nix_modules: fix and update None types
This commit is contained in:
@@ -13,7 +13,7 @@ class Unknown:
|
||||
|
||||
|
||||
InventoryInstanceModuleNameType = str
|
||||
InventoryInstanceModuleInputType = str
|
||||
InventoryInstanceModuleInputType = str | None
|
||||
|
||||
class InventoryInstanceModule(TypedDict):
|
||||
name: str
|
||||
@@ -163,7 +163,7 @@ class Template(TypedDict):
|
||||
|
||||
|
||||
|
||||
ClanDirectoryType = dict[str, Any] | list[Any] | bool | float | int | str
|
||||
ClanDirectoryType = dict[str, Any] | list[Any] | bool | float | int | str | None
|
||||
ClanInventoryType = Inventory
|
||||
ClanMachinesType = dict[str, Unknown]
|
||||
ClanMetaType = Unknown
|
||||
|
||||
@@ -218,13 +218,12 @@ def get_field_def(
|
||||
default_factory: str | None = None,
|
||||
type_appendix: str = "",
|
||||
) -> tuple[str, str]:
|
||||
if "None" in field_types or default or default_factory:
|
||||
if "None" in field_types:
|
||||
field_types.remove("None")
|
||||
serialised_types = " | ".join(sort_types(field_types)) + type_appendix
|
||||
_field_types = set(field_types)
|
||||
if "None" in _field_types or default or default_factory:
|
||||
serialised_types = " | ".join(sort_types(_field_types)) + type_appendix
|
||||
serialised_types = f"{serialised_types}"
|
||||
else:
|
||||
serialised_types = " | ".join(sort_types(field_types)) + type_appendix
|
||||
serialised_types = " | ".join(sort_types(_field_types)) + type_appendix
|
||||
|
||||
return (field_name, serialised_types)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user