Retry calling the decorated function using an exponential backoff. The decorated method’s object may define the _handle_error method. The parameters for _handle_error are the exception object, a formatted stack trace in the form of a string, the wrapped methods’ name, the number of tries remaining, and finally the original parameters. If _handle_error returns True, retrying is aborted.
Parameters: |
|
---|
This module can be imported to allow pickling of methods.
Created on Sep 26, 2014
@author: joe
file may be the path to a file or a fileobject
file may be the path to a file or a fileobject
Bases: cloudfusion.util.cache.Cache
Multiprocessing cache that can synchronize entries over multiple processes.
Return an MPCache instance.
Parameters: | expiration_time – Time in seconds until entries are expired. |
---|
Parses an XML file or string, populating a dictionary containing the keys with the desired values.
The keys of the dictionary are either the names of Tags contained in the XML data or again dictionaries. The values can either be dictionaries again or simple strings, but ultimately the leaf values will be strings.
Bases: object
Does the work for populate_dict_with_XML_leaf_textnodes()
Parameters: |
|
---|
Does the work for populate_dict_with_XML_collection_leaf_textnodes()
Parameters: |
|
---|
Returns: | elem a list of elements matching the tags with the name tag_name on the first level of dom_tree. |
---|
Puts the text of the XML tags of xml_tree specified by dict_tree into dict_tree .
The dict_tree is a dictionary describing a subtree of xml_data. The dictionarie’s keys correspond to the first XML tags with the same name on the same nesting level of the dictionary. Additionally, keys with the name surrounded by brackets are seen as a list of such XML tags. Therefore the keys in the dictionary {“root”: {“[element]”: “”}} match the root tag <root> as well as the subelements of root <element> and <element>. The dictionarie’s most deeply nested elements must be empty strings. This value is replaced by the text of the corresponding key’s XML tag. Given the previous dictionary and the following XML structure:
<root> <element>text1</element> <element>text2</element> </root>
The resulting dictionary would be {“root”: {“[element]”: [“text1”, “text2”]}}
Parameters: |
|
---|
Puts the text of the XML tags of xml_data specified by dict_tree into dict_tree. The dict_tree is a dictionary describing a subtree of xml_data. The dictionarie’s keys correspond to the first XML tags with the same name on the same nesting level of the dictionary. Therefore the keys in the dictionary {“root”: {“element1”: “”, “element2”: “”}} match the root tag <root> as well as the subelements of root <element1> and <element2>. The dictionarie’s most deeply nested elements must be empty strings. This value is replaced by the text of the corresponding key’s XML tag. Given the previous dictionary and the following XML structure:
<root> <element1>text1</element1> <element2>text2</element2> </root>
The resulting dictionary would be {“root”: {“element1”: “text1”, “element2”: “text2”}}
Parameters: |
|
---|
Wrapper object for a method to be called.
Bases: object
Proxy object that synchronizes access to a core object methods and attributes that don’t start with _.
Created on Feb 5, 2013
Bases: cloudfusion.util.lru_cache.LRUCache
A persistent LRU cache for restricting memory usage to a minimum and carrying the cache information over several sessions even after application crashes.
Return an LRUCache instance.
Parameters: |
|
---|
Remove current entry associated with key from the LRU queue and delete its persistent representation.
Like peek, but memory efficient The temporary file needs to be closed if it is not used anymore :returns: temporary file object with the value
Refreshes an entry with disk_value, if modified is bigger than the entry’s modified date.
Get the key for the id defined in dictionary from a list of synonyms. Cloud providers have different names for the id like amazon’s access_key_id or Dropbox’ consumer_key. :returns: key from dicitionary which is a synonym for an cloud account id or None otherwise
Get the key for the secret defined in dictionary from a list of synonyms. Cloud providers have different names for the secret like amazon’s secret_access_key or Dropbox’ consumer_secret. :returns: key from dicitionary which is a synonym for an cloud account secret or None otherwise
Get globally unique identifier
Indents a string’s lines by indent spaces. Does not indent empty strings.
Bases: object
Proxy object that synchronizes access to a core object methods and attributes that don’t start with _ for multiple processes.
Wrapper object for a method to be called.
Created on 03.06.2011
Bases: object
Return a Cache instance with entries expiring after expiration_time seconds.
Refreshes an entry with disk_value, if modified is bigger than the entry’s modified date.
Bases: object
Cache entry.
Created on Feb 5, 2013
Bases: cloudfusion.util.cache.Cache
Least Recently Used cache. When adding an entry to the cache exceeds its size limit, the cache discards dirty entries starting with the least recently used. However, dirty entries or the last entry in the cache are not deleted.
Return an LRUCache instance.
Parameters: |
|
---|
Put existing entry associated with key in front of the LRU queue.
Resize cache to maxsize.
This is only important for subclasses using shelve with writeback=False as a dictionary.
Remove current entry associated with key from the LRU queue.
Get list of num dirty least recently used entries. returns: list of keys of the num least recently used entries
Returns: | The minimal interval between consecutive calls to reduce cache size as a float in seconds. The default is one second. |
---|
Get value associated with key. This does not count as the entry being used.
Refreshes an entry with disk_value, if modified is bigger than the entry’s modified date.
Do not try to reduce the cache size again before seconds have passed. Resize operations are slow, especially when the cache has many elements. It can be set to 0, if you want to make sure that clean entries are removed as fast as possible. :param seconds: float stating how much time in seconds must pass before a cache size reduction is tried again
Bases: cloudfusion.util.cache.Entry
Cache entry with next and previous links for chaining into a doubly linked list and a key for direct reference.