Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Mar 18, 2024
1 parent 0e009ea commit ecf2777
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 28 deletions.
31 changes: 14 additions & 17 deletions src/talondoc/analysis/registry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,11 @@ def _register_grouped_data(self, value: GroupDataVar) -> GroupDataVar:
" ".join(
[
f"Found",
"declaration"
if issubclass(value.parent_type, data.Module)
else "override",
(
"declaration"
if issubclass(value.parent_type, data.Module)
else "override"
),
"for {value.__class__.__name__} {value.name}",
]
)
Expand Down Expand Up @@ -292,24 +294,21 @@ def lookup(
self,
cls: type[SimpleDataVar],
name: str,
) -> Optional[SimpleDataVar]:
...
) -> Optional[SimpleDataVar]: ...

@overload
def lookup(
self,
cls: type[GroupDataVar],
name: str,
) -> Optional[list[GroupDataVar]]:
...
) -> Optional[list[GroupDataVar]]: ...

@overload
def lookup(
self,
cls: type[data.Callback],
name: data.EventCode,
) -> Optional[Sequence[data.Callback]]:
...
) -> Optional[Sequence[data.Callback]]: ...

def lookup(self, cls: type[Data], name: Any) -> Optional[Any]:
return self._typed_store(cls).get(self.resolve_name(name), None)
Expand Down Expand Up @@ -497,22 +496,20 @@ def tags(self) -> Mapping[str, data.Tag]:
######################################################################

@overload
def _typed_store(self, cls: type[SimpleDataVar]) -> dict[str, SimpleDataVar]:
...
def _typed_store(self, cls: type[SimpleDataVar]) -> dict[str, SimpleDataVar]: ...

@overload
def _typed_store(self, cls: type[GroupDataVar]) -> dict[str, list[GroupDataVar]]:
...
def _typed_store(
self, cls: type[GroupDataVar]
) -> dict[str, list[GroupDataVar]]: ...

@overload
def _typed_store(
self, cls: type[data.Callback]
) -> dict[data.EventCode, list[data.Callback]]:
...
) -> dict[data.EventCode, list[data.Callback]]: ...

@overload
def _typed_store(self, cls: type[Data]) -> dict[Any, Any]:
...
def _typed_store(self, cls: type[Data]) -> dict[Any, Any]: ...

def _typed_store(self, cls: type[Data]) -> dict[Any, Any]:
# If the data is not serialisable, store it in temp_data:
Expand Down
6 changes: 3 additions & 3 deletions src/talondoc/analysis/registry/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,9 @@ def always_on(self) -> bool:
# Common Decoders - Cont'd
##############################################################################

field_parent_type: Callable[
[JsonValue], Union[type[Module], type[Context]]
] = parse_field("parent_type", parse_class(Module, Context))
field_parent_type: Callable[[JsonValue], Union[type[Module], type[Context]]] = (
parse_field("parent_type", parse_class(Module, Context))
)


##############################################################################
Expand Down
6 changes: 2 additions & 4 deletions src/talondoc/analysis/registry/data/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,10 @@ class GroupData(Data):

@classmethod
@abstractmethod
def from_dict(cls, value: JsonValue) -> Self:
...
def from_dict(cls, value: JsonValue) -> Self: ...

@abstractmethod
def to_dict(self) -> dict[str, JsonValue]:
...
def to_dict(self) -> dict[str, JsonValue]: ...


GroupDataVar = TypeVar(
Expand Down
6 changes: 2 additions & 4 deletions src/talondoc/analysis/static/python/shims.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,12 +290,10 @@ def update(self, values: Sequence[str]) -> None:
self._add_tag_import(name)

@overload
def __getitem__(self, index: int) -> str:
...
def __getitem__(self, index: int) -> str: ...

@overload
def __getitem__(self, index: slice) -> Sequence[str]:
...
def __getitem__(self, index: slice) -> Sequence[str]: ...

def __getitem__(self, _index: Any) -> Sequence[Any]:
raise NotImplementedError()
Expand Down

0 comments on commit ecf2777

Please sign in to comment.