Drop more `Optional` usage on our `Struct`

rekt_pps
Tyler Goodlet 2023-03-21 22:33:54 -04:00
parent dc2332c980
commit 6272cae8d4
1 changed files with 2 additions and 3 deletions

View File

@ -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)))