def L(self): '''local settings''' return self._M.localize(self) if self._M is not None else frozenstuf()
def defaults(self): '''get default settings separately''' return frozenstuf(self._default)
def __init__(self, **cxn_args): self.cxn_args = frozenstuf(cxn_args) self.cxn = self.connect(self.cxn_args) self.connected = False
def required(self): '''get required settings separately''' return frozenstuf(self._required)
def final(self): '''finalized settings''' end = self._default.copy() end.update(self._final.copy()) end.update(self._required.copy()) return frozenstuf(end)
def __init__(self, conf): super(context, self).__init__() self._conf = frozenstuf(conf)
def gc(self): return frozenstuf(self._load_config(self.default_config))
from contextlib import contextmanager from path import path from stuf import frozenstuf from urllib import quote_plus as quote from urllib import unquote import logging import os import requests import subprocess import tarfile import tempfile logger = logging.getLogger(__name__) environ = frozenstuf([(x,k) for x, k in os.environ.items() if not x.startswith('_')]) class Downloader(object): """ Downloading object for setting up a cluster """ def __init__(self, cache=path(environ.VIRTUAL_ENV) / '.download_cache'): self.cache = path(cache) if not self.cache.exists(): self.cache.makedirs() tempdir = staticmethod(tempfile.mkdtemp) quote = staticmethod(quote) unquote = staticmethod(unquote)