Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ max-line-length = 119

ignore =
# D400 and D205 are because we sometimes split the first line of the docstring
*.py E203, W503, D100,D101,D102,D105,D106,D107, D400,D205, D415
E203, W503, D100,D101,D102,D105,D106,D107, D400,D205, D415
# temporary, until code is complete and stuff like ObjectDisposedException is gone:
*.py F821
F821

# Config for flake8-docstrings
docstring-convention = google
Expand Down
12 changes: 7 additions & 5 deletions nisystemlink/clients/core/_internal/_classproperty_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

import abc
import typing
from typing import Any, Callable, Dict, Tuple
from typing import Any, Callable, Dict, Tuple, TypeVar

_T = TypeVar("_T")


class ClasspropertySupport(abc.ABCMeta):
Expand All @@ -31,8 +33,8 @@ class ClasspropertySupport_(meta): # type: ignore
)

@classmethod
def classproperty(cls, f: Callable[[Any], Any]) -> property:
def classproperty(cls, f: Callable[[Any], _T]) -> _T:
"""Make a classproperty."""
# Cast to a property for the type checker, as we'll convert it to a property
# later, in the __new__ method
return typing.cast(property, cls._ClassProperty(f))
# Cast to preserve the original function's return type for the type checker.
# It'll get wrapped in a property in the __new__ method.
return typing.cast(_T, cls._ClassProperty(f))
4 changes: 2 additions & 2 deletions nisystemlink/clients/core/_internal/_path_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ class PathConstants(metaclass=ClasspropertySupport):

PRODUCT_NAME = "Skyline"

_application_data_directory = None # type: Optional[pathlib.Path]
_application_data_directory: Optional[pathlib.Path] = None

_salt_data_directory = None # type: Optional[pathlib.Path]
_salt_data_directory: Optional[pathlib.Path] = None

def __init_subclass__(cls) -> None:
raise TypeError("type 'PathConstants' is not an acceptable base type")
Expand Down
2 changes: 1 addition & 1 deletion nisystemlink/clients/core/_uplink/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from ._json_model import JsonModel


@response_handler
@response_handler # type: ignore[untyped-decorator]
def _handle_http_status(response: Response) -> Optional[Response]:
"""Checks an HTTP response's status code and raises an exception if necessary."""
if 200 <= response.status_code < 300:
Expand Down
4 changes: 2 additions & 2 deletions nisystemlink/clients/tag/_buffered_tag_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ def __init__(

self._closed = False
self._num_buffered = 0
self._send_error = None # type: Optional[core.ApiException]
self._send_error: Optional[core.ApiException] = None
self._timer_generation = 0
self._timer_handler = None # type: Optional[Callable[[], None]]
self._timer_handler: Optional[Callable[[], None]] = None

@abc.abstractmethod
def _buffer_value(self, path: str, value: Any) -> None:
Expand Down
4 changes: 2 additions & 2 deletions nisystemlink/clients/tag/_itag_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
from typing_extensions import Literal


_VALID_TYPES = {
_VALID_TYPES: Dict[tbase.DataType, Union[type, Tuple[type, type]]] = {
tbase.DataType.BOOLEAN: bool,
tbase.DataType.DATE_TIME: datetime.datetime,
tbase.DataType.DOUBLE: (float, int),
tbase.DataType.INT32: int,
tbase.DataType.UINT64: int,
tbase.DataType.STRING: str,
} # type: Dict[tbase.DataType, Union[type, Tuple[type, type]]]
}


class _ITagWriterOverloads(abc.ABC):
Expand Down
2 changes: 1 addition & 1 deletion nisystemlink/clients/tag/_tag_query_result_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(
total_count: The total number of results in the query.
skip: The skip used for the first page of results.
"""
self._first_page = None # type: Optional[List[tbase.TagData]]
self._first_page: Optional[List[tbase.TagData]] = None
if first_page:
if skip >= total_count:
raise core.ApiException(
Expand Down
1,346 changes: 824 additions & 522 deletions poetry.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ pyarrow = ["pyarrow"]

[tool.poetry.group.dev.dependencies]
black = ">=22.10,<25.0"
flake8 = "^5.0.4"
flake8-import-order = "^0.18.1"
flake8 = ">=5.0.4"
flake8-import-order = ">=0.18.1"
pytest = "^7.2.0"
pytest-asyncio = "^0.20.1"
mypy = "^1.15.0"
flake8-docstrings = "^1.6.0"
flake8-docstrings = ">=1.6.0"
poethepoet = "^0.16.4"
types-requests = "^2.28.11.4"
responses = "^0.22.0"
Expand Down