repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 3
values | summary stringlengths 4 350 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
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 | Set the data node output from node estimations. |
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 | Set the function node output from node inputs and outputs. |
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 | Add initial values updating workflow seen and fringe. |
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 | Visit a node and update the workflow seen and fringe. |
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 | Check if a node is visible in the fringe. |
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 | Removes unused function and sub - dispatcher nodes. |
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 | Initialize the dispatcher as sub - dispatcher and update the fringe. |
vinci1it2000/schedula | schedula/utils/sol.py | Solution._see_remote_link_node | def _see_remote_link_node(self, node_id, fringe=None, dist=None,
check_dsp=lambda x: True):
"""
See data remote links of the node (set output to remote links).
:param node_id:
Node id.
:type node_id: str
:param fringe:
Heapq... | python | def _see_remote_link_node(self, node_id, fringe=None, dist=None,
check_dsp=lambda x: True):
"""
See data remote links of the node (set output to remote links).
:param node_id:
Node id.
:type node_id: str
:param fringe:
Heapq... | [
"def",
"_see_remote_link_node",
"(",
"self",
",",
"node_id",
",",
"fringe",
"=",
"None",
",",
"dist",
"=",
"None",
",",
"check_dsp",
"=",
"lambda",
"x",
":",
"True",
")",
":",
"# Namespace shortcut.",
"node",
",",
"p_id",
",",
"c_i",
"=",
"self",
".",
... | See data remote links of the node (set output to remote links).
:param node_id:
Node id.
:type node_id: str
:param fringe:
Heapq of closest available nodes.
:type fringe: list[(float | int, bool, (str, Dispatcher)]
:param dist:
Distance from... | [
"See",
"data",
"remote",
"links",
"of",
"the",
"node",
"(",
"set",
"output",
"to",
"remote",
"links",
")",
"."
] | addb9fd685be81544b796c51383ac00a31543ce9 | https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/sol.py#L1089-L1127 | train | See remote links of the node. |
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 | Sets the input of a sub - dispatcher node. |
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 | Handles the error messages. |
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 | Method to read from a Grid Stream File |
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 | Method to write grid stream file to File Method to File Method |
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 | Method to read from file Method to set properties of the object |
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 | Writes the raster to a file. |
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 | Method to write to File Method to Write |
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 | Parse a CELLIJ Chunk Method
|
aio-libs/aiosparql | aiosparql/escape.py | escape_any | def escape_any(value):
"""
Section 4.1.2 defines SPARQL shortened forms
https://www.w3.org/TR/2013/REC-sparql11-query-20130321/#QSynLiterals
Examples of literal syntax in SPARQL include:
"chat"
'chat'@fr with language tag "fr"
"xyz"^^<http://example.org/ns/userDatatype>
... | python | def escape_any(value):
"""
Section 4.1.2 defines SPARQL shortened forms
https://www.w3.org/TR/2013/REC-sparql11-query-20130321/#QSynLiterals
Examples of literal syntax in SPARQL include:
"chat"
'chat'@fr with language tag "fr"
"xyz"^^<http://example.org/ns/userDatatype>
... | [
"def",
"escape_any",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"type",
")",
":",
"raise",
"TypeError",
"(",
"\"object %r is not an instance\"",
"%",
"value",
")",
"for",
"type_",
",",
"escape_method",
"in",
"escapers",
":",
"if",
"isinst... | Section 4.1.2 defines SPARQL shortened forms
https://www.w3.org/TR/2013/REC-sparql11-query-20130321/#QSynLiterals
Examples of literal syntax in SPARQL include:
"chat"
'chat'@fr with language tag "fr"
"xyz"^^<http://example.org/ns/userDatatype>
"abc"^^appNS:appDataType
'... | [
"Section",
"4",
".",
"1",
".",
"2",
"defines",
"SPARQL",
"shortened",
"forms",
"https",
":",
"//",
"www",
".",
"w3",
".",
"org",
"/",
"TR",
"/",
"2013",
"/",
"REC",
"-",
"sparql11",
"-",
"query",
"-",
"20130321",
"/",
"#QSynLiterals"
] | 9aaf313fe71908c2cc4d7a7ab3b5af2dc9e0c99d | https://github.com/aio-libs/aiosparql/blob/9aaf313fe71908c2cc4d7a7ab3b5af2dc9e0c99d/aiosparql/escape.py#L11-L35 | train | Escape any value in the SPARQL shortened form
. |
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 | Private method to write to File Method
|
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 | Method to read from file Method to read from file Method to parse into a data structure |
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 | Write to File Method |
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 | Use this function in emit data into the store. |
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 | Returns a list with each script that is triggered. |
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 | Run the script and add it to the list of threads. |
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 | Execute one frame of the interpreter. |
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 | Stop running threads. |
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 | Evaluate the expression and return the value. |
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 | Get the name of the RabbitMQ cluster. |
ambitioninc/rabbitmq-admin | rabbitmq_admin/api.py | AdminAPI.get_node | def get_node(self, name, memory=False, binary=False):
"""
An individual node in the RabbitMQ cluster. Set "memory=true" to get
memory statistics, and "binary=true" to get a breakdown of binary
memory use (may be expensive if there are many small binaries in the
system).
"... | python | def get_node(self, name, memory=False, binary=False):
"""
An individual node in the RabbitMQ cluster. Set "memory=true" to get
memory statistics, and "binary=true" to get a breakdown of binary
memory use (may be expensive if there are many small binaries in the
system).
"... | [
"def",
"get_node",
"(",
"self",
",",
"name",
",",
"memory",
"=",
"False",
",",
"binary",
"=",
"False",
")",
":",
"return",
"self",
".",
"_api_get",
"(",
"url",
"=",
"'/api/nodes/{0}'",
".",
"format",
"(",
"name",
")",
",",
"params",
"=",
"dict",
"(",... | An individual node in the RabbitMQ cluster. Set "memory=true" to get
memory statistics, and "binary=true" to get a breakdown of binary
memory use (may be expensive if there are many small binaries in the
system). | [
"An",
"individual",
"node",
"in",
"the",
"RabbitMQ",
"cluster",
".",
"Set",
"memory",
"=",
"true",
"to",
"get",
"memory",
"statistics",
"and",
"binary",
"=",
"true",
"to",
"get",
"a",
"breakdown",
"of",
"binary",
"memory",
"use",
"(",
"may",
"be",
"expen... | ff65054115f19991da153f0e4f4e45e526545fea | https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/api.py#L32-L45 | train | Get a specific node in the RabbitMQ cluster. |
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 | Get a single connection. |
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 | Closes an individual connection. Give an optional reason
|
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 | List all channels for a given connection. |
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 | Get the details about an individual channel. |
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 | Returns a list of all consumers for a given vhost. |
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 | Returns a list of all exchanges in a given virtual host. |
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 | Get the name of the exchange for a vhost |
ambitioninc/rabbitmq-admin | rabbitmq_admin/api.py | AdminAPI.create_exchange_for_vhost | def create_exchange_for_vhost(self, exchange, vhost, body):
"""
Create an individual exchange.
The body should look like:
::
{
"type": "direct",
"auto_delete": false,
"durable": true,
"internal": false,
... | python | def create_exchange_for_vhost(self, exchange, vhost, body):
"""
Create an individual exchange.
The body should look like:
::
{
"type": "direct",
"auto_delete": false,
"durable": true,
"internal": false,
... | [
"def",
"create_exchange_for_vhost",
"(",
"self",
",",
"exchange",
",",
"vhost",
",",
"body",
")",
":",
"self",
".",
"_api_put",
"(",
"'/api/exchanges/{0}/{1}'",
".",
"format",
"(",
"urllib",
".",
"parse",
".",
"quote_plus",
"(",
"vhost",
")",
",",
"urllib",
... | Create an individual exchange.
The body should look like:
::
{
"type": "direct",
"auto_delete": false,
"durable": true,
"internal": false,
"arguments": {}
}
The type key is mandatory; other ... | [
"Create",
"an",
"individual",
"exchange",
".",
"The",
"body",
"should",
"look",
"like",
":",
"::"
] | ff65054115f19991da153f0e4f4e45e526545fea | https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/api.py#L200-L230 | train | Create an individual exchange for a vhost. |
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 | Delete an individual exchange for a vhost. |
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 | Returns a list of all bindings for a given vhost. |
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 | Get details about an individual vhost. |
ambitioninc/rabbitmq-admin | rabbitmq_admin/api.py | AdminAPI.delete_vhost | def delete_vhost(self, name):
"""
Delete a vhost.
:param name: The vhost name
:type name: str
"""
self._api_delete('/api/vhosts/{0}'.format(
urllib.parse.quote_plus(name)
)) | python | def delete_vhost(self, name):
"""
Delete a vhost.
:param name: The vhost name
:type name: str
"""
self._api_delete('/api/vhosts/{0}'.format(
urllib.parse.quote_plus(name)
)) | [
"def",
"delete_vhost",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"_api_delete",
"(",
"'/api/vhosts/{0}'",
".",
"format",
"(",
"urllib",
".",
"parse",
".",
"quote_plus",
"(",
"name",
")",
")",
")"
] | Delete a vhost.
:param name: The vhost name
:type name: str | [
"Delete",
"a",
"vhost",
"."
] | ff65054115f19991da153f0e4f4e45e526545fea | https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/api.py#L290-L299 | train | Delete a vhost. |
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 | Create an individual vhost. |
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 | Get details about an individual user. |
ambitioninc/rabbitmq-admin | rabbitmq_admin/api.py | AdminAPI.delete_user | def delete_user(self, name):
"""
Delete a user.
:param name: The user's name
:type name: str
"""
self._api_delete('/api/users/{0}'.format(
urllib.parse.quote_plus(name)
)) | python | def delete_user(self, name):
"""
Delete a user.
:param name: The user's name
:type name: str
"""
self._api_delete('/api/users/{0}'.format(
urllib.parse.quote_plus(name)
)) | [
"def",
"delete_user",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"_api_delete",
"(",
"'/api/users/{0}'",
".",
"format",
"(",
"urllib",
".",
"parse",
".",
"quote_plus",
"(",
"name",
")",
")",
")"
] | Delete a user.
:param name: The user's name
:type name: str | [
"Delete",
"a",
"user",
"."
] | ff65054115f19991da153f0e4f4e45e526545fea | https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/api.py#L334-L343 | train | Delete a user. |
ambitioninc/rabbitmq-admin | rabbitmq_admin/api.py | AdminAPI.create_user | def create_user(self, name, password, password_hash=None, tags=None):
"""
Create a user
:param name: The user's name
:type name: str
:param password: The user's password. Set to "" if no password is
desired. Takes precedence if ``password_hash`` is also set.
... | python | def create_user(self, name, password, password_hash=None, tags=None):
"""
Create a user
:param name: The user's name
:type name: str
:param password: The user's password. Set to "" if no password is
desired. Takes precedence if ``password_hash`` is also set.
... | [
"def",
"create_user",
"(",
"self",
",",
"name",
",",
"password",
",",
"password_hash",
"=",
"None",
",",
"tags",
"=",
"None",
")",
":",
"data",
"=",
"{",
"'tags'",
":",
"', '",
".",
"join",
"(",
"tags",
"or",
"[",
"]",
")",
"}",
"if",
"password",
... | Create a user
:param name: The user's name
:type name: str
:param password: The user's password. Set to "" if no password is
desired. Takes precedence if ``password_hash`` is also set.
:type password: str
:param password_hash: An optional password hash for the user.
... | [
"Create",
"a",
"user"
] | ff65054115f19991da153f0e4f4e45e526545fea | https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/api.py#L345-L374 | train | Creates a user in the national system. |
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 | Returns a list of all permissions for a given user. |
ambitioninc/rabbitmq-admin | rabbitmq_admin/api.py | AdminAPI.create_user_permission | def create_user_permission(self,
name,
vhost,
configure=None,
write=None,
read=None):
"""
Create a user permission
:param name: The user's na... | python | def create_user_permission(self,
name,
vhost,
configure=None,
write=None,
read=None):
"""
Create a user permission
:param name: The user's na... | [
"def",
"create_user_permission",
"(",
"self",
",",
"name",
",",
"vhost",
",",
"configure",
"=",
"None",
",",
"write",
"=",
"None",
",",
"read",
"=",
"None",
")",
":",
"data",
"=",
"{",
"'configure'",
":",
"configure",
"or",
"'.*'",
",",
"'write'",
":",... | Create a user permission
:param name: The user's name
:type name: str
:param vhost: The vhost to assign the permission to
:type vhost: str
:param configure: A regex for the user permission. Default is ``.*``
:type configure: str
:param write: A regex for the user... | [
"Create",
"a",
"user",
"permission",
":",
"param",
"name",
":",
"The",
"user",
"s",
"name",
":",
"type",
"name",
":",
"str",
":",
"param",
"vhost",
":",
"The",
"vhost",
"to",
"assign",
"the",
"permission",
"to",
":",
"type",
"vhost",
":",
"str"
] | ff65054115f19991da153f0e4f4e45e526545fea | https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/api.py#L429-L460 | train | Creates a user permission. |
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 | Returns a list of all policies for a vhost. |
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 | Get a specific policy for a vhost. |
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 | Creates a policy for a vhost. |
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 | Delete a specific policy for a vhost. |
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 | Check if a vhost is alive. |
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 | Write from database to file. |
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 | Returns the WMS dataset as a gridded time stamped KML string. |
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 | Returns the WMS dataset as a PNG time stamped KMZ ArcGIS image. |
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 | Method to read from WMS Dataset File Method to set properties of the object. |
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 | Method to write the contents of the object to File Method to File Method |
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 | Retrieve the WMS Raster as a string in the WMS Dataset format |
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 | Make sure that there are no random artifacts in the file. |
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 | Get a batch of inputs and outputs from a list of sentences. |
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 | Simple wrapper of model. fit. |
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 | Get layers that output the Bi - LM feature. |
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 | This method is called by the Asterisk class to attempt to join a node. |
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 | NWSRFS Write to File Method |
CI-WATER/gsshapy | gsshapy/orm/snw.py | OrographicGageFile._read | def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile):
"""
Orographic Gage File Read from File Method
"""
# Set file extension property
self.fileExtension = extension
# Open file and parse into HmetRecords
... | python | def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile):
"""
Orographic Gage File Read from File Method
"""
# Set file extension property
self.fileExtension = extension
# Open file and parse into HmetRecords
... | [
"def",
"_read",
"(",
"self",
",",
"directory",
",",
"filename",
",",
"session",
",",
"path",
",",
"name",
",",
"extension",
",",
"spatial",
",",
"spatialReferenceID",
",",
"replaceParamFile",
")",
":",
"# Set file extension property",
"self",
".",
"fileExtension... | Orographic Gage File Read from File Method | [
"Orographic",
"Gage",
"File",
"Read",
"from",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/snw.py#L211-L244 | train | Method to read from file and populate the internal state of the object. |
CI-WATER/gsshapy | gsshapy/orm/snw.py | OrographicGageFile._write | def _write(self, session, openFile, replaceParamFile):
"""
Orographic Gage File Write to File Method
"""
# Write lines
openFile.write('Num_Sites: %s\n' % self.numSites)
openFile.write('Elev_Base %s\n' % self.elevBase)
openFile.write('Elev_2 %s\n' % s... | python | def _write(self, session, openFile, replaceParamFile):
"""
Orographic Gage File Write to File Method
"""
# Write lines
openFile.write('Num_Sites: %s\n' % self.numSites)
openFile.write('Elev_Base %s\n' % self.elevBase)
openFile.write('Elev_2 %s\n' % s... | [
"def",
"_write",
"(",
"self",
",",
"session",
",",
"openFile",
",",
"replaceParamFile",
")",
":",
"# Write lines",
"openFile",
".",
"write",
"(",
"'Num_Sites: %s\\n'",
"%",
"self",
".",
"numSites",
")",
"openFile",
".",
"write",
"(",
"'Elev_Base %s\\n'",
... | Orographic Gage File Write to File Method | [
"Orographic",
"Gage",
"File",
"Write",
"to",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/snw.py#L246-L270 | train | Method to write the Orographic Gage File |
CI-WATER/gsshapy | gsshapy/orm/cif.py | ChannelInputFile.getFluvialLinks | def getFluvialLinks(self):
"""
Retrieve only the links that represent fluvial portions of the stream. Returns a list of StreamLink instances.
Returns:
list: A list of fluvial :class:`.StreamLink` objects.
"""
# Define fluvial types
fluvialTypeKeywords = ('TRA... | python | def getFluvialLinks(self):
"""
Retrieve only the links that represent fluvial portions of the stream. Returns a list of StreamLink instances.
Returns:
list: A list of fluvial :class:`.StreamLink` objects.
"""
# Define fluvial types
fluvialTypeKeywords = ('TRA... | [
"def",
"getFluvialLinks",
"(",
"self",
")",
":",
"# Define fluvial types",
"fluvialTypeKeywords",
"=",
"(",
"'TRAPEZOID'",
",",
"'TRAP'",
",",
"'BREAKPOINT'",
",",
"'ERODE'",
",",
"'SUBSURFACE'",
")",
"fluvialLinks",
"=",
"[",
"]",
"for",
"link",
"in",
"self",
... | Retrieve only the links that represent fluvial portions of the stream. Returns a list of StreamLink instances.
Returns:
list: A list of fluvial :class:`.StreamLink` objects. | [
"Retrieve",
"only",
"the",
"links",
"that",
"represent",
"fluvial",
"portions",
"of",
"the",
"stream",
".",
"Returns",
"a",
"list",
"of",
"StreamLink",
"instances",
"."
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/cif.py#L93-L111 | train | Retrieve only the links that represent fluvial portions of the stream. Returns a list of StreamLink instances. |
CI-WATER/gsshapy | gsshapy/orm/cif.py | ChannelInputFile.getOrderedLinks | def getOrderedLinks(self, session):
"""
Retrieve the links in the order of the link number.
Args:
session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled database.
Returns:
list: A list of :class:`.StreamLink` objects.... | python | def getOrderedLinks(self, session):
"""
Retrieve the links in the order of the link number.
Args:
session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled database.
Returns:
list: A list of :class:`.StreamLink` objects.... | [
"def",
"getOrderedLinks",
"(",
"self",
",",
"session",
")",
":",
"streamLinks",
"=",
"session",
".",
"query",
"(",
"StreamLink",
")",
".",
"filter",
"(",
"StreamLink",
".",
"channelInputFile",
"==",
"self",
")",
".",
"order_by",
"(",
"StreamLink",
".",
"li... | Retrieve the links in the order of the link number.
Args:
session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled database.
Returns:
list: A list of :class:`.StreamLink` objects. | [
"Retrieve",
"the",
"links",
"in",
"the",
"order",
"of",
"the",
"link",
"number",
"."
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/cif.py#L113-L128 | train | Retrieve the links in the order of the link number. |
CI-WATER/gsshapy | gsshapy/orm/cif.py | ChannelInputFile.getStreamNetworkAsKml | def getStreamNetworkAsKml(self, session, path=None, documentName='Stream Network', withNodes=False, styles={}):
"""
Retrieve the stream network visualization in KML format.
Args:
session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled data... | python | def getStreamNetworkAsKml(self, session, path=None, documentName='Stream Network', withNodes=False, styles={}):
"""
Retrieve the stream network visualization in KML format.
Args:
session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled data... | [
"def",
"getStreamNetworkAsKml",
"(",
"self",
",",
"session",
",",
"path",
"=",
"None",
",",
"documentName",
"=",
"'Stream Network'",
",",
"withNodes",
"=",
"False",
",",
"styles",
"=",
"{",
"}",
")",
":",
"# Retrieve Stream Links",
"links",
"=",
"self",
".",... | Retrieve the stream network visualization in KML format.
Args:
session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled database
path (str, optional): Path to file where KML will be written. Defaults to None.
documentName (str, opti... | [
"Retrieve",
"the",
"stream",
"network",
"visualization",
"in",
"KML",
"format",
"."
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/cif.py#L132-L301 | train | Returns the stream network visualization in KML format. |
CI-WATER/gsshapy | gsshapy/orm/cif.py | ChannelInputFile.getStreamNetworkAsWkt | def getStreamNetworkAsWkt(self, session, withNodes=True):
"""
Retrieve the stream network geometry in Well Known Text format.
Args:
session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled database
withNodes (bool, optional): In... | python | def getStreamNetworkAsWkt(self, session, withNodes=True):
"""
Retrieve the stream network geometry in Well Known Text format.
Args:
session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled database
withNodes (bool, optional): In... | [
"def",
"getStreamNetworkAsWkt",
"(",
"self",
",",
"session",
",",
"withNodes",
"=",
"True",
")",
":",
"wkt_list",
"=",
"[",
"]",
"for",
"link",
"in",
"self",
".",
"streamLinks",
":",
"wkt_link",
"=",
"link",
".",
"getAsWkt",
"(",
"session",
")",
"if",
... | Retrieve the stream network geometry in Well Known Text format.
Args:
session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled database
withNodes (bool, optional): Include nodes. Defaults to False.
Returns:
str: Well Known ... | [
"Retrieve",
"the",
"stream",
"network",
"geometry",
"in",
"Well",
"Known",
"Text",
"format",
"."
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/cif.py#L303-L329 | train | Retrieve the stream network geometry in Well Known Text format. |
CI-WATER/gsshapy | gsshapy/orm/cif.py | ChannelInputFile.getStreamNetworkAsGeoJson | def getStreamNetworkAsGeoJson(self, session, withNodes=True):
"""
Retrieve the stream network geometry in GeoJSON format.
Args:
session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled database
withNodes (bool, optional): Includ... | python | def getStreamNetworkAsGeoJson(self, session, withNodes=True):
"""
Retrieve the stream network geometry in GeoJSON format.
Args:
session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled database
withNodes (bool, optional): Includ... | [
"def",
"getStreamNetworkAsGeoJson",
"(",
"self",
",",
"session",
",",
"withNodes",
"=",
"True",
")",
":",
"features_list",
"=",
"[",
"]",
"# Assemble link features",
"for",
"link",
"in",
"self",
".",
"streamLinks",
":",
"link_geoJson",
"=",
"link",
".",
"getAs... | Retrieve the stream network geometry in GeoJSON format.
Args:
session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled database
withNodes (bool, optional): Include nodes. Defaults to False.
Returns:
str: GeoJSON string. | [
"Retrieve",
"the",
"stream",
"network",
"geometry",
"in",
"GeoJSON",
"format",
"."
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/cif.py#L331-L387 | train | Retrieve the stream network geometry in GeoJSON format. |
CI-WATER/gsshapy | gsshapy/orm/cif.py | ChannelInputFile._read | def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile):
"""
Channel Input File Read from File Method
"""
# Set file extension property
self.fileExtension = extension
# Dictionary of keywords/cards and parse fun... | python | def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile):
"""
Channel Input File Read from File Method
"""
# Set file extension property
self.fileExtension = extension
# Dictionary of keywords/cards and parse fun... | [
"def",
"_read",
"(",
"self",
",",
"directory",
",",
"filename",
",",
"session",
",",
"path",
",",
"name",
",",
"extension",
",",
"spatial",
",",
"spatialReferenceID",
",",
"replaceParamFile",
")",
":",
"# Set file extension property",
"self",
".",
"fileExtension... | Channel Input File Read from File Method | [
"Channel",
"Input",
"File",
"Read",
"from",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/cif.py#L389-L447 | train | Method to read from a Channel Input File |
CI-WATER/gsshapy | gsshapy/orm/cif.py | ChannelInputFile._write | def _write(self, session, openFile, replaceParamFile):
"""
Channel Input File Write to File Method
"""
# Write lines
openFile.write('GSSHA_CHAN\n')
alpha = vwp(self.alpha, replaceParamFile)
try:
openFile.write('ALPHA%s%.6f\n' % (' ' * 7, alpha))
... | python | def _write(self, session, openFile, replaceParamFile):
"""
Channel Input File Write to File Method
"""
# Write lines
openFile.write('GSSHA_CHAN\n')
alpha = vwp(self.alpha, replaceParamFile)
try:
openFile.write('ALPHA%s%.6f\n' % (' ' * 7, alpha))
... | [
"def",
"_write",
"(",
"self",
",",
"session",
",",
"openFile",
",",
"replaceParamFile",
")",
":",
"# Write lines",
"openFile",
".",
"write",
"(",
"'GSSHA_CHAN\\n'",
")",
"alpha",
"=",
"vwp",
"(",
"self",
".",
"alpha",
",",
"replaceParamFile",
")",
"try",
"... | Channel Input File Write to File Method | [
"Channel",
"Input",
"File",
"Write",
"to",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/cif.py#L449-L484 | train | Method to write the channel input file to openFile. |
CI-WATER/gsshapy | gsshapy/orm/cif.py | ChannelInputFile._createLink | def _createLink(self, linkResult, replaceParamFile):
"""
Create GSSHAPY Link Object Method
"""
link = None
# Cases
if linkResult['type'] == 'XSEC':
# Cross section link handler
link = self._createCrossSection(linkResult, replaceParamFile)
... | python | def _createLink(self, linkResult, replaceParamFile):
"""
Create GSSHAPY Link Object Method
"""
link = None
# Cases
if linkResult['type'] == 'XSEC':
# Cross section link handler
link = self._createCrossSection(linkResult, replaceParamFile)
... | [
"def",
"_createLink",
"(",
"self",
",",
"linkResult",
",",
"replaceParamFile",
")",
":",
"link",
"=",
"None",
"# Cases",
"if",
"linkResult",
"[",
"'type'",
"]",
"==",
"'XSEC'",
":",
"# Cross section link handler",
"link",
"=",
"self",
".",
"_createCrossSection",... | Create GSSHAPY Link Object Method | [
"Create",
"GSSHAPY",
"Link",
"Object",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/cif.py#L486-L505 | train | Create GSSHAPY Link Object Method Method |
CI-WATER/gsshapy | gsshapy/orm/cif.py | ChannelInputFile._createConnectivity | def _createConnectivity(self, linkList, connectList):
"""
Create GSSHAPY Connect Object Method
"""
# Create StreamLink-Connectivity Pairs
for idx, link in enumerate(linkList):
connectivity = connectList[idx]
# Initialize GSSHAPY UpstreamLink objects
... | python | def _createConnectivity(self, linkList, connectList):
"""
Create GSSHAPY Connect Object Method
"""
# Create StreamLink-Connectivity Pairs
for idx, link in enumerate(linkList):
connectivity = connectList[idx]
# Initialize GSSHAPY UpstreamLink objects
... | [
"def",
"_createConnectivity",
"(",
"self",
",",
"linkList",
",",
"connectList",
")",
":",
"# Create StreamLink-Connectivity Pairs",
"for",
"idx",
",",
"link",
"in",
"enumerate",
"(",
"linkList",
")",
":",
"connectivity",
"=",
"connectList",
"[",
"idx",
"]",
"# I... | Create GSSHAPY Connect Object Method | [
"Create",
"GSSHAPY",
"Connect",
"Object",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/cif.py#L508-L524 | train | Create GSSHAPY Connect Object Method Method |
CI-WATER/gsshapy | gsshapy/orm/cif.py | ChannelInputFile._createCrossSection | def _createCrossSection(self, linkResult, replaceParamFile):
"""
Create GSSHAPY Cross Section Objects Method
"""
# Extract header variables from link result object
header = linkResult['header']
# Initialize GSSHAPY StreamLink object
link = StreamLink(linkNumber=i... | python | def _createCrossSection(self, linkResult, replaceParamFile):
"""
Create GSSHAPY Cross Section Objects Method
"""
# Extract header variables from link result object
header = linkResult['header']
# Initialize GSSHAPY StreamLink object
link = StreamLink(linkNumber=i... | [
"def",
"_createCrossSection",
"(",
"self",
",",
"linkResult",
",",
"replaceParamFile",
")",
":",
"# Extract header variables from link result object",
"header",
"=",
"linkResult",
"[",
"'header'",
"]",
"# Initialize GSSHAPY StreamLink object",
"link",
"=",
"StreamLink",
"("... | Create GSSHAPY Cross Section Objects Method | [
"Create",
"GSSHAPY",
"Cross",
"Section",
"Objects",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/cif.py#L527-L599 | train | Create GSSHAPY Cross Section Objects Method |
CI-WATER/gsshapy | gsshapy/orm/cif.py | ChannelInputFile._createStructure | def _createStructure(self, linkResult, replaceParamFile):
"""
Create GSSHAPY Structure Objects Method
"""
# Constants
WEIRS = ('WEIR', 'SAG_WEIR')
CULVERTS = ('ROUND_CULVERT', 'RECT_CULVERT')
CURVES = ('RATING_CURVE', 'SCHEDULED_RELEASE', 'RULE_CURVE')
... | python | def _createStructure(self, linkResult, replaceParamFile):
"""
Create GSSHAPY Structure Objects Method
"""
# Constants
WEIRS = ('WEIR', 'SAG_WEIR')
CULVERTS = ('ROUND_CULVERT', 'RECT_CULVERT')
CURVES = ('RATING_CURVE', 'SCHEDULED_RELEASE', 'RULE_CURVE')
... | [
"def",
"_createStructure",
"(",
"self",
",",
"linkResult",
",",
"replaceParamFile",
")",
":",
"# Constants",
"WEIRS",
"=",
"(",
"'WEIR'",
",",
"'SAG_WEIR'",
")",
"CULVERTS",
"=",
"(",
"'ROUND_CULVERT'",
",",
"'RECT_CULVERT'",
")",
"CURVES",
"=",
"(",
"'RATING_... | Create GSSHAPY Structure Objects Method | [
"Create",
"GSSHAPY",
"Structure",
"Objects",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/cif.py#L601-L664 | train | Create GSSHAPY Structure Objects Method |
CI-WATER/gsshapy | gsshapy/orm/cif.py | ChannelInputFile._createGeometry | def _createGeometry(self, session, spatialReferenceID):
"""
Create PostGIS geometric objects
"""
# Flush the current session
session.flush()
# Create geometry for each fluvial link
for link in self.getFluvialLinks():
# Retrieve the nodes for each lin... | python | def _createGeometry(self, session, spatialReferenceID):
"""
Create PostGIS geometric objects
"""
# Flush the current session
session.flush()
# Create geometry for each fluvial link
for link in self.getFluvialLinks():
# Retrieve the nodes for each lin... | [
"def",
"_createGeometry",
"(",
"self",
",",
"session",
",",
"spatialReferenceID",
")",
":",
"# Flush the current session",
"session",
".",
"flush",
"(",
")",
"# Create geometry for each fluvial link",
"for",
"link",
"in",
"self",
".",
"getFluvialLinks",
"(",
")",
":... | Create PostGIS geometric objects | [
"Create",
"PostGIS",
"geometric",
"objects"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/cif.py#L715-L755 | train | Create postGIS geometric objects for fluvial objects. |
CI-WATER/gsshapy | gsshapy/orm/cif.py | ChannelInputFile._writeConnectivity | def _writeConnectivity(self, links, fileObject):
"""
Write Connectivity Lines to File Method
"""
for link in links:
linkNum = link.linkNumber
downLink = link.downstreamLinkID
numUpLinks = link.numUpstreamLinks
upLinks = ''
for u... | python | def _writeConnectivity(self, links, fileObject):
"""
Write Connectivity Lines to File Method
"""
for link in links:
linkNum = link.linkNumber
downLink = link.downstreamLinkID
numUpLinks = link.numUpstreamLinks
upLinks = ''
for u... | [
"def",
"_writeConnectivity",
"(",
"self",
",",
"links",
",",
"fileObject",
")",
":",
"for",
"link",
"in",
"links",
":",
"linkNum",
"=",
"link",
".",
"linkNumber",
"downLink",
"=",
"link",
".",
"downstreamLinkID",
"numUpLinks",
"=",
"link",
".",
"numUpstreamL... | Write Connectivity Lines to File Method | [
"Write",
"Connectivity",
"Lines",
"to",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/cif.py#L757-L771 | train | Writes Connectivity Lines to File Method
|
CI-WATER/gsshapy | gsshapy/orm/cif.py | ChannelInputFile._writeLinks | def _writeLinks(self, links, fileObject, replaceParamFile):
"""
Write Link Lines to File Method
"""
for link in links:
linkType = link.type
fileObject.write('LINK %s\n' % link.linkNumber)
# Cases
if 'TRAP' in linkType or 'TRAPEZO... | python | def _writeLinks(self, links, fileObject, replaceParamFile):
"""
Write Link Lines to File Method
"""
for link in links:
linkType = link.type
fileObject.write('LINK %s\n' % link.linkNumber)
# Cases
if 'TRAP' in linkType or 'TRAPEZO... | [
"def",
"_writeLinks",
"(",
"self",
",",
"links",
",",
"fileObject",
",",
"replaceParamFile",
")",
":",
"for",
"link",
"in",
"links",
":",
"linkType",
"=",
"link",
".",
"type",
"fileObject",
".",
"write",
"(",
"'LINK %s\\n'",
"%",
"link",
".",
"li... | Write Link Lines to File Method | [
"Write",
"Link",
"Lines",
"to",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/cif.py#L773-L794 | train | Write Link Lines to File Method
|
CI-WATER/gsshapy | gsshapy/orm/cif.py | ChannelInputFile._writeReservoirLink | def _writeReservoirLink(self, link, fileObject, replaceParamFile):
"""
Write Reservoir/Lake Link to File Method
"""
fileObject.write('%s\n' % link.type)
# Retrieve reservoir
reservoir = link.reservoir
# Reservoir parameters
initWSE = vwp(reservoir.initWS... | python | def _writeReservoirLink(self, link, fileObject, replaceParamFile):
"""
Write Reservoir/Lake Link to File Method
"""
fileObject.write('%s\n' % link.type)
# Retrieve reservoir
reservoir = link.reservoir
# Reservoir parameters
initWSE = vwp(reservoir.initWS... | [
"def",
"_writeReservoirLink",
"(",
"self",
",",
"link",
",",
"fileObject",
",",
"replaceParamFile",
")",
":",
"fileObject",
".",
"write",
"(",
"'%s\\n'",
"%",
"link",
".",
"type",
")",
"# Retrieve reservoir",
"reservoir",
"=",
"link",
".",
"reservoir",
"# Rese... | Write Reservoir/Lake Link to File Method | [
"Write",
"Reservoir",
"/",
"Lake",
"Link",
"to",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/cif.py#L796-L860 | train | Write Reservoir Link to File Method |
CI-WATER/gsshapy | gsshapy/orm/cif.py | ChannelInputFile._writeStructureLink | def _writeStructureLink(self, link, fileObject, replaceParamFile):
"""
Write Structure Link to File Method
"""
fileObject.write('%s\n' % link.type)
fileObject.write('NUMSTRUCTS %s\n' % link.numElements)
# Retrieve lists of structures
weirs = link.weirs
... | python | def _writeStructureLink(self, link, fileObject, replaceParamFile):
"""
Write Structure Link to File Method
"""
fileObject.write('%s\n' % link.type)
fileObject.write('NUMSTRUCTS %s\n' % link.numElements)
# Retrieve lists of structures
weirs = link.weirs
... | [
"def",
"_writeStructureLink",
"(",
"self",
",",
"link",
",",
"fileObject",
",",
"replaceParamFile",
")",
":",
"fileObject",
".",
"write",
"(",
"'%s\\n'",
"%",
"link",
".",
"type",
")",
"fileObject",
".",
"write",
"(",
"'NUMSTRUCTS %s\\n'",
"%",
"link",
"... | Write Structure Link to File Method | [
"Write",
"Structure",
"Link",
"to",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/cif.py#L863-L1001 | train | Write Structure Link to File Method |
CI-WATER/gsshapy | gsshapy/orm/cif.py | ChannelInputFile._writeCrossSectionLink | def _writeCrossSectionLink(self, link, fileObject, replaceParamFile):
"""
Write Cross Section Link to File Method
"""
linkType = link.type
# Write cross section link header
dx = vwp(link.dx, replaceParamFile)
try:
fileObject.write('DX %.6f... | python | def _writeCrossSectionLink(self, link, fileObject, replaceParamFile):
"""
Write Cross Section Link to File Method
"""
linkType = link.type
# Write cross section link header
dx = vwp(link.dx, replaceParamFile)
try:
fileObject.write('DX %.6f... | [
"def",
"_writeCrossSectionLink",
"(",
"self",
",",
"link",
",",
"fileObject",
",",
"replaceParamFile",
")",
":",
"linkType",
"=",
"link",
".",
"type",
"# Write cross section link header",
"dx",
"=",
"vwp",
"(",
"link",
".",
"dx",
",",
"replaceParamFile",
")",
... | Write Cross Section Link to File Method | [
"Write",
"Cross",
"Section",
"Link",
"to",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/cif.py#L1003-L1085 | train | Write Cross Section Link to File Method |
CI-WATER/gsshapy | gsshapy/orm/cif.py | ChannelInputFile._writeOptionalXsecCards | def _writeOptionalXsecCards(self, fileObject, xSec, replaceParamFile):
"""
Write Optional Cross Section Cards to File Method
"""
if xSec.erode:
fileObject.write('ERODE\n')
if xSec.maxErosion != None:
fileObject.write('MAX_EROSION %.6f\n' % xSec.maxEros... | python | def _writeOptionalXsecCards(self, fileObject, xSec, replaceParamFile):
"""
Write Optional Cross Section Cards to File Method
"""
if xSec.erode:
fileObject.write('ERODE\n')
if xSec.maxErosion != None:
fileObject.write('MAX_EROSION %.6f\n' % xSec.maxEros... | [
"def",
"_writeOptionalXsecCards",
"(",
"self",
",",
"fileObject",
",",
"xSec",
",",
"replaceParamFile",
")",
":",
"if",
"xSec",
".",
"erode",
":",
"fileObject",
".",
"write",
"(",
"'ERODE\\n'",
")",
"if",
"xSec",
".",
"maxErosion",
"!=",
"None",
":",
"file... | Write Optional Cross Section Cards to File Method | [
"Write",
"Optional",
"Cross",
"Section",
"Cards",
"to",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/cif.py#L1087-L1112 | train | Write Optional Cross Section Cards to File Method |
CI-WATER/gsshapy | gsshapy/modeling/framework.py | replace_file | def replace_file(from_file, to_file):
"""
Replaces to_file with from_file
"""
try:
os.remove(to_file)
except OSError:
pass
copy(from_file, to_file) | python | def replace_file(from_file, to_file):
"""
Replaces to_file with from_file
"""
try:
os.remove(to_file)
except OSError:
pass
copy(from_file, to_file) | [
"def",
"replace_file",
"(",
"from_file",
",",
"to_file",
")",
":",
"try",
":",
"os",
".",
"remove",
"(",
"to_file",
")",
"except",
"OSError",
":",
"pass",
"copy",
"(",
"from_file",
",",
"to_file",
")"
] | Replaces to_file with from_file | [
"Replaces",
"to_file",
"with",
"from_file"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/modeling/framework.py#L29-L37 | train | Replaces from_file with to_file |
CI-WATER/gsshapy | gsshapy/modeling/framework.py | GSSHAFramework._prepare_lsm_gag | def _prepare_lsm_gag(self):
"""
Determines whether to prepare gage data from LSM
"""
lsm_required_vars = (self.lsm_precip_data_var,
self.lsm_precip_type)
return self.lsm_input_valid and (None not in lsm_required_vars) | python | def _prepare_lsm_gag(self):
"""
Determines whether to prepare gage data from LSM
"""
lsm_required_vars = (self.lsm_precip_data_var,
self.lsm_precip_type)
return self.lsm_input_valid and (None not in lsm_required_vars) | [
"def",
"_prepare_lsm_gag",
"(",
"self",
")",
":",
"lsm_required_vars",
"=",
"(",
"self",
".",
"lsm_precip_data_var",
",",
"self",
".",
"lsm_precip_type",
")",
"return",
"self",
".",
"lsm_input_valid",
"and",
"(",
"None",
"not",
"in",
"lsm_required_vars",
")"
] | Determines whether to prepare gage data from LSM | [
"Determines",
"whether",
"to",
"prepare",
"gage",
"data",
"from",
"LSM"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/modeling/framework.py#L338-L345 | train | Determines whether to prepare gage data from LSM. |
CI-WATER/gsshapy | gsshapy/modeling/framework.py | GSSHAFramework._update_card_file_location | def _update_card_file_location(self, card_name, new_directory):
"""
Moves card to new gssha working directory
"""
with tmp_chdir(self.gssha_directory):
file_card = self.project_manager.getCard(card_name)
if file_card:
if file_card.value:
... | python | def _update_card_file_location(self, card_name, new_directory):
"""
Moves card to new gssha working directory
"""
with tmp_chdir(self.gssha_directory):
file_card = self.project_manager.getCard(card_name)
if file_card:
if file_card.value:
... | [
"def",
"_update_card_file_location",
"(",
"self",
",",
"card_name",
",",
"new_directory",
")",
":",
"with",
"tmp_chdir",
"(",
"self",
".",
"gssha_directory",
")",
":",
"file_card",
"=",
"self",
".",
"project_manager",
".",
"getCard",
"(",
"card_name",
")",
"if... | Moves card to new gssha working directory | [
"Moves",
"card",
"to",
"new",
"gssha",
"working",
"directory"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/modeling/framework.py#L366-L382 | train | Updates the file location of the card to new directory. |
CI-WATER/gsshapy | gsshapy/modeling/framework.py | GSSHAFramework.download_spt_forecast | def download_spt_forecast(self, extract_directory):
"""
Downloads Streamflow Prediction Tool forecast data
"""
needed_vars = (self.spt_watershed_name,
self.spt_subbasin_name,
self.spt_forecast_date_string,
self.ckan_eng... | python | def download_spt_forecast(self, extract_directory):
"""
Downloads Streamflow Prediction Tool forecast data
"""
needed_vars = (self.spt_watershed_name,
self.spt_subbasin_name,
self.spt_forecast_date_string,
self.ckan_eng... | [
"def",
"download_spt_forecast",
"(",
"self",
",",
"extract_directory",
")",
":",
"needed_vars",
"=",
"(",
"self",
".",
"spt_watershed_name",
",",
"self",
".",
"spt_subbasin_name",
",",
"self",
".",
"spt_forecast_date_string",
",",
"self",
".",
"ckan_engine_url",
"... | Downloads Streamflow Prediction Tool forecast data | [
"Downloads",
"Streamflow",
"Prediction",
"Tool",
"forecast",
"data"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/modeling/framework.py#L384-L414 | train | Downloads the streamflow prediction tool forecast data from the specified extract directory. |
CI-WATER/gsshapy | gsshapy/modeling/framework.py | GSSHAFramework.prepare_hmet | def prepare_hmet(self):
"""
Prepare HMET data for simulation
"""
if self._prepare_lsm_hmet:
netcdf_file_path = None
hmet_ascii_output_folder = None
if self.output_netcdf:
netcdf_file_path = '{0}_hmet.nc'.format(self.project_manager.name... | python | def prepare_hmet(self):
"""
Prepare HMET data for simulation
"""
if self._prepare_lsm_hmet:
netcdf_file_path = None
hmet_ascii_output_folder = None
if self.output_netcdf:
netcdf_file_path = '{0}_hmet.nc'.format(self.project_manager.name... | [
"def",
"prepare_hmet",
"(",
"self",
")",
":",
"if",
"self",
".",
"_prepare_lsm_hmet",
":",
"netcdf_file_path",
"=",
"None",
"hmet_ascii_output_folder",
"=",
"None",
"if",
"self",
".",
"output_netcdf",
":",
"netcdf_file_path",
"=",
"'{0}_hmet.nc'",
".",
"format",
... | Prepare HMET data for simulation | [
"Prepare",
"HMET",
"data",
"for",
"simulation"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/modeling/framework.py#L416-L438 | train | Prepare HMET data for simulation |
CI-WATER/gsshapy | gsshapy/modeling/framework.py | GSSHAFramework.prepare_gag | def prepare_gag(self):
"""
Prepare gage data for simulation
"""
if self._prepare_lsm_gag:
self.event_manager.prepare_gag_lsm(self.lsm_precip_data_var,
self.lsm_precip_type,
self.prec... | python | def prepare_gag(self):
"""
Prepare gage data for simulation
"""
if self._prepare_lsm_gag:
self.event_manager.prepare_gag_lsm(self.lsm_precip_data_var,
self.lsm_precip_type,
self.prec... | [
"def",
"prepare_gag",
"(",
"self",
")",
":",
"if",
"self",
".",
"_prepare_lsm_gag",
":",
"self",
".",
"event_manager",
".",
"prepare_gag_lsm",
"(",
"self",
".",
"lsm_precip_data_var",
",",
"self",
".",
"lsm_precip_type",
",",
"self",
".",
"precip_interpolation_t... | Prepare gage data for simulation | [
"Prepare",
"gage",
"data",
"for",
"simulation"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/modeling/framework.py#L440-L450 | train | Prepare gage data for simulation |
CI-WATER/gsshapy | gsshapy/modeling/framework.py | GSSHAFramework.rapid_to_gssha | def rapid_to_gssha(self):
"""
Prepare RAPID data for simulation
"""
# if no streamflow given, download forecast
if self.path_to_rapid_qout is None and self.connection_list_file:
rapid_qout_directory = os.path.join(self.gssha_directory, 'rapid_streamflow')
... | python | def rapid_to_gssha(self):
"""
Prepare RAPID data for simulation
"""
# if no streamflow given, download forecast
if self.path_to_rapid_qout is None and self.connection_list_file:
rapid_qout_directory = os.path.join(self.gssha_directory, 'rapid_streamflow')
... | [
"def",
"rapid_to_gssha",
"(",
"self",
")",
":",
"# if no streamflow given, download forecast",
"if",
"self",
".",
"path_to_rapid_qout",
"is",
"None",
"and",
"self",
".",
"connection_list_file",
":",
"rapid_qout_directory",
"=",
"os",
".",
"path",
".",
"join",
"(",
... | Prepare RAPID data for simulation | [
"Prepare",
"RAPID",
"data",
"for",
"simulation"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/modeling/framework.py#L452-L469 | train | Prepare RAPID data for simulation and GSSHA. |
CI-WATER/gsshapy | gsshapy/modeling/framework.py | GSSHAFramework.hotstart | def hotstart(self):
"""
Prepare simulation hotstart info
"""
if self.write_hotstart:
hotstart_time_str = self.event_manager.simulation_end.strftime("%Y%m%d_%H%M")
try:
os.mkdir('hotstart')
except OSError:
pass
... | python | def hotstart(self):
"""
Prepare simulation hotstart info
"""
if self.write_hotstart:
hotstart_time_str = self.event_manager.simulation_end.strftime("%Y%m%d_%H%M")
try:
os.mkdir('hotstart')
except OSError:
pass
... | [
"def",
"hotstart",
"(",
"self",
")",
":",
"if",
"self",
".",
"write_hotstart",
":",
"hotstart_time_str",
"=",
"self",
".",
"event_manager",
".",
"simulation_end",
".",
"strftime",
"(",
"\"%Y%m%d_%H%M\"",
")",
"try",
":",
"os",
".",
"mkdir",
"(",
"'hotstart'"... | Prepare simulation hotstart info | [
"Prepare",
"simulation",
"hotstart",
"info"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/modeling/framework.py#L471-L533 | train | Prepare simulation hotstart info |
CI-WATER/gsshapy | gsshapy/modeling/framework.py | GSSHAFramework.run | def run(self, subdirectory=None):
"""
Write out project file and run GSSHA simulation
"""
with tmp_chdir(self.gssha_directory):
if self.hotstart_minimal_mode:
# remove all optional output cards
for gssha_optional_output_card in self.GSSHA_OPTIO... | python | def run(self, subdirectory=None):
"""
Write out project file and run GSSHA simulation
"""
with tmp_chdir(self.gssha_directory):
if self.hotstart_minimal_mode:
# remove all optional output cards
for gssha_optional_output_card in self.GSSHA_OPTIO... | [
"def",
"run",
"(",
"self",
",",
"subdirectory",
"=",
"None",
")",
":",
"with",
"tmp_chdir",
"(",
"self",
".",
"gssha_directory",
")",
":",
"if",
"self",
".",
"hotstart_minimal_mode",
":",
"# remove all optional output cards",
"for",
"gssha_optional_output_card",
"... | Write out project file and run GSSHA simulation | [
"Write",
"out",
"project",
"file",
"and",
"run",
"GSSHA",
"simulation"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/modeling/framework.py#L535-L674 | train | Runs GSSHA simulation and returns a new instance of IProjectFile. |
CI-WATER/gsshapy | gsshapy/modeling/framework.py | GSSHAFramework.run_forecast | def run_forecast(self):
"""
Updates card & runs for RAPID to GSSHA & LSM to GSSHA
"""
# ----------------------------------------------------------------------
# LSM to GSSHA
# ----------------------------------------------------------------------
self.prepare_hme... | python | def run_forecast(self):
"""
Updates card & runs for RAPID to GSSHA & LSM to GSSHA
"""
# ----------------------------------------------------------------------
# LSM to GSSHA
# ----------------------------------------------------------------------
self.prepare_hme... | [
"def",
"run_forecast",
"(",
"self",
")",
":",
"# ----------------------------------------------------------------------",
"# LSM to GSSHA",
"# ----------------------------------------------------------------------",
"self",
".",
"prepare_hmet",
"(",
")",
"self",
".",
"prepare_gag",
... | Updates card & runs for RAPID to GSSHA & LSM to GSSHA | [
"Updates",
"card",
"&",
"runs",
"for",
"RAPID",
"to",
"GSSHA",
"&",
"LSM",
"to",
"GSSHA"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/modeling/framework.py#L676-L700 | train | Runs the forecast for the current set of dates. |
nephila/djangocms-page-tags | djangocms_page_tags/utils.py | get_cache_key | def get_cache_key(request, page, lang, site_id, title):
"""
Create the cache key for the current page and tag type
"""
from cms.cache import _get_cache_key
from cms.templatetags.cms_tags import _get_page_by_untyped_arg
from cms.models import Page
if not isinstance(page, Page):
page ... | python | def get_cache_key(request, page, lang, site_id, title):
"""
Create the cache key for the current page and tag type
"""
from cms.cache import _get_cache_key
from cms.templatetags.cms_tags import _get_page_by_untyped_arg
from cms.models import Page
if not isinstance(page, Page):
page ... | [
"def",
"get_cache_key",
"(",
"request",
",",
"page",
",",
"lang",
",",
"site_id",
",",
"title",
")",
":",
"from",
"cms",
".",
"cache",
"import",
"_get_cache_key",
"from",
"cms",
".",
"templatetags",
".",
"cms_tags",
"import",
"_get_page_by_untyped_arg",
"from"... | Create the cache key for the current page and tag type | [
"Create",
"the",
"cache",
"key",
"for",
"the",
"current",
"page",
"and",
"tag",
"type"
] | 602c9d74456d689f46ddb8d67cd64d1a42747359 | https://github.com/nephila/djangocms-page-tags/blob/602c9d74456d689f46ddb8d67cd64d1a42747359/djangocms_page_tags/utils.py#L5-L23 | train | Create the cache key for the current page and tag type |
nephila/djangocms-page-tags | djangocms_page_tags/utils.py | get_page_tags | def get_page_tags(page):
"""
Retrieves all the tags for a Page instance.
:param page: a Page instance
:return: list or queryset of attached tags
:type: List
"""
from .models import PageTags
try:
return page.pagetags.tags.all()
except PageTags.DoesNotExist:
return [] | python | def get_page_tags(page):
"""
Retrieves all the tags for a Page instance.
:param page: a Page instance
:return: list or queryset of attached tags
:type: List
"""
from .models import PageTags
try:
return page.pagetags.tags.all()
except PageTags.DoesNotExist:
return [] | [
"def",
"get_page_tags",
"(",
"page",
")",
":",
"from",
".",
"models",
"import",
"PageTags",
"try",
":",
"return",
"page",
".",
"pagetags",
".",
"tags",
".",
"all",
"(",
")",
"except",
"PageTags",
".",
"DoesNotExist",
":",
"return",
"[",
"]"
] | Retrieves all the tags for a Page instance.
:param page: a Page instance
:return: list or queryset of attached tags
:type: List | [
"Retrieves",
"all",
"the",
"tags",
"for",
"a",
"Page",
"instance",
"."
] | 602c9d74456d689f46ddb8d67cd64d1a42747359 | https://github.com/nephila/djangocms-page-tags/blob/602c9d74456d689f46ddb8d67cd64d1a42747359/djangocms_page_tags/utils.py#L26-L39 | train | Returns all the tags attached to a Page instance. |
nephila/djangocms-page-tags | djangocms_page_tags/utils.py | page_has_tag | def page_has_tag(page, tag):
"""
Check if a Page object is associated with the given tag.
:param page: a Page instance
:param tag: a Tag instance or a slug string.
:return: whether the Page instance has the given tag attached (False if no Page or no
attached PageTags exists)
:type... | python | def page_has_tag(page, tag):
"""
Check if a Page object is associated with the given tag.
:param page: a Page instance
:param tag: a Tag instance or a slug string.
:return: whether the Page instance has the given tag attached (False if no Page or no
attached PageTags exists)
:type... | [
"def",
"page_has_tag",
"(",
"page",
",",
"tag",
")",
":",
"from",
".",
"models",
"import",
"PageTags",
"if",
"hasattr",
"(",
"tag",
",",
"'slug'",
")",
":",
"slug",
"=",
"tag",
".",
"slug",
"else",
":",
"slug",
"=",
"tag",
"try",
":",
"return",
"pa... | Check if a Page object is associated with the given tag.
:param page: a Page instance
:param tag: a Tag instance or a slug string.
:return: whether the Page instance has the given tag attached (False if no Page or no
attached PageTags exists)
:type: Boolean | [
"Check",
"if",
"a",
"Page",
"object",
"is",
"associated",
"with",
"the",
"given",
"tag",
"."
] | 602c9d74456d689f46ddb8d67cd64d1a42747359 | https://github.com/nephila/djangocms-page-tags/blob/602c9d74456d689f46ddb8d67cd64d1a42747359/djangocms_page_tags/utils.py#L42-L61 | train | Checks if a Page object is associated with the given tag. |
nephila/djangocms-page-tags | djangocms_page_tags/utils.py | get_title_tags | def get_title_tags(page, lang):
"""
Retrieves all the tags for a Title (given as page and language).
This function does not use fallbacks to retrieve title object.
:param page: a Page instance
:param lang: a language code
:return: list or queryset of attached tags
:type: List
"""
f... | python | def get_title_tags(page, lang):
"""
Retrieves all the tags for a Title (given as page and language).
This function does not use fallbacks to retrieve title object.
:param page: a Page instance
:param lang: a language code
:return: list or queryset of attached tags
:type: List
"""
f... | [
"def",
"get_title_tags",
"(",
"page",
",",
"lang",
")",
":",
"from",
".",
"models",
"import",
"TitleTags",
"try",
":",
"return",
"page",
".",
"get_title_obj",
"(",
"language",
"=",
"lang",
",",
"fallback",
"=",
"False",
")",
".",
"titletags",
".",
"tags"... | Retrieves all the tags for a Title (given as page and language).
This function does not use fallbacks to retrieve title object.
:param page: a Page instance
:param lang: a language code
:return: list or queryset of attached tags
:type: List | [
"Retrieves",
"all",
"the",
"tags",
"for",
"a",
"Title",
"(",
"given",
"as",
"page",
"and",
"language",
")",
".",
"This",
"function",
"does",
"not",
"use",
"fallbacks",
"to",
"retrieve",
"title",
"object",
"."
] | 602c9d74456d689f46ddb8d67cd64d1a42747359 | https://github.com/nephila/djangocms-page-tags/blob/602c9d74456d689f46ddb8d67cd64d1a42747359/djangocms_page_tags/utils.py#L64-L79 | train | Returns all the tags attached to a Title object. |
nephila/djangocms-page-tags | djangocms_page_tags/utils.py | title_has_tag | def title_has_tag(page, lang, tag):
"""
Check if a Title object is associated with the given tag.
This function does not use fallbacks to retrieve title object.
:param page: a Page instance
:param lang: a language code
:param tag: a Tag instance or a slug string.
:return: whether the Title... | python | def title_has_tag(page, lang, tag):
"""
Check if a Title object is associated with the given tag.
This function does not use fallbacks to retrieve title object.
:param page: a Page instance
:param lang: a language code
:param tag: a Tag instance or a slug string.
:return: whether the Title... | [
"def",
"title_has_tag",
"(",
"page",
",",
"lang",
",",
"tag",
")",
":",
"from",
".",
"models",
"import",
"TitleTags",
"if",
"hasattr",
"(",
"tag",
",",
"'slug'",
")",
":",
"slug",
"=",
"tag",
".",
"slug",
"else",
":",
"slug",
"=",
"tag",
"try",
":"... | Check if a Title object is associated with the given tag.
This function does not use fallbacks to retrieve title object.
:param page: a Page instance
:param lang: a language code
:param tag: a Tag instance or a slug string.
:return: whether the Title instance has the given tag attached (False if n... | [
"Check",
"if",
"a",
"Title",
"object",
"is",
"associated",
"with",
"the",
"given",
"tag",
".",
"This",
"function",
"does",
"not",
"use",
"fallbacks",
"to",
"retrieve",
"title",
"object",
"."
] | 602c9d74456d689f46ddb8d67cd64d1a42747359 | https://github.com/nephila/djangocms-page-tags/blob/602c9d74456d689f46ddb8d67cd64d1a42747359/djangocms_page_tags/utils.py#L82-L105 | train | Check if a Title object is associated with a given tag. |
nephila/djangocms-page-tags | djangocms_page_tags/utils.py | get_page_tags_from_request | def get_page_tags_from_request(request, page_lookup, lang, site, title=False):
"""
Get the list of tags attached to a Page or a Title from a request from usual
`page_lookup` parameters.
:param request: request object
:param page_lookup: a valid page_lookup argument
:param lang: a language code... | python | def get_page_tags_from_request(request, page_lookup, lang, site, title=False):
"""
Get the list of tags attached to a Page or a Title from a request from usual
`page_lookup` parameters.
:param request: request object
:param page_lookup: a valid page_lookup argument
:param lang: a language code... | [
"def",
"get_page_tags_from_request",
"(",
"request",
",",
"page_lookup",
",",
"lang",
",",
"site",
",",
"title",
"=",
"False",
")",
":",
"from",
"cms",
".",
"templatetags",
".",
"cms_tags",
"import",
"_get_page_by_untyped_arg",
"from",
"cms",
".",
"utils",
"im... | Get the list of tags attached to a Page or a Title from a request from usual
`page_lookup` parameters.
:param request: request object
:param page_lookup: a valid page_lookup argument
:param lang: a language code
:param site: a site id
:param title: a boolean to extract the Page (if False) or T... | [
"Get",
"the",
"list",
"of",
"tags",
"attached",
"to",
"a",
"Page",
"or",
"a",
"Title",
"from",
"a",
"request",
"from",
"usual",
"page_lookup",
"parameters",
"."
] | 602c9d74456d689f46ddb8d67cd64d1a42747359 | https://github.com/nephila/djangocms-page-tags/blob/602c9d74456d689f46ddb8d67cd64d1a42747359/djangocms_page_tags/utils.py#L108-L146 | train | Get the list of tags attached to a Page or a Title from a request. |
nephila/djangocms-page-tags | djangocms_page_tags/utils.py | get_title_tags_from_request | def get_title_tags_from_request(request, page_lookup, lang, site):
"""
Get the list of tags attached to a Title from a request from usual
`page_lookup` parameters.
:param request: request object
:param page_lookup: a valid page_lookup argument
:param lang: a language code
:param site: a sit... | python | def get_title_tags_from_request(request, page_lookup, lang, site):
"""
Get the list of tags attached to a Title from a request from usual
`page_lookup` parameters.
:param request: request object
:param page_lookup: a valid page_lookup argument
:param lang: a language code
:param site: a sit... | [
"def",
"get_title_tags_from_request",
"(",
"request",
",",
"page_lookup",
",",
"lang",
",",
"site",
")",
":",
"return",
"get_page_tags_from_request",
"(",
"request",
",",
"page_lookup",
",",
"lang",
",",
"site",
",",
"True",
")"
] | Get the list of tags attached to a Title from a request from usual
`page_lookup` parameters.
:param request: request object
:param page_lookup: a valid page_lookup argument
:param lang: a language code
:param site: a site id
:return: list of tags attached to the given Title
:type: List | [
"Get",
"the",
"list",
"of",
"tags",
"attached",
"to",
"a",
"Title",
"from",
"a",
"request",
"from",
"usual",
"page_lookup",
"parameters",
"."
] | 602c9d74456d689f46ddb8d67cd64d1a42747359 | https://github.com/nephila/djangocms-page-tags/blob/602c9d74456d689f46ddb8d67cd64d1a42747359/djangocms_page_tags/utils.py#L149-L162 | train | Get the list of tags attached to a Title from a request from usual
page_lookup parameters. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.