environment.py
Others:
This definition returns the system Application data directory.
Examples directories:
- 'C:\Users\$USER\AppData\Roaming' on Windows 7.
- 'C:\Documents and Settings\$USER\Application Data' on Windows XP.
- '/Users/$USER/Library/Preferences' on Mac Os X.
- '/home/$USER' on Linux.
Returns: | User Application data directory. ( String ) |
---|
Examples directories:
- 'C:\Users\$USER\AppData\Roaming\Provider\Application' on Windows 7.
- 'C:\Documents and Settings\$USER\Application Data\Provider\Application' on Windows XP.
- '/Users/$USER/Library/Preferences/Provider/Application' on Mac Os X.
- '/home/$USER/.Provider/Application' on Linux.
Returns: | User Application directory. ( String ) |
---|
Bases: object
This class provides methods to manipulate environment variables.
Usage:
>>> environment = Environment(JOHN="DOE", DOE="JOHN")
>>> environment.setValues()
True
>>> import os
>>> os.environ["JOHN"]
'DOE'
>>> os.environ["DOE"]
'JOHN'
Parameters: |
|
---|
This method is the property for self.__variables attribute.
Returns: | self.__variables. ( Dictionary ) |
---|
This method gets environment variables values.
Usage:
>>> environment = Environment("HOME")
>>> environment.getValues()
{'HOME': '/Users/JohnDoe'}
>>> environment.getValues("USER")
{'HOME': '/Users/JohnDoe', 'USER': 'JohnDoe'}
Parameters: | *args – Additional variables names to retrieve values from. ( * ) |
---|---|
Returns: | Variables : Values. ( Dictionary ) |
This method sets environment variables values.
Usage:
>>> environment = Environment()
>>> environment.setValues(JOHN="DOE", DOE="JOHN")
True
>>> import os
>>> os.environ["JOHN"]
'DOE'
>>> os.environ["DOE"]
'JOHN'
Parameters: | **kwargs – Variables : Values. ( * ) |
---|---|
Returns: | Method success. ( String ) |
Note : | Any variable with a None value will be skipped. |