Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _tmp_root():
root = os.path.join(tempfile.gettempdir(), 'peru', 'test')
makedirs(root)
return root
def _plugin_cache_path(plugin_context, definition, module_fields):
if not definition.cache_fields:
# This plugin is not cacheable.
return os.devnull
key = _plugin_cache_key(definition, module_fields)
plugin_cache = os.path.join(plugin_context.plugin_cache_root,
definition.type, key)
makedirs(plugin_cache)
return plugin_cache
def __init__(self, root):
"Don't instantiate this class directly. Use the Cache() constructor."
self.root = root
self.plugins_root = os.path.join(root, "plugins")
makedirs(self.plugins_root)
self.tmp_path = os.path.join(root, "tmp")
makedirs(self.tmp_path)
self.keyval = KeyVal(os.path.join(root, 'keyval'), self.tmp_path)
self.trees_path = os.path.join(root, "trees")
self._empty_tree = None