repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
3 values
summary
stringlengths
4
350
CI-WATER/gsshapy
gsshapy/orm/prj.py
ProjectCard.write
def write(self, originalPrefix, newPrefix=None): """ Write project card to string. Args: originalPrefix (str): Original name to give to files that follow the project naming convention (e.g: prefix.gag). newPrefix (str, optional): If new prefix is desired,...
python
def write(self, originalPrefix, newPrefix=None): """ Write project card to string. Args: originalPrefix (str): Original name to give to files that follow the project naming convention (e.g: prefix.gag). newPrefix (str, optional): If new prefix is desired,...
[ "def", "write", "(", "self", ",", "originalPrefix", ",", "newPrefix", "=", "None", ")", ":", "# Determine number of spaces between card and value for nice alignment", "numSpaces", "=", "max", "(", "2", ",", "25", "-", "len", "(", "self", ".", "name", ")", ")", ...
Write project card to string. Args: originalPrefix (str): Original name to give to files that follow the project naming convention (e.g: prefix.gag). newPrefix (str, optional): If new prefix is desired, pass in this parameter. Defaults to None. Returns: ...
[ "Write", "project", "card", "to", "string", "." ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L2024-L2051
train
Writes the project card to string.
Robpol86/etaprogress
etaprogress/eta.py
ETA.elapsed
def elapsed(self): """Returns the number of seconds it has been since the start until the latest entry.""" if not self.started or self._start_time is None: return 0.0 return self._timing_data[-1][0] - self._start_time
python
def elapsed(self): """Returns the number of seconds it has been since the start until the latest entry.""" if not self.started or self._start_time is None: return 0.0 return self._timing_data[-1][0] - self._start_time
[ "def", "elapsed", "(", "self", ")", ":", "if", "not", "self", ".", "started", "or", "self", ".", "_start_time", "is", "None", ":", "return", "0.0", "return", "self", ".", "_timing_data", "[", "-", "1", "]", "[", "0", "]", "-", "self", ".", "_start_...
Returns the number of seconds it has been since the start until the latest entry.
[ "Returns", "the", "number", "of", "seconds", "it", "has", "been", "since", "the", "start", "until", "the", "latest", "entry", "." ]
224e8a248c2bf820bad218763281914ad3983fff
https://github.com/Robpol86/etaprogress/blob/224e8a248c2bf820bad218763281914ad3983fff/etaprogress/eta.py#L83-L87
train
Returns the number of seconds that the entry has been since the start until the latest entry.
Robpol86/etaprogress
etaprogress/eta.py
ETA.rate_unstable
def rate_unstable(self): """Returns an unstable rate based on the last two entries in the timing data. Less intensive to compute.""" if not self.started or self.stalled: return 0.0 x1, y1 = self._timing_data[-2] x2, y2 = self._timing_data[-1] return (y2 - y1) / (x2 - ...
python
def rate_unstable(self): """Returns an unstable rate based on the last two entries in the timing data. Less intensive to compute.""" if not self.started or self.stalled: return 0.0 x1, y1 = self._timing_data[-2] x2, y2 = self._timing_data[-1] return (y2 - y1) / (x2 - ...
[ "def", "rate_unstable", "(", "self", ")", ":", "if", "not", "self", ".", "started", "or", "self", ".", "stalled", ":", "return", "0.0", "x1", ",", "y1", "=", "self", ".", "_timing_data", "[", "-", "2", "]", "x2", ",", "y2", "=", "self", ".", "_ti...
Returns an unstable rate based on the last two entries in the timing data. Less intensive to compute.
[ "Returns", "an", "unstable", "rate", "based", "on", "the", "last", "two", "entries", "in", "the", "timing", "data", ".", "Less", "intensive", "to", "compute", "." ]
224e8a248c2bf820bad218763281914ad3983fff
https://github.com/Robpol86/etaprogress/blob/224e8a248c2bf820bad218763281914ad3983fff/etaprogress/eta.py#L90-L96
train
Returns an unstable rate based on the last two entries in the timing data. Less intensive to compute.
Robpol86/etaprogress
etaprogress/eta.py
ETA.rate_overall
def rate_overall(self): """Returns the overall average rate based on the start time.""" elapsed = self.elapsed return self.rate if not elapsed else self.numerator / self.elapsed
python
def rate_overall(self): """Returns the overall average rate based on the start time.""" elapsed = self.elapsed return self.rate if not elapsed else self.numerator / self.elapsed
[ "def", "rate_overall", "(", "self", ")", ":", "elapsed", "=", "self", ".", "elapsed", "return", "self", ".", "rate", "if", "not", "elapsed", "else", "self", ".", "numerator", "/", "self", ".", "elapsed" ]
Returns the overall average rate based on the start time.
[ "Returns", "the", "overall", "average", "rate", "based", "on", "the", "start", "time", "." ]
224e8a248c2bf820bad218763281914ad3983fff
https://github.com/Robpol86/etaprogress/blob/224e8a248c2bf820bad218763281914ad3983fff/etaprogress/eta.py#L99-L102
train
Returns the overall average rate based on the start time.
Robpol86/etaprogress
etaprogress/eta.py
ETA.set_numerator
def set_numerator(self, numerator, calculate=True): """Sets the new numerator (number of items done). Positional arguments: numerator -- the new numerator to add to the timing data. Keyword arguments: calculate -- calculate the ETA and rate by default. """ # Val...
python
def set_numerator(self, numerator, calculate=True): """Sets the new numerator (number of items done). Positional arguments: numerator -- the new numerator to add to the timing data. Keyword arguments: calculate -- calculate the ETA and rate by default. """ # Val...
[ "def", "set_numerator", "(", "self", ",", "numerator", ",", "calculate", "=", "True", ")", ":", "# Validate", "if", "self", ".", "_timing_data", "and", "numerator", "<", "self", ".", "_timing_data", "[", "-", "1", "]", "[", "1", "]", ":", "raise", "Val...
Sets the new numerator (number of items done). Positional arguments: numerator -- the new numerator to add to the timing data. Keyword arguments: calculate -- calculate the ETA and rate by default.
[ "Sets", "the", "new", "numerator", "(", "number", "of", "items", "done", ")", "." ]
224e8a248c2bf820bad218763281914ad3983fff
https://github.com/Robpol86/etaprogress/blob/224e8a248c2bf820bad218763281914ad3983fff/etaprogress/eta.py#L104-L126
train
Sets the new numerator for the current state of the object.
Robpol86/etaprogress
etaprogress/eta.py
ETA._calculate
def _calculate(self): """Perform the ETA and rate calculation. Two linear lines are used to calculate the ETA: the linear regression (line through a scatter-plot), and the fitted line (a line that runs through the latest data point in _timing_data but parallel to the linear regression l...
python
def _calculate(self): """Perform the ETA and rate calculation. Two linear lines are used to calculate the ETA: the linear regression (line through a scatter-plot), and the fitted line (a line that runs through the latest data point in _timing_data but parallel to the linear regression l...
[ "def", "_calculate", "(", "self", ")", ":", "# Calculate means and standard deviations.", "mean_x", "=", "sum", "(", "i", "[", "0", "]", "for", "i", "in", "self", ".", "_timing_data", ")", "/", "len", "(", "self", ".", "_timing_data", ")", "mean_y", "=", ...
Perform the ETA and rate calculation. Two linear lines are used to calculate the ETA: the linear regression (line through a scatter-plot), and the fitted line (a line that runs through the latest data point in _timing_data but parallel to the linear regression line). As the percentage ...
[ "Perform", "the", "ETA", "and", "rate", "calculation", "." ]
224e8a248c2bf820bad218763281914ad3983fff
https://github.com/Robpol86/etaprogress/blob/224e8a248c2bf820bad218763281914ad3983fff/etaprogress/eta.py#L128-L169
train
Perform the ETA and rate calculation.
adamziel/django_translate
django_translate/templatetags/tranz.py
tranz
def tranz(parser, token, is_transchoice=False): """ Templatetagish wrapper for Translator.trans() :param parser: :param token: :param is_transchoice: :return: """ tokens = token.split_contents() id = tokens[1] number = domain = locale = None parameters = {} if len(tokens...
python
def tranz(parser, token, is_transchoice=False): """ Templatetagish wrapper for Translator.trans() :param parser: :param token: :param is_transchoice: :return: """ tokens = token.split_contents() id = tokens[1] number = domain = locale = None parameters = {} if len(tokens...
[ "def", "tranz", "(", "parser", ",", "token", ",", "is_transchoice", "=", "False", ")", ":", "tokens", "=", "token", ".", "split_contents", "(", ")", "id", "=", "tokens", "[", "1", "]", "number", "=", "domain", "=", "locale", "=", "None", "parameters", ...
Templatetagish wrapper for Translator.trans() :param parser: :param token: :param is_transchoice: :return:
[ "Templatetagish", "wrapper", "for", "Translator", ".", "trans", "()" ]
43d8ef94a5c230abbdc89f3dbc623313fde998f2
https://github.com/adamziel/django_translate/blob/43d8ef94a5c230abbdc89f3dbc623313fde998f2/django_translate/templatetags/tranz.py#L18-L63
train
Returns a TranzNode from a token.
adamziel/django_translate
django_translate/templatetags/tranz.py
tranz_context
def tranz_context(parser, token): """ Templatetagish wrapper for Translator.transchoice() """ tokens = token.split_contents() parameters = {} for idx, token in enumerate(tokens[1:], start=1): if "=" in token: if token[0:token.index('=')] not in ("domain", "prefix", "locale")...
python
def tranz_context(parser, token): """ Templatetagish wrapper for Translator.transchoice() """ tokens = token.split_contents() parameters = {} for idx, token in enumerate(tokens[1:], start=1): if "=" in token: if token[0:token.index('=')] not in ("domain", "prefix", "locale")...
[ "def", "tranz_context", "(", "parser", ",", "token", ")", ":", "tokens", "=", "token", ".", "split_contents", "(", ")", "parameters", "=", "{", "}", "for", "idx", ",", "token", "in", "enumerate", "(", "tokens", "[", "1", ":", "]", ",", "start", "=", ...
Templatetagish wrapper for Translator.transchoice()
[ "Templatetagish", "wrapper", "for", "Translator", ".", "transchoice", "()" ]
43d8ef94a5c230abbdc89f3dbc623313fde998f2
https://github.com/adamziel/django_translate/blob/43d8ef94a5c230abbdc89f3dbc623313fde998f2/django_translate/templatetags/tranz.py#L124-L148
train
Returns TranzContextNode for the given token.
CI-WATER/gsshapy
gsshapy/orm/hmet.py
HmetFile._write
def _write(self, session, openFile, replaceParamFile): """ Write HMET WES to File Method """ ## TODO: Ensure Other HMET Formats are supported hmetRecords = self.hmetRecords for record in hmetRecords: openFile.write('%s\t%s\t%s\t%s\t%.3f\t%s\t%s\t%s\t%s\t%.2f\...
python
def _write(self, session, openFile, replaceParamFile): """ Write HMET WES to File Method """ ## TODO: Ensure Other HMET Formats are supported hmetRecords = self.hmetRecords for record in hmetRecords: openFile.write('%s\t%s\t%s\t%s\t%.3f\t%s\t%s\t%s\t%s\t%.2f\...
[ "def", "_write", "(", "self", ",", "session", ",", "openFile", ",", "replaceParamFile", ")", ":", "## TODO: Ensure Other HMET Formats are supported", "hmetRecords", "=", "self", ".", "hmetRecords", "for", "record", "in", "hmetRecords", ":", "openFile", ".", "write",...
Write HMET WES to File Method
[ "Write", "HMET", "WES", "to", "File", "Method" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/hmet.py#L89-L108
train
Write HMET WES to File Method
CI-WATER/gsshapy
gsshapy/orm/evt.py
ProjectFileEventManager._read
def _read(self, directory, filename, session, path, name, extension, spatial=None, spatialReferenceID=None, replaceParamFile=None): """ ProjectFileEvent Read from File Method """ yml_events = [] with open(path) as fo: yml_events = yaml.load(fo) ...
python
def _read(self, directory, filename, session, path, name, extension, spatial=None, spatialReferenceID=None, replaceParamFile=None): """ ProjectFileEvent Read from File Method """ yml_events = [] with open(path) as fo: yml_events = yaml.load(fo) ...
[ "def", "_read", "(", "self", ",", "directory", ",", "filename", ",", "session", ",", "path", ",", "name", ",", "extension", ",", "spatial", "=", "None", ",", "spatialReferenceID", "=", "None", ",", "replaceParamFile", "=", "None", ")", ":", "yml_events", ...
ProjectFileEvent Read from File Method
[ "ProjectFileEvent", "Read", "from", "File", "Method" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/evt.py#L30-L46
train
Method to read from File Method to read from File Method to ProjectFileEvent
CI-WATER/gsshapy
gsshapy/orm/evt.py
ProjectFileEventManager._write
def _write(self, session, openFile, replaceParamFile=None): """ ProjectFileEvent Write to File Method """ openFile.write( text( yaml.dump([evt.as_yml() for evt in self.events.order_by(ProjectFileEvent.name, ...
python
def _write(self, session, openFile, replaceParamFile=None): """ ProjectFileEvent Write to File Method """ openFile.write( text( yaml.dump([evt.as_yml() for evt in self.events.order_by(ProjectFileEvent.name, ...
[ "def", "_write", "(", "self", ",", "session", ",", "openFile", ",", "replaceParamFile", "=", "None", ")", ":", "openFile", ".", "write", "(", "text", "(", "yaml", ".", "dump", "(", "[", "evt", ".", "as_yml", "(", ")", "for", "evt", "in", "self", "....
ProjectFileEvent Write to File Method
[ "ProjectFileEvent", "Write", "to", "File", "Method" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/evt.py#L48-L59
train
Write to File Method
CI-WATER/gsshapy
gsshapy/orm/evt.py
ProjectFileEventManager.next_id
def next_id(self, subfolder): """ ProjectFileEvent Write to File Method """ evt_sim_folders = self.events.filter( ProjectFileEvent.subfolder .like("{0}_%".format(subfolder)) ) max_id = 0 num_search = ...
python
def next_id(self, subfolder): """ ProjectFileEvent Write to File Method """ evt_sim_folders = self.events.filter( ProjectFileEvent.subfolder .like("{0}_%".format(subfolder)) ) max_id = 0 num_search = ...
[ "def", "next_id", "(", "self", ",", "subfolder", ")", ":", "evt_sim_folders", "=", "self", ".", "events", ".", "filter", "(", "ProjectFileEvent", ".", "subfolder", ".", "like", "(", "\"{0}_%\"", ".", "format", "(", "subfolder", ")", ")", ")", "max_id", "...
ProjectFileEvent Write to File Method
[ "ProjectFileEvent", "Write", "to", "File", "Method" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/evt.py#L61-L75
train
Get the next id for a subfolder.
CI-WATER/gsshapy
gsshapy/orm/evt.py
ProjectFileEventManager.add_event
def add_event(self, name, subfolder, session): """ Add an event """ if self._similar_event_exists(subfolder): subfolder += "_{0}".format(self.next_id(subfolder)) new_event = ProjectFileEvent(name=name, subfolder=subfolder) session.add(new_event) self.e...
python
def add_event(self, name, subfolder, session): """ Add an event """ if self._similar_event_exists(subfolder): subfolder += "_{0}".format(self.next_id(subfolder)) new_event = ProjectFileEvent(name=name, subfolder=subfolder) session.add(new_event) self.e...
[ "def", "add_event", "(", "self", ",", "name", ",", "subfolder", ",", "session", ")", ":", "if", "self", ".", "_similar_event_exists", "(", "subfolder", ")", ":", "subfolder", "+=", "\"_{0}\"", ".", "format", "(", "self", ".", "next_id", "(", "subfolder", ...
Add an event
[ "Add", "an", "event" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/evt.py#L77-L87
train
Add an event to the list of events.
CI-WATER/gsshapy
gsshapy/orm/evt.py
ProjectFileEventManager.generate_event
def generate_event(self, session): """ Add an event """ event_name = "event_{0}".format(self.next_id("event")) return self.add_event(name=event_name, subfolder=event_name, session=session)
python
def generate_event(self, session): """ Add an event """ event_name = "event_{0}".format(self.next_id("event")) return self.add_event(name=event_name, subfolder=event_name, session=session)
[ "def", "generate_event", "(", "self", ",", "session", ")", ":", "event_name", "=", "\"event_{0}\"", ".", "format", "(", "self", ".", "next_id", "(", "\"event\"", ")", ")", "return", "self", ".", "add_event", "(", "name", "=", "event_name", ",", "subfolder"...
Add an event
[ "Add", "an", "event" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/evt.py#L89-L95
train
Generate an event in the log.
CI-WATER/gsshapy
gsshapy/orm/evt.py
ProjectFileEvent.as_yml
def as_yml(self): """ Return yml compatible version of self """ return YmlFileEvent(name=str(self.name), subfolder=str(self.subfolder))
python
def as_yml(self): """ Return yml compatible version of self """ return YmlFileEvent(name=str(self.name), subfolder=str(self.subfolder))
[ "def", "as_yml", "(", "self", ")", ":", "return", "YmlFileEvent", "(", "name", "=", "str", "(", "self", ".", "name", ")", ",", "subfolder", "=", "str", "(", "self", ".", "subfolder", ")", ")" ]
Return yml compatible version of self
[ "Return", "yml", "compatible", "version", "of", "self" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/evt.py#L115-L120
train
Return a yaml compatible version of this object.
timofurrer/ramlient
ramlient/request.py
prepare_request
def prepare_request(node): """ Prepare request to node's API route :param Node node: the RAML node object """ if node.resource.method not in AVAILABLE_METHODS: raise UnsupportedHTTPMethodError(node.resource.method) def request(data=None, json=None, **kwargs): """ ...
python
def prepare_request(node): """ Prepare request to node's API route :param Node node: the RAML node object """ if node.resource.method not in AVAILABLE_METHODS: raise UnsupportedHTTPMethodError(node.resource.method) def request(data=None, json=None, **kwargs): """ ...
[ "def", "prepare_request", "(", "node", ")", ":", "if", "node", ".", "resource", ".", "method", "not", "in", "AVAILABLE_METHODS", ":", "raise", "UnsupportedHTTPMethodError", "(", "node", ".", "resource", ".", "method", ")", "def", "request", "(", "data", "=",...
Prepare request to node's API route :param Node node: the RAML node object
[ "Prepare", "request", "to", "node", "s", "API", "route" ]
e93092252635a6b3b0aca2c390b9f820368b791c
https://github.com/timofurrer/ramlient/blob/e93092252635a6b3b0aca2c390b9f820368b791c/ramlient/request.py#L20-L47
train
Prepare request to node s API route with the given keyword arguments
vinci1it2000/schedula
schedula/ext/dispatcher/documenter.py
_dsp2dot_option
def _dsp2dot_option(arg): """Used to convert the :dmap: option to auto directives.""" # noinspection PyUnusedLocal def map_args(*args, **kwargs): from schedula.utils.base import Base a = inspect.signature(Base.plot).bind(None, *args, **kwargs).arguments a.popitem(last=False) ...
python
def _dsp2dot_option(arg): """Used to convert the :dmap: option to auto directives.""" # noinspection PyUnusedLocal def map_args(*args, **kwargs): from schedula.utils.base import Base a = inspect.signature(Base.plot).bind(None, *args, **kwargs).arguments a.popitem(last=False) ...
[ "def", "_dsp2dot_option", "(", "arg", ")", ":", "# noinspection PyUnusedLocal", "def", "map_args", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "from", "schedula", ".", "utils", ".", "base", "import", "Base", "a", "=", "inspect", ".", "signature", ...
Used to convert the :dmap: option to auto directives.
[ "Used", "to", "convert", "the", ":", "dmap", ":", "option", "to", "auto", "directives", "." ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/ext/dispatcher/documenter.py#L233-L245
train
Used to convert the dmap option to auto directives.
CI-WATER/gsshapy
gsshapy/grid/nwm_to_gssha.py
NWMtoGSSHA.xd
def xd(self): """get xarray dataset file handle to LSM files""" if self._xd is None: path_to_lsm_files = path.join(self.lsm_input_folder_path, self.lsm_search_card) self._xd = super(NWMtoGSSHA, self).xd self._xd.lsm.coords_pro...
python
def xd(self): """get xarray dataset file handle to LSM files""" if self._xd is None: path_to_lsm_files = path.join(self.lsm_input_folder_path, self.lsm_search_card) self._xd = super(NWMtoGSSHA, self).xd self._xd.lsm.coords_pro...
[ "def", "xd", "(", "self", ")", ":", "if", "self", ".", "_xd", "is", "None", ":", "path_to_lsm_files", "=", "path", ".", "join", "(", "self", ".", "lsm_input_folder_path", ",", "self", ".", "lsm_search_card", ")", "self", ".", "_xd", "=", "super", "(", ...
get xarray dataset file handle to LSM files
[ "get", "xarray", "dataset", "file", "handle", "to", "LSM", "files" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/grid/nwm_to_gssha.py#L100-L107
train
get xarray dataset file handle to LSM files
CI-WATER/gsshapy
gsshapy/grid/nwm_to_gssha.py
NWMtoGSSHA._load_converted_gssha_data_from_lsm
def _load_converted_gssha_data_from_lsm(self, gssha_var, lsm_var, load_type): """ This function loads data from LSM and converts to GSSHA format """ super(NWMtoGSSHA, self).\ _load_converted_gssha_data_from_lsm(gssha_var, lsm_var, load_type) self.data.lsm.coords_proje...
python
def _load_converted_gssha_data_from_lsm(self, gssha_var, lsm_var, load_type): """ This function loads data from LSM and converts to GSSHA format """ super(NWMtoGSSHA, self).\ _load_converted_gssha_data_from_lsm(gssha_var, lsm_var, load_type) self.data.lsm.coords_proje...
[ "def", "_load_converted_gssha_data_from_lsm", "(", "self", ",", "gssha_var", ",", "lsm_var", ",", "load_type", ")", ":", "super", "(", "NWMtoGSSHA", ",", "self", ")", ".", "_load_converted_gssha_data_from_lsm", "(", "gssha_var", ",", "lsm_var", ",", "load_type", "...
This function loads data from LSM and converts to GSSHA format
[ "This", "function", "loads", "data", "from", "LSM", "and", "converts", "to", "GSSHA", "format" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/grid/nwm_to_gssha.py#L109-L115
train
This function loads data from LSM and converts to GSSHA format
thebigmunch/google-music-proto
src/google_music_proto/musicmanager/utils.py
get_transcoder
def get_transcoder(): """Return the path to a transcoder (ffmpeg or avconv) with MP3 support.""" transcoders = ['ffmpeg', 'avconv'] transcoder_details = {} for transcoder in transcoders: command_path = shutil.which(transcoder) if command_path is None: transcoder_details[transcoder] = 'Not installed.' co...
python
def get_transcoder(): """Return the path to a transcoder (ffmpeg or avconv) with MP3 support.""" transcoders = ['ffmpeg', 'avconv'] transcoder_details = {} for transcoder in transcoders: command_path = shutil.which(transcoder) if command_path is None: transcoder_details[transcoder] = 'Not installed.' co...
[ "def", "get_transcoder", "(", ")", ":", "transcoders", "=", "[", "'ffmpeg'", ",", "'avconv'", "]", "transcoder_details", "=", "{", "}", "for", "transcoder", "in", "transcoders", ":", "command_path", "=", "shutil", ".", "which", "(", "transcoder", ")", "if", ...
Return the path to a transcoder (ffmpeg or avconv) with MP3 support.
[ "Return", "the", "path", "to", "a", "transcoder", "(", "ffmpeg", "or", "avconv", ")", "with", "MP3", "support", "." ]
071a48ec8645ad4f482e80c16a634d6842dd0446
https://github.com/thebigmunch/google-music-proto/blob/071a48ec8645ad4f482e80c16a634d6842dd0446/src/google_music_proto/musicmanager/utils.py#L64-L89
train
Return the path to a transcoder with MP3 support.
vinci1it2000/schedula
examples/processing_chain/utils/plot.py
define_plot_data
def define_plot_data(data, x_name, *y_names): """ Defines the data to be plotted. :param data: All data. :type data: dict :param x_name: x-axes name. :type x_name: str :param y_names: y-axes names to be plotted. :type y_names: str :return: Data to ...
python
def define_plot_data(data, x_name, *y_names): """ Defines the data to be plotted. :param data: All data. :type data: dict :param x_name: x-axes name. :type x_name: str :param y_names: y-axes names to be plotted. :type y_names: str :return: Data to ...
[ "def", "define_plot_data", "(", "data", ",", "x_name", ",", "*", "y_names", ")", ":", "it", "=", "[", "]", "for", "k", "in", "y_names", ":", "it", ".", "append", "(", "{", "'x'", ":", "data", "[", "x_name", "]", ",", "'y'", ":", "data", "[", "k...
Defines the data to be plotted. :param data: All data. :type data: dict :param x_name: x-axes name. :type x_name: str :param y_names: y-axes names to be plotted. :type y_names: str :return: Data to be plotted. :rtype: list
[ "Defines", "the", "data", "to", "be", "plotted", "." ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/examples/processing_chain/utils/plot.py#L9-L36
train
Define the data to be plotted.
vinci1it2000/schedula
examples/processing_chain/utils/plot.py
plot_lines
def plot_lines(it): """ Plotting lines. :param it: Data to plot where key value is the name of the series. :type it: list[dict] :return: The plot. :rtype: plotly.plotly.iplot """ data = [go.Scatter(mode='lines', **d) for d in it] return py.iplot(data, filename='scat...
python
def plot_lines(it): """ Plotting lines. :param it: Data to plot where key value is the name of the series. :type it: list[dict] :return: The plot. :rtype: plotly.plotly.iplot """ data = [go.Scatter(mode='lines', **d) for d in it] return py.iplot(data, filename='scat...
[ "def", "plot_lines", "(", "it", ")", ":", "data", "=", "[", "go", ".", "Scatter", "(", "mode", "=", "'lines'", ",", "*", "*", "d", ")", "for", "d", "in", "it", "]", "return", "py", ".", "iplot", "(", "data", ",", "filename", "=", "'scatter-mode'"...
Plotting lines. :param it: Data to plot where key value is the name of the series. :type it: list[dict] :return: The plot. :rtype: plotly.plotly.iplot
[ "Plotting", "lines", "." ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/examples/processing_chain/utils/plot.py#L39-L52
train
Plots the series lines.
dsoprea/PySecure
pysecure/adapters/channela.py
_ssh_channel_read
def _ssh_channel_read(ssh_channel_int, count, is_stderr): """Do a read on a channel.""" buffer_ = create_string_buffer(count) while 1: received_bytes = c_ssh_channel_read(ssh_channel_int, cast(buffer_, c_void_p), ...
python
def _ssh_channel_read(ssh_channel_int, count, is_stderr): """Do a read on a channel.""" buffer_ = create_string_buffer(count) while 1: received_bytes = c_ssh_channel_read(ssh_channel_int, cast(buffer_, c_void_p), ...
[ "def", "_ssh_channel_read", "(", "ssh_channel_int", ",", "count", ",", "is_stderr", ")", ":", "buffer_", "=", "create_string_buffer", "(", "count", ")", "while", "1", ":", "received_bytes", "=", "c_ssh_channel_read", "(", "ssh_channel_int", ",", "cast", "(", "bu...
Do a read on a channel.
[ "Do", "a", "read", "on", "a", "channel", "." ]
ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0
https://github.com/dsoprea/PySecure/blob/ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0/pysecure/adapters/channela.py#L79-L106
train
Do a read on a channel.
davitv/chance
chance/chance.py
dictionary
def dictionary(values): """ This function generates dictionary from values parameter. For example this: example = { 'streetway': ('street', {'language': 'en'}), 'first_name': ('first', {'language': 'en'}) } chance.dictionary(example) will output something like this: {...
python
def dictionary(values): """ This function generates dictionary from values parameter. For example this: example = { 'streetway': ('street', {'language': 'en'}), 'first_name': ('first', {'language': 'en'}) } chance.dictionary(example) will output something like this: {...
[ "def", "dictionary", "(", "values", ")", ":", "result", "=", "dict", "(", ")", "for", "key", "in", "values", ":", "fname", "=", "values", "[", "key", "]", "[", "0", "]", "if", "fname", "not", "in", "functions_map", ":", "result", "[", "key", "]", ...
This function generates dictionary from values parameter. For example this: example = { 'streetway': ('street', {'language': 'en'}), 'first_name': ('first', {'language': 'en'}) } chance.dictionary(example) will output something like this: {'streetway': 'Jabhuru Point', 'first...
[ "This", "function", "generates", "dictionary", "from", "values", "parameter", ".", "For", "example", "this", ":", "example", "=", "{", "streetway", ":", "(", "street", "{", "language", ":", "en", "}", ")", "first_name", ":", "(", "first", "{", "language", ...
cefd8773a6b41933a7b0536eb74287066557bc68
https://github.com/davitv/chance/blob/cefd8773a6b41933a7b0536eb74287066557bc68/chance/chance.py#L407-L431
train
This function generates dictionary from dictionary values.
leplatrem/django-sizefield
sizefield/utils.py
filesizeformat
def filesizeformat(bytes, decimals=1): """ Formats the value like a 'human-readable' file size (i.e. 13 KB, 4.1 MB, 102 bytes, etc). Based on django.template.defaultfilters.filesizeformat """ try: bytes = float(bytes) except (TypeError, ValueError, UnicodeDecodeError): raise...
python
def filesizeformat(bytes, decimals=1): """ Formats the value like a 'human-readable' file size (i.e. 13 KB, 4.1 MB, 102 bytes, etc). Based on django.template.defaultfilters.filesizeformat """ try: bytes = float(bytes) except (TypeError, ValueError, UnicodeDecodeError): raise...
[ "def", "filesizeformat", "(", "bytes", ",", "decimals", "=", "1", ")", ":", "try", ":", "bytes", "=", "float", "(", "bytes", ")", "except", "(", "TypeError", ",", "ValueError", ",", "UnicodeDecodeError", ")", ":", "raise", "ValueError", "def", "filesize_nu...
Formats the value like a 'human-readable' file size (i.e. 13 KB, 4.1 MB, 102 bytes, etc). Based on django.template.defaultfilters.filesizeformat
[ "Formats", "the", "value", "like", "a", "human", "-", "readable", "file", "size", "(", "i", ".", "e", ".", "13", "KB", "4", ".", "1", "MB", "102", "bytes", "etc", ")", ".", "Based", "on", "django", ".", "template", ".", "defaultfilters", ".", "file...
6a273a43a2e8d157ee438811c0824eae534bcdb2
https://github.com/leplatrem/django-sizefield/blob/6a273a43a2e8d157ee438811c0824eae534bcdb2/sizefield/utils.py#L32-L62
train
Formats the value like a human - readable file size.
CI-WATER/gsshapy
gsshapy/lib/gag_chunk.py
eventChunk
def eventChunk(key, lines): """ Parse EVENT chunks """ ## NOTE: RADAR file format not supported currently. ## TODO: Add Support for RADAR file format type values # Contants KEYWORDS = ('EVENT', 'NRPDS', 'NRGAG', 'COORD', 'GAGES...
python
def eventChunk(key, lines): """ Parse EVENT chunks """ ## NOTE: RADAR file format not supported currently. ## TODO: Add Support for RADAR file format type values # Contants KEYWORDS = ('EVENT', 'NRPDS', 'NRGAG', 'COORD', 'GAGES...
[ "def", "eventChunk", "(", "key", ",", "lines", ")", ":", "## NOTE: RADAR file format not supported currently.", "## TODO: Add Support for RADAR file format type values", "# Contants", "KEYWORDS", "=", "(", "'EVENT'", ",", "'NRPDS'", ",", "'NRGAG'", ",", "'COORD'", ",", "'...
Parse EVENT chunks
[ "Parse", "EVENT", "chunks" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/lib/gag_chunk.py#L15-L102
train
Parse EVENT chunks and return a dictionary of event data.
Robpol86/etaprogress
example_wget.py
main
def main(): """From: http://stackoverflow.com/questions/20801034/how-to-measure-download-speed-and-progress-using-requests""" # Prepare. if os.name == 'nt': locale.setlocale(locale.LC_ALL, 'english-us') else: locale.resetlocale() response = requests.get(OPTIONS['<url>'], stream=True)...
python
def main(): """From: http://stackoverflow.com/questions/20801034/how-to-measure-download-speed-and-progress-using-requests""" # Prepare. if os.name == 'nt': locale.setlocale(locale.LC_ALL, 'english-us') else: locale.resetlocale() response = requests.get(OPTIONS['<url>'], stream=True)...
[ "def", "main", "(", ")", ":", "# Prepare.", "if", "os", ".", "name", "==", "'nt'", ":", "locale", ".", "setlocale", "(", "locale", ".", "LC_ALL", ",", "'english-us'", ")", "else", ":", "locale", ".", "resetlocale", "(", ")", "response", "=", "requests"...
From: http://stackoverflow.com/questions/20801034/how-to-measure-download-speed-and-progress-using-requests
[ "From", ":", "http", ":", "//", "stackoverflow", ".", "com", "/", "questions", "/", "20801034", "/", "how", "-", "to", "-", "measure", "-", "download", "-", "speed", "-", "and", "-", "progress", "-", "using", "-", "requests" ]
224e8a248c2bf820bad218763281914ad3983fff
https://github.com/Robpol86/etaprogress/blob/224e8a248c2bf820bad218763281914ad3983fff/example_wget.py#L58-L86
train
Main function for the main function of the download thread.
Losant/losant-rest-python
losantrest/client.py
Client.request
def request(self, method, path, params=None, headers=None, body=None): """ Base method for making a Losant API request """ if not headers: headers = {} if not params: params = {} headers["Accept"] = "application/json" headers["Accept-Version"] = "^1.15.0"...
python
def request(self, method, path, params=None, headers=None, body=None): """ Base method for making a Losant API request """ if not headers: headers = {} if not params: params = {} headers["Accept"] = "application/json" headers["Accept-Version"] = "^1.15.0"...
[ "def", "request", "(", "self", ",", "method", ",", "path", ",", "params", "=", "None", ",", "headers", "=", "None", ",", "body", "=", "None", ")", ":", "if", "not", "headers", ":", "headers", "=", "{", "}", "if", "not", "params", ":", "params", "...
Base method for making a Losant API request
[ "Base", "method", "for", "making", "a", "Losant", "API", "request" ]
75b20decda0e999002f21811c3508f087e7f13b5
https://github.com/Losant/losant-rest-python/blob/75b20decda0e999002f21811c3508f087e7f13b5/losantrest/client.py#L165-L190
train
Base method for making a Losant API request
Losant/losant-rest-python
losantrest/client.py
Client.flatten_params
def flatten_params(self, data, base_key=None): """ Flatten out nested arrays and dicts in query params into correct format """ result = {} if data is None: return result map_data = None if not isinstance(data, collections.Mapping): map_data = [] ...
python
def flatten_params(self, data, base_key=None): """ Flatten out nested arrays and dicts in query params into correct format """ result = {} if data is None: return result map_data = None if not isinstance(data, collections.Mapping): map_data = [] ...
[ "def", "flatten_params", "(", "self", ",", "data", ",", "base_key", "=", "None", ")", ":", "result", "=", "{", "}", "if", "data", "is", "None", ":", "return", "result", "map_data", "=", "None", "if", "not", "isinstance", "(", "data", ",", "collections"...
Flatten out nested arrays and dicts in query params into correct format
[ "Flatten", "out", "nested", "arrays", "and", "dicts", "in", "query", "params", "into", "correct", "format" ]
75b20decda0e999002f21811c3508f087e7f13b5
https://github.com/Losant/losant-rest-python/blob/75b20decda0e999002f21811c3508f087e7f13b5/losantrest/client.py#L192-L216
train
Flatten out nested arrays and dicts in query params into correct format
vinci1it2000/schedula
examples/processing_chain/process.py
read_excel
def read_excel(input_fpath): """ Reads the excel file. :param input_fpath: Input file path. :type input_fpath: str :return: Raw Data. :rtype: dict """ return {k: v.values for k, v in pd.read_excel(input_fpath).items()}
python
def read_excel(input_fpath): """ Reads the excel file. :param input_fpath: Input file path. :type input_fpath: str :return: Raw Data. :rtype: dict """ return {k: v.values for k, v in pd.read_excel(input_fpath).items()}
[ "def", "read_excel", "(", "input_fpath", ")", ":", "return", "{", "k", ":", "v", ".", "values", "for", "k", ",", "v", "in", "pd", ".", "read_excel", "(", "input_fpath", ")", ".", "items", "(", ")", "}" ]
Reads the excel file. :param input_fpath: Input file path. :type input_fpath: str :return: Raw Data. :rtype: dict
[ "Reads", "the", "excel", "file", "." ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/examples/processing_chain/process.py#L13-L25
train
Reads the excel file.
vinci1it2000/schedula
examples/processing_chain/process.py
save_outputs
def save_outputs(outputs, output_fpath): """ Save model outputs in an Excel file. :param outputs: Model outputs. :type outputs: dict :param output_fpath: Output file path. :type output_fpath: str """ df = pd.DataFrame(outputs) with pd.ExcelWriter(output_fpath) as wr...
python
def save_outputs(outputs, output_fpath): """ Save model outputs in an Excel file. :param outputs: Model outputs. :type outputs: dict :param output_fpath: Output file path. :type output_fpath: str """ df = pd.DataFrame(outputs) with pd.ExcelWriter(output_fpath) as wr...
[ "def", "save_outputs", "(", "outputs", ",", "output_fpath", ")", ":", "df", "=", "pd", ".", "DataFrame", "(", "outputs", ")", "with", "pd", ".", "ExcelWriter", "(", "output_fpath", ")", "as", "writer", ":", "df", ".", "to_excel", "(", "writer", ")" ]
Save model outputs in an Excel file. :param outputs: Model outputs. :type outputs: dict :param output_fpath: Output file path. :type output_fpath: str
[ "Save", "model", "outputs", "in", "an", "Excel", "file", "." ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/examples/processing_chain/process.py#L51-L65
train
Save model outputs in an Excel file.
CI-WATER/gsshapy
gsshapy/orm/gag.py
PrecipFile._read
def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile): """ Precipitation Read from File Method """ # Set file extension property self.fileExtension = extension # Dictionary of keywords/cards and parse function...
python
def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile): """ Precipitation Read from File Method """ # Set file extension property self.fileExtension = extension # Dictionary of keywords/cards and parse function...
[ "def", "_read", "(", "self", ",", "directory", ",", "filename", ",", "session", ",", "path", ",", "name", ",", "extension", ",", "spatial", ",", "spatialReferenceID", ",", "replaceParamFile", ")", ":", "# Set file extension property", "self", ".", "fileExtension...
Precipitation Read from File Method
[ "Precipitation", "Read", "from", "File", "Method" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/gag.py#L62-L84
train
Read from File Method
CI-WATER/gsshapy
gsshapy/orm/gag.py
PrecipFile._write
def _write(self, session, openFile, replaceParamFile): """ Precipitation File Write to File Method """ # Retrieve the events associated with this PrecipFile events = self.precipEvents # Write each event to file for event in events: openFile.write('EVE...
python
def _write(self, session, openFile, replaceParamFile): """ Precipitation File Write to File Method """ # Retrieve the events associated with this PrecipFile events = self.precipEvents # Write each event to file for event in events: openFile.write('EVE...
[ "def", "_write", "(", "self", ",", "session", ",", "openFile", ",", "replaceParamFile", ")", ":", "# Retrieve the events associated with this PrecipFile", "events", "=", "self", ".", "precipEvents", "# Write each event to file", "for", "event", "in", "events", ":", "o...
Precipitation File Write to File Method
[ "Precipitation", "File", "Write", "to", "File", "Method" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/gag.py#L86-L148
train
Method writes the precipitation file to openFile
CI-WATER/gsshapy
gsshapy/orm/gag.py
PrecipFile._createGsshaPyObjects
def _createGsshaPyObjects(self, eventChunk): """ Create GSSHAPY PrecipEvent, PrecipValue, and PrecipGage Objects Method """ ## TODO: Add Support for RADAR file format type values # Create GSSHAPY PrecipEvent event = PrecipEvent(description=eventChunk['description'], ...
python
def _createGsshaPyObjects(self, eventChunk): """ Create GSSHAPY PrecipEvent, PrecipValue, and PrecipGage Objects Method """ ## TODO: Add Support for RADAR file format type values # Create GSSHAPY PrecipEvent event = PrecipEvent(description=eventChunk['description'], ...
[ "def", "_createGsshaPyObjects", "(", "self", ",", "eventChunk", ")", ":", "## TODO: Add Support for RADAR file format type values", "# Create GSSHAPY PrecipEvent", "event", "=", "PrecipEvent", "(", "description", "=", "eventChunk", "[", "'description'", "]", ",", "nrGag", ...
Create GSSHAPY PrecipEvent, PrecipValue, and PrecipGage Objects Method
[ "Create", "GSSHAPY", "PrecipEvent", "PrecipValue", "and", "PrecipGage", "Objects", "Method" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/gag.py#L150-L186
train
Create GSSHAPY PrecipEvent PrecipValue and PrecipGage Objects Method
CI-WATER/gsshapy
gsshapy/orm/pro.py
ProjectionFile.lookupSpatialReferenceID
def lookupSpatialReferenceID(cls, directory, filename): """ Look up spatial reference system using the projection file. Args: directory (str): filename (str): Return: int: Spatial Reference ID """ path = os.path.join(directory, filen...
python
def lookupSpatialReferenceID(cls, directory, filename): """ Look up spatial reference system using the projection file. Args: directory (str): filename (str): Return: int: Spatial Reference ID """ path = os.path.join(directory, filen...
[ "def", "lookupSpatialReferenceID", "(", "cls", ",", "directory", ",", "filename", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "directory", ",", "filename", ")", "with", "open", "(", "path", ",", "'r'", ")", "as", "f", ":", "srid", "="...
Look up spatial reference system using the projection file. Args: directory (str): filename (str): Return: int: Spatial Reference ID
[ "Look", "up", "spatial", "reference", "system", "using", "the", "projection", "file", "." ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/pro.py#L61-L78
train
Look up spatial reference ID using the projection file.
CI-WATER/gsshapy
gsshapy/orm/pro.py
ProjectionFile._read
def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile): """ Projection File Read from File Method """ # Set file extension property self.fileExtension = extension # Open file and parse into a data structure ...
python
def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile): """ Projection File Read from File Method """ # Set file extension property self.fileExtension = extension # Open file and parse into a data structure ...
[ "def", "_read", "(", "self", ",", "directory", ",", "filename", ",", "session", ",", "path", ",", "name", ",", "extension", ",", "spatial", ",", "spatialReferenceID", ",", "replaceParamFile", ")", ":", "# Set file extension property", "self", ".", "fileExtension...
Projection File Read from File Method
[ "Projection", "File", "Read", "from", "File", "Method" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/pro.py#L81-L90
train
This method is called when the user reads the file from the database.
CI-WATER/gsshapy
gsshapy/util/log.py
log_to_console
def log_to_console(status=True, level=None): """Log events to the console. Args: status (bool, Optional, Default=True) whether logging to console should be turned on(True) or off(False) level (string, Optional, Default=None) : level of logging; whichever level is chosen...
python
def log_to_console(status=True, level=None): """Log events to the console. Args: status (bool, Optional, Default=True) whether logging to console should be turned on(True) or off(False) level (string, Optional, Default=None) : level of logging; whichever level is chosen...
[ "def", "log_to_console", "(", "status", "=", "True", ",", "level", "=", "None", ")", ":", "if", "status", ":", "if", "level", "is", "not", "None", ":", "logger", ".", "setLevel", "(", "level", ")", "console_handler", "=", "logging", ".", "StreamHandler",...
Log events to the console. Args: status (bool, Optional, Default=True) whether logging to console should be turned on(True) or off(False) level (string, Optional, Default=None) : level of logging; whichever level is chosen all higher levels will be logged. See: ...
[ "Log", "events", "to", "the", "console", "." ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/util/log.py#L22-L49
train
Log events to the console.
CI-WATER/gsshapy
gsshapy/util/log.py
log_to_file
def log_to_file(status=True, filename=default_log_file, level=None): """Log events to a file. Args: status (bool, Optional, Default=True) whether logging to file should be turned on(True) or off(False) filename (string, Optional, Default=None) : path of file to log to ...
python
def log_to_file(status=True, filename=default_log_file, level=None): """Log events to a file. Args: status (bool, Optional, Default=True) whether logging to file should be turned on(True) or off(False) filename (string, Optional, Default=None) : path of file to log to ...
[ "def", "log_to_file", "(", "status", "=", "True", ",", "filename", "=", "default_log_file", ",", "level", "=", "None", ")", ":", "if", "status", ":", "if", "level", "is", "not", "None", ":", "logger", ".", "setLevel", "(", "level", ")", "try", ":", "...
Log events to a file. Args: status (bool, Optional, Default=True) whether logging to file should be turned on(True) or off(False) filename (string, Optional, Default=None) : path of file to log to level (string, Optional, Default=None) : level of logging;...
[ "Log", "events", "to", "a", "file", "." ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/util/log.py#L54-L88
train
Log events to a file.
Robpol86/etaprogress
etaprogress/components/base_progress_bar.py
BaseProgressBar.numerator
def numerator(self, value): """Sets a new numerator and generates the ETA. Must be greater than or equal to previous numerator.""" # If ETA is every iteration, don't do anything fancy. if self.eta_every <= 1: self._eta.numerator = value self._eta_string = self._generate_e...
python
def numerator(self, value): """Sets a new numerator and generates the ETA. Must be greater than or equal to previous numerator.""" # If ETA is every iteration, don't do anything fancy. if self.eta_every <= 1: self._eta.numerator = value self._eta_string = self._generate_e...
[ "def", "numerator", "(", "self", ",", "value", ")", ":", "# If ETA is every iteration, don't do anything fancy.", "if", "self", ".", "eta_every", "<=", "1", ":", "self", ".", "_eta", ".", "numerator", "=", "value", "self", ".", "_eta_string", "=", "self", ".",...
Sets a new numerator and generates the ETA. Must be greater than or equal to previous numerator.
[ "Sets", "a", "new", "numerator", "and", "generates", "the", "ETA", ".", "Must", "be", "greater", "than", "or", "equal", "to", "previous", "numerator", "." ]
224e8a248c2bf820bad218763281914ad3983fff
https://github.com/Robpol86/etaprogress/blob/224e8a248c2bf820bad218763281914ad3983fff/etaprogress/components/base_progress_bar.py#L40-L61
train
Sets a new numerator and generates the ETA. Must be greater than or equal to previous numerator.
Robpol86/etaprogress
etaprogress/components/base_progress_bar.py
BaseProgressBar.rate
def rate(self): """Returns the rate of the progress as a float. Selects the unstable rate if eta_every > 1 for performance.""" return float(self._eta.rate_unstable if self.eta_every > 1 else self._eta.rate)
python
def rate(self): """Returns the rate of the progress as a float. Selects the unstable rate if eta_every > 1 for performance.""" return float(self._eta.rate_unstable if self.eta_every > 1 else self._eta.rate)
[ "def", "rate", "(", "self", ")", ":", "return", "float", "(", "self", ".", "_eta", ".", "rate_unstable", "if", "self", ".", "eta_every", ">", "1", "else", "self", ".", "_eta", ".", "rate", ")" ]
Returns the rate of the progress as a float. Selects the unstable rate if eta_every > 1 for performance.
[ "Returns", "the", "rate", "of", "the", "progress", "as", "a", "float", ".", "Selects", "the", "unstable", "rate", "if", "eta_every", ">", "1", "for", "performance", "." ]
224e8a248c2bf820bad218763281914ad3983fff
https://github.com/Robpol86/etaprogress/blob/224e8a248c2bf820bad218763281914ad3983fff/etaprogress/components/base_progress_bar.py#L69-L71
train
Returns the rate of the progress as a float. Selects the unstable rate if eta_every > 1 for performance.
CI-WATER/gsshapy
gsshapy/orm/ele.py
ElevationGridFile.generateFromRaster
def generateFromRaster(self, elevation_raster, shapefile_path=None, out_elevation_grid=None, resample_method=gdalconst.GRA_Average, load_raster_to_db=True): """ Generate...
python
def generateFromRaster(self, elevation_raster, shapefile_path=None, out_elevation_grid=None, resample_method=gdalconst.GRA_Average, load_raster_to_db=True): """ Generate...
[ "def", "generateFromRaster", "(", "self", ",", "elevation_raster", ",", "shapefile_path", "=", "None", ",", "out_elevation_grid", "=", "None", ",", "resample_method", "=", "gdalconst", ".", "GRA_Average", ",", "load_raster_to_db", "=", "True", ")", ":", "if", "n...
Generates an elevation grid for the GSSHA simulation from an elevation raster Example:: from gsshapy.orm import ProjectFile, ElevationGridFile from gsshapy.lib import db_tools as dbt gssha_directory = '/gsshapy/tests/grid_standard/gssha_project' elevat...
[ "Generates", "an", "elevation", "grid", "for", "the", "GSSHA", "simulation", "from", "an", "elevation", "raster" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/ele.py#L42-L111
train
Generate an elevation grid for the GSSHA simulation from an elevation raster.
CI-WATER/gsshapy
gsshapy/orm/spn.py
StormPipeNetworkFile._read
def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile): """ Storm Pipe Network File Read from File Method """ # Set file extension property self.fileExtension = extension # Dictionary of keywords/cards and pars...
python
def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile): """ Storm Pipe Network File Read from File Method """ # Set file extension property self.fileExtension = extension # Dictionary of keywords/cards and pars...
[ "def", "_read", "(", "self", ",", "directory", ",", "filename", ",", "session", ",", "path", ",", "name", ",", "extension", ",", "spatial", ",", "spatialReferenceID", ",", "replaceParamFile", ")", ":", "# Set file extension property", "self", ".", "fileExtension...
Storm Pipe Network File Read from File Method
[ "Storm", "Pipe", "Network", "File", "Read", "from", "File", "Method" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/spn.py#L65-L103
train
This method is called by the file read method in Storm Pipe Network File
CI-WATER/gsshapy
gsshapy/orm/spn.py
StormPipeNetworkFile._write
def _write(self, session, openFile, replaceParamFile): """ Storm Pipe Network File Write to File Method """ # Retrieve Connection objects and write to file connections = self.connections self._writeConnections(connections=connections, fileOb...
python
def _write(self, session, openFile, replaceParamFile): """ Storm Pipe Network File Write to File Method """ # Retrieve Connection objects and write to file connections = self.connections self._writeConnections(connections=connections, fileOb...
[ "def", "_write", "(", "self", ",", "session", ",", "openFile", ",", "replaceParamFile", ")", ":", "# Retrieve Connection objects and write to file", "connections", "=", "self", ".", "connections", "self", ".", "_writeConnections", "(", "connections", "=", "connections...
Storm Pipe Network File Write to File Method
[ "Storm", "Pipe", "Network", "File", "Write", "to", "File", "Method" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/spn.py#L105-L122
train
Private method to write to a file in Storm Pipe Network File
CI-WATER/gsshapy
gsshapy/orm/spn.py
StormPipeNetworkFile._createConnection
def _createConnection(self, connections): """ Create GSSHAPY Connection Objects Method """ for c in connections: # Create GSSHAPY Connection object connection = Connection(slinkNumber=c['slinkNumber'], upSjuncNumber=c['upSjunc'...
python
def _createConnection(self, connections): """ Create GSSHAPY Connection Objects Method """ for c in connections: # Create GSSHAPY Connection object connection = Connection(slinkNumber=c['slinkNumber'], upSjuncNumber=c['upSjunc'...
[ "def", "_createConnection", "(", "self", ",", "connections", ")", ":", "for", "c", "in", "connections", ":", "# Create GSSHAPY Connection object", "connection", "=", "Connection", "(", "slinkNumber", "=", "c", "[", "'slinkNumber'", "]", ",", "upSjuncNumber", "=", ...
Create GSSHAPY Connection Objects Method
[ "Create", "GSSHAPY", "Connection", "Objects", "Method" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/spn.py#L124-L136
train
Create GSSHAPY Connection Objects Method
CI-WATER/gsshapy
gsshapy/orm/spn.py
StormPipeNetworkFile._writeConnections
def _writeConnections(self, connections, fileObject): """ Write Connections to File Method """ for connection in connections: fileObject.write('CONNECT %s %s %s\n' % ( connection.slinkNumber, connection.upSjuncNumber, connect...
python
def _writeConnections(self, connections, fileObject): """ Write Connections to File Method """ for connection in connections: fileObject.write('CONNECT %s %s %s\n' % ( connection.slinkNumber, connection.upSjuncNumber, connect...
[ "def", "_writeConnections", "(", "self", ",", "connections", ",", "fileObject", ")", ":", "for", "connection", "in", "connections", ":", "fileObject", ".", "write", "(", "'CONNECT %s %s %s\\n'", "%", "(", "connection", ".", "slinkNumber", ",", "connection", "...
Write Connections to File Method
[ "Write", "Connections", "to", "File", "Method" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/spn.py#L201-L209
train
Write Connections to File Method
CI-WATER/gsshapy
gsshapy/orm/spn.py
StormPipeNetworkFile._writeSuperJunctions
def _writeSuperJunctions(self, superJunctions, fileObject): """ Write SuperJunctions to File Method """ for sjunc in superJunctions: fileObject.write('SJUNC %s %.2f %.2f %.6f %s %s %s %.6f %.6f\n' % ( sjunc.sjuncNumber, sjunc.groundSur...
python
def _writeSuperJunctions(self, superJunctions, fileObject): """ Write SuperJunctions to File Method """ for sjunc in superJunctions: fileObject.write('SJUNC %s %.2f %.2f %.6f %s %s %s %.6f %.6f\n' % ( sjunc.sjuncNumber, sjunc.groundSur...
[ "def", "_writeSuperJunctions", "(", "self", ",", "superJunctions", ",", "fileObject", ")", ":", "for", "sjunc", "in", "superJunctions", ":", "fileObject", ".", "write", "(", "'SJUNC %s %.2f %.2f %.6f %s %s %s %.6f %.6f\\n'", "%", "(", "sjunc", ".", "sjuncNumb...
Write SuperJunctions to File Method
[ "Write", "SuperJunctions", "to", "File", "Method" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/spn.py#L211-L225
train
Writes SuperJunctions to File Method Accesses
CI-WATER/gsshapy
gsshapy/orm/spn.py
StormPipeNetworkFile._writeSuperLinks
def _writeSuperLinks(self, superLinks, fileObject): """ Write SuperLinks to File Method """ for slink in superLinks: fileObject.write('SLINK %s %s\n' % ( slink.slinkNumber, slink.numPipes)) for node in slink.superNodes: ...
python
def _writeSuperLinks(self, superLinks, fileObject): """ Write SuperLinks to File Method """ for slink in superLinks: fileObject.write('SLINK %s %s\n' % ( slink.slinkNumber, slink.numPipes)) for node in slink.superNodes: ...
[ "def", "_writeSuperLinks", "(", "self", ",", "superLinks", ",", "fileObject", ")", ":", "for", "slink", "in", "superLinks", ":", "fileObject", ".", "write", "(", "'SLINK %s %s\\n'", "%", "(", "slink", ".", "slinkNumber", ",", "slink", ".", "numPipes", ...
Write SuperLinks to File Method
[ "Write", "SuperLinks", "to", "File", "Method" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/spn.py#L227-L257
train
Method writes SuperLinks to File Method Method
Robpol86/etaprogress
etaprogress/components/eta_conversions.py
eta_hms
def eta_hms(seconds, always_show_hours=False, always_show_minutes=False, hours_leading_zero=False): """Converts seconds remaining into a human readable timestamp (e.g. hh:mm:ss, h:mm:ss, mm:ss, or ss). Positional arguments: seconds -- integer/float indicating seconds remaining. Keyword arguments: ...
python
def eta_hms(seconds, always_show_hours=False, always_show_minutes=False, hours_leading_zero=False): """Converts seconds remaining into a human readable timestamp (e.g. hh:mm:ss, h:mm:ss, mm:ss, or ss). Positional arguments: seconds -- integer/float indicating seconds remaining. Keyword arguments: ...
[ "def", "eta_hms", "(", "seconds", ",", "always_show_hours", "=", "False", ",", "always_show_minutes", "=", "False", ",", "hours_leading_zero", "=", "False", ")", ":", "# Convert seconds to other units.", "final_hours", ",", "final_minutes", ",", "final_seconds", "=", ...
Converts seconds remaining into a human readable timestamp (e.g. hh:mm:ss, h:mm:ss, mm:ss, or ss). Positional arguments: seconds -- integer/float indicating seconds remaining. Keyword arguments: always_show_hours -- don't hide the 0 hours. always_show_minutes -- don't hide the 0 minutes. hours...
[ "Converts", "seconds", "remaining", "into", "a", "human", "readable", "timestamp", "(", "e", ".", "g", ".", "hh", ":", "mm", ":", "ss", "h", ":", "mm", ":", "ss", "mm", ":", "ss", "or", "ss", ")", "." ]
224e8a248c2bf820bad218763281914ad3983fff
https://github.com/Robpol86/etaprogress/blob/224e8a248c2bf820bad218763281914ad3983fff/etaprogress/components/eta_conversions.py#L6-L41
train
Converts seconds remaining into a human readable string.
Robpol86/etaprogress
etaprogress/components/eta_conversions.py
eta_letters
def eta_letters(seconds, shortest=False, leading_zero=False): """Converts seconds remaining into human readable strings (e.g. '1s' or '5h 22m 2s'). Positional arguments: seconds -- integer/float indicating seconds remaining. Keyword arguments: shortest -- show the shortest possible string length b...
python
def eta_letters(seconds, shortest=False, leading_zero=False): """Converts seconds remaining into human readable strings (e.g. '1s' or '5h 22m 2s'). Positional arguments: seconds -- integer/float indicating seconds remaining. Keyword arguments: shortest -- show the shortest possible string length b...
[ "def", "eta_letters", "(", "seconds", ",", "shortest", "=", "False", ",", "leading_zero", "=", "False", ")", ":", "if", "not", "seconds", ":", "return", "'00s'", "if", "leading_zero", "else", "'0s'", "# Convert seconds to other units.", "final_weeks", ",", "fina...
Converts seconds remaining into human readable strings (e.g. '1s' or '5h 22m 2s'). Positional arguments: seconds -- integer/float indicating seconds remaining. Keyword arguments: shortest -- show the shortest possible string length by only showing the biggest unit. leading_zero -- always show a le...
[ "Converts", "seconds", "remaining", "into", "human", "readable", "strings", "(", "e", ".", "g", ".", "1s", "or", "5h", "22m", "2s", ")", "." ]
224e8a248c2bf820bad218763281914ad3983fff
https://github.com/Robpol86/etaprogress/blob/224e8a248c2bf820bad218763281914ad3983fff/etaprogress/components/eta_conversions.py#L44-L102
train
Converts seconds remaining into human readable strings.
theodoregoetz/wernher
wernher/pid_control.py
Controller.ziegler_nichols
def ziegler_nichols(self,ku,tu,control_type='pid'): ''' ku = ultimate gain tu = period of oscillation at ultimate gain ''' converter = dict( p = lambda ku,tu: (.5*ku, 0, 0), pi = lambda ku,tu: (.45*ku, 1.2*(.45*ku)/tu, 0), pd = lambda k...
python
def ziegler_nichols(self,ku,tu,control_type='pid'): ''' ku = ultimate gain tu = period of oscillation at ultimate gain ''' converter = dict( p = lambda ku,tu: (.5*ku, 0, 0), pi = lambda ku,tu: (.45*ku, 1.2*(.45*ku)/tu, 0), pd = lambda k...
[ "def", "ziegler_nichols", "(", "self", ",", "ku", ",", "tu", ",", "control_type", "=", "'pid'", ")", ":", "converter", "=", "dict", "(", "p", "=", "lambda", "ku", ",", "tu", ":", "(", ".5", "*", "ku", ",", "0", ",", "0", ")", ",", "pi", "=", ...
ku = ultimate gain tu = period of oscillation at ultimate gain
[ "ku", "=", "ultimate", "gain", "tu", "=", "period", "of", "oscillation", "at", "ultimate", "gain" ]
ef5d3aabe24e532b5eab33cd0212b2dbc2c9022e
https://github.com/theodoregoetz/wernher/blob/ef5d3aabe24e532b5eab33cd0212b2dbc2c9022e/wernher/pid_control.py#L110-L124
train
This function is used to set the control_type of the ziegler.
CI-WATER/gsshapy
gsshapy/lib/wms_dataset_chunk.py
datasetHeaderChunk
def datasetHeaderChunk(key, lines): """ Process the dataset header """ KEYWORDS = ('DATASET', 'OBJTYPE', 'VECTYPE', 'BEGSCL', 'BEGVEC', 'OBJID', 'ND', 'NC', 'NAME') TYPE_K...
python
def datasetHeaderChunk(key, lines): """ Process the dataset header """ KEYWORDS = ('DATASET', 'OBJTYPE', 'VECTYPE', 'BEGSCL', 'BEGVEC', 'OBJID', 'ND', 'NC', 'NAME') TYPE_K...
[ "def", "datasetHeaderChunk", "(", "key", ",", "lines", ")", ":", "KEYWORDS", "=", "(", "'DATASET'", ",", "'OBJTYPE'", ",", "'VECTYPE'", ",", "'BEGSCL'", ",", "'BEGVEC'", ",", "'OBJID'", ",", "'ND'", ",", "'NC'", ",", "'NAME'", ")", "TYPE_KEYS", "=", "(",...
Process the dataset header
[ "Process", "the", "dataset", "header" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/lib/wms_dataset_chunk.py#L14-L66
train
Process the dataset header chunk
CI-WATER/gsshapy
gsshapy/lib/wms_dataset_chunk.py
datasetScalarTimeStepChunk
def datasetScalarTimeStepChunk(lines, numberColumns, numberCells): """ Process the time step chunks for scalar datasets """ END_DATASET_TAG = 'ENDDS' # Define the result object result = {'iStatus': None, 'timestamp': None, 'cellArray': None, 'rasterText...
python
def datasetScalarTimeStepChunk(lines, numberColumns, numberCells): """ Process the time step chunks for scalar datasets """ END_DATASET_TAG = 'ENDDS' # Define the result object result = {'iStatus': None, 'timestamp': None, 'cellArray': None, 'rasterText...
[ "def", "datasetScalarTimeStepChunk", "(", "lines", ",", "numberColumns", ",", "numberCells", ")", ":", "END_DATASET_TAG", "=", "'ENDDS'", "# Define the result object", "result", "=", "{", "'iStatus'", ":", "None", ",", "'timestamp'", ":", "None", ",", "'cellArray'",...
Process the time step chunks for scalar datasets
[ "Process", "the", "time", "step", "chunks", "for", "scalar", "datasets" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/lib/wms_dataset_chunk.py#L69-L127
train
Process the time step chunks for scalar datasets
vinci1it2000/schedula
schedula/utils/io.py
save_dispatcher
def save_dispatcher(dsp, path): """ Write Dispatcher object in Python pickle format. Pickles are a serialized byte stream of a Python object. This format will preserve Python objects used as nodes or edges. :param dsp: A dispatcher that identifies the model adopted. :type dsp: schedula...
python
def save_dispatcher(dsp, path): """ Write Dispatcher object in Python pickle format. Pickles are a serialized byte stream of a Python object. This format will preserve Python objects used as nodes or edges. :param dsp: A dispatcher that identifies the model adopted. :type dsp: schedula...
[ "def", "save_dispatcher", "(", "dsp", ",", "path", ")", ":", "import", "dill", "with", "open", "(", "path", ",", "'wb'", ")", "as", "f", ":", "dill", ".", "dump", "(", "dsp", ",", "f", ")" ]
Write Dispatcher object in Python pickle format. Pickles are a serialized byte stream of a Python object. This format will preserve Python objects used as nodes or edges. :param dsp: A dispatcher that identifies the model adopted. :type dsp: schedula.Dispatcher :param path: File o...
[ "Write", "Dispatcher", "object", "in", "Python", "pickle", "format", "." ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/io.py#L16-L48
train
Save a dispatcher object in Python pickle format.
vinci1it2000/schedula
schedula/utils/io.py
save_default_values
def save_default_values(dsp, path): """ Write Dispatcher default values in Python pickle format. Pickles are a serialized byte stream of a Python object. This format will preserve Python objects used as nodes or edges. :param dsp: A dispatcher that identifies the model adopted. :type d...
python
def save_default_values(dsp, path): """ Write Dispatcher default values in Python pickle format. Pickles are a serialized byte stream of a Python object. This format will preserve Python objects used as nodes or edges. :param dsp: A dispatcher that identifies the model adopted. :type d...
[ "def", "save_default_values", "(", "dsp", ",", "path", ")", ":", "import", "dill", "with", "open", "(", "path", ",", "'wb'", ")", "as", "f", ":", "dill", ".", "dump", "(", "dsp", ".", "default_values", ",", "f", ")" ]
Write Dispatcher default values in Python pickle format. Pickles are a serialized byte stream of a Python object. This format will preserve Python objects used as nodes or edges. :param dsp: A dispatcher that identifies the model adopted. :type dsp: schedula.Dispatcher :param path: ...
[ "Write", "Dispatcher", "default", "values", "in", "Python", "pickle", "format", "." ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/io.py#L91-L123
train
Writes Dispatcher default values in Python pickle format.
vinci1it2000/schedula
schedula/utils/io.py
load_default_values
def load_default_values(dsp, path): """ Load Dispatcher default values in Python pickle format. Pickles are a serialized byte stream of a Python object. This format will preserve Python objects used as nodes or edges. :param dsp: A dispatcher that identifies the model adopted. :type ds...
python
def load_default_values(dsp, path): """ Load Dispatcher default values in Python pickle format. Pickles are a serialized byte stream of a Python object. This format will preserve Python objects used as nodes or edges. :param dsp: A dispatcher that identifies the model adopted. :type ds...
[ "def", "load_default_values", "(", "dsp", ",", "path", ")", ":", "import", "dill", "# noinspection PyArgumentList", "with", "open", "(", "path", ",", "'rb'", ")", "as", "f", ":", "dsp", ".", "__init__", "(", "dmap", "=", "dsp", ".", "dmap", ",", "default...
Load Dispatcher default values in Python pickle format. Pickles are a serialized byte stream of a Python object. This format will preserve Python objects used as nodes or edges. :param dsp: A dispatcher that identifies the model adopted. :type dsp: schedula.Dispatcher :param path: ...
[ "Load", "Dispatcher", "default", "values", "in", "Python", "pickle", "format", "." ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/io.py#L126-L164
train
Loads the default values of a node or edge from a file.
vinci1it2000/schedula
schedula/utils/io.py
save_map
def save_map(dsp, path): """ Write Dispatcher graph object in Python pickle format. Pickles are a serialized byte stream of a Python object. This format will preserve Python objects used as nodes or edges. :param dsp: A dispatcher that identifies the model adopted. :type dsp: schedula....
python
def save_map(dsp, path): """ Write Dispatcher graph object in Python pickle format. Pickles are a serialized byte stream of a Python object. This format will preserve Python objects used as nodes or edges. :param dsp: A dispatcher that identifies the model adopted. :type dsp: schedula....
[ "def", "save_map", "(", "dsp", ",", "path", ")", ":", "import", "dill", "with", "open", "(", "path", ",", "'wb'", ")", "as", "f", ":", "dill", ".", "dump", "(", "dsp", ".", "dmap", ",", "f", ")" ]
Write Dispatcher graph object in Python pickle format. Pickles are a serialized byte stream of a Python object. This format will preserve Python objects used as nodes or edges. :param dsp: A dispatcher that identifies the model adopted. :type dsp: schedula.Dispatcher :param path: ...
[ "Write", "Dispatcher", "graph", "object", "in", "Python", "pickle", "format", "." ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/io.py#L167-L197
train
Save a dispatcher graph in Python pickle format.
CI-WATER/gsshapy
gsshapy/lib/parsetools.py
chunk
def chunk(keywords, lines): """ Divide a file into chunks between key words in the list """ chunks = dict() chunk = [] # Create an empty dictionary using all the keywords for keyword in keywords: chunks[keyword] = [] # Populate dictionary with lists of chunks asso...
python
def chunk(keywords, lines): """ Divide a file into chunks between key words in the list """ chunks = dict() chunk = [] # Create an empty dictionary using all the keywords for keyword in keywords: chunks[keyword] = [] # Populate dictionary with lists of chunks asso...
[ "def", "chunk", "(", "keywords", ",", "lines", ")", ":", "chunks", "=", "dict", "(", ")", "chunk", "=", "[", "]", "# Create an empty dictionary using all the keywords", "for", "keyword", "in", "keywords", ":", "chunks", "[", "keyword", "]", "=", "[", "]", ...
Divide a file into chunks between key words in the list
[ "Divide", "a", "file", "into", "chunks", "between", "key", "words", "in", "the", "list" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/lib/parsetools.py#L46-L69
train
Divide a file into chunks between the keywords in the list
CI-WATER/gsshapy
gsshapy/lib/parsetools.py
valueReadPreprocessor
def valueReadPreprocessor(valueString, replaceParamsFile=None): """ Apply global pre-processing to values during reading throughout the project. Args: valueString (str): String representing the value to be preprocessed. replaceParamsFile (gsshapy.orm.ReplaceParamFile, optional): Instance of...
python
def valueReadPreprocessor(valueString, replaceParamsFile=None): """ Apply global pre-processing to values during reading throughout the project. Args: valueString (str): String representing the value to be preprocessed. replaceParamsFile (gsshapy.orm.ReplaceParamFile, optional): Instance of...
[ "def", "valueReadPreprocessor", "(", "valueString", ",", "replaceParamsFile", "=", "None", ")", ":", "if", "type", "(", "valueString", ")", "is", "bool", ":", "log", ".", "warning", "(", "\"Only numerical variable types can be handled by the valueReadPreprocessor function...
Apply global pre-processing to values during reading throughout the project. Args: valueString (str): String representing the value to be preprocessed. replaceParamsFile (gsshapy.orm.ReplaceParamFile, optional): Instance of the replace param file. Required if replacement variables are i...
[ "Apply", "global", "pre", "-", "processing", "to", "values", "during", "reading", "throughout", "the", "project", "." ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/lib/parsetools.py#L72-L103
train
Apply global pre - processing to values during reading throughout the project.
CI-WATER/gsshapy
gsshapy/lib/parsetools.py
valueWritePreprocessor
def valueWritePreprocessor(valueString, replaceParamsFile=None): """ Look up variable name in replace param file for the negative id given and return it. Args: valueString (str): String representing the value to be preprocessed. replaceParamsFile (gsshapy.orm.ReplaceParamFile, optional): In...
python
def valueWritePreprocessor(valueString, replaceParamsFile=None): """ Look up variable name in replace param file for the negative id given and return it. Args: valueString (str): String representing the value to be preprocessed. replaceParamsFile (gsshapy.orm.ReplaceParamFile, optional): In...
[ "def", "valueWritePreprocessor", "(", "valueString", ",", "replaceParamsFile", "=", "None", ")", ":", "if", "type", "(", "valueString", ")", "is", "bool", ":", "log", ".", "warning", "(", "\"Only numerical variable types can be handled by the valueReadPreprocessor functio...
Look up variable name in replace param file for the negative id given and return it. Args: valueString (str): String representing the value to be preprocessed. replaceParamsFile (gsshapy.orm.ReplaceParamFile, optional): Instance of the replace param file. Required if replacement variabl...
[ "Look", "up", "variable", "name", "in", "replace", "param", "file", "for", "the", "negative", "id", "given", "and", "return", "it", "." ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/lib/parsetools.py#L106-L144
train
This function is used to preprocess a value in the replace param file.
bayesimpact/fex
fex/collection.py
Collection.run
def run(self, dataset_path): """Run all FeatureExtractors and output results to CSV.""" features = self._generate_features(self._feature_extractors) features.to_csv(dataset_path)
python
def run(self, dataset_path): """Run all FeatureExtractors and output results to CSV.""" features = self._generate_features(self._feature_extractors) features.to_csv(dataset_path)
[ "def", "run", "(", "self", ",", "dataset_path", ")", ":", "features", "=", "self", ".", "_generate_features", "(", "self", ".", "_feature_extractors", ")", "features", ".", "to_csv", "(", "dataset_path", ")" ]
Run all FeatureExtractors and output results to CSV.
[ "Run", "all", "FeatureExtractors", "and", "output", "results", "to", "CSV", "." ]
2d9b4e9be2bf98847a36055b907411fd5557eb77
https://github.com/bayesimpact/fex/blob/2d9b4e9be2bf98847a36055b907411fd5557eb77/fex/collection.py#L28-L31
train
Run all FeatureExtractors and output results to CSV.
bayesimpact/fex
fex/collection.py
Collection._generate_features
def _generate_features(self, feature_extractors): """Run all FeatureExtractors and record results in a key-value format. :param feature_extractors: iterable of `FeatureExtractor` objects. """ results = [pd.DataFrame()] n_ext = len(feature_extractors) for i, extractor in...
python
def _generate_features(self, feature_extractors): """Run all FeatureExtractors and record results in a key-value format. :param feature_extractors: iterable of `FeatureExtractor` objects. """ results = [pd.DataFrame()] n_ext = len(feature_extractors) for i, extractor in...
[ "def", "_generate_features", "(", "self", ",", "feature_extractors", ")", ":", "results", "=", "[", "pd", ".", "DataFrame", "(", ")", "]", "n_ext", "=", "len", "(", "feature_extractors", ")", "for", "i", ",", "extractor", "in", "enumerate", "(", "feature_e...
Run all FeatureExtractors and record results in a key-value format. :param feature_extractors: iterable of `FeatureExtractor` objects.
[ "Run", "all", "FeatureExtractors", "and", "record", "results", "in", "a", "key", "-", "value", "format", "." ]
2d9b4e9be2bf98847a36055b907411fd5557eb77
https://github.com/bayesimpact/fex/blob/2d9b4e9be2bf98847a36055b907411fd5557eb77/fex/collection.py#L33-L58
train
Run all FeatureExtractors and record results in a key - value format.
CI-WATER/gsshapy
gsshapy/base/file_base.py
GsshaPyFileObjectBase.read
def read(self, directory, filename, session, spatial=False, spatialReferenceID=4236, replaceParamFile=None, **kwargs): """ Generic read file into database method. Args: directory (str): Directory containing the file to be read. filename (str): Name of the fi...
python
def read(self, directory, filename, session, spatial=False, spatialReferenceID=4236, replaceParamFile=None, **kwargs): """ Generic read file into database method. Args: directory (str): Directory containing the file to be read. filename (str): Name of the fi...
[ "def", "read", "(", "self", ",", "directory", ",", "filename", ",", "session", ",", "spatial", "=", "False", ",", "spatialReferenceID", "=", "4236", ",", "replaceParamFile", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# Read parameter derivatives", "pat...
Generic read file into database method. Args: directory (str): Directory containing the file to be read. filename (str): Name of the file which will be read (e.g.: 'example.prj'). session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS ena...
[ "Generic", "read", "file", "into", "database", "method", "." ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/base/file_base.py#L37-L80
train
Generic read method for the base class.
CI-WATER/gsshapy
gsshapy/base/file_base.py
GsshaPyFileObjectBase.write
def write(self, session, directory, name, replaceParamFile=None, **kwargs): """ Write from database back to file. Args: session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled database. directory (str): Directory where the file...
python
def write(self, session, directory, name, replaceParamFile=None, **kwargs): """ Write from database back to file. Args: session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled database. directory (str): Directory where the file...
[ "def", "write", "(", "self", ",", "session", ",", "directory", ",", "name", ",", "replaceParamFile", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# Assemble Path to file", "name_split", "=", "name", ".", "split", "(", "'.'", ")", "name", "=", "name_s...
Write from database back to file. Args: session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled database. directory (str): Directory where the file will be written. name (str): The name of the file that will be created (including t...
[ "Write", "from", "database", "back", "to", "file", "." ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/base/file_base.py#L82-L122
train
Writes a new entry to a file.
CI-WATER/gsshapy
gsshapy/base/file_base.py
GsshaPyFileObjectBase._commit
def _commit(self, session, errorMessage): """ Custom commit function for file objects """ try: session.commit() except IntegrityError: # Raise special error if the commit fails due to empty files log.error('Commit to database failed. %s' % erro...
python
def _commit(self, session, errorMessage): """ Custom commit function for file objects """ try: session.commit() except IntegrityError: # Raise special error if the commit fails due to empty files log.error('Commit to database failed. %s' % erro...
[ "def", "_commit", "(", "self", ",", "session", ",", "errorMessage", ")", ":", "try", ":", "session", ".", "commit", "(", ")", "except", "IntegrityError", ":", "# Raise special error if the commit fails due to empty files", "log", ".", "error", "(", "'Commit to datab...
Custom commit function for file objects
[ "Custom", "commit", "function", "for", "file", "objects" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/base/file_base.py#L124-L135
train
Custom commit function for file objects
CI-WATER/gsshapy
gsshapy/base/file_base.py
GsshaPyFileObjectBase._read
def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile): """ Private file object read method. Classes that inherit from this base class must implement this method. The ``read()`` method that each file object inherits from this base cla...
python
def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile): """ Private file object read method. Classes that inherit from this base class must implement this method. The ``read()`` method that each file object inherits from this base cla...
[ "def", "_read", "(", "self", ",", "directory", ",", "filename", ",", "session", ",", "path", ",", "name", ",", "extension", ",", "spatial", ",", "spatialReferenceID", ",", "replaceParamFile", ")", ":" ]
Private file object read method. Classes that inherit from this base class must implement this method. The ``read()`` method that each file object inherits from this base class performs the processes common to all file read methods, after which it calls the file object's ``_read()`` (the preceding unde...
[ "Private", "file", "object", "read", "method", ".", "Classes", "that", "inherit", "from", "this", "base", "class", "must", "implement", "this", "method", "." ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/base/file_base.py#L137-L170
train
Private method that reads the file object specified by the user.
dsoprea/PySecure
versioneer.py
svn_versions_from_vcs
def svn_versions_from_vcs(tag_prefix, root, verbose=False): """Return a dictionary of values derived directly from the VCS. This is the third attempt to find information by get_versions(). """ if not os.path.exists(os.path.join(root, '.svn')): if verbose: print("no .svn in %s." % ro...
python
def svn_versions_from_vcs(tag_prefix, root, verbose=False): """Return a dictionary of values derived directly from the VCS. This is the third attempt to find information by get_versions(). """ if not os.path.exists(os.path.join(root, '.svn')): if verbose: print("no .svn in %s." % ro...
[ "def", "svn_versions_from_vcs", "(", "tag_prefix", ",", "root", ",", "verbose", "=", "False", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ".", "join", "(", "root", ",", "'.svn'", ")", ")", ":", "if", "verbose", ...
Return a dictionary of values derived directly from the VCS. This is the third attempt to find information by get_versions().
[ "Return", "a", "dictionary", "of", "values", "derived", "directly", "from", "the", "VCS", ".", "This", "is", "the", "third", "attempt", "to", "find", "information", "by", "get_versions", "()", "." ]
ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0
https://github.com/dsoprea/PySecure/blob/ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0/versioneer.py#L1061-L1116
train
Return a dictionary of values derived directly from the VCS. This is the first attempt to find information by get_versions.
dsoprea/PySecure
versioneer.py
get_versions
def get_versions(default=DEFAULT, verbose=False): """This variation of get_versions() will be used in versioneer.py .""" # returns dict with two keys: 'version' and 'full' assert versionfile_source is not None, "please set versioneer.versionfile_source" assert tag_prefix is not None, "please set versi...
python
def get_versions(default=DEFAULT, verbose=False): """This variation of get_versions() will be used in versioneer.py .""" # returns dict with two keys: 'version' and 'full' assert versionfile_source is not None, "please set versioneer.versionfile_source" assert tag_prefix is not None, "please set versi...
[ "def", "get_versions", "(", "default", "=", "DEFAULT", ",", "verbose", "=", "False", ")", ":", "# returns dict with two keys: 'version' and 'full'", "assert", "versionfile_source", "is", "not", "None", ",", "\"please set versioneer.versionfile_source\"", "assert", "tag_pref...
This variation of get_versions() will be used in versioneer.py .
[ "This", "variation", "of", "get_versions", "()", "will", "be", "used", "in", "versioneer", ".", "py", "." ]
ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0
https://github.com/dsoprea/PySecure/blob/ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0/versioneer.py#L1204-L1263
train
This function returns a dict with two keys version and full version.
dsoprea/PySecure
versioneer.py
cmd_versioneer.run
def run(self): """Create the versioneer.py file.""" print(" creating %s" % versionfile_source) with open(versionfile_source, "w") as f: f.write(get_vcs_code()) ipy = os.path.join(os.path.dirname(versionfile_source), "__init__.py") try: with open(ipy, "r"...
python
def run(self): """Create the versioneer.py file.""" print(" creating %s" % versionfile_source) with open(versionfile_source, "w") as f: f.write(get_vcs_code()) ipy = os.path.join(os.path.dirname(versionfile_source), "__init__.py") try: with open(ipy, "r"...
[ "def", "run", "(", "self", ")", ":", "print", "(", "\" creating %s\"", "%", "versionfile_source", ")", "with", "open", "(", "versionfile_source", ",", "\"w\"", ")", "as", "f", ":", "f", ".", "write", "(", "get_vcs_code", "(", ")", ")", "ipy", "=", "os"...
Create the versioneer.py file.
[ "Create", "the", "versioneer", ".", "py", "file", "." ]
ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0
https://github.com/dsoprea/PySecure/blob/ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0/versioneer.py#L1378-L1435
train
Create the versioneer. py file.
CI-WATER/gsshapy
gsshapy/lib/cif_chunk.py
cardChunk
def cardChunk(key, chunk): """ Parse Card Chunk Method """ for line in chunk: values = [] sline = line.strip().split() for idx in range(1, len(sline)): values.append(sline[idx]) return {'card': sline[0], 'values': values}
python
def cardChunk(key, chunk): """ Parse Card Chunk Method """ for line in chunk: values = [] sline = line.strip().split() for idx in range(1, len(sline)): values.append(sline[idx]) return {'card': sline[0], 'values': values}
[ "def", "cardChunk", "(", "key", ",", "chunk", ")", ":", "for", "line", "in", "chunk", ":", "values", "=", "[", "]", "sline", "=", "line", ".", "strip", "(", ")", ".", "split", "(", ")", "for", "idx", "in", "range", "(", "1", ",", "len", "(", ...
Parse Card Chunk Method
[ "Parse", "Card", "Chunk", "Method" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/lib/cif_chunk.py#L14-L26
train
Parse a card chunk into a dict
CI-WATER/gsshapy
gsshapy/lib/cif_chunk.py
connectChunk
def connectChunk(key, chunk): """ Parse Card Chunk Method """ upLinks = [] schunk = chunk[0].strip().split() for idx in range(4, len(schunk)): upLinks.append(schunk[idx]) result = {'link': schunk[1], 'downLink': schunk[2], 'numUpLinks': schunk[3], ...
python
def connectChunk(key, chunk): """ Parse Card Chunk Method """ upLinks = [] schunk = chunk[0].strip().split() for idx in range(4, len(schunk)): upLinks.append(schunk[idx]) result = {'link': schunk[1], 'downLink': schunk[2], 'numUpLinks': schunk[3], ...
[ "def", "connectChunk", "(", "key", ",", "chunk", ")", ":", "upLinks", "=", "[", "]", "schunk", "=", "chunk", "[", "0", "]", ".", "strip", "(", ")", ".", "split", "(", ")", "for", "idx", "in", "range", "(", "4", ",", "len", "(", "schunk", ")", ...
Parse Card Chunk Method
[ "Parse", "Card", "Chunk", "Method" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/lib/cif_chunk.py#L28-L43
train
Parse a Card Chunk Method
CI-WATER/gsshapy
gsshapy/lib/cif_chunk.py
structureLink
def structureLink(lines): """ Parse STRUCTURE LINK Method """ # Constants KEYWORDS = ('LINK', 'STRUCTURE', 'NUMSTRUCTS', 'STRUCTTYPE') WEIR_KEYWORDS = ('STRUCTTYPE', 'CREST_LENGTH', 'CREST_LOW_ELEV', ...
python
def structureLink(lines): """ Parse STRUCTURE LINK Method """ # Constants KEYWORDS = ('LINK', 'STRUCTURE', 'NUMSTRUCTS', 'STRUCTTYPE') WEIR_KEYWORDS = ('STRUCTTYPE', 'CREST_LENGTH', 'CREST_LOW_ELEV', ...
[ "def", "structureLink", "(", "lines", ")", ":", "# Constants", "KEYWORDS", "=", "(", "'LINK'", ",", "'STRUCTURE'", ",", "'NUMSTRUCTS'", ",", "'STRUCTTYPE'", ")", "WEIR_KEYWORDS", "=", "(", "'STRUCTTYPE'", ",", "'CREST_LENGTH'", ",", "'CREST_LOW_ELEV'", ",", "'DI...
Parse STRUCTURE LINK Method
[ "Parse", "STRUCTURE", "LINK", "Method" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/lib/cif_chunk.py#L66-L158
train
Parses the STRUCTURE LINK Method and returns the structureLink object.
CI-WATER/gsshapy
gsshapy/lib/cif_chunk.py
xSectionLink
def xSectionLink(lines): """ Parse Cross Section Links Method """ # Constants KEYWORDS = ('LINK', 'DX', 'TRAPEZOID', 'TRAPEZOID_ERODE', 'TRAPEZOID_SUBSURFACE', 'ERODE_TRAPEZOID', 'ERODE_SUBSURFACE', ...
python
def xSectionLink(lines): """ Parse Cross Section Links Method """ # Constants KEYWORDS = ('LINK', 'DX', 'TRAPEZOID', 'TRAPEZOID_ERODE', 'TRAPEZOID_SUBSURFACE', 'ERODE_TRAPEZOID', 'ERODE_SUBSURFACE', ...
[ "def", "xSectionLink", "(", "lines", ")", ":", "# Constants", "KEYWORDS", "=", "(", "'LINK'", ",", "'DX'", ",", "'TRAPEZOID'", ",", "'TRAPEZOID_ERODE'", ",", "'TRAPEZOID_SUBSURFACE'", ",", "'ERODE_TRAPEZOID'", ",", "'ERODE_SUBSURFACE'", ",", "'SUBSURFACE_TRAPEZOID'", ...
Parse Cross Section Links Method
[ "Parse", "Cross", "Section", "Links", "Method" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/lib/cif_chunk.py#L160-L273
train
Parses Cross Section Links Method
CI-WATER/gsshapy
gsshapy/lib/cif_chunk.py
reservoirLink
def reservoirLink(lines): """ Parse RESERVOIR Link Method """ # Constants KEYWORDS = ('LINK', 'RESERVOIR', 'RES_MINWSE', 'RES_INITWSE', 'RES_MAXWSE', 'RES_NUMPTS', 'LAKE', 'MINWSE', ...
python
def reservoirLink(lines): """ Parse RESERVOIR Link Method """ # Constants KEYWORDS = ('LINK', 'RESERVOIR', 'RES_MINWSE', 'RES_INITWSE', 'RES_MAXWSE', 'RES_NUMPTS', 'LAKE', 'MINWSE', ...
[ "def", "reservoirLink", "(", "lines", ")", ":", "# Constants", "KEYWORDS", "=", "(", "'LINK'", ",", "'RESERVOIR'", ",", "'RES_MINWSE'", ",", "'RES_INITWSE'", ",", "'RES_MAXWSE'", ",", "'RES_NUMPTS'", ",", "'LAKE'", ",", "'MINWSE'", ",", "'INITWSE'", ",", "'MAX...
Parse RESERVOIR Link Method
[ "Parse", "RESERVOIR", "Link", "Method" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/lib/cif_chunk.py#L275-L342
train
Parse RESERVOIR Link Method
CI-WATER/gsshapy
gsshapy/lib/cif_chunk.py
nodeChunk
def nodeChunk(lines): """ Parse NODE Method """ # Constants KEYWORDS = ('NODE', 'X_Y', 'ELEV') result = {'node': None, 'x': None, 'y': None, 'elev': None} chunks = pt.chunk(KEYWORDS, lines) # Parse chunks associ...
python
def nodeChunk(lines): """ Parse NODE Method """ # Constants KEYWORDS = ('NODE', 'X_Y', 'ELEV') result = {'node': None, 'x': None, 'y': None, 'elev': None} chunks = pt.chunk(KEYWORDS, lines) # Parse chunks associ...
[ "def", "nodeChunk", "(", "lines", ")", ":", "# Constants", "KEYWORDS", "=", "(", "'NODE'", ",", "'X_Y'", ",", "'ELEV'", ")", "result", "=", "{", "'node'", ":", "None", ",", "'x'", ":", "None", ",", "'y'", ":", "None", ",", "'elev'", ":", "None", "}...
Parse NODE Method
[ "Parse", "NODE", "Method" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/lib/cif_chunk.py#L344-L371
train
Parse NODE Method
CI-WATER/gsshapy
gsshapy/lib/cif_chunk.py
xSectionChunk
def xSectionChunk(lines): """ Parse XSEC Method """ # Constants KEYWORDS = ('MANNINGS_N', 'BOTTOM_WIDTH', 'BANKFULL_DEPTH', 'SIDE_SLOPE', 'NPAIRS', 'NUM_INTERP', 'X1', 'ERODE', ...
python
def xSectionChunk(lines): """ Parse XSEC Method """ # Constants KEYWORDS = ('MANNINGS_N', 'BOTTOM_WIDTH', 'BANKFULL_DEPTH', 'SIDE_SLOPE', 'NPAIRS', 'NUM_INTERP', 'X1', 'ERODE', ...
[ "def", "xSectionChunk", "(", "lines", ")", ":", "# Constants", "KEYWORDS", "=", "(", "'MANNINGS_N'", ",", "'BOTTOM_WIDTH'", ",", "'BANKFULL_DEPTH'", ",", "'SIDE_SLOPE'", ",", "'NPAIRS'", ",", "'NUM_INTERP'", ",", "'X1'", ",", "'ERODE'", ",", "'MAX_EROSION'", ","...
Parse XSEC Method
[ "Parse", "XSEC", "Method" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/lib/cif_chunk.py#L373-L427
train
Parse XSEC Method Chunk
Robpol86/etaprogress
etaprogress/components/bars.py
BarUndefinedEmpty.bar
def bar(self, width, **_): """Returns the completed progress bar. Positional arguments: width -- the width of the entire bar (including borders). """ return self.CHAR_LEFT_BORDER + self.CHAR_EMPTY * (width - self._width_offset) + self.CHAR_RIGHT_BORDER
python
def bar(self, width, **_): """Returns the completed progress bar. Positional arguments: width -- the width of the entire bar (including borders). """ return self.CHAR_LEFT_BORDER + self.CHAR_EMPTY * (width - self._width_offset) + self.CHAR_RIGHT_BORDER
[ "def", "bar", "(", "self", ",", "width", ",", "*", "*", "_", ")", ":", "return", "self", ".", "CHAR_LEFT_BORDER", "+", "self", ".", "CHAR_EMPTY", "*", "(", "width", "-", "self", ".", "_width_offset", ")", "+", "self", ".", "CHAR_RIGHT_BORDER" ]
Returns the completed progress bar. Positional arguments: width -- the width of the entire bar (including borders).
[ "Returns", "the", "completed", "progress", "bar", "." ]
224e8a248c2bf820bad218763281914ad3983fff
https://github.com/Robpol86/etaprogress/blob/224e8a248c2bf820bad218763281914ad3983fff/etaprogress/components/bars.py#L14-L20
train
Returns the complete progress bar.
Robpol86/etaprogress
etaprogress/components/bars.py
BarUndefinedAnimated.bar
def bar(self, width, **_): """Returns the completed progress bar. Every time this is called the animation moves. Positional arguments: width -- the width of the entire bar (including borders). """ width -= self._width_offset self._position += self._direction # C...
python
def bar(self, width, **_): """Returns the completed progress bar. Every time this is called the animation moves. Positional arguments: width -- the width of the entire bar (including borders). """ width -= self._width_offset self._position += self._direction # C...
[ "def", "bar", "(", "self", ",", "width", ",", "*", "*", "_", ")", ":", "width", "-=", "self", ".", "_width_offset", "self", ".", "_position", "+=", "self", ".", "_direction", "# Change direction.", "if", "self", ".", "_position", "<=", "0", "and", "sel...
Returns the completed progress bar. Every time this is called the animation moves. Positional arguments: width -- the width of the entire bar (including borders).
[ "Returns", "the", "completed", "progress", "bar", ".", "Every", "time", "this", "is", "called", "the", "animation", "moves", "." ]
224e8a248c2bf820bad218763281914ad3983fff
https://github.com/Robpol86/etaprogress/blob/224e8a248c2bf820bad218763281914ad3983fff/etaprogress/components/bars.py#L34-L58
train
Returns the complete progress bar. Every time this is called the animation moves.
Robpol86/etaprogress
etaprogress/components/bars.py
Bar.bar
def bar(self, width, percent=0): """Returns the completed progress bar. Positional arguments: width -- the width of the entire bar (including borders). Keyword arguments: percent -- the percentage to draw. """ width -= self._width_offset units = int(perc...
python
def bar(self, width, percent=0): """Returns the completed progress bar. Positional arguments: width -- the width of the entire bar (including borders). Keyword arguments: percent -- the percentage to draw. """ width -= self._width_offset units = int(perc...
[ "def", "bar", "(", "self", ",", "width", ",", "percent", "=", "0", ")", ":", "width", "-=", "self", ".", "_width_offset", "units", "=", "int", "(", "percent", "*", "0.01", "*", "width", ")", "if", "not", "units", ":", "return", "self", ".", "CHAR_L...
Returns the completed progress bar. Positional arguments: width -- the width of the entire bar (including borders). Keyword arguments: percent -- the percentage to draw.
[ "Returns", "the", "completed", "progress", "bar", "." ]
224e8a248c2bf820bad218763281914ad3983fff
https://github.com/Robpol86/etaprogress/blob/224e8a248c2bf820bad218763281914ad3983fff/etaprogress/components/bars.py#L67-L88
train
Returns the complete progress bar.
Robpol86/etaprogress
etaprogress/components/bars.py
BarDoubled.bar
def bar(self, width, percent=0): """Returns the completed progress bar. Positional arguments: width -- the width of the entire bar (including borders). Keyword arguments: percent -- the percentage to draw. """ width -= self._width_offset units_float = pe...
python
def bar(self, width, percent=0): """Returns the completed progress bar. Positional arguments: width -- the width of the entire bar (including borders). Keyword arguments: percent -- the percentage to draw. """ width -= self._width_offset units_float = pe...
[ "def", "bar", "(", "self", ",", "width", ",", "percent", "=", "0", ")", ":", "width", "-=", "self", ".", "_width_offset", "units_float", "=", "percent", "*", "0.01", "*", "width", "if", "units_float", "<", "0.5", ":", "return", "self", ".", "CHAR_LEFT_...
Returns the completed progress bar. Positional arguments: width -- the width of the entire bar (including borders). Keyword arguments: percent -- the percentage to draw.
[ "Returns", "the", "completed", "progress", "bar", "." ]
224e8a248c2bf820bad218763281914ad3983fff
https://github.com/Robpol86/etaprogress/blob/224e8a248c2bf820bad218763281914ad3983fff/etaprogress/components/bars.py#L97-L129
train
Returns the completed progress bar.
CI-WATER/gsshapy
gsshapy/orm/cmt.py
MapTableFile._read
def _read(self, directory, filename, session, path, name, extension, spatial=False, spatialReferenceID=4236, replaceParamFile=None, readIndexMaps=True): """ Mapping Table Read from File Method """ # Set file extension property self.fileExtension = exte...
python
def _read(self, directory, filename, session, path, name, extension, spatial=False, spatialReferenceID=4236, replaceParamFile=None, readIndexMaps=True): """ Mapping Table Read from File Method """ # Set file extension property self.fileExtension = exte...
[ "def", "_read", "(", "self", ",", "directory", ",", "filename", ",", "session", ",", "path", ",", "name", ",", "extension", ",", "spatial", "=", "False", ",", "spatialReferenceID", "=", "4236", ",", "replaceParamFile", "=", "None", ",", "readIndexMaps", "=...
Mapping Table Read from File Method
[ "Mapping", "Table", "Read", "from", "File", "Method" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/cmt.py#L86-L159
train
Read from File Method
CI-WATER/gsshapy
gsshapy/orm/cmt.py
MapTableFile._write
def _write(self, session, openFile, replaceParamFile=None, writeIndexMaps=True): """ Map Table Write to File Method """ # Extract directory directory = os.path.split(openFile.name)[0] # Derive a Unique Set of Contaminants for mapTable in self.getOrderedMapTables(...
python
def _write(self, session, openFile, replaceParamFile=None, writeIndexMaps=True): """ Map Table Write to File Method """ # Extract directory directory = os.path.split(openFile.name)[0] # Derive a Unique Set of Contaminants for mapTable in self.getOrderedMapTables(...
[ "def", "_write", "(", "self", ",", "session", ",", "openFile", ",", "replaceParamFile", "=", "None", ",", "writeIndexMaps", "=", "True", ")", ":", "# Extract directory", "directory", "=", "os", ".", "path", ".", "split", "(", "openFile", ".", "name", ")", ...
Map Table Write to File Method
[ "Map", "Table", "Write", "to", "File", "Method" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/cmt.py#L161-L206
train
This method writes the GSSHA index maps to file and returns the ID of the index map.
CI-WATER/gsshapy
gsshapy/orm/cmt.py
MapTableFile.getOrderedMapTables
def getOrderedMapTables(self, session): """ Retrieve the map tables ordered by name """ return session.query(MapTable).filter(MapTable.mapTableFile == self).order_by(MapTable.name).all()
python
def getOrderedMapTables(self, session): """ Retrieve the map tables ordered by name """ return session.query(MapTable).filter(MapTable.mapTableFile == self).order_by(MapTable.name).all()
[ "def", "getOrderedMapTables", "(", "self", ",", "session", ")", ":", "return", "session", ".", "query", "(", "MapTable", ")", ".", "filter", "(", "MapTable", ".", "mapTableFile", "==", "self", ")", ".", "order_by", "(", "MapTable", ".", "name", ")", ".",...
Retrieve the map tables ordered by name
[ "Retrieve", "the", "map", "tables", "ordered", "by", "name" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/cmt.py#L208-L212
train
Retrieve the map tables ordered by name
CI-WATER/gsshapy
gsshapy/orm/cmt.py
MapTableFile.deleteMapTable
def deleteMapTable(self, name, session): """ Remove duplicate map table if it exists """ duplicate_map_tables = session.query(MapTable).filter(MapTable.mapTableFile == self).filter(MapTable.name == name).all() for duplicate_map_table in duplicate_map_tables: if dupli...
python
def deleteMapTable(self, name, session): """ Remove duplicate map table if it exists """ duplicate_map_tables = session.query(MapTable).filter(MapTable.mapTableFile == self).filter(MapTable.name == name).all() for duplicate_map_table in duplicate_map_tables: if dupli...
[ "def", "deleteMapTable", "(", "self", ",", "name", ",", "session", ")", ":", "duplicate_map_tables", "=", "session", ".", "query", "(", "MapTable", ")", ".", "filter", "(", "MapTable", ".", "mapTableFile", "==", "self", ")", ".", "filter", "(", "MapTable",...
Remove duplicate map table if it exists
[ "Remove", "duplicate", "map", "table", "if", "it", "exists" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/cmt.py#L214-L224
train
Delete duplicate map table if it exists
CI-WATER/gsshapy
gsshapy/orm/cmt.py
MapTableFile._createGsshaPyObjects
def _createGsshaPyObjects(self, mapTables, indexMaps, replaceParamFile, directory, session, spatial, spatialReferenceID): """ Create GSSHAPY Mapping Table ORM Objects Method """ for mt in mapTables: # Create GSSHAPY MapTable object try: # Make sure...
python
def _createGsshaPyObjects(self, mapTables, indexMaps, replaceParamFile, directory, session, spatial, spatialReferenceID): """ Create GSSHAPY Mapping Table ORM Objects Method """ for mt in mapTables: # Create GSSHAPY MapTable object try: # Make sure...
[ "def", "_createGsshaPyObjects", "(", "self", ",", "mapTables", ",", "indexMaps", ",", "replaceParamFile", ",", "directory", ",", "session", ",", "spatial", ",", "spatialReferenceID", ")", ":", "for", "mt", "in", "mapTables", ":", "# Create GSSHAPY MapTable object", ...
Create GSSHAPY Mapping Table ORM Objects Method
[ "Create", "GSSHAPY", "Mapping", "Table", "ORM", "Objects", "Method" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/cmt.py#L226-L301
train
Create GSSHAPY ORM Objects Method Method
CI-WATER/gsshapy
gsshapy/orm/cmt.py
MapTableFile._createValueObjects
def _createValueObjects(self, valueList, varList, mapTable, indexMap, contaminant, replaceParamFile): """ Populate GSSHAPY MTValue and MTIndex Objects Method """ def assign_values_to_table(value_list, layer_id): for i, value in enumerate(value_list): value = v...
python
def _createValueObjects(self, valueList, varList, mapTable, indexMap, contaminant, replaceParamFile): """ Populate GSSHAPY MTValue and MTIndex Objects Method """ def assign_values_to_table(value_list, layer_id): for i, value in enumerate(value_list): value = v...
[ "def", "_createValueObjects", "(", "self", ",", "valueList", ",", "varList", ",", "mapTable", ",", "indexMap", ",", "contaminant", ",", "replaceParamFile", ")", ":", "def", "assign_values_to_table", "(", "value_list", ",", "layer_id", ")", ":", "for", "i", ","...
Populate GSSHAPY MTValue and MTIndex Objects Method
[ "Populate", "GSSHAPY", "MTValue", "and", "MTIndex", "Objects", "Method" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/cmt.py#L303-L329
train
Populate GSSHAPY MTValue and MTIndex Objects Method
CI-WATER/gsshapy
gsshapy/orm/cmt.py
MapTableFile._readContaminantOutputFiles
def _readContaminantOutputFiles(self, directory, baseFileName, session, spatial, spatialReferenceID): """ Read any contaminant output files if available """ if not os.path.isdir(directory): return if baseFileName == '': return # Look for channel o...
python
def _readContaminantOutputFiles(self, directory, baseFileName, session, spatial, spatialReferenceID): """ Read any contaminant output files if available """ if not os.path.isdir(directory): return if baseFileName == '': return # Look for channel o...
[ "def", "_readContaminantOutputFiles", "(", "self", ",", "directory", ",", "baseFileName", ",", "session", ",", "spatial", ",", "spatialReferenceID", ")", ":", "if", "not", "os", ".", "path", ".", "isdir", "(", "directory", ")", ":", "return", "if", "baseFile...
Read any contaminant output files if available
[ "Read", "any", "contaminant", "output", "files", "if", "available" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/cmt.py#L331-L364
train
Read any contaminant output files in the specified directory.
CI-WATER/gsshapy
gsshapy/orm/cmt.py
MapTableFile._writeMapTable
def _writeMapTable(self, session, fileObject, mapTable, replaceParamFile): """ Write Generic Map Table Method This method writes a mapping table in the generic format to file. The method will handle both empty and filled cases of generic formatted mapping tables. session = SQLA...
python
def _writeMapTable(self, session, fileObject, mapTable, replaceParamFile): """ Write Generic Map Table Method This method writes a mapping table in the generic format to file. The method will handle both empty and filled cases of generic formatted mapping tables. session = SQLA...
[ "def", "_writeMapTable", "(", "self", ",", "session", ",", "fileObject", ",", "mapTable", ",", "replaceParamFile", ")", ":", "# Write mapping name", "fileObject", ".", "write", "(", "'%s \"%s\"\\n'", "%", "(", "mapTable", ".", "name", ",", "mapTable", ".", "in...
Write Generic Map Table Method This method writes a mapping table in the generic format to file. The method will handle both empty and filled cases of generic formatted mapping tables. session = SQLAlchemy session object for retrieving data from the database fileObject = The file objec...
[ "Write", "Generic", "Map", "Table", "Method" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/cmt.py#L366-L395
train
Method writes a generic mapping table to the file object.
CI-WATER/gsshapy
gsshapy/orm/cmt.py
MapTableFile._writeContaminantTable
def _writeContaminantTable(self, session, fileObject, mapTable, contaminants, replaceParamFile): """ This method writes the contaminant transport mapping table case. """ # Write the contaminant mapping table header fileObject.write('%s\n' % (mapTable.name)) fileObject.wri...
python
def _writeContaminantTable(self, session, fileObject, mapTable, contaminants, replaceParamFile): """ This method writes the contaminant transport mapping table case. """ # Write the contaminant mapping table header fileObject.write('%s\n' % (mapTable.name)) fileObject.wri...
[ "def", "_writeContaminantTable", "(", "self", ",", "session", ",", "fileObject", ",", "mapTable", ",", "contaminants", ",", "replaceParamFile", ")", ":", "# Write the contaminant mapping table header", "fileObject", ".", "write", "(", "'%s\\n'", "%", "(", "mapTable", ...
This method writes the contaminant transport mapping table case.
[ "This", "method", "writes", "the", "contaminant", "transport", "mapping", "table", "case", "." ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/cmt.py#L398-L430
train
This method writes the contaminants mapping table case.
CI-WATER/gsshapy
gsshapy/orm/cmt.py
MapTableFile._writeSedimentTable
def _writeSedimentTable(self, session, fileObject, mapTable, replaceParamFile): """ Write Sediment Mapping Table Method This method writes the sediments special mapping table case. """ # Write the sediment mapping table header fileObject.write('%s\n' % (mapTable.name)) ...
python
def _writeSedimentTable(self, session, fileObject, mapTable, replaceParamFile): """ Write Sediment Mapping Table Method This method writes the sediments special mapping table case. """ # Write the sediment mapping table header fileObject.write('%s\n' % (mapTable.name)) ...
[ "def", "_writeSedimentTable", "(", "self", ",", "session", ",", "fileObject", ",", "mapTable", ",", "replaceParamFile", ")", ":", "# Write the sediment mapping table header", "fileObject", ".", "write", "(", "'%s\\n'", "%", "(", "mapTable", ".", "name", ")", ")", ...
Write Sediment Mapping Table Method This method writes the sediments special mapping table case.
[ "Write", "Sediment", "Mapping", "Table", "Method" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/cmt.py#L433-L475
train
Method writes the sediments special mapping table to fileObject
CI-WATER/gsshapy
gsshapy/orm/cmt.py
MapTableFile._valuePivot
def _valuePivot(self, session, mapTable, contaminant, replaceParaFile): """ This function retrieves the values of a mapping table from the database and pivots them into the format that is required by the mapping table file. This function returns a list of strings that can be printed to the file ...
python
def _valuePivot(self, session, mapTable, contaminant, replaceParaFile): """ This function retrieves the values of a mapping table from the database and pivots them into the format that is required by the mapping table file. This function returns a list of strings that can be printed to the file ...
[ "def", "_valuePivot", "(", "self", ",", "session", ",", "mapTable", ",", "contaminant", ",", "replaceParaFile", ")", ":", "# Retrieve the indices for the current mapping table and mapping table file", "indexes", "=", "session", ".", "query", "(", "MTIndex", ")", ".", ...
This function retrieves the values of a mapping table from the database and pivots them into the format that is required by the mapping table file. This function returns a list of strings that can be printed to the file directly.
[ "This", "function", "retrieves", "the", "values", "of", "a", "mapping", "table", "from", "the", "database", "and", "pivots", "them", "into", "the", "format", "that", "is", "required", "by", "the", "mapping", "table", "file", ".", "This", "function", "returns...
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/cmt.py#L477-L576
train
This function retrieves the values of a mapping table from the database and pivots them into the format that is required by the mapping table file. This function returns a list of strings that can be printed to the file .
CI-WATER/gsshapy
gsshapy/orm/cmt.py
MapTableFile._preprocessContaminantOutFilePath
def _preprocessContaminantOutFilePath(outPath): """ Preprocess the contaminant output file path to a relative path. """ if '/' in outPath: splitPath = outPath.split('/') elif '\\' in outPath: splitPath = outPath.split('\\') else: spli...
python
def _preprocessContaminantOutFilePath(outPath): """ Preprocess the contaminant output file path to a relative path. """ if '/' in outPath: splitPath = outPath.split('/') elif '\\' in outPath: splitPath = outPath.split('\\') else: spli...
[ "def", "_preprocessContaminantOutFilePath", "(", "outPath", ")", ":", "if", "'/'", "in", "outPath", ":", "splitPath", "=", "outPath", ".", "split", "(", "'/'", ")", "elif", "'\\\\'", "in", "outPath", ":", "splitPath", "=", "outPath", ".", "split", "(", "'\...
Preprocess the contaminant output file path to a relative path.
[ "Preprocess", "the", "contaminant", "output", "file", "path", "to", "a", "relative", "path", "." ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/cmt.py#L587-L609
train
Preprocess the contaminant output file path to a relative path.
CI-WATER/gsshapy
gsshapy/orm/cmt.py
MapTableFile.addRoughnessMapFromLandUse
def addRoughnessMapFromLandUse(self, name, session, land_use_grid, land_use_to_roughness_table=None, land_use_grid_id=None, ...
python
def addRoughnessMapFromLandUse(self, name, session, land_use_grid, land_use_to_roughness_table=None, land_use_grid_id=None, ...
[ "def", "addRoughnessMapFromLandUse", "(", "self", ",", "name", ",", "session", ",", "land_use_grid", ",", "land_use_to_roughness_table", "=", "None", ",", "land_use_grid_id", "=", "None", ",", ")", ":", "LAND_USE_GRID_TABLES", "=", "{", "'nga'", ":", "'land_cover_...
Adds a roughness map from land use file Example:: from gsshapy.orm import ProjectFile from gsshapy.lib import db_tools as dbt from os import path, chdir gssha_directory = '/gsshapy/tests/grid_standard/gssha_project' land_use_grid = 'LC_5min_global_...
[ "Adds", "a", "roughness", "map", "from", "land", "use", "file" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/cmt.py#L611-L744
train
Add a roughness map from land use file.
vinci1it2000/schedula
schedula/utils/sol.py
Solution._set_wildcards
def _set_wildcards(self, inputs=None, outputs=None): """ Update wildcards set with the input data nodes that are also outputs. :param inputs: Input data nodes. :type inputs: list[str], iterable, optional :param outputs: Ending data nodes. :type o...
python
def _set_wildcards(self, inputs=None, outputs=None): """ Update wildcards set with the input data nodes that are also outputs. :param inputs: Input data nodes. :type inputs: list[str], iterable, optional :param outputs: Ending data nodes. :type o...
[ "def", "_set_wildcards", "(", "self", ",", "inputs", "=", "None", ",", "outputs", "=", "None", ")", ":", "w", "=", "self", ".", "_wildcards", "=", "set", "(", ")", "# Clean wildcards.", "if", "outputs", "and", "inputs", ":", "node", ",", "wi", "=", "...
Update wildcards set with the input data nodes that are also outputs. :param inputs: Input data nodes. :type inputs: list[str], iterable, optional :param outputs: Ending data nodes. :type outputs: list[str], iterable, optional
[ "Update", "wildcards", "set", "with", "the", "input", "data", "nodes", "that", "are", "also", "outputs", "." ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/sol.py#L108-L130
train
Update wildcards set with the input data nodes that are also outputs.
vinci1it2000/schedula
schedula/utils/sol.py
Solution.result
def result(self, timeout=None): """ Set all asynchronous results. :param timeout: The number of seconds to wait for the result if the futures aren't done. If None, then there is no limit on the wait time. :type timeout: float :return: Update ...
python
def result(self, timeout=None): """ Set all asynchronous results. :param timeout: The number of seconds to wait for the result if the futures aren't done. If None, then there is no limit on the wait time. :type timeout: float :return: Update ...
[ "def", "result", "(", "self", ",", "timeout", "=", "None", ")", ":", "it", ",", "exceptions", ",", "future_lists", "=", "[", "]", ",", "[", "]", ",", "[", "]", "from", "concurrent", ".", "futures", "import", "Future", ",", "wait", "as", "wait_fut", ...
Set all asynchronous results. :param timeout: The number of seconds to wait for the result if the futures aren't done. If None, then there is no limit on the wait time. :type timeout: float :return: Update Solution. :rtype: Solution
[ "Set", "all", "asynchronous", "results", "." ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/sol.py#L194-L245
train
Set all asynchronous results.
vinci1it2000/schedula
schedula/utils/sol.py
Solution.get_sub_dsp_from_workflow
def get_sub_dsp_from_workflow(self, sources, reverse=False, add_missing=False, check_inputs=True): """ Returns the sub-dispatcher induced by the workflow from sources. The induced sub-dispatcher of the dsp contains the reachable nodes and edges evaluate...
python
def get_sub_dsp_from_workflow(self, sources, reverse=False, add_missing=False, check_inputs=True): """ Returns the sub-dispatcher induced by the workflow from sources. The induced sub-dispatcher of the dsp contains the reachable nodes and edges evaluate...
[ "def", "get_sub_dsp_from_workflow", "(", "self", ",", "sources", ",", "reverse", "=", "False", ",", "add_missing", "=", "False", ",", "check_inputs", "=", "True", ")", ":", "sub_dsp", "=", "self", ".", "dsp", ".", "get_sub_dsp_from_workflow", "(", "sources", ...
Returns the sub-dispatcher induced by the workflow from sources. The induced sub-dispatcher of the dsp contains the reachable nodes and edges evaluated with breadth-first-search on the workflow graph from source nodes. :param sources: Source nodes for the breadth-first-searc...
[ "Returns", "the", "sub", "-", "dispatcher", "induced", "by", "the", "workflow", "from", "sources", "." ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/sol.py#L305-L340
train
Returns the sub - dispatcher induced by the workflow from sources.
vinci1it2000/schedula
schedula/utils/sol.py
Solution._check_targets
def _check_targets(self): """ Returns a function to terminate the ArciDispatch algorithm when all targets have been visited. :return: A function to terminate the ArciDispatch algorithm. :rtype: (str) -> bool """ if self.outputs: targets ...
python
def _check_targets(self): """ Returns a function to terminate the ArciDispatch algorithm when all targets have been visited. :return: A function to terminate the ArciDispatch algorithm. :rtype: (str) -> bool """ if self.outputs: targets ...
[ "def", "_check_targets", "(", "self", ")", ":", "if", "self", ".", "outputs", ":", "targets", "=", "self", ".", "outputs", ".", "copy", "(", ")", "# Namespace shortcut for speed.", "def", "check_targets", "(", "node_id", ")", ":", "\"\"\"\n Termin...
Returns a function to terminate the ArciDispatch algorithm when all targets have been visited. :return: A function to terminate the ArciDispatch algorithm. :rtype: (str) -> bool
[ "Returns", "a", "function", "to", "terminate", "the", "ArciDispatch", "algorithm", "when", "all", "targets", "have", "been", "visited", "." ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/sol.py#L375-L413
train
Returns a function to terminate the ArciDispatch algorithm when all targets have been visited.
vinci1it2000/schedula
schedula/utils/sol.py
Solution._check_cutoff
def _check_cutoff(self): """ Returns a function to stop the search of the investigated node of the ArciDispatch algorithm. :return: A function to stop the search. :rtype: (int | float) -> bool """ if self.cutoff is not None: cutoff = sel...
python
def _check_cutoff(self): """ Returns a function to stop the search of the investigated node of the ArciDispatch algorithm. :return: A function to stop the search. :rtype: (int | float) -> bool """ if self.cutoff is not None: cutoff = sel...
[ "def", "_check_cutoff", "(", "self", ")", ":", "if", "self", ".", "cutoff", "is", "not", "None", ":", "cutoff", "=", "self", ".", "cutoff", "# Namespace shortcut for speed.", "def", "check_cutoff", "(", "distance", ")", ":", "\"\"\"\n Stops the sear...
Returns a function to stop the search of the investigated node of the ArciDispatch algorithm. :return: A function to stop the search. :rtype: (int | float) -> bool
[ "Returns", "a", "function", "to", "stop", "the", "search", "of", "the", "investigated", "node", "of", "the", "ArciDispatch", "algorithm", "." ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/sol.py#L415-L450
train
Returns a function to stop the search of the investigated node of the ArciDispatch algorithm.
vinci1it2000/schedula
schedula/utils/sol.py
Solution._check_wait_input_flag
def _check_wait_input_flag(self): """ Returns a function to stop the search of the investigated node of the ArciDispatch algorithm. :return: A function to stop the search. :rtype: (bool, str) -> bool """ wf_pred = self._wf_pred # Namespace shortcuts...
python
def _check_wait_input_flag(self): """ Returns a function to stop the search of the investigated node of the ArciDispatch algorithm. :return: A function to stop the search. :rtype: (bool, str) -> bool """ wf_pred = self._wf_pred # Namespace shortcuts...
[ "def", "_check_wait_input_flag", "(", "self", ")", ":", "wf_pred", "=", "self", ".", "_wf_pred", "# Namespace shortcuts.", "pred", "=", "{", "k", ":", "set", "(", "v", ")", ".", "issubset", "for", "k", ",", "v", "in", "self", ".", "_pred", ".", "items"...
Returns a function to stop the search of the investigated node of the ArciDispatch algorithm. :return: A function to stop the search. :rtype: (bool, str) -> bool
[ "Returns", "a", "function", "to", "stop", "the", "search", "of", "the", "investigated", "node", "of", "the", "ArciDispatch", "algorithm", "." ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/sol.py#L452-L496
train
Returns a function to stop the search of the investigated node of the ArciDispatch algorithm.
vinci1it2000/schedula
schedula/utils/sol.py
Solution._get_node_estimations
def _get_node_estimations(self, node_attr, node_id): """ Returns the data nodes estimations and `wait_inputs` flag. :param node_attr: Dictionary of node attributes. :type node_attr: dict :param node_id: Data node's id. :type node_id: str ...
python
def _get_node_estimations(self, node_attr, node_id): """ Returns the data nodes estimations and `wait_inputs` flag. :param node_attr: Dictionary of node attributes. :type node_attr: dict :param node_id: Data node's id. :type node_id: str ...
[ "def", "_get_node_estimations", "(", "self", ",", "node_attr", ",", "node_id", ")", ":", "# Get data node estimations.", "estimations", "=", "self", ".", "_wf_pred", "[", "node_id", "]", "wait_in", "=", "node_attr", "[", "'wait_inputs'", "]", "# Namespace shortcut."...
Returns the data nodes estimations and `wait_inputs` flag. :param node_attr: Dictionary of node attributes. :type node_attr: dict :param node_id: Data node's id. :type node_id: str :returns: - node estimations with minimum distance from the...
[ "Returns", "the", "data", "nodes", "estimations", "and", "wait_inputs", "flag", "." ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/sol.py#L498-L540
train
Get the data node estimations and wait_inputs flag.
vinci1it2000/schedula
schedula/utils/sol.py
Solution._set_node_output
def _set_node_output(self, node_id, no_call, next_nds=None, **kw): """ Set the node outputs from node inputs. :param node_id: Data or function node id. :type node_id: str :param no_call: If True data node estimation function is not used. :type no...
python
def _set_node_output(self, node_id, no_call, next_nds=None, **kw): """ Set the node outputs from node inputs. :param node_id: Data or function node id. :type node_id: str :param no_call: If True data node estimation function is not used. :type no...
[ "def", "_set_node_output", "(", "self", ",", "node_id", ",", "no_call", ",", "next_nds", "=", "None", ",", "*", "*", "kw", ")", ":", "# Namespace shortcuts.", "node_attr", "=", "self", ".", "nodes", "[", "node_id", "]", "node_type", "=", "node_attr", "[", ...
Set the node outputs from node inputs. :param node_id: Data or function node id. :type node_id: str :param no_call: If True data node estimation function is not used. :type no_call: bool :return: If the output have been evaluated correctly. ...
[ "Set", "the", "node", "outputs", "from", "node", "inputs", "." ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/sol.py#L554-L581
train
Set the node outputs from node inputs.