Skip to content

Commit

Permalink
refactor: consolidate periods module types
Browse files Browse the repository at this point in the history
  • Loading branch information
bonjourmauko committed Nov 21, 2024
1 parent 21f4850 commit d865806
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 208 deletions.
12 changes: 5 additions & 7 deletions openfisca_core/periods/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#
# See: https://www.python.org/dev/peps/pep-0008/#imports

from . import types
from ._errors import InstantError, ParserError, PeriodError
from .config import (
INSTANT_PATTERN,
Expand Down Expand Up @@ -52,27 +51,26 @@

__all__ = [
"DAY",
"DateUnit",
"ETERNITY",
"INSTANT_PATTERN",
"ISOCALENDAR",
"ISOFORMAT",
"MONTH",
"WEEK",
"WEEKDAY",
"YEAR",
"DateUnit",
"Instant",
"InstantError",
"MONTH",
"ParserError",
"Period",
"PeriodError",
"WEEK",
"WEEKDAY",
"YEAR",
"date_by_instant_cache",
"instant",
"instant_date",
"key_period_size",
"period",
"str_by_instant_cache",
"types",
"unit_weight",
"unit_weights",
"year_or_month_or_day_re",
Expand Down
3 changes: 2 additions & 1 deletion openfisca_core/periods/_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

import pendulum

from . import types as t
from openfisca_core import types as t

from ._errors import InstantError, ParserError, PeriodError
from .date_unit import DateUnit
from .instant_ import Instant
Expand Down
2 changes: 1 addition & 1 deletion openfisca_core/periods/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pendulum

from . import types as t
from openfisca_core import types as t

# Matches "2015", "2015-01", "2015-01-01"
# Does not match "2015-13", "2015-12-32"
Expand Down
2 changes: 1 addition & 1 deletion openfisca_core/periods/date_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from strenum import StrEnum

from . import types as t
from openfisca_core import types as t


class DateUnitMeta(EnumMeta):
Expand Down
4 changes: 3 additions & 1 deletion openfisca_core/periods/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@

import pendulum

from . import config, types as t
from openfisca_core import types as t

from . import config
from ._errors import InstantError, PeriodError
from ._parsers import parse_instant, parse_period
from .date_unit import DateUnit
Expand Down
4 changes: 3 additions & 1 deletion openfisca_core/periods/instant_.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import pendulum

from . import config, types as t
from openfisca_core import types as t

from . import config
from .date_unit import DateUnit


Expand Down
4 changes: 3 additions & 1 deletion openfisca_core/periods/period_.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@

import pendulum

from . import helpers, types as t
from openfisca_core import types as t

from . import helpers
from .date_unit import DateUnit
from .instant_ import Instant

Expand Down
183 changes: 0 additions & 183 deletions openfisca_core/periods/types.py

This file was deleted.

Loading

0 comments on commit d865806

Please sign in to comment.