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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
nickpandolfi/Cyther | cyther/commands.py | processFiles | def processFiles(args):
"""
Generates and error checks each file's information before the compilation actually starts
"""
to_process = []
for filename in args['filenames']:
file = dict()
if args['include']:
file['include'] = INCLUDE_STRING + ''.join(
['-... | python | def processFiles(args):
"""
Generates and error checks each file's information before the compilation actually starts
"""
to_process = []
for filename in args['filenames']:
file = dict()
if args['include']:
file['include'] = INCLUDE_STRING + ''.join(
['-... | [
"def",
"processFiles",
"(",
"args",
")",
":",
"to_process",
"=",
"[",
"]",
"for",
"filename",
"in",
"args",
"[",
"'filenames'",
"]",
":",
"file",
"=",
"dict",
"(",
")",
"if",
"args",
"[",
"'include'",
"]",
":",
"file",
"[",
"'include'",
"]",
"=",
"... | Generates and error checks each file's information before the compilation actually starts | [
"Generates",
"and",
"error",
"checks",
"each",
"file",
"s",
"information",
"before",
"the",
"compilation",
"actually",
"starts"
] | 9fb0bd77af594008aa6ee8af460aa8c953abf5bc | https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/commands.py#L93-L147 | train | Generates and error checks each file in the file list and processes the files. |
nickpandolfi/Cyther | cyther/commands.py | makeCommands | def makeCommands(file):
"""
Given a high level preset, it will construct the basic args to pass over.
'ninja', 'beast', 'minimal', 'swift'
"""
commands = [['cython', '-a', '-p', '-o',
file['c_name'], file['file_path']],
['gcc', '-DNDEBUG', '-g', '-fwrapv', '-O3', '-W... | python | def makeCommands(file):
"""
Given a high level preset, it will construct the basic args to pass over.
'ninja', 'beast', 'minimal', 'swift'
"""
commands = [['cython', '-a', '-p', '-o',
file['c_name'], file['file_path']],
['gcc', '-DNDEBUG', '-g', '-fwrapv', '-O3', '-W... | [
"def",
"makeCommands",
"(",
"file",
")",
":",
"commands",
"=",
"[",
"[",
"'cython'",
",",
"'-a'",
",",
"'-p'",
",",
"'-o'",
",",
"file",
"[",
"'c_name'",
"]",
",",
"file",
"[",
"'file_path'",
"]",
"]",
",",
"[",
"'gcc'",
",",
"'-DNDEBUG'",
",",
"'-... | Given a high level preset, it will construct the basic args to pass over.
'ninja', 'beast', 'minimal', 'swift' | [
"Given",
"a",
"high",
"level",
"preset",
"it",
"will",
"construct",
"the",
"basic",
"args",
"to",
"pass",
"over",
".",
"ninja",
"beast",
"minimal",
"swift"
] | 9fb0bd77af594008aa6ee8af460aa8c953abf5bc | https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/commands.py#L206-L220 | train | This function creates the list of command line arguments to pass over to the high level preset. |
Open-ET/openet-core-beta | openet/core/api.py | collection | def collection(
et_model,
variable,
collections,
start_date,
end_date,
t_interval,
geometry,
**kwargs
):
"""Generic OpenET Collection
Parameters
----------
self :
et_model : {'ndvi', 'ssebop'}
ET model.
variable : str
... | python | def collection(
et_model,
variable,
collections,
start_date,
end_date,
t_interval,
geometry,
**kwargs
):
"""Generic OpenET Collection
Parameters
----------
self :
et_model : {'ndvi', 'ssebop'}
ET model.
variable : str
... | [
"def",
"collection",
"(",
"et_model",
",",
"variable",
",",
"collections",
",",
"start_date",
",",
"end_date",
",",
"t_interval",
",",
"geometry",
",",
"*",
"*",
"kwargs",
")",
":",
"# Load the ET model",
"if",
"et_model",
".",
"lower",
"(",
")",
"==",
"'n... | Generic OpenET Collection
Parameters
----------
self :
et_model : {'ndvi', 'ssebop'}
ET model.
variable : str
collections : list
GEE satellite image collection IDs.
start_date : str
ISO format inclusive start date (i.e. YYYY-MM-DD).
end_date : str
ISO fo... | [
"Generic",
"OpenET",
"Collection"
] | f2b81ccf87bf7e7fe1b9f3dd1d4081d0ec7852db | https://github.com/Open-ET/openet-core-beta/blob/f2b81ccf87bf7e7fe1b9f3dd1d4081d0ec7852db/openet/core/api.py#L16-L117 | train | Generic OpenET Collection object. |
cltl/KafNafParserPy | KafNafParserPy/constituency_data.py | Ctree.get_terminals_as_list | def get_terminals_as_list(self):
"""
Iterator that returns all the terminal objects
@rtype: L{Cterminal}
@return: terminal objects as list
"""
terminalList = []
for t_node in self.__get_t_nodes():
terminalList.append(Cterminal(t_node))
return t... | python | def get_terminals_as_list(self):
"""
Iterator that returns all the terminal objects
@rtype: L{Cterminal}
@return: terminal objects as list
"""
terminalList = []
for t_node in self.__get_t_nodes():
terminalList.append(Cterminal(t_node))
return t... | [
"def",
"get_terminals_as_list",
"(",
"self",
")",
":",
"terminalList",
"=",
"[",
"]",
"for",
"t_node",
"in",
"self",
".",
"__get_t_nodes",
"(",
")",
":",
"terminalList",
".",
"append",
"(",
"Cterminal",
"(",
"t_node",
")",
")",
"return",
"terminalList"
] | Iterator that returns all the terminal objects
@rtype: L{Cterminal}
@return: terminal objects as list | [
"Iterator",
"that",
"returns",
"all",
"the",
"terminal",
"objects"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/constituency_data.py#L308-L317 | train | Iterator that returns all the terminal objects
|
cltl/KafNafParserPy | KafNafParserPy/constituency_data.py | Ctree.get_edges_as_list | def get_edges_as_list(self):
"""
Iterator that returns all the edge objects
@rtype: L{Cedge}
@return: terminal objects (iterator)
"""
my_edges = []
for edge_node in self.__get_edge_nodes():
my_edges.append(Cedge(edge_node))
return my_edges | python | def get_edges_as_list(self):
"""
Iterator that returns all the edge objects
@rtype: L{Cedge}
@return: terminal objects (iterator)
"""
my_edges = []
for edge_node in self.__get_edge_nodes():
my_edges.append(Cedge(edge_node))
return my_edges | [
"def",
"get_edges_as_list",
"(",
"self",
")",
":",
"my_edges",
"=",
"[",
"]",
"for",
"edge_node",
"in",
"self",
".",
"__get_edge_nodes",
"(",
")",
":",
"my_edges",
".",
"append",
"(",
"Cedge",
"(",
"edge_node",
")",
")",
"return",
"my_edges"
] | Iterator that returns all the edge objects
@rtype: L{Cedge}
@return: terminal objects (iterator) | [
"Iterator",
"that",
"returns",
"all",
"the",
"edge",
"objects"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/constituency_data.py#L374-L383 | train | Iterator that returns all the edge objects
|
mjirik/imtools | imtools/show_segmentation.py | prettify | def prettify(elem):
# from xml.etree.ElementTree import Element, SubElement, Comment, tostring
from xml.etree import ElementTree
from xml.dom import minidom
"""Return a pretty-printed XML string for the Element.
"""
rough_string = ElementTree.tostring(elem, 'utf-8')
reparsed = minidom.parseS... | python | def prettify(elem):
# from xml.etree.ElementTree import Element, SubElement, Comment, tostring
from xml.etree import ElementTree
from xml.dom import minidom
"""Return a pretty-printed XML string for the Element.
"""
rough_string = ElementTree.tostring(elem, 'utf-8')
reparsed = minidom.parseS... | [
"def",
"prettify",
"(",
"elem",
")",
":",
"# from xml.etree.ElementTree import Element, SubElement, Comment, tostring",
"from",
"xml",
".",
"etree",
"import",
"ElementTree",
"from",
"xml",
".",
"dom",
"import",
"minidom",
"rough_string",
"=",
"ElementTree",
".",
"tostri... | Return a pretty-printed XML string for the Element. | [
"Return",
"a",
"pretty",
"-",
"printed",
"XML",
"string",
"for",
"the",
"Element",
"."
] | eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a | https://github.com/mjirik/imtools/blob/eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a/imtools/show_segmentation.py#L375-L383 | train | Return a pretty - printed XML string for the Element. |
mjirik/imtools | imtools/show_segmentation.py | create_pvsm_file | def create_pvsm_file(vtk_files, pvsm_filename, relative_paths=True):
"""
Create paraview status file (.pvsm) based on input vtk files.
:param vtk_files:
:param pvsm_filename:
:param relative_paths:
:return:
"""
from xml.etree.ElementTree import Element, SubElement, Comment
import os.... | python | def create_pvsm_file(vtk_files, pvsm_filename, relative_paths=True):
"""
Create paraview status file (.pvsm) based on input vtk files.
:param vtk_files:
:param pvsm_filename:
:param relative_paths:
:return:
"""
from xml.etree.ElementTree import Element, SubElement, Comment
import os.... | [
"def",
"create_pvsm_file",
"(",
"vtk_files",
",",
"pvsm_filename",
",",
"relative_paths",
"=",
"True",
")",
":",
"from",
"xml",
".",
"etree",
".",
"ElementTree",
"import",
"Element",
",",
"SubElement",
",",
"Comment",
"import",
"os",
".",
"path",
"as",
"op",... | Create paraview status file (.pvsm) based on input vtk files.
:param vtk_files:
:param pvsm_filename:
:param relative_paths:
:return: | [
"Create",
"paraview",
"status",
"file",
"(",
".",
"pvsm",
")",
"based",
"on",
"input",
"vtk",
"files",
".",
":",
"param",
"vtk_files",
":",
":",
"param",
"pvsm_filename",
":",
":",
"param",
"relative_paths",
":",
":",
"return",
":"
] | eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a | https://github.com/mjirik/imtools/blob/eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a/imtools/show_segmentation.py#L386-L439 | train | Create a new PVsm status file based on input vtk files. |
mjirik/imtools | imtools/show_segmentation.py | SegmentationToMesh.set_resize_parameters | def set_resize_parameters(
self,
degrad=6,
labels=None,
resize_mm=None,
resize_voxel_number=None,
):
"""
set_input_data() should be called before
:param degrad:
:param labels:
:param resize_mm:
:param resize... | python | def set_resize_parameters(
self,
degrad=6,
labels=None,
resize_mm=None,
resize_voxel_number=None,
):
"""
set_input_data() should be called before
:param degrad:
:param labels:
:param resize_mm:
:param resize... | [
"def",
"set_resize_parameters",
"(",
"self",
",",
"degrad",
"=",
"6",
",",
"labels",
"=",
"None",
",",
"resize_mm",
"=",
"None",
",",
"resize_voxel_number",
"=",
"None",
",",
")",
":",
"# from . import show_segmentation",
"logger",
".",
"debug",
"(",
"\"set_re... | set_input_data() should be called before
:param degrad:
:param labels:
:param resize_mm:
:param resize_voxel_number:
:return: | [
"set_input_data",
"()",
"should",
"be",
"called",
"before",
":",
"param",
"degrad",
":",
":",
"param",
"labels",
":",
":",
"param",
"resize_mm",
":",
":",
"param",
"resize_voxel_number",
":",
":",
"return",
":"
] | eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a | https://github.com/mjirik/imtools/blob/eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a/imtools/show_segmentation.py#L70-L113 | train | set the parameters for the image resize |
mjirik/imtools | imtools/show_segmentation.py | SegmentationToMesh.select_labels | def select_labels(self, labels=None):
""" Prepare binar segmentation based on input segmentation and labels.
:param labels:
:return:
"""
self._resize_if_required()
segmentation = self._select_labels(self.resized_segmentation, labels)
# logger.debug("select labels... | python | def select_labels(self, labels=None):
""" Prepare binar segmentation based on input segmentation and labels.
:param labels:
:return:
"""
self._resize_if_required()
segmentation = self._select_labels(self.resized_segmentation, labels)
# logger.debug("select labels... | [
"def",
"select_labels",
"(",
"self",
",",
"labels",
"=",
"None",
")",
":",
"self",
".",
"_resize_if_required",
"(",
")",
"segmentation",
"=",
"self",
".",
"_select_labels",
"(",
"self",
".",
"resized_segmentation",
",",
"labels",
")",
"# logger.debug(\"select la... | Prepare binar segmentation based on input segmentation and labels.
:param labels:
:return: | [
"Prepare",
"binar",
"segmentation",
"based",
"on",
"input",
"segmentation",
"and",
"labels",
"."
] | eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a | https://github.com/mjirik/imtools/blob/eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a/imtools/show_segmentation.py#L126-L135 | train | Select binar labels based on input segmentation and labels. |
mjirik/imtools | imtools/show_segmentation.py | SegmentationToMesh._select_labels | def _select_labels(self, segmentation, labels=None):
""" Get selection of labels from input segmentation
:param segmentation:
:param labels:
:return:
"""
logger.debug("select_labels() started with labels={}".format(labels))
if self.slab is not None and labels is... | python | def _select_labels(self, segmentation, labels=None):
""" Get selection of labels from input segmentation
:param segmentation:
:param labels:
:return:
"""
logger.debug("select_labels() started with labels={}".format(labels))
if self.slab is not None and labels is... | [
"def",
"_select_labels",
"(",
"self",
",",
"segmentation",
",",
"labels",
"=",
"None",
")",
":",
"logger",
".",
"debug",
"(",
"\"select_labels() started with labels={}\"",
".",
"format",
"(",
"labels",
")",
")",
"if",
"self",
".",
"slab",
"is",
"not",
"None"... | Get selection of labels from input segmentation
:param segmentation:
:param labels:
:return: | [
"Get",
"selection",
"of",
"labels",
"from",
"input",
"segmentation"
] | eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a | https://github.com/mjirik/imtools/blob/eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a/imtools/show_segmentation.py#L137-L154 | train | Select the labels from input segmentation |
mjirik/imtools | imtools/show_segmentation.py | SegmentationToMesh._resize_if_required | def _resize_if_required(self):
"""
:return:
"""
# orig_dtype = self.binar_segmentation.dtype
# if orig_dtype == np.bool:
# segmentation = self.binar_segmentation.astype(np.int8)
# else:
# segmentation = self.binar_segmentation
if self.resi... | python | def _resize_if_required(self):
"""
:return:
"""
# orig_dtype = self.binar_segmentation.dtype
# if orig_dtype == np.bool:
# segmentation = self.binar_segmentation.astype(np.int8)
# else:
# segmentation = self.binar_segmentation
if self.resi... | [
"def",
"_resize_if_required",
"(",
"self",
")",
":",
"# orig_dtype = self.binar_segmentation.dtype",
"# if orig_dtype == np.bool:",
"# segmentation = self.binar_segmentation.astype(np.int8)",
"# else:",
"# segmentation = self.binar_segmentation",
"if",
"self",
".",
"resized_segme... | :return: | [
":",
"return",
":"
] | eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a | https://github.com/mjirik/imtools/blob/eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a/imtools/show_segmentation.py#L156-L184 | train | Internal method to resize the image of the current object. |
mjirik/imtools | imtools/show_segmentation.py | SegmentationToMesh.make_mesh_file | def make_mesh_file(
self,
labels=None,
):
""" Make one mesh (vtk or stl) file
:param label: labels from prev use of set_labels are used if None
:return: filename of output file
Funkce vrací trojrozměrné porobné jako data['segmentation']
v da... | python | def make_mesh_file(
self,
labels=None,
):
""" Make one mesh (vtk or stl) file
:param label: labels from prev use of set_labels are used if None
:return: filename of output file
Funkce vrací trojrozměrné porobné jako data['segmentation']
v da... | [
"def",
"make_mesh_file",
"(",
"self",
",",
"labels",
"=",
"None",
",",
")",
":",
"if",
"labels",
"is",
"None",
":",
"labels",
"=",
"self",
".",
"labels",
"strlabel",
"=",
"imma",
".",
"get_nlabels",
"(",
"slab",
"=",
"self",
".",
"slab",
",",
"labels... | Make one mesh (vtk or stl) file
:param label: labels from prev use of set_labels are used if None
:return: filename of output file
Funkce vrací trojrozměrné porobné jako data['segmentation']
v data['slab'] je popsáno, co která hodnota znamená | [
"Make",
"one",
"mesh",
"(",
"vtk",
"or",
"stl",
")",
"file"
] | eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a | https://github.com/mjirik/imtools/blob/eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a/imtools/show_segmentation.py#L210-L267 | train | Make one mesh file for a given set of voxels. |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/template.py | Templates.Get | def Get(self,key):
"""Get template by providing name, ID, or other unique key.
If key is not unique and finds multiple matches only the first
will be returned
"""
for template in self.templates:
if template.id == key: return(template) | python | def Get(self,key):
"""Get template by providing name, ID, or other unique key.
If key is not unique and finds multiple matches only the first
will be returned
"""
for template in self.templates:
if template.id == key: return(template) | [
"def",
"Get",
"(",
"self",
",",
"key",
")",
":",
"for",
"template",
"in",
"self",
".",
"templates",
":",
"if",
"template",
".",
"id",
"==",
"key",
":",
"return",
"(",
"template",
")"
] | Get template by providing name, ID, or other unique key.
If key is not unique and finds multiple matches only the first
will be returned | [
"Get",
"template",
"by",
"providing",
"name",
"ID",
"or",
"other",
"unique",
"key",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/template.py#L25-L33 | train | Get a template by providing name ID or other unique key. |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/template.py | Templates.Search | def Search(self,key):
"""Search template list by providing partial name, ID, or other key.
"""
results = []
for template in self.templates:
if template.id.lower().find(key.lower()) != -1: results.append(template)
elif template.name.lower().find(key.lower()) != -1: results.append(template)
return(re... | python | def Search(self,key):
"""Search template list by providing partial name, ID, or other key.
"""
results = []
for template in self.templates:
if template.id.lower().find(key.lower()) != -1: results.append(template)
elif template.name.lower().find(key.lower()) != -1: results.append(template)
return(re... | [
"def",
"Search",
"(",
"self",
",",
"key",
")",
":",
"results",
"=",
"[",
"]",
"for",
"template",
"in",
"self",
".",
"templates",
":",
"if",
"template",
".",
"id",
".",
"lower",
"(",
")",
".",
"find",
"(",
"key",
".",
"lower",
"(",
")",
")",
"!=... | Search template list by providing partial name, ID, or other key. | [
"Search",
"template",
"list",
"by",
"providing",
"partial",
"name",
"ID",
"or",
"other",
"key",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/template.py#L36-L46 | train | Search template list by providing partial name ID or other key. |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/time_utils.py | SecondsToZuluTS | def SecondsToZuluTS(secs=None):
"""Returns Zulu TS from unix time seconds.
If secs is not provided will convert the current time.
"""
if not secs: secs = int(time.time())
return(datetime.utcfromtimestamp(secs).strftime("%Y-%m-%dT%H:%M:%SZ")) | python | def SecondsToZuluTS(secs=None):
"""Returns Zulu TS from unix time seconds.
If secs is not provided will convert the current time.
"""
if not secs: secs = int(time.time())
return(datetime.utcfromtimestamp(secs).strftime("%Y-%m-%dT%H:%M:%SZ")) | [
"def",
"SecondsToZuluTS",
"(",
"secs",
"=",
"None",
")",
":",
"if",
"not",
"secs",
":",
"secs",
"=",
"int",
"(",
"time",
".",
"time",
"(",
")",
")",
"return",
"(",
"datetime",
".",
"utcfromtimestamp",
"(",
"secs",
")",
".",
"strftime",
"(",
"\"%Y-%m-... | Returns Zulu TS from unix time seconds.
If secs is not provided will convert the current time. | [
"Returns",
"Zulu",
"TS",
"from",
"unix",
"time",
"seconds",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/time_utils.py#L16-L24 | train | Returns Zulu TS from unix time seconds. |
lacava/DistanceClassifier | DistanceClassifier/DistanceClassifier.py | main | def main():
"""Main function that is called when DistanceClassifier is run on the command line"""
parser = argparse.ArgumentParser(description='DistanceClassifier for classification based on distance measure in feature space.',
add_help=False)
parser.add_argument('INPUT... | python | def main():
"""Main function that is called when DistanceClassifier is run on the command line"""
parser = argparse.ArgumentParser(description='DistanceClassifier for classification based on distance measure in feature space.',
add_help=False)
parser.add_argument('INPUT... | [
"def",
"main",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"'DistanceClassifier for classification based on distance measure in feature space.'",
",",
"add_help",
"=",
"False",
")",
"parser",
".",
"add_argument",
"(",
"'INPU... | Main function that is called when DistanceClassifier is run on the command line | [
"Main",
"function",
"that",
"is",
"called",
"when",
"DistanceClassifier",
"is",
"run",
"on",
"the",
"command",
"line"
] | cbb8a38a82b453c5821d2a2c3328b581f62e47bc | https://github.com/lacava/DistanceClassifier/blob/cbb8a38a82b453c5821d2a2c3328b581f62e47bc/DistanceClassifier/DistanceClassifier.py#L172-L227 | train | This function is called by the CLI when DistanceClassifier is run on the command line. It is called by the CLI when DistanceClassifier is run on the command line. |
lacava/DistanceClassifier | DistanceClassifier/DistanceClassifier.py | DistanceClassifier.fit | def fit(self, features, classes):
"""Constructs the DistanceClassifier from the provided training data
Parameters
----------
features: array-like {n_samples, n_features}
Feature matrix
classes: array-like {n_samples}
List of class labels for prediction
... | python | def fit(self, features, classes):
"""Constructs the DistanceClassifier from the provided training data
Parameters
----------
features: array-like {n_samples, n_features}
Feature matrix
classes: array-like {n_samples}
List of class labels for prediction
... | [
"def",
"fit",
"(",
"self",
",",
"features",
",",
"classes",
")",
":",
"# class labels",
"classes",
"=",
"self",
".",
"le",
".",
"fit_transform",
"(",
"classes",
")",
"# group the data by class label",
"X",
"=",
"[",
"]",
"self",
".",
"mu",
"=",
"[",
"]",... | Constructs the DistanceClassifier from the provided training data
Parameters
----------
features: array-like {n_samples, n_features}
Feature matrix
classes: array-like {n_samples}
List of class labels for prediction
Returns
-------
None | [
"Constructs",
"the",
"DistanceClassifier",
"from",
"the",
"provided",
"training",
"data"
] | cbb8a38a82b453c5821d2a2c3328b581f62e47bc | https://github.com/lacava/DistanceClassifier/blob/cbb8a38a82b453c5821d2a2c3328b581f62e47bc/DistanceClassifier/DistanceClassifier.py#L56-L84 | train | Constructs the DistanceClassifier from the provided training data and class labels. |
lacava/DistanceClassifier | DistanceClassifier/DistanceClassifier.py | DistanceClassifier.predict | def predict(self, features):
"""Predict class outputs for an unlabelled feature set"""
# get distance of features to class clusters
distances = [self._distance(x) for x in features]
# assign class label belonging to smallest distance
class_predict = [np.argmin(d) for d in dista... | python | def predict(self, features):
"""Predict class outputs for an unlabelled feature set"""
# get distance of features to class clusters
distances = [self._distance(x) for x in features]
# assign class label belonging to smallest distance
class_predict = [np.argmin(d) for d in dista... | [
"def",
"predict",
"(",
"self",
",",
"features",
")",
":",
"# get distance of features to class clusters",
"distances",
"=",
"[",
"self",
".",
"_distance",
"(",
"x",
")",
"for",
"x",
"in",
"features",
"]",
"# assign class label belonging to smallest distance",
"class_p... | Predict class outputs for an unlabelled feature set | [
"Predict",
"class",
"outputs",
"for",
"an",
"unlabelled",
"feature",
"set"
] | cbb8a38a82b453c5821d2a2c3328b581f62e47bc | https://github.com/lacava/DistanceClassifier/blob/cbb8a38a82b453c5821d2a2c3328b581f62e47bc/DistanceClassifier/DistanceClassifier.py#L86-L95 | train | Predict class outputs for an unlabelled feature set |
lacava/DistanceClassifier | DistanceClassifier/DistanceClassifier.py | DistanceClassifier._distance | def _distance(self,x):
"""returns distance measures for features"""
distance = np.empty([len(self.mu)])
for i in np.arange(len(self.mu)):
if self.d == 'mahalanobis' and self.is_invertible(self.Z[i]):
distance[i] = (x - self.mu[i]).dot(np.linalg.inv(self.Z[i])).do... | python | def _distance(self,x):
"""returns distance measures for features"""
distance = np.empty([len(self.mu)])
for i in np.arange(len(self.mu)):
if self.d == 'mahalanobis' and self.is_invertible(self.Z[i]):
distance[i] = (x - self.mu[i]).dot(np.linalg.inv(self.Z[i])).do... | [
"def",
"_distance",
"(",
"self",
",",
"x",
")",
":",
"distance",
"=",
"np",
".",
"empty",
"(",
"[",
"len",
"(",
"self",
".",
"mu",
")",
"]",
")",
"for",
"i",
"in",
"np",
".",
"arange",
"(",
"len",
"(",
"self",
".",
"mu",
")",
")",
":",
"if"... | returns distance measures for features | [
"returns",
"distance",
"measures",
"for",
"features"
] | cbb8a38a82b453c5821d2a2c3328b581f62e47bc | https://github.com/lacava/DistanceClassifier/blob/cbb8a38a82b453c5821d2a2c3328b581f62e47bc/DistanceClassifier/DistanceClassifier.py#L97-L107 | train | returns distance measures for features |
lacava/DistanceClassifier | DistanceClassifier/DistanceClassifier.py | DistanceClassifier.fit_predict | def fit_predict(self, features, classes):
"""Convenience function that fits the provided data then predicts the class labels
Parameters
----------
features: array-like {n_samples, n_features}
Feature matrix
classes: array-like {n_samples}
List of true clas... | python | def fit_predict(self, features, classes):
"""Convenience function that fits the provided data then predicts the class labels
Parameters
----------
features: array-like {n_samples, n_features}
Feature matrix
classes: array-like {n_samples}
List of true clas... | [
"def",
"fit_predict",
"(",
"self",
",",
"features",
",",
"classes",
")",
":",
"self",
".",
"fit",
"(",
"features",
",",
"classes",
")",
"return",
"self",
".",
"predict",
"(",
"features",
")"
] | Convenience function that fits the provided data then predicts the class labels
Parameters
----------
features: array-like {n_samples, n_features}
Feature matrix
classes: array-like {n_samples}
List of true class labels
Returns
----------
... | [
"Convenience",
"function",
"that",
"fits",
"the",
"provided",
"data",
"then",
"predicts",
"the",
"class",
"labels",
"Parameters",
"----------",
"features",
":",
"array",
"-",
"like",
"{",
"n_samples",
"n_features",
"}",
"Feature",
"matrix",
"classes",
":",
"arra... | cbb8a38a82b453c5821d2a2c3328b581f62e47bc | https://github.com/lacava/DistanceClassifier/blob/cbb8a38a82b453c5821d2a2c3328b581f62e47bc/DistanceClassifier/DistanceClassifier.py#L108-L124 | train | Convenience function that fits the provided data then predicts the class labels
|
lacava/DistanceClassifier | DistanceClassifier/DistanceClassifier.py | DistanceClassifier.score | def score(self, features, classes, scoring_function=accuracy_score, **scoring_function_kwargs):
"""Estimates the accuracy of the predictions from the constructed feature
Parameters
----------
features: array-like {n_samples, n_features}
Feature matrix to predict from
... | python | def score(self, features, classes, scoring_function=accuracy_score, **scoring_function_kwargs):
"""Estimates the accuracy of the predictions from the constructed feature
Parameters
----------
features: array-like {n_samples, n_features}
Feature matrix to predict from
... | [
"def",
"score",
"(",
"self",
",",
"features",
",",
"classes",
",",
"scoring_function",
"=",
"accuracy_score",
",",
"*",
"*",
"scoring_function_kwargs",
")",
":",
"if",
"not",
"self",
".",
"mu",
":",
"raise",
"ValueError",
"(",
"'The DistanceClassifier model must... | Estimates the accuracy of the predictions from the constructed feature
Parameters
----------
features: array-like {n_samples, n_features}
Feature matrix to predict from
classes: array-like {n_samples}
List of true class labels
Returns
-------
... | [
"Estimates",
"the",
"accuracy",
"of",
"the",
"predictions",
"from",
"the",
"constructed",
"feature"
] | cbb8a38a82b453c5821d2a2c3328b581f62e47bc | https://github.com/lacava/DistanceClassifier/blob/cbb8a38a82b453c5821d2a2c3328b581f62e47bc/DistanceClassifier/DistanceClassifier.py#L126-L145 | train | Estimates the accuracy of the predictions from the constructed feature set. |
lacava/DistanceClassifier | DistanceClassifier/DistanceClassifier.py | DistanceClassifier.is_invertible | def is_invertible(self,X):
"""checks if Z is invertible"""
if len(X.shape) == 2:
return X.shape[0] == X.shape[1] and np.linalg.matrix_rank(X) == X.shape[0]
else:
return False | python | def is_invertible(self,X):
"""checks if Z is invertible"""
if len(X.shape) == 2:
return X.shape[0] == X.shape[1] and np.linalg.matrix_rank(X) == X.shape[0]
else:
return False | [
"def",
"is_invertible",
"(",
"self",
",",
"X",
")",
":",
"if",
"len",
"(",
"X",
".",
"shape",
")",
"==",
"2",
":",
"return",
"X",
".",
"shape",
"[",
"0",
"]",
"==",
"X",
".",
"shape",
"[",
"1",
"]",
"and",
"np",
".",
"linalg",
".",
"matrix_ra... | checks if Z is invertible | [
"checks",
"if",
"Z",
"is",
"invertible"
] | cbb8a38a82b453c5821d2a2c3328b581f62e47bc | https://github.com/lacava/DistanceClassifier/blob/cbb8a38a82b453c5821d2a2c3328b581f62e47bc/DistanceClassifier/DistanceClassifier.py#L165-L170 | train | checks if Z is invertible |
cltl/KafNafParserPy | KafNafParserPy/term_data.py | Cterm.get_span_ids | def get_span_ids(self):
"""
Returns the span object of the term
@rtype: List
@return: the term span as list of wf ids
"""
node_span = self.node.find('span')
if node_span is not None:
mySpan = Cspan(node_span)
span_ids = mySpan.get_span_ids(... | python | def get_span_ids(self):
"""
Returns the span object of the term
@rtype: List
@return: the term span as list of wf ids
"""
node_span = self.node.find('span')
if node_span is not None:
mySpan = Cspan(node_span)
span_ids = mySpan.get_span_ids(... | [
"def",
"get_span_ids",
"(",
"self",
")",
":",
"node_span",
"=",
"self",
".",
"node",
".",
"find",
"(",
"'span'",
")",
"if",
"node_span",
"is",
"not",
"None",
":",
"mySpan",
"=",
"Cspan",
"(",
"node_span",
")",
"span_ids",
"=",
"mySpan",
".",
"get_span_... | Returns the span object of the term
@rtype: List
@return: the term span as list of wf ids | [
"Returns",
"the",
"span",
"object",
"of",
"the",
"term"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/term_data.py#L177-L189 | train | Returns the span object of the term
|
cltl/KafNafParserPy | KafNafParserPy/term_data.py | Cterm.set_span_from_ids | def set_span_from_ids(self, span_list):
"""
Sets the span for the term from list of ids
@type span_list: []
@param span_list: list of wf ids forming span
"""
this_span = Cspan()
this_span.create_from_ids(span_list)
self.node.append(this_span.get_node()) | python | def set_span_from_ids(self, span_list):
"""
Sets the span for the term from list of ids
@type span_list: []
@param span_list: list of wf ids forming span
"""
this_span = Cspan()
this_span.create_from_ids(span_list)
self.node.append(this_span.get_node()) | [
"def",
"set_span_from_ids",
"(",
"self",
",",
"span_list",
")",
":",
"this_span",
"=",
"Cspan",
"(",
")",
"this_span",
".",
"create_from_ids",
"(",
"span_list",
")",
"self",
".",
"node",
".",
"append",
"(",
"this_span",
".",
"get_node",
"(",
")",
")"
] | Sets the span for the term from list of ids
@type span_list: []
@param span_list: list of wf ids forming span | [
"Sets",
"the",
"span",
"for",
"the",
"term",
"from",
"list",
"of",
"ids"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/term_data.py#L191-L199 | train | Sets the span for the term from list of ids |
cltl/KafNafParserPy | KafNafParserPy/term_data.py | Cterms.to_naf | def to_naf(self):
"""
Converts the object to NAF (if it is KAF)
"""
if self.type == 'KAF':
self.type = 'NAF'
for node in self.__get_node_terms():
node.set('id',node.get('tid'))
del node.attrib['tid'] | python | def to_naf(self):
"""
Converts the object to NAF (if it is KAF)
"""
if self.type == 'KAF':
self.type = 'NAF'
for node in self.__get_node_terms():
node.set('id',node.get('tid'))
del node.attrib['tid'] | [
"def",
"to_naf",
"(",
"self",
")",
":",
"if",
"self",
".",
"type",
"==",
"'KAF'",
":",
"self",
".",
"type",
"=",
"'NAF'",
"for",
"node",
"in",
"self",
".",
"__get_node_terms",
"(",
")",
":",
"node",
".",
"set",
"(",
"'id'",
",",
"node",
".",
"get... | Converts the object to NAF (if it is KAF) | [
"Converts",
"the",
"object",
"to",
"NAF",
"(",
"if",
"it",
"is",
"KAF",
")"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/term_data.py#L304-L312 | train | Converts the object to NAF |
cltl/KafNafParserPy | KafNafParserPy/term_data.py | Cterms.get_term | def get_term(self,term_id):
"""
Returns the term object for the supplied identifier
@type term_id: string
@param term_id: term identifier
"""
if term_id in self.idx:
return Cterm(self.idx[term_id],self.type)
else:
return None | python | def get_term(self,term_id):
"""
Returns the term object for the supplied identifier
@type term_id: string
@param term_id: term identifier
"""
if term_id in self.idx:
return Cterm(self.idx[term_id],self.type)
else:
return None | [
"def",
"get_term",
"(",
"self",
",",
"term_id",
")",
":",
"if",
"term_id",
"in",
"self",
".",
"idx",
":",
"return",
"Cterm",
"(",
"self",
".",
"idx",
"[",
"term_id",
"]",
",",
"self",
".",
"type",
")",
"else",
":",
"return",
"None"
] | Returns the term object for the supplied identifier
@type term_id: string
@param term_id: term identifier | [
"Returns",
"the",
"term",
"object",
"for",
"the",
"supplied",
"identifier"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/term_data.py#L327-L336 | train | Returns the term object for the supplied identifier |
cltl/KafNafParserPy | KafNafParserPy/term_data.py | Cterms.add_term | def add_term(self,term_obj):
"""
Adds a term object to the layer
@type term_obj: L{Cterm}
@param term_obj: the term object
"""
if term_obj.get_id() in self.idx:
raise ValueError("Term with id {} already exists!"
.format(term_obj.ge... | python | def add_term(self,term_obj):
"""
Adds a term object to the layer
@type term_obj: L{Cterm}
@param term_obj: the term object
"""
if term_obj.get_id() in self.idx:
raise ValueError("Term with id {} already exists!"
.format(term_obj.ge... | [
"def",
"add_term",
"(",
"self",
",",
"term_obj",
")",
":",
"if",
"term_obj",
".",
"get_id",
"(",
")",
"in",
"self",
".",
"idx",
":",
"raise",
"ValueError",
"(",
"\"Term with id {} already exists!\"",
".",
"format",
"(",
"term_obj",
".",
"get_id",
"(",
")",... | Adds a term object to the layer
@type term_obj: L{Cterm}
@param term_obj: the term object | [
"Adds",
"a",
"term",
"object",
"to",
"the",
"layer"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/term_data.py#L338-L348 | train | Adds a term object to the layer |
cltl/KafNafParserPy | KafNafParserPy/term_data.py | Cterms.add_external_reference | def add_external_reference(self,term_id, external_ref):
"""
Adds an external reference for the given term
@type term_id: string
@param term_id: the term identifier
@type external_ref: L{CexternalReference}
@param external_ref: the external reference object
"""
... | python | def add_external_reference(self,term_id, external_ref):
"""
Adds an external reference for the given term
@type term_id: string
@param term_id: the term identifier
@type external_ref: L{CexternalReference}
@param external_ref: the external reference object
"""
... | [
"def",
"add_external_reference",
"(",
"self",
",",
"term_id",
",",
"external_ref",
")",
":",
"if",
"term_id",
"in",
"self",
".",
"idx",
":",
"term_obj",
"=",
"Cterm",
"(",
"self",
".",
"idx",
"[",
"term_id",
"]",
",",
"self",
".",
"type",
")",
"term_ob... | Adds an external reference for the given term
@type term_id: string
@param term_id: the term identifier
@type external_ref: L{CexternalReference}
@param external_ref: the external reference object | [
"Adds",
"an",
"external",
"reference",
"for",
"the",
"given",
"term"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/term_data.py#L350-L362 | train | Adds an external reference for the given term |
cltl/KafNafParserPy | KafNafParserPy/term_data.py | Cterms.remove_terms | def remove_terms(self,list_term_ids):
"""
Removes a list of terms from the layer
@type list_term_ids: list
@param list_term_ids: list of term identifiers to be removed
"""
nodes_to_remove = set()
for term in self:
if term.get_id() in list_term_ids:
... | python | def remove_terms(self,list_term_ids):
"""
Removes a list of terms from the layer
@type list_term_ids: list
@param list_term_ids: list of term identifiers to be removed
"""
nodes_to_remove = set()
for term in self:
if term.get_id() in list_term_ids:
... | [
"def",
"remove_terms",
"(",
"self",
",",
"list_term_ids",
")",
":",
"nodes_to_remove",
"=",
"set",
"(",
")",
"for",
"term",
"in",
"self",
":",
"if",
"term",
".",
"get_id",
"(",
")",
"in",
"list_term_ids",
":",
"nodes_to_remove",
".",
"add",
"(",
"term",
... | Removes a list of terms from the layer
@type list_term_ids: list
@param list_term_ids: list of term identifiers to be removed | [
"Removes",
"a",
"list",
"of",
"terms",
"from",
"the",
"layer"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/term_data.py#L367-L383 | train | Removes a list of terms from the layer
|
mjirik/imtools | imtools/select_label_qt.py | SelectLabelWidget.init_slab | def init_slab(self, slab=None, segmentation=None, voxelsize_mm=None, show_ok_button=False):
"""
Create widget with segmentation labels information used to select labels.
:param slab: dict with label name and its id
:param segmentation: 3D label ndarray
:param voxelsize_mm: size ... | python | def init_slab(self, slab=None, segmentation=None, voxelsize_mm=None, show_ok_button=False):
"""
Create widget with segmentation labels information used to select labels.
:param slab: dict with label name and its id
:param segmentation: 3D label ndarray
:param voxelsize_mm: size ... | [
"def",
"init_slab",
"(",
"self",
",",
"slab",
"=",
"None",
",",
"segmentation",
"=",
"None",
",",
"voxelsize_mm",
"=",
"None",
",",
"show_ok_button",
"=",
"False",
")",
":",
"self",
".",
"segmentation",
"=",
"segmentation",
"self",
".",
"voxelsize_mm",
"="... | Create widget with segmentation labels information used to select labels.
:param slab: dict with label name and its id
:param segmentation: 3D label ndarray
:param voxelsize_mm: size of voxel in mm
:return: | [
"Create",
"widget",
"with",
"segmentation",
"labels",
"information",
"used",
"to",
"select",
"labels",
"."
] | eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a | https://github.com/mjirik/imtools/blob/eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a/imtools/select_label_qt.py#L47-L67 | train | Create widget with segmentation labels information used to select labels. |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv1/server.py | Server.GetServers | def GetServers(location,group=None,alias=None,name_groups=False):
"""Gets a deep list of all Servers for a given Hardware Group and its sub groups, or all Servers for a given location.
https://www.ctl.io/api-docs/v1/#server-getallservers
:param alias: short code for a particular account. If none will use accou... | python | def GetServers(location,group=None,alias=None,name_groups=False):
"""Gets a deep list of all Servers for a given Hardware Group and its sub groups, or all Servers for a given location.
https://www.ctl.io/api-docs/v1/#server-getallservers
:param alias: short code for a particular account. If none will use accou... | [
"def",
"GetServers",
"(",
"location",
",",
"group",
"=",
"None",
",",
"alias",
"=",
"None",
",",
"name_groups",
"=",
"False",
")",
":",
"if",
"alias",
"is",
"None",
":",
"alias",
"=",
"clc",
".",
"v1",
".",
"Account",
".",
"GetAlias",
"(",
")",
"pa... | Gets a deep list of all Servers for a given Hardware Group and its sub groups, or all Servers for a given location.
https://www.ctl.io/api-docs/v1/#server-getallservers
:param alias: short code for a particular account. If none will use account's default alias
:param location: datacenter where group resides
... | [
"Gets",
"a",
"deep",
"list",
"of",
"all",
"Servers",
"for",
"a",
"given",
"Hardware",
"Group",
"and",
"its",
"sub",
"groups",
"or",
"all",
"Servers",
"for",
"a",
"given",
"location",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/server.py#L37-L57 | train | Gets a deep list of all Servers for a given location. |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv1/server.py | Server.GetAllServers | def GetAllServers(alias=None,name_groups=False):
"""Gets a deep list of all Servers in all groups and datacenters.
:param alias: short code for a particular account. If none will use account's default alias
"""
if alias is None: alias = clc.v1.Account.GetAlias()
servers = []
clc.v1.Account.GetLocations()... | python | def GetAllServers(alias=None,name_groups=False):
"""Gets a deep list of all Servers in all groups and datacenters.
:param alias: short code for a particular account. If none will use account's default alias
"""
if alias is None: alias = clc.v1.Account.GetAlias()
servers = []
clc.v1.Account.GetLocations()... | [
"def",
"GetAllServers",
"(",
"alias",
"=",
"None",
",",
"name_groups",
"=",
"False",
")",
":",
"if",
"alias",
"is",
"None",
":",
"alias",
"=",
"clc",
".",
"v1",
".",
"Account",
".",
"GetAlias",
"(",
")",
"servers",
"=",
"[",
"]",
"clc",
".",
"v1",
... | Gets a deep list of all Servers in all groups and datacenters.
:param alias: short code for a particular account. If none will use account's default alias | [
"Gets",
"a",
"deep",
"list",
"of",
"all",
"Servers",
"in",
"all",
"groups",
"and",
"datacenters",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/server.py#L61-L76 | train | Gets a deep list of all Servers in all groups and datacenters. |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv1/server.py | Server.GetTemplates | def GetTemplates(alias=None,location=None):
"""Gets the list of Templates available to the account and location.
https://t3n.zendesk.com/entries/23102683-List-Available-Server-Templates
:param alias: short code for a particular account. If none will use account's default alias
:param location: datacenter whe... | python | def GetTemplates(alias=None,location=None):
"""Gets the list of Templates available to the account and location.
https://t3n.zendesk.com/entries/23102683-List-Available-Server-Templates
:param alias: short code for a particular account. If none will use account's default alias
:param location: datacenter whe... | [
"def",
"GetTemplates",
"(",
"alias",
"=",
"None",
",",
"location",
"=",
"None",
")",
":",
"if",
"alias",
"is",
"None",
":",
"alias",
"=",
"clc",
".",
"v1",
".",
"Account",
".",
"GetAlias",
"(",
")",
"if",
"location",
"is",
"None",
":",
"location",
... | Gets the list of Templates available to the account and location.
https://t3n.zendesk.com/entries/23102683-List-Available-Server-Templates
:param alias: short code for a particular account. If none will use account's default alias
:param location: datacenter where group resides | [
"Gets",
"the",
"list",
"of",
"Templates",
"available",
"to",
"the",
"account",
"and",
"location",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/server.py#L80-L92 | train | Gets the list of Templates available to the account and location. |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv1/server.py | Server.GetTemplateID | def GetTemplateID(alias,location,name):
"""Given a template name return the unique OperatingSystem ID.
:param alias: short code for a particular account. If none will use account's default alias
:param location: datacenter where group resides
:param name: template name
"""
if alias is None: alias = clc.v... | python | def GetTemplateID(alias,location,name):
"""Given a template name return the unique OperatingSystem ID.
:param alias: short code for a particular account. If none will use account's default alias
:param location: datacenter where group resides
:param name: template name
"""
if alias is None: alias = clc.v... | [
"def",
"GetTemplateID",
"(",
"alias",
",",
"location",
",",
"name",
")",
":",
"if",
"alias",
"is",
"None",
":",
"alias",
"=",
"clc",
".",
"v1",
".",
"Account",
".",
"GetAlias",
"(",
")",
"if",
"location",
"is",
"None",
":",
"location",
"=",
"clc",
... | Given a template name return the unique OperatingSystem ID.
:param alias: short code for a particular account. If none will use account's default alias
:param location: datacenter where group resides
:param name: template name | [
"Given",
"a",
"template",
"name",
"return",
"the",
"unique",
"OperatingSystem",
"ID",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/server.py#L96-L111 | train | Given a template name return the unique OperatingSystem ID. |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv1/server.py | Server.Create | def Create(name,template,cpu,ram,backup_level,group,alias=None,location=None,network='',description='',password=''):
"""Gets the list of Templates available to the account and location.
https://www.centurylinkcloud.com/api-docs/v1/#server-create-server
:param alias: short code for a particular account. If None... | python | def Create(name,template,cpu,ram,backup_level,group,alias=None,location=None,network='',description='',password=''):
"""Gets the list of Templates available to the account and location.
https://www.centurylinkcloud.com/api-docs/v1/#server-create-server
:param alias: short code for a particular account. If None... | [
"def",
"Create",
"(",
"name",
",",
"template",
",",
"cpu",
",",
"ram",
",",
"backup_level",
",",
"group",
",",
"alias",
"=",
"None",
",",
"location",
"=",
"None",
",",
"network",
"=",
"''",
",",
"description",
"=",
"''",
",",
"password",
"=",
"''",
... | Gets the list of Templates available to the account and location.
https://www.centurylinkcloud.com/api-docs/v1/#server-create-server
:param alias: short code for a particular account. If None will use account's default alias
:param location: datacenter where group resides. If None will use account's default l... | [
"Gets",
"the",
"list",
"of",
"Templates",
"available",
"to",
"the",
"account",
"and",
"location",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/server.py#L116-L142 | train | Creates a new server. |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv1/server.py | Server.ConvertToTemplate | def ConvertToTemplate(server,template,password=None,alias=None):
"""Converts an existing server into a template.
http://www.centurylinkcloud.com/api-docs/v1/#server-convert-server-to-template
:param server: source server to convert
:param template: name of destination template
:param password: source server... | python | def ConvertToTemplate(server,template,password=None,alias=None):
"""Converts an existing server into a template.
http://www.centurylinkcloud.com/api-docs/v1/#server-convert-server-to-template
:param server: source server to convert
:param template: name of destination template
:param password: source server... | [
"def",
"ConvertToTemplate",
"(",
"server",
",",
"template",
",",
"password",
"=",
"None",
",",
"alias",
"=",
"None",
")",
":",
"if",
"alias",
"is",
"None",
":",
"alias",
"=",
"clc",
".",
"v1",
".",
"Account",
".",
"GetAlias",
"(",
")",
"if",
"passwor... | Converts an existing server into a template.
http://www.centurylinkcloud.com/api-docs/v1/#server-convert-server-to-template
:param server: source server to convert
:param template: name of destination template
:param password: source server password (optional - will lookup password if None)
:param alias: sh... | [
"Converts",
"an",
"existing",
"server",
"into",
"a",
"template",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/server.py#L146-L161 | train | Converts an existing server into a template. |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv1/server.py | Server.RestoreServer | def RestoreServer(server,group,alias,location):
"""Restores an archived server.
https://www.centurylinkcloud.com/api-docs/v1/#restoreserver
:param server: archived server to restore
:param group: name of group or group ID for server to belong to
:param alias: short code for a particular account. If None wi... | python | def RestoreServer(server,group,alias,location):
"""Restores an archived server.
https://www.centurylinkcloud.com/api-docs/v1/#restoreserver
:param server: archived server to restore
:param group: name of group or group ID for server to belong to
:param alias: short code for a particular account. If None wi... | [
"def",
"RestoreServer",
"(",
"server",
",",
"group",
",",
"alias",
",",
"location",
")",
":",
"if",
"alias",
"is",
"None",
":",
"alias",
"=",
"clc",
".",
"v1",
".",
"Account",
".",
"GetAlias",
"(",
")",
"if",
"location",
"is",
"None",
":",
"location"... | Restores an archived server.
https://www.centurylinkcloud.com/api-docs/v1/#restoreserver
:param server: archived server to restore
:param group: name of group or group ID for server to belong to
:param alias: short code for a particular account. If None will use account's default alias
:param location: dat... | [
"Restores",
"an",
"archived",
"server",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/server.py#L165-L182 | train | Restores an archived server. |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv1/server.py | Server._ServerActions | def _ServerActions(action,alias,servers):
"""Archives the specified servers.
:param action: the server action url to exec against
:param alias: short code for a particular account. If none will use account's default alias
:param servers: list of server names
"""
if alias is None: alias = clc.v1.Account.G... | python | def _ServerActions(action,alias,servers):
"""Archives the specified servers.
:param action: the server action url to exec against
:param alias: short code for a particular account. If none will use account's default alias
:param servers: list of server names
"""
if alias is None: alias = clc.v1.Account.G... | [
"def",
"_ServerActions",
"(",
"action",
",",
"alias",
",",
"servers",
")",
":",
"if",
"alias",
"is",
"None",
":",
"alias",
"=",
"clc",
".",
"v1",
".",
"Account",
".",
"GetAlias",
"(",
")",
"results",
"=",
"[",
"]",
"for",
"server",
"in",
"servers",
... | Archives the specified servers.
:param action: the server action url to exec against
:param alias: short code for a particular account. If none will use account's default alias
:param servers: list of server names | [
"Archives",
"the",
"specified",
"servers",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/server.py#L187-L199 | train | Archives the specified servers. |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv1/server.py | Server.GetDisks | def GetDisks(server,alias=None,guest_names=True):
"""Returns list of disks configured for the server
https://www.ctl.io/api-docs/v1/#server-listdisks
:param alias: short code for a particular account. If none will use account's default alias
:param server: server name
:param guest_names: query guest disk n... | python | def GetDisks(server,alias=None,guest_names=True):
"""Returns list of disks configured for the server
https://www.ctl.io/api-docs/v1/#server-listdisks
:param alias: short code for a particular account. If none will use account's default alias
:param server: server name
:param guest_names: query guest disk n... | [
"def",
"GetDisks",
"(",
"server",
",",
"alias",
"=",
"None",
",",
"guest_names",
"=",
"True",
")",
":",
"if",
"alias",
"is",
"None",
":",
"alias",
"=",
"clc",
".",
"v1",
".",
"Account",
".",
"GetAlias",
"(",
")",
"r",
"=",
"clc",
".",
"v1",
".",
... | Returns list of disks configured for the server
https://www.ctl.io/api-docs/v1/#server-listdisks
:param alias: short code for a particular account. If none will use account's default alias
:param server: server name
:param guest_names: query guest disk names and mount points | [
"Returns",
"list",
"of",
"disks",
"configured",
"for",
"the",
"server"
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/server.py#L329-L341 | train | Returns list of disks configured for a particular server. |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv1/server.py | Server.DeleteDisk | def DeleteDisk(server,scsi_bus_id,scsi_device_id,alias=None):
"""Deletes the specified disk.
https://www.ctl.io/api-docs/v1/#server-delete-disk
:param alias: short code for a particular account. If None will use account's default alias
:param server: server name
:param scsi_bus_id: bus ID associated with d... | python | def DeleteDisk(server,scsi_bus_id,scsi_device_id,alias=None):
"""Deletes the specified disk.
https://www.ctl.io/api-docs/v1/#server-delete-disk
:param alias: short code for a particular account. If None will use account's default alias
:param server: server name
:param scsi_bus_id: bus ID associated with d... | [
"def",
"DeleteDisk",
"(",
"server",
",",
"scsi_bus_id",
",",
"scsi_device_id",
",",
"alias",
"=",
"None",
")",
":",
"if",
"alias",
"is",
"None",
":",
"alias",
"=",
"clc",
".",
"v1",
".",
"Account",
".",
"GetAlias",
"(",
")",
"r",
"=",
"clc",
".",
"... | Deletes the specified disk.
https://www.ctl.io/api-docs/v1/#server-delete-disk
:param alias: short code for a particular account. If None will use account's default alias
:param server: server name
:param scsi_bus_id: bus ID associated with disk
:param scsi_device_id: disk ID associated with disk | [
"Deletes",
"the",
"specified",
"disk",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/server.py#L345-L360 | train | Delete a disk. |
cltl/KafNafParserPy | KafNafParserPy/external_references_data.py | CexternalReferences.get_external_references | def get_external_references(self):
"""
Iterator that returns all the external reference objects of the external references object
@rtype: L{CexternalReference}
@return: the external reference objects
"""
for ext_ref_node in self.node.findall('externalRef'):
ex... | python | def get_external_references(self):
"""
Iterator that returns all the external reference objects of the external references object
@rtype: L{CexternalReference}
@return: the external reference objects
"""
for ext_ref_node in self.node.findall('externalRef'):
ex... | [
"def",
"get_external_references",
"(",
"self",
")",
":",
"for",
"ext_ref_node",
"in",
"self",
".",
"node",
".",
"findall",
"(",
"'externalRef'",
")",
":",
"ext_refs_obj",
"=",
"CexternalReference",
"(",
"ext_ref_node",
")",
"for",
"ref",
"in",
"ext_refs_obj",
... | Iterator that returns all the external reference objects of the external references object
@rtype: L{CexternalReference}
@return: the external reference objects | [
"Iterator",
"that",
"returns",
"all",
"the",
"external",
"reference",
"objects",
"of",
"the",
"external",
"references",
"object"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/external_references_data.py#L184-L193 | train | Iterate that returns all the external reference objects of the external references |
cltl/KafNafParserPy | KafNafParserPy/text_data.py | Cwf.set_id | def set_id(self,this_id):
"""
Set the identifier for the token
@type this_id: string
@param this_id: the identifier
"""
if self.type == 'NAF':
return self.node.set('id',this_id)
elif self.type == 'KAF':
return self.node.set('wid',this_id) | python | def set_id(self,this_id):
"""
Set the identifier for the token
@type this_id: string
@param this_id: the identifier
"""
if self.type == 'NAF':
return self.node.set('id',this_id)
elif self.type == 'KAF':
return self.node.set('wid',this_id) | [
"def",
"set_id",
"(",
"self",
",",
"this_id",
")",
":",
"if",
"self",
".",
"type",
"==",
"'NAF'",
":",
"return",
"self",
".",
"node",
".",
"set",
"(",
"'id'",
",",
"this_id",
")",
"elif",
"self",
".",
"type",
"==",
"'KAF'",
":",
"return",
"self",
... | Set the identifier for the token
@type this_id: string
@param this_id: the identifier | [
"Set",
"the",
"identifier",
"for",
"the",
"token"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/text_data.py#L34-L43 | train | Set the identifier for the token
|
cltl/KafNafParserPy | KafNafParserPy/text_data.py | Ctext.to_kaf | def to_kaf(self):
"""
Converts the object to KAF (if it is NAF)
"""
if self.type == 'NAF':
self.type = 'KAF'
for node in self.__get_wf_nodes():
node.set('wid',node.get('id'))
del node.attrib['id'] | python | def to_kaf(self):
"""
Converts the object to KAF (if it is NAF)
"""
if self.type == 'NAF':
self.type = 'KAF'
for node in self.__get_wf_nodes():
node.set('wid',node.get('id'))
del node.attrib['id'] | [
"def",
"to_kaf",
"(",
"self",
")",
":",
"if",
"self",
".",
"type",
"==",
"'NAF'",
":",
"self",
".",
"type",
"=",
"'KAF'",
"for",
"node",
"in",
"self",
".",
"__get_wf_nodes",
"(",
")",
":",
"node",
".",
"set",
"(",
"'wid'",
",",
"node",
".",
"get"... | Converts the object to KAF (if it is NAF) | [
"Converts",
"the",
"object",
"to",
"KAF",
"(",
"if",
"it",
"is",
"NAF",
")"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/text_data.py#L202-L210 | train | Converts the object to KAF |
cltl/KafNafParserPy | KafNafParserPy/text_data.py | Ctext.to_naf | def to_naf(self):
"""
Converts the object to NAF
"""
if self.type == 'KAF':
self.type = 'NAF'
for node in self.__get_wf_nodes():
node.set('id',node.get('wid'))
del node.attrib['wid'] | python | def to_naf(self):
"""
Converts the object to NAF
"""
if self.type == 'KAF':
self.type = 'NAF'
for node in self.__get_wf_nodes():
node.set('id',node.get('wid'))
del node.attrib['wid'] | [
"def",
"to_naf",
"(",
"self",
")",
":",
"if",
"self",
".",
"type",
"==",
"'KAF'",
":",
"self",
".",
"type",
"=",
"'NAF'",
"for",
"node",
"in",
"self",
".",
"__get_wf_nodes",
"(",
")",
":",
"node",
".",
"set",
"(",
"'id'",
",",
"node",
".",
"get",... | Converts the object to NAF | [
"Converts",
"the",
"object",
"to",
"NAF"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/text_data.py#L212-L220 | train | Converts the object to NAF |
cltl/KafNafParserPy | KafNafParserPy/text_data.py | Ctext.get_wf | def get_wf(self,token_id):
"""
Returns the token object for the given token identifier
@type token_id: string
@param token_id: the token identifier
@rtype: L{Cwf}
@return: the token object
"""
wf_node = self.idx.get(token_id)
if wf_node is not No... | python | def get_wf(self,token_id):
"""
Returns the token object for the given token identifier
@type token_id: string
@param token_id: the token identifier
@rtype: L{Cwf}
@return: the token object
"""
wf_node = self.idx.get(token_id)
if wf_node is not No... | [
"def",
"get_wf",
"(",
"self",
",",
"token_id",
")",
":",
"wf_node",
"=",
"self",
".",
"idx",
".",
"get",
"(",
"token_id",
")",
"if",
"wf_node",
"is",
"not",
"None",
":",
"return",
"Cwf",
"(",
"node",
"=",
"wf_node",
",",
"type",
"=",
"self",
".",
... | Returns the token object for the given token identifier
@type token_id: string
@param token_id: the token identifier
@rtype: L{Cwf}
@return: the token object | [
"Returns",
"the",
"token",
"object",
"for",
"the",
"given",
"token",
"identifier"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/text_data.py#L235-L252 | train | Returns the token object for the given token identifier |
cltl/KafNafParserPy | KafNafParserPy/text_data.py | Ctext.add_wf | def add_wf(self,wf_obj):
"""
Adds a token object to the text layer
@type wf_obj: L{Cwf}
@param wf_obj: token object
"""
if wf_obj.get_id() in self.idx:
raise ValueError("Text node (wf) with id {} already exists!"
.format(wf_obj.get... | python | def add_wf(self,wf_obj):
"""
Adds a token object to the text layer
@type wf_obj: L{Cwf}
@param wf_obj: token object
"""
if wf_obj.get_id() in self.idx:
raise ValueError("Text node (wf) with id {} already exists!"
.format(wf_obj.get... | [
"def",
"add_wf",
"(",
"self",
",",
"wf_obj",
")",
":",
"if",
"wf_obj",
".",
"get_id",
"(",
")",
"in",
"self",
".",
"idx",
":",
"raise",
"ValueError",
"(",
"\"Text node (wf) with id {} already exists!\"",
".",
"format",
"(",
"wf_obj",
".",
"get_id",
"(",
")... | Adds a token object to the text layer
@type wf_obj: L{Cwf}
@param wf_obj: token object | [
"Adds",
"a",
"token",
"object",
"to",
"the",
"text",
"layer"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/text_data.py#L254-L264 | train | Adds a token object to the text layer. |
cltl/KafNafParserPy | KafNafParserPy/text_data.py | Ctext.remove_tokens_of_sentence | def remove_tokens_of_sentence(self,sentence_id):
"""
Removes the tokens of the given sentence
@type sentence_id: string
@param sentence_id: the sentence identifier
"""
nodes_to_remove = set()
for wf in self:
if wf.get_sent() == sentence_id:
... | python | def remove_tokens_of_sentence(self,sentence_id):
"""
Removes the tokens of the given sentence
@type sentence_id: string
@param sentence_id: the sentence identifier
"""
nodes_to_remove = set()
for wf in self:
if wf.get_sent() == sentence_id:
... | [
"def",
"remove_tokens_of_sentence",
"(",
"self",
",",
"sentence_id",
")",
":",
"nodes_to_remove",
"=",
"set",
"(",
")",
"for",
"wf",
"in",
"self",
":",
"if",
"wf",
".",
"get_sent",
"(",
")",
"==",
"sentence_id",
":",
"nodes_to_remove",
".",
"add",
"(",
"... | Removes the tokens of the given sentence
@type sentence_id: string
@param sentence_id: the sentence identifier | [
"Removes",
"the",
"tokens",
"of",
"the",
"given",
"sentence"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/text_data.py#L267-L279 | train | Removes the tokens of the given sentence from the list of nodes. |
Open-ET/openet-core-beta | openet/core/interp.py | daily | def daily(target_coll, source_coll, interp_days=32, interp_method='linear'):
"""Generate daily ETa collection from ETo and ETf collections
Parameters
----------
target_coll : ee.ImageCollection
Source images will be interpolated to each target image time_start.
Target images should have... | python | def daily(target_coll, source_coll, interp_days=32, interp_method='linear'):
"""Generate daily ETa collection from ETo and ETf collections
Parameters
----------
target_coll : ee.ImageCollection
Source images will be interpolated to each target image time_start.
Target images should have... | [
"def",
"daily",
"(",
"target_coll",
",",
"source_coll",
",",
"interp_days",
"=",
"32",
",",
"interp_method",
"=",
"'linear'",
")",
":",
"# # DEADBEEF - This module is assuming that the time band is already in",
"# # the source collection.",
"# # Uncomment the following to add a... | Generate daily ETa collection from ETo and ETf collections
Parameters
----------
target_coll : ee.ImageCollection
Source images will be interpolated to each target image time_start.
Target images should have a daily time step. This will typically be
the reference ET (ETr) collectio... | [
"Generate",
"daily",
"ETa",
"collection",
"from",
"ETo",
"and",
"ETf",
"collections"
] | f2b81ccf87bf7e7fe1b9f3dd1d4081d0ec7852db | https://github.com/Open-ET/openet-core-beta/blob/f2b81ccf87bf7e7fe1b9f3dd1d4081d0ec7852db/openet/core/interp.py#L7-L158 | train | Generate a daily ETa collection from ETo and ETf collections. |
Open-ET/openet-core-beta | openet/core/interp.py | aggregate_daily | def aggregate_daily(image_coll, start_date=None, end_date=None,
agg_type='mean'):
"""Aggregate images by day without using joins
The primary purpose of this function is to join separate Landsat images
from the same path into a single daily image.
Parameters
----------
image... | python | def aggregate_daily(image_coll, start_date=None, end_date=None,
agg_type='mean'):
"""Aggregate images by day without using joins
The primary purpose of this function is to join separate Landsat images
from the same path into a single daily image.
Parameters
----------
image... | [
"def",
"aggregate_daily",
"(",
"image_coll",
",",
"start_date",
"=",
"None",
",",
"end_date",
"=",
"None",
",",
"agg_type",
"=",
"'mean'",
")",
":",
"if",
"start_date",
"and",
"end_date",
":",
"test_coll",
"=",
"image_coll",
".",
"filterDate",
"(",
"ee",
"... | Aggregate images by day without using joins
The primary purpose of this function is to join separate Landsat images
from the same path into a single daily image.
Parameters
----------
image_coll : ee.ImageCollection
Input image collection.
start_date : date, number, string, optional
... | [
"Aggregate",
"images",
"by",
"day",
"without",
"using",
"joins"
] | f2b81ccf87bf7e7fe1b9f3dd1d4081d0ec7852db | https://github.com/Open-ET/openet-core-beta/blob/f2b81ccf87bf7e7fe1b9f3dd1d4081d0ec7852db/openet/core/interp.py#L161-L227 | train | Aggregate images by day without using joins
|
Open-ET/openet-core-beta | openet/core/interp.py | aggregate_daily_with_joins | def aggregate_daily_with_joins(image_coll, start_date, end_date,
agg_type='mean'):
"""Aggregate images by day (using joins)
The primary purpose of this function is to join separate Landsat images
from the same path into a single daily image.
Parameters
----------
... | python | def aggregate_daily_with_joins(image_coll, start_date, end_date,
agg_type='mean'):
"""Aggregate images by day (using joins)
The primary purpose of this function is to join separate Landsat images
from the same path into a single daily image.
Parameters
----------
... | [
"def",
"aggregate_daily_with_joins",
"(",
"image_coll",
",",
"start_date",
",",
"end_date",
",",
"agg_type",
"=",
"'mean'",
")",
":",
"# Build a collection of time \"features\" to join to",
"# \"Flatten\" dates to 0 UTC time",
"if",
"start_date",
"and",
"end_date",
":",
"da... | Aggregate images by day (using joins)
The primary purpose of this function is to join separate Landsat images
from the same path into a single daily image.
Parameters
----------
image_coll : ee.ImageCollection
Input image collection.
start_date : date, number, string
Start dat... | [
"Aggregate",
"images",
"by",
"day",
"(",
"using",
"joins",
")"
] | f2b81ccf87bf7e7fe1b9f3dd1d4081d0ec7852db | https://github.com/Open-ET/openet-core-beta/blob/f2b81ccf87bf7e7fe1b9f3dd1d4081d0ec7852db/openet/core/interp.py#L232-L326 | train | Aggregate images by day using joins. |
cltl/KafNafParserPy | KafNafParserPy/causal_data.py | CcausalRelations.remove_this_clink | def remove_this_clink(self,clink_id):
"""
Removes the clink for the given clink identifier
@type clink_id: string
@param clink_id: the clink identifier to be removed
"""
for clink in self.get_clinks():
if clink.get_id() == clink_id:
self.node.r... | python | def remove_this_clink(self,clink_id):
"""
Removes the clink for the given clink identifier
@type clink_id: string
@param clink_id: the clink identifier to be removed
"""
for clink in self.get_clinks():
if clink.get_id() == clink_id:
self.node.r... | [
"def",
"remove_this_clink",
"(",
"self",
",",
"clink_id",
")",
":",
"for",
"clink",
"in",
"self",
".",
"get_clinks",
"(",
")",
":",
"if",
"clink",
".",
"get_id",
"(",
")",
"==",
"clink_id",
":",
"self",
".",
"node",
".",
"remove",
"(",
"clink",
".",
... | Removes the clink for the given clink identifier
@type clink_id: string
@param clink_id: the clink identifier to be removed | [
"Removes",
"the",
"clink",
"for",
"the",
"given",
"clink",
"identifier"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/causal_data.py#L156-L165 | train | Removes the clink for the given clink identifier from the set of clinks in the set of active clinks. |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv1/billing.py | Billing.GetGroupEstimate | def GetGroupEstimate(group,alias=None,location=None):
"""Gets estimated costs for a group of servers.
https://t3n.zendesk.com/entries/22423906-GetGroupEstimate
:param alias: short code for a particular account. If none will use account's default alias
:param location: datacenter where... | python | def GetGroupEstimate(group,alias=None,location=None):
"""Gets estimated costs for a group of servers.
https://t3n.zendesk.com/entries/22423906-GetGroupEstimate
:param alias: short code for a particular account. If none will use account's default alias
:param location: datacenter where... | [
"def",
"GetGroupEstimate",
"(",
"group",
",",
"alias",
"=",
"None",
",",
"location",
"=",
"None",
")",
":",
"if",
"alias",
"is",
"None",
":",
"alias",
"=",
"clc",
".",
"v1",
".",
"Account",
".",
"GetAlias",
"(",
")",
"if",
"location",
"is",
"None",
... | Gets estimated costs for a group of servers.
https://t3n.zendesk.com/entries/22423906-GetGroupEstimate
:param alias: short code for a particular account. If none will use account's default alias
:param location: datacenter where group resides
:param group: group name | [
"Gets",
"estimated",
"costs",
"for",
"a",
"group",
"of",
"servers",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/billing.py#L14-L29 | train | Gets estimated costs for a group of servers. |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv1/billing.py | Billing.GetGroupSummaries | def GetGroupSummaries(alias=None,date_start=None,date_end=None):
"""Gets the charges for groups and servers within a given account, and for any date range.
https://t3n.zendesk.com/entries/22423916-GetGroupSummaries
:param alias: short code for a particular account. If none will use account's ... | python | def GetGroupSummaries(alias=None,date_start=None,date_end=None):
"""Gets the charges for groups and servers within a given account, and for any date range.
https://t3n.zendesk.com/entries/22423916-GetGroupSummaries
:param alias: short code for a particular account. If none will use account's ... | [
"def",
"GetGroupSummaries",
"(",
"alias",
"=",
"None",
",",
"date_start",
"=",
"None",
",",
"date_end",
"=",
"None",
")",
":",
"if",
"alias",
"is",
"None",
":",
"alias",
"=",
"clc",
".",
"v1",
".",
"Account",
".",
"GetAlias",
"(",
")",
"payload",
"="... | Gets the charges for groups and servers within a given account, and for any date range.
https://t3n.zendesk.com/entries/22423916-GetGroupSummaries
:param alias: short code for a particular account. If none will use account's default alias
:param date_start: YYYY-MM-DD string for start date. ... | [
"Gets",
"the",
"charges",
"for",
"groups",
"and",
"servers",
"within",
"a",
"given",
"account",
"and",
"for",
"any",
"date",
"range",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/billing.py#L34-L50 | train | Gets the charges for groups and servers within a given account and for any date range. |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv1/billing.py | Billing.GetServerEstimate | def GetServerEstimate(server,alias=None):
"""Gets the estimated monthly cost for a given server.
https://t3n.zendesk.com/entries/22422323-GetServerEstimate
:param alias: short code for a particular account. If none will use account's default alias
:param server: name of server to quer... | python | def GetServerEstimate(server,alias=None):
"""Gets the estimated monthly cost for a given server.
https://t3n.zendesk.com/entries/22422323-GetServerEstimate
:param alias: short code for a particular account. If none will use account's default alias
:param server: name of server to quer... | [
"def",
"GetServerEstimate",
"(",
"server",
",",
"alias",
"=",
"None",
")",
":",
"if",
"alias",
"is",
"None",
":",
"alias",
"=",
"clc",
".",
"v1",
".",
"Account",
".",
"GetAlias",
"(",
")",
"r",
"=",
"clc",
".",
"v1",
".",
"API",
".",
"Call",
"(",... | Gets the estimated monthly cost for a given server.
https://t3n.zendesk.com/entries/22422323-GetServerEstimate
:param alias: short code for a particular account. If none will use account's default alias
:param server: name of server to query | [
"Gets",
"the",
"estimated",
"monthly",
"cost",
"for",
"a",
"given",
"server",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/billing.py#L54-L65 | train | Gets the estimated monthly cost for a given server. |
nickpandolfi/Cyther | cyther/direct.py | display_direct | def display_direct():
"""
Displays the output of 'get_direct_config', formatted nicely
"""
include_dirs, runtime_dirs, runtime = get_direct_config()
print("Include Search Dirs: {}".format(include_dirs))
print("\tContents: {}\n".format(get_dir_contents(include_dirs)))
print("Runtime Search D... | python | def display_direct():
"""
Displays the output of 'get_direct_config', formatted nicely
"""
include_dirs, runtime_dirs, runtime = get_direct_config()
print("Include Search Dirs: {}".format(include_dirs))
print("\tContents: {}\n".format(get_dir_contents(include_dirs)))
print("Runtime Search D... | [
"def",
"display_direct",
"(",
")",
":",
"include_dirs",
",",
"runtime_dirs",
",",
"runtime",
"=",
"get_direct_config",
"(",
")",
"print",
"(",
"\"Include Search Dirs: {}\"",
".",
"format",
"(",
"include_dirs",
")",
")",
"print",
"(",
"\"\\tContents: {}\\n\"",
".",... | Displays the output of 'get_direct_config', formatted nicely | [
"Displays",
"the",
"output",
"of",
"get_direct_config",
"formatted",
"nicely"
] | 9fb0bd77af594008aa6ee8af460aa8c953abf5bc | https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/direct.py#L20-L30 | train | Displays the output of get_direct_config formatted nicely
|
nickpandolfi/Cyther | cyther/direct.py | getIncludeAndRuntime | def getIncludeAndRuntime():
"""
A function from distutils' build_ext.py that was updated and changed
to ACTUALLY WORK
"""
include_dirs, library_dirs = [], []
py_include = distutils.sysconfig.get_python_inc()
plat_py_include = distutils.sysconfig.get_python_inc(plat_specific=1)
include_... | python | def getIncludeAndRuntime():
"""
A function from distutils' build_ext.py that was updated and changed
to ACTUALLY WORK
"""
include_dirs, library_dirs = [], []
py_include = distutils.sysconfig.get_python_inc()
plat_py_include = distutils.sysconfig.get_python_inc(plat_specific=1)
include_... | [
"def",
"getIncludeAndRuntime",
"(",
")",
":",
"include_dirs",
",",
"library_dirs",
"=",
"[",
"]",
",",
"[",
"]",
"py_include",
"=",
"distutils",
".",
"sysconfig",
".",
"get_python_inc",
"(",
")",
"plat_py_include",
"=",
"distutils",
".",
"sysconfig",
".",
"g... | A function from distutils' build_ext.py that was updated and changed
to ACTUALLY WORK | [
"A",
"function",
"from",
"distutils",
"build_ext",
".",
"py",
"that",
"was",
"updated",
"and",
"changed",
"to",
"ACTUALLY",
"WORK"
] | 9fb0bd77af594008aa6ee8af460aa8c953abf5bc | https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/direct.py#L50-L119 | train | A function from distutils build_ext. py that was updated and changed to ACTUALLY WORK
|
mjirik/imtools | imtools/thresholding_functions.py | get_priority_objects | def get_priority_objects(data, nObj=1, seeds=None, seeds_multi_index=None, debug=False):
"""
Get N biggest objects from the selection or the object with seed.
Similar function is in image_manipulation.select_objects_by_seeds(). Use it if possible.
:param data: labeled ndarray
:param nObj: number ... | python | def get_priority_objects(data, nObj=1, seeds=None, seeds_multi_index=None, debug=False):
"""
Get N biggest objects from the selection or the object with seed.
Similar function is in image_manipulation.select_objects_by_seeds(). Use it if possible.
:param data: labeled ndarray
:param nObj: number ... | [
"def",
"get_priority_objects",
"(",
"data",
",",
"nObj",
"=",
"1",
",",
"seeds",
"=",
"None",
",",
"seeds_multi_index",
"=",
"None",
",",
"debug",
"=",
"False",
")",
":",
"# Oznaceni dat.",
"# labels - oznacena data.",
"# length - pocet rozdilnych oznaceni.",
"if",
... | Get N biggest objects from the selection or the object with seed.
Similar function is in image_manipulation.select_objects_by_seeds(). Use it if possible.
:param data: labeled ndarray
:param nObj: number of objects
:param seeds: ndarray. Objects on non zero positions are returned
:param debug: bo... | [
"Get",
"N",
"biggest",
"objects",
"from",
"the",
"selection",
"or",
"the",
"object",
"with",
"seed",
".",
"Similar",
"function",
"is",
"in",
"image_manipulation",
".",
"select_objects_by_seeds",
"()",
".",
"Use",
"it",
"if",
"possible",
"."
] | eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a | https://github.com/mjirik/imtools/blob/eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a/imtools/thresholding_functions.py#L355-L498 | train | Get N biggest objects from the selection or the object with seed. |
mjirik/imtools | imtools/thresholding_functions.py | selectSort | def selectSort(list1, list2):
"""
Razeni 2 poli najednou (list) pomoci metody select sort
input:
list1 - prvni pole (hlavni pole pro razeni)
list2 - druhe pole (vedlejsi pole) (kopirujici pozice pro razeni
podle hlavniho pole list1)
returns:
d... | python | def selectSort(list1, list2):
"""
Razeni 2 poli najednou (list) pomoci metody select sort
input:
list1 - prvni pole (hlavni pole pro razeni)
list2 - druhe pole (vedlejsi pole) (kopirujici pozice pro razeni
podle hlavniho pole list1)
returns:
d... | [
"def",
"selectSort",
"(",
"list1",
",",
"list2",
")",
":",
"length",
"=",
"len",
"(",
"list1",
")",
"for",
"index",
"in",
"range",
"(",
"0",
",",
"length",
")",
":",
"min",
"=",
"index",
"for",
"index2",
"in",
"range",
"(",
"index",
"+",
"1",
","... | Razeni 2 poli najednou (list) pomoci metody select sort
input:
list1 - prvni pole (hlavni pole pro razeni)
list2 - druhe pole (vedlejsi pole) (kopirujici pozice pro razeni
podle hlavniho pole list1)
returns:
dve serazena pole - hodnoty se ridi podle p... | [
"Razeni",
"2",
"poli",
"najednou",
"(",
"list",
")",
"pomoci",
"metody",
"select",
"sort",
"input",
":",
"list1",
"-",
"prvni",
"pole",
"(",
"hlavni",
"pole",
"pro",
"razeni",
")",
"list2",
"-",
"druhe",
"pole",
"(",
"vedlejsi",
"pole",
")",
"(",
"kopi... | eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a | https://github.com/mjirik/imtools/blob/eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a/imtools/thresholding_functions.py#L524-L548 | train | select sort
Razeni 2 poli najednou list1 list2 |
mjirik/imtools | imtools/trainer3d.py | Trainer3D.save | def save(self, filename='saved.ol.p'):
"""
Save model to pickle file
"""
import dill as pickle
sv = {
# 'feature_function': self.feature_function,
'cl': self.cl
}
pickle.dump(sv, open(filename, "wb")) | python | def save(self, filename='saved.ol.p'):
"""
Save model to pickle file
"""
import dill as pickle
sv = {
# 'feature_function': self.feature_function,
'cl': self.cl
}
pickle.dump(sv, open(filename, "wb")) | [
"def",
"save",
"(",
"self",
",",
"filename",
"=",
"'saved.ol.p'",
")",
":",
"import",
"dill",
"as",
"pickle",
"sv",
"=",
"{",
"# 'feature_function': self.feature_function,",
"'cl'",
":",
"self",
".",
"cl",
"}",
"pickle",
".",
"dump",
"(",
"sv",
",",
"open"... | Save model to pickle file | [
"Save",
"model",
"to",
"pickle",
"file"
] | eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a | https://github.com/mjirik/imtools/blob/eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a/imtools/trainer3d.py#L36-L46 | train | Save the current state of the object to a pickle file. |
mjirik/imtools | imtools/trainer3d.py | Trainer3D.predict_w | def predict_w(self, data3d, voxelsize_mm, weight, label0=0, label1=1):
"""
segmentation with weight factor
:param data3d:
:param voxelsize_mm:
:param weight:
:return:
"""
scores = self.scores(data3d, voxelsize_mm)
out = scores[label1] > (weight * s... | python | def predict_w(self, data3d, voxelsize_mm, weight, label0=0, label1=1):
"""
segmentation with weight factor
:param data3d:
:param voxelsize_mm:
:param weight:
:return:
"""
scores = self.scores(data3d, voxelsize_mm)
out = scores[label1] > (weight * s... | [
"def",
"predict_w",
"(",
"self",
",",
"data3d",
",",
"voxelsize_mm",
",",
"weight",
",",
"label0",
"=",
"0",
",",
"label1",
"=",
"1",
")",
":",
"scores",
"=",
"self",
".",
"scores",
"(",
"data3d",
",",
"voxelsize_mm",
")",
"out",
"=",
"scores",
"[",
... | segmentation with weight factor
:param data3d:
:param voxelsize_mm:
:param weight:
:return: | [
"segmentation",
"with",
"weight",
"factor",
":",
"param",
"data3d",
":",
":",
"param",
"voxelsize_mm",
":",
":",
"param",
"weight",
":",
":",
"return",
":"
] | eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a | https://github.com/mjirik/imtools/blob/eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a/imtools/trainer3d.py#L84-L95 | train | predict the segmentation with weight factor |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv1/group.py | Group.GetGroupUUID | def GetGroupUUID(group,alias=None,location=None):
"""Given a group name return the unique group ID.
:param alias: short code for a particular account. If none will use account's default alias
:param location: datacenter where group resides
:param group: group name
"""
if alias is None: alias = clc.v1.Acc... | python | def GetGroupUUID(group,alias=None,location=None):
"""Given a group name return the unique group ID.
:param alias: short code for a particular account. If none will use account's default alias
:param location: datacenter where group resides
:param group: group name
"""
if alias is None: alias = clc.v1.Acc... | [
"def",
"GetGroupUUID",
"(",
"group",
",",
"alias",
"=",
"None",
",",
"location",
"=",
"None",
")",
":",
"if",
"alias",
"is",
"None",
":",
"alias",
"=",
"clc",
".",
"v1",
".",
"Account",
".",
"GetAlias",
"(",
")",
"if",
"location",
"is",
"None",
":"... | Given a group name return the unique group ID.
:param alias: short code for a particular account. If none will use account's default alias
:param location: datacenter where group resides
:param group: group name | [
"Given",
"a",
"group",
"name",
"return",
"the",
"unique",
"group",
"ID",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/group.py#L14-L28 | train | Given a group name return the unique group ID. |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv1/group.py | Group.NameGroups | def NameGroups(data_arr,id_key):
"""Get group name associated with ID.
TODO - not yet implemented
"""
new_data_arr = []
for data in data_arr:
try:
data_arr[id_key] = clc._GROUP_MAPPING[data[id_key]]
except:
pass
new_data_arr.append(data)
if clc.args: clc.v1.output.Status("ERROR",2,"Group ... | python | def NameGroups(data_arr,id_key):
"""Get group name associated with ID.
TODO - not yet implemented
"""
new_data_arr = []
for data in data_arr:
try:
data_arr[id_key] = clc._GROUP_MAPPING[data[id_key]]
except:
pass
new_data_arr.append(data)
if clc.args: clc.v1.output.Status("ERROR",2,"Group ... | [
"def",
"NameGroups",
"(",
"data_arr",
",",
"id_key",
")",
":",
"new_data_arr",
"=",
"[",
"]",
"for",
"data",
"in",
"data_arr",
":",
"try",
":",
"data_arr",
"[",
"id_key",
"]",
"=",
"clc",
".",
"_GROUP_MAPPING",
"[",
"data",
"[",
"id_key",
"]",
"]",
"... | Get group name associated with ID.
TODO - not yet implemented | [
"Get",
"group",
"name",
"associated",
"with",
"ID",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/group.py#L33-L46 | train | Get group name associated with ID. |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv1/group.py | Group.GetGroups | def GetGroups(location=None,alias=None):
"""Return all of alias' groups in the given location.
http://www.centurylinkcloud.com/api-docs/v2/#groups-get-group
:param alias: short code for a particular account. If none will use account's default alias
:param location: datacenter where group resides
"""
if a... | python | def GetGroups(location=None,alias=None):
"""Return all of alias' groups in the given location.
http://www.centurylinkcloud.com/api-docs/v2/#groups-get-group
:param alias: short code for a particular account. If none will use account's default alias
:param location: datacenter where group resides
"""
if a... | [
"def",
"GetGroups",
"(",
"location",
"=",
"None",
",",
"alias",
"=",
"None",
")",
":",
"if",
"alias",
"is",
"None",
":",
"alias",
"=",
"clc",
".",
"v1",
".",
"Account",
".",
"GetAlias",
"(",
")",
"if",
"location",
"is",
"None",
":",
"location",
"="... | Return all of alias' groups in the given location.
http://www.centurylinkcloud.com/api-docs/v2/#groups-get-group
:param alias: short code for a particular account. If none will use account's default alias
:param location: datacenter where group resides | [
"Return",
"all",
"of",
"alias",
"groups",
"in",
"the",
"given",
"location",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/group.py#L50-L62 | train | Return all of alias groups in the given location. |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv1/group.py | Group.Create | def Create(group,parent=None,description='',alias=None,location=None):
"""Creates a new group
https://t3n.zendesk.com/entries/20979861-Create-Hardware-Group
:param alias: short code for a particular account. If none will use account's default alias
:param location: datacenter where group resides
:param par... | python | def Create(group,parent=None,description='',alias=None,location=None):
"""Creates a new group
https://t3n.zendesk.com/entries/20979861-Create-Hardware-Group
:param alias: short code for a particular account. If none will use account's default alias
:param location: datacenter where group resides
:param par... | [
"def",
"Create",
"(",
"group",
",",
"parent",
"=",
"None",
",",
"description",
"=",
"''",
",",
"alias",
"=",
"None",
",",
"location",
"=",
"None",
")",
":",
"if",
"alias",
"is",
"None",
":",
"alias",
"=",
"clc",
".",
"v1",
".",
"Account",
".",
"G... | Creates a new group
https://t3n.zendesk.com/entries/20979861-Create-Hardware-Group
:param alias: short code for a particular account. If none will use account's default alias
:param location: datacenter where group resides
:param parent: groups can be nested - name of parent group. If None will be a topleve... | [
"Creates",
"a",
"new",
"group"
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/group.py#L66-L85 | train | Create a new group in the specified account. |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv1/group.py | Group._GroupActions | def _GroupActions(action,group,alias,location):
"""Applies group level actions.
:param action: the server action url to exec against
:param group: group name
:param alias: short code for a particular account. If none will use account's default alias
:param location: datacenter location. If none will use ac... | python | def _GroupActions(action,group,alias,location):
"""Applies group level actions.
:param action: the server action url to exec against
:param group: group name
:param alias: short code for a particular account. If none will use account's default alias
:param location: datacenter location. If none will use ac... | [
"def",
"_GroupActions",
"(",
"action",
",",
"group",
",",
"alias",
",",
"location",
")",
":",
"if",
"alias",
"is",
"None",
":",
"alias",
"=",
"clc",
".",
"v1",
".",
"Account",
".",
"GetAlias",
"(",
")",
"if",
"location",
"is",
"None",
":",
"location"... | Applies group level actions.
:param action: the server action url to exec against
:param group: group name
:param alias: short code for a particular account. If none will use account's default alias
:param location: datacenter location. If none will use account's default alias | [
"Applies",
"group",
"level",
"actions",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/group.py#L89-L102 | train | Applies group level actions. |
sio2project/filetracker | filetracker/servers/base.py | get_endpoint_and_path | def get_endpoint_and_path(environ):
"""Extracts "endpoint" and "path" from the request URL.
Endpoint is the first path component, and path is the rest. Both
of them are without leading slashes.
"""
path = environ['PATH_INFO']
components = path.split('/')
if '..' in components:
rais... | python | def get_endpoint_and_path(environ):
"""Extracts "endpoint" and "path" from the request URL.
Endpoint is the first path component, and path is the rest. Both
of them are without leading slashes.
"""
path = environ['PATH_INFO']
components = path.split('/')
if '..' in components:
rais... | [
"def",
"get_endpoint_and_path",
"(",
"environ",
")",
":",
"path",
"=",
"environ",
"[",
"'PATH_INFO'",
"]",
"components",
"=",
"path",
".",
"split",
"(",
"'/'",
")",
"if",
"'..'",
"in",
"components",
":",
"raise",
"HttpError",
"(",
"'400 Bad Request'",
",",
... | Extracts "endpoint" and "path" from the request URL.
Endpoint is the first path component, and path is the rest. Both
of them are without leading slashes. | [
"Extracts",
"endpoint",
"and",
"path",
"from",
"the",
"request",
"URL",
"."
] | 359b474850622e3d0c25ee2596d7242c02f84efb | https://github.com/sio2project/filetracker/blob/359b474850622e3d0c25ee2596d7242c02f84efb/filetracker/servers/base.py#L63-L90 | train | Extracts endpoint and path from the request URL. |
sio2project/filetracker | filetracker/servers/base.py | main | def main(server):
"""A convenience ``main`` method for running WSGI-compatible HTTP
application as CGI, FCGI or standalone (with auto-detection)."""
if 'REQUEST_METHOD' in os.environ:
start_cgi(server)
stdin_sock = socket.fromfd(0, socket.AF_UNIX, socket.SOCK_STREAM)
try:
stdin_... | python | def main(server):
"""A convenience ``main`` method for running WSGI-compatible HTTP
application as CGI, FCGI or standalone (with auto-detection)."""
if 'REQUEST_METHOD' in os.environ:
start_cgi(server)
stdin_sock = socket.fromfd(0, socket.AF_UNIX, socket.SOCK_STREAM)
try:
stdin_... | [
"def",
"main",
"(",
"server",
")",
":",
"if",
"'REQUEST_METHOD'",
"in",
"os",
".",
"environ",
":",
"start_cgi",
"(",
"server",
")",
"stdin_sock",
"=",
"socket",
".",
"fromfd",
"(",
"0",
",",
"socket",
".",
"AF_UNIX",
",",
"socket",
".",
"SOCK_STREAM",
... | A convenience ``main`` method for running WSGI-compatible HTTP
application as CGI, FCGI or standalone (with auto-detection). | [
"A",
"convenience",
"main",
"method",
"for",
"running",
"WSGI",
"-",
"compatible",
"HTTP",
"application",
"as",
"CGI",
"FCGI",
"or",
"standalone",
"(",
"with",
"auto",
"-",
"detection",
")",
"."
] | 359b474850622e3d0c25ee2596d7242c02f84efb | https://github.com/sio2project/filetracker/blob/359b474850622e3d0c25ee2596d7242c02f84efb/filetracker/servers/base.py#L115-L129 | train | A convenience method for running WSGI - compatible HTTP
application as CGI FCGI or standalone. |
mjirik/imtools | imtools/lar_show_segmentation.py | showSegmentation | def showSegmentation(
segmentation,
voxelsize_mm=np.ones([3, 1]),
degrad=4,
label=1,
smoothing=True
):
"""
Funkce vrací trojrozměrné porobné jako data['segmentation']
v data['slab'] je popsáno, co která hodnota znamená
"""
labels = []
segmentation... | python | def showSegmentation(
segmentation,
voxelsize_mm=np.ones([3, 1]),
degrad=4,
label=1,
smoothing=True
):
"""
Funkce vrací trojrozměrné porobné jako data['segmentation']
v data['slab'] je popsáno, co která hodnota znamená
"""
labels = []
segmentation... | [
"def",
"showSegmentation",
"(",
"segmentation",
",",
"voxelsize_mm",
"=",
"np",
".",
"ones",
"(",
"[",
"3",
",",
"1",
"]",
")",
",",
"degrad",
"=",
"4",
",",
"label",
"=",
"1",
",",
"smoothing",
"=",
"True",
")",
":",
"labels",
"=",
"[",
"]",
"se... | Funkce vrací trojrozměrné porobné jako data['segmentation']
v data['slab'] je popsáno, co která hodnota znamená | [
"Funkce",
"vrací",
"trojrozměrné",
"porobné",
"jako",
"data",
"[",
"segmentation",
"]",
"v",
"data",
"[",
"slab",
"]",
"je",
"popsáno",
"co",
"která",
"hodnota",
"znamená"
] | eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a | https://github.com/mjirik/imtools/blob/eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a/imtools/lar_show_segmentation.py#L72-L100 | train | Show segmentation in a single file. |
srossross/rpmfile | rpmfile/cpiofile.py | StructBase.pack | def pack(self):
"""convenience function for packing"""
block = bytearray(self.size)
self.pack_into(block)
return block | python | def pack(self):
"""convenience function for packing"""
block = bytearray(self.size)
self.pack_into(block)
return block | [
"def",
"pack",
"(",
"self",
")",
":",
"block",
"=",
"bytearray",
"(",
"self",
".",
"size",
")",
"self",
".",
"pack_into",
"(",
"block",
")",
"return",
"block"
] | convenience function for packing | [
"convenience",
"function",
"for",
"packing"
] | 3ab96f211da7b56f5e99d8cc248f714a6e542d31 | https://github.com/srossross/rpmfile/blob/3ab96f211da7b56f5e99d8cc248f714a6e542d31/rpmfile/cpiofile.py#L108-L112 | train | convenience function for packing the object into a byte array |
srossross/rpmfile | rpmfile/cpiofile.py | CpioFile._open | def _open(self, name=None, fileobj=None, mymap=None, block=None):
"""
The _open function takes some form of file identifier and creates
an :py:class:`CpioFile` instance from it.
:param :py:class:`str` name: a file name
:param :py:class:`file` fileobj: if given, this overrides *n... | python | def _open(self, name=None, fileobj=None, mymap=None, block=None):
"""
The _open function takes some form of file identifier and creates
an :py:class:`CpioFile` instance from it.
:param :py:class:`str` name: a file name
:param :py:class:`file` fileobj: if given, this overrides *n... | [
"def",
"_open",
"(",
"self",
",",
"name",
"=",
"None",
",",
"fileobj",
"=",
"None",
",",
"mymap",
"=",
"None",
",",
"block",
"=",
"None",
")",
":",
"if",
"block",
"is",
"not",
"None",
":",
"if",
"not",
"name",
":",
"name",
"=",
"'<unknown>'",
"se... | The _open function takes some form of file identifier and creates
an :py:class:`CpioFile` instance from it.
:param :py:class:`str` name: a file name
:param :py:class:`file` fileobj: if given, this overrides *name*
:param :py:class:`mmap.mmap` mymap: if given, this overrides *fileobj*
... | [
"The",
"_open",
"function",
"takes",
"some",
"form",
"of",
"file",
"identifier",
"and",
"creates",
"an",
":",
"py",
":",
"class",
":",
"CpioFile",
"instance",
"from",
"it",
"."
] | 3ab96f211da7b56f5e99d8cc248f714a6e542d31 | https://github.com/srossross/rpmfile/blob/3ab96f211da7b56f5e99d8cc248f714a6e542d31/rpmfile/cpiofile.py#L171-L223 | train | This function opens a new file in the cache and returns a new object. |
srossross/rpmfile | rpmfile/cpiofile.py | CpioFile.get_member | def get_member(self, name):
"""return a member by *name*"""
for member in self.members:
if member.name == name:
return member
return None | python | def get_member(self, name):
"""return a member by *name*"""
for member in self.members:
if member.name == name:
return member
return None | [
"def",
"get_member",
"(",
"self",
",",
"name",
")",
":",
"for",
"member",
"in",
"self",
".",
"members",
":",
"if",
"member",
".",
"name",
"==",
"name",
":",
"return",
"member",
"return",
"None"
] | return a member by *name* | [
"return",
"a",
"member",
"by",
"*",
"name",
"*"
] | 3ab96f211da7b56f5e99d8cc248f714a6e542d31 | https://github.com/srossross/rpmfile/blob/3ab96f211da7b56f5e99d8cc248f714a6e542d31/rpmfile/cpiofile.py#L252-L258 | train | return a member by name |
srossross/rpmfile | rpmfile/cpiofile.py | CpioMember.encoded_class | def encoded_class(block, offset=0):
"""
predicate indicating whether a block of memory includes a magic number
"""
if not block:
raise InvalidFileFormatNull
for key in __magicmap__:
if block.find(key, offset, offset + len(key)) > -1:
retur... | python | def encoded_class(block, offset=0):
"""
predicate indicating whether a block of memory includes a magic number
"""
if not block:
raise InvalidFileFormatNull
for key in __magicmap__:
if block.find(key, offset, offset + len(key)) > -1:
retur... | [
"def",
"encoded_class",
"(",
"block",
",",
"offset",
"=",
"0",
")",
":",
"if",
"not",
"block",
":",
"raise",
"InvalidFileFormatNull",
"for",
"key",
"in",
"__magicmap__",
":",
"if",
"block",
".",
"find",
"(",
"key",
",",
"offset",
",",
"offset",
"+",
"l... | predicate indicating whether a block of memory includes a magic number | [
"predicate",
"indicating",
"whether",
"a",
"block",
"of",
"memory",
"includes",
"a",
"magic",
"number"
] | 3ab96f211da7b56f5e99d8cc248f714a6e542d31 | https://github.com/srossross/rpmfile/blob/3ab96f211da7b56f5e99d8cc248f714a6e542d31/rpmfile/cpiofile.py#L295-L306 | train | predicate indicating whether a block of memory includes a magic number
|
sio2project/filetracker | filetracker/servers/storage.py | _copy_stream | def _copy_stream(src, dest, length=0):
"""Similar to shutil.copyfileobj, but supports limiting data size.
As for why this is required, refer to
https://www.python.org/dev/peps/pep-0333/#input-and-error-streams
Yes, there are WSGI implementations which do not support EOFs, and
believe me, you don't... | python | def _copy_stream(src, dest, length=0):
"""Similar to shutil.copyfileobj, but supports limiting data size.
As for why this is required, refer to
https://www.python.org/dev/peps/pep-0333/#input-and-error-streams
Yes, there are WSGI implementations which do not support EOFs, and
believe me, you don't... | [
"def",
"_copy_stream",
"(",
"src",
",",
"dest",
",",
"length",
"=",
"0",
")",
":",
"if",
"length",
"==",
"0",
":",
"shutil",
".",
"copyfileobj",
"(",
"src",
",",
"dest",
")",
"return",
"bytes_left",
"=",
"length",
"while",
"bytes_left",
">",
"0",
":"... | Similar to shutil.copyfileobj, but supports limiting data size.
As for why this is required, refer to
https://www.python.org/dev/peps/pep-0333/#input-and-error-streams
Yes, there are WSGI implementations which do not support EOFs, and
believe me, you don't want to debug this.
Args:
src: s... | [
"Similar",
"to",
"shutil",
".",
"copyfileobj",
"but",
"supports",
"limiting",
"data",
"size",
"."
] | 359b474850622e3d0c25ee2596d7242c02f84efb | https://github.com/sio2project/filetracker/blob/359b474850622e3d0c25ee2596d7242c02f84efb/filetracker/servers/storage.py#L375-L400 | train | Similar to shutil. copyfileobj but supports limiting data size. |
sio2project/filetracker | filetracker/servers/storage.py | _read_stream_for_size | def _read_stream_for_size(stream):
"""Reads a stream discarding the data read and returns its size."""
size = 0
while True:
buf = stream.read(_BUFFER_SIZE)
size += len(buf)
if not buf:
break
return size | python | def _read_stream_for_size(stream):
"""Reads a stream discarding the data read and returns its size."""
size = 0
while True:
buf = stream.read(_BUFFER_SIZE)
size += len(buf)
if not buf:
break
return size | [
"def",
"_read_stream_for_size",
"(",
"stream",
")",
":",
"size",
"=",
"0",
"while",
"True",
":",
"buf",
"=",
"stream",
".",
"read",
"(",
"_BUFFER_SIZE",
")",
"size",
"+=",
"len",
"(",
"buf",
")",
"if",
"not",
"buf",
":",
"break",
"return",
"size"
] | Reads a stream discarding the data read and returns its size. | [
"Reads",
"a",
"stream",
"discarding",
"the",
"data",
"read",
"and",
"returns",
"its",
"size",
"."
] | 359b474850622e3d0c25ee2596d7242c02f84efb | https://github.com/sio2project/filetracker/blob/359b474850622e3d0c25ee2596d7242c02f84efb/filetracker/servers/storage.py#L403-L411 | train | Reads a stream discarding the data read and returns its size. |
sio2project/filetracker | filetracker/servers/storage.py | _path_exists | def _path_exists(path):
"""Checks if the path exists
- is a file, a directory or a symbolic link that may be broken."""
return os.path.exists(path) or os.path.islink(path) | python | def _path_exists(path):
"""Checks if the path exists
- is a file, a directory or a symbolic link that may be broken."""
return os.path.exists(path) or os.path.islink(path) | [
"def",
"_path_exists",
"(",
"path",
")",
":",
"return",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
"or",
"os",
".",
"path",
".",
"islink",
"(",
"path",
")"
] | Checks if the path exists
- is a file, a directory or a symbolic link that may be broken. | [
"Checks",
"if",
"the",
"path",
"exists",
"-",
"is",
"a",
"file",
"a",
"directory",
"or",
"a",
"symbolic",
"link",
"that",
"may",
"be",
"broken",
"."
] | 359b474850622e3d0c25ee2596d7242c02f84efb | https://github.com/sio2project/filetracker/blob/359b474850622e3d0c25ee2596d7242c02f84efb/filetracker/servers/storage.py#L420-L423 | train | Checks if the path exists in the current virtual folder. |
sio2project/filetracker | filetracker/servers/storage.py | _exclusive_lock | def _exclusive_lock(path):
"""A simple wrapper for fcntl exclusive lock."""
_create_file_dirs(path)
fd = os.open(path, os.O_WRONLY | os.O_CREAT, 0o600)
try:
retries_left = _LOCK_RETRIES
success = False
while retries_left > 0:
# try to acquire the lock in a loop
... | python | def _exclusive_lock(path):
"""A simple wrapper for fcntl exclusive lock."""
_create_file_dirs(path)
fd = os.open(path, os.O_WRONLY | os.O_CREAT, 0o600)
try:
retries_left = _LOCK_RETRIES
success = False
while retries_left > 0:
# try to acquire the lock in a loop
... | [
"def",
"_exclusive_lock",
"(",
"path",
")",
":",
"_create_file_dirs",
"(",
"path",
")",
"fd",
"=",
"os",
".",
"open",
"(",
"path",
",",
"os",
".",
"O_WRONLY",
"|",
"os",
".",
"O_CREAT",
",",
"0o600",
")",
"try",
":",
"retries_left",
"=",
"_LOCK_RETRIES... | A simple wrapper for fcntl exclusive lock. | [
"A",
"simple",
"wrapper",
"for",
"fcntl",
"exclusive",
"lock",
"."
] | 359b474850622e3d0c25ee2596d7242c02f84efb | https://github.com/sio2project/filetracker/blob/359b474850622e3d0c25ee2596d7242c02f84efb/filetracker/servers/storage.py#L431-L463 | train | A simple wrapper for fcntl exclusive lock. |
sio2project/filetracker | filetracker/servers/storage.py | FileStorage.store | def store(self, name, data, version, size=0,
compressed=False, digest=None, logical_size=None):
"""Adds a new file to the storage.
If the file with the same name existed before, it's not
guaranteed that the link for the old version will exist until
the operation co... | python | def store(self, name, data, version, size=0,
compressed=False, digest=None, logical_size=None):
"""Adds a new file to the storage.
If the file with the same name existed before, it's not
guaranteed that the link for the old version will exist until
the operation co... | [
"def",
"store",
"(",
"self",
",",
"name",
",",
"data",
",",
"version",
",",
"size",
"=",
"0",
",",
"compressed",
"=",
"False",
",",
"digest",
"=",
"None",
",",
"logical_size",
"=",
"None",
")",
":",
"with",
"_exclusive_lock",
"(",
"self",
".",
"_lock... | Adds a new file to the storage.
If the file with the same name existed before, it's not
guaranteed that the link for the old version will exist until
the operation completes, but it's guaranteed that the link
will never point to an invalid blob.
Args:
name: ... | [
"Adds",
"a",
"new",
"file",
"to",
"the",
"storage",
".",
"If",
"the",
"file",
"with",
"the",
"same",
"name",
"existed",
"before",
"it",
"s",
"not",
"guaranteed",
"that",
"the",
"link",
"for",
"the",
"old",
"version",
"will",
"exist",
"until",
"the",
"o... | 359b474850622e3d0c25ee2596d7242c02f84efb | https://github.com/sio2project/filetracker/blob/359b474850622e3d0c25ee2596d7242c02f84efb/filetracker/servers/storage.py#L106-L220 | train | Stores a new file in the storage. |
sio2project/filetracker | filetracker/servers/storage.py | FileStorage.delete | def delete(self, name, version, _lock=True):
"""Removes a file from the storage.
Args:
name: name of the file being deleted.
May contain slashes that are treated as path separators.
version: file "version" that is meant to be deleted
If the fi... | python | def delete(self, name, version, _lock=True):
"""Removes a file from the storage.
Args:
name: name of the file being deleted.
May contain slashes that are treated as path separators.
version: file "version" that is meant to be deleted
If the fi... | [
"def",
"delete",
"(",
"self",
",",
"name",
",",
"version",
",",
"_lock",
"=",
"True",
")",
":",
"link_path",
"=",
"self",
".",
"_link_path",
"(",
"name",
")",
"if",
"_lock",
":",
"file_lock",
"=",
"_exclusive_lock",
"(",
"self",
".",
"_lock_path",
"(",... | Removes a file from the storage.
Args:
name: name of the file being deleted.
May contain slashes that are treated as path separators.
version: file "version" that is meant to be deleted
If the file that is stored has newer version than provided,
... | [
"Removes",
"a",
"file",
"from",
"the",
"storage",
"."
] | 359b474850622e3d0c25ee2596d7242c02f84efb | https://github.com/sio2project/filetracker/blob/359b474850622e3d0c25ee2596d7242c02f84efb/filetracker/servers/storage.py#L222-L287 | train | Removes a file from the storage. |
sio2project/filetracker | filetracker/servers/storage.py | FileStorage.stored_version | def stored_version(self, name):
"""Returns the version of file `name` or None if it doesn't exist."""
link_path = self._link_path(name)
if not _path_exists(link_path):
return None
return _file_version(link_path) | python | def stored_version(self, name):
"""Returns the version of file `name` or None if it doesn't exist."""
link_path = self._link_path(name)
if not _path_exists(link_path):
return None
return _file_version(link_path) | [
"def",
"stored_version",
"(",
"self",
",",
"name",
")",
":",
"link_path",
"=",
"self",
".",
"_link_path",
"(",
"name",
")",
"if",
"not",
"_path_exists",
"(",
"link_path",
")",
":",
"return",
"None",
"return",
"_file_version",
"(",
"link_path",
")"
] | Returns the version of file `name` or None if it doesn't exist. | [
"Returns",
"the",
"version",
"of",
"file",
"name",
"or",
"None",
"if",
"it",
"doesn",
"t",
"exist",
"."
] | 359b474850622e3d0c25ee2596d7242c02f84efb | https://github.com/sio2project/filetracker/blob/359b474850622e3d0c25ee2596d7242c02f84efb/filetracker/servers/storage.py#L289-L294 | train | Returns the version of the file with the given name. |
sio2project/filetracker | filetracker/servers/storage.py | FileStorage.logical_size | def logical_size(self, name):
"""Returns the logical size (before compression) of file `name`."""
digest = self._digest_for_link(name)
logical_size = self.db.get('{}:logical_size'.format(digest).encode())
if logical_size:
return int(logical_size.decode())
else:
... | python | def logical_size(self, name):
"""Returns the logical size (before compression) of file `name`."""
digest = self._digest_for_link(name)
logical_size = self.db.get('{}:logical_size'.format(digest).encode())
if logical_size:
return int(logical_size.decode())
else:
... | [
"def",
"logical_size",
"(",
"self",
",",
"name",
")",
":",
"digest",
"=",
"self",
".",
"_digest_for_link",
"(",
"name",
")",
"logical_size",
"=",
"self",
".",
"db",
".",
"get",
"(",
"'{}:logical_size'",
".",
"format",
"(",
"digest",
")",
".",
"encode",
... | Returns the logical size (before compression) of file `name`. | [
"Returns",
"the",
"logical",
"size",
"(",
"before",
"compression",
")",
"of",
"file",
"name",
"."
] | 359b474850622e3d0c25ee2596d7242c02f84efb | https://github.com/sio2project/filetracker/blob/359b474850622e3d0c25ee2596d7242c02f84efb/filetracker/servers/storage.py#L296-L305 | train | Returns the logical size of the file name. |
sio2project/filetracker | filetracker/servers/storage.py | _InputStreamWrapper.save | def save(self, new_path=None):
"""Moves or creates the file with stream contents to a new location.
Args:
new_path: path to move to, if None a temporary file is created.
"""
self.saved_in_temp = new_path is None
if new_path is None:
fd, new_path = tempfil... | python | def save(self, new_path=None):
"""Moves or creates the file with stream contents to a new location.
Args:
new_path: path to move to, if None a temporary file is created.
"""
self.saved_in_temp = new_path is None
if new_path is None:
fd, new_path = tempfil... | [
"def",
"save",
"(",
"self",
",",
"new_path",
"=",
"None",
")",
":",
"self",
".",
"saved_in_temp",
"=",
"new_path",
"is",
"None",
"if",
"new_path",
"is",
"None",
":",
"fd",
",",
"new_path",
"=",
"tempfile",
".",
"mkstemp",
"(",
")",
"os",
".",
"close"... | Moves or creates the file with stream contents to a new location.
Args:
new_path: path to move to, if None a temporary file is created. | [
"Moves",
"or",
"creates",
"the",
"file",
"with",
"stream",
"contents",
"to",
"a",
"new",
"location",
"."
] | 359b474850622e3d0c25ee2596d7242c02f84efb | https://github.com/sio2project/filetracker/blob/359b474850622e3d0c25ee2596d7242c02f84efb/filetracker/servers/storage.py#L353-L369 | train | Moves or creates the file with stream contents to a new location. |
cltl/KafNafParserPy | KafNafParserPy/KafNafParserMod.py | KafNafParser.to_kaf | def to_kaf(self):
"""
Converts a NAF object to KAF (in memory). You will have to use the method dump later to save it as a new KAF file
"""
if self.type == 'NAF':
self.root.tag = 'KAF'
self.type = 'KAF'
## Convert the header
if self.header is not... | python | def to_kaf(self):
"""
Converts a NAF object to KAF (in memory). You will have to use the method dump later to save it as a new KAF file
"""
if self.type == 'NAF':
self.root.tag = 'KAF'
self.type = 'KAF'
## Convert the header
if self.header is not... | [
"def",
"to_kaf",
"(",
"self",
")",
":",
"if",
"self",
".",
"type",
"==",
"'NAF'",
":",
"self",
".",
"root",
".",
"tag",
"=",
"'KAF'",
"self",
".",
"type",
"=",
"'KAF'",
"## Convert the header",
"if",
"self",
".",
"header",
"is",
"not",
"None",
":",
... | Converts a NAF object to KAF (in memory). You will have to use the method dump later to save it as a new KAF file | [
"Converts",
"a",
"NAF",
"object",
"to",
"KAF",
"(",
"in",
"memory",
")",
".",
"You",
"will",
"have",
"to",
"use",
"the",
"method",
"dump",
"later",
"to",
"save",
"it",
"as",
"a",
"new",
"KAF",
"file"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L230-L305 | train | Converts a NAF object to KAF. |
cltl/KafNafParserPy | KafNafParserPy/KafNafParserMod.py | KafNafParser.to_naf | def to_naf(self):
"""
Converts a KAF object to NAF (in memory). You will have to use the method dump later to save it as a new NAF file
"""
if self.type == 'KAF':
self.root.tag = self.type = 'NAF'
## Convert the header
if self.header is not None:
... | python | def to_naf(self):
"""
Converts a KAF object to NAF (in memory). You will have to use the method dump later to save it as a new NAF file
"""
if self.type == 'KAF':
self.root.tag = self.type = 'NAF'
## Convert the header
if self.header is not None:
... | [
"def",
"to_naf",
"(",
"self",
")",
":",
"if",
"self",
".",
"type",
"==",
"'KAF'",
":",
"self",
".",
"root",
".",
"tag",
"=",
"self",
".",
"type",
"=",
"'NAF'",
"## Convert the header",
"if",
"self",
".",
"header",
"is",
"not",
"None",
":",
"self",
... | Converts a KAF object to NAF (in memory). You will have to use the method dump later to save it as a new NAF file | [
"Converts",
"a",
"KAF",
"object",
"to",
"NAF",
"(",
"in",
"memory",
")",
".",
"You",
"will",
"have",
"to",
"use",
"the",
"method",
"dump",
"later",
"to",
"save",
"it",
"as",
"a",
"new",
"NAF",
"file"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L307-L386 | train | Converts a KAF object to NAF. |
cltl/KafNafParserPy | KafNafParserPy/KafNafParserMod.py | KafNafParser.get_lps | def get_lps(self):
"""Iterator that returns all the lp objects from linguistic processors layers from the header
@rtype: L{Clp}
@return: list of lp objects
"""
if self.header is not None:
for linguisticProcessor in self.header:
for lp in linguisticProc... | python | def get_lps(self):
"""Iterator that returns all the lp objects from linguistic processors layers from the header
@rtype: L{Clp}
@return: list of lp objects
"""
if self.header is not None:
for linguisticProcessor in self.header:
for lp in linguisticProc... | [
"def",
"get_lps",
"(",
"self",
")",
":",
"if",
"self",
".",
"header",
"is",
"not",
"None",
":",
"for",
"linguisticProcessor",
"in",
"self",
".",
"header",
":",
"for",
"lp",
"in",
"linguisticProcessor",
":",
"yield",
"lp"
] | Iterator that returns all the lp objects from linguistic processors layers from the header
@rtype: L{Clp}
@return: list of lp objects | [
"Iterator",
"that",
"returns",
"all",
"the",
"lp",
"objects",
"from",
"linguistic",
"processors",
"layers",
"from",
"the",
"header"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L404-L412 | train | Iterator that returns all the lp objects from the header |
cltl/KafNafParserPy | KafNafParserPy/KafNafParserMod.py | KafNafParser.get_trees_as_list | def get_trees_as_list(self):
"""
Iterator that returns the constituency trees
@rtype: L{Ctree}
@return: iterator to all the constituency trees
"""
mytrees = []
if self.constituency_layer is not None:
for tree in self.constituency_layer.get_trees():
... | python | def get_trees_as_list(self):
"""
Iterator that returns the constituency trees
@rtype: L{Ctree}
@return: iterator to all the constituency trees
"""
mytrees = []
if self.constituency_layer is not None:
for tree in self.constituency_layer.get_trees():
... | [
"def",
"get_trees_as_list",
"(",
"self",
")",
":",
"mytrees",
"=",
"[",
"]",
"if",
"self",
".",
"constituency_layer",
"is",
"not",
"None",
":",
"for",
"tree",
"in",
"self",
".",
"constituency_layer",
".",
"get_trees",
"(",
")",
":",
"mytrees",
".",
"appe... | Iterator that returns the constituency trees
@rtype: L{Ctree}
@return: iterator to all the constituency trees | [
"Iterator",
"that",
"returns",
"the",
"constituency",
"trees"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L425-L435 | train | Iterator that returns the constituency trees
|
cltl/KafNafParserPy | KafNafParserPy/KafNafParserMod.py | KafNafParser.get_properties | def get_properties(self):
"""
Returns all the properties of the features layer (iterator)
@rtype: L{Cproperty}
@return: list of properties
"""
if self.features_layer is not None:
for property in self.features_layer.get_properties():
yield prope... | python | def get_properties(self):
"""
Returns all the properties of the features layer (iterator)
@rtype: L{Cproperty}
@return: list of properties
"""
if self.features_layer is not None:
for property in self.features_layer.get_properties():
yield prope... | [
"def",
"get_properties",
"(",
"self",
")",
":",
"if",
"self",
".",
"features_layer",
"is",
"not",
"None",
":",
"for",
"property",
"in",
"self",
".",
"features_layer",
".",
"get_properties",
"(",
")",
":",
"yield",
"propertyfound_entities",
".",
"get",
"(",
... | Returns all the properties of the features layer (iterator)
@rtype: L{Cproperty}
@return: list of properties | [
"Returns",
"all",
"the",
"properties",
"of",
"the",
"features",
"layer",
"(",
"iterator",
")"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L621-L629 | train | Returns all the properties of the features layer |
cltl/KafNafParserPy | KafNafParserPy/KafNafParserMod.py | KafNafParser.set_raw | def set_raw(self,text):
"""
Sets the text of the raw element (or creates the layer if does not exist)
@param text: text of the raw layer
@type text: string
"""
node_raw = self.root.find('raw')
if node_raw is None:
node_raw = etree.Element('raw')
... | python | def set_raw(self,text):
"""
Sets the text of the raw element (or creates the layer if does not exist)
@param text: text of the raw layer
@type text: string
"""
node_raw = self.root.find('raw')
if node_raw is None:
node_raw = etree.Element('raw')
... | [
"def",
"set_raw",
"(",
"self",
",",
"text",
")",
":",
"node_raw",
"=",
"self",
".",
"root",
".",
"find",
"(",
"'raw'",
")",
"if",
"node_raw",
"is",
"None",
":",
"node_raw",
"=",
"etree",
".",
"Element",
"(",
"'raw'",
")",
"self",
".",
"root",
".",
... | Sets the text of the raw element (or creates the layer if does not exist)
@param text: text of the raw layer
@type text: string | [
"Sets",
"the",
"text",
"of",
"the",
"raw",
"element",
"(",
"or",
"creates",
"the",
"layer",
"if",
"does",
"not",
"exist",
")"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L685-L695 | train | Sets the text of the raw element or creates the layer if it does not exist. |
cltl/KafNafParserPy | KafNafParserPy/KafNafParserMod.py | KafNafParser.dump | def dump(self,filename=None):
"""
Dumps the object to an output filename (or open file descriptor). The filename
parameter is optional, and if it is not provided, the standard output will be used
@type filename: string or file descriptor
@param filename: file where to dump the ob... | python | def dump(self,filename=None):
"""
Dumps the object to an output filename (or open file descriptor). The filename
parameter is optional, and if it is not provided, the standard output will be used
@type filename: string or file descriptor
@param filename: file where to dump the ob... | [
"def",
"dump",
"(",
"self",
",",
"filename",
"=",
"None",
")",
":",
"if",
"filename",
"is",
"None",
":",
"with",
"io",
".",
"BytesIO",
"(",
")",
"as",
"buffer",
":",
"self",
".",
"dump",
"(",
"filename",
"=",
"buffer",
")",
"bytes",
"=",
"buffer",
... | Dumps the object to an output filename (or open file descriptor). The filename
parameter is optional, and if it is not provided, the standard output will be used
@type filename: string or file descriptor
@param filename: file where to dump the object (default standard output) | [
"Dumps",
"the",
"object",
"to",
"an",
"output",
"filename",
"(",
"or",
"open",
"file",
"descriptor",
")",
".",
"The",
"filename",
"parameter",
"is",
"optional",
"and",
"if",
"it",
"is",
"not",
"provided",
"the",
"standard",
"output",
"will",
"be",
"used"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L707-L721 | train | Dumps the object to a file. |
cltl/KafNafParserPy | KafNafParserPy/KafNafParserMod.py | KafNafParser.remove_entity_layer | def remove_entity_layer(self):
"""
Removes the entity layer (if exists) of the object (in memory)
"""
if self.entity_layer is not None:
this_node = self.entity_layer.get_node()
self.root.remove(this_node)
self.entity_layer = None
if self.header... | python | def remove_entity_layer(self):
"""
Removes the entity layer (if exists) of the object (in memory)
"""
if self.entity_layer is not None:
this_node = self.entity_layer.get_node()
self.root.remove(this_node)
self.entity_layer = None
if self.header... | [
"def",
"remove_entity_layer",
"(",
"self",
")",
":",
"if",
"self",
".",
"entity_layer",
"is",
"not",
"None",
":",
"this_node",
"=",
"self",
".",
"entity_layer",
".",
"get_node",
"(",
")",
"self",
".",
"root",
".",
"remove",
"(",
"this_node",
")",
"self",... | Removes the entity layer (if exists) of the object (in memory) | [
"Removes",
"the",
"entity",
"layer",
"(",
"if",
"exists",
")",
"of",
"the",
"object",
"(",
"in",
"memory",
")"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L723-L732 | train | Removes the entity layer of the object. |
cltl/KafNafParserPy | KafNafParserPy/KafNafParserMod.py | KafNafParser.remove_dependency_layer | def remove_dependency_layer(self):
"""
Removes the dependency layer (if exists) of the object (in memory)
"""
if self.dependency_layer is not None:
this_node = self.dependency_layer.get_node()
self.root.remove(this_node)
self.dependency_layer = self.my... | python | def remove_dependency_layer(self):
"""
Removes the dependency layer (if exists) of the object (in memory)
"""
if self.dependency_layer is not None:
this_node = self.dependency_layer.get_node()
self.root.remove(this_node)
self.dependency_layer = self.my... | [
"def",
"remove_dependency_layer",
"(",
"self",
")",
":",
"if",
"self",
".",
"dependency_layer",
"is",
"not",
"None",
":",
"this_node",
"=",
"self",
".",
"dependency_layer",
".",
"get_node",
"(",
")",
"self",
".",
"root",
".",
"remove",
"(",
"this_node",
")... | Removes the dependency layer (if exists) of the object (in memory) | [
"Removes",
"the",
"dependency",
"layer",
"(",
"if",
"exists",
")",
"of",
"the",
"object",
"(",
"in",
"memory",
")"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L734-L744 | train | Removes the dependency layer of the object. |
cltl/KafNafParserPy | KafNafParserPy/KafNafParserMod.py | KafNafParser.remove_temporalRelations_layer | def remove_temporalRelations_layer(self):
"""
Removes the temporalRelations layer (if exists) of the object (in memory)
"""
if self.temporalRelations_layer is not None:
this_node = self.temporalRelations_layer.get_node()
self.root.remove(this_node)
sel... | python | def remove_temporalRelations_layer(self):
"""
Removes the temporalRelations layer (if exists) of the object (in memory)
"""
if self.temporalRelations_layer is not None:
this_node = self.temporalRelations_layer.get_node()
self.root.remove(this_node)
sel... | [
"def",
"remove_temporalRelations_layer",
"(",
"self",
")",
":",
"if",
"self",
".",
"temporalRelations_layer",
"is",
"not",
"None",
":",
"this_node",
"=",
"self",
".",
"temporalRelations_layer",
".",
"get_node",
"(",
")",
"self",
".",
"root",
".",
"remove",
"("... | Removes the temporalRelations layer (if exists) of the object (in memory) | [
"Removes",
"the",
"temporalRelations",
"layer",
"(",
"if",
"exists",
")",
"of",
"the",
"object",
"(",
"in",
"memory",
")"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L747-L757 | train | Removes the temporalRelations layer from the object. |
cltl/KafNafParserPy | KafNafParserPy/KafNafParserMod.py | KafNafParser.remove_causalRelations_layer | def remove_causalRelations_layer(self):
"""
Removes the causalRelations layer (if exists) of the object (in memory)
"""
if self.causalRelations_layer is not None:
this_node = self.causalRelations_layer.get_node()
self.root.remove(this_node)
self.causal... | python | def remove_causalRelations_layer(self):
"""
Removes the causalRelations layer (if exists) of the object (in memory)
"""
if self.causalRelations_layer is not None:
this_node = self.causalRelations_layer.get_node()
self.root.remove(this_node)
self.causal... | [
"def",
"remove_causalRelations_layer",
"(",
"self",
")",
":",
"if",
"self",
".",
"causalRelations_layer",
"is",
"not",
"None",
":",
"this_node",
"=",
"self",
".",
"causalRelations_layer",
".",
"get_node",
"(",
")",
"self",
".",
"root",
".",
"remove",
"(",
"t... | Removes the causalRelations layer (if exists) of the object (in memory) | [
"Removes",
"the",
"causalRelations",
"layer",
"(",
"if",
"exists",
")",
"of",
"the",
"object",
"(",
"in",
"memory",
")"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L759-L769 | train | Removes the causalRelations layer from the object. |
cltl/KafNafParserPy | KafNafParserPy/KafNafParserMod.py | KafNafParser.remove_factualitylayer_layer | def remove_factualitylayer_layer(self):
"""
Removes the factualitylayer layer (the old version) (if exists) of the object (in memory)
"""
if self.factuality_layer is not None:
this_node = self.factuality_layer.get_node()
self.root.remove(this_node)
sel... | python | def remove_factualitylayer_layer(self):
"""
Removes the factualitylayer layer (the old version) (if exists) of the object (in memory)
"""
if self.factuality_layer is not None:
this_node = self.factuality_layer.get_node()
self.root.remove(this_node)
sel... | [
"def",
"remove_factualitylayer_layer",
"(",
"self",
")",
":",
"if",
"self",
".",
"factuality_layer",
"is",
"not",
"None",
":",
"this_node",
"=",
"self",
".",
"factuality_layer",
".",
"get_node",
"(",
")",
"self",
".",
"root",
".",
"remove",
"(",
"this_node",... | Removes the factualitylayer layer (the old version) (if exists) of the object (in memory) | [
"Removes",
"the",
"factualitylayer",
"layer",
"(",
"the",
"old",
"version",
")",
"(",
"if",
"exists",
")",
"of",
"the",
"object",
"(",
"in",
"memory",
")"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L771-L781 | train | Removes the factualitylayer layer from the object. |
cltl/KafNafParserPy | KafNafParserPy/KafNafParserMod.py | KafNafParser.remove_factualities_layer | def remove_factualities_layer(self, lp_remove=True):
"""
Removes the factualities layer (the new version) (if exists) of the object (in memory)
"""
if self.factuality_layer is not None:
this_node = self.factuality_layer.get_node()
self.root.remove(this_node)
... | python | def remove_factualities_layer(self, lp_remove=True):
"""
Removes the factualities layer (the new version) (if exists) of the object (in memory)
"""
if self.factuality_layer is not None:
this_node = self.factuality_layer.get_node()
self.root.remove(this_node)
... | [
"def",
"remove_factualities_layer",
"(",
"self",
",",
"lp_remove",
"=",
"True",
")",
":",
"if",
"self",
".",
"factuality_layer",
"is",
"not",
"None",
":",
"this_node",
"=",
"self",
".",
"factuality_layer",
".",
"get_node",
"(",
")",
"self",
".",
"root",
".... | Removes the factualities layer (the new version) (if exists) of the object (in memory) | [
"Removes",
"the",
"factualities",
"layer",
"(",
"the",
"new",
"version",
")",
"(",
"if",
"exists",
")",
"of",
"the",
"object",
"(",
"in",
"memory",
")"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L784-L794 | train | Removes the factualities layer from the object. |
cltl/KafNafParserPy | KafNafParserPy/KafNafParserMod.py | KafNafParser.remove_constituency_layer | def remove_constituency_layer(self):
"""
Removes the constituency layer (if exists) of the object (in memory)
"""
if self.constituency_layer is not None:
this_node = self.constituency_layer.get_node()
self.root.remove(this_node)
if self.header is not None:... | python | def remove_constituency_layer(self):
"""
Removes the constituency layer (if exists) of the object (in memory)
"""
if self.constituency_layer is not None:
this_node = self.constituency_layer.get_node()
self.root.remove(this_node)
if self.header is not None:... | [
"def",
"remove_constituency_layer",
"(",
"self",
")",
":",
"if",
"self",
".",
"constituency_layer",
"is",
"not",
"None",
":",
"this_node",
"=",
"self",
".",
"constituency_layer",
".",
"get_node",
"(",
")",
"self",
".",
"root",
".",
"remove",
"(",
"this_node"... | Removes the constituency layer (if exists) of the object (in memory) | [
"Removes",
"the",
"constituency",
"layer",
"(",
"if",
"exists",
")",
"of",
"the",
"object",
"(",
"in",
"memory",
")"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L796-L804 | train | Removes the constituency layer from the object. |
cltl/KafNafParserPy | KafNafParserPy/KafNafParserMod.py | KafNafParser.remove_opinion_layer | def remove_opinion_layer(self):
"""
Removes the opinion layer (if exists) of the object (in memory)
"""
if self.opinion_layer is not None:
this_node = self.opinion_layer.get_node()
self.root.remove(this_node)
self.opinion_layer = None
if self.... | python | def remove_opinion_layer(self):
"""
Removes the opinion layer (if exists) of the object (in memory)
"""
if self.opinion_layer is not None:
this_node = self.opinion_layer.get_node()
self.root.remove(this_node)
self.opinion_layer = None
if self.... | [
"def",
"remove_opinion_layer",
"(",
"self",
")",
":",
"if",
"self",
".",
"opinion_layer",
"is",
"not",
"None",
":",
"this_node",
"=",
"self",
".",
"opinion_layer",
".",
"get_node",
"(",
")",
"self",
".",
"root",
".",
"remove",
"(",
"this_node",
")",
"sel... | Removes the opinion layer (if exists) of the object (in memory) | [
"Removes",
"the",
"opinion",
"layer",
"(",
"if",
"exists",
")",
"of",
"the",
"object",
"(",
"in",
"memory",
")"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L816-L826 | train | Removes the opinion layer from the object. |
cltl/KafNafParserPy | KafNafParserPy/KafNafParserMod.py | KafNafParser.remove_properties | def remove_properties(self):
"""
Removes the property layer (if exists) of the object (in memory)
"""
if self.features_layer is not None:
self.features_layer.remove_properties()
if self.header is not None:
self.header.remove_lp('features') | python | def remove_properties(self):
"""
Removes the property layer (if exists) of the object (in memory)
"""
if self.features_layer is not None:
self.features_layer.remove_properties()
if self.header is not None:
self.header.remove_lp('features') | [
"def",
"remove_properties",
"(",
"self",
")",
":",
"if",
"self",
".",
"features_layer",
"is",
"not",
"None",
":",
"self",
".",
"features_layer",
".",
"remove_properties",
"(",
")",
"if",
"self",
".",
"header",
"is",
"not",
"None",
":",
"self",
".",
"head... | Removes the property layer (if exists) of the object (in memory) | [
"Removes",
"the",
"property",
"layer",
"(",
"if",
"exists",
")",
"of",
"the",
"object",
"(",
"in",
"memory",
")"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L828-L836 | train | Removes the properties of the object. |
cltl/KafNafParserPy | KafNafParserPy/KafNafParserMod.py | KafNafParser.remove_term_layer | def remove_term_layer(self):
"""
Removes the term layer (if exists) of the object (in memory)
"""
if self.term_layer is not None:
this_node = self.term_layer.get_node()
self.root.remove(this_node)
self.term_layer = None
if self.header is not N... | python | def remove_term_layer(self):
"""
Removes the term layer (if exists) of the object (in memory)
"""
if self.term_layer is not None:
this_node = self.term_layer.get_node()
self.root.remove(this_node)
self.term_layer = None
if self.header is not N... | [
"def",
"remove_term_layer",
"(",
"self",
")",
":",
"if",
"self",
".",
"term_layer",
"is",
"not",
"None",
":",
"this_node",
"=",
"self",
".",
"term_layer",
".",
"get_node",
"(",
")",
"self",
".",
"root",
".",
"remove",
"(",
"this_node",
")",
"self",
"."... | Removes the term layer (if exists) of the object (in memory) | [
"Removes",
"the",
"term",
"layer",
"(",
"if",
"exists",
")",
"of",
"the",
"object",
"(",
"in",
"memory",
")"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L839-L849 | train | Removes the term layer of the object from the term layer list. |
cltl/KafNafParserPy | KafNafParserPy/KafNafParserMod.py | KafNafParser.remove_chunk_layer | def remove_chunk_layer(self):
"""
Removes the chunk layer (if exists) of the object (in memory)
"""
if self.chunk_layer is not None:
this_node = self.chunk_layer.get_node()
self.root.remove(this_node)
self.chunk_layer = None
if self.header is ... | python | def remove_chunk_layer(self):
"""
Removes the chunk layer (if exists) of the object (in memory)
"""
if self.chunk_layer is not None:
this_node = self.chunk_layer.get_node()
self.root.remove(this_node)
self.chunk_layer = None
if self.header is ... | [
"def",
"remove_chunk_layer",
"(",
"self",
")",
":",
"if",
"self",
".",
"chunk_layer",
"is",
"not",
"None",
":",
"this_node",
"=",
"self",
".",
"chunk_layer",
".",
"get_node",
"(",
")",
"self",
".",
"root",
".",
"remove",
"(",
"this_node",
")",
"self",
... | Removes the chunk layer (if exists) of the object (in memory) | [
"Removes",
"the",
"chunk",
"layer",
"(",
"if",
"exists",
")",
"of",
"the",
"object",
"(",
"in",
"memory",
")"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L853-L863 | train | Removes the chunk layer of the object. |
cltl/KafNafParserPy | KafNafParserPy/KafNafParserMod.py | KafNafParser.remove_attribution_layer | def remove_attribution_layer(self):
"""
Removes the attribution layer (if exists) of the object (in memory)
"""
if self.attribution_layer is not None:
this_node = self.attribution_layer.get_node()
self.root.remove(this_node)
self.attribution_layer = No... | python | def remove_attribution_layer(self):
"""
Removes the attribution layer (if exists) of the object (in memory)
"""
if self.attribution_layer is not None:
this_node = self.attribution_layer.get_node()
self.root.remove(this_node)
self.attribution_layer = No... | [
"def",
"remove_attribution_layer",
"(",
"self",
")",
":",
"if",
"self",
".",
"attribution_layer",
"is",
"not",
"None",
":",
"this_node",
"=",
"self",
".",
"attribution_layer",
".",
"get_node",
"(",
")",
"self",
".",
"root",
".",
"remove",
"(",
"this_node",
... | Removes the attribution layer (if exists) of the object (in memory) | [
"Removes",
"the",
"attribution",
"layer",
"(",
"if",
"exists",
")",
"of",
"the",
"object",
"(",
"in",
"memory",
")"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L866-L876 | train | Removes the attribution layer from the object. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.