mirror of
https://github.com/Andre0512/pyhOn.git
synced 2024-01-19 02:50:44 +00:00
Add flake8 config
This commit is contained in:
parent
4f7d4860db
commit
22367242a2
2
.github/workflows/python-check.yml
vendored
2
.github/workflows/python-check.yml
vendored
|
@ -28,7 +28,7 @@ jobs:
|
||||||
python -m pip install -r requirements_dev.txt
|
python -m pip install -r requirements_dev.txt
|
||||||
- name: Lint with flake8
|
- name: Lint with flake8
|
||||||
run: |
|
run: |
|
||||||
flake8 . --count --max-complexity=7 --max-line-length=88 --statistics
|
flake8 . --count --statistics
|
||||||
- name: Type check with mypy
|
- name: Type check with mypy
|
||||||
run: |
|
run: |
|
||||||
mypy pyhon/
|
mypy pyhon/
|
||||||
|
|
|
@ -28,7 +28,7 @@ class HonCommand:
|
||||||
category_name: str = "",
|
category_name: str = "",
|
||||||
):
|
):
|
||||||
self._name: str = name
|
self._name: str = name
|
||||||
self._api: Optional[HonAPI] = appliance.api
|
self._api: Optional[HonAPI] = None
|
||||||
self._appliance: "HonAppliance" = appliance
|
self._appliance: "HonAppliance" = appliance
|
||||||
self._categories: Optional[Dict[str, "HonCommand"]] = categories
|
self._categories: Optional[Dict[str, "HonCommand"]] = categories
|
||||||
self._category_name: str = category_name
|
self._category_name: str = category_name
|
||||||
|
@ -48,6 +48,8 @@ class HonCommand:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def api(self) -> "HonAPI":
|
def api(self) -> "HonAPI":
|
||||||
|
if self._api is None and self._appliance:
|
||||||
|
self._api = self._appliance.api
|
||||||
if self._api is None:
|
if self._api is None:
|
||||||
raise exceptions.NoAuthenticationException("Missing hOn login")
|
raise exceptions.NoAuthenticationException("Missing hOn login")
|
||||||
return self._api
|
return self._api
|
||||||
|
|
|
@ -16,9 +16,9 @@ class HonParameterRange(HonParameter):
|
||||||
|
|
||||||
def _set_attributes(self) -> None:
|
def _set_attributes(self) -> None:
|
||||||
super()._set_attributes()
|
super()._set_attributes()
|
||||||
self._min = str_to_float(self._attributes["minimumValue"])
|
self._min = str_to_float(self._attributes.get("minimumValue", 0))
|
||||||
self._max = str_to_float(self._attributes["maximumValue"])
|
self._max = str_to_float(self._attributes.get("maximumValue", 0))
|
||||||
self._step = str_to_float(self._attributes["incrementValue"])
|
self._step = str_to_float(self._attributes.get("incrementValue", 0))
|
||||||
self._default = str_to_float(self._attributes.get("defaultValue", self.min))
|
self._default = str_to_float(self._attributes.get("defaultValue", self.min))
|
||||||
self._value = self._default
|
self._value = self._default
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue