mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2024-09-21 00:24:37 +03:00
type_checking: Drop some redundant None
checks (#10334)
This commit is contained in:
parent
48a1c26232
commit
3608d25c80
@ -17,18 +17,18 @@ else:
|
||||
|
||||
|
||||
def is_type_List(f_type: Type) -> bool:
|
||||
return (get_origin(f_type) is not None and get_origin(f_type) == list) or f_type == list
|
||||
return get_origin(f_type) == list or f_type == list
|
||||
|
||||
|
||||
def is_type_SpecificOptional(f_type) -> bool:
|
||||
"""
|
||||
Returns true for types such as Optional[T], but not Optional, or T.
|
||||
"""
|
||||
return get_origin(f_type) is not None and f_type.__origin__ == Union and get_args(f_type)[1]() is None
|
||||
return get_origin(f_type) == Union and get_args(f_type)[1]() is None
|
||||
|
||||
|
||||
def is_type_Tuple(f_type: Type) -> bool:
|
||||
return (get_origin(f_type) is not None and get_origin(f_type) == tuple) or f_type == tuple
|
||||
return get_origin(f_type) == tuple or f_type == tuple
|
||||
|
||||
|
||||
def strictdataclass(cls: Any):
|
||||
|
Loading…
Reference in New Issue
Block a user