repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
CI-WATER/gsshapy | gsshapy/lib/cif_chunk.py | linkChunk | def linkChunk(key, chunk):
"""
Parse LINK Chunk Method
"""
# Extract link type card
linkType = chunk[1].strip().split()[0]
# Cases
if linkType == 'DX':
# Cross section link type handler
result = xSectionLink(chunk)
elif linkType == 'STRUCTURE':
# Structure link ... | python | def linkChunk(key, chunk):
"""
Parse LINK Chunk Method
"""
# Extract link type card
linkType = chunk[1].strip().split()[0]
# Cases
if linkType == 'DX':
# Cross section link type handler
result = xSectionLink(chunk)
elif linkType == 'STRUCTURE':
# Structure link ... | [
"def",
"linkChunk",
"(",
"key",
",",
"chunk",
")",
":",
"# Extract link type card",
"linkType",
"=",
"chunk",
"[",
"1",
"]",
".",
"strip",
"(",
")",
".",
"split",
"(",
")",
"[",
"0",
"]",
"# Cases",
"if",
"linkType",
"==",
"'DX'",
":",
"# Cross section... | Parse LINK Chunk Method | [
"Parse",
"LINK",
"Chunk",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/lib/cif_chunk.py#L45-L64 | train |
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 |
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 |
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 |
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 |
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 |
CI-WATER/gsshapy | gsshapy/lib/cif_chunk.py | structureChunk | def structureChunk(keywords, resultDict, lines):
"""
Parse Weir and Culvert Structures Method
"""
chunks = pt.chunk(keywords, lines)
# Parse chunks associated with each key
for key, chunkList in iteritems(chunks):
# Parse each chunk in the chunk list
for chunk in chunkList:
... | python | def structureChunk(keywords, resultDict, lines):
"""
Parse Weir and Culvert Structures Method
"""
chunks = pt.chunk(keywords, lines)
# Parse chunks associated with each key
for key, chunkList in iteritems(chunks):
# Parse each chunk in the chunk list
for chunk in chunkList:
... | [
"def",
"structureChunk",
"(",
"keywords",
",",
"resultDict",
",",
"lines",
")",
":",
"chunks",
"=",
"pt",
".",
"chunk",
"(",
"keywords",
",",
"lines",
")",
"# Parse chunks associated with each key",
"for",
"key",
",",
"chunkList",
"in",
"iteritems",
"(",
"chun... | Parse Weir and Culvert Structures Method | [
"Parse",
"Weir",
"and",
"Culvert",
"Structures",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/lib/cif_chunk.py#L429-L445 | train |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
vinci1it2000/schedula | schedula/utils/sol.py | Solution._set_data_node_output | def _set_data_node_output(self, node_id, node_attr, no_call, next_nds=None,
**kw):
"""
Set the data node output from node estimations.
:param node_id:
Data node id.
:type node_id: str
:param node_attr:
Dictionary of node att... | python | def _set_data_node_output(self, node_id, node_attr, no_call, next_nds=None,
**kw):
"""
Set the data node output from node estimations.
:param node_id:
Data node id.
:type node_id: str
:param node_attr:
Dictionary of node att... | [
"def",
"_set_data_node_output",
"(",
"self",
",",
"node_id",
",",
"node_attr",
",",
"no_call",
",",
"next_nds",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"# Get data node estimations.",
"est",
",",
"wait_in",
"=",
"self",
".",
"_get_node_estimations",
"(",
... | Set the data node output from node estimations.
:param node_id:
Data node id.
:type node_id: str
:param node_attr:
Dictionary of node attributes.
:type node_attr: dict[str, T]
:param no_call:
If True data node estimations are not used.
... | [
"Set",
"the",
"data",
"node",
"output",
"from",
"node",
"estimations",
"."
] | addb9fd685be81544b796c51383ac00a31543ce9 | https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/sol.py#L642-L721 | train |
vinci1it2000/schedula | schedula/utils/sol.py | Solution._set_function_node_output | def _set_function_node_output(self, node_id, node_attr, no_call,
next_nds=None, **kw):
"""
Set the function node output from node inputs.
:param node_id:
Function node id.
:type node_id: str
:param node_attr:
Dictionary ... | python | def _set_function_node_output(self, node_id, node_attr, no_call,
next_nds=None, **kw):
"""
Set the function node output from node inputs.
:param node_id:
Function node id.
:type node_id: str
:param node_attr:
Dictionary ... | [
"def",
"_set_function_node_output",
"(",
"self",
",",
"node_id",
",",
"node_attr",
",",
"no_call",
",",
"next_nds",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"# Namespace shortcuts for speed.",
"o_nds",
",",
"dist",
"=",
"node_attr",
"[",
"'outputs'",
"]",
... | Set the function node output from node inputs.
:param node_id:
Function node id.
:type node_id: str
:param node_attr:
Dictionary of node attributes.
:type node_attr: dict[str, T]
:param no_call:
If True data node estimation function is not u... | [
"Set",
"the",
"function",
"node",
"output",
"from",
"node",
"inputs",
"."
] | addb9fd685be81544b796c51383ac00a31543ce9 | https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/sol.py#L743-L798 | train |
vinci1it2000/schedula | schedula/utils/sol.py | Solution._add_initial_value | def _add_initial_value(self, data_id, value, initial_dist=0.0,
fringe=None, check_cutoff=None, no_call=None):
"""
Add initial values updating workflow, seen, and fringe.
:param fringe:
Heapq of closest available nodes.
:type fringe: list[(float | i... | python | def _add_initial_value(self, data_id, value, initial_dist=0.0,
fringe=None, check_cutoff=None, no_call=None):
"""
Add initial values updating workflow, seen, and fringe.
:param fringe:
Heapq of closest available nodes.
:type fringe: list[(float | i... | [
"def",
"_add_initial_value",
"(",
"self",
",",
"data_id",
",",
"value",
",",
"initial_dist",
"=",
"0.0",
",",
"fringe",
"=",
"None",
",",
"check_cutoff",
"=",
"None",
",",
"no_call",
"=",
"None",
")",
":",
"# Namespace shortcuts for speed.",
"nodes",
",",
"s... | Add initial values updating workflow, seen, and fringe.
:param fringe:
Heapq of closest available nodes.
:type fringe: list[(float | int, bool, (str, Dispatcher)]
:param check_cutoff:
Check the cutoff limit.
:type check_cutoff: (int | float) -> bool
:pa... | [
"Add",
"initial",
"values",
"updating",
"workflow",
"seen",
"and",
"fringe",
"."
] | addb9fd685be81544b796c51383ac00a31543ce9 | https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/sol.py#L800-L903 | train |
vinci1it2000/schedula | schedula/utils/sol.py | Solution._visit_nodes | def _visit_nodes(self, node_id, dist, fringe, check_cutoff, no_call=False,
**kw):
"""
Visits a node, updating workflow, seen, and fringe..
:param node_id:
Node id to visit.
:type node_id: str
:param dist:
Distance from the starting n... | python | def _visit_nodes(self, node_id, dist, fringe, check_cutoff, no_call=False,
**kw):
"""
Visits a node, updating workflow, seen, and fringe..
:param node_id:
Node id to visit.
:type node_id: str
:param dist:
Distance from the starting n... | [
"def",
"_visit_nodes",
"(",
"self",
",",
"node_id",
",",
"dist",
",",
"fringe",
",",
"check_cutoff",
",",
"no_call",
"=",
"False",
",",
"*",
"*",
"kw",
")",
":",
"# Namespace shortcuts.",
"wf_rm_edge",
",",
"wf_has_edge",
"=",
"self",
".",
"_wf_remove_edge",... | Visits a node, updating workflow, seen, and fringe..
:param node_id:
Node id to visit.
:type node_id: str
:param dist:
Distance from the starting node.
:type dist: float, int
:param fringe:
Heapq of closest available nodes.
:type fri... | [
"Visits",
"a",
"node",
"updating",
"workflow",
"seen",
"and",
"fringe",
".."
] | addb9fd685be81544b796c51383ac00a31543ce9 | https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/sol.py#L912-L976 | train |
vinci1it2000/schedula | schedula/utils/sol.py | Solution._see_node | def _see_node(self, node_id, fringe, dist, w_wait_in=0):
"""
See a node, updating seen and fringe.
:param node_id:
Node id to see.
:type node_id: str
:param fringe:
Heapq of closest available nodes.
:type fringe: list[(float | int, bool, (str, Di... | python | def _see_node(self, node_id, fringe, dist, w_wait_in=0):
"""
See a node, updating seen and fringe.
:param node_id:
Node id to see.
:type node_id: str
:param fringe:
Heapq of closest available nodes.
:type fringe: list[(float | int, bool, (str, Di... | [
"def",
"_see_node",
"(",
"self",
",",
"node_id",
",",
"fringe",
",",
"dist",
",",
"w_wait_in",
"=",
"0",
")",
":",
"# Namespace shortcuts.",
"seen",
",",
"dists",
"=",
"self",
".",
"seen",
",",
"self",
".",
"dist",
"wait_in",
"=",
"self",
".",
"nodes",... | See a node, updating seen and fringe.
:param node_id:
Node id to see.
:type node_id: str
:param fringe:
Heapq of closest available nodes.
:type fringe: list[(float | int, bool, (str, Dispatcher)]
:param dist:
Distance from the starting node.... | [
"See",
"a",
"node",
"updating",
"seen",
"and",
"fringe",
"."
] | addb9fd685be81544b796c51383ac00a31543ce9 | https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/sol.py#L978-L1030 | train |
vinci1it2000/schedula | schedula/utils/sol.py | Solution._remove_unused_nodes | def _remove_unused_nodes(self):
"""
Removes unused function and sub-dispatcher nodes.
"""
# Namespace shortcuts.
nodes, wf_remove_node = self.nodes, self.workflow.remove_node
add_visited, succ = self._visited.add, self.workflow.succ
# Remove unused function and ... | python | def _remove_unused_nodes(self):
"""
Removes unused function and sub-dispatcher nodes.
"""
# Namespace shortcuts.
nodes, wf_remove_node = self.nodes, self.workflow.remove_node
add_visited, succ = self._visited.add, self.workflow.succ
# Remove unused function and ... | [
"def",
"_remove_unused_nodes",
"(",
"self",
")",
":",
"# Namespace shortcuts.",
"nodes",
",",
"wf_remove_node",
"=",
"self",
".",
"nodes",
",",
"self",
".",
"workflow",
".",
"remove_node",
"add_visited",
",",
"succ",
"=",
"self",
".",
"_visited",
".",
"add",
... | Removes unused function and sub-dispatcher nodes. | [
"Removes",
"unused",
"function",
"and",
"sub",
"-",
"dispatcher",
"nodes",
"."
] | addb9fd685be81544b796c51383ac00a31543ce9 | https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/sol.py#L1032-L1054 | train |
vinci1it2000/schedula | schedula/utils/sol.py | Solution._init_sub_dsp | def _init_sub_dsp(self, dsp, fringe, outputs, no_call, initial_dist, index,
full_name):
"""
Initialize the dispatcher as sub-dispatcher and update the fringe.
:param fringe:
Heapq of closest available nodes.
:type fringe: list[(float | int, bool, (str, ... | python | def _init_sub_dsp(self, dsp, fringe, outputs, no_call, initial_dist, index,
full_name):
"""
Initialize the dispatcher as sub-dispatcher and update the fringe.
:param fringe:
Heapq of closest available nodes.
:type fringe: list[(float | int, bool, (str, ... | [
"def",
"_init_sub_dsp",
"(",
"self",
",",
"dsp",
",",
"fringe",
",",
"outputs",
",",
"no_call",
",",
"initial_dist",
",",
"index",
",",
"full_name",
")",
":",
"# Initialize as sub-dispatcher.",
"sol",
"=",
"self",
".",
"__class__",
"(",
"dsp",
",",
"{",
"}... | Initialize the dispatcher as sub-dispatcher and update the fringe.
:param fringe:
Heapq of closest available nodes.
:type fringe: list[(float | int, bool, (str, Dispatcher)]
:param outputs:
Ending data nodes.
:type outputs: list[str], iterable
:param no... | [
"Initialize",
"the",
"dispatcher",
"as",
"sub",
"-",
"dispatcher",
"and",
"update",
"the",
"fringe",
"."
] | addb9fd685be81544b796c51383ac00a31543ce9 | https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/sol.py#L1056-L1087 | train |
vinci1it2000/schedula | schedula/utils/sol.py | Solution._set_sub_dsp_node_input | def _set_sub_dsp_node_input(self, node_id, dsp_id, fringe, check_cutoff,
no_call, initial_dist):
"""
Initializes the sub-dispatcher and set its inputs.
:param node_id:
Input node to set.
:type node_id: str
:param dsp_id:
S... | python | def _set_sub_dsp_node_input(self, node_id, dsp_id, fringe, check_cutoff,
no_call, initial_dist):
"""
Initializes the sub-dispatcher and set its inputs.
:param node_id:
Input node to set.
:type node_id: str
:param dsp_id:
S... | [
"def",
"_set_sub_dsp_node_input",
"(",
"self",
",",
"node_id",
",",
"dsp_id",
",",
"fringe",
",",
"check_cutoff",
",",
"no_call",
",",
"initial_dist",
")",
":",
"# Namespace shortcuts.",
"node",
"=",
"self",
".",
"nodes",
"[",
"dsp_id",
"]",
"dsp",
",",
"pre... | Initializes the sub-dispatcher and set its inputs.
:param node_id:
Input node to set.
:type node_id: str
:param dsp_id:
Sub-dispatcher node id.
:type dsp_id: str
:param fringe:
Heapq of closest available nodes.
:type fringe: list[(fl... | [
"Initializes",
"the",
"sub",
"-",
"dispatcher",
"and",
"set",
"its",
"inputs",
"."
] | addb9fd685be81544b796c51383ac00a31543ce9 | https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/sol.py#L1142-L1218 | train |
vinci1it2000/schedula | schedula/utils/sol.py | Solution._warning | def _warning(self, msg, node_id, ex, *args, **kwargs):
"""
Handles the error messages.
.. note:: If `self.raises` is True the dispatcher interrupt the dispatch
when an error occur, otherwise it logs a warning.
"""
raises = self.raises(ex) if callable(self.raises) els... | python | def _warning(self, msg, node_id, ex, *args, **kwargs):
"""
Handles the error messages.
.. note:: If `self.raises` is True the dispatcher interrupt the dispatch
when an error occur, otherwise it logs a warning.
"""
raises = self.raises(ex) if callable(self.raises) els... | [
"def",
"_warning",
"(",
"self",
",",
"msg",
",",
"node_id",
",",
"ex",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"raises",
"=",
"self",
".",
"raises",
"(",
"ex",
")",
"if",
"callable",
"(",
"self",
".",
"raises",
")",
"else",
"self",
... | Handles the error messages.
.. note:: If `self.raises` is True the dispatcher interrupt the dispatch
when an error occur, otherwise it logs a warning. | [
"Handles",
"the",
"error",
"messages",
"."
] | addb9fd685be81544b796c51383ac00a31543ce9 | https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/sol.py#L1220-L1241 | train |
CI-WATER/gsshapy | gsshapy/orm/gst.py | GridStreamFile._read | def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile):
"""
Grid Stream File Read from File Method
"""
# Set file extension property
self.fileExtension = extension
# Keywords
KEYWORDS = ('STREAMCELLS',
... | python | def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile):
"""
Grid Stream File Read from File Method
"""
# Set file extension property
self.fileExtension = extension
# Keywords
KEYWORDS = ('STREAMCELLS',
... | [
"def",
"_read",
"(",
"self",
",",
"directory",
",",
"filename",
",",
"session",
",",
"path",
",",
"name",
",",
"extension",
",",
"spatial",
",",
"spatialReferenceID",
",",
"replaceParamFile",
")",
":",
"# Set file extension property",
"self",
".",
"fileExtension... | Grid Stream File Read from File Method | [
"Grid",
"Stream",
"File",
"Read",
"from",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/gst.py#L60-L92 | train |
CI-WATER/gsshapy | gsshapy/orm/gst.py | GridStreamFile._write | def _write(self, session, openFile, replaceParamFile):
"""
Grid Stream File Write to File Method
"""
# Write lines
openFile.write('GRIDSTREAMFILE\n')
openFile.write('STREAMCELLS %s\n' % self.streamCells)
for cell in self.gridStreamCells:
openFile.writ... | python | def _write(self, session, openFile, replaceParamFile):
"""
Grid Stream File Write to File Method
"""
# Write lines
openFile.write('GRIDSTREAMFILE\n')
openFile.write('STREAMCELLS %s\n' % self.streamCells)
for cell in self.gridStreamCells:
openFile.writ... | [
"def",
"_write",
"(",
"self",
",",
"session",
",",
"openFile",
",",
"replaceParamFile",
")",
":",
"# Write lines",
"openFile",
".",
"write",
"(",
"'GRIDSTREAMFILE\\n'",
")",
"openFile",
".",
"write",
"(",
"'STREAMCELLS %s\\n'",
"%",
"self",
".",
"streamCells",
... | Grid Stream File Write to File Method | [
"Grid",
"Stream",
"File",
"Write",
"to",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/gst.py#L95-L111 | train |
CI-WATER/gsshapy | gsshapy/orm/gst.py | GridStreamFile._createGsshaPyObjects | def _createGsshaPyObjects(self, cell):
"""
Create GSSHAPY PipeGridCell and PipeGridNode Objects Method
"""
# Initialize GSSHAPY PipeGridCell object
gridCell = GridStreamCell(cellI=cell['i'],
cellJ=cell['j'],
numN... | python | def _createGsshaPyObjects(self, cell):
"""
Create GSSHAPY PipeGridCell and PipeGridNode Objects Method
"""
# Initialize GSSHAPY PipeGridCell object
gridCell = GridStreamCell(cellI=cell['i'],
cellJ=cell['j'],
numN... | [
"def",
"_createGsshaPyObjects",
"(",
"self",
",",
"cell",
")",
":",
"# Initialize GSSHAPY PipeGridCell object",
"gridCell",
"=",
"GridStreamCell",
"(",
"cellI",
"=",
"cell",
"[",
"'i'",
"]",
",",
"cellJ",
"=",
"cell",
"[",
"'j'",
"]",
",",
"numNodes",
"=",
"... | Create GSSHAPY PipeGridCell and PipeGridNode Objects Method | [
"Create",
"GSSHAPY",
"PipeGridCell",
"and",
"PipeGridNode",
"Objects",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/gst.py#L113-L132 | train |
CI-WATER/gsshapy | gsshapy/orm/idx.py | IndexMap._read | def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile):
"""
Index Map Read from File Method
"""
# Set file extension property
self.fileExtension = extension
# Open file and read plain text into text field
... | python | def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile):
"""
Index Map Read from File Method
"""
# Set file extension property
self.fileExtension = extension
# Open file and read plain text into text field
... | [
"def",
"_read",
"(",
"self",
",",
"directory",
",",
"filename",
",",
"session",
",",
"path",
",",
"name",
",",
"extension",
",",
"spatial",
",",
"spatialReferenceID",
",",
"replaceParamFile",
")",
":",
"# Set file extension property",
"self",
".",
"fileExtension... | Index Map Read from File Method | [
"Index",
"Map",
"Read",
"from",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/idx.py#L96-L135 | train |
CI-WATER/gsshapy | gsshapy/orm/idx.py | IndexMap.write | def write(self, directory, name=None, session=None, replaceParamFile=None):
"""
Index Map Write to File Method
"""
# Initiate file
if name != None:
filename = '%s.%s' % (name, self.fileExtension)
filePath = os.path.join(directory, filename)
else:
... | python | def write(self, directory, name=None, session=None, replaceParamFile=None):
"""
Index Map Write to File Method
"""
# Initiate file
if name != None:
filename = '%s.%s' % (name, self.fileExtension)
filePath = os.path.join(directory, filename)
else:
... | [
"def",
"write",
"(",
"self",
",",
"directory",
",",
"name",
"=",
"None",
",",
"session",
"=",
"None",
",",
"replaceParamFile",
"=",
"None",
")",
":",
"# Initiate file",
"if",
"name",
"!=",
"None",
":",
"filename",
"=",
"'%s.%s'",
"%",
"(",
"name",
",",... | Index Map Write to File Method | [
"Index",
"Map",
"Write",
"to",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/idx.py#L137-L168 | train |
CI-WATER/gsshapy | gsshapy/orm/gpi.py | GridPipeFile._write | def _write(self, session, openFile, replaceParamFile):
"""
Grid Pipe File Write to File Method
"""
# Write Lines
openFile.write('GRIDPIPEFILE\n')
openFile.write('PIPECELLS %s\n' % self.pipeCells)
for cell in self.gridPipeCells:
openFile.write('CELLIJ ... | python | def _write(self, session, openFile, replaceParamFile):
"""
Grid Pipe File Write to File Method
"""
# Write Lines
openFile.write('GRIDPIPEFILE\n')
openFile.write('PIPECELLS %s\n' % self.pipeCells)
for cell in self.gridPipeCells:
openFile.write('CELLIJ ... | [
"def",
"_write",
"(",
"self",
",",
"session",
",",
"openFile",
",",
"replaceParamFile",
")",
":",
"# Write Lines",
"openFile",
".",
"write",
"(",
"'GRIDPIPEFILE\\n'",
")",
"openFile",
".",
"write",
"(",
"'PIPECELLS %s\\n'",
"%",
"self",
".",
"pipeCells",
")",
... | Grid Pipe File Write to File Method | [
"Grid",
"Pipe",
"File",
"Write",
"to",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/gpi.py#L94-L110 | train |
CI-WATER/gsshapy | gsshapy/orm/gpi.py | GridPipeFile._createGsshaPyObjects | def _createGsshaPyObjects(self, cell):
"""
Create GSSHAPY GridPipeCell and GridPipeNode Objects Method
"""
# Initialize GSSHAPY GridPipeCell object
gridCell = GridPipeCell(cellI=cell['i'],
cellJ=cell['j'],
numPipes=c... | python | def _createGsshaPyObjects(self, cell):
"""
Create GSSHAPY GridPipeCell and GridPipeNode Objects Method
"""
# Initialize GSSHAPY GridPipeCell object
gridCell = GridPipeCell(cellI=cell['i'],
cellJ=cell['j'],
numPipes=c... | [
"def",
"_createGsshaPyObjects",
"(",
"self",
",",
"cell",
")",
":",
"# Initialize GSSHAPY GridPipeCell object",
"gridCell",
"=",
"GridPipeCell",
"(",
"cellI",
"=",
"cell",
"[",
"'i'",
"]",
",",
"cellJ",
"=",
"cell",
"[",
"'j'",
"]",
",",
"numPipes",
"=",
"ce... | Create GSSHAPY GridPipeCell and GridPipeNode Objects Method | [
"Create",
"GSSHAPY",
"GridPipeCell",
"and",
"GridPipeNode",
"Objects",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/gpi.py#L112-L131 | train |
CI-WATER/gsshapy | gsshapy/orm/gpi.py | GridPipeFile._cellChunk | def _cellChunk(self, lines):
"""
Parse CELLIJ Chunk Method
"""
KEYWORDS = ('CELLIJ',
'NUMPIPES',
'SPIPE')
result = {'i': None,
'j': None,
'numPipes': None,
'spipes': []}
chunks... | python | def _cellChunk(self, lines):
"""
Parse CELLIJ Chunk Method
"""
KEYWORDS = ('CELLIJ',
'NUMPIPES',
'SPIPE')
result = {'i': None,
'j': None,
'numPipes': None,
'spipes': []}
chunks... | [
"def",
"_cellChunk",
"(",
"self",
",",
"lines",
")",
":",
"KEYWORDS",
"=",
"(",
"'CELLIJ'",
",",
"'NUMPIPES'",
",",
"'SPIPE'",
")",
"result",
"=",
"{",
"'i'",
":",
"None",
",",
"'j'",
":",
"None",
",",
"'numPipes'",
":",
"None",
",",
"'spipes'",
":",... | Parse CELLIJ Chunk Method | [
"Parse",
"CELLIJ",
"Chunk",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/gpi.py#L133-L172 | train |
CI-WATER/gsshapy | gsshapy/orm/rep.py | ReplaceParamFile._read | def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile):
"""
Replace Param 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):
"""
Replace Param 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... | Replace Param File Read from File Method | [
"Replace",
"Param",
"File",
"Read",
"from",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/rep.py#L55-L74 | train |
CI-WATER/gsshapy | gsshapy/orm/rep.py | ReplaceParamFile._write | def _write(self, session, openFile, replaceParamFile):
"""
Replace Param File Write to File Method
"""
# Retrieve TargetParameter objects
targets = self.targetParameters
# Write lines
openFile.write('%s\n' % self.numParameters)
for target in targets:
... | python | def _write(self, session, openFile, replaceParamFile):
"""
Replace Param File Write to File Method
"""
# Retrieve TargetParameter objects
targets = self.targetParameters
# Write lines
openFile.write('%s\n' % self.numParameters)
for target in targets:
... | [
"def",
"_write",
"(",
"self",
",",
"session",
",",
"openFile",
",",
"replaceParamFile",
")",
":",
"# Retrieve TargetParameter objects",
"targets",
"=",
"self",
".",
"targetParameters",
"# Write lines",
"openFile",
".",
"write",
"(",
"'%s\\n'",
"%",
"self",
".",
... | Replace Param File Write to File Method | [
"Replace",
"Param",
"File",
"Write",
"to",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/rep.py#L76-L87 | train |
CI-WATER/gsshapy | gsshapy/orm/rep.py | ReplaceValFile._read | def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile):
"""
Replace Val 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):
"""
Replace Val 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... | Replace Val File Read from File Method | [
"Replace",
"Val",
"File",
"Read",
"from",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/rep.py#L147-L159 | train |
CI-WATER/gsshapy | gsshapy/orm/rep.py | ReplaceValFile._write | def _write(self, session, openFile, replaceParamFile):
"""
Replace Val File Write to File Method
"""
# Write lines
for line in self.lines:
openFile.write(line.contents) | python | def _write(self, session, openFile, replaceParamFile):
"""
Replace Val File Write to File Method
"""
# Write lines
for line in self.lines:
openFile.write(line.contents) | [
"def",
"_write",
"(",
"self",
",",
"session",
",",
"openFile",
",",
"replaceParamFile",
")",
":",
"# Write lines",
"for",
"line",
"in",
"self",
".",
"lines",
":",
"openFile",
".",
"write",
"(",
"line",
".",
"contents",
")"
] | Replace Val File Write to File Method | [
"Replace",
"Val",
"File",
"Write",
"to",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/rep.py#L161-L167 | train |
bayesimpact/fex | fex/feature_extractor.py | FeatureExtractor.emit | def emit(self, data_frame):
"""Use this function in emit data into the store.
:param data_frame: DataFrame to be recorded.
"""
if self.result is not None:
raise MultipleEmitsError()
data_frame.columns = [self.prefix + '__' + c
for c in d... | python | def emit(self, data_frame):
"""Use this function in emit data into the store.
:param data_frame: DataFrame to be recorded.
"""
if self.result is not None:
raise MultipleEmitsError()
data_frame.columns = [self.prefix + '__' + c
for c in d... | [
"def",
"emit",
"(",
"self",
",",
"data_frame",
")",
":",
"if",
"self",
".",
"result",
"is",
"not",
"None",
":",
"raise",
"MultipleEmitsError",
"(",
")",
"data_frame",
".",
"columns",
"=",
"[",
"self",
".",
"prefix",
"+",
"'__'",
"+",
"c",
"for",
"c",... | Use this function in emit data into the store.
:param data_frame: DataFrame to be recorded. | [
"Use",
"this",
"function",
"in",
"emit",
"data",
"into",
"the",
"store",
"."
] | 2d9b4e9be2bf98847a36055b907411fd5557eb77 | https://github.com/bayesimpact/fex/blob/2d9b4e9be2bf98847a36055b907411fd5557eb77/fex/feature_extractor.py#L41-L50 | train |
tjvr/skip | skip/__init__.py | Interpreter.trigger_hats | def trigger_hats(self, command, arg=None, callback=None):
"""Returns a list with each script that is triggered."""
threads = []
for scriptable in [self.project.stage] + self.project.sprites:
threads += self.trigger_scriptable_hats(scriptable, command, arg,
... | python | def trigger_hats(self, command, arg=None, callback=None):
"""Returns a list with each script that is triggered."""
threads = []
for scriptable in [self.project.stage] + self.project.sprites:
threads += self.trigger_scriptable_hats(scriptable, command, arg,
... | [
"def",
"trigger_hats",
"(",
"self",
",",
"command",
",",
"arg",
"=",
"None",
",",
"callback",
"=",
"None",
")",
":",
"threads",
"=",
"[",
"]",
"for",
"scriptable",
"in",
"[",
"self",
".",
"project",
".",
"stage",
"]",
"+",
"self",
".",
"project",
"... | Returns a list with each script that is triggered. | [
"Returns",
"a",
"list",
"with",
"each",
"script",
"that",
"is",
"triggered",
"."
] | ac84f7198079732bf22c3b8cbc0dc1a073b1d539 | https://github.com/tjvr/skip/blob/ac84f7198079732bf22c3b8cbc0dc1a073b1d539/skip/__init__.py#L115-L121 | train |
tjvr/skip | skip/__init__.py | Interpreter.push_script | def push_script(self, scriptable, script, callback=None):
"""Run the script and add it to the list of threads."""
if script in self.threads:
self.threads[script].finish()
thread = Thread(self.run_script(scriptable, script),
scriptable, callback)
... | python | def push_script(self, scriptable, script, callback=None):
"""Run the script and add it to the list of threads."""
if script in self.threads:
self.threads[script].finish()
thread = Thread(self.run_script(scriptable, script),
scriptable, callback)
... | [
"def",
"push_script",
"(",
"self",
",",
"scriptable",
",",
"script",
",",
"callback",
"=",
"None",
")",
":",
"if",
"script",
"in",
"self",
".",
"threads",
":",
"self",
".",
"threads",
"[",
"script",
"]",
".",
"finish",
"(",
")",
"thread",
"=",
"Threa... | Run the script and add it to the list of threads. | [
"Run",
"the",
"script",
"and",
"add",
"it",
"to",
"the",
"list",
"of",
"threads",
"."
] | ac84f7198079732bf22c3b8cbc0dc1a073b1d539 | https://github.com/tjvr/skip/blob/ac84f7198079732bf22c3b8cbc0dc1a073b1d539/skip/__init__.py#L134-L141 | train |
tjvr/skip | skip/__init__.py | Interpreter.tick | def tick(self, events):
"""Execute one frame of the interpreter.
Don't call more than 40 times per second.
"""
self.add_new_threads()
if self.drag_sprite:
(mx, my) = self.screen.get_mouse_pos()
(ox, oy) = self.drag_offset
new_position = (mx ... | python | def tick(self, events):
"""Execute one frame of the interpreter.
Don't call more than 40 times per second.
"""
self.add_new_threads()
if self.drag_sprite:
(mx, my) = self.screen.get_mouse_pos()
(ox, oy) = self.drag_offset
new_position = (mx ... | [
"def",
"tick",
"(",
"self",
",",
"events",
")",
":",
"self",
".",
"add_new_threads",
"(",
")",
"if",
"self",
".",
"drag_sprite",
":",
"(",
"mx",
",",
"my",
")",
"=",
"self",
".",
"screen",
".",
"get_mouse_pos",
"(",
")",
"(",
"ox",
",",
"oy",
")"... | Execute one frame of the interpreter.
Don't call more than 40 times per second. | [
"Execute",
"one",
"frame",
"of",
"the",
"interpreter",
"."
] | ac84f7198079732bf22c3b8cbc0dc1a073b1d539 | https://github.com/tjvr/skip/blob/ac84f7198079732bf22c3b8cbc0dc1a073b1d539/skip/__init__.py#L147-L224 | train |
tjvr/skip | skip/__init__.py | Interpreter.stop | def stop(self):
"""Stop running threads."""
self.threads = {}
self.new_threads = {}
self.answer = ""
self.ask_lock = False | python | def stop(self):
"""Stop running threads."""
self.threads = {}
self.new_threads = {}
self.answer = ""
self.ask_lock = False | [
"def",
"stop",
"(",
"self",
")",
":",
"self",
".",
"threads",
"=",
"{",
"}",
"self",
".",
"new_threads",
"=",
"{",
"}",
"self",
".",
"answer",
"=",
"\"\"",
"self",
".",
"ask_lock",
"=",
"False"
] | Stop running threads. | [
"Stop",
"running",
"threads",
"."
] | ac84f7198079732bf22c3b8cbc0dc1a073b1d539 | https://github.com/tjvr/skip/blob/ac84f7198079732bf22c3b8cbc0dc1a073b1d539/skip/__init__.py#L226-L231 | train |
tjvr/skip | skip/__init__.py | Interpreter.evaluate | def evaluate(self, s, value, insert=None):
"""Expression evaluator.
* For expressions, returns the value of the expression.
* For Blocks, returns a generator (or the empty list []).
"""
assert not isinstance(value, kurt.Script)
if insert and insert.unevaluated:
... | python | def evaluate(self, s, value, insert=None):
"""Expression evaluator.
* For expressions, returns the value of the expression.
* For Blocks, returns a generator (or the empty list []).
"""
assert not isinstance(value, kurt.Script)
if insert and insert.unevaluated:
... | [
"def",
"evaluate",
"(",
"self",
",",
"s",
",",
"value",
",",
"insert",
"=",
"None",
")",
":",
"assert",
"not",
"isinstance",
"(",
"value",
",",
"kurt",
".",
"Script",
")",
"if",
"insert",
"and",
"insert",
".",
"unevaluated",
":",
"return",
"value",
"... | Expression evaluator.
* For expressions, returns the value of the expression.
* For Blocks, returns a generator (or the empty list []). | [
"Expression",
"evaluator",
"."
] | ac84f7198079732bf22c3b8cbc0dc1a073b1d539 | https://github.com/tjvr/skip/blob/ac84f7198079732bf22c3b8cbc0dc1a073b1d539/skip/__init__.py#L240-L320 | train |
ambitioninc/rabbitmq-admin | rabbitmq_admin/api.py | AdminAPI.get_cluster_name | def get_cluster_name(self):
"""
Name identifying this RabbitMQ cluster.
"""
return self._get(
url=self.url + '/api/cluster-name',
headers=self.headers,
auth=self.auth
) | python | def get_cluster_name(self):
"""
Name identifying this RabbitMQ cluster.
"""
return self._get(
url=self.url + '/api/cluster-name',
headers=self.headers,
auth=self.auth
) | [
"def",
"get_cluster_name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_get",
"(",
"url",
"=",
"self",
".",
"url",
"+",
"'/api/cluster-name'",
",",
"headers",
"=",
"self",
".",
"headers",
",",
"auth",
"=",
"self",
".",
"auth",
")"
] | Name identifying this RabbitMQ cluster. | [
"Name",
"identifying",
"this",
"RabbitMQ",
"cluster",
"."
] | ff65054115f19991da153f0e4f4e45e526545fea | https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/api.py#L16-L24 | train |
ambitioninc/rabbitmq-admin | rabbitmq_admin/api.py | AdminAPI.get_connection | def get_connection(self, name):
"""
An individual connection.
:param name: The connection name
:type name: str
"""
return self._api_get('/api/connections/{0}'.format(
urllib.parse.quote_plus(name)
)) | python | def get_connection(self, name):
"""
An individual connection.
:param name: The connection name
:type name: str
"""
return self._api_get('/api/connections/{0}'.format(
urllib.parse.quote_plus(name)
)) | [
"def",
"get_connection",
"(",
"self",
",",
"name",
")",
":",
"return",
"self",
".",
"_api_get",
"(",
"'/api/connections/{0}'",
".",
"format",
"(",
"urllib",
".",
"parse",
".",
"quote_plus",
"(",
"name",
")",
")",
")"
] | An individual connection.
:param name: The connection name
:type name: str | [
"An",
"individual",
"connection",
"."
] | ff65054115f19991da153f0e4f4e45e526545fea | https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/api.py#L93-L102 | train |
ambitioninc/rabbitmq-admin | rabbitmq_admin/api.py | AdminAPI.delete_connection | def delete_connection(self, name, reason=None):
"""
Closes an individual connection. Give an optional reason
:param name: The connection name
:type name: str
:param reason: An option reason why the connection was deleted
:type reason: str
"""
headers = {... | python | def delete_connection(self, name, reason=None):
"""
Closes an individual connection. Give an optional reason
:param name: The connection name
:type name: str
:param reason: An option reason why the connection was deleted
:type reason: str
"""
headers = {... | [
"def",
"delete_connection",
"(",
"self",
",",
"name",
",",
"reason",
"=",
"None",
")",
":",
"headers",
"=",
"{",
"'X-Reason'",
":",
"reason",
"}",
"if",
"reason",
"else",
"{",
"}",
"self",
".",
"_api_delete",
"(",
"'/api/connections/{0}'",
".",
"format",
... | Closes an individual connection. Give an optional reason
:param name: The connection name
:type name: str
:param reason: An option reason why the connection was deleted
:type reason: str | [
"Closes",
"an",
"individual",
"connection",
".",
"Give",
"an",
"optional",
"reason"
] | ff65054115f19991da153f0e4f4e45e526545fea | https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/api.py#L104-L121 | train |
ambitioninc/rabbitmq-admin | rabbitmq_admin/api.py | AdminAPI.list_connection_channels | def list_connection_channels(self, name):
"""
List of all channels for a given connection.
:param name: The connection name
:type name: str
"""
return self._api_get('/api/connections/{0}/channels'.format(
urllib.parse.quote_plus(name)
)) | python | def list_connection_channels(self, name):
"""
List of all channels for a given connection.
:param name: The connection name
:type name: str
"""
return self._api_get('/api/connections/{0}/channels'.format(
urllib.parse.quote_plus(name)
)) | [
"def",
"list_connection_channels",
"(",
"self",
",",
"name",
")",
":",
"return",
"self",
".",
"_api_get",
"(",
"'/api/connections/{0}/channels'",
".",
"format",
"(",
"urllib",
".",
"parse",
".",
"quote_plus",
"(",
"name",
")",
")",
")"
] | List of all channels for a given connection.
:param name: The connection name
:type name: str | [
"List",
"of",
"all",
"channels",
"for",
"a",
"given",
"connection",
"."
] | ff65054115f19991da153f0e4f4e45e526545fea | https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/api.py#L123-L132 | train |
ambitioninc/rabbitmq-admin | rabbitmq_admin/api.py | AdminAPI.get_channel | def get_channel(self, name):
"""
Details about an individual channel.
:param name: The channel name
:type name: str
"""
return self._api_get('/api/channels/{0}'.format(
urllib.parse.quote_plus(name)
)) | python | def get_channel(self, name):
"""
Details about an individual channel.
:param name: The channel name
:type name: str
"""
return self._api_get('/api/channels/{0}'.format(
urllib.parse.quote_plus(name)
)) | [
"def",
"get_channel",
"(",
"self",
",",
"name",
")",
":",
"return",
"self",
".",
"_api_get",
"(",
"'/api/channels/{0}'",
".",
"format",
"(",
"urllib",
".",
"parse",
".",
"quote_plus",
"(",
"name",
")",
")",
")"
] | Details about an individual channel.
:param name: The channel name
:type name: str | [
"Details",
"about",
"an",
"individual",
"channel",
"."
] | ff65054115f19991da153f0e4f4e45e526545fea | https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/api.py#L140-L149 | train |
ambitioninc/rabbitmq-admin | rabbitmq_admin/api.py | AdminAPI.list_consumers_for_vhost | def list_consumers_for_vhost(self, vhost):
"""
A list of all consumers in a given virtual host.
:param vhost: The vhost name
:type vhost: str
"""
return self._api_get('/api/consumers/{0}'.format(
urllib.parse.quote_plus(vhost)
)) | python | def list_consumers_for_vhost(self, vhost):
"""
A list of all consumers in a given virtual host.
:param vhost: The vhost name
:type vhost: str
"""
return self._api_get('/api/consumers/{0}'.format(
urllib.parse.quote_plus(vhost)
)) | [
"def",
"list_consumers_for_vhost",
"(",
"self",
",",
"vhost",
")",
":",
"return",
"self",
".",
"_api_get",
"(",
"'/api/consumers/{0}'",
".",
"format",
"(",
"urllib",
".",
"parse",
".",
"quote_plus",
"(",
"vhost",
")",
")",
")"
] | A list of all consumers in a given virtual host.
:param vhost: The vhost name
:type vhost: str | [
"A",
"list",
"of",
"all",
"consumers",
"in",
"a",
"given",
"virtual",
"host",
"."
] | ff65054115f19991da153f0e4f4e45e526545fea | https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/api.py#L157-L166 | train |
ambitioninc/rabbitmq-admin | rabbitmq_admin/api.py | AdminAPI.list_exchanges_for_vhost | def list_exchanges_for_vhost(self, vhost):
"""
A list of all exchanges in a given virtual host.
:param vhost: The vhost name
:type vhost: str
"""
return self._api_get('/api/exchanges/{0}'.format(
urllib.parse.quote_plus(vhost)
)) | python | def list_exchanges_for_vhost(self, vhost):
"""
A list of all exchanges in a given virtual host.
:param vhost: The vhost name
:type vhost: str
"""
return self._api_get('/api/exchanges/{0}'.format(
urllib.parse.quote_plus(vhost)
)) | [
"def",
"list_exchanges_for_vhost",
"(",
"self",
",",
"vhost",
")",
":",
"return",
"self",
".",
"_api_get",
"(",
"'/api/exchanges/{0}'",
".",
"format",
"(",
"urllib",
".",
"parse",
".",
"quote_plus",
"(",
"vhost",
")",
")",
")"
] | A list of all exchanges in a given virtual host.
:param vhost: The vhost name
:type vhost: str | [
"A",
"list",
"of",
"all",
"exchanges",
"in",
"a",
"given",
"virtual",
"host",
"."
] | ff65054115f19991da153f0e4f4e45e526545fea | https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/api.py#L174-L183 | train |
ambitioninc/rabbitmq-admin | rabbitmq_admin/api.py | AdminAPI.get_exchange_for_vhost | def get_exchange_for_vhost(self, exchange, vhost):
"""
An individual exchange
:param exchange: The exchange name
:type exchange: str
:param vhost: The vhost name
:type vhost: str
"""
return self._api_get('/api/exchanges/{0}/{1}'.format(
urlli... | python | def get_exchange_for_vhost(self, exchange, vhost):
"""
An individual exchange
:param exchange: The exchange name
:type exchange: str
:param vhost: The vhost name
:type vhost: str
"""
return self._api_get('/api/exchanges/{0}/{1}'.format(
urlli... | [
"def",
"get_exchange_for_vhost",
"(",
"self",
",",
"exchange",
",",
"vhost",
")",
":",
"return",
"self",
".",
"_api_get",
"(",
"'/api/exchanges/{0}/{1}'",
".",
"format",
"(",
"urllib",
".",
"parse",
".",
"quote_plus",
"(",
"vhost",
")",
",",
"urllib",
".",
... | An individual exchange
:param exchange: The exchange name
:type exchange: str
:param vhost: The vhost name
:type vhost: str | [
"An",
"individual",
"exchange"
] | ff65054115f19991da153f0e4f4e45e526545fea | https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/api.py#L185-L198 | train |
ambitioninc/rabbitmq-admin | rabbitmq_admin/api.py | AdminAPI.delete_exchange_for_vhost | def delete_exchange_for_vhost(self, exchange, vhost, if_unused=False):
"""
Delete an individual exchange. You can add the parameter
``if_unused=True``. This prevents the delete from succeeding if the
exchange is bound to a queue or as a source to another exchange.
:param exchang... | python | def delete_exchange_for_vhost(self, exchange, vhost, if_unused=False):
"""
Delete an individual exchange. You can add the parameter
``if_unused=True``. This prevents the delete from succeeding if the
exchange is bound to a queue or as a source to another exchange.
:param exchang... | [
"def",
"delete_exchange_for_vhost",
"(",
"self",
",",
"exchange",
",",
"vhost",
",",
"if_unused",
"=",
"False",
")",
":",
"self",
".",
"_api_delete",
"(",
"'/api/exchanges/{0}/{1}'",
".",
"format",
"(",
"urllib",
".",
"parse",
".",
"quote_plus",
"(",
"vhost",
... | Delete an individual exchange. You can add the parameter
``if_unused=True``. This prevents the delete from succeeding if the
exchange is bound to a queue or as a source to another exchange.
:param exchange: The exchange name
:type exchange: str
:param vhost: The vhost name
... | [
"Delete",
"an",
"individual",
"exchange",
".",
"You",
"can",
"add",
"the",
"parameter",
"if_unused",
"=",
"True",
".",
"This",
"prevents",
"the",
"delete",
"from",
"succeeding",
"if",
"the",
"exchange",
"is",
"bound",
"to",
"a",
"queue",
"or",
"as",
"a",
... | ff65054115f19991da153f0e4f4e45e526545fea | https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/api.py#L232-L254 | train |
ambitioninc/rabbitmq-admin | rabbitmq_admin/api.py | AdminAPI.list_bindings_for_vhost | def list_bindings_for_vhost(self, vhost):
"""
A list of all bindings in a given virtual host.
:param vhost: The vhost name
:type vhost: str
"""
return self._api_get('/api/bindings/{}'.format(
urllib.parse.quote_plus(vhost)
)) | python | def list_bindings_for_vhost(self, vhost):
"""
A list of all bindings in a given virtual host.
:param vhost: The vhost name
:type vhost: str
"""
return self._api_get('/api/bindings/{}'.format(
urllib.parse.quote_plus(vhost)
)) | [
"def",
"list_bindings_for_vhost",
"(",
"self",
",",
"vhost",
")",
":",
"return",
"self",
".",
"_api_get",
"(",
"'/api/bindings/{}'",
".",
"format",
"(",
"urllib",
".",
"parse",
".",
"quote_plus",
"(",
"vhost",
")",
")",
")"
] | A list of all bindings in a given virtual host.
:param vhost: The vhost name
:type vhost: str | [
"A",
"list",
"of",
"all",
"bindings",
"in",
"a",
"given",
"virtual",
"host",
"."
] | ff65054115f19991da153f0e4f4e45e526545fea | https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/api.py#L262-L271 | train |
ambitioninc/rabbitmq-admin | rabbitmq_admin/api.py | AdminAPI.get_vhost | def get_vhost(self, name):
"""
Details about an individual vhost.
:param name: The vhost name
:type name: str
"""
return self._api_get('/api/vhosts/{0}'.format(
urllib.parse.quote_plus(name)
)) | python | def get_vhost(self, name):
"""
Details about an individual vhost.
:param name: The vhost name
:type name: str
"""
return self._api_get('/api/vhosts/{0}'.format(
urllib.parse.quote_plus(name)
)) | [
"def",
"get_vhost",
"(",
"self",
",",
"name",
")",
":",
"return",
"self",
".",
"_api_get",
"(",
"'/api/vhosts/{0}'",
".",
"format",
"(",
"urllib",
".",
"parse",
".",
"quote_plus",
"(",
"name",
")",
")",
")"
] | Details about an individual vhost.
:param name: The vhost name
:type name: str | [
"Details",
"about",
"an",
"individual",
"vhost",
"."
] | ff65054115f19991da153f0e4f4e45e526545fea | https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/api.py#L279-L288 | train |
ambitioninc/rabbitmq-admin | rabbitmq_admin/api.py | AdminAPI.create_vhost | def create_vhost(self, name, tracing=False):
"""
Create an individual vhost.
:param name: The vhost name
:type name: str
:param tracing: Set to ``True`` to enable tracing
:type tracing: bool
"""
data = {'tracing': True} if tracing else {}
self._a... | python | def create_vhost(self, name, tracing=False):
"""
Create an individual vhost.
:param name: The vhost name
:type name: str
:param tracing: Set to ``True`` to enable tracing
:type tracing: bool
"""
data = {'tracing': True} if tracing else {}
self._a... | [
"def",
"create_vhost",
"(",
"self",
",",
"name",
",",
"tracing",
"=",
"False",
")",
":",
"data",
"=",
"{",
"'tracing'",
":",
"True",
"}",
"if",
"tracing",
"else",
"{",
"}",
"self",
".",
"_api_put",
"(",
"'/api/vhosts/{0}'",
".",
"format",
"(",
"urllib"... | Create an individual vhost.
:param name: The vhost name
:type name: str
:param tracing: Set to ``True`` to enable tracing
:type tracing: bool | [
"Create",
"an",
"individual",
"vhost",
"."
] | ff65054115f19991da153f0e4f4e45e526545fea | https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/api.py#L301-L315 | train |
ambitioninc/rabbitmq-admin | rabbitmq_admin/api.py | AdminAPI.get_user | def get_user(self, name):
"""
Details about an individual user.
:param name: The user's name
:type name: str
"""
return self._api_get('/api/users/{0}'.format(
urllib.parse.quote_plus(name)
)) | python | def get_user(self, name):
"""
Details about an individual user.
:param name: The user's name
:type name: str
"""
return self._api_get('/api/users/{0}'.format(
urllib.parse.quote_plus(name)
)) | [
"def",
"get_user",
"(",
"self",
",",
"name",
")",
":",
"return",
"self",
".",
"_api_get",
"(",
"'/api/users/{0}'",
".",
"format",
"(",
"urllib",
".",
"parse",
".",
"quote_plus",
"(",
"name",
")",
")",
")"
] | Details about an individual user.
:param name: The user's name
:type name: str | [
"Details",
"about",
"an",
"individual",
"user",
"."
] | ff65054115f19991da153f0e4f4e45e526545fea | https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/api.py#L323-L332 | train |
ambitioninc/rabbitmq-admin | rabbitmq_admin/api.py | AdminAPI.list_user_permissions | def list_user_permissions(self, name):
"""
A list of all permissions for a given user.
:param name: The user's name
:type name: str
"""
return self._api_get('/api/users/{0}/permissions'.format(
urllib.parse.quote_plus(name)
)) | python | def list_user_permissions(self, name):
"""
A list of all permissions for a given user.
:param name: The user's name
:type name: str
"""
return self._api_get('/api/users/{0}/permissions'.format(
urllib.parse.quote_plus(name)
)) | [
"def",
"list_user_permissions",
"(",
"self",
",",
"name",
")",
":",
"return",
"self",
".",
"_api_get",
"(",
"'/api/users/{0}/permissions'",
".",
"format",
"(",
"urllib",
".",
"parse",
".",
"quote_plus",
"(",
"name",
")",
")",
")"
] | A list of all permissions for a given user.
:param name: The user's name
:type name: str | [
"A",
"list",
"of",
"all",
"permissions",
"for",
"a",
"given",
"user",
"."
] | ff65054115f19991da153f0e4f4e45e526545fea | https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/api.py#L376-L385 | train |
ambitioninc/rabbitmq-admin | rabbitmq_admin/api.py | AdminAPI.list_policies_for_vhost | def list_policies_for_vhost(self, vhost):
"""
A list of all policies for a vhost.
"""
return self._api_get('/api/policies/{0}'.format(
urllib.parse.quote_plus(vhost)
)) | python | def list_policies_for_vhost(self, vhost):
"""
A list of all policies for a vhost.
"""
return self._api_get('/api/policies/{0}'.format(
urllib.parse.quote_plus(vhost)
)) | [
"def",
"list_policies_for_vhost",
"(",
"self",
",",
"vhost",
")",
":",
"return",
"self",
".",
"_api_get",
"(",
"'/api/policies/{0}'",
".",
"format",
"(",
"urllib",
".",
"parse",
".",
"quote_plus",
"(",
"vhost",
")",
")",
")"
] | A list of all policies for a vhost. | [
"A",
"list",
"of",
"all",
"policies",
"for",
"a",
"vhost",
"."
] | ff65054115f19991da153f0e4f4e45e526545fea | https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/api.py#L468-L474 | train |
ambitioninc/rabbitmq-admin | rabbitmq_admin/api.py | AdminAPI.get_policy_for_vhost | def get_policy_for_vhost(self, vhost, name):
"""
Get a specific policy for a vhost.
:param vhost: The virtual host the policy is for
:type vhost: str
:param name: The name of the policy
:type name: str
"""
return self._api_get('/api/policies/{0}/{1}'.form... | python | def get_policy_for_vhost(self, vhost, name):
"""
Get a specific policy for a vhost.
:param vhost: The virtual host the policy is for
:type vhost: str
:param name: The name of the policy
:type name: str
"""
return self._api_get('/api/policies/{0}/{1}'.form... | [
"def",
"get_policy_for_vhost",
"(",
"self",
",",
"vhost",
",",
"name",
")",
":",
"return",
"self",
".",
"_api_get",
"(",
"'/api/policies/{0}/{1}'",
".",
"format",
"(",
"urllib",
".",
"parse",
".",
"quote_plus",
"(",
"vhost",
")",
",",
"urllib",
".",
"parse... | Get a specific policy for a vhost.
:param vhost: The virtual host the policy is for
:type vhost: str
:param name: The name of the policy
:type name: str | [
"Get",
"a",
"specific",
"policy",
"for",
"a",
"vhost",
"."
] | ff65054115f19991da153f0e4f4e45e526545fea | https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/api.py#L476-L488 | train |
ambitioninc/rabbitmq-admin | rabbitmq_admin/api.py | AdminAPI.create_policy_for_vhost | def create_policy_for_vhost(
self, vhost, name,
definition,
pattern=None,
priority=0,
apply_to='all'):
"""
Create a policy for a vhost.
:param vhost: The virtual host the policy is for
:type vhost: str
:param name: The ... | python | def create_policy_for_vhost(
self, vhost, name,
definition,
pattern=None,
priority=0,
apply_to='all'):
"""
Create a policy for a vhost.
:param vhost: The virtual host the policy is for
:type vhost: str
:param name: The ... | [
"def",
"create_policy_for_vhost",
"(",
"self",
",",
"vhost",
",",
"name",
",",
"definition",
",",
"pattern",
"=",
"None",
",",
"priority",
"=",
"0",
",",
"apply_to",
"=",
"'all'",
")",
":",
"data",
"=",
"{",
"\"pattern\"",
":",
"pattern",
",",
"\"definit... | Create a policy for a vhost.
:param vhost: The virtual host the policy is for
:type vhost: str
:param name: The name of the policy
:type name: str
:param definition: The definition of the policy. Required
:type definition: dict
:param priority: The priority of t... | [
"Create",
"a",
"policy",
"for",
"a",
"vhost",
"."
] | ff65054115f19991da153f0e4f4e45e526545fea | https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/api.py#L490-L537 | train |
ambitioninc/rabbitmq-admin | rabbitmq_admin/api.py | AdminAPI.delete_policy_for_vhost | def delete_policy_for_vhost(self, vhost, name):
"""
Delete a specific policy for a vhost.
:param vhost: The virtual host of the policy
:type vhost: str
:param name: The name of the policy
:type name: str
"""
self._api_delete('/api/policies/{0}/{1}/'.forma... | python | def delete_policy_for_vhost(self, vhost, name):
"""
Delete a specific policy for a vhost.
:param vhost: The virtual host of the policy
:type vhost: str
:param name: The name of the policy
:type name: str
"""
self._api_delete('/api/policies/{0}/{1}/'.forma... | [
"def",
"delete_policy_for_vhost",
"(",
"self",
",",
"vhost",
",",
"name",
")",
":",
"self",
".",
"_api_delete",
"(",
"'/api/policies/{0}/{1}/'",
".",
"format",
"(",
"urllib",
".",
"parse",
".",
"quote_plus",
"(",
"vhost",
")",
",",
"urllib",
".",
"parse",
... | Delete a specific policy for a vhost.
:param vhost: The virtual host of the policy
:type vhost: str
:param name: The name of the policy
:type name: str | [
"Delete",
"a",
"specific",
"policy",
"for",
"a",
"vhost",
"."
] | ff65054115f19991da153f0e4f4e45e526545fea | https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/api.py#L539-L551 | train |
ambitioninc/rabbitmq-admin | rabbitmq_admin/api.py | AdminAPI.is_vhost_alive | def is_vhost_alive(self, vhost):
"""
Declares a test queue, then publishes and consumes a message.
Intended for use by monitoring tools.
:param vhost: The vhost name to check
:type vhost: str
"""
return self._api_get('/api/aliveness-test/{0}'.format(
... | python | def is_vhost_alive(self, vhost):
"""
Declares a test queue, then publishes and consumes a message.
Intended for use by monitoring tools.
:param vhost: The vhost name to check
:type vhost: str
"""
return self._api_get('/api/aliveness-test/{0}'.format(
... | [
"def",
"is_vhost_alive",
"(",
"self",
",",
"vhost",
")",
":",
"return",
"self",
".",
"_api_get",
"(",
"'/api/aliveness-test/{0}'",
".",
"format",
"(",
"urllib",
".",
"parse",
".",
"quote_plus",
"(",
"vhost",
")",
")",
")"
] | Declares a test queue, then publishes and consumes a message.
Intended for use by monitoring tools.
:param vhost: The vhost name to check
:type vhost: str | [
"Declares",
"a",
"test",
"queue",
"then",
"publishes",
"and",
"consumes",
"a",
"message",
".",
"Intended",
"for",
"use",
"by",
"monitoring",
"tools",
"."
] | ff65054115f19991da153f0e4f4e45e526545fea | https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/api.py#L553-L563 | train |
CI-WATER/gsshapy | gsshapy/orm/wms_dataset.py | WMSDatasetFile.write | def write(self, session, directory, name, maskMap):
"""
Write from database to file.
*session* = SQLAlchemy session object\n
*directory* = to which directory will the files be written (e.g.: '/example/path')\n
*name* = name of file that will be written (e.g.: 'my_project.ext')\n... | python | def write(self, session, directory, name, maskMap):
"""
Write from database to file.
*session* = SQLAlchemy session object\n
*directory* = to which directory will the files be written (e.g.: '/example/path')\n
*name* = name of file that will be written (e.g.: 'my_project.ext')\n... | [
"def",
"write",
"(",
"self",
",",
"session",
",",
"directory",
",",
"name",
",",
"maskMap",
")",
":",
"# Assemble Path to file",
"name_split",
"=",
"name",
".",
"split",
"(",
"'.'",
")",
"name",
"=",
"name_split",
"[",
"0",
"]",
"# Default extension",
"ext... | Write from database to file.
*session* = SQLAlchemy session object\n
*directory* = to which directory will the files be written (e.g.: '/example/path')\n
*name* = name of file that will be written (e.g.: 'my_project.ext')\n | [
"Write",
"from",
"database",
"to",
"file",
"."
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/wms_dataset.py#L144-L180 | train |
CI-WATER/gsshapy | gsshapy/orm/wms_dataset.py | WMSDatasetFile.getAsKmlGridAnimation | def getAsKmlGridAnimation(self, session, projectFile=None, path=None, documentName=None, colorRamp=None, alpha=1.0, noDataValue=0.0):
"""
Retrieve the WMS dataset as a gridded time stamped KML string.
Args:
session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object b... | python | def getAsKmlGridAnimation(self, session, projectFile=None, path=None, documentName=None, colorRamp=None, alpha=1.0, noDataValue=0.0):
"""
Retrieve the WMS dataset as a gridded time stamped KML string.
Args:
session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object b... | [
"def",
"getAsKmlGridAnimation",
"(",
"self",
",",
"session",
",",
"projectFile",
"=",
"None",
",",
"path",
"=",
"None",
",",
"documentName",
"=",
"None",
",",
"colorRamp",
"=",
"None",
",",
"alpha",
"=",
"1.0",
",",
"noDataValue",
"=",
"0.0",
")",
":",
... | Retrieve the WMS dataset as a gridded time stamped KML string.
Args:
session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled database.
projectFile(:class:`gsshapy.orm.ProjectFile`): Project file object for the GSSHA project to which the WMS da... | [
"Retrieve",
"the",
"WMS",
"dataset",
"as",
"a",
"gridded",
"time",
"stamped",
"KML",
"string",
"."
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/wms_dataset.py#L184-L234 | train |
CI-WATER/gsshapy | gsshapy/orm/wms_dataset.py | WMSDatasetFile.getAsKmlPngAnimation | def getAsKmlPngAnimation(self, session, projectFile=None, path=None, documentName=None, colorRamp=None, alpha=1.0,
noDataValue=0, drawOrder=0, cellSize=None, resampleMethod='NearestNeighbour'):
"""
Retrieve the WMS dataset as a PNG time stamped KMZ
Args:
... | python | def getAsKmlPngAnimation(self, session, projectFile=None, path=None, documentName=None, colorRamp=None, alpha=1.0,
noDataValue=0, drawOrder=0, cellSize=None, resampleMethod='NearestNeighbour'):
"""
Retrieve the WMS dataset as a PNG time stamped KMZ
Args:
... | [
"def",
"getAsKmlPngAnimation",
"(",
"self",
",",
"session",
",",
"projectFile",
"=",
"None",
",",
"path",
"=",
"None",
",",
"documentName",
"=",
"None",
",",
"colorRamp",
"=",
"None",
",",
"alpha",
"=",
"1.0",
",",
"noDataValue",
"=",
"0",
",",
"drawOrde... | Retrieve the WMS dataset as a PNG time stamped KMZ
Args:
session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled database.
projectFile(:class:`gsshapy.orm.ProjectFile`): Project file object for the GSSHA project to which the WMS dataset belong... | [
"Retrieve",
"the",
"WMS",
"dataset",
"as",
"a",
"PNG",
"time",
"stamped",
"KMZ"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/wms_dataset.py#L236-L306 | train |
CI-WATER/gsshapy | gsshapy/orm/wms_dataset.py | WMSDatasetFile._read | def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, maskMap):
"""
WMS Dataset File Read from File Method
"""
# Assign file extension attribute to file object
self.fileExtension = extension
if isinstance(maskMap, RasterMapFile... | python | def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, maskMap):
"""
WMS Dataset File Read from File Method
"""
# Assign file extension attribute to file object
self.fileExtension = extension
if isinstance(maskMap, RasterMapFile... | [
"def",
"_read",
"(",
"self",
",",
"directory",
",",
"filename",
",",
"session",
",",
"path",
",",
"name",
",",
"extension",
",",
"spatial",
",",
"spatialReferenceID",
",",
"maskMap",
")",
":",
"# Assign file extension attribute to file object",
"self",
".",
"fil... | WMS Dataset File Read from File Method | [
"WMS",
"Dataset",
"File",
"Read",
"from",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/wms_dataset.py#L308-L390 | train |
CI-WATER/gsshapy | gsshapy/orm/wms_dataset.py | WMSDatasetFile._write | def _write(self, session, openFile, maskMap):
"""
WMS Dataset File Write to File Method
"""
# Magic numbers
FIRST_VALUE_INDEX = 12
# Write the header
openFile.write('DATASET\r\n')
if self.type == self.SCALAR_TYPE:
openFile.write('OBJTYPE {0}\... | python | def _write(self, session, openFile, maskMap):
"""
WMS Dataset File Write to File Method
"""
# Magic numbers
FIRST_VALUE_INDEX = 12
# Write the header
openFile.write('DATASET\r\n')
if self.type == self.SCALAR_TYPE:
openFile.write('OBJTYPE {0}\... | [
"def",
"_write",
"(",
"self",
",",
"session",
",",
"openFile",
",",
"maskMap",
")",
":",
"# Magic numbers",
"FIRST_VALUE_INDEX",
"=",
"12",
"# Write the header",
"openFile",
".",
"write",
"(",
"'DATASET\\r\\n'",
")",
"if",
"self",
".",
"type",
"==",
"self",
... | WMS Dataset File Write to File Method | [
"WMS",
"Dataset",
"File",
"Write",
"to",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/wms_dataset.py#L392-L450 | train |
CI-WATER/gsshapy | gsshapy/orm/wms_dataset.py | WMSDatasetRaster.getAsWmsDatasetString | def getAsWmsDatasetString(self, session):
"""
Retrieve the WMS Raster as a string in the WMS Dataset format
"""
# Magic numbers
FIRST_VALUE_INDEX = 12
# Write value raster
if type(self.raster) != type(None):
# Convert to GRASS ASCII Raster
... | python | def getAsWmsDatasetString(self, session):
"""
Retrieve the WMS Raster as a string in the WMS Dataset format
"""
# Magic numbers
FIRST_VALUE_INDEX = 12
# Write value raster
if type(self.raster) != type(None):
# Convert to GRASS ASCII Raster
... | [
"def",
"getAsWmsDatasetString",
"(",
"self",
",",
"session",
")",
":",
"# Magic numbers",
"FIRST_VALUE_INDEX",
"=",
"12",
"# Write value raster",
"if",
"type",
"(",
"self",
".",
"raster",
")",
"!=",
"type",
"(",
"None",
")",
":",
"# Convert to GRASS ASCII Raster",... | Retrieve the WMS Raster as a string in the WMS Dataset format | [
"Retrieve",
"the",
"WMS",
"Raster",
"as",
"a",
"string",
"in",
"the",
"WMS",
"Dataset",
"format"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/wms_dataset.py#L530-L553 | train |
CI-WATER/gsshapy | gsshapy/lib/check_geometry.py | check_watershed_boundary_geometry | def check_watershed_boundary_geometry(shapefile_path):
"""Make sure that there are no random artifacts in the file."""
wfg = gpd.read_file(shapefile_path)
first_shape = wfg.iloc[0].geometry
if hasattr(first_shape, 'geoms'):
raise ValueError(
"Invalid watershed boundary geometry. "
... | python | def check_watershed_boundary_geometry(shapefile_path):
"""Make sure that there are no random artifacts in the file."""
wfg = gpd.read_file(shapefile_path)
first_shape = wfg.iloc[0].geometry
if hasattr(first_shape, 'geoms'):
raise ValueError(
"Invalid watershed boundary geometry. "
... | [
"def",
"check_watershed_boundary_geometry",
"(",
"shapefile_path",
")",
":",
"wfg",
"=",
"gpd",
".",
"read_file",
"(",
"shapefile_path",
")",
"first_shape",
"=",
"wfg",
".",
"iloc",
"[",
"0",
"]",
".",
"geometry",
"if",
"hasattr",
"(",
"first_shape",
",",
"'... | Make sure that there are no random artifacts in the file. | [
"Make",
"sure",
"that",
"there",
"are",
"no",
"random",
"artifacts",
"in",
"the",
"file",
"."
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/lib/check_geometry.py#L4-L12 | train |
CyberZHG/keras-bi-lm | keras_bi_lm/model.py | BiLM.get_batch | def get_batch(sentences,
token_dict,
ignore_case=False,
unk_index=1,
eos_index=2):
"""Get a batch of inputs and outputs from given sentences.
:param sentences: A list of list of tokens.
:param token_dict: The dict that maps... | python | def get_batch(sentences,
token_dict,
ignore_case=False,
unk_index=1,
eos_index=2):
"""Get a batch of inputs and outputs from given sentences.
:param sentences: A list of list of tokens.
:param token_dict: The dict that maps... | [
"def",
"get_batch",
"(",
"sentences",
",",
"token_dict",
",",
"ignore_case",
"=",
"False",
",",
"unk_index",
"=",
"1",
",",
"eos_index",
"=",
"2",
")",
":",
"batch_size",
"=",
"len",
"(",
"sentences",
")",
"max_sentence_len",
"=",
"max",
"(",
"map",
"(",... | Get a batch of inputs and outputs from given sentences.
:param sentences: A list of list of tokens.
:param token_dict: The dict that maps a token to an integer. `<UNK>` and `<EOS>` should be preserved.
:param ignore_case: Whether ignoring the case of the token.
:param unk_index: The ind... | [
"Get",
"a",
"batch",
"of",
"inputs",
"and",
"outputs",
"from",
"given",
"sentences",
"."
] | 615e1131052d488420d759bab2370d504c9fc074 | https://github.com/CyberZHG/keras-bi-lm/blob/615e1131052d488420d759bab2370d504c9fc074/keras_bi_lm/model.py#L168-L203 | train |
CyberZHG/keras-bi-lm | keras_bi_lm/model.py | BiLM.fit | def fit(self, inputs, outputs, epochs=1):
"""Simple wrapper of model.fit.
:param inputs: Inputs.
:param outputs: List of forward and backward outputs.
:param epochs: Number of epoch.
:return: None
"""
self.model.fit(inputs, outputs, epochs=epochs) | python | def fit(self, inputs, outputs, epochs=1):
"""Simple wrapper of model.fit.
:param inputs: Inputs.
:param outputs: List of forward and backward outputs.
:param epochs: Number of epoch.
:return: None
"""
self.model.fit(inputs, outputs, epochs=epochs) | [
"def",
"fit",
"(",
"self",
",",
"inputs",
",",
"outputs",
",",
"epochs",
"=",
"1",
")",
":",
"self",
".",
"model",
".",
"fit",
"(",
"inputs",
",",
"outputs",
",",
"epochs",
"=",
"epochs",
")"
] | Simple wrapper of model.fit.
:param inputs: Inputs.
:param outputs: List of forward and backward outputs.
:param epochs: Number of epoch.
:return: None | [
"Simple",
"wrapper",
"of",
"model",
".",
"fit",
"."
] | 615e1131052d488420d759bab2370d504c9fc074 | https://github.com/CyberZHG/keras-bi-lm/blob/615e1131052d488420d759bab2370d504c9fc074/keras_bi_lm/model.py#L205-L214 | train |
CyberZHG/keras-bi-lm | keras_bi_lm/model.py | BiLM.get_feature_layers | def get_feature_layers(self, input_layer=None, trainable=False, use_weighted_sum=False):
"""Get layers that output the Bi-LM feature.
:param input_layer: Use existing input layer.
:param trainable: Whether the layers are still trainable.
:param use_weighted_sum: Whether to use weighted ... | python | def get_feature_layers(self, input_layer=None, trainable=False, use_weighted_sum=False):
"""Get layers that output the Bi-LM feature.
:param input_layer: Use existing input layer.
:param trainable: Whether the layers are still trainable.
:param use_weighted_sum: Whether to use weighted ... | [
"def",
"get_feature_layers",
"(",
"self",
",",
"input_layer",
"=",
"None",
",",
"trainable",
"=",
"False",
",",
"use_weighted_sum",
"=",
"False",
")",
":",
"model",
"=",
"keras",
".",
"models",
".",
"clone_model",
"(",
"self",
".",
"model",
",",
"input_lay... | Get layers that output the Bi-LM feature.
:param input_layer: Use existing input layer.
:param trainable: Whether the layers are still trainable.
:param use_weighted_sum: Whether to use weighted sum of RNN layers.
:return [input_layer,] output_layer: Input and output layer. | [
"Get",
"layers",
"that",
"output",
"the",
"Bi",
"-",
"LM",
"feature",
"."
] | 615e1131052d488420d759bab2370d504c9fc074 | https://github.com/CyberZHG/keras-bi-lm/blob/615e1131052d488420d759bab2370d504c9fc074/keras_bi_lm/model.py#L225-L261 | train |
pedrotgn/pyactor | examples/chord/chord.py | Node.join | def join(self, n1):
"""if join returns false, the node did not entry the ring. Retry it"""
if self.id == n1.get_id():
for i in range(k):
self.finger[i] = self.proxy
self.predecessor = self.proxy
self.run = True
return True
else:
... | python | def join(self, n1):
"""if join returns false, the node did not entry the ring. Retry it"""
if self.id == n1.get_id():
for i in range(k):
self.finger[i] = self.proxy
self.predecessor = self.proxy
self.run = True
return True
else:
... | [
"def",
"join",
"(",
"self",
",",
"n1",
")",
":",
"if",
"self",
".",
"id",
"==",
"n1",
".",
"get_id",
"(",
")",
":",
"for",
"i",
"in",
"range",
"(",
"k",
")",
":",
"self",
".",
"finger",
"[",
"i",
"]",
"=",
"self",
".",
"proxy",
"self",
".",... | if join returns false, the node did not entry the ring. Retry it | [
"if",
"join",
"returns",
"false",
"the",
"node",
"did",
"not",
"entry",
"the",
"ring",
".",
"Retry",
"it"
] | 24d98d134dd4228f2ba38e83611e9c3f50ec2fd4 | https://github.com/pedrotgn/pyactor/blob/24d98d134dd4228f2ba38e83611e9c3f50ec2fd4/examples/chord/chord.py#L123-L140 | train |
CI-WATER/gsshapy | gsshapy/orm/snw.py | NwsrfsFile._read | def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile):
"""
NWSRFS Read from File Method
"""
# Set file extension property
self.fileExtension = extension
# Open file and parse
with open(path, 'r') as nw... | python | def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile):
"""
NWSRFS Read from File Method
"""
# Set file extension property
self.fileExtension = extension
# Open file and parse
with open(path, 'r') as nw... | [
"def",
"_read",
"(",
"self",
",",
"directory",
",",
"filename",
",",
"session",
",",
"path",
",",
"name",
",",
"extension",
",",
"spatial",
",",
"spatialReferenceID",
",",
"replaceParamFile",
")",
":",
"# Set file extension property",
"self",
".",
"fileExtension... | NWSRFS Read from File Method | [
"NWSRFS",
"Read",
"from",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/snw.py#L56-L87 | train |
CI-WATER/gsshapy | gsshapy/orm/snw.py | NwsrfsFile._write | def _write(self, session, openFile, replaceParamFile):
"""
NWSRFS Write to File Method
"""
# Write lines
openFile.write('Number_Bands: %s\n' % self.numBands)
openFile.write('Lower_Elevation Upper_Elevation MF_Min MF_Max SCF FR_USE TIPM NMF FUA PCWHC\n')
... | python | def _write(self, session, openFile, replaceParamFile):
"""
NWSRFS Write to File Method
"""
# Write lines
openFile.write('Number_Bands: %s\n' % self.numBands)
openFile.write('Lower_Elevation Upper_Elevation MF_Min MF_Max SCF FR_USE TIPM NMF FUA PCWHC\n')
... | [
"def",
"_write",
"(",
"self",
",",
"session",
",",
"openFile",
",",
"replaceParamFile",
")",
":",
"# Write lines",
"openFile",
".",
"write",
"(",
"'Number_Bands: %s\\n'",
"%",
"self",
".",
"numBands",
")",
"openFile",
".",
"write",
"(",
"'Lower_Elevation Upp... | NWSRFS Write to File Method | [
"NWSRFS",
"Write",
"to",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/snw.py#L89-L120 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.