Skip to content

Commit

Permalink
fix annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
haakonvt committed Jan 17, 2025
1 parent 57f251d commit aba9755
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cognite/client/data_classes/data_modeling/ids.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def version(self) -> str | None: ...
Id = tuple[str, str] | tuple[str, str, str] | IdLike | VersionedIdLike


def _load_space_identifier(ids: str | SequenceNotStr[str]) -> DataModelingIdentifierSequence:
def _load_space_identifier(ids: str | Sequence[str] | SequenceNotStr[str]) -> DataModelingIdentifierSequence:
is_sequence = isinstance(ids, Sequence) and not isinstance(ids, str)
spaces = [ids] if isinstance(ids, str) else ids
return DataModelingIdentifierSequence(
Expand Down
9 changes: 6 additions & 3 deletions cognite/client/utils/_pandas_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from inspect import signature
from itertools import chain
from numbers import Integral
from typing import TYPE_CHECKING, Any, Literal
from typing import TYPE_CHECKING, Any, Literal, Protocol

from cognite.client.exceptions import CogniteImportError
from cognite.client.utils._importing import local_import
Expand All @@ -18,7 +18,6 @@
import pandas as pd

from cognite.client.data_classes import Datapoints, DatapointsArray, DatapointsArrayList, DatapointsList
from cognite.client.data_classes._base import T_CogniteResource, T_CogniteResourceList


NULLABLE_INT_COLS = {
Expand Down Expand Up @@ -88,7 +87,11 @@ def concat_dps_dataframe_list(
return concat_dataframes_with_nullable_int_cols(dfs)


def notebook_display_with_fallback(inst: T_CogniteResource | T_CogniteResourceList, **kwargs: Any) -> str:
class PandasConvertible(Protocol):
def to_pandas(self) -> pd.DataFrame: ...


def notebook_display_with_fallback(inst: PandasConvertible, **kwargs: Any) -> str:
params = signature(inst.to_pandas).parameters
# Default of False enforced (when accepted by method):
if "camel_case" in params:
Expand Down

0 comments on commit aba9755

Please sign in to comment.