[docs]@finalclassOsInfo:"""Information about the operating system running on the current system."""__instance:ClassVar[OsInfo|None]=None
[docs]def__new__(cls,*args:Any,**kwargs:Any)->OsInfo:"""Create a new instance of class. This class is a singleton so it will always return the same instance. """ifcls.__instanceisNone:cls.__instance=cast("OsInfo",super().__new__(cls,*args,**kwargs))returncls.__instance
@cached_propertydefis_darwin(self)->bool:"""Operating system is Darwin."""returnself.name=="darwin"@cached_propertydefis_linux(self)->bool:"""Operating system is Linux."""returnself.name=="linux"@cached_propertydefis_macos(self)->bool:"""Operating system is macOS. Does not differentiate between macOS and Darwin. """returnself.is_darwin@cached_propertydefis_posix(self)->bool:"""Operating system is posix."""returnos.name=="posix"@cached_propertydefis_windows(self)->bool:"""Operating system is Windows."""returnself.name=="windows"@cached_propertydefname(self)->str:"""Operating system name set to lowercase for consistency."""returnplatform.system().lower()
[docs]@classmethoddefclear_singleton(cls)->None:"""Clear singleton instances. Intended to only be used for running tests. """cls.__instance=None
[docs]@finalclassSystemInfo:"""Information about the system running Runway."""__instance:ClassVar[SystemInfo|None]=None
[docs]def__new__(cls,*args:Any,**kwargs:Any)->SystemInfo:"""Create a new instance of class. This class is a singleton so it will always return the same instance. """ifcls.__instanceisNone:cls.__instance=cast("SystemInfo",super().__new__(cls,*args,**kwargs))returncls.__instance
@cached_propertydefis_frozen(self)->bool:"""Whether or not Runway is running from a frozen package (Pyinstaller)."""returnbool(getattr(sys,"frozen",False))@cached_propertydefos(self)->OsInfo:"""Operating system information."""returnOsInfo()
[docs]@classmethoddefclear_singleton(cls)->None:"""Clear singleton instances. Intended to only be used for running tests. """cls.__instance=None