environment.py
Others:
Returns the system temporary directory.
Returns: | System temporary directory. |
---|---|
Return type: | unicode |
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. |
---|---|
Return type: | unicode |
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. |
---|---|
Return type: | unicode |
Bases: object
Defines methods to manipulate environment variables.
Initializes the class.
Usage:
>>> environment = Environment(JOHN="DOE", DOE="JOHN")
>>> environment.setValues()
True
>>> import os
>>> os.environ["JOHN"]
u'DOE'
>>> os.environ["DOE"]
u'JOHN'
Parameters: |
|
---|
Property for self.__variables attribute.
Returns: | self.__variables. |
---|---|
Return type: | dict |
Gets environment variables values.
Usage:
>>> environment = Environment("HOME")
>>> environment.getValues()
{'HOME': u'/Users/JohnDoe'}
>>> environment.getValues("USER")
{'HOME': u'/Users/JohnDoe', 'USER': u'JohnDoe'}
Parameters: | *args (*) – Additional variables names to retrieve values from. |
---|---|
Returns: | Variables : Values. |
Return type: | dict |
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. |
Return type: | unicode |
Note: | Any variable with a None value will be skipped. |