Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to pyright==1.1.335 #8075

Merged
merged 2 commits into from Nov 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
sydney-runkle marked this conversation as resolved.
Show resolved Hide resolved
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:
sydney-runkle marked this conversation as resolved.
Show resolved Hide resolved
"""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
sydney-runkle marked this conversation as resolved.
Show resolved Hide resolved

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