Platform: An Enumeration of Supported Operating Systems#

class my.types.Platform.Platform(*values)#

An enumeration of supported platforms, as combinable bitwise flags.

The desktop members are GNU, MAC, and DOS; the mobile members IOS and ANDROID are defined as unions that include MOBILE and their parent desktop family, so flag containment checks read naturally. NONE, OLD, and ERR cover the degenerate cases.

Examples

Test family membership via flag containment:

>>> from my import Platform
>>> Platform.MAC in Platform.IOS
True
>>> Platform.MOBILE in Platform.ANDROID
True
>>> Platform.DOS in Platform.IOS
False

Detect the platform of the current host (e.g. on a Linux machine):

>>> Platform.local()
<Platform.GNU: 4>
classmethod Platform.local() → Platform#

Detect the current platform, caching the result for subsequent calls.

Returns:

The member matching platform.system(), or NONE if nothing matches.