Skip to content

Commit

Permalink
Update to pyright==1.1.335 (#8075)
Browse files Browse the repository at this point in the history
  • Loading branch information
Viicos committed Nov 11, 2023
1 parent ab843af commit 2358e63
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Expand Up @@ -269,7 +269,7 @@ jobs:
node-version: '18'

- name: install pyright
run: npm install -g pyright@1.1.322 # try to keep this in sync with .pre-commit-config.yaml
run: npm install -g pyright@1.1.335 # try to keep this in sync with .pre-commit-config.yaml

- name: run pyright tests
run: make test-pyright
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Expand Up @@ -36,4 +36,4 @@ repos:
types: [python]
language: node
pass_filenames: false
additional_dependencies: ["pyright@1.1.322"]
additional_dependencies: ["pyright@1.1.335"] # try to keep this in sync with .github/workflows/ci.yml
2 changes: 1 addition & 1 deletion pydantic/_internal/_utils.py
Expand Up @@ -309,7 +309,7 @@ def smart_deepcopy(obj: Obj) -> Obj:
try:
if not obj and obj_type in BUILTIN_COLLECTIONS:
# faster way for empty collections, no need to copy its members
return obj if obj_type is tuple else obj.copy() # tuple doesn't have copy method
return obj if obj_type is tuple else obj.copy() # tuple doesn't have copy method # type: ignore
except (TypeError, ValueError, RuntimeError):
# do we really dare to catch ALL errors? Seems a bit risky
pass
Expand Down
4 changes: 2 additions & 2 deletions pydantic/deprecated/parse.py
Expand Up @@ -46,11 +46,11 @@ def load_str_bytes(
if proto == Protocol.json:
if isinstance(b, bytes):
b = b.decode(encoding)
return json_loads(b)
return json_loads(b) # type: ignore
elif proto == Protocol.pickle:
if not allow_pickle:
raise RuntimeError('Trying to decode with pickle with allow_pickle=False')
bb = b if isinstance(b, bytes) else b.encode()
bb = b if isinstance(b, bytes) else b.encode() # type: ignore
return pickle.loads(bb)
else:
raise TypeError(f'Unknown protocol: {proto}')
Expand Down
6 changes: 3 additions & 3 deletions pydantic/fields.py
Expand Up @@ -244,7 +244,7 @@ class MyModel(pydantic.BaseModel):
return cls(default=default, **kwargs)

@classmethod
def from_annotation(cls, annotation: type[Any]) -> typing_extensions.Self:
def from_annotation(cls, annotation: type[Any]) -> FieldInfo:
"""Creates a `FieldInfo` instance from a bare annotation.
Args:
Expand Down Expand Up @@ -306,7 +306,7 @@ class MyModel(pydantic.BaseModel):
return cls(annotation=annotation, frozen=final or None)

@classmethod
def from_annotated_attribute(cls, annotation: type[Any], default: Any) -> typing_extensions.Self:
def from_annotated_attribute(cls, annotation: type[Any], default: Any) -> FieldInfo:
"""Create `FieldInfo` from an annotation with a default value.
Args:
Expand Down Expand Up @@ -402,7 +402,7 @@ def merge_field_infos(*field_infos: FieldInfo, **overrides: Any) -> FieldInfo:
field_info._attributes_set.update(overrides)
for k, v in overrides.items():
setattr(field_info, k, v)
return field_info
return field_info # type: ignore

new_kwargs: dict[str, Any] = {}
metadata = {}
Expand Down
2 changes: 1 addition & 1 deletion pydantic/type_adapter.py
Expand Up @@ -125,7 +125,7 @@ def __new__(cls, __type: type[T], *, config: ConfigDict | None = ...) -> TypeAda
def __new__(cls, __type: T, *, config: ConfigDict | None = ...) -> TypeAdapter[T]:
...

def __new__(cls, __type: Any, *, config: ConfigDict | None = ...) -> TypeAdapter[T]:
def __new__(cls, __type: Any, *, config: ConfigDict | None = None) -> TypeAdapter[T]:
"""A class representing the type adapter."""
raise NotImplementedError

Expand Down

0 comments on commit 2358e63

Please sign in to comment.