default_profile.util.machine¶
Generate a Platform class that can be used to identify varying
characteristics of a user’s device.
Aims to clearly identify OS, CPU architecture and in the future may work to identify varying shells and terminals.
The Platform class in this module can be easily initialized with.:
>>> from default_profile.util.machine import Platform
>>> users_machine = Platform()
>>> users_machine.update_env()
>>> assert users_machine is not None
See Also¶
default_profile.startup.20_aliasesShows an example use case
Platform Specific Abstractions¶
-
class
Platform[source][source] Abstract away platform differences.
After toying with the initial implementation, I realized I could simply bind the
pathlib.Path()instance directly toPlatformduring initialization.This allows for a user to check the
sys.platforminstance, and then act in an appropriate manner without knowing what thepathlib.Pathactually initialized to.-
__init__(shell, user_env)[source][source] Initialize a user specific object.
- shell
InteractiveShell, optional Global IPython instance.
- user_envdict, optional
Environment variables to add to the instance.
- shell
-
LOGGER : :class:`logging.Logger` Class attribute. Logger for the class
-
Sphinx Autogenerated Docs for machine¶
-
class
Platform(shell=None, env=None, **kwargs)[source][source]¶ Bases:
object
-
class
Shell(shell=None, env=None, **kwargs)[source][source]¶ Bases:
default_profile.util.machine.PlatformSubclass Platform to gain information about the user’s shell.