Skip to content

Commit 6990387

Browse files
Add type hints to Service properties
1 parent a219aeb commit 6990387

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Diff for: testinfra/modules/service.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# limitations under the License.
1212

1313
import functools
14+
from typing import Any
1415

1516
from testinfra.modules.base import Module
1617

@@ -34,22 +35,22 @@ def __init__(self, name):
3435
super().__init__()
3536

3637
@property
37-
def exists(self):
38+
def exists(self) -> bool:
3839
"""Test if the service exists"""
3940
raise NotImplementedError
4041

4142
@property
42-
def is_running(self):
43+
def is_running(self) -> bool:
4344
"""Test if service is running"""
4445
raise NotImplementedError
4546

4647
@property
47-
def is_enabled(self):
48+
def is_enabled(self) -> bool:
4849
"""Test if service is enabled"""
4950
raise NotImplementedError
5051

5152
@property
52-
def is_valid(self):
53+
def is_valid(self) -> bool:
5354
"""Test if service is valid
5455
5556
This method is only available in the systemd implementation,
@@ -58,7 +59,7 @@ def is_valid(self):
5859
raise NotImplementedError
5960

6061
@property
61-
def is_masked(self):
62+
def is_masked(self) -> bool:
6263
"""Test if service is masked
6364
6465
This method is only available in the systemd implementation,
@@ -67,7 +68,7 @@ def is_masked(self):
6768
raise NotImplementedError
6869

6970
@functools.cached_property
70-
def systemd_properties(self):
71+
def systemd_properties(self) -> dict[str, Any]:
7172
"""Properties of the service (unit).
7273
7374
Return service properties as a `dict`,

0 commit comments

Comments
 (0)