Skip to content

Commit

Permalink
Update to pyright==1.1.335
Browse files Browse the repository at this point in the history
  • Loading branch information
Viicos committed Nov 10, 2023
1 parent 9eec4d6 commit a09c02f
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 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"]
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
8 changes: 4 additions & 4 deletions pydantic/fields.py
Expand Up @@ -382,16 +382,16 @@ class MyModel(pydantic.BaseModel):

return cls(annotation=annotation, default=default, frozen=final or None)

@staticmethod
def merge_field_infos(*field_infos: FieldInfo, **overrides: Any) -> FieldInfo:
@classmethod
def merge_field_infos(cls, *field_infos: typing_extensions.Self, **overrides: Any) -> typing_extensions.Self:
"""Merge `FieldInfo` instances keeping only explicitly set attributes.
Later `FieldInfo` instances override earlier ones.
Returns:
FieldInfo: A merged FieldInfo instance.
"""
flattened_field_infos: list[FieldInfo] = []
flattened_field_infos: list[typing_extensions.Self] = []
for field_info in field_infos:
flattened_field_infos.extend(x for x in field_info.metadata if isinstance(x, FieldInfo))
flattened_field_infos.append(field_info)
Expand All @@ -412,7 +412,7 @@ def merge_field_infos(*field_infos: FieldInfo, **overrides: Any) -> FieldInfo:
if not isinstance(x, FieldInfo):
metadata[type(x)] = x
new_kwargs.update(overrides)
field_info = FieldInfo(**new_kwargs)
field_info = cls(**new_kwargs)
field_info.metadata = list(metadata.values())
return field_info

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 a09c02f

Please sign in to comment.