Skip to content

Commit d3c4943

Browse files
committed
Make calculate_f_year_f_dev private
1 parent 64186c2 commit d3c4943

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

pythainlp/util/thai_lunar_date.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# SPDX-FileType: SOURCE
44
# SPDX-License-Identifier: Apache-2.0
55
"""
6-
This file is port from
6+
This file is a port from
77
> https://gist.github.com/touchiep/99f4f5bb349d6b983ef78697630ab78e
88
"""
99

@@ -223,7 +223,7 @@
223223
}
224224

225225

226-
def calculate_f_year_f_dev(year: int) -> Tuple[int, float]:
226+
def _calculate_f_year_f_dev(year: int) -> Tuple[int, float]:
227227
if year in _YEAR_DEV:
228228
return year, _YEAR_DEV[year]
229229

@@ -239,6 +239,7 @@ def athikamas(year: int) -> bool:
239239
def athikavar(year: int) -> bool:
240240
if athikamas(year):
241241
return False
242+
242243
if athikamas(year + 1):
243244
cutoff = 1.69501433191599e-02
244245
else:
@@ -249,7 +250,7 @@ def athikavar(year: int) -> bool:
249250
def deviation(year: int) -> float:
250251
curr_dev = 0.0
251252
last_dev = 0.0
252-
f_year, f_dev = calculate_f_year_f_dev(year)
253+
f_year, f_dev = _calculate_f_year_f_dev(year)
253254
if year == f_year:
254255
curr_dev = f_dev
255256
else:
@@ -266,6 +267,7 @@ def deviation(year: int) -> float:
266267
else:
267268
curr_dev = 0.367056
268269
curr_dev = last_dev + curr_dev
270+
269271
return curr_dev
270272

271273

@@ -280,7 +282,7 @@ def last_day_in_year(year: int) -> int:
280282

281283
def athikasurathin(year: int) -> bool:
282284
"""
283-
athikasurathin - Check if a year is a leap year in the Thai lunar calendar
285+
Check if a year is a leap year in the Thai lunar calendar
284286
"""
285287
# Check divisibility by 400 (divisible by 400 is always a leap year)
286288
if year % 400 == 0:
@@ -312,7 +314,7 @@ def th_zodiac(year: int, output_type: int = 1) -> Union[str, int]:
312314
Converts a Gregorian year to its corresponding Zodiac name.
313315
314316
:param int year: The Gregorian year. AD (Anno Domini)
315-
:param int output_type: Output Type (1 = Thai, 2 = English, 3 = Number).
317+
:param int output_type: Output type (1 = Thai, 2 = English, 3 = Number).
316318
317319
:return: The Zodiac name or number corresponding to the input year.
318320
:rtype: Union[str, int]

0 commit comments

Comments
 (0)