Skip to content

Commit 0cc1969

Browse files
authored
Switch from flake8 to ruff (#47)
1 parent b3279c5 commit 0cc1969

4 files changed

Lines changed: 15 additions & 36 deletions

File tree

.flake8

Lines changed: 0 additions & 16 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,11 @@ repos:
2121
hooks:
2222
- id: black
2323

24-
- repo: https://github.com/PyCQA/flake8
25-
rev: 3.9.2
24+
- repo: https://github.com/charliermarsh/ruff-pre-commit
25+
# Ruff version.
26+
rev: "v0.0.191"
2627
hooks:
27-
- id: flake8
28-
pass_filenames: true
29-
30-
- repo: https://github.com/pycqa/isort
31-
rev: 5.10.1
32-
hooks:
33-
- id: isort
34-
35-
- repo: https://github.com/asottile/pyupgrade
36-
rev: v2.37.3
37-
hooks:
38-
- id: pyupgrade
39-
args: [--py38-plus]
28+
- id: ruff
4029

4130
- repo: https://github.com/pre-commit/mirrors-prettier
4231
rev: v2.7.1

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,6 @@ Source = "https://github.com/scientific-python/yaml2ics"
3939

4040
[tool.flit.sdist]
4141
exclude = ["tests/*"]
42+
43+
[tool.ruff]
44+
select = ["F", "E", "W", "I", "UP"]

yaml2ics.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ def datetime2utc(date):
3333

3434

3535
# See RFC2445, 4.8.5 REcurrence Component Properties
36-
# This function can be used to add a list of e.g. exception dates (EXDATE) or recurrence dates (RDATE)
37-
# to a reoccurring event
36+
# This function can be used to add a list of e.g. exception dates (EXDATE) or
37+
# recurrence dates (RDATE) to a reoccurring event
3838
def add_recurrence_property(
3939
event: ics.Event, property_name, dates: map, tz: datetime.tzinfo = None
4040
):
@@ -76,15 +76,17 @@ def event_from_yaml(event_yaml: dict, tz: datetime.tzinfo = None) -> ics.Event:
7676

7777
if not len(interval) == 1:
7878
print(
79-
"Error: interval must specify seconds, minutes, hours, days, weeks, months, or years only",
79+
"Error: interval must specify seconds, minutes, hours, days, "
80+
"weeks, months, or years only",
8081
file=sys.stderr,
8182
)
8283
sys.exit(-1)
8384

8485
interval_measure = list(interval.keys())[0]
8586
if interval_measure not in interval_type:
8687
print(
87-
"Error: expected interval to be specified in seconds, minutes, hours, days, weeks, months, or years only",
88+
"Error: expected interval to be specified in seconds, minutes, "
89+
"hours, days, weeks, months, or years only",
8890
file=sys.stderr,
8991
)
9092
sys.exit(-1)
@@ -93,7 +95,8 @@ def event_from_yaml(event_yaml: dict, tz: datetime.tzinfo = None) -> ics.Event:
9395
print("Error: must specify end date for repeating events", file=sys.stderr)
9496
sys.exit(-1)
9597

96-
# This causes zero-length events, I guess overriding whatever duration might have been specified.
98+
# This causes zero-length events, I guess overriding whatever duration
99+
# might have been specified
97100
# event.end = d.get('end', None)
98101

99102
rrule = dateutil.rrule.rrule(

0 commit comments

Comments
 (0)