@@ -114,31 +114,38 @@ def _thai_strftime(datetime: datetime.datetime, fmt_char: str) -> str:
114114 )
115115 elif fmt_char == "D" :
116116 # Equivalent to ``%m/%d/%y''
117- str_ = "{}/{}" .format (datetime .strftime ("%m/%d" ),
118- str (datetime .year + _BE_AD_DIFFERENCE )[- 2 :])
117+ str_ = "{}/{}" .format (
118+ datetime .strftime ("%m/%d" ),
119+ str (datetime .year + _BE_AD_DIFFERENCE )[- 2 :],
120+ )
119121 elif fmt_char == "F" :
120122 # Equivalent to ``%Y-%m-%d''
121- str_ = "{}-{}" .format (str (datetime .year + _BE_AD_DIFFERENCE ),
122- datetime .strftime ("%m-%d" ))
123+ str_ = "{}-{}" .format (
124+ str (datetime .year + _BE_AD_DIFFERENCE ), datetime .strftime ("%m-%d" )
125+ )
123126 elif fmt_char == "G" :
124- # ISO 8601 year with century representing the year that contains the greater part of the ISO week (%V). Monday as the first day of the week.
127+ # ISO 8601 year with century representing the year that contains the
128+ # greater part of the ISO week (%V). Monday as the first day of the week.
125129 str_ = str (int (datetime .strftime ("%G" )) + _BE_AD_DIFFERENCE )
126130 elif fmt_char == "g" :
127131 # Same year as in ``%G'', but as a decimal number without century (00-99).
128132 str_ = str (int (datetime .strftime ("%G" )) + _BE_AD_DIFFERENCE )[- 2 :]
129133 elif fmt_char == "v" :
130134 # BSD extension, ' 6-Oct-1976'
131- str_ = "{:>2}-{}-{}" .format (datetime .day ,
132- thai_abbr_months [datetime .month - 1 ],
133- datetime .year + _BE_AD_DIFFERENCE )
135+ str_ = "{:>2}-{}-{}" .format (
136+ datetime .day ,
137+ thai_abbr_months [datetime .month - 1 ],
138+ datetime .year + _BE_AD_DIFFERENCE ,
139+ )
134140 elif fmt_char == "X" :
135141 # Locale’s appropriate time representation.
136142 str_ = datetime .strftime ("%H:%M:%S" )
137143 elif fmt_char == "x" :
138144 # Locale’s appropriate date representation.
139145 str_ = "{}/{}/{}" .format (
140- _padding (datetime .day ), _padding (
141- datetime .month ), datetime .year + _BE_AD_DIFFERENCE
146+ _padding (datetime .day ),
147+ _padding (datetime .month ),
148+ datetime .year + _BE_AD_DIFFERENCE ,
142149 )
143150 elif fmt_char == "Y" :
144151 # Year with century
@@ -147,7 +154,8 @@ def _thai_strftime(datetime: datetime.datetime, fmt_char: str) -> str:
147154 # Year without century
148155 str_ = str (datetime .year + _BE_AD_DIFFERENCE )[2 :4 ]
149156 elif fmt_char == "+" :
150- # National representation of the date and time (the format is similar to that produced by date(1))
157+ # National representation of the date and time
158+ # (the format is similar to that produced by date(1))
151159 # Wed 6 Oct 1976 01:40:00
152160 str_ = "{:<2} {:>2} {} {} {}" .format (
153161 thai_abbr_weekdays [datetime .weekday ()],
@@ -278,10 +286,13 @@ def thai_strftime(
278286 ): # check if requires localization
279287 str_ = _thai_strftime (datetime , fmt_char_nopad )
280288 else :
289+ # Windows may not support this
281290 str_ = datetime .strftime (f"%-{ fmt_char_nopad } " )
282291 i = i + 1 # consume char after "-"
283292 else :
284- str_ = "-" # "-" at the end of string has no meaning
293+ str_ = (
294+ "-"
295+ ) # "-" at the end of string has no meaning
285296 elif fmt_char == "_" :
286297 # GNU libc extension, explicitly specify space (" ") for padding
287298 # Not implemented yet
0 commit comments