Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions .flake8

This file was deleted.

19 changes: 4 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,11 @@ repos:
hooks:
- id: black

- repo: https://github.com/PyCQA/flake8
rev: 3.9.2
- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: "v0.0.191"
hooks:
- id: flake8
pass_filenames: true

- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort

- repo: https://github.com/asottile/pyupgrade
rev: v2.37.3
hooks:
- id: pyupgrade
args: [--py38-plus]
- id: ruff

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.7.1
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ Source = "https://github.com/scientific-python/yaml2ics"

[tool.flit.sdist]
exclude = ["tests/*"]

[tool.ruff]
select = ["F", "E", "W", "I", "UP"]
13 changes: 8 additions & 5 deletions yaml2ics.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ def datetime2utc(date):


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

if not len(interval) == 1:
print(
"Error: interval must specify seconds, minutes, hours, days, weeks, months, or years only",
"Error: interval must specify seconds, minutes, hours, days, "
"weeks, months, or years only",
file=sys.stderr,
)
sys.exit(-1)

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

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

rrule = dateutil.rrule.rrule(
Expand Down