Skip to content

Commit

Permalink
Add flake8 config
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre0512 committed Jul 18, 2023
1 parent 4f7d486 commit 2236724
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
max-line-length = 88
max-complexity = 7
2 changes: 1 addition & 1 deletion .github/workflows/python-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
python -m pip install -r requirements_dev.txt
- name: Lint with flake8
run: |
flake8 . --count --max-complexity=7 --max-line-length=88 --statistics
flake8 . --count --statistics
- name: Type check with mypy
run: |
mypy pyhon/
Expand Down
4 changes: 3 additions & 1 deletion pyhon/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __init__(
category_name: str = "",
):
self._name: str = name
self._api: Optional[HonAPI] = appliance.api
self._api: Optional[HonAPI] = None
self._appliance: "HonAppliance" = appliance
self._categories: Optional[Dict[str, "HonCommand"]] = categories
self._category_name: str = category_name
Expand All @@ -48,6 +48,8 @@ def name(self) -> str:

@property
def api(self) -> "HonAPI":
if self._api is None and self._appliance:
self._api = self._appliance.api
if self._api is None:
raise exceptions.NoAuthenticationException("Missing hOn login")
return self._api
Expand Down
6 changes: 3 additions & 3 deletions pyhon/parameter/range.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ def __init__(self, key: str, attributes: Dict[str, Any], group: str) -> None:

def _set_attributes(self) -> None:
super()._set_attributes()
self._min = str_to_float(self._attributes["minimumValue"])
self._max = str_to_float(self._attributes["maximumValue"])
self._step = str_to_float(self._attributes["incrementValue"])
self._min = str_to_float(self._attributes.get("minimumValue", 0))
self._max = str_to_float(self._attributes.get("maximumValue", 0))
self._step = str_to_float(self._attributes.get("incrementValue", 0))
self._default = str_to_float(self._attributes.get("defaultValue", self.min))
self._value = self._default

Expand Down

0 comments on commit 2236724

Please sign in to comment.