Skip to content

Commit

Permalink
lint everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
seekinginfiniteloop committed Jan 16, 2024
1 parent 5ef5802 commit 104d364
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
29 changes: 17 additions & 12 deletions fedcal/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
from functools import total_ordering
from typing import Any, Callable, Generator, Iterable, Mapping, Type

import attr

from fedcal._typing import EnumType


Expand Down Expand Up @@ -311,7 +309,10 @@ def list_member_attrs(cls, member: EnumType) -> list[Any]:
"""
Simple classmethod to return the attributes of members.
"""
return sorted(member.value + ([getattr(member, attr) for attr in cls._lookup_attributes()]))
return sorted(
member.value
+ ([getattr(member, attr) for attr in cls._lookup_attributes()])
)

@classmethod
def members(cls) -> list[Type[EnumType]]:
Expand Down Expand Up @@ -351,26 +352,30 @@ def val_attr_map(cls) -> Mapping[Any, Any]:
Returns
-------
_description_
Returns dictionary map of member' values to its attributes
"""
member_attrs = [cls.list_member_attrs(member=x) if x in cls._member_names_ else None for x in cls._member_names_]
return dict(zip(cls._member_names_, cls._value2member_map_.values(), member_attrs))

member_attrs = [
cls.list_member_attrs(member=x) if x in cls._member_names_ else None
for x in cls._member_names_
]
return dict(
zip(cls._member_names_, cls._value2member_map_.values(), member_attrs)
)

@classmethod
def attr_member_map(cls, attr: str) -> Mapping[Any, Any]:
return {getattr(cls.members(), attr): item for item in cls.val_attr_map().items()}

return {
getattr(cls.members(), attr): item for item in cls.val_attr_map().items()
}

@classmethod
def get_reverse_member_value_map(cls) -> Mapping[Any, Any]:
return cls._value2member_map_

@classmethod
def member_dict(cls) -> Mapping[Any, Any]:
return dict(cls.members(): cls.list_member_attrs(member) for member in cls.members() if member.value is not None)


members = cls.members()
return {member: cls.list_member_attrs(member=member) for member in members}


__all__: list[str] = ["EnumBase", "HandyEnumMixin", "MagicDelegator"]
2 changes: 1 addition & 1 deletion fedcal/_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

if TYPE_CHECKING:
from fedcal.utils import YearMonthDay
from fedcal.enum import Dept, DeptStatus, EnumBase
from fedcal.enum import EnumBase

TimestampSeries = "Series[Timestamp]"

Expand Down
3 changes: 1 addition & 2 deletions fedcal/fedstamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import pandas as pd
from pandas import MultiIndex, Timestamp

from fedcal import offsets, utils
from fedcal._base import MagicDelegator
from fedcal.enum import Dept, DeptStatus
from fedcal._status_factory import fetch_index
Expand Down Expand Up @@ -355,7 +354,7 @@ def business_day(self) -> bool:
True if the date is a business day, False otherwise.
"""
b_day: FedBusinessDay = offsets.FedBusinessDay()
b_day: FedBusinessDay = FedBusinessDay()
return b_day.is_on_offset(dt=self.ts)

# instance cache
Expand Down
2 changes: 1 addition & 1 deletion fedcal/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ def to_timestamp(date_input: FedStampConvertibleTypes) -> Timestamp | None:
We roll our own here because pd.to_datetime has multiple outputs depending
on input type, and we want to consistently get Timestamps and normalize
them. This also allows us to add some flexibility to how to_datetime
handles input.
handles input.
Parameters
----------
Expand Down

0 comments on commit 104d364

Please sign in to comment.