def _make(name, tags, project, show_error): Name.set_name(name) Name.set_tags(tags) Path.set_project_path(project_path=project, show_error=show_error) DataFile.compute_command_path(force=True) return MergeSettings(args)
def _make(name, tags, project, show_error, args): Name.set_name(name) Name.set_tags(tags) Path.set_project_path(project_path=project, show_error=show_error) CommandFile.compute_command_path() return MergeConfig.MergeConfig(args)
def read_settings(args=None): global _ARGS if args is not None: _ARGS = args def _make(name, tags, project, show_error): Name.set_name(name) Name.set_tags(tags) Path.set_project_path(project_path=project, show_error=show_error) DataFile.compute_command_path(force=True) return MergeSettings(args) # Read a settings file with a given name, tags, and project. # First, make a settings with the default information. merge_settings = _make(None, [], None, False) # Now, use the name, tags and project to get the correct configuration. get = merge_settings.args.get name = get('name') or Name.lookup(get('map', {}).get('name', {})) tags = get('tag') or Name.lookup(get('map', {}).get('tag', {})) or [] project = get('project') if not isinstance(tags, (list, tuple)): tags = [tags] prompt = not get('execution', 'autostart') global MERGE_SETTINGS MERGE_SETTINGS = _make(name, tags, project, prompt)
def _get_name_and_tags(): name = Name.lookup(get('map', 'name')) if name: Name.set_name(name) tags = Name.lookup(get('map', 'tag')) if tags: if isinstance(tags, six.string_types): tags = [tags] Name.TAGS = tags if name or tags: CommandFile.compute_command_path()
def reconfigure(args): # Read a configuration file with a given name, tags, and project. # First, make a config with the default information. merge_config = _make(None, [], None, False, args) # Now, use the name, tags and project to get the correct configuration. get = merge_config.config.get name = get('name') or Name.lookup(get('map', {}).get('name', {})) tags = get('tag') or Name.lookup(get('map', {}).get('tag', {})) or [] project = get('project') if not isinstance(tags, (list, tuple)): tags = [tags] prompt = not get('autostart') return _make(name, tags, project, prompt, args)
def __init__(self, instance): super(Peers, self).__init__() self.lock = Lock() self.instance = instance self.type = Peers.TYPE source = Name.NAME self.data = dict(Name.info(), type=self.type, time=time.time(), ascii_time=time.asctime(), source=source) self._peers = {source: self.data}
def names(_): _info(Name.names())
def info(_): _info(Name.info())
def addresses(_): _info(Name.addresses())