Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix linting issues introducd by #14 #17

Merged
merged 1 commit into from
Nov 8, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ on:
tags:
- "*"
pull_request:
branches:
- main
schedule:
# Run every Monday at 8am to check latest versions of dependencies
- cron: "0 8 * * MON"
Expand Down Expand Up @@ -57,12 +59,11 @@ jobs:
matrix:
os: ["ubuntu-latest"] # can add windows-latest, macos-latest
python: ["3.10", "3.11", "3.12"]
pipenv: ["skip-lock"]

pipenv: [""]
include:
# Add an extra Python3.8 runner to use the lockfile
# Add an extra Python3.10 runner to use the lockfile
- os: "ubuntu-latest"
python: "3.8"
python: "3.10"
pipenv: "deploy"

runs-on: ${{ matrix.os }}
Expand Down
1,065 changes: 545 additions & 520 deletions Pipfile.lock

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ install_requires =
[options.extras_require]
# For development tests/docs
dev =
black>=22.3.0
black>=23.1.0
isort>5.0
pytest-cov
mypy
Expand Down Expand Up @@ -75,9 +75,12 @@ float_to_top=true
# Make flake8 respect black's line length (default 88),
max-line-length = 88
extend-ignore =
E203, # See https://github.com/PyCQA/pycodestyle/issues/373
F811, # support typing.overload decorator
F722, # allow Annotated[typ, some_func("some string")]
# See https://github.com/PyCQA/pycodestyle/issues/373
E203,
# support typing.overload decorator
F811,
# allow Annotated[typ, some_func("some string")]
F722

[tool:pytest]
# Run pytest with all our checkers, and don't spam us with massive tracebacks on error
Expand Down
2 changes: 1 addition & 1 deletion src/maaspower/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# import all subclasses of SwitchDevice so ApiSchema sees them
from .devices.shell_cmd import CommandLine
from .devices.smart_thing import SmartThing
from .devices.web_ui import WebGui
from .devices.web_device import WebDevice
from .devices.web_ui import WebGui
from .maasconfig import MaasConfig
from .webhook import run_web_hook

Expand Down
6 changes: 3 additions & 3 deletions src/maaspower/devices/shell_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
import subprocess
from dataclasses import dataclass

from typing import Optional
from typing_extensions import Literal, Annotated as A
from typing_extensions import Annotated as A
from typing_extensions import Literal

from maaspower.maasconfig import RegexSwitchDevice
from maaspower.maas_globals import desc
from maaspower.maasconfig import RegexSwitchDevice


@dataclass(kw_only=True)
Expand Down
6 changes: 3 additions & 3 deletions src/maaspower/devices/smart_thing.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
"""
import asyncio
from dataclasses import dataclass
from typing import Optional

import aiohttp
from pysmartthings import SmartThings
from typing_extensions import Literal, Annotated as A
from typing_extensions import Annotated as A
from typing_extensions import Literal

from maaspower.maasconfig import RegexSwitchDevice
from maaspower.maas_globals import desc
from maaspower.maasconfig import RegexSwitchDevice


@dataclass(kw_only=True)
Expand Down
5 changes: 3 additions & 2 deletions src/maaspower/devices/web_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
from dataclasses import dataclass
from typing import Optional, cast

from typing_extensions import Literal, Annotated as A
from typing_extensions import Annotated as A
from typing_extensions import Literal

from maaspower.maasconfig import MaasConfig, SwitchDevice
from maaspower.maas_globals import desc
from maaspower.maasconfig import MaasConfig, SwitchDevice

from ..webhook import app
from .web_ui import WebGui
Expand Down
3 changes: 1 addition & 2 deletions src/maaspower/devices/web_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
from typing_extensions import Annotated as A
from typing_extensions import Literal

from maaspower.maasconfig import RegexSwitchDevice
from maaspower.maas_globals import desc

from maaspower.maasconfig import RegexSwitchDevice

command_regex = re.compile(r"([^\/]*)\/([^\/]*)\/?([^\/]*)?\/?([^\/]*)?$")
index_regex = re.compile(r"(.*)\[([0-9]*)\]")
Expand Down
4 changes: 3 additions & 1 deletion src/maaspower/maasconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@

from apischema import deserialize, identity
from apischema.conversions import Conversion, deserializer
from typing_extensions import Annotated as A, override
from typing_extensions import Annotated as A
from typing_extensions import override

from .maas_globals import MaasResponse, T, desc

Expand Down Expand Up @@ -108,6 +109,7 @@ class RegexSwitchDevice(SwitchDevice, ABC):
and convert them to the requisit MaasReponse values using regex.

"""

query_on_regex: A[str, desc("match the on status return from query")] = "on"
query_off_regex: A[str, desc("match the off status return from query")] = "off"

Expand Down