diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ecbafa9..3f0b49c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,7 +12,7 @@ default_language_version: repos: - repo: https://github.com/commitizen-tools/commitizen - rev: v3.27.0 + rev: v4.1.0 hooks: - id: commitizen stages: @@ -27,7 +27,7 @@ repos: pass_filenames: false - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.5 + rev: v0.8.3 hooks: - id: ruff args: [--fix] @@ -41,7 +41,7 @@ repos: args: ["--in-place", "--config", "./pyproject.toml"] - repo: https://github.com/pre-commit/mirrors-mypy - rev: 'v1.10.0' + rev: 'v1.13.0' hooks: - id: mypy additional_dependencies: [ diff --git a/pyoda_time/__init__.py b/pyoda_time/__init__.py index a710f7d..452c407 100644 --- a/pyoda_time/__init__.py +++ b/pyoda_time/__init__.py @@ -5,13 +5,6 @@ __version__ = "0.9.3" __all__: list[str] = [ - "calendars", - "fields", - "globalization", - "testing", - "text", - "time_zones", - "utility", "AmbiguousTimeError", "AnnualDate", "CalendarSystem", @@ -26,8 +19,8 @@ "Interval", "IsoDayOfWeek", "LocalDate", - "LocalTime", "LocalDateTime", + "LocalTime", "Offset", "OffsetDateTime", "OffsetTime", @@ -41,6 +34,13 @@ "YearMonth", "ZonedClock", "ZonedDateTime", + "calendars", + "fields", + "globalization", + "testing", + "text", + "time_zones", + "utility", ] diff --git a/pyoda_time/_compatibility/_culture_data.py b/pyoda_time/_compatibility/_culture_data.py index d2c59ab..899f275 100644 --- a/pyoda_time/_compatibility/_culture_data.py +++ b/pyoda_time/_compatibility/_culture_data.py @@ -361,7 +361,7 @@ def __create_culture_data(cls, culture_name: str, use_user_override: bool) -> _C cd._iLanguage = CultureInfo._LOCALE_CUSTOM_UNSPECIFIED return cd - if len(culture_name) == 1 and culture_name[0] == "C" or culture_name[0] == "c": + if (len(culture_name) == 1 and culture_name[0] == "C") or culture_name[0] == "c": # Always map the "C" locale to Invariant to avoid mapping it to en_US_POSIX on Linux because POSIX # locale collation doesn't support case insensitive comparisons. # We do the same mapping on Windows for the sake of consistency. diff --git a/pyoda_time/_interval.py b/pyoda_time/_interval.py index e06af94..17c1910 100644 --- a/pyoda_time/_interval.py +++ b/pyoda_time/_interval.py @@ -31,7 +31,7 @@ class Interval: The default value of this type is an empty interval with a start and end of ``PyodaConstant.UNIX_EPOCH``. """ - __slots__ = ("__start", "__end") + __slots__ = ("__end", "__start") def __init__( self, start: Instant | None = PyodaConstants.UNIX_EPOCH, end: Instant | None = PyodaConstants.UNIX_EPOCH diff --git a/pyoda_time/calendars/__init__.py b/pyoda_time/calendars/__init__.py index 862ca60..2a9e0d9 100644 --- a/pyoda_time/calendars/__init__.py +++ b/pyoda_time/calendars/__init__.py @@ -6,9 +6,9 @@ "CalendarWeekRule", "Era", "HebrewMonthNumbering", + "IWeekYearRule", "IslamicEpoch", "IslamicLeapYearPattern", - "IWeekYearRule", "WeekYearRules", ] diff --git a/pyoda_time/testing/__init__.py b/pyoda_time/testing/__init__.py index dc5fa94..c46a8c3 100644 --- a/pyoda_time/testing/__init__.py +++ b/pyoda_time/testing/__init__.py @@ -3,8 +3,8 @@ # as found in the LICENSE.txt file. __all__ = [ - "time_zones", "FakeClock", + "time_zones", ] from . import time_zones diff --git a/pyoda_time/testing/_fake_clock.py b/pyoda_time/testing/_fake_clock.py index dc03e3c..033bbdc 100644 --- a/pyoda_time/testing/_fake_clock.py +++ b/pyoda_time/testing/_fake_clock.py @@ -26,9 +26,9 @@ class FakeClock(IClock): """ __slots__ = ( + "__auto_advance", "__lock", "__now", - "__auto_advance", ) def __init__(self, initial: Instant, auto_advance: Duration = Duration.zero) -> None: diff --git a/pyoda_time/text/__init__.py b/pyoda_time/text/__init__.py index ca88d77..95f56eb 100644 --- a/pyoda_time/text/__init__.py +++ b/pyoda_time/text/__init__.py @@ -3,7 +3,6 @@ # as found in the LICENSE.txt file. __all__: list[str] = [ - "patterns", "AnnualDatePattern", "DurationPattern", "InstantPattern", @@ -14,6 +13,7 @@ "OffsetPattern", "ParseResult", "UnparsableValueError", + "patterns", ] from ._annual_date_pattern import AnnualDatePattern diff --git a/pyoda_time/text/patterns/_date_pattern_helper.py b/pyoda_time/text/patterns/_date_pattern_helper.py index efb5b79..80bb66f 100644 --- a/pyoda_time/text/patterns/_date_pattern_helper.py +++ b/pyoda_time/text/patterns/_date_pattern_helper.py @@ -150,7 +150,7 @@ def build_format_action(self, final_fields: _PatternFields) -> Callable[[T, Stri text_values = self.__format_info.long_month_names def format_action(value: T, sb: StringBuilder) -> None: - sb.append(text_values[self.__getter(value)]) + sb.append(text_values[self.__getter(value)]) # type: ignore[arg-type] return format_action diff --git a/pyoda_time/time_zones/__init__.py b/pyoda_time/time_zones/__init__.py index 3692bfe..e3bd5c2 100644 --- a/pyoda_time/time_zones/__init__.py +++ b/pyoda_time/time_zones/__init__.py @@ -3,8 +3,6 @@ # as found in the LICENSE.txt file. __all__ = [ - "cldr", - "io", "DateTimeZoneCache", "DateTimeZoneNotFoundError", "IDateTimeZoneSource", @@ -13,6 +11,8 @@ "TzdbZoneLocation", "ZoneInterval", "ZoneLocalMapping", + "cldr", + "io", ] from . import cldr, io diff --git a/pyproject.toml b/pyproject.toml index b7882ea..9490e4a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,10 +63,7 @@ warn_unused_ignores = true line-length = 120 [tool.ruff.lint] -# Allow fix for all enabled rules (when `--fix`) is provided. fixable = ["ALL"] -unfixable = [] - select = [ "E", # pycodestyle (error) "F", # pyflakes @@ -75,4 +72,5 @@ select = [ "UP", # pyupgrade "W", # pycodestyle (warning) ] +unfixable = []