style(mark): type hint **kwargs as str | int | bool | None
This commit is contained in:
@@ -184,7 +184,7 @@ class KeywordMatcher:
|
||||
|
||||
return cls(mapped_names)
|
||||
|
||||
def __call__(self, subname: str, /, **kwargs: object) -> bool:
|
||||
def __call__(self, subname: str, /, **kwargs: str | int | bool | None) -> bool:
|
||||
if kwargs:
|
||||
raise UsageError("Keyword expressions do not support call parameters.")
|
||||
subname = subname.lower()
|
||||
@@ -234,7 +234,7 @@ class MarkMatcher:
|
||||
mark_name_mapping[mark.name].append(mark)
|
||||
return cls(mark_name_mapping)
|
||||
|
||||
def __call__(self, name: str, /, **kwargs: object) -> bool:
|
||||
def __call__(self, name: str, /, **kwargs: str | int | bool | None) -> bool:
|
||||
if not (matches := self.own_mark_name_mapping.get(name, [])):
|
||||
return False
|
||||
|
||||
|
||||
@@ -260,7 +260,7 @@ def all_kwargs(s: Scanner) -> list[ast.keyword]:
|
||||
|
||||
|
||||
class MatcherCall(Protocol):
|
||||
def __call__(self, name: str, /, **kwargs: object) -> bool: ...
|
||||
def __call__(self, name: str, /, **kwargs: str | int | bool | None) -> bool: ...
|
||||
|
||||
|
||||
@dataclasses.dataclass
|
||||
@@ -271,7 +271,7 @@ class MatcherNameAdapter:
|
||||
def __bool__(self) -> bool:
|
||||
return self.matcher(self.name)
|
||||
|
||||
def __call__(self, **kwargs: object) -> bool:
|
||||
def __call__(self, **kwargs: str | int | bool | None) -> bool:
|
||||
return self.matcher(self.name, **kwargs)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user