Skip to content

Commit e097010

Browse files
committed
Use yapf for code formatting
1 parent 1aca997 commit e097010

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

domdf_python_tools/dates.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ def get_utc_offset(tz, date: datetime.datetime = None) -> datetime.timedelta:
6161

6262
return date.replace(tzinfo=pytz.utc).astimezone(tz).utcoffset()
6363

64-
6564
def get_timezone(tz: str, date: datetime.datetime = None) -> datetime.timedelta:
6665
"""
6766
Returns a localized :class:`pytz.timezone` object for the given date.
@@ -82,7 +81,6 @@ def get_timezone(tz: str, date: datetime.datetime = None) -> datetime.timedelta:
8281

8382
return pytz.timezone(tz).localize(d).tzinfo
8483

85-
8684
def current_tzinfo():
8785
"""
8886
Returns a tzinfo object for the current timezone
@@ -127,8 +125,9 @@ def set_timezone(obj, tzinfo):
127125

128126
return obj.replace(tzinfo=tzinfo)
129127

130-
131-
def utc_timestamp_to_datetime(utc_timestamp: Union[float, int], output_tz: datetime.tzinfo = None) -> datetime.datetime:
128+
def utc_timestamp_to_datetime(
129+
utc_timestamp: Union[float, int], output_tz: datetime.tzinfo = None
130+
) -> datetime.datetime:
132131
"""
133132
Convert UTC timestamp (seconds from UNIX epoch) to a :class:`datetime.datetime` object
134133
@@ -157,7 +156,6 @@ def utc_timestamp_to_datetime(utc_timestamp: Union[float, int], output_tz: datet
157156
new_datetime = datetime.datetime.fromtimestamp(utc_timestamp, output_tz)
158157
return new_datetime.astimezone(output_tz)
159158

160-
161159
# List of months and their 3-character shortcodes.
162160
months = OrderedDict(
163161
Jan="January",
@@ -174,7 +172,6 @@ def utc_timestamp_to_datetime(utc_timestamp: Union[float, int], output_tz: datet
174172
Dec="December",
175173
)
176174

177-
178175
def parse_month(month: Union[str, int]) -> str:
179176
"""
180177
Converts an integer or shorthand month into the full month name
@@ -200,7 +197,6 @@ def parse_month(month: Union[str, int]) -> str:
200197
else:
201198
raise ValueError("Unrecognised month value")
202199

203-
204200
def get_month_number(month: Union[str, int]) -> int:
205201
"""
206202
Returns the number of the given month. If ``month`` is already a

domdf_python_tools/enums.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828

2929
__all__ = ["IntEnum", "StrEnum"]
3030

31-
3231
# class IntEnum(Enum):
3332
# """
3433
# An Enum that can be converted into an integer
@@ -51,6 +50,7 @@ class StrEnum(str, Enum):
5150

5251
def __str__(self):
5352
return self.value
53+
5454
#
5555
# def __repr__(self):
5656
# return self.value

tests/test_bases.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,5 @@ def test_namedlist(capsys):
115115
assert stdout[0] == "<class 'domdf_python_tools.bases.namedlist.<locals>.NamedList'>"
116116
assert stdout[1] == "['egg and bacon', 'egg sausage and bacon', 'egg and spam', 'egg bacon and spam']"
117117
assert stdout[2] == (
118-
"ShoppingList['egg and bacon', 'egg sausage and bacon', 'egg and spam', 'egg bacon and spam']")
118+
"ShoppingList['egg and bacon', 'egg sausage and bacon', 'egg and spam', 'egg bacon and spam']"
119+
)

0 commit comments

Comments
 (0)