code
stringlengths
1
18.2k
def add_argparser(self, root, parents): """ Add arguments for this command. """ parents.append(tools.argparser) parser = root.add_parser('auth', parents=parents) parser.set_defaults(func=self) parser.add_argument( '--secrets', dest='secrets', action='store', help='Path to the authorization secrets file (client_secrets....
def add_config(self, config): """ :param config: :type config: dict """ self.pre_configure() self.config = config if not self.has_revision_file(): #: Create new revision file. touch_file(self.revfile_path) self.history.load(self.revfile_path) self.archiver.target_path = self.dest_path self.archiver.zip_path = self.tmp_...
def filename(self): """ :return: :rtype: str """ filename = self.key if self.has_revision_file() and self.history.current_revision: filename += "-" filename += self.history.current_revision.revision_id filename += ".zip" return filename
def has_commit(self): """ :return: :rtype: boolean """ current_revision = self.history.current_revision revision_id = self.state.revision_id return current_revision.revision_id != revision_id
def revfile_path(self): """ :return: The full path of revision file. :rtype: str """ return os.path.normpath(os.path.join( os.getcwd(), self.config.revision_file ))
def infofile_path(self): """ :return: :rtype: str """ return os.path.normpath(os.path.join( self.dest_path, self.config.info_file ))
def dest_path(self): """ :return: The destination path. :rtype: str """ if os.path.isabs(self.config.local_path): return self.config.local_path else: return os.path.normpath(os.path.join( os.getcwd(), self.config.local_path ))
def tmp_file_path(self): """ :return: :rtype: str """ return os.path.normpath(os.path.join( TMP_DIR, self.filename ))
def save(self, revision): """ :param revision: :type revision: :class:`revision.data.Revision` """ if not isinstance(revision, Revision): raise InvalidArgType() self.state.update(revision)
def has_new_revision(self): """ :return: True if new revision exists, False if not. :rtype: boolean """ if self.history.current_revision is None: return self.state.revision_id is not None current_revision_id = self.history.current_revision.revision_id return self.state.revision_id != current_revision_id
def get_source(self, key, name_spaces=None, default_prefix=''): """Generates the dictionary key for the serialized representation based on the instance variable source and a provided key. :param str key: name of the field in model :returns: self.source or key """ source = self.source or key prefix = default_prefix if n...
def validate(self, raw_data, **kwargs): """Convert the raw_data to an integer. """ try: converted_data = int(raw_data) return super(IntegerField, self).validate(converted_data) except ValueError: raise ValidationException(self.messages['invalid'], repr(raw_data))
def validate(self, raw_data, **kwargs): """Convert the raw_data to a float. """ try: converted_data = float(raw_data) super(FloatField, self).validate(converted_data, **kwargs) return raw_data except ValueError: raise ValidationException(self.messages['invalid'], repr(raw_data))
def validate(self, raw_data, **kwargs): """The string ``'True'`` (case insensitive) will be converted to ``True``, as will any positive integers. """ super(BooleanField, self).validate(raw_data, **kwargs) if isinstance(raw_data, string_types): valid_data = raw_data.strip().lower() == 'true' elif isinstance(raw_data, bo...
def validate(self, raw_data, **kwargs): """The raw_data is returned unchanged.""" super(DateTimeField, self).validate(raw_data, **kwargs) try: if isinstance(raw_data, datetime.datetime): self.converted = raw_data elif self.serial_format is None: # parse as iso8601 self.converted = parse(raw_data) else: self.converted =...
def deserialize(self, raw_data, **kwargs): """A :class:`datetime.datetime` object is returned.""" super(DateTimeField, self).deserialize(raw_data, **kwargs) return self.converted
def _clean_post_content(blog_url, content): """ Replace import path with something relative to blog. """ content = re.sub( "<img.src=\"%s(.*)\"" % blog_url, lambda s: "<img src=\"%s\"" % _get_relative_upload(s.groups(1)[0]), content) return content
def register_conversion_handler(self, name, handler): u""" Регистрация обработчика конвертирования :param name: Имя обработчика в таблице соответствия :param handler: Обработчик """ if name in self.conversion_table: warnings.warn(( u'Конвертирующий тип с именем {} уже ' u'существует и будет перезаписан!' ).format(name)...
def conversion_handler(self, name): u""" Возвращает обработчик конвертации с указанным именем :param name: Имя обработчика :return: callable """ try: handler = self.conversion_table[name] except KeyError: raise KeyError(( u'Конвертирующий тип с именем {} отсутствует ' u'в таблице соответствия!' ).format(name)) return h...
def get(self, key, default=None): u""" Возвращает значение с указанным ключем Пример вызова: value = self.get('system.database.name') :param key: Имя параметра :param default: Значение, возвращаемое по умолчанию :return: mixed """ segments = key.split('.') result = reduce( lambda dct, k: dct and dct.get(k) or None, seg...
def get_converted(self, key, conversion_type, default=None): u""" Возвращает значение, приведенное к типу, соответствующему указанному типу из таблицы соответствия :param key: Имя параметра :param conversion_type: Имя обработчика конвертации из таблицы соответствия :param default: Значение по умолчанию :return: mixed "...
def get_by_type(self, key, conversion_func, default=None): u""" Возвращает значение, приведенное к типу с использованием переданной функции :param key: Имя параметра :param conversion_func: callable объект, принимающий и возвращающий значение :param default: Значение по умолчанию :return: mixed """ if not self.has_para...
def get_int(self, key, default=None): u""" Возвращает значение, приведенное к числовому """ return self.get_converted( key, ConversionTypeEnum.INTEGER, default=default)
def get_bool(self, key, default=None): u""" Возвращает значение, приведенное к булеву """ return self.get_converted( key, ConversionTypeEnum.BOOL, default=default)
def _queue(self, kwargs): """The hard resource_list comes like this: '<qname>=TRUE,mem=128M'. To process it we have to split it twice (',' and then on '='), create a dictionary and extract just the qname""" if not 'hard resource_list' in kwargs: return 'all.q' d = dict([k.split('=') for k in kwargs['hard resource_list'...
def submit(self, command_line, name = None, array = None, dependencies = [], exec_dir = None, log_dir = "logs", dry_run = False, verbosity = 0, stop_on_failure = False, **kwargs): """Submits a job that will be executed in the grid.""" # add job to database self.lock() job = add_job(self.session, command_line, name, dep...
def communicate(self, job_ids = None): """Communicates with the SGE grid (using qstat) to see if jobs are still running.""" self.lock() # iterate over all jobs jobs = self.get_jobs(job_ids) for job in jobs: job.refresh() if job.status in ('queued', 'executing', 'waiting') and job.queue_name != 'local': status = qstat(j...
def resubmit(self, job_ids = None, also_success = False, running_jobs = False, new_command=None, verbosity=0, keep_logs=False, **kwargs): """Re-submit jobs automatically""" self.lock() # iterate over all jobs jobs = self.get_jobs(job_ids) if new_command is not None: if len(jobs) == 1: jobs[0].set_command_line(new_comma...
arguments[arg] job.set_arguments(kwargs=arguments) # delete old status and result of the job if not keep_logs: self.delete_logs(job) job.submit() if job.queue_name == 'local' and 'queue' not in arguments: logger.warn("Re-submitting job '%s' locally (since no queue name is specified)." % job) else: deps = [dep.unique fo...
def run_job(self, job_id, array_id = None): """Overwrites the run-job command from the manager to extract the correct job id before calling base class implementation.""" # get the unique job id from the given grid id self.lock() jobs = list(self.session.query(Job).filter(Job.id == job_id)) if len(jobs) != 1: self.unloc...
def stop_jobs(self, job_ids): """Stops the jobs in the grid.""" self.lock() jobs = self.get_jobs(job_ids) for job in jobs: if job.status in ('executing', 'queued', 'waiting'): qdel(job.id, context=self.context) logger.info("Stopped job '%s' in the SGE grid." % job) job.submit() self.session.commit() self.unlock()
def encrypt(self, pubkey: str, nonce: Union[str, bytes], text: Union[str, bytes]) -> str: """ Encrypt message text with the public key of the recipient and a nonce The nonce must be a 24 character string (you can use libnacl.utils.rand_nonce() to get one) and unique for each encrypted message. Return base58 encoded enc...
def decrypt(self, pubkey: str, nonce: Union[str, bytes], text: str) -> str: """ Decrypt encrypted message text with recipient public key and the unique nonce used by the sender. :param pubkey: Public key of the recipient :param nonce: Unique nonce used by the sender :param text: Encrypted message :return: """ sender_pu...
def encrypt_seal(self, data: Union[str, bytes]) -> bytes: """ Encrypt data with a curve25519 version of the ed25519 public key :param data: Bytes data to encrypt """ curve25519_public_key = libnacl.crypto_sign_ed25519_pk_to_curve25519(self.pk) return libnacl.crypto_box_seal(ensure_bytes(data), curve25519_public_key)
def override_default_templates(self): """ Override the default emails already defined by other apps """ if plugs_mail_settings['OVERRIDE_TEMPLATE_DIR']: dir_ = plugs_mail_settings['OVERRIDE_TEMPLATE_DIR'] for file_ in os.listdir(dir_): if file_.endswith(('.html', 'txt')): self.overrides[file_] = dir_
def get_apps(self): """ Get the list of installed apps and return the apps that have an emails module """ templates = [] for app in settings.INSTALLED_APPS: try: app = import_module(app + '.emails') templates += self.get_plugs_mail_classes(app) except ImportError: pass return templates
def get_template_files(self, location, class_name): """ Multilanguage support means that for each template we can have multiple templtate files, this methods returns all the template (html and txt) files that match the (class) template name """ template_name = utils.camel_to_snake(class_name) dir_ = location[:-9] + 'te...
def get_plugs_mail_classes(self, app): """ Returns a list of tuples, but it should return a list of dicts """ classes = [] members = self.get_members(app) for member in members: name, cls = member if inspect.isclass(cls) and issubclass(cls, PlugsMail) and name != 'PlugsMail': files_ = self.get_template_files(app.__file...
def get_template_language(self, file_): """ Return the template language Every template file must end in with the language code, and the code must match the ISO_6301 lang code https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes valid examples: account_created_pt.html payment_created_en.txt """ stem = Path(file_).stem...
def get_subject(self, text): """ Email template subject is the first line of the email template, we can optionally add SUBJECT: to make it clearer """ first_line = text.splitlines(True)[0] # TODO second line should be empty if first_line.startswith('SUBJECT:'): subject = first_line[len('SUBJECT:'):] else: subject = fir...
def create_templates(self, templates): """ Gets a list of templates to insert into the database """ count = 0 for template in templates: if not self.template_exists_db(template): name, location, description, language = template text = self.open_file(location) html_content = self.get_html_content(text) data = { 'name': ...
def open_file(self, file_): """ Receives a file path has input and returns a string with the contents of the file """ with open(file_, 'r', encoding='utf-8') as file: text = '' for line in file: text += line return text
def template_exists_db(self, template): """ Receives a template and checks if it exists in the database using the template name and language """ name = utils.camel_to_snake(template[0]).upper() language = utils.camel_to_snake(template[3]) try: models.EmailTemplate.objects.get(name=name, language=language) except models...
def invalidate_caches(cls): """Call the invalidate_caches() method on all path entry finders stored in sys.path_importer_caches (where implemented).""" for finder in sys.path_importer_cache.values(): if hasattr(finder, 'invalidate_caches'): finder.invalidate_caches()
def _path_hooks(cls, path): # from importlib.PathFinder """Search sys.path_hooks for a finder for 'path'.""" if sys.path_hooks is not None and not sys.path_hooks: warnings.warn('sys.path_hooks is empty', ImportWarning) for hook in sys.path_hooks: try: return hook(path) except ImportError: continue else: return None
def _path_importer_cache(cls, path): # from importlib.PathFinder """Get the finder for the path entry from sys.path_importer_cache. If the path entry is not in the cache, find the appropriate finder and cache it. If no finder is available, store None. """ if path == '': try: path = os.getcwd() except FileNotFoundError:...
def _get_spec(cls, fullname, path, target=None): """Find the loader or namespace_path for this module/package name.""" # If this ends up being a namespace package, namespace_path is # the list of paths that will become its __path__ namespace_path = [] for entry in path: if not isinstance(entry, (str, bytes)): continue ...
= namespace_path return spec
def find_module(cls, fullname, path=None): """find the module on sys.path or 'path' based on sys.path_hooks and sys.path_importer_cache. This method is for python2 only """ spec = cls.find_spec(fullname, path) if spec is None: return None elif spec.loader is None and spec.submodule_search_locations: # Here we need to c...
def find_spec(cls, fullname, path=None, target=None): """find the module on sys.path or 'path' based on sys.path_hooks and sys.path_importer_cache.""" if path is None: path = sys.path spec = cls._get_spec(fullname, path, target) if spec is None: return None elif spec.loader is None: namespace_path = spec.submodule_sear...
def find_spec(self, fullname, target=None): """Try to find a spec for the specified module. Returns the matching spec, or None if not found.""" is_namespace = False tail_module = fullname.rpartition('.')[2] base_path = os.path.join(self.path, tail_module) for suffix, loader_class in self._loaders: init_filename = '__in...
def find_loader(self, fullname): """Try to find a loader for the specified module, or the namespace package portions. Returns (loader, list-of-portions). This method is deprecated. Use find_spec() instead. """ spec = self.find_spec(fullname) if spec is None: return None, [] return spec.loader, spec.submodule_search_loc...
def find_module(self, fullname): """Try to find a loader for the specified module, or the namespace package portions. Returns loader. """ spec = self.find_spec(fullname) if spec is None: return None # We need to handle the namespace case here for python2 if spec.loader is None and len(spec.submodule_search_locations): ...
def path_hook(cls, *loader_details): """A class method which returns a closure to use on sys.path_hook which will return an instance using the specified loaders and the path called on the closure. If the path called on the closure is not a directory, ImportError is raised. """ def path_hook_for_FileFinder2(path): """Pa...
def t_IDENTIFIER(t): r"[A-Z_a-z][0-9A-Z_a-z]*" if t.value in keywords: t.type = t.value return t
def getid(self, idtype): ''' idtype in Uniq constants ''' memorable_id = None while memorable_id in self._ids: l=[] for _ in range(4): l.append(str(randint(0, 19))) memorable_id = ''.join(l) self._ids.append(memorable_id) return idtype + '-' + memorable_id
def register_deregister(notifier, event_type, callback=None, args=None, kwargs=None, details_filter=None, weak=False): """Context manager that registers a callback, then deregisters on exit. NOTE(harlowja): if the callback is none, then this registers nothing, which is different from the behavior of the ``register`` me...
def dead(self): """Whether the callback no longer exists. If the callback is maintained via a weak reference, and that weak reference has been collected, this will be true instead of false. """ if not self._weak: return False cb = self._callback() if cb is None: return True return False
def is_equivalent(self, callback, details_filter=None): """Check if the callback provided is the same as the internal one. :param callback: callback used for comparison :param details_filter: callback used for comparison :returns: false if not the same callback, otherwise true :rtype: boolean """ cb = self.callback if ...
def is_registered(self, event_type, callback, details_filter=None): """Check if a callback is registered. :param event_type: event type callback was registered to :param callback: callback that was used during registration :param details_filter: details filter that was used during registration :returns: if the callback...
def _do_dispatch(self, listeners, event_type, details): """Calls into listeners, handling failures and logging as needed.""" possible_calls = len(listeners) call_failures = 0 for listener in listeners: try: listener(event_type, details.copy()) except Exception: self._logger.warn( "Failure calling listener %s to notify ...
def notify(self, event_type, details): """Notify about an event occurrence. All callbacks registered to receive notifications about given event type will be called. If the provided event type can not be used to emit notifications (this is checked via the :meth:`.can_be_registered` method) then a value error will be rai...
" notifications" % event_type) listeners = list(self._topics.get(self.ANY, [])) listeners.extend(self._topics.get(event_type, [])) if not details: details = {} fut = self._executor.submit(self._do_dispatch, listeners, event_type, details) return fut
def register(self, event_type, callback, args=None, kwargs=None, details_filter=None, weak=False): """Register a callback to be called when event of a given type occurs. Callback will be called with provided ``args`` and ``kwargs`` and when event type occurs (or on any event if ``event_type`` equals to :attr:`.ANY`). I...
reference or a strong reference (defaults to holding a strong reference) :type weak: bool :returns: the listener that was registered :rtype: :py:class:`~.Listener` """ if not six.callable(callback): raise ValueError("Event callback must be callable") if details_filter is not None: if not six.callable(details_filter): r...
def deregister(self, event_type, callback, details_filter=None): """Remove a single listener bound to event ``event_type``. :param event_type: deregister listener bound to event_type :param callback: callback that was used during registration :param details_filter: details filter that was used during registration :retu...
def deregister_by_uuid(self, event_type, uuid): """Remove a single listener bound to event ``event_type``. :param event_type: deregister listener bound to event_type :param uuid: uuid of listener to remove :returns: if the listener was deregistered :rtype: boolean """ with self._lock: listeners = self._topics.get(event...
def copy(self): """Clones this notifier (and its bound listeners).""" c = copy.copy(self) c._topics = {} c._lock = threading.Lock() topics = set(six.iterkeys(self._topics)) while topics: event_type = topics.pop() try: listeners = self._topics[event_type] c._topics[event_type] = list(listeners) except KeyError: pass ret...
def listeners_iter(self): """Return an iterator over the mapping of event => listeners bound. The listener list(s) returned should **not** be mutated. NOTE(harlowja): Each listener in the yielded (event, listeners) tuple is an instance of the :py:class:`~.Listener` type, which itself wraps a provided callback (and its ...
def can_be_registered(self, event_type): """Checks if the event can be registered/subscribed to. :param event_type: event that needs to be verified :returns: whether the event can be registered/subscribed to :rtype: boolean """ return (event_type in self._watchable_events or (event_type == self.ANY and self._allow_any)...
def read_local_files(*file_paths: str) -> str: """ Reads one or more text files and returns them joined together. A title is automatically created based on the file name. Args: *file_paths: list of files to aggregate Returns: content of files """ def _read_single_file(file_path): with open(file_path) as f: filename = o...
def _readfile(cls, filename): """ Reads a file a utf-8 file, and retuns character tokens. :param filename: Name of file to be read. """ f = codecs.open(filename, encoding='utf-8') filedata = f.read() f.close() tokenz = LM.tokenize(filedata, mode='c') #print tokenz return tokenz
def train(self, root=''): """ Trains our Language Model. :param root: Path to training data. """ self.trainer = Train(root=root) corpus = self.trainer.get_corpus() # Show loaded Languages #print 'Lang Set: ' + ' '.join(train.get_lang_set()) for item in corpus: self.lm.add_doc(doc_id=item[0], doc_terms=self._readfile(it...
def is_training_modified(self): """ Returns `True` if training data was modified since last training. Returns `False` otherwise, or if using builtin training data. """ last_modified = self.trainer.get_last_modified() if last_modified > self.training_timestamp: return True else: return False
def add_training_sample(self, text=u'', lang=''): """ Initial step for adding new sample to training data. You need to call `save_training_samples()` afterwards. :param text: Sample text to be added. :param lang: Language label for the input text. """ self.trainer.add(text=text, lang=lang)
def save_training_samples(self, domain='', filename=''): """ Saves data previously added via add_training_sample(). Data saved in folder specified by Train.get_corpus_path(). :param domain: Name for domain folder. If not set, current timestamp will be used. :param filename: Name for file to save data in. If not set, fi...
def classify(self, text=u''): """ Predicts the Language of a given text. :param text: Unicode text to be classified. """ text = self.lm.normalize(text) tokenz = LM.tokenize(text, mode='c') result = self.lm.calculate(doc_terms=tokenz) #print 'Karbasa:', self.karbasa(result) if self.unk and self.lm.karbasa(result) < self...
def exists(c_table_cd: str, tables: I2B2Tables) -> int: """ Return the number of records that exist with the table code. - Ideally this should be zero or one, but the default table doesn't have a key :param c_table_cd: key to test :param tables: :return: number of records found """ conn = tables.ont_connection table = ...
def del_records(c_table_cd: str, tables: I2B2Tables) -> int: """ Delete all records with c_table_code :param c_table_cd: key to delete :param tables: :return: number of records deleted """ conn = tables.ont_connection table = tables.schemes return conn.execute(table.delete().where(table.c.c_table_cd == c_table_cd)).row...
def read_config(filename=None): """ Read a config filename into .ini format and return dict of shares. Keyword arguments: filename -- the path of config filename (default None) Return dict. """ if not os.path.exists(filename): raise IOError('Impossibile trovare il filename %s' % filename) shares = [] config = ConfigPar...
def lock(self): """Generates (and returns) a blocking session object to the database.""" if hasattr(self, 'session'): raise RuntimeError('Dead lock detected. Please do not try to lock the session when it is already locked!') if LooseVersion(sqlalchemy.__version__) < LooseVersion('0.7.8'): # for old sqlalchemy versions,...
def unlock(self): """Closes the session to the database.""" if not hasattr(self, 'session'): raise RuntimeError('Error detected! The session that you want to close does not exist any more!') logger.debug("Closed database session of '%s'" % self._database) self.session.close() del self.session
def _create(self): """Creates a new and empty database.""" from .tools import makedirs_safe # create directory for sql database makedirs_safe(os.path.dirname(self._database)) # create all the tables Base.metadata.create_all(self._engine) logger.debug("Created new empty database '%s'" % self._database)
def get_jobs(self, job_ids = None): """Returns a list of jobs that are stored in the database.""" if job_ids is not None and len(job_ids) == 0: return [] q = self.session.query(Job) if job_ids is not None: q = q.filter(Job.unique.in_(job_ids)) return sorted(list(q), key=lambda job: job.unique)
def run_job(self, job_id, array_id = None): """This function is called to run a job (e.g. in the grid) with the given id and the given array index if applicable.""" # set the job's status in the database try: # get the job from the database self.lock() jobs = self.get_jobs((job_id,)) if not len(jobs): # it seems that t...
command_line = job.get_command_line() exec_dir = job.get_exec_dir() self.unlock() logger.info("Starting job %d: %s", job_id, " ".join(command_line)) # execute the command line of the job, and wait until it has finished try: result = subprocess.call(command_line, cwd=exec_dir) logger.info("Job %d finished with result %s...
and job.status == 'failure': # the job has failed # stop this and all dependent jobs from execution dependent_jobs = job.get_jobs_waiting_for_us() dependent_job_ids = set([dep.unique for dep in dependent_jobs] + [job.unique]) while len(dependent_jobs): dep = dependent_jobs.pop(0) new = dep.get_jobs_waiting_for_us() dep...
def list(self, job_ids, print_array_jobs = False, print_dependencies = False, long = False, print_times = False, status=Status, names=None, ids_only=False): """Lists the jobs currently added to the database.""" # configuration for jobs fields = ("job-id", "grid-id", "queue", "status", "job-name") lengths = (6, 17, 11, ...
if not ids_only: print(' '.join(header)) print(delimiter) self.lock() for job in self.get_jobs(job_ids): job.refresh() if job.status in status and (names is None or job.name in names): if ids_only: print(job.unique, end=" ") else: print(job.format(format, dependency_length)) if print_times: print(times(job)) if (not id...
def report(self, job_ids=None, array_ids=None, output=True, error=True, status=Status, name=None): """Iterates through the output and error files and write the results to command line.""" def _write_contents(job): # Writes the contents of the output and error files to command line out_file, err_file = job.std_out_file(...
job id must be given.") array_jobs = list(self.session.query(ArrayJob).join(Job).filter(Job.unique.in_(job_ids)).filter(Job.unique == ArrayJob.job_id).filter(ArrayJob.id.in_(array_ids))) if array_jobs: print(array_jobs[0].job) _write_array_jobs(array_jobs) else: # iterate over all jobs jobs = self.get_jobs(job_ids) for...
def delete(self, job_ids, array_ids = None, delete_logs = True, delete_log_dir = False, status = Status, delete_jobs = True): """Deletes the jobs with the given ids from the database.""" def _delete_dir_if_empty(log_dir): if log_dir and delete_log_dir and os.path.isdir(log_dir) and not os.listdir(log_dir): os.rmdir(log...
job.array: if job.status in status: if delete_jobs: logger.info("Deleting job '%d' from the database." % job.unique) _delete(job, delete_jobs) else: # iterate over all jobs jobs = self.get_jobs(job_ids) for job in jobs: # delete all array jobs if job.array: for array_job in job.array: if array_job.status in status: if ...
def main(): p = ArgumentParser(description='Makes unit flux eV^-1 as input to GLOW or Transcar to create ionospheric eigenprofiles') p.add_argument('-i', '--inputgridfn', help='original Zettergren input flux grid to base off of', default='zettflux.csv') p.add_argument('-o', '--outfn', help='hdf5 file to write with iono...
options, so I will only plot and not save result') # makeplot = p.makeplot if len(p.simtime) == 1: T = [parse(p.simtime[0])] elif len(p.simtime) == 2: T = list(rrule.rrule(rrule.HOURLY, dtstart=parse(p.simtime[0]), until=parse(p.simtime[1]))) # %% input unit flux Egrid = loadregress(Path(p.inputgridfn).expanduser()) Eb...
lrates, tezs, p.latlon) # %% plots # input doplot(p.inputgridfn, Ebins) # output sim = namedtuple('sim', ['reacreq', 'opticalfilter']) sim.reacreq = sim.opticalfilter = '' for t in ver: # TODO for each time # VER eigenprofiles, summed over wavelength ploteigver(EKpcolor, ver.z_km, ver.sum('wavelength_nm'), (None,)*6, s...
am not yet able to handle your model {}'.format(model)) # %% plots show()
def current(config): """Display current revision""" with open(config, 'r'): main.current(yaml.load(open(config)))
def revision(config, message): """Create new revision file in a scripts directory""" with open(config, 'r'): main.revision(yaml.load(open(config)), message)
def checkout(config, rev): """Upgrade/revert to a different revision. <rev> must be "head", integer or revision id. To pass negative number you need to write "--" before it""" with open(config, 'r'): main.checkout(yaml.load(open(config)), rev)