Skip to content

Commit

Permalink
🚨 Improve code
Browse files Browse the repository at this point in the history
  • Loading branch information
kinegratii committed Jan 18, 2024
1 parent 02105b4 commit f4578e4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion borax/calendars/festivals2.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
'FreqConst', 'Festival', 'FestivalSchema',
'SolarFestival', 'LunarFestival', 'WeekFestival', 'TermFestival',
'encode', 'decode', 'decode_festival',
'FestivalLibrary',
'FestivalLibrary', 'ConditionUtils'
]

MixedDate = Union[date, LunarDate]
Expand Down
4 changes: 2 additions & 2 deletions borax/calendars/lunardate.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,8 @@ def gz2offset(gz: str) -> int:
if x % 2 != y % 2:
raise ValueError
return (6 * x - 5 * y) % 60
except (TypeError, ValueError):
raise ValueError(f'Invalid gz string: {gz}')
except (TypeError, ValueError) as e:
raise ValueError(f'Invalid gz string: {gz}') from e

@staticmethod
def offset2gz(offset: int) -> str:
Expand Down
6 changes: 3 additions & 3 deletions borax/calendars/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def _init_widgets(self):
bw, bh = 3, 1
tool_row_no, head_row_no, week_row_no, day_row_no = range(4)

today_btn = tk.Button(self, text='今日', relief=tk.GROOVE, command=lambda: self._nav_current_month())
today_btn = tk.Button(self, text='今日', relief=tk.GROOVE, command=self._nav_current_month)
today_btn.grid(row=0, column=5, sticky='wens', columnspan=2, pady=4)
pre_btn = tk.Button(self, text='\u25C4', width=bw, height=bh, command=lambda: self.page_to(-1),
relief=tk.GROOVE)
Expand Down Expand Up @@ -85,12 +85,12 @@ def _update_calendar_cell_values(self, event=None):
month = self._v_month.get()
cell_index = 0
_mi, _ma, _left_zero = -1, -1, 0
for day, text, wd in self._library.iter_month_daytuples(year, month):
for day, text, _ in self._library.iter_month_daytuples(year, month):
if day == 0:
day_text = ''
_left_zero += int(_mi == -1)
else:
day_text = '{}\n{}'.format(day, text)
day_text = f'{day}\n{text}'
if day == 1:
_mi = cell_index
_ma += 1
Expand Down
2 changes: 1 addition & 1 deletion borax/capp/borax_calendar_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
class WDateVar(tk.StringVar):

def __init__(self, master=None, value=None, name=None, date_fmt='%Y-%m-%d'):
tk.Variable.__init__(self, master, value, name)
super().__init__(master, value, name)
self._date_object = None
self._date_fmt = date_fmt

Expand Down

0 comments on commit f4578e4

Please sign in to comment.