code stringlengths 1 18.2k |
|---|
limit in enumerate(groupLimits): if value < limit: keyIndex = i break if keyIndex == 0: # below the minimum raise BelowLimitsError('Value {0} below limit {1}'.format(value, groupLimits[0])) if keyIndex is None: raise AboveLimitsError('Value {0} above limit {1}'.format(value, groupLimits[-1])) return groupKeys[keyIndex-... |
def set_size(self, size): """ choose a preset size for the plot :param size: 'small' for documents or 'large' for presentations """ if size == 'small': self._set_size_small() elif size == 'large': self._set_size_large() else: raise ValueError('Size must be large or small') |
def set_foregroundcolor(self, color): '''For the specified axes, sets the color of the frame, major ticks, tick labels, axis labels, title and legend ''' ax = self.ax for tl in ax.get_xticklines() + ax.get_yticklines(): tl.set_color(color) for spine in ax.spines: ax.spines[spine].set_edgecolor(color) for tick in ax.xax... |
def set_backgroundcolor(self, color): '''Sets the background color of the current axes (and legend). Use 'None' (with quotes) for transparent. To get transparent background on saved figures, use: pp.savefig("fig1.svg", transparent=True) ''' ax = self.ax ax.patch.set_facecolor(color) lh = ax.get_legend() if lh != None: ... |
def _getParLabelAndUnit(self, param): """ checks param to see if it contains a parent link (ie star.) then returns the correct unit and label for the job from the parDicts :return: """ firstObject = self.objectList[0] if isinstance(firstObject, ac.Planet): if 'star.' in param: return _starPars[param[5:]] # cut off star... |
def _processResults(self): """ Checks each result can meet SNR requirments, adds to count :return: """ resultsByClass = self._genEmptyResults() for astroObject in self.objectList: sortKey = self._getSortKey(astroObject) resultsByClass[sortKey] += 1 return resultsByClass |
def _getPlotData(self): """ Turns the resultsByClass Dict into a list of bin groups skipping the uncertain group if empty return: (label list, ydata list) :rtype: tuple(list(str), list(float)) """ resultsByClass = self.resultsByClass try: if resultsByClass['Uncertain'] == 0: # remove uncertain tag if present and = 0 re... |
def _genEmptyResults(self): """ Uses allowed keys to generate a empty dict to start counting from :return: """ allowedKeys = self._allowedKeys keysDict = OrderedDict() # Note: list comprehension take 0 then 2 then 1 then 3 etc for some reason. we want strict order for k in allowedKeys: keysDict[k] = 0 resultsByClass = ... |
def _getSortKey(self, planet): """ Takes a planet and turns it into a key to be sorted by :param planet: :return: """ value = eval('planet.'+self._planetProperty) # TODO some sort of data validation, either before or using try except if self.unit is not None: try: value = value.rescale(self.unit) except AttributeError:... |
def _genKeysBins(self): """ Generates keys from bins, sets self._allowedKeys normally set in _classVariables """ binlimits = self._binlimits allowedKeys = [] midbinlimits = binlimits if binlimits[0] == -float('inf'): midbinlimits = binlimits[1:] # remove the bottom limit allowedKeys.append('<{0}'.format(midbinlimits[0]... |
def set_xaxis(self, param, unit=None, label=None): """ Sets the value of use on the x axis :param param: value to use on the xaxis, should be a variable or function of the objects in objectList. ie 'R' for the radius variable and 'calcDensity()' for the calcDensity function :param unit: the unit to scale the values to,... |
def set_yaxis(self, param, unit=None, label=None): """ Sets the value of use on the yaxis :param param: value to use on the yaxis, should be a variable or function of the objects in objectList. ie 'R' for the radius variable and 'calcDensity()' for the calcDensity function :param unit: the unit to scale the values to :... |
def _set_axis(self, param, unit): """ this should take a variable or a function and turn it into a list by evaluating on each planet """ axisValues = [] for astroObject in self.objectList: try: value = eval('astroObject.{0}'.format(param)) except ac.HierarchyError: # ie trying to call planet.star and one planet is a lo... |
def set_marker_color(self, color='#3ea0e4', edgecolor='k'): """ set the marker color used in the plot :param color: matplotlib color (ie 'r', '#000000') """ # TODO allow a colour set per another variable self._marker_color = color self._edge_color = edgecolor |
def setup_keys(self): """ Build the initial data dictionary to store the values """ discovery_methods = {} discovery_years = {} nan_list = [] # Initial Loop to get keys for planet in self.planet_list: if 'Solar System' in planet.params['list'] and self.skip_solar_system_planets: continue try: discovery_methods[planet.d... |
def plot(self, method_labels=None, exodata_credit=True): """ :param method_labels: list of legend labels for the methods, i.e. give 'Radial Velocity' rather than 'RV' :return: """ if method_labels is None: method_labels = self.methods_to_plot plot_matrix, year_list, discovery_years = self.generate_data() fig = plt.figu... |
True: ax.text(2, 420, 'Generated by ExoData on {}'.format(time.strftime("%d/%m/%Y")), fontsize=11) for i, year in enumerate(year_list): try: total_planets = discovery_years[year] except KeyError: # year with no planets discovered continue # Dont label y_pos = bottom[i]+10 x_pos = i ax.text(x_pos, y_pos, '{}'.format(tot... |
def plot_confusion_matrix(cm, classes, normalize=False, title='Confusion matrix', cmap=plt.cm.Blues): """ This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. """ if normalize: cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis] print("Normalized confusion m... |
def is_zsettable(s): """quick check that all values in a dict are reals""" return all(map(lambda x: isinstance(x, (int, float, long)), s.values())) |
def trim(self, start, stop): """Trim the list to the specified range of elements.""" return self.client.ltrim(self.name, start, stop - 1) |
def remove(self, value, count=1): """Remove occurences of ``value`` from the list. :keyword count: Number of matching values to remove. Default is to remove a single value. """ count = self.client.lrem(self.name, value, num=count) if not count: raise ValueError("%s not in list" % value) return count |
def remove(self, member): """Remove element from set; it must be a member. :raises KeyError: if the element is not a member. """ if not self.client.srem(self.name, member): raise KeyError(member) |
def pop(self): """Remove and return an arbitrary set element. :raises KeyError: if the set is empty. """ member = self.client.spop(self.name) if member is not None: return member raise KeyError() |
def union(self, other): """Return the union of sets as a new set. (i.e. all elements that are in either set.) Operates on either redish.types.Set or __builtins__.set. """ if isinstance(other, self.__class__): return self.client.sunion([self.name, other.name]) else: return self._as_set().union(other) |
def update(self, other): """Update this set with the union of itself and others.""" if isinstance(other, self.__class__): return self.client.sunionstore(self.name, [self.name, other.name]) else: return map(self.add, other) |
def intersection(self, other): """Return the intersection of two sets as a new set. (i.e. all elements that are in both sets.) Operates on either redish.types.Set or __builtins__.set. """ if isinstance(other, self.__class__): return self.client.sinter([self.name, other.name]) else: return self._as_set().intersection(ot... |
def intersection_update(self, other): """Update the set with the intersection of itself and another.""" return self.client.sinterstore(self.name, [self.name, other.name]) |
def difference(self, *others): """Return the difference of two or more sets as a new :class:`set`. (i.e. all elements that are in this set but not the others.) Operates on either redish.types.Set or __builtins__.set. """ if all([isinstance(a, self.__class__) for a in others]): return self.client.sdiff([self.name] + [ot... |
def difference_update(self, other): """Remove all elements of another set from this set.""" return self.client.sdiffstore(self.name, [self.name, other.name]) |
def add(self, member, score): """Add the specified member to the sorted set, or update the score if it already exist.""" return self.client.zadd(self.name, member, score) |
def remove(self, member): """Remove member.""" if not self.client.zrem(self.name, member): raise KeyError(member) |
def increment(self, member, amount=1): """Increment the score of ``member`` by ``amount``.""" return self.client.zincrby(self.name, member, amount) |
def range_by_score(self, min, max, num=None, withscores=False): """Return all the elements with score >= min and score <= max (a range query) from the sorted set.""" return self.client.zrangebyscore(self.name, min, max, num=num, withscores=withscores) |
def pop(self, key, *args, **kwargs): """Remove specified key and return the corresponding value. :keyword default: If key is not found, ``default`` is returned if given, otherwise :exc:`KeyError` is raised. """ try: val = self[key] except KeyError: if len(args): return args[0] if "default" in kwargs: return kwargs["def... |
def full(self): """Return ``True`` if the queue is full, ``False`` otherwise (not reliable!). Only applicable if :attr:`maxsize` is set. """ return self.maxsize and len(self.list) >= self.maxsize or False |
def get(self, block=True, timeout=None): """Remove and return an item from the queue. If optional args ``block`` is ``True`` and ``timeout`` is ``None`` (the default), block if necessary until an item is available. If ``timeout`` is a positive number, it blocks at most ``timeout`` seconds and raises the :exc:`Queue.Emp... |
def put(self, item, **kwargs): """Put an item into the queue.""" if self.full(): raise Full() self._append(item) |
def increment(self, member, amount=1): """Increment the score of ``member`` by ``amount``.""" self._dict[member] += amount return self._dict[member] |
def range_by_score(self, min, max): """Return all the elements with score >= min and score <= max (a range query) from the sorted set.""" data = self.items() keys = [r[1] for r in data] start = bisect.bisect_left(keys, min) end = bisect.bisect_right(keys, max, start) return self._as_set()[start:end] |
def connect(self): """Connect to the given socket""" if not self.connected: self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.socket.connect(self.address) self.connected = True |
def send(self, data): """Send a formatted message to the ADB server""" self._send_data(int_to_hex(len(data))) self._send_data(data) |
def _send_data(self, data): """Send data to the ADB server""" total_sent = 0 while total_sent < len(data): # Send only the bytes that haven't been # sent yet sent = self.socket.send(data[total_sent:].encode("ascii")) if sent == 0: self.close() raise RuntimeError("Socket connection dropped, " "send failed") total_sent +... |
def receive_until_end(self, timeout=None): """ Reads and blocks until the socket closes Used for the "shell" command, where STDOUT and STDERR are just redirected to the terminal with no length """ if self.receive_fixed_length(4) != "OKAY": raise SocketError("Socket communication failed: " "the server did not return a v... |
def defaults(f, self, *args, **kwargs): """ For ``PARAMETERS`` keys, replace None ``kwargs`` with ``self`` attr values. Should be applied on the top of any decorator stack so other decorators see the "right" kwargs. Will also apply transformations found in ``TRANSFORMS``. """ for name, data in PARAMETERS.iteritems(): k... |
def requires(*params): """ Raise ValueError if any ``params`` are omitted from the decorated kwargs. None values are considered omissions. Example usage on an AWS() method: @requires('zone', 'security_groups') def my_aws_method(self, custom_args, **kwargs): # We'll only get here if 'kwargs' contained non-None values fo... |
def get_security_group_id(self, name): """ Take name string, give back security group ID. To get around VPC's API being stupid. """ # Memoize entire list of groups if not hasattr(self, '_security_groups'): self._security_groups = {} for group in self.get_all_security_groups(): self._security_groups[group.name] = group.... |
def get_instance_subnet_name(self, instance): """ Return a human readable name for given instance's subnet, or None. Uses stored config mapping of subnet IDs to names. """ # TODO: we have to do this here since we are monkeypatching Instance. # If we switch to custom Instance (sub)class then we could do it in the # obje... |
def get_subnet_id(self, name): """ Return subnet ID for given ``name``, if it exists. E.g. with a subnet mapping of ``{'abc123': 'ops', '67fd56': 'prod'}``, ``get_subnet_id('ops')`` would return ``'abc123'``. If the map has non-unique values, the first matching key will be returned. If no match is found, the given ``na... |
def create(self, hostname, **kwargs): """ Create new EC2 instance named ``hostname``. You may specify keyword arguments matching those of ``__init__`` (e.g. ``size``, ``ami``) to override any defaults given when the object was created, or to fill in parameters not given at initialization time. Additional parameters tha... |
instance.state != 'running': self.log(".", end='') time.sleep(tick) instance.update() return instance |
def get(self, arg): """ Return instance object with given EC2 ID or nametag. """ try: reservations = self.get_all_instances(filters={'tag:Name': [arg]}) instance = reservations[0].instances[0] except IndexError: try: instance = self.get_all_instances([arg])[0].instances[0] except (_ResponseError, IndexError): # TODO: e... |
def get_volumes_for_instance(self, arg, device=None): """ Return all EC2 Volume objects attached to ``arg`` instance name or ID. May specify ``device`` to limit to the (single) volume attached as that device. """ instance = self.get(arg) filters = {'attachment.instance-id': instance.id} if device is not None: filters['... |
def terminate(self, arg): """ Terminate instance with given EC2 ID or nametag. """ instance = self.get(arg) with self.msg("Terminating %s (%s): " % (instance.name, instance.id)): instance.rename("old-%s" % instance.name) instance.terminate() while instance.state != 'terminated': time.sleep(5) self.log(".", end='') inst... |
def _get(self): """get and parse data stored in self.path.""" data, stat = self.zk.get(self.path) if not len(data): return {}, stat.version if self.OLD_SEPARATOR in data: return self._get_old() return json.loads(data), stat.version |
def _set(self, data, version): """serialize and set data to self.path.""" self.zk.set(self.path, json.dumps(data), version) |
def _get_old(self): """get and parse data stored in self.path.""" def _deserialize(d): if not len(d): return {} return dict(l.split(self.OLD_SEPARATOR) for l in d.split('\n')) data, stat = self.zk.get(self.path) return _deserialize(data.decode('utf8')), stat.version |
def create_config(self, env, conf): """ Set conf to env under service. pass None to env for root. """ if not isinstance(conf, collections.Mapping): raise ValueError("conf must be a collections.Mapping") self.zk.ensure_path(self.view_path) self._create( self._get_env_path(env), conf ) self._update_view(env) |
def set_config(self, env, conf, version): """ Set conf to env under service. pass None to env for root. """ if not isinstance(conf, collections.Mapping): raise ValueError("conf must be a collections.Mapping") self._set( self._get_env_path(env), conf, version ) path = self._get_env_path(env) """Update env's children wit... |
def get_config(self, hostname): """ Returns a configuration for hostname. """ version, config = self._get( self.associations.get(hostname) ) return config |
def get_view_by_env(self, env): """ Returns the view of `env`. """ version, data = self._get(self._get_view_path(env)) return data |
def assoc_host(self, hostname, env): """ Associate a host with an environment. hostname is opaque to Jones. Any string which uniquely identifies a host is acceptable. """ dest = self._get_view_path(env) self.associations.set(hostname, dest) |
def get_associations(self, env): """ Get all the associations for this env. Root cannot have associations, so return None for root. returns a map of hostnames to environments. """ if env.is_root: return None associations = self.associations.get_all() return [assoc for assoc in associations if associations[assoc] == sel... |
def _flatten_from_root(self, env): """ Flatten values from root down in to new view. """ nodes = env.components # Path through the znode graph from root ('') to env path = [nodes[:n] for n in xrange(len(nodes) + 1)] # Expand path and map it to the root path = map( self._get_env_path, [Env('/'.join(p)) for p in path] ) ... |
def encode(self, value): """Encode value.""" value = self.serialize(value) if self.encoding: value = value.encode(self.encoding) return value |
def decode(self, value): """Decode value.""" if self.encoding: value = value.decode(self.encoding) return self.deserialize(value) |
def install(packagename, save, save_dev, save_test, filename): """ Install the package via pip, pin the package only to requirements file. Use option to decide which file the package will be pinned to. """ print('Installing ', packagename) print(sh_pip.install(packagename)) if not filename: filename = get_filename(save... |
def remove(packagename, save, save_dev, save_test, filename): """ Uninstall the package and remove it from requirements file. """ print(sh_pip.uninstall(packagename, "-y")) if not filename: filename = get_filename(save, save_dev, save_test) remove_requirements(packagename, filename) |
def os_path_split_asunder(path, debug=False): """ http://stackoverflow.com/a/4580931/171094 """ parts = [] while True: newpath, tail = os.path.split(path) if debug: print repr(path), (newpath, tail) if newpath == path: assert not tail if path: parts.append(path) break parts.append(tail) path = newpath parts.reverse() r... |
def is_subdirectory(potential_subdirectory, expected_parent_directory): """ Is the first argument a sub-directory of the second argument? :param potential_subdirectory: :param expected_parent_directory: :return: True if the potential_subdirectory is a child of the expected parent directory """ def _get_normalized_parts... |
def update_all_files(dk_api, kitchen, recipe_name, recipe_dir, message, dryrun=False): """ reutrns a string. :param dk_api: -- api object :param kitchen: string :param recipe_name: string -- kitchen name, string :param recipe_dir: string - path to the root of the directory :param message: string message -- commit messa... |
rc = DKCloudCommandRunner._add_new_files(dk_api, rl['only_local'], kitchen, recipe_name, message, dryrun) if not rc.ok(): return rc msg_additions = rc.get_message() rc = DKCloudCommandRunner._remove_deleted_files(dk_api, rl['only_remote'], kitchen, recipe_name, message, dryrun) if not rc.ok(): return rc msg_deletions =... |
def update_file(dk_api, kitchen, recipe_name, message, files_to_update_param): """ reutrns a string. :param dk_api: -- api object :param kitchen: string :param recipe_name: string -- kitchen name, string :param message: string message -- commit message, string :param files_to_update_param: string -- file system directo... |
rc.set(rc.DK_FAIL, msg) return rc except ValueError as e: if len(msg) != 0: msg += '\n' msg += 'ERROR: %s' % e.message rc.set(rc.DK_FAIL, msg) return rc rc = dk_api.update_file(kitchen, recipe_name, message, file_to_update, file_contents) if not rc.ok(): if len(msg) != 0: msg += '\n' msg += 'DKCloudCommand.update_file ... |
def add_file(dk_api, kitchen, recipe_name, message, api_file_key): """ returns a string. :param dk_api: -- api object :param kitchen: string :param recipe_name: string :param message: string -- commit message, string :param api_file_key: string -- directory where the recipe file lives :rtype: DKReturnCode """ rc = DKRe... |
message, api_file_key, file_contents) if rc.ok(): rs = 'DKCloudCommand.add_file for %s succeed' % api_file_key else: rs = 'DKCloudCommand.add_file for %s failed\nmessage: %s' % (api_file_key, rc.get_message()) rc.set_message(rs) return rc |
def delete_file(dk_api, kitchen, recipe_name, message, files_to_delete_param): """ returns a string. :param dk_api: -- api object :param kitchen: string :param recipe_name: string -- kitchen name, string :param message: string message -- commit message, string :param files_to_delete_param: path to the files to delete :... |
'DKCloudCommand.delete_file for %s succeed' % file_to_delete rc.set_message(msg) return rc |
def watch_active_servings(dk_api, kitchen, period): """ returns a string. :param dk_api: -- api object :param kitchen: string :param period: integer :rtype: string """ print 'period', period # try: # p = int(period) # except ValueError: # return 'DKCloudCommand.watch_active_servings requires an integer for the period' ... |
def get_compiled_serving(dk_api, kitchen, recipe_name, variation_name): """ returns a string. :param dk_api: -- api object :param kitchen: string :param recipe_name: string -- kitchen name, string :param variation_name: string -- name of the recipe variation_name to be used :rtype: DKReturnCode """ rc = dk_api.get_comp... |
def merge_kitchens_improved(dk_api, from_kitchen, to_kitchen): """ returns a string. :param dk_api: -- api object :param from_kitchen: string :param to_kitchen: string -- kitchen name, string :rtype: DKReturnCode """ unresolved_conflicts = DKKitchenDisk.get_unresolved_conflicts(from_kitchen, to_kitchen) if unresolved_c... |
the findings rs = DKCloudCommandRunner.print_merge_conflicts(md.get_payload()) md.set_message(rs) else: # We are in a recipe folder, so let's write out the conflicted files. rc = DKCloudCommandRunner.write_merge_conflicts(md.get_payload()) if rc.ok(): md.set_message(rc.get_message()) else: md = rc return md |
def create_order(dk_api, kitchen, recipe_name, variation_name, node_name=None): """ returns a string. :param dk_api: -- api object :param kitchen: string :param recipe_name: string -- kitchen name, string :param variation_name: string -- name of the recipe variation_name to be run :param node_name: string -- name of th... |
def orderrun_detail(dk_api, kitchen, pd): """ returns a string. :param dk_api: -- api object :param kitchen: string :param pd: dict :rtype: DKReturnCode """ if DKCloudCommandRunner.SUMMARY in pd: display_summary = True else: display_summary = False # always get summary information pd[DKCloudCommandRunner.SUMMARY] = Tru... |
newest serving dex = -1 latest = None for i, serving in enumerate(serving_list): if DKCloudCommandRunner.ORDER_ID in serving and serving[DKCloudCommandRunner.ORDER_ID] > latest: latest = serving[DKCloudCommandRunner.ORDER_ID] dex = i if dex != -1: serving = serving_list[dex] if serving is None: rc.set(rc.DK_FAIL, "No O... |
kitchen if summary and 'name' in summary: s += 'Recipe:\t\t%s\n' % summary['name'] else: s += 'Recipe:\t\t%s\n' % 'Not available' # variation name is inside the order id, pull it out s += 'Variation:\t%s\n' % orid_from_serving.split('#')[3] if summary and 'start-time' in summary: start_time = summary['start-time'] if i... |
DKCloudCommandRunner.TIMINGRESULTS in serving and \ isinstance(serving[DKCloudCommandRunner.TIMINGRESULTS], basestring): s += '\n\nTIMING RESULTS\n\n' s += serving[DKCloudCommandRunner.TIMINGRESULTS] if serving and DKCloudCommandRunner.LOGS in serving and \ isinstance(serving[DKCloudCommandRunner.LOGS], basestring): s ... |
DKCloudCommandRunner.ORDER_RUN_ID in serving: s += serving[DKCloudCommandRunner.ORDER_RUN_ID] rc.set_message(s) return rc |
def _split_one_end(path): """ Utility function for splitting off the very end part of a path. """ s = path.rsplit('/', 1) if len(s) == 1: return s[0], '' else: return tuple(s) |
def get_system_config_directory(): """ Return platform specific config directory. """ if platform.system().lower() == 'windows': _cfg_directory = Path(os.getenv('APPDATA') or '~') elif platform.system().lower() == 'darwin': _cfg_directory = Path('~', 'Library', 'Preferences') else: _cfg_directory = Path(os.getenv('XDG_... |
def get_version_exec_mapping_from_path(path): """ Find valid application version from given path object and return a mapping of version, executable. """ version_executable = {} logger.debug('Getting exes from path: {}'.format(path)) for sub_dir in path.iterdir(): if not sub_dir.name.startswith(APPLICATION_NAME): contin... |
def find_applications_on_system(): """ Collect maya version from Autodesk PATH if exists, else try looking for custom executable paths from config file. """ # First we collect maya versions from the Autodesk folder we presume # is addeed to the system environment "PATH" path_env = os.getenv('PATH').split(os.pathsep) ve... |
def build_config(config_file=get_system_config_directory()): """ Construct the config object from necessary elements. """ config = Config(config_file, allow_no_value=True) application_versions = find_applications_on_system() # Add found versions to config if they don't exist. Versions found # in the config file takes p... |
def get_environment_paths(config, env): """ Get environment paths from given environment variable. """ if env is None: return config.get(Config.DEFAULTS, 'environment') # Config option takes precedence over environment key. if config.has_option(Config.ENVIRONMENTS, env): env = config.get(Config.ENVIRONMENTS, env).repla... |
def build_maya_environment(config, env=None, arg_paths=None): """ Construct maya environment. """ maya_env = MayaEnvironment() maya_env.exclude_pattern = config.get_list(Config.PATTERNS, 'exclude') maya_env.icon_extensions = config.get_list(Config.PATTERNS, 'icon_ext') env = get_environment_paths(config, env) if not en... |
def launch(exec_, args): """ Launches application. """ if not exec_: raise RuntimeError( 'Mayalauncher could not find a maya executable, please specify' 'a path in the config file (-e) or add the {} directory location' 'to your PATH system environment.'.format(DEVELOPER_NAME) ) # Launch Maya if args.debug: return watch... |
def main(): """ Main function of maya launcher. Parses the arguments and tries to launch maya with given them. """ config = build_config() parser = argparse.ArgumentParser( description=""" Maya Launcher is a useful script that tries to deal with all important system environments maya uses when starting up. It aims to s... |
default value. If not default value is specified Maya will behave with factory environment setup. """) parser.add_argument( '-p', '--path', metavar='path', type=str, nargs='+', help=""" Path is an optional argument that takes an unlimited number of paths to use for environment creation. Useful if you don't want to crea... |
and config.items(Config.EXECUTABLES): items = dict(config.items(Config.EXECUTABLES)) exec_ = items[sorted(items.keys(), reverse=True)[0]] else: exec_ = exec_default else: exec_ = config.get(Config.EXECUTABLES, args.version) build_maya_environment(config, args.environment, args.path) logger.info('\nDone building maya en... |
def _create_default_config_file(self): """ If config file does not exists create and set default values. """ logger.info('Initialize Maya launcher, creating config file...\n') self.add_section(self.DEFAULTS) self.add_section(self.PATTERNS) self.add_section(self.ENVIRONMENTS) self.add_section(self.EXECUTABLES) self.set(... |
def get_list(self, section, option): """ Convert string value to list object. """ if self.has_option(section, option): return self.get(section, option).replace(' ', '').split(',') else: raise KeyError('{} with {} does not exist.'.format(section, option)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.