Drop more `Optional` usage on our `Struct`
parent
8594a39c61
commit
f7f2d1247b
|
@ -19,7 +19,6 @@ Built-in (extension) types.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
import sys
|
import sys
|
||||||
from typing import Optional
|
|
||||||
from pprint import pformat
|
from pprint import pformat
|
||||||
|
|
||||||
import msgspec
|
import msgspec
|
||||||
|
@ -59,7 +58,7 @@ class Struct(
|
||||||
|
|
||||||
def copy(
|
def copy(
|
||||||
self,
|
self,
|
||||||
update: Optional[dict] = None,
|
update: dict | None = None,
|
||||||
|
|
||||||
) -> msgspec.Struct:
|
) -> msgspec.Struct:
|
||||||
'''
|
'''
|
||||||
|
@ -84,7 +83,7 @@ class Struct(
|
||||||
# use ``.copy()`` above in such cases.
|
# use ``.copy()`` above in such cases.
|
||||||
def typecast(
|
def typecast(
|
||||||
self,
|
self,
|
||||||
# fields: Optional[list[str]] = None,
|
# fields: list[str] | None = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
for fname, ftype in self.__annotations__.items():
|
for fname, ftype in self.__annotations__.items():
|
||||||
setattr(self, fname, ftype(getattr(self, fname)))
|
setattr(self, fname, ftype(getattr(self, fname)))
|
||||||
|
|
Loading…
Reference in New Issue