Skip to content

Commit 35b6166

Browse files
committed
Merge branch 'flake8/more-tests' of github.com:iocage/libiocage into flake8/more-tests
2 parents 91b06ff + a7eb435 commit 35b6166

File tree

6 files changed

+15
-10
lines changed

6 files changed

+15
-10
lines changed

iocage/lib/Config/Jail/BaseConfig.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ def _set_priority(self, value: typing.Union[int, str], **kwargs):
215215
self.data["priority"] = str(value)
216216

217217
# legacy support
218-
def _get_tag(self) -> str:
218+
def _get_tag(self) -> typing.Optional[str]:
219219

220220
if self._has_legacy_tag is True:
221221
return self.data["tag"]
@@ -396,7 +396,7 @@ def _skip_on_error(self, **kwargs):
396396
except AttributeError:
397397
return False
398398

399-
def __getitem_user(self, key):
399+
def __getitem_user(self, key: str) -> typing.Any:
400400

401401
# passthrough existing properties
402402
try:

iocage/lib/Jail.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,7 @@ def running(self) -> bool:
10561056
return self.jid is not None
10571057

10581058
@property
1059-
def jid(self) -> int:
1059+
def jid(self) -> typing.Optional[int]:
10601060
"""
10611061
The JID of a running jail or None if the jail is not running
10621062
"""

iocage/lib/Release.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def base_dataset_name(self) -> str:
116116
return f"{self.__base_dataset_name}/{self.release.name}/root"
117117

118118
@property
119-
def file(self) -> str:
119+
def file(self) -> typing.Optional[str]:
120120
return None
121121

122122

iocage/lib/Resource.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def _set_dataset(self, value: libzfs.ZFSDataset) -> None:
181181
# return self.dataset.mountpoint
182182

183183
@property
184-
def config_type(self) -> str:
184+
def config_type(self) -> typing.Optional[str]:
185185
if self._config_type is None:
186186
return None
187187
elif self._config_type == self.CONFIG_TYPES.index("auto"):
@@ -209,7 +209,7 @@ def _detect_config_type(self) -> int:
209209
return 0
210210

211211
@property
212-
def config_file(self) -> str:
212+
def config_file(self) -> typing.Optional[str]:
213213
"""
214214
Relative path of the resource config file
215215
"""

iocage/lib/events.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ class IocageEvent:
4848

4949
PENDING_COUNT: int = 0
5050

51-
identifier: str = None
52-
_started_at: float = None
53-
_stopped_at: float = None
51+
identifier: str
52+
_started_at: float
53+
_stopped_at: float
5454
_pending: bool = False
5555
skipped: bool = False
5656
done: bool = True
57-
error: BaseException = None
57+
error: BaseException
5858

5959
def __init__(self, message=None, **kwargs) -> None:
6060
"""

setup.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ description-file = README.md
33

44
[mypy]
55
python_version = 3.6
6+
# override flake8-mypy defaults, since we provide (missing) types
7+
ignore_missing_imports=False
8+
disallow_untyped_calls=True
9+
follow_imports=True
10+
cache_dir=.mypy_cache
611

712
[tool:pytest]
813
addopts = -v -x -rs --ignore=setup.py --pep8 --cov-report term-missing --cov=iocage/lib iocage/lib iocage/tests

0 commit comments

Comments
 (0)