Skip to content

Commit

Permalink
upgrade volnurable version of jinja
Browse files Browse the repository at this point in the history
ruff
  • Loading branch information
andgineer committed Jan 15, 2024
1 parent 34b4f1a commit 197bbb8
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 81 deletions.
76 changes: 9 additions & 67 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,75 +4,17 @@ exclude: |
version.py|
conftest.py
)
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
args: ["--unsafe"]
- id: check-added-large-files

- repo: https://github.com/myint/autoflake
rev: v2.2.1
hooks:
- id: autoflake
name: Cleanup imports
args:
- --in-place
- --remove-all-unused-imports
- --expand-star-imports
- --ignore-init-module-imports

- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.10.1
hooks:
- id: isort
name: Sorts imports
args: [
# Align isort with black formatting
"--multi-line=3",
"--trailing-comma",
"--force-grid-wrap=0",
"--use-parentheses",
"--line-width=99",
]
- repo: https://github.com/psf/black
rev: 23.12.1
hooks:
- id: black
name: Fixes formatting
language_version: python3
args: ["--line-length=99"]

- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
name: Checks pep8 style
args:
- --max-line-length=99
# F405 - init imports * from module
# F401 - ignore imports used in init
# F403 - import * used in init
- --exclude=__init__.py
# ignore long comments (E501), as long lines are formatted by black
# ignore Whitespace before ':' (E203)
# ignore Line break occurred before a binary operator (W503)
# ignore module level import not at top of file (E402) to skip tests with uninstalled modules (pytest.importorskip)
- --ignore=E501,E203,W503,E402

- repo: https://github.com/PyCQA/pydocstyle
rev: 6.3.0
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.13
hooks:
- id: pydocstyle
name: docstrings
entry: pydocstyle
language: python
args:
- --ignore=D100,D203,D405,D407,D213,D413
# Run the linter.
- id: ruff
args: [ --fix ]
# Run the formatter.
- id: ruff-format

- repo: local
hooks:
Expand Down
1 change: 1 addition & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
line-length = 99
12 changes: 6 additions & 6 deletions requirements.dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ google-api-core==2.15.0
# via
# -r requirements.txt
# google-api-python-client
google-api-python-client==2.111.0
google-api-python-client==2.113.0
# via -r requirements.txt
google-auth==2.25.2
google-auth==2.26.2
# via
# -r requirements.txt
# google-api-core
Expand Down Expand Up @@ -90,11 +90,11 @@ iniconfig==2.0.0
# via pytest
isort==5.13.2
# via pylint
jinja2==3.1.2
jinja2==3.1.3
# via mkdocs
lazydocs==0.4.8
# via -r requirements.dev.in
markdown==3.5.1
markdown==3.5.2
# via mkdocs
markupsafe==2.1.3
# via
Expand Down Expand Up @@ -138,7 +138,7 @@ pluggy==1.3.0
# via pytest
pre-commit==3.6.0
# via -r requirements.dev.in
protobuf==4.25.1
protobuf==4.25.2
# via
# -r requirements.txt
# google-api-core
Expand Down Expand Up @@ -172,7 +172,7 @@ pyparsing==3.1.1
# httplib2
pyproject-hooks==1.0.0
# via build
pytest==7.4.3
pytest==7.4.4
# via
# -r requirements.dev.in
# pytest-cov
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ charset-normalizer==3.3.2
# via requests
google-api-core==2.15.0
# via google-api-python-client
google-api-python-client==2.111.0
google-api-python-client==2.113.0
# via -r requirements.in
google-auth==2.25.2
google-auth==2.26.2
# via
# google-api-core
# google-api-python-client
Expand All @@ -37,7 +37,7 @@ idna==3.6
# via requests
oauth2client==4.1.3
# via -r requirements.in
protobuf==4.25.1
protobuf==4.25.2
# via
# google-api-core
# googleapis-common-protos
Expand Down
16 changes: 12 additions & 4 deletions src/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ def action(self, button: str, dry_run: bool = False) -> None:
traceback.print_exception(*sys.exc_info())

def ifttt_action(
self, button: str, action_params: models.IftttAction # pylint: disable=unused-argument
self,
button: str, # pylint: disable=unused-argument
action_params: models.IftttAction,
) -> None:
"""Register event in IFTTT."""
ifttt = Ifttt(self.settings)
Expand All @@ -155,21 +157,27 @@ def ifttt_action(
)

def openhab_action(
self, button: str, action_params: models.OpenhabAction # pylint: disable=unused-argument
self,
button: str, # pylint: disable=unused-argument
action_params: models.OpenhabAction,
) -> None:
"""Register event in OpenHab."""
openhab = OpenHab(self.settings)
openhab.press(action_params)

def calendar_action(
self, button: str, action_params: models.CalendarAction # pylint: disable=unused-argument
self,
button: str, # pylint: disable=unused-argument
action_params: models.CalendarAction,
) -> None:
"""Register event in Google Calendar."""
calendar = Calendar(self.settings, action_params.calendar_id)
self.event(calendar, action_params)

def sheet_action(
self, button: str, action_params: models.SheetAction # pylint: disable=unused-argument
self,
button: str, # pylint: disable=unused-argument
action_params: models.SheetAction,
) -> None:
"""Register event in Google Sheet."""
sheet = Sheet(
Expand Down
3 changes: 2 additions & 1 deletion src/google_calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ def get_last_event(self, summary: str) -> Tuple[Optional[str], Optional[List[Any
def delete_event(self, event_id: str) -> None:
"""Delete event from Google Calendar."""
self.service().events().delete(
calendarId=self.calendarId, eventId=event_id # 'primary',
calendarId=self.calendarId,
eventId=event_id, # 'primary',
).execute()

def close_event(self, event_id: Union[int, str], close_time: datetime.datetime) -> None:
Expand Down

0 comments on commit 197bbb8

Please sign in to comment.