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
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.remove_text_layer
def remove_text_layer(self): """ Removes the text layer (if exists) of the object (in memory) """ if self.text_layer is not None: this_node = self.text_layer.get_node() self.root.remove(this_node) self.text_layer = None if self.header is not N...
python
def remove_text_layer(self): """ Removes the text layer (if exists) of the object (in memory) """ if self.text_layer is not None: this_node = self.text_layer.get_node() self.root.remove(this_node) self.text_layer = None if self.header is not N...
[ "def", "remove_text_layer", "(", "self", ")", ":", "if", "self", ".", "text_layer", "is", "not", "None", ":", "this_node", "=", "self", ".", "text_layer", ".", "get_node", "(", ")", "self", ".", "root", ".", "remove", "(", "this_node", ")", "self", "."...
Removes the text layer (if exists) of the object (in memory)
[ "Removes", "the", "text", "layer", "(", "if", "exists", ")", "of", "the", "object", "(", "in", "memory", ")" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L879-L889
train
Removes the text layer of the object.
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.remove_coreference_layer
def remove_coreference_layer(self): """ Removes the constituency layer (if exists) of the object (in memory) """ if self.coreference_layer is not None: this_node = self.coreference_layer.get_node() self.root.remove(this_node) if self.header is not None: ...
python
def remove_coreference_layer(self): """ Removes the constituency layer (if exists) of the object (in memory) """ if self.coreference_layer is not None: this_node = self.coreference_layer.get_node() self.root.remove(this_node) if self.header is not None: ...
[ "def", "remove_coreference_layer", "(", "self", ")", ":", "if", "self", ".", "coreference_layer", "is", "not", "None", ":", "this_node", "=", "self", ".", "coreference_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#L892-L900
train
Removes the constituency layer of the object.
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.remove_markable_layer
def remove_markable_layer(self): """ Removes the markable layer (if exists) of the object (in memory) """ if self.markable_layer is not None: this_node = self.markable_layer.get_node() self.root.remove(this_node) if self.header is not None: ...
python
def remove_markable_layer(self): """ Removes the markable layer (if exists) of the object (in memory) """ if self.markable_layer is not None: this_node = self.markable_layer.get_node() self.root.remove(this_node) if self.header is not None: ...
[ "def", "remove_markable_layer", "(", "self", ")", ":", "if", "self", ".", "markable_layer", "is", "not", "None", ":", "this_node", "=", "self", ".", "markable_layer", ".", "get_node", "(", ")", "self", ".", "root", ".", "remove", "(", "this_node", ")", "...
Removes the markable layer (if exists) of the object (in memory)
[ "Removes", "the", "markable", "layer", "(", "if", "exists", ")", "of", "the", "object", "(", "in", "memory", ")" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L903-L911
train
Removes the markable layer from the object.
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.convert_factualitylayer_to_factualities
def convert_factualitylayer_to_factualities(self): """ Takes information from factuality layer in old representation Creates new factuality representation and removes the old layer """ if self.factuality_layer is not None: this_node = self.factuality_layer.get_node() ...
python
def convert_factualitylayer_to_factualities(self): """ Takes information from factuality layer in old representation Creates new factuality representation and removes the old layer """ if self.factuality_layer is not None: this_node = self.factuality_layer.get_node() ...
[ "def", "convert_factualitylayer_to_factualities", "(", "self", ")", ":", "if", "self", ".", "factuality_layer", "is", "not", "None", ":", "this_node", "=", "self", ".", "factuality_layer", ".", "get_node", "(", ")", "if", "this_node", ".", "tag", "==", "'factu...
Takes information from factuality layer in old representation Creates new factuality representation and removes the old layer
[ "Takes", "information", "from", "factuality", "layer", "in", "old", "representation", "Creates", "new", "factuality", "representation", "and", "removes", "the", "old", "layer" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L914-L951
train
Converts information from factuality layer in old representation to factuality representation
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.get_constituency_extractor
def get_constituency_extractor(self): """ Returns a constituency extractor object @rtype: L{Cconstituency_extractor} @return: a constituency extractor object """ if self.constituency_layer is not None: ##Otherwise there are no constituens if self.my_consti...
python
def get_constituency_extractor(self): """ Returns a constituency extractor object @rtype: L{Cconstituency_extractor} @return: a constituency extractor object """ if self.constituency_layer is not None: ##Otherwise there are no constituens if self.my_consti...
[ "def", "get_constituency_extractor", "(", "self", ")", ":", "if", "self", ".", "constituency_layer", "is", "not", "None", ":", "##Otherwise there are no constituens", "if", "self", ".", "my_constituency_extractor", "is", "None", ":", "self", ".", "my_constituency_extr...
Returns a constituency extractor object @rtype: L{Cconstituency_extractor} @return: a constituency extractor object
[ "Returns", "a", "constituency", "extractor", "object" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L954-L966
train
Returns a constituency extractor object for the given locale.
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.get_dependency_extractor
def get_dependency_extractor(self): """ Returns a dependency extractor object @rtype: L{Cdependency_extractor} @return: a dependency extractor object """ if self.dependency_layer is not None: #otherwise there are no dependencies if self.my_dependency_extrac...
python
def get_dependency_extractor(self): """ Returns a dependency extractor object @rtype: L{Cdependency_extractor} @return: a dependency extractor object """ if self.dependency_layer is not None: #otherwise there are no dependencies if self.my_dependency_extrac...
[ "def", "get_dependency_extractor", "(", "self", ")", ":", "if", "self", ".", "dependency_layer", "is", "not", "None", ":", "#otherwise there are no dependencies", "if", "self", ".", "my_dependency_extractor", "is", "None", ":", "self", ".", "my_dependency_extractor", ...
Returns a dependency extractor object @rtype: L{Cdependency_extractor} @return: a dependency extractor object
[ "Returns", "a", "dependency", "extractor", "object" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L968-L979
train
Returns a dependency extractor object for the current object.
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.add_wf
def add_wf(self,wf_obj): """ Adds a token to the text layer @type wf_obj: L{Cwf} @param wf_obj: the token object """ if self.text_layer is None: self.text_layer = Ctext(type=self.type) self.root.append(self.text_layer.get_node()) self.text_...
python
def add_wf(self,wf_obj): """ Adds a token to the text layer @type wf_obj: L{Cwf} @param wf_obj: the token object """ if self.text_layer is None: self.text_layer = Ctext(type=self.type) self.root.append(self.text_layer.get_node()) self.text_...
[ "def", "add_wf", "(", "self", ",", "wf_obj", ")", ":", "if", "self", ".", "text_layer", "is", "None", ":", "self", ".", "text_layer", "=", "Ctext", "(", "type", "=", "self", ".", "type", ")", "self", ".", "root", ".", "append", "(", "self", ".", ...
Adds a token to the text layer @type wf_obj: L{Cwf} @param wf_obj: the token object
[ "Adds", "a", "token", "to", "the", "text", "layer" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L982-L991
train
Adds a token to the text layer.
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.create_wf
def create_wf(self, text, sent, offset, id=None, length=None): """ Create a new wordform (text token) and add it to the text layer @type text: string @param text: The text of the token @type sent: int @param pos: The sentence of this token @type offset: int ...
python
def create_wf(self, text, sent, offset, id=None, length=None): """ Create a new wordform (text token) and add it to the text layer @type text: string @param text: The text of the token @type sent: int @param pos: The sentence of this token @type offset: int ...
[ "def", "create_wf", "(", "self", ",", "text", ",", "sent", ",", "offset", ",", "id", "=", "None", ",", "length", "=", "None", ")", ":", "if", "id", "is", "None", ":", "n", "=", "1", "if", "self", ".", "text_layer", "is", "None", "else", "len", ...
Create a new wordform (text token) and add it to the text layer @type text: string @param text: The text of the token @type sent: int @param pos: The sentence of this token @type offset: int @param morphofeat: The offset of this token @type id: string @pa...
[ "Create", "a", "new", "wordform", "(", "text", "token", ")", "and", "add", "it", "to", "the", "text", "layer" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L993-L1020
train
Create a new wordform for this token and add it to the text layer.
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.add_term
def add_term(self,term_obj): """ Adds a term to the term layer @type term_obj: L{Cterm} @param term_obj: the term object """ if self.term_layer is None: self.term_layer = Cterms(type=self.type) self.root.append(self.term_layer.get_node()) s...
python
def add_term(self,term_obj): """ Adds a term to the term layer @type term_obj: L{Cterm} @param term_obj: the term object """ if self.term_layer is None: self.term_layer = Cterms(type=self.type) self.root.append(self.term_layer.get_node()) s...
[ "def", "add_term", "(", "self", ",", "term_obj", ")", ":", "if", "self", ".", "term_layer", "is", "None", ":", "self", ".", "term_layer", "=", "Cterms", "(", "type", "=", "self", ".", "type", ")", "self", ".", "root", ".", "append", "(", "self", "....
Adds a term to the term layer @type term_obj: L{Cterm} @param term_obj: the term object
[ "Adds", "a", "term", "to", "the", "term", "layer" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L1022-L1031
train
Adds a term to the term layer
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.add_chunk
def add_chunk(self,chunk_obj): """ Adds a chunk to the chunk layer @type chunk_obj: L{Cchunk} @param chunk_obj: the chunk object """ if self.chunk_layer is None: self.chunk_layer = Cchunks(type=self.type) self.root.append(self.chunk_layer.get_node(...
python
def add_chunk(self,chunk_obj): """ Adds a chunk to the chunk layer @type chunk_obj: L{Cchunk} @param chunk_obj: the chunk object """ if self.chunk_layer is None: self.chunk_layer = Cchunks(type=self.type) self.root.append(self.chunk_layer.get_node(...
[ "def", "add_chunk", "(", "self", ",", "chunk_obj", ")", ":", "if", "self", ".", "chunk_layer", "is", "None", ":", "self", ".", "chunk_layer", "=", "Cchunks", "(", "type", "=", "self", ".", "type", ")", "self", ".", "root", ".", "append", "(", "self",...
Adds a chunk to the chunk layer @type chunk_obj: L{Cchunk} @param chunk_obj: the chunk object
[ "Adds", "a", "chunk", "to", "the", "chunk", "layer" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L1034-L1043
train
Adds a chunk to the chunk layer
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.create_term
def create_term(self, lemma, pos, morphofeat, tokens, id=None): """ Create a new term and add it to the term layer @type lemma: string @param lemma: The lemma of the term @type pos: string @param pos: The postrag(rst letter) of the POS attribute @type morphofeat: ...
python
def create_term(self, lemma, pos, morphofeat, tokens, id=None): """ Create a new term and add it to the term layer @type lemma: string @param lemma: The lemma of the term @type pos: string @param pos: The postrag(rst letter) of the POS attribute @type morphofeat: ...
[ "def", "create_term", "(", "self", ",", "lemma", ",", "pos", ",", "morphofeat", ",", "tokens", ",", "id", "=", "None", ")", ":", "if", "id", "is", "None", ":", "n", "=", "1", "if", "self", ".", "term_layer", "is", "None", "else", "len", "(", "sel...
Create a new term and add it to the term layer @type lemma: string @param lemma: The lemma of the term @type pos: string @param pos: The postrag(rst letter) of the POS attribute @type morphofeat: string @param morphofeat: The morphofeat (full morphological features) of th...
[ "Create", "a", "new", "term", "and", "add", "it", "to", "the", "term", "layer" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L1045-L1072
train
Create a new term and add it to the term layer
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.add_markable
def add_markable(self,markable_obj): """ Adds a markable to the markable layer @type markable_obj: L{Cmarkable} @param markable_obj: the markable object """ if self.markable_layer is None: self.markable_layer = Cmarkables(type=self.type) self.root....
python
def add_markable(self,markable_obj): """ Adds a markable to the markable layer @type markable_obj: L{Cmarkable} @param markable_obj: the markable object """ if self.markable_layer is None: self.markable_layer = Cmarkables(type=self.type) self.root....
[ "def", "add_markable", "(", "self", ",", "markable_obj", ")", ":", "if", "self", ".", "markable_layer", "is", "None", ":", "self", ".", "markable_layer", "=", "Cmarkables", "(", "type", "=", "self", ".", "type", ")", "self", ".", "root", ".", "append", ...
Adds a markable to the markable layer @type markable_obj: L{Cmarkable} @param markable_obj: the markable object
[ "Adds", "a", "markable", "to", "the", "markable", "layer" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L1074-L1083
train
Adds a markable to the markable layer
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.add_opinion
def add_opinion(self,opinion_obj): """ Adds an opinion to the opinion layer @type opinion_obj: L{Copinion} @param opinion_obj: the opinion object """ if self.opinion_layer is None: self.opinion_layer = Copinions() self.root.append(self.opinion_laye...
python
def add_opinion(self,opinion_obj): """ Adds an opinion to the opinion layer @type opinion_obj: L{Copinion} @param opinion_obj: the opinion object """ if self.opinion_layer is None: self.opinion_layer = Copinions() self.root.append(self.opinion_laye...
[ "def", "add_opinion", "(", "self", ",", "opinion_obj", ")", ":", "if", "self", ".", "opinion_layer", "is", "None", ":", "self", ".", "opinion_layer", "=", "Copinions", "(", ")", "self", ".", "root", ".", "append", "(", "self", ".", "opinion_layer", ".", ...
Adds an opinion to the opinion layer @type opinion_obj: L{Copinion} @param opinion_obj: the opinion object
[ "Adds", "an", "opinion", "to", "the", "opinion", "layer" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L1086-L1095
train
Adds an opinion to the opinion layer.
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.add_statement
def add_statement(self,statement_obj): """ Adds a statement to the attribution layer @type statement_obj: L{Cstatement} @param statement_obj: the statement object """ if self.attribution_layer is None: self.attribution_layer = Cattribution() self.r...
python
def add_statement(self,statement_obj): """ Adds a statement to the attribution layer @type statement_obj: L{Cstatement} @param statement_obj: the statement object """ if self.attribution_layer is None: self.attribution_layer = Cattribution() self.r...
[ "def", "add_statement", "(", "self", ",", "statement_obj", ")", ":", "if", "self", ".", "attribution_layer", "is", "None", ":", "self", ".", "attribution_layer", "=", "Cattribution", "(", ")", "self", ".", "root", ".", "append", "(", "self", ".", "attribut...
Adds a statement to the attribution layer @type statement_obj: L{Cstatement} @param statement_obj: the statement object
[ "Adds", "a", "statement", "to", "the", "attribution", "layer" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L1097-L1106
train
Adds a statement to the attribution layer.
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.add_predicate
def add_predicate(self, predicate_obj): """ Adds a predicate to the semantic layer @type predicate_obj: L{Cpredicate} @param predicate_obj: the predicate object """ if self.srl_layer is None: self.srl_layer = Csrl() self.root.append(self.srl_layer....
python
def add_predicate(self, predicate_obj): """ Adds a predicate to the semantic layer @type predicate_obj: L{Cpredicate} @param predicate_obj: the predicate object """ if self.srl_layer is None: self.srl_layer = Csrl() self.root.append(self.srl_layer....
[ "def", "add_predicate", "(", "self", ",", "predicate_obj", ")", ":", "if", "self", ".", "srl_layer", "is", "None", ":", "self", ".", "srl_layer", "=", "Csrl", "(", ")", "self", ".", "root", ".", "append", "(", "self", ".", "srl_layer", ".", "get_node",...
Adds a predicate to the semantic layer @type predicate_obj: L{Cpredicate} @param predicate_obj: the predicate object
[ "Adds", "a", "predicate", "to", "the", "semantic", "layer" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L1110-L1119
train
Adds a predicate to the semantic layer
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.add_timex
def add_timex(self, time_obj): """ Adds a timex entry to the time layer @type time_obj: L{Ctime} @param time_obj: time time object """ if self.timex_layer is None: self.timex_layer = CtimeExpressions() self.root.append(self.timex_layer.get_node()) ...
python
def add_timex(self, time_obj): """ Adds a timex entry to the time layer @type time_obj: L{Ctime} @param time_obj: time time object """ if self.timex_layer is None: self.timex_layer = CtimeExpressions() self.root.append(self.timex_layer.get_node()) ...
[ "def", "add_timex", "(", "self", ",", "time_obj", ")", ":", "if", "self", ".", "timex_layer", "is", "None", ":", "self", ".", "timex_layer", "=", "CtimeExpressions", "(", ")", "self", ".", "root", ".", "append", "(", "self", ".", "timex_layer", ".", "g...
Adds a timex entry to the time layer @type time_obj: L{Ctime} @param time_obj: time time object
[ "Adds", "a", "timex", "entry", "to", "the", "time", "layer" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L1121-L1130
train
Adds a timex entry to the time layer.
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.set_header
def set_header(self,header): """ Sets the header of the object @type header: L{CHeader} @param header: the header object """ self.header = header self.root.insert(0,header.get_node())
python
def set_header(self,header): """ Sets the header of the object @type header: L{CHeader} @param header: the header object """ self.header = header self.root.insert(0,header.get_node())
[ "def", "set_header", "(", "self", ",", "header", ")", ":", "self", ".", "header", "=", "header", "self", ".", "root", ".", "insert", "(", "0", ",", "header", ".", "get_node", "(", ")", ")" ]
Sets the header of the object @type header: L{CHeader} @param header: the header object
[ "Sets", "the", "header", "of", "the", "object" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L1133-L1140
train
Sets the header of the object
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.add_linguistic_processor
def add_linguistic_processor(self, layer, my_lp): """ Adds a linguistic processor to the header @type my_lp: L{Clp} @param my_lp: linguistic processor object @type layer: string @param layer: the layer to which the processor is related to """ if self.heade...
python
def add_linguistic_processor(self, layer, my_lp): """ Adds a linguistic processor to the header @type my_lp: L{Clp} @param my_lp: linguistic processor object @type layer: string @param layer: the layer to which the processor is related to """ if self.heade...
[ "def", "add_linguistic_processor", "(", "self", ",", "layer", ",", "my_lp", ")", ":", "if", "self", ".", "header", "is", "None", ":", "self", ".", "header", "=", "CHeader", "(", "type", "=", "self", ".", "type", ")", "self", ".", "root", ".", "insert...
Adds a linguistic processor to the header @type my_lp: L{Clp} @param my_lp: linguistic processor object @type layer: string @param layer: the layer to which the processor is related to
[ "Adds", "a", "linguistic", "processor", "to", "the", "header" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L1142-L1153
train
Adds a linguistic processor to the header.
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.create_linguistic_processor
def create_linguistic_processor(self, layer, name, version, **kwargs): """ Create a new linguistic processor element and add it to the header @type layer: string @param layer: the layer to which the processor is related to @type name: string @param name: the name of the l...
python
def create_linguistic_processor(self, layer, name, version, **kwargs): """ Create a new linguistic processor element and add it to the header @type layer: string @param layer: the layer to which the processor is related to @type name: string @param name: the name of the l...
[ "def", "create_linguistic_processor", "(", "self", ",", "layer", ",", "name", ",", "version", ",", "*", "*", "kwargs", ")", ":", "lp", "=", "Clp", "(", "name", "=", "name", ",", "version", "=", "version", ",", "*", "*", "kwargs", ")", "self", ".", ...
Create a new linguistic processor element and add it to the header @type layer: string @param layer: the layer to which the processor is related to @type name: string @param name: the name of the linguistic processor @type version: string @param version: the version of th...
[ "Create", "a", "new", "linguistic", "processor", "element", "and", "add", "it", "to", "the", "header" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L1155-L1168
train
Create a new linguistic processor element and add it to the header
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.add_dependency
def add_dependency(self,my_dep): """ Adds a dependency to the dependency layer @type my_dep: L{Cdependency} @param my_dep: dependency object """ if self.dependency_layer is None: self.dependency_layer = Cdependencies() self.root.append(self.depende...
python
def add_dependency(self,my_dep): """ Adds a dependency to the dependency layer @type my_dep: L{Cdependency} @param my_dep: dependency object """ if self.dependency_layer is None: self.dependency_layer = Cdependencies() self.root.append(self.depende...
[ "def", "add_dependency", "(", "self", ",", "my_dep", ")", ":", "if", "self", ".", "dependency_layer", "is", "None", ":", "self", ".", "dependency_layer", "=", "Cdependencies", "(", ")", "self", ".", "root", ".", "append", "(", "self", ".", "dependency_laye...
Adds a dependency to the dependency layer @type my_dep: L{Cdependency} @param my_dep: dependency object
[ "Adds", "a", "dependency", "to", "the", "dependency", "layer" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L1170-L1179
train
Adds a dependency object to the dependency layer
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.create_dependency
def create_dependency(self, _from, to, function, comment=None): """ Create a new dependency object and add it to the dependency layer @type _from: string @param _from: term id of the child node @type _to: string @param _to: term id of the parent node @type functio...
python
def create_dependency(self, _from, to, function, comment=None): """ Create a new dependency object and add it to the dependency layer @type _from: string @param _from: term id of the child node @type _to: string @param _to: term id of the parent node @type functio...
[ "def", "create_dependency", "(", "self", ",", "_from", ",", "to", ",", "function", ",", "comment", "=", "None", ")", ":", "new_dependency", "=", "Cdependency", "(", ")", "new_dependency", ".", "set_from", "(", "_from", ")", "new_dependency", ".", "set_to", ...
Create a new dependency object and add it to the dependency layer @type _from: string @param _from: term id of the child node @type _to: string @param _to: term id of the parent node @type function: string @param function: grammatical function (relation) between parent an...
[ "Create", "a", "new", "dependency", "object", "and", "add", "it", "to", "the", "dependency", "layer" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L1181-L1200
train
Create a new dependency object and add it to the dependency layer
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.add_tlink
def add_tlink(self,my_tlink): """ Adds a tlink to the temporalRelations layer @type my_tlink: L{Ctlink} @param my_tlink: tlink object """ if self.temporalRelations_layer is None: self.temporalRelations_layer = CtemporalRelations() self.root.append(...
python
def add_tlink(self,my_tlink): """ Adds a tlink to the temporalRelations layer @type my_tlink: L{Ctlink} @param my_tlink: tlink object """ if self.temporalRelations_layer is None: self.temporalRelations_layer = CtemporalRelations() self.root.append(...
[ "def", "add_tlink", "(", "self", ",", "my_tlink", ")", ":", "if", "self", ".", "temporalRelations_layer", "is", "None", ":", "self", ".", "temporalRelations_layer", "=", "CtemporalRelations", "(", ")", "self", ".", "root", ".", "append", "(", "self", ".", ...
Adds a tlink to the temporalRelations layer @type my_tlink: L{Ctlink} @param my_tlink: tlink object
[ "Adds", "a", "tlink", "to", "the", "temporalRelations", "layer" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L1202-L1211
train
Adds a tlink to the temporalRelations layer.
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.add_predicateAnchor
def add_predicateAnchor(self,my_predAnch): """ Adds a predAnch to the temporalRelations layer @type my_predAnch: L{CpredicateAnchor} @param my_predAnch: predicateAnchor object """ if self.temporalRelations_layer is None: self.temporalRelations_layer = Ctempora...
python
def add_predicateAnchor(self,my_predAnch): """ Adds a predAnch to the temporalRelations layer @type my_predAnch: L{CpredicateAnchor} @param my_predAnch: predicateAnchor object """ if self.temporalRelations_layer is None: self.temporalRelations_layer = Ctempora...
[ "def", "add_predicateAnchor", "(", "self", ",", "my_predAnch", ")", ":", "if", "self", ".", "temporalRelations_layer", "is", "None", ":", "self", ".", "temporalRelations_layer", "=", "CtemporalRelations", "(", ")", "self", ".", "root", ".", "append", "(", "sel...
Adds a predAnch to the temporalRelations layer @type my_predAnch: L{CpredicateAnchor} @param my_predAnch: predicateAnchor object
[ "Adds", "a", "predAnch", "to", "the", "temporalRelations", "layer" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L1213-L1222
train
Adds a predAnch to the temporalRelations layer.
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.add_clink
def add_clink(self,my_clink): """ Adds a clink to the causalRelations layer @type my_clink: L{Cclink} @param my_clink: clink object """ if self.causalRelations_layer is None: self.causalRelations_layer = CcausalRelations() self.root.append(self.cau...
python
def add_clink(self,my_clink): """ Adds a clink to the causalRelations layer @type my_clink: L{Cclink} @param my_clink: clink object """ if self.causalRelations_layer is None: self.causalRelations_layer = CcausalRelations() self.root.append(self.cau...
[ "def", "add_clink", "(", "self", ",", "my_clink", ")", ":", "if", "self", ".", "causalRelations_layer", "is", "None", ":", "self", ".", "causalRelations_layer", "=", "CcausalRelations", "(", ")", "self", ".", "root", ".", "append", "(", "self", ".", "causa...
Adds a clink to the causalRelations layer @type my_clink: L{Cclink} @param my_clink: clink object
[ "Adds", "a", "clink", "to", "the", "causalRelations", "layer" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L1224-L1233
train
Adds a clink to the causalRelations layer.
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.add_factuality
def add_factuality(self,my_fact): """ Adds a factuality to the factuality layer @type my_fact: L{Cfactuality} @param my_fact: factuality object """ if self.factuality_layer is None: self.factuality_layer = Cfactualities() self.root.append(self.fact...
python
def add_factuality(self,my_fact): """ Adds a factuality to the factuality layer @type my_fact: L{Cfactuality} @param my_fact: factuality object """ if self.factuality_layer is None: self.factuality_layer = Cfactualities() self.root.append(self.fact...
[ "def", "add_factuality", "(", "self", ",", "my_fact", ")", ":", "if", "self", ".", "factuality_layer", "is", "None", ":", "self", ".", "factuality_layer", "=", "Cfactualities", "(", ")", "self", ".", "root", ".", "append", "(", "self", ".", "factuality_lay...
Adds a factuality to the factuality layer @type my_fact: L{Cfactuality} @param my_fact: factuality object
[ "Adds", "a", "factuality", "to", "the", "factuality", "layer" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L1235-L1244
train
Adds a factuality to the factuality layer.
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.add_entity
def add_entity(self,entity): """ Adds an entity to the entity layer @type entity: L{Centity} @param entity: the entity object """ if self.entity_layer is None: self.entity_layer = Centities(type=self.type) self.root.append(self.entity_layer.get_nod...
python
def add_entity(self,entity): """ Adds an entity to the entity layer @type entity: L{Centity} @param entity: the entity object """ if self.entity_layer is None: self.entity_layer = Centities(type=self.type) self.root.append(self.entity_layer.get_nod...
[ "def", "add_entity", "(", "self", ",", "entity", ")", ":", "if", "self", ".", "entity_layer", "is", "None", ":", "self", ".", "entity_layer", "=", "Centities", "(", "type", "=", "self", ".", "type", ")", "self", ".", "root", ".", "append", "(", "self...
Adds an entity to the entity layer @type entity: L{Centity} @param entity: the entity object
[ "Adds", "an", "entity", "to", "the", "entity", "layer" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L1246-L1255
train
Adds an entity to the entity layer.
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.create_entity
def create_entity(self, entity_type, term_ids, id=None): """ Create a new (named) entity and add it to the entities layer @type entity_type: string @param entity_type: The type of the entity @type term_ids: list @param term_ids: list of term ids @type id: string ...
python
def create_entity(self, entity_type, term_ids, id=None): """ Create a new (named) entity and add it to the entities layer @type entity_type: string @param entity_type: The type of the entity @type term_ids: list @param term_ids: list of term ids @type id: string ...
[ "def", "create_entity", "(", "self", ",", "entity_type", ",", "term_ids", ",", "id", "=", "None", ")", ":", "new_entity", "=", "Centity", "(", "type", "=", "self", ".", "type", ")", "if", "id", "is", "None", ":", "n", "=", "1", "if", "self", ".", ...
Create a new (named) entity and add it to the entities layer @type entity_type: string @param entity_type: The type of the entity @type term_ids: list @param term_ids: list of term ids @type id: string @param id: optional id of the entity
[ "Create", "a", "new", "(", "named", ")", "entity", "and", "add", "it", "to", "the", "entities", "layer" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L1257-L1277
train
Create a new entity and add it to the entities layer
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.add_coreference
def add_coreference(self, coreference): """ Adds an coreference to the coreference layer @type coreference: L{Ccoreference} @param coreference: the coreference object """ if self.coreference_layer is None: self.coreference_layer = Ccoreferences(type=self.type)...
python
def add_coreference(self, coreference): """ Adds an coreference to the coreference layer @type coreference: L{Ccoreference} @param coreference: the coreference object """ if self.coreference_layer is None: self.coreference_layer = Ccoreferences(type=self.type)...
[ "def", "add_coreference", "(", "self", ",", "coreference", ")", ":", "if", "self", ".", "coreference_layer", "is", "None", ":", "self", ".", "coreference_layer", "=", "Ccoreferences", "(", "type", "=", "self", ".", "type", ")", "self", ".", "root", ".", ...
Adds an coreference to the coreference layer @type coreference: L{Ccoreference} @param coreference: the coreference object
[ "Adds", "an", "coreference", "to", "the", "coreference", "layer" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L1279-L1288
train
Adds an coreference to the coreference layer
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.create_coreference
def create_coreference(self, coref_type, term_ids, id=None): """ Create a new coreference object and add it to the coreferences layer @type coref_type: string @param coref_type: type of the coreference object @type term_ids: list @param term_ids: list of term ids ...
python
def create_coreference(self, coref_type, term_ids, id=None): """ Create a new coreference object and add it to the coreferences layer @type coref_type: string @param coref_type: type of the coreference object @type term_ids: list @param term_ids: list of term ids ...
[ "def", "create_coreference", "(", "self", ",", "coref_type", ",", "term_ids", ",", "id", "=", "None", ")", ":", "if", "id", "is", "None", ":", "if", "self", ".", "coreference_layer", "is", "None", ":", "i", "=", "1", "else", ":", "corefs", "=", "(", ...
Create a new coreference object and add it to the coreferences layer @type coref_type: string @param coref_type: type of the coreference object @type term_ids: list @param term_ids: list of term ids @type id: string @param id: optional id of the entity
[ "Create", "a", "new", "coreference", "object", "and", "add", "it", "to", "the", "coreferences", "layer" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L1290-L1313
train
Create a new coreference object and add it to the coreferences layer
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.add_constituency_tree
def add_constituency_tree(self,my_tree): """ Adds a constituency tree to the constituency layer @type my_tree: L{Ctree} @param my_tree: the constituency tree object """ if self.constituency_layer is None: self.constituency_layer = Cconstituency() s...
python
def add_constituency_tree(self,my_tree): """ Adds a constituency tree to the constituency layer @type my_tree: L{Ctree} @param my_tree: the constituency tree object """ if self.constituency_layer is None: self.constituency_layer = Cconstituency() s...
[ "def", "add_constituency_tree", "(", "self", ",", "my_tree", ")", ":", "if", "self", ".", "constituency_layer", "is", "None", ":", "self", ".", "constituency_layer", "=", "Cconstituency", "(", ")", "self", ".", "root", ".", "append", "(", "self", ".", "con...
Adds a constituency tree to the constituency layer @type my_tree: L{Ctree} @param my_tree: the constituency tree object
[ "Adds", "a", "constituency", "tree", "to", "the", "constituency", "layer" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L1315-L1324
train
Adds a constituency tree to the constituency layer
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.add_property
def add_property(self,label,term_span,pid=None): """ Adds a property to the property layer @type label: string @param label: the type of property @type term_span: list @param term_span: list of term ids @type pid: string @param pid: the identifier for the ...
python
def add_property(self,label,term_span,pid=None): """ Adds a property to the property layer @type label: string @param label: the type of property @type term_span: list @param term_span: list of term ids @type pid: string @param pid: the identifier for the ...
[ "def", "add_property", "(", "self", ",", "label", ",", "term_span", ",", "pid", "=", "None", ")", ":", "if", "self", ".", "features_layer", "is", "None", ":", "self", ".", "features_layer", "=", "Cfeatures", "(", "type", "=", "self", ".", "type", ")", ...
Adds a property to the property layer @type label: string @param label: the type of property @type term_span: list @param term_span: list of term ids @type pid: string @param pid: the identifier for the property (use None to automatically generate one)
[ "Adds", "a", "property", "to", "the", "property", "layer" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L1327-L1340
train
Adds a property to the property layer
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.get_dict_tokens_for_termid
def get_dict_tokens_for_termid(self, term_id): """ Returns the tokens ids that are the span of the term specified @type term_id: string @param term_id: the term idenfier @rtype: list @return: list of token ids that are the span of the term """ if self.dict...
python
def get_dict_tokens_for_termid(self, term_id): """ Returns the tokens ids that are the span of the term specified @type term_id: string @param term_id: the term idenfier @rtype: list @return: list of token ids that are the span of the term """ if self.dict...
[ "def", "get_dict_tokens_for_termid", "(", "self", ",", "term_id", ")", ":", "if", "self", ".", "dict_tokens_for_tid", "is", "None", ":", "self", ".", "dict_tokens_for_tid", "=", "{", "}", "for", "term", "in", "self", ".", "get_terms", "(", ")", ":", "self"...
Returns the tokens ids that are the span of the term specified @type term_id: string @param term_id: the term idenfier @rtype: list @return: list of token ids that are the span of the term
[ "Returns", "the", "tokens", "ids", "that", "are", "the", "span", "of", "the", "term", "specified" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L1344-L1357
train
Returns the dict of tokens ids that are the span of the term specified
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.map_tokens_to_terms
def map_tokens_to_terms(self,list_tokens): """ Maps a list of token ids to the corresponding term ids @type list_tokens: list @param list_tokens: list of token identifiers @rtype: list @return: list of term idenfitiers """ if self.terms_for_token is None: ...
python
def map_tokens_to_terms(self,list_tokens): """ Maps a list of token ids to the corresponding term ids @type list_tokens: list @param list_tokens: list of token identifiers @rtype: list @return: list of term idenfitiers """ if self.terms_for_token is None: ...
[ "def", "map_tokens_to_terms", "(", "self", ",", "list_tokens", ")", ":", "if", "self", ".", "terms_for_token", "is", "None", ":", "self", ".", "terms_for_token", "=", "{", "}", "for", "term", "in", "self", ".", "get_terms", "(", ")", ":", "termid", "=", ...
Maps a list of token ids to the corresponding term ids @type list_tokens: list @param list_tokens: list of token identifiers @rtype: list @return: list of term idenfitiers
[ "Maps", "a", "list", "of", "token", "ids", "to", "the", "corresponding", "term", "ids" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L1360-L1383
train
Maps a list of token ids to the corresponding term ids
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.add_external_reference_to_term
def add_external_reference_to_term(self,term_id, external_ref): """ Adds an external reference to the given term identifier @type term_id: string @param term_id: the term identifier @param external_ref: an external reference object @type external_ref: L{CexternalReference...
python
def add_external_reference_to_term(self,term_id, external_ref): """ Adds an external reference to the given term identifier @type term_id: string @param term_id: the term identifier @param external_ref: an external reference object @type external_ref: L{CexternalReference...
[ "def", "add_external_reference_to_term", "(", "self", ",", "term_id", ",", "external_ref", ")", ":", "if", "self", ".", "term_layer", "is", "not", "None", ":", "self", ".", "term_layer", ".", "add_external_reference", "(", "term_id", ",", "external_ref", ")" ]
Adds an external reference to the given term identifier @type term_id: string @param term_id: the term identifier @param external_ref: an external reference object @type external_ref: L{CexternalReference}
[ "Adds", "an", "external", "reference", "to", "the", "given", "term", "identifier" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L1406-L1415
train
Adds an external reference to the given term identifier
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.add_external_reference_to_role
def add_external_reference_to_role(self,role_id,external_ref): """ Adds an external reference to the given role identifier in the SRL layer @type role_id: string @param role_id: the role identifier @param external_ref: an external reference object @type external_ref: L{Ce...
python
def add_external_reference_to_role(self,role_id,external_ref): """ Adds an external reference to the given role identifier in the SRL layer @type role_id: string @param role_id: the role identifier @param external_ref: an external reference object @type external_ref: L{Ce...
[ "def", "add_external_reference_to_role", "(", "self", ",", "role_id", ",", "external_ref", ")", ":", "if", "self", ".", "srl_layer", "is", "not", "None", ":", "self", ".", "srl_layer", ".", "add_external_reference_to_role", "(", "role_id", ",", "external_ref", "...
Adds an external reference to the given role identifier in the SRL layer @type role_id: string @param role_id: the role identifier @param external_ref: an external reference object @type external_ref: L{CexternalReference}
[ "Adds", "an", "external", "reference", "to", "the", "given", "role", "identifier", "in", "the", "SRL", "layer" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L1426-L1435
train
Adds an external reference to the given role identifier in the SRL layer.
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.remove_external_references_from_srl_layer
def remove_external_references_from_srl_layer(self): """ Removes all external references present in the term layer """ if self.srl_layer is not None: for pred in self.srl_layer.get_predicates(): pred.remove_external_references() pred.remove_ext...
python
def remove_external_references_from_srl_layer(self): """ Removes all external references present in the term layer """ if self.srl_layer is not None: for pred in self.srl_layer.get_predicates(): pred.remove_external_references() pred.remove_ext...
[ "def", "remove_external_references_from_srl_layer", "(", "self", ")", ":", "if", "self", ".", "srl_layer", "is", "not", "None", ":", "for", "pred", "in", "self", ".", "srl_layer", ".", "get_predicates", "(", ")", ":", "pred", ".", "remove_external_references", ...
Removes all external references present in the term layer
[ "Removes", "all", "external", "references", "present", "in", "the", "term", "layer" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L1439-L1446
train
Removes all external references present in the term layer
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.add_external_reference_to_entity
def add_external_reference_to_entity(self,entity_id, external_ref): """ Adds an external reference to the given entity identifier in the entity layer @type entity_id: string @param entity_id: the entity identifier @param external_ref: an external reference object @type ex...
python
def add_external_reference_to_entity(self,entity_id, external_ref): """ Adds an external reference to the given entity identifier in the entity layer @type entity_id: string @param entity_id: the entity identifier @param external_ref: an external reference object @type ex...
[ "def", "add_external_reference_to_entity", "(", "self", ",", "entity_id", ",", "external_ref", ")", ":", "if", "self", ".", "entity_layer", "is", "not", "None", ":", "self", ".", "entity_layer", ".", "add_external_reference_to_entity", "(", "entity_id", ",", "exte...
Adds an external reference to the given entity identifier in the entity layer @type entity_id: string @param entity_id: the entity identifier @param external_ref: an external reference object @type external_ref: L{CexternalReference}
[ "Adds", "an", "external", "reference", "to", "the", "given", "entity", "identifier", "in", "the", "entity", "layer" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L1448-L1457
train
Adds an external reference to the given entity identifier in the entity layer.
teepark/greenhouse
greenhouse/io/files.py
FileBase.read
def read(self, size=-1): """read a number of bytes from the file and return it as a string .. note:: this method will block if there is no data already available :param size: the maximum number of bytes to read from the file. < 0 means read the file to the end :...
python
def read(self, size=-1): """read a number of bytes from the file and return it as a string .. note:: this method will block if there is no data already available :param size: the maximum number of bytes to read from the file. < 0 means read the file to the end :...
[ "def", "read", "(", "self", ",", "size", "=", "-", "1", ")", ":", "chunksize", "=", "size", "<", "0", "and", "self", ".", "CHUNKSIZE", "or", "min", "(", "self", ".", "CHUNKSIZE", ",", "size", ")", "buf", "=", "self", ".", "_rbuf", "buf", ".", "...
read a number of bytes from the file and return it as a string .. note:: this method will block if there is no data already available :param size: the maximum number of bytes to read from the file. < 0 means read the file to the end :type size: int :returns: a ...
[ "read", "a", "number", "of", "bytes", "from", "the", "file", "and", "return", "it", "as", "a", "string" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/io/files.py#L48-L91
train
read a number of bytes from the file and return it as a string
teepark/greenhouse
greenhouse/io/files.py
FileBase.readline
def readline(self, max_len=-1): """read from the file until a newline is encountered .. note:: this method will block if there isn't already a full line available from the data source :param max_len: stop reading a single line after this many bytes :type max_le...
python
def readline(self, max_len=-1): """read from the file until a newline is encountered .. note:: this method will block if there isn't already a full line available from the data source :param max_len: stop reading a single line after this many bytes :type max_le...
[ "def", "readline", "(", "self", ",", "max_len", "=", "-", "1", ")", ":", "buf", "=", "self", ".", "_rbuf", "newline", ",", "chunksize", "=", "self", ".", "NEWLINE", ",", "self", ".", "CHUNKSIZE", "buf", ".", "seek", "(", "0", ")", "text", "=", "b...
read from the file until a newline is encountered .. note:: this method will block if there isn't already a full line available from the data source :param max_len: stop reading a single line after this many bytes :type max_len: int :returns: a str...
[ "read", "from", "the", "file", "until", "a", "newline", "is", "encountered" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/io/files.py#L93-L147
train
read from the file until a newline is encountered
teepark/greenhouse
greenhouse/io/files.py
FileBase.write
def write(self, data): """write data to the file :param data: the data to write into the file, at the descriptor's current position :type data: str """ while data: went = self._write_chunk(data) if went is None: con...
python
def write(self, data): """write data to the file :param data: the data to write into the file, at the descriptor's current position :type data: str """ while data: went = self._write_chunk(data) if went is None: con...
[ "def", "write", "(", "self", ",", "data", ")", ":", "while", "data", ":", "went", "=", "self", ".", "_write_chunk", "(", "data", ")", "if", "went", "is", "None", ":", "continue", "data", "=", "data", "[", "went", ":", "]" ]
write data to the file :param data: the data to write into the file, at the descriptor's current position :type data: str
[ "write", "data", "to", "the", "file" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/io/files.py#L161-L173
train
write data into the file at the descriptor s current position
teepark/greenhouse
greenhouse/io/files.py
File._wait_event
def _wait_event(self, reading): "wait on our events" with self._registered(reading, not reading): (self._readable if reading else self._writable).wait() if scheduler.state.interrupted: raise IOError(errno.EINTR, "interrupted system call")
python
def _wait_event(self, reading): "wait on our events" with self._registered(reading, not reading): (self._readable if reading else self._writable).wait() if scheduler.state.interrupted: raise IOError(errno.EINTR, "interrupted system call")
[ "def", "_wait_event", "(", "self", ",", "reading", ")", ":", "with", "self", ".", "_registered", "(", "reading", ",", "not", "reading", ")", ":", "(", "self", ".", "_readable", "if", "reading", "else", "self", ".", "_writable", ")", ".", "wait", "(", ...
wait on our events
[ "wait", "on", "our", "events" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/io/files.py#L273-L279
train
wait on our events
teepark/greenhouse
greenhouse/io/files.py
File.fromfd
def fromfd(cls, fd, mode='rb', bufsize=-1): """create a cooperating greenhouse file from an existing descriptor :param fd: the file descriptor to wrap in a new file object :type fd: int :param mode: the file mode :type mode: str :param bufsize: the size of re...
python
def fromfd(cls, fd, mode='rb', bufsize=-1): """create a cooperating greenhouse file from an existing descriptor :param fd: the file descriptor to wrap in a new file object :type fd: int :param mode: the file mode :type mode: str :param bufsize: the size of re...
[ "def", "fromfd", "(", "cls", ",", "fd", ",", "mode", "=", "'rb'", ",", "bufsize", "=", "-", "1", ")", ":", "fp", "=", "object", ".", "__new__", "(", "cls", ")", "# bypass __init__", "fp", ".", "_rbuf", "=", "StringIO", "(", ")", "fp", ".", "encod...
create a cooperating greenhouse file from an existing descriptor :param fd: the file descriptor to wrap in a new file object :type fd: int :param mode: the file mode :type mode: str :param bufsize: the size of read buffer to use. 0 indicates unbuffered, and < 0 ...
[ "create", "a", "cooperating", "greenhouse", "file", "from", "an", "existing", "descriptor" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/io/files.py#L310-L333
train
create a cooperating greenhouse file from an existing file descriptor
teepark/greenhouse
greenhouse/io/files.py
File.isatty
def isatty(self): "return whether the file is connected to a tty or not" try: return os.isatty(self._fileno) except OSError, e: raise IOError(*e.args)
python
def isatty(self): "return whether the file is connected to a tty or not" try: return os.isatty(self._fileno) except OSError, e: raise IOError(*e.args)
[ "def", "isatty", "(", "self", ")", ":", "try", ":", "return", "os", ".", "isatty", "(", "self", ".", "_fileno", ")", "except", "OSError", ",", "e", ":", "raise", "IOError", "(", "*", "e", ".", "args", ")" ]
return whether the file is connected to a tty or not
[ "return", "whether", "the", "file", "is", "connected", "to", "a", "tty", "or", "not" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/io/files.py#L357-L362
train
return whether the file is connected to a tty or not
teepark/greenhouse
greenhouse/io/files.py
File.seek
def seek(self, position, modifier=0): """move the cursor on the file descriptor to a different location :param position: an integer offset from the location indicated by the modifier :type position: int :param modifier: an indicator of how to find the seek locati...
python
def seek(self, position, modifier=0): """move the cursor on the file descriptor to a different location :param position: an integer offset from the location indicated by the modifier :type position: int :param modifier: an indicator of how to find the seek locati...
[ "def", "seek", "(", "self", ",", "position", ",", "modifier", "=", "0", ")", ":", "os", ".", "lseek", "(", "self", ".", "_fileno", ",", "position", ",", "modifier", ")", "# clear out the buffer", "buf", "=", "self", ".", "_rbuf", "buf", ".", "seek", ...
move the cursor on the file descriptor to a different location :param position: an integer offset from the location indicated by the modifier :type position: int :param modifier: an indicator of how to find the seek location. - ``os.SEEK_SET`` means start fr...
[ "move", "the", "cursor", "on", "the", "file", "descriptor", "to", "a", "different", "location" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/io/files.py#L364-L384
train
move the cursor to a different location
teepark/greenhouse
greenhouse/io/files.py
File.tell
def tell(self): "get the file descriptor's position relative to the file's beginning" with _fdopen(os.dup(self._fileno)) as fp: return fp.tell()
python
def tell(self): "get the file descriptor's position relative to the file's beginning" with _fdopen(os.dup(self._fileno)) as fp: return fp.tell()
[ "def", "tell", "(", "self", ")", ":", "with", "_fdopen", "(", "os", ".", "dup", "(", "self", ".", "_fileno", ")", ")", "as", "fp", ":", "return", "fp", ".", "tell", "(", ")" ]
get the file descriptor's position relative to the file's beginning
[ "get", "the", "file", "descriptor", "s", "position", "relative", "to", "the", "file", "s", "beginning" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/io/files.py#L386-L389
train
get the file descriptor s position relative to the file s beginning
vmonaco/pohmm
pohmm/classification.py
PohmmClassifier.fit
def fit(self, labels, samples, pstates): """ Fit the classifier with labels y and observations X """ assert len(labels) == len(samples) == len(pstates) for label in set(labels): label_samples = [s for l,s in zip(labels, samples) if l == label] label_pstat...
python
def fit(self, labels, samples, pstates): """ Fit the classifier with labels y and observations X """ assert len(labels) == len(samples) == len(pstates) for label in set(labels): label_samples = [s for l,s in zip(labels, samples) if l == label] label_pstat...
[ "def", "fit", "(", "self", ",", "labels", ",", "samples", ",", "pstates", ")", ":", "assert", "len", "(", "labels", ")", "==", "len", "(", "samples", ")", "==", "len", "(", "pstates", ")", "for", "label", "in", "set", "(", "labels", ")", ":", "la...
Fit the classifier with labels y and observations X
[ "Fit", "the", "classifier", "with", "labels", "y", "and", "observations", "X" ]
c00f8a62d3005a171d424549a55d46c421859ae9
https://github.com/vmonaco/pohmm/blob/c00f8a62d3005a171d424549a55d46c421859ae9/pohmm/classification.py#L16-L30
train
Fit the classifier with labels y and observations X
vmonaco/pohmm
pohmm/classification.py
PohmmClassifier.fit_df
def fit_df(self, labels, dfs, pstate_col=PSTATE_COL): """ Fit the classifier with labels y and DataFrames dfs """ assert len(labels) == len(dfs) for label in set(labels): label_dfs = [s for l,s in zip(labels, dfs) if l == label] pohmm = self.pohmm_factor...
python
def fit_df(self, labels, dfs, pstate_col=PSTATE_COL): """ Fit the classifier with labels y and DataFrames dfs """ assert len(labels) == len(dfs) for label in set(labels): label_dfs = [s for l,s in zip(labels, dfs) if l == label] pohmm = self.pohmm_factor...
[ "def", "fit_df", "(", "self", ",", "labels", ",", "dfs", ",", "pstate_col", "=", "PSTATE_COL", ")", ":", "assert", "len", "(", "labels", ")", "==", "len", "(", "dfs", ")", "for", "label", "in", "set", "(", "labels", ")", ":", "label_dfs", "=", "[",...
Fit the classifier with labels y and DataFrames dfs
[ "Fit", "the", "classifier", "with", "labels", "y", "and", "DataFrames", "dfs" ]
c00f8a62d3005a171d424549a55d46c421859ae9
https://github.com/vmonaco/pohmm/blob/c00f8a62d3005a171d424549a55d46c421859ae9/pohmm/classification.py#L32-L45
train
Fit the classifier with labels y and DataFrames dfs and return the classifier.
vmonaco/pohmm
pohmm/classification.py
PohmmClassifier.predict
def predict(self, sample, pstates): """ Predict the class label of X """ scores = {} for label, pohmm in self.pohmms.items(): scores[label] = pohmm.score(sample, pstates) max_score_label = max(scores.items(), key=itemgetter(1))[0] return max_score_labe...
python
def predict(self, sample, pstates): """ Predict the class label of X """ scores = {} for label, pohmm in self.pohmms.items(): scores[label] = pohmm.score(sample, pstates) max_score_label = max(scores.items(), key=itemgetter(1))[0] return max_score_labe...
[ "def", "predict", "(", "self", ",", "sample", ",", "pstates", ")", ":", "scores", "=", "{", "}", "for", "label", ",", "pohmm", "in", "self", ".", "pohmms", ".", "items", "(", ")", ":", "scores", "[", "label", "]", "=", "pohmm", ".", "score", "(",...
Predict the class label of X
[ "Predict", "the", "class", "label", "of", "X" ]
c00f8a62d3005a171d424549a55d46c421859ae9
https://github.com/vmonaco/pohmm/blob/c00f8a62d3005a171d424549a55d46c421859ae9/pohmm/classification.py#L47-L55
train
Predict the class label of X
vmonaco/pohmm
pohmm/classification.py
PohmmClassifier.predict_df
def predict_df(self, df, pstate_col=PSTATE_COL): """ Predict the class label of DataFrame df """ scores = {} for label, pohmm in self.pohmms.items(): scores[label] = pohmm.score_df(df, pstate_col=pstate_col) max_score_label = max(scores.items(), key=itemgetter...
python
def predict_df(self, df, pstate_col=PSTATE_COL): """ Predict the class label of DataFrame df """ scores = {} for label, pohmm in self.pohmms.items(): scores[label] = pohmm.score_df(df, pstate_col=pstate_col) max_score_label = max(scores.items(), key=itemgetter...
[ "def", "predict_df", "(", "self", ",", "df", ",", "pstate_col", "=", "PSTATE_COL", ")", ":", "scores", "=", "{", "}", "for", "label", ",", "pohmm", "in", "self", ".", "pohmms", ".", "items", "(", ")", ":", "scores", "[", "label", "]", "=", "pohmm",...
Predict the class label of DataFrame df
[ "Predict", "the", "class", "label", "of", "DataFrame", "df" ]
c00f8a62d3005a171d424549a55d46c421859ae9
https://github.com/vmonaco/pohmm/blob/c00f8a62d3005a171d424549a55d46c421859ae9/pohmm/classification.py#L57-L65
train
Predict the class label of DataFrame df
EVEprosper/ProsperCommon
prosper/common/prosper_cli.py
ProsperApplication.dump_config
def dump_config(self): # pragma: no cover """dumps configfile to stdout so users can edit/implement their own""" with open(self.config_path, 'r') as cfg_fh: base_config = cfg_fh.read() print(base_config) exit(2)
python
def dump_config(self): # pragma: no cover """dumps configfile to stdout so users can edit/implement their own""" with open(self.config_path, 'r') as cfg_fh: base_config = cfg_fh.read() print(base_config) exit(2)
[ "def", "dump_config", "(", "self", ")", ":", "# pragma: no cover", "with", "open", "(", "self", ".", "config_path", ",", "'r'", ")", "as", "cfg_fh", ":", "base_config", "=", "cfg_fh", ".", "read", "(", ")", "print", "(", "base_config", ")", "exit", "(", ...
dumps configfile to stdout so users can edit/implement their own
[ "dumps", "configfile", "to", "stdout", "so", "users", "can", "edit", "/", "implement", "their", "own" ]
bcada3b25420099e1f204db8d55eb268e7b4dc27
https://github.com/EVEprosper/ProsperCommon/blob/bcada3b25420099e1f204db8d55eb268e7b4dc27/prosper/common/prosper_cli.py#L44-L50
train
dumps configfile to stdout so users can edit their own
EVEprosper/ProsperCommon
prosper/common/prosper_cli.py
ProsperApplication.load_secrets
def load_secrets(self, secret_path): """render secrets into config object""" self._config = p_config.render_secrets(self.config_path, secret_path)
python
def load_secrets(self, secret_path): """render secrets into config object""" self._config = p_config.render_secrets(self.config_path, secret_path)
[ "def", "load_secrets", "(", "self", ",", "secret_path", ")", ":", "self", ".", "_config", "=", "p_config", ".", "render_secrets", "(", "self", ".", "config_path", ",", "secret_path", ")" ]
render secrets into config object
[ "render", "secrets", "into", "config", "object" ]
bcada3b25420099e1f204db8d55eb268e7b4dc27
https://github.com/EVEprosper/ProsperCommon/blob/bcada3b25420099e1f204db8d55eb268e7b4dc27/prosper/common/prosper_cli.py#L57-L59
train
load secrets into config object
EVEprosper/ProsperCommon
prosper/common/prosper_cli.py
ProsperApplication.logger
def logger(self): """uses "global logger" for logging""" if self._logger: return self._logger else: log_builder = p_logging.ProsperLogger( self.PROGNAME, self.config.get_option('LOGGING', 'log_path'), config_obj=self.config ...
python
def logger(self): """uses "global logger" for logging""" if self._logger: return self._logger else: log_builder = p_logging.ProsperLogger( self.PROGNAME, self.config.get_option('LOGGING', 'log_path'), config_obj=self.config ...
[ "def", "logger", "(", "self", ")", ":", "if", "self", ".", "_logger", ":", "return", "self", ".", "_logger", "else", ":", "log_builder", "=", "p_logging", ".", "ProsperLogger", "(", "self", ".", "PROGNAME", ",", "self", ".", "config", ".", "get_option", ...
uses "global logger" for logging
[ "uses", "global", "logger", "for", "logging" ]
bcada3b25420099e1f204db8d55eb268e7b4dc27
https://github.com/EVEprosper/ProsperCommon/blob/bcada3b25420099e1f204db8d55eb268e7b4dc27/prosper/common/prosper_cli.py#L63-L95
train
uses global logger for logging
EVEprosper/ProsperCommon
prosper/common/prosper_cli.py
ProsperApplication.config
def config(self): """uses "global config" for cfg""" if self._config: return self._config else: self._config = p_config.ProsperConfig(self.config_path) return self._config
python
def config(self): """uses "global config" for cfg""" if self._config: return self._config else: self._config = p_config.ProsperConfig(self.config_path) return self._config
[ "def", "config", "(", "self", ")", ":", "if", "self", ".", "_config", ":", "return", "self", ".", "_config", "else", ":", "self", ".", "_config", "=", "p_config", ".", "ProsperConfig", "(", "self", ".", "config_path", ")", "return", "self", ".", "_conf...
uses "global config" for cfg
[ "uses", "global", "config", "for", "cfg" ]
bcada3b25420099e1f204db8d55eb268e7b4dc27
https://github.com/EVEprosper/ProsperCommon/blob/bcada3b25420099e1f204db8d55eb268e7b4dc27/prosper/common/prosper_cli.py#L99-L105
train
uses global config for cfg
EVEprosper/ProsperCommon
prosper/common/prosper_cli.py
FlaskLauncher.notify_launch
def notify_launch(self, log_level='ERROR'): """logs launcher message before startup Args: log_level (str): level to notify at """ if not self.debug: self.logger.log( logging.getLevelName(log_level), 'LAUNCHING %s -- %s', self.PROG...
python
def notify_launch(self, log_level='ERROR'): """logs launcher message before startup Args: log_level (str): level to notify at """ if not self.debug: self.logger.log( logging.getLevelName(log_level), 'LAUNCHING %s -- %s', self.PROG...
[ "def", "notify_launch", "(", "self", ",", "log_level", "=", "'ERROR'", ")", ":", "if", "not", "self", ".", "debug", ":", "self", ".", "logger", ".", "log", "(", "logging", ".", "getLevelName", "(", "log_level", ")", ",", "'LAUNCHING %s -- %s'", ",", "sel...
logs launcher message before startup Args: log_level (str): level to notify at
[ "logs", "launcher", "message", "before", "startup" ]
bcada3b25420099e1f204db8d55eb268e7b4dc27
https://github.com/EVEprosper/ProsperCommon/blob/bcada3b25420099e1f204db8d55eb268e7b4dc27/prosper/common/prosper_cli.py#L146-L163
train
logs launcher message before startup
Open-ET/openet-core-beta
openet/core/common.py
landsat_c1_toa_cloud_mask
def landsat_c1_toa_cloud_mask(input_img, snow_flag=False, cirrus_flag=False, cloud_confidence=2, shadow_confidence=3, snow_confidence=3, cirrus_confidence=3): """Extract cloud mask from the Landsat Collection 1 TOA BQA band Parameters ---------- ...
python
def landsat_c1_toa_cloud_mask(input_img, snow_flag=False, cirrus_flag=False, cloud_confidence=2, shadow_confidence=3, snow_confidence=3, cirrus_confidence=3): """Extract cloud mask from the Landsat Collection 1 TOA BQA band Parameters ---------- ...
[ "def", "landsat_c1_toa_cloud_mask", "(", "input_img", ",", "snow_flag", "=", "False", ",", "cirrus_flag", "=", "False", ",", "cloud_confidence", "=", "2", ",", "shadow_confidence", "=", "3", ",", "snow_confidence", "=", "3", ",", "cirrus_confidence", "=", "3", ...
Extract cloud mask from the Landsat Collection 1 TOA BQA band Parameters ---------- input_img : ee.Image Image from a Landsat Collection 1 TOA collection with a BQA band (e.g. LANDSAT/LE07/C01/T1_TOA). snow_flag : bool If true, mask snow pixels (the default is False). cirrus...
[ "Extract", "cloud", "mask", "from", "the", "Landsat", "Collection", "1", "TOA", "BQA", "band" ]
f2b81ccf87bf7e7fe1b9f3dd1d4081d0ec7852db
https://github.com/Open-ET/openet-core-beta/blob/f2b81ccf87bf7e7fe1b9f3dd1d4081d0ec7852db/openet/core/common.py#L6-L80
train
Extract cloud mask from the Landsat Collection 1 TOA band.
Open-ET/openet-core-beta
openet/core/common.py
landsat_c1_sr_cloud_mask
def landsat_c1_sr_cloud_mask(input_img, cloud_confidence=3, snow_flag=False): """Extract cloud mask from the Landsat Collection 1 SR pixel_qa band Parameters ---------- img : ee.Image Image from a Landsat Collection 1 SR image collection with a pixel_qa band (e.g. LANDSAT/LE07/C01/T1_SR...
python
def landsat_c1_sr_cloud_mask(input_img, cloud_confidence=3, snow_flag=False): """Extract cloud mask from the Landsat Collection 1 SR pixel_qa band Parameters ---------- img : ee.Image Image from a Landsat Collection 1 SR image collection with a pixel_qa band (e.g. LANDSAT/LE07/C01/T1_SR...
[ "def", "landsat_c1_sr_cloud_mask", "(", "input_img", ",", "cloud_confidence", "=", "3", ",", "snow_flag", "=", "False", ")", ":", "qa_img", "=", "input_img", ".", "select", "(", "[", "'pixel_qa'", "]", ")", "cloud_mask", "=", "qa_img", ".", "rightShift", "("...
Extract cloud mask from the Landsat Collection 1 SR pixel_qa band Parameters ---------- img : ee.Image Image from a Landsat Collection 1 SR image collection with a pixel_qa band (e.g. LANDSAT/LE07/C01/T1_SR). cloud_confidence : int Minimum cloud confidence value (the default is ...
[ "Extract", "cloud", "mask", "from", "the", "Landsat", "Collection", "1", "SR", "pixel_qa", "band" ]
f2b81ccf87bf7e7fe1b9f3dd1d4081d0ec7852db
https://github.com/Open-ET/openet-core-beta/blob/f2b81ccf87bf7e7fe1b9f3dd1d4081d0ec7852db/openet/core/common.py#L83-L135
train
Extract cloud mask from the Landsat Collection 1 SR image collection with a pixel_qa band and a cloud confidence value.
Open-ET/openet-core-beta
openet/core/common.py
sentinel2_toa_cloud_mask
def sentinel2_toa_cloud_mask(input_img): """Extract cloud mask from the Sentinel 2 TOA QA60 band Parameters ---------- input_img : ee.Image Image from the COPERNICUS/S2 collection with a QA60 band. Returns ------- ee.Image Notes ----- Output image is structured to be a...
python
def sentinel2_toa_cloud_mask(input_img): """Extract cloud mask from the Sentinel 2 TOA QA60 band Parameters ---------- input_img : ee.Image Image from the COPERNICUS/S2 collection with a QA60 band. Returns ------- ee.Image Notes ----- Output image is structured to be a...
[ "def", "sentinel2_toa_cloud_mask", "(", "input_img", ")", ":", "qa_img", "=", "input_img", ".", "select", "(", "[", "'QA60'", "]", ")", "cloud_mask", "=", "qa_img", ".", "rightShift", "(", "10", ")", ".", "bitwiseAnd", "(", "1", ")", ".", "neq", "(", "...
Extract cloud mask from the Sentinel 2 TOA QA60 band Parameters ---------- input_img : ee.Image Image from the COPERNICUS/S2 collection with a QA60 band. Returns ------- ee.Image Notes ----- Output image is structured to be applied directly with updateMask() i.e. 0...
[ "Extract", "cloud", "mask", "from", "the", "Sentinel", "2", "TOA", "QA60", "band" ]
f2b81ccf87bf7e7fe1b9f3dd1d4081d0ec7852db
https://github.com/Open-ET/openet-core-beta/blob/f2b81ccf87bf7e7fe1b9f3dd1d4081d0ec7852db/openet/core/common.py#L138-L172
train
Extract cloud mask from Sentinel 2 TOA QA60 band
nickpandolfi/Cyther
cyther/searcher.py
where
def where(cmd, path=None): """ A function to wrap shutil.which for universal usage """ raw_result = shutil.which(cmd, os.X_OK, path) if raw_result: return os.path.abspath(raw_result) else: raise ValueError("Could not find '{}' in the path".format(cmd))
python
def where(cmd, path=None): """ A function to wrap shutil.which for universal usage """ raw_result = shutil.which(cmd, os.X_OK, path) if raw_result: return os.path.abspath(raw_result) else: raise ValueError("Could not find '{}' in the path".format(cmd))
[ "def", "where", "(", "cmd", ",", "path", "=", "None", ")", ":", "raw_result", "=", "shutil", ".", "which", "(", "cmd", ",", "os", ".", "X_OK", ",", "path", ")", "if", "raw_result", ":", "return", "os", ".", "path", ".", "abspath", "(", "raw_result"...
A function to wrap shutil.which for universal usage
[ "A", "function", "to", "wrap", "shutil", ".", "which", "for", "universal", "usage" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/searcher.py#L23-L31
train
A function to wrap shutil. which for universal usage
nickpandolfi/Cyther
cyther/searcher.py
search_file
def search_file(pattern, file_path): """ Search a given file's contents for the regex pattern given as 'pattern' """ try: with open(file_path) as file: string = file.read() except PermissionError: return [] matches = re.findall(pattern, string) return matches
python
def search_file(pattern, file_path): """ Search a given file's contents for the regex pattern given as 'pattern' """ try: with open(file_path) as file: string = file.read() except PermissionError: return [] matches = re.findall(pattern, string) return matches
[ "def", "search_file", "(", "pattern", ",", "file_path", ")", ":", "try", ":", "with", "open", "(", "file_path", ")", "as", "file", ":", "string", "=", "file", ".", "read", "(", ")", "except", "PermissionError", ":", "return", "[", "]", "matches", "=", ...
Search a given file's contents for the regex pattern given as 'pattern'
[ "Search", "a", "given", "file", "s", "contents", "for", "the", "regex", "pattern", "given", "as", "pattern" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/searcher.py#L34-L46
train
Search a given file for the regex pattern given as pattern
nickpandolfi/Cyther
cyther/searcher.py
breadth
def breadth(dirs): """ Crawl through directories like os.walk, but use a 'breadth first' approach (os.walk uses 'depth first') """ while dirs: next_dirs = [] print("Dirs: '{}'".format(dirs)) for d in dirs: next_dirs = [] try: for name i...
python
def breadth(dirs): """ Crawl through directories like os.walk, but use a 'breadth first' approach (os.walk uses 'depth first') """ while dirs: next_dirs = [] print("Dirs: '{}'".format(dirs)) for d in dirs: next_dirs = [] try: for name i...
[ "def", "breadth", "(", "dirs", ")", ":", "while", "dirs", ":", "next_dirs", "=", "[", "]", "print", "(", "\"Dirs: '{}'\"", ".", "format", "(", "dirs", ")", ")", "for", "d", "in", "dirs", ":", "next_dirs", "=", "[", "]", "try", ":", "for", "name", ...
Crawl through directories like os.walk, but use a 'breadth first' approach (os.walk uses 'depth first')
[ "Crawl", "through", "directories", "like", "os", ".", "walk", "but", "use", "a", "breadth", "first", "approach", "(", "os", ".", "walk", "uses", "depth", "first", ")" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/searcher.py#L75-L95
train
A breadth - first approach of os. walk.
nickpandolfi/Cyther
cyther/searcher.py
find
def find(init, start=None, one=False, is_exec=False, content=None, parallelize=True, workers=None): """ Finds a given 'target' (filename string) in the file system """ base_start, target, suffix = _find_init(init, start) def _condition(file_path, dirpath, filenames): if target in f...
python
def find(init, start=None, one=False, is_exec=False, content=None, parallelize=True, workers=None): """ Finds a given 'target' (filename string) in the file system """ base_start, target, suffix = _find_init(init, start) def _condition(file_path, dirpath, filenames): if target in f...
[ "def", "find", "(", "init", ",", "start", "=", "None", ",", "one", "=", "False", ",", "is_exec", "=", "False", ",", "content", "=", "None", ",", "parallelize", "=", "True", ",", "workers", "=", "None", ")", ":", "base_start", ",", "target", ",", "s...
Finds a given 'target' (filename string) in the file system
[ "Finds", "a", "given", "target", "(", "filename", "string", ")", "in", "the", "file", "system" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/searcher.py#L104-L150
train
Find a given target in the file system.
nickpandolfi/Cyther
cyther/launcher.py
_get_encodings
def _get_encodings(): """ Just a simple function to return the system encoding (defaults to utf-8) """ stdout_encoding = sys.stdout.encoding if sys.stdout.encoding else 'utf-8' stderr_encoding = sys.stderr.encoding if sys.stderr.encoding else 'utf-8' return stdout_encoding, stderr_encoding
python
def _get_encodings(): """ Just a simple function to return the system encoding (defaults to utf-8) """ stdout_encoding = sys.stdout.encoding if sys.stdout.encoding else 'utf-8' stderr_encoding = sys.stderr.encoding if sys.stderr.encoding else 'utf-8' return stdout_encoding, stderr_encoding
[ "def", "_get_encodings", "(", ")", ":", "stdout_encoding", "=", "sys", ".", "stdout", ".", "encoding", "if", "sys", ".", "stdout", ".", "encoding", "else", "'utf-8'", "stderr_encoding", "=", "sys", ".", "stderr", ".", "encoding", "if", "sys", ".", "stderr"...
Just a simple function to return the system encoding (defaults to utf-8)
[ "Just", "a", "simple", "function", "to", "return", "the", "system", "encoding", "(", "defaults", "to", "utf", "-", "8", ")" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/launcher.py#L75-L81
train
Returns the system encoding and stderr encoding for a single node.
nickpandolfi/Cyther
cyther/launcher.py
call
def call(commands, *, print_result=False, raise_exception=False, print_commands=False): """ Will call a set of commands and wrangle the output how you choose """ if isinstance(commands, str): commands = commands.split() if not (isinstance(commands, tuple) or isinstance(...
python
def call(commands, *, print_result=False, raise_exception=False, print_commands=False): """ Will call a set of commands and wrangle the output how you choose """ if isinstance(commands, str): commands = commands.split() if not (isinstance(commands, tuple) or isinstance(...
[ "def", "call", "(", "commands", ",", "*", ",", "print_result", "=", "False", ",", "raise_exception", "=", "False", ",", "print_commands", "=", "False", ")", ":", "if", "isinstance", "(", "commands", ",", "str", ")", ":", "commands", "=", "commands", ".",...
Will call a set of commands and wrangle the output how you choose
[ "Will", "call", "a", "set", "of", "commands", "and", "wrangle", "the", "output", "how", "you", "choose" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/launcher.py#L105-L140
train
Calls a set of commands and returns the output of the process.
nickpandolfi/Cyther
cyther/launcher.py
multiCall
def multiCall(*commands, dependent=True, bundle=False, print_result=False, print_commands=False): """ Calls the function 'call' multiple times, given sets of commands """ results = [] dependent_failed = False for command in commands: if not dependent_failed: re...
python
def multiCall(*commands, dependent=True, bundle=False, print_result=False, print_commands=False): """ Calls the function 'call' multiple times, given sets of commands """ results = [] dependent_failed = False for command in commands: if not dependent_failed: re...
[ "def", "multiCall", "(", "*", "commands", ",", "dependent", "=", "True", ",", "bundle", "=", "False", ",", "print_result", "=", "False", ",", "print_commands", "=", "False", ")", ":", "results", "=", "[", "]", "dependent_failed", "=", "False", "for", "co...
Calls the function 'call' multiple times, given sets of commands
[ "Calls", "the", "function", "call", "multiple", "times", "given", "sets", "of", "commands" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/launcher.py#L145-L177
train
Calls the function call multiple times given sets of commands
nickpandolfi/Cyther
cyther/launcher.py
distribute
def distribute(function, iterable, *, workers=4): """ A version of multiprocessing.Pool.map that works using dill to pickle the function and iterable """ with multiprocessing.Pool(workers) as pool: processes = [] for item in iterable: pickled = dill.dumps((function, item)...
python
def distribute(function, iterable, *, workers=4): """ A version of multiprocessing.Pool.map that works using dill to pickle the function and iterable """ with multiprocessing.Pool(workers) as pool: processes = [] for item in iterable: pickled = dill.dumps((function, item)...
[ "def", "distribute", "(", "function", ",", "iterable", ",", "*", ",", "workers", "=", "4", ")", ":", "with", "multiprocessing", ".", "Pool", "(", "workers", ")", "as", "pool", ":", "processes", "=", "[", "]", "for", "item", "in", "iterable", ":", "pi...
A version of multiprocessing.Pool.map that works using dill to pickle the function and iterable
[ "A", "version", "of", "multiprocessing", ".", "Pool", ".", "map", "that", "works", "using", "dill", "to", "pickle", "the", "function", "and", "iterable" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/launcher.py#L185-L198
train
A version of multiprocessing. Pool. map that works using dill to pickle the function and iterable.
nickpandolfi/Cyther
cyther/launcher.py
Result.getOutput
def getOutput(self): """ Returns the combined output of stdout and stderr """ output = self.stdout if self.stdout: output += '\r\n' output += self.stderr return output
python
def getOutput(self): """ Returns the combined output of stdout and stderr """ output = self.stdout if self.stdout: output += '\r\n' output += self.stderr return output
[ "def", "getOutput", "(", "self", ")", ":", "output", "=", "self", ".", "stdout", "if", "self", ".", "stdout", ":", "output", "+=", "'\\r\\n'", "output", "+=", "self", ".", "stderr", "return", "output" ]
Returns the combined output of stdout and stderr
[ "Returns", "the", "combined", "output", "of", "stdout", "and", "stderr" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/launcher.py#L54-L62
train
Returns the combined output of stdout and stderr
nickpandolfi/Cyther
cyther/launcher.py
Result.extendInformation
def extendInformation(self, response): """ This extends the objects stdout and stderr by 'response's stdout and stderr """ if response.stdout: self.stdout += '\r\n' + response.stdout if response.stderr: self.stderr += '\r\n' + response.stderr
python
def extendInformation(self, response): """ This extends the objects stdout and stderr by 'response's stdout and stderr """ if response.stdout: self.stdout += '\r\n' + response.stdout if response.stderr: self.stderr += '\r\n' + response.stderr
[ "def", "extendInformation", "(", "self", ",", "response", ")", ":", "if", "response", ".", "stdout", ":", "self", ".", "stdout", "+=", "'\\r\\n'", "+", "response", ".", "stdout", "if", "response", ".", "stderr", ":", "self", ".", "stderr", "+=", "'\\r\\n...
This extends the objects stdout and stderr by 'response's stdout and stderr
[ "This", "extends", "the", "objects", "stdout", "and", "stderr", "by", "response", "s", "stdout", "and", "stderr" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/launcher.py#L64-L72
train
This extends the stdout and stderr by the response s stdout and stderr.
teepark/greenhouse
greenhouse/ext/zmq.py
wait_socks
def wait_socks(sock_events, inmask=1, outmask=2, timeout=None): """wait on a combination of zeromq sockets, normal sockets, and fds .. note:: this method can block it will return once there is relevant activity on any of the descriptors or sockets, or the timeout expires :param sock_event...
python
def wait_socks(sock_events, inmask=1, outmask=2, timeout=None): """wait on a combination of zeromq sockets, normal sockets, and fds .. note:: this method can block it will return once there is relevant activity on any of the descriptors or sockets, or the timeout expires :param sock_event...
[ "def", "wait_socks", "(", "sock_events", ",", "inmask", "=", "1", ",", "outmask", "=", "2", ",", "timeout", "=", "None", ")", ":", "results", "=", "[", "]", "for", "sock", ",", "mask", "in", "sock_events", ":", "if", "isinstance", "(", "sock", ",", ...
wait on a combination of zeromq sockets, normal sockets, and fds .. note:: this method can block it will return once there is relevant activity on any of the descriptors or sockets, or the timeout expires :param sock_events: two-tuples, the first item is either a zeromq socket, a sock...
[ "wait", "on", "a", "combination", "of", "zeromq", "sockets", "normal", "sockets", "and", "fds" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/ext/zmq.py#L12-L79
train
wait on a combination of zeromq sockets normal sockets and fds returning a list of two - tuples each one with the event mask that was detected on the inmask and outmask.
cltl/KafNafParserPy
KafNafParserPy/factuality_data.py
Cfactualities.remove_this_factuality
def remove_this_factuality(self,factuality_id): """ Removes the factuality for the given factuality identifier @type factuality_id: string @param factuality_id: the factuality identifier to be removed """ for fact in self.get_factualities(): if fact.get_id() =...
python
def remove_this_factuality(self,factuality_id): """ Removes the factuality for the given factuality identifier @type factuality_id: string @param factuality_id: the factuality identifier to be removed """ for fact in self.get_factualities(): if fact.get_id() =...
[ "def", "remove_this_factuality", "(", "self", ",", "factuality_id", ")", ":", "for", "fact", "in", "self", ".", "get_factualities", "(", ")", ":", "if", "fact", ".", "get_id", "(", ")", "==", "factuality_id", ":", "self", ".", "node", ".", "remove", "(",...
Removes the factuality for the given factuality identifier @type factuality_id: string @param factuality_id: the factuality identifier to be removed
[ "Removes", "the", "factuality", "for", "the", "given", "factuality", "identifier" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/factuality_data.py#L224-L233
train
Removes the factuality for the given factuality identifier.
cltl/KafNafParserPy
KafNafParserPy/factuality_data.py
Cfactualities.remove_factuality
def remove_factuality(self, fid): """ Removes a factuality element with a specific id from the layer """ for node_pre in self.node.findall('factuality'): if node_pre.get('id') == fid: self.node.remove(node_pre)
python
def remove_factuality(self, fid): """ Removes a factuality element with a specific id from the layer """ for node_pre in self.node.findall('factuality'): if node_pre.get('id') == fid: self.node.remove(node_pre)
[ "def", "remove_factuality", "(", "self", ",", "fid", ")", ":", "for", "node_pre", "in", "self", ".", "node", ".", "findall", "(", "'factuality'", ")", ":", "if", "node_pre", ".", "get", "(", "'id'", ")", "==", "fid", ":", "self", ".", "node", ".", ...
Removes a factuality element with a specific id from the layer
[ "Removes", "a", "factuality", "element", "with", "a", "specific", "id", "from", "the", "layer" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/factuality_data.py#L236-L242
train
Removes a factuality element with a specific id from the layer.
cltl/KafNafParserPy
KafNafParserPy/factuality_data.py
Cfactualitylayer.remove_this_factvalue
def remove_this_factvalue(self,factvalue_id): """ Removes the factvalue for the given factvalue identifier @type factvalue_id: string @param factvalue_id: the factvalue identifier to be removed """ for fact in self.get_factvalues(): if fact.get_id() == factval...
python
def remove_this_factvalue(self,factvalue_id): """ Removes the factvalue for the given factvalue identifier @type factvalue_id: string @param factvalue_id: the factvalue identifier to be removed """ for fact in self.get_factvalues(): if fact.get_id() == factval...
[ "def", "remove_this_factvalue", "(", "self", ",", "factvalue_id", ")", ":", "for", "fact", "in", "self", ".", "get_factvalues", "(", ")", ":", "if", "fact", ".", "get_id", "(", ")", "==", "factvalue_id", ":", "self", ".", "node", ".", "remove", "(", "f...
Removes the factvalue for the given factvalue identifier @type factvalue_id: string @param factvalue_id: the factvalue identifier to be removed
[ "Removes", "the", "factvalue", "for", "the", "given", "factvalue", "identifier" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/factuality_data.py#L393-L402
train
Removes the factvalue for the given factvalue identifier
sio2project/filetracker
filetracker/client/remote_data_store.py
RemoteDataStore._add_version_to_request
def _add_version_to_request(self, url, headers, version): """Adds version to either url or headers, depending on protocol.""" if self._has_capability(SERVER_REQUIRES_VERSION_HEADER): new_headers = headers.copy() new_headers['Last-Modified'] = email.utils.formatdate(version) ...
python
def _add_version_to_request(self, url, headers, version): """Adds version to either url or headers, depending on protocol.""" if self._has_capability(SERVER_REQUIRES_VERSION_HEADER): new_headers = headers.copy() new_headers['Last-Modified'] = email.utils.formatdate(version) ...
[ "def", "_add_version_to_request", "(", "self", ",", "url", ",", "headers", ",", "version", ")", ":", "if", "self", ".", "_has_capability", "(", "SERVER_REQUIRES_VERSION_HEADER", ")", ":", "new_headers", "=", "headers", ".", "copy", "(", ")", "new_headers", "["...
Adds version to either url or headers, depending on protocol.
[ "Adds", "version", "to", "either", "url", "or", "headers", "depending", "on", "protocol", "." ]
359b474850622e3d0c25ee2596d7242c02f84efb
https://github.com/sio2project/filetracker/blob/359b474850622e3d0c25ee2596d7242c02f84efb/filetracker/client/remote_data_store.py#L216-L227
train
Adds version to either url or headers depending on protocol.
sio2project/filetracker
filetracker/client/remote_data_store.py
RemoteDataStore._protocol_version
def _protocol_version(self): """Returns the protocol version that should be used. If the version wasn't established yet, asks the server what versions it supports and picks the highest one. """ if hasattr(self, '_protocol_ver'): return self._protocol_ver res...
python
def _protocol_version(self): """Returns the protocol version that should be used. If the version wasn't established yet, asks the server what versions it supports and picks the highest one. """ if hasattr(self, '_protocol_ver'): return self._protocol_ver res...
[ "def", "_protocol_version", "(", "self", ")", ":", "if", "hasattr", "(", "self", ",", "'_protocol_ver'", ")", ":", "return", "self", ".", "_protocol_ver", "response", "=", "requests", ".", "get", "(", "self", ".", "base_url", "+", "'/version/'", ")", "if",...
Returns the protocol version that should be used. If the version wasn't established yet, asks the server what versions it supports and picks the highest one.
[ "Returns", "the", "protocol", "version", "that", "should", "be", "used", "." ]
359b474850622e3d0c25ee2596d7242c02f84efb
https://github.com/sio2project/filetracker/blob/359b474850622e3d0c25ee2596d7242c02f84efb/filetracker/client/remote_data_store.py#L229-L260
train
Returns the protocol version that should be used.
sio2project/filetracker
filetracker/scripts/cachecleaner.py
CacheCleaner.run
def run(self): """Starts cleaning cache in infinite loop. """ logger.info("Starting daemon.") while True: try: self._scan_disk() do_cleaning, delete_from_index = self._analyze_file_index() if do_cleaning: sel...
python
def run(self): """Starts cleaning cache in infinite loop. """ logger.info("Starting daemon.") while True: try: self._scan_disk() do_cleaning, delete_from_index = self._analyze_file_index() if do_cleaning: sel...
[ "def", "run", "(", "self", ")", ":", "logger", ".", "info", "(", "\"Starting daemon.\"", ")", "while", "True", ":", "try", ":", "self", ".", "_scan_disk", "(", ")", "do_cleaning", ",", "delete_from_index", "=", "self", ".", "_analyze_file_index", "(", ")",...
Starts cleaning cache in infinite loop.
[ "Starts", "cleaning", "cache", "in", "infinite", "loop", "." ]
359b474850622e3d0c25ee2596d7242c02f84efb
https://github.com/sio2project/filetracker/blob/359b474850622e3d0c25ee2596d7242c02f84efb/filetracker/scripts/cachecleaner.py#L73-L87
train
Starts cleaning cache in infinite loop.
nickpandolfi/Cyther
cyther/pathway.py
normalize
def normalize(path_name, override=None): """ Prepares a path name to be worked with. Path name must not be empty. This function will return the 'normpath'ed path and the identity of the path. This function takes an optional overriding argument for the identity. ONLY PROVIDE OVERRIDE IF: 1) ...
python
def normalize(path_name, override=None): """ Prepares a path name to be worked with. Path name must not be empty. This function will return the 'normpath'ed path and the identity of the path. This function takes an optional overriding argument for the identity. ONLY PROVIDE OVERRIDE IF: 1) ...
[ "def", "normalize", "(", "path_name", ",", "override", "=", "None", ")", ":", "identity", "=", "identify", "(", "path_name", ",", "override", "=", "override", ")", "new_path_name", "=", "os", ".", "path", ".", "normpath", "(", "os", ".", "path", ".", "...
Prepares a path name to be worked with. Path name must not be empty. This function will return the 'normpath'ed path and the identity of the path. This function takes an optional overriding argument for the identity. ONLY PROVIDE OVERRIDE IF: 1) YOU AREWORKING WITH A FOLDER THAT HAS AN EXTENSION IN...
[ "Prepares", "a", "path", "name", "to", "be", "worked", "with", ".", "Path", "name", "must", "not", "be", "empty", ".", "This", "function", "will", "return", "the", "normpath", "ed", "path", "and", "the", "identity", "of", "the", "path", ".", "This", "f...
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/pathway.py#L36-L50
train
Normalizes a path name to be work with.
nickpandolfi/Cyther
cyther/pathway.py
identify
def identify(path_name, *, override=None, check_exists=True, default=ISDIR): """ Identify the type of a given path name (file or directory). If check_exists is specified to be false, then the function will not set the identity based on the path existing or not. If override is specified as either ISDIR o...
python
def identify(path_name, *, override=None, check_exists=True, default=ISDIR): """ Identify the type of a given path name (file or directory). If check_exists is specified to be false, then the function will not set the identity based on the path existing or not. If override is specified as either ISDIR o...
[ "def", "identify", "(", "path_name", ",", "*", ",", "override", "=", "None", ",", "check_exists", "=", "True", ",", "default", "=", "ISDIR", ")", ":", "head", ",", "tail", "=", "os", ".", "path", ".", "split", "(", "path_name", ")", "if", "check_exis...
Identify the type of a given path name (file or directory). If check_exists is specified to be false, then the function will not set the identity based on the path existing or not. If override is specified as either ISDIR or ISFILE, then the function will try its best to over-ride the identity to be wha...
[ "Identify", "the", "type", "of", "a", "given", "path", "name", "(", "file", "or", "directory", ")", ".", "If", "check_exists", "is", "specified", "to", "be", "false", "then", "the", "function", "will", "not", "set", "the", "identity", "based", "on", "the...
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/pathway.py#L53-L95
train
Identify the type of a given path name.
nickpandolfi/Cyther
cyther/pathway.py
join_ext
def join_ext(name, extension): """ Joins a given name with an extension. If the extension doesn't have a '.' it will add it for you """ if extension[0] == EXT: ret = name + extension else: ret = name + EXT + extension return ret
python
def join_ext(name, extension): """ Joins a given name with an extension. If the extension doesn't have a '.' it will add it for you """ if extension[0] == EXT: ret = name + extension else: ret = name + EXT + extension return ret
[ "def", "join_ext", "(", "name", ",", "extension", ")", ":", "if", "extension", "[", "0", "]", "==", "EXT", ":", "ret", "=", "name", "+", "extension", "else", ":", "ret", "=", "name", "+", "EXT", "+", "extension", "return", "ret" ]
Joins a given name with an extension. If the extension doesn't have a '.' it will add it for you
[ "Joins", "a", "given", "name", "with", "an", "extension", ".", "If", "the", "extension", "doesn", "t", "have", "a", ".", "it", "will", "add", "it", "for", "you" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/pathway.py#L98-L107
train
Joins a given name with an extension.
nickpandolfi/Cyther
cyther/pathway.py
has_ext
def has_ext(path_name, *, multiple=None, if_all_ext=False): """ Determine if the given path name has an extension """ base = os.path.basename(path_name) count = base.count(EXT) if not if_all_ext and base[0] == EXT and count != 0: count -= 1 if multiple is None: return count...
python
def has_ext(path_name, *, multiple=None, if_all_ext=False): """ Determine if the given path name has an extension """ base = os.path.basename(path_name) count = base.count(EXT) if not if_all_ext and base[0] == EXT and count != 0: count -= 1 if multiple is None: return count...
[ "def", "has_ext", "(", "path_name", ",", "*", ",", "multiple", "=", "None", ",", "if_all_ext", "=", "False", ")", ":", "base", "=", "os", ".", "path", ".", "basename", "(", "path_name", ")", "count", "=", "base", ".", "count", "(", "EXT", ")", "if"...
Determine if the given path name has an extension
[ "Determine", "if", "the", "given", "path", "name", "has", "an", "extension" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/pathway.py#L118-L133
train
Determines if the given path name has an extension.
nickpandolfi/Cyther
cyther/pathway.py
get_ext
def get_ext(path_name, *, if_all_ext=False): """ Get an extension from the given path name. If an extension cannot be found, it will return an empty string """ if has_ext(path_name): return os.path.splitext(path_name)[EXTENSION] elif if_all_ext and has_ext(path_name, if_all_ext=True): ...
python
def get_ext(path_name, *, if_all_ext=False): """ Get an extension from the given path name. If an extension cannot be found, it will return an empty string """ if has_ext(path_name): return os.path.splitext(path_name)[EXTENSION] elif if_all_ext and has_ext(path_name, if_all_ext=True): ...
[ "def", "get_ext", "(", "path_name", ",", "*", ",", "if_all_ext", "=", "False", ")", ":", "if", "has_ext", "(", "path_name", ")", ":", "return", "os", ".", "path", ".", "splitext", "(", "path_name", ")", "[", "EXTENSION", "]", "elif", "if_all_ext", "and...
Get an extension from the given path name. If an extension cannot be found, it will return an empty string
[ "Get", "an", "extension", "from", "the", "given", "path", "name", ".", "If", "an", "extension", "cannot", "be", "found", "it", "will", "return", "an", "empty", "string" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/pathway.py#L136-L146
train
Get an extension from the given path name.
nickpandolfi/Cyther
cyther/pathway.py
get_dir
def get_dir(path_name, *, greedy=False, override=None, identity=None): """ Gets the directory path of the given path name. If the argument 'greedy' is specified as True, then if the path name represents a directory itself, the function will return the whole path """ if identity is None: ...
python
def get_dir(path_name, *, greedy=False, override=None, identity=None): """ Gets the directory path of the given path name. If the argument 'greedy' is specified as True, then if the path name represents a directory itself, the function will return the whole path """ if identity is None: ...
[ "def", "get_dir", "(", "path_name", ",", "*", ",", "greedy", "=", "False", ",", "override", "=", "None", ",", "identity", "=", "None", ")", ":", "if", "identity", "is", "None", ":", "identity", "=", "identify", "(", "path_name", ",", "override", "=", ...
Gets the directory path of the given path name. If the argument 'greedy' is specified as True, then if the path name represents a directory itself, the function will return the whole path
[ "Gets", "the", "directory", "path", "of", "the", "given", "path", "name", ".", "If", "the", "argument", "greedy", "is", "specified", "as", "True", "then", "if", "the", "path", "name", "represents", "a", "directory", "itself", "the", "function", "will", "re...
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/pathway.py#L157-L171
train
Gets the directory path of the given path name.
nickpandolfi/Cyther
cyther/pathway.py
get_name
def get_name(path_name, *, ext=True, override=None, identity=None): """ Gets the name par of the path name given. By 'name' I mean the basename of a filename's path, such as 'test.o' in the path: 'C:/test/test.o' """ if identity is None: identity = identify(path_name, override=override) ...
python
def get_name(path_name, *, ext=True, override=None, identity=None): """ Gets the name par of the path name given. By 'name' I mean the basename of a filename's path, such as 'test.o' in the path: 'C:/test/test.o' """ if identity is None: identity = identify(path_name, override=override) ...
[ "def", "get_name", "(", "path_name", ",", "*", ",", "ext", "=", "True", ",", "override", "=", "None", ",", "identity", "=", "None", ")", ":", "if", "identity", "is", "None", ":", "identity", "=", "identify", "(", "path_name", ",", "override", "=", "o...
Gets the name par of the path name given. By 'name' I mean the basename of a filename's path, such as 'test.o' in the path: 'C:/test/test.o'
[ "Gets", "the", "name", "par", "of", "the", "path", "name", "given", ".", "By", "name", "I", "mean", "the", "basename", "of", "a", "filename", "s", "path", "such", "as", "test", ".", "o", "in", "the", "path", ":", "C", ":", "/", "test", "/", "test...
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/pathway.py#L181-L196
train
Get the name par of the path name given. By name I mean the basename of the file s path such as C:/test. o
nickpandolfi/Cyther
cyther/pathway.py
get_system_drives
def get_system_drives(): """ Get the available drive names on the system. Always returns a list. """ drives = [] if os.name == 'nt': import ctypes bitmask = ctypes.windll.kernel32.GetLogicalDrives() letter = ord('A') while bitmask > 0: if bitmask & 1: ...
python
def get_system_drives(): """ Get the available drive names on the system. Always returns a list. """ drives = [] if os.name == 'nt': import ctypes bitmask = ctypes.windll.kernel32.GetLogicalDrives() letter = ord('A') while bitmask > 0: if bitmask & 1: ...
[ "def", "get_system_drives", "(", ")", ":", "drives", "=", "[", "]", "if", "os", ".", "name", "==", "'nt'", ":", "import", "ctypes", "bitmask", "=", "ctypes", ".", "windll", ".", "kernel32", ".", "GetLogicalDrives", "(", ")", "letter", "=", "ord", "(", ...
Get the available drive names on the system. Always returns a list.
[ "Get", "the", "available", "drive", "names", "on", "the", "system", ".", "Always", "returns", "a", "list", "." ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/pathway.py#L206-L230
train
Get the available drive names on the system. Always returns a list.
nickpandolfi/Cyther
cyther/pathway.py
has_suffix
def has_suffix(path_name, suffix): """ Determines if path_name has a suffix of at least 'suffix' """ if isinstance(suffix, str): suffix = disintegrate(suffix) components = disintegrate(path_name) for i in range(-1, -(len(suffix) + 1), -1): if components[i] != suffix[i]: ...
python
def has_suffix(path_name, suffix): """ Determines if path_name has a suffix of at least 'suffix' """ if isinstance(suffix, str): suffix = disintegrate(suffix) components = disintegrate(path_name) for i in range(-1, -(len(suffix) + 1), -1): if components[i] != suffix[i]: ...
[ "def", "has_suffix", "(", "path_name", ",", "suffix", ")", ":", "if", "isinstance", "(", "suffix", ",", "str", ")", ":", "suffix", "=", "disintegrate", "(", "suffix", ")", "components", "=", "disintegrate", "(", "path_name", ")", "for", "i", "in", "range...
Determines if path_name has a suffix of at least 'suffix'
[ "Determines", "if", "path_name", "has", "a", "suffix", "of", "at", "least", "suffix" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/pathway.py#L233-L247
train
Determines if path_name has at least suffix of at least suffix.
nickpandolfi/Cyther
cyther/pathway.py
path
def path(path_name=None, override=None, *, root=None, name=None, ext=None, inject=None, relpath=None, reduce=False): """ Path manipulation black magic """ path_name, identity, root = _initialize(path_name, override, root, inject) new_name = _process_name(path_name, identity, name, ext) ...
python
def path(path_name=None, override=None, *, root=None, name=None, ext=None, inject=None, relpath=None, reduce=False): """ Path manipulation black magic """ path_name, identity, root = _initialize(path_name, override, root, inject) new_name = _process_name(path_name, identity, name, ext) ...
[ "def", "path", "(", "path_name", "=", "None", ",", "override", "=", "None", ",", "*", ",", "root", "=", "None", ",", "name", "=", "None", ",", "ext", "=", "None", ",", "inject", "=", "None", ",", "relpath", "=", "None", ",", "reduce", "=", "False...
Path manipulation black magic
[ "Path", "manipulation", "black", "magic" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/pathway.py#L364-L376
train
Returns a path to a node.
nickpandolfi/Cyther
cyther/pathway.py
File.path
def path(self, **kwargs): """ Returns a different object with the specified changes applied to it. This object is not changed in the process. """ new_path = path(self.getPath(), **kwargs) return File(new_path)
python
def path(self, **kwargs): """ Returns a different object with the specified changes applied to it. This object is not changed in the process. """ new_path = path(self.getPath(), **kwargs) return File(new_path)
[ "def", "path", "(", "self", ",", "*", "*", "kwargs", ")", ":", "new_path", "=", "path", "(", "self", ".", "getPath", "(", ")", ",", "*", "*", "kwargs", ")", "return", "File", "(", "new_path", ")" ]
Returns a different object with the specified changes applied to it. This object is not changed in the process.
[ "Returns", "a", "different", "object", "with", "the", "specified", "changes", "applied", "to", "it", ".", "This", "object", "is", "not", "changed", "in", "the", "process", "." ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/pathway.py#L408-L414
train
Returns a new File object with the specified path applied to it.
nickpandolfi/Cyther
cyther/pathway.py
File.isOutDated
def isOutDated(self, output_file): """ Figures out if Cyther should compile the given FileInfo object by checking the both of the modified times """ if output_file.exists(): source_time = self.getmtime() output_time = output_file.getmtime() ret...
python
def isOutDated(self, output_file): """ Figures out if Cyther should compile the given FileInfo object by checking the both of the modified times """ if output_file.exists(): source_time = self.getmtime() output_time = output_file.getmtime() ret...
[ "def", "isOutDated", "(", "self", ",", "output_file", ")", ":", "if", "output_file", ".", "exists", "(", ")", ":", "source_time", "=", "self", ".", "getmtime", "(", ")", "output_time", "=", "output_file", ".", "getmtime", "(", ")", "return", "source_time",...
Figures out if Cyther should compile the given FileInfo object by checking the both of the modified times
[ "Figures", "out", "if", "Cyther", "should", "compile", "the", "given", "FileInfo", "object", "by", "checking", "the", "both", "of", "the", "modified", "times" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/pathway.py#L416-L426
train
Checks if the given FileInfo object is out of date.
nickpandolfi/Cyther
cyther/pathway.py
File.isUpdated
def isUpdated(self): """ Figures out if the file had previously errored and hasn't been fixed since given a numerical time """ modified_time = self.getmtime() valid = modified_time > self.__stamp return valid
python
def isUpdated(self): """ Figures out if the file had previously errored and hasn't been fixed since given a numerical time """ modified_time = self.getmtime() valid = modified_time > self.__stamp return valid
[ "def", "isUpdated", "(", "self", ")", ":", "modified_time", "=", "self", ".", "getmtime", "(", ")", "valid", "=", "modified_time", ">", "self", ".", "__stamp", "return", "valid" ]
Figures out if the file had previously errored and hasn't been fixed since given a numerical time
[ "Figures", "out", "if", "the", "file", "had", "previously", "errored", "and", "hasn", "t", "been", "fixed", "since", "given", "a", "numerical", "time" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/pathway.py#L434-L441
train
Returns true if the file has been modified since given a numerical time
mjirik/imtools
imtools/qmisc.py
getVersionString
def getVersionString(): """ Function return string with version information. It is performed by use one of three procedures: git describe, file in .git dir and file __VERSION__. """ version_string = None try: version_string = subprocess.check_output(['git', 'describe']) except: ...
python
def getVersionString(): """ Function return string with version information. It is performed by use one of three procedures: git describe, file in .git dir and file __VERSION__. """ version_string = None try: version_string = subprocess.check_output(['git', 'describe']) except: ...
[ "def", "getVersionString", "(", ")", ":", "version_string", "=", "None", "try", ":", "version_string", "=", "subprocess", ".", "check_output", "(", "[", "'git'", ",", "'describe'", "]", ")", "except", ":", "logger", ".", "warning", "(", "'Command \"git describ...
Function return string with version information. It is performed by use one of three procedures: git describe, file in .git dir and file __VERSION__.
[ "Function", "return", "string", "with", "version", "information", ".", "It", "is", "performed", "by", "use", "one", "of", "three", "procedures", ":", "git", "describe", "file", "in", ".", "git", "dir", "and", "file", "__VERSION__", "." ]
eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a
https://github.com/mjirik/imtools/blob/eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a/imtools/qmisc.py#L22-L54
train
Function returns string with version information.
Unbabel/unbabel-py
unbabel/api.py
UnbabelApi.get_translations
def get_translations(self, status=None): ''' Returns the translations requested by the user ''' if status is not None: result = self.api_call('translation/?status=%s' % status) else: result = self.api_call('translation/') if result.status_code ...
python
def get_translations(self, status=None): ''' Returns the translations requested by the user ''' if status is not None: result = self.api_call('translation/?status=%s' % status) else: result = self.api_call('translation/') if result.status_code ...
[ "def", "get_translations", "(", "self", ",", "status", "=", "None", ")", ":", "if", "status", "is", "not", "None", ":", "result", "=", "self", ".", "api_call", "(", "'translation/?status=%s'", "%", "status", ")", "else", ":", "result", "=", "self", ".", ...
Returns the translations requested by the user
[ "Returns", "the", "translations", "requested", "by", "the", "user" ]
3bd6397174e184d89d2a11149d87be5d12570c64
https://github.com/Unbabel/unbabel-py/blob/3bd6397174e184d89d2a11149d87be5d12570c64/unbabel/api.py#L370-L387
train
Returns the translations requested by the user.
Unbabel/unbabel-py
unbabel/api.py
UnbabelApi.get_translation
def get_translation(self, uid): ''' Returns a translation with the given id ''' result = self.api_call('translation/{}/'.format(uid)) if result.status_code == 200: translation = Translation(**json.loads(result.content)) else: log.critical( ...
python
def get_translation(self, uid): ''' Returns a translation with the given id ''' result = self.api_call('translation/{}/'.format(uid)) if result.status_code == 200: translation = Translation(**json.loads(result.content)) else: log.critical( ...
[ "def", "get_translation", "(", "self", ",", "uid", ")", ":", "result", "=", "self", ".", "api_call", "(", "'translation/{}/'", ".", "format", "(", "uid", ")", ")", "if", "result", ".", "status_code", "==", "200", ":", "translation", "=", "Translation", "...
Returns a translation with the given id
[ "Returns", "a", "translation", "with", "the", "given", "id" ]
3bd6397174e184d89d2a11149d87be5d12570c64
https://github.com/Unbabel/unbabel-py/blob/3bd6397174e184d89d2a11149d87be5d12570c64/unbabel/api.py#L389-L402
train
Returns a translation with the given id
Unbabel/unbabel-py
unbabel/api.py
UnbabelApi.upgrade_mt_translation
def upgrade_mt_translation(self, uid, properties=None): """ :param uid: :param properties: This is suppose to be a dictionary with new properties values to be replaced on the upgraded job :return: """ api_url = self.api_url uri = 'mt_translation/{}/'.forma...
python
def upgrade_mt_translation(self, uid, properties=None): """ :param uid: :param properties: This is suppose to be a dictionary with new properties values to be replaced on the upgraded job :return: """ api_url = self.api_url uri = 'mt_translation/{}/'.forma...
[ "def", "upgrade_mt_translation", "(", "self", ",", "uid", ",", "properties", "=", "None", ")", ":", "api_url", "=", "self", ".", "api_url", "uri", "=", "'mt_translation/{}/'", ".", "format", "(", "uid", ")", "url", "=", "\"{}{}\"", ".", "format", "(", "a...
:param uid: :param properties: This is suppose to be a dictionary with new properties values to be replaced on the upgraded job :return:
[ ":", "param", "uid", ":", ":", "param", "properties", ":", "This", "is", "suppose", "to", "be", "a", "dictionary", "with", "new", "properties", "values", "to", "be", "replaced", "on", "the", "upgraded", "job", ":", "return", ":" ]
3bd6397174e184d89d2a11149d87be5d12570c64
https://github.com/Unbabel/unbabel-py/blob/3bd6397174e184d89d2a11149d87be5d12570c64/unbabel/api.py#L404-L415
train
This method is used to upgrade the MT translation for a specific resource.
Unbabel/unbabel-py
unbabel/api.py
UnbabelApi.get_language_pairs
def get_language_pairs(self, train_langs=None): ''' Returns the language pairs available on unbabel ''' if train_langs is None: result = self.api_call('language_pair/') else: result = self.api_call( 'language_pair/?train_langs={}'.forma...
python
def get_language_pairs(self, train_langs=None): ''' Returns the language pairs available on unbabel ''' if train_langs is None: result = self.api_call('language_pair/') else: result = self.api_call( 'language_pair/?train_langs={}'.forma...
[ "def", "get_language_pairs", "(", "self", ",", "train_langs", "=", "None", ")", ":", "if", "train_langs", "is", "None", ":", "result", "=", "self", ".", "api_call", "(", "'language_pair/'", ")", "else", ":", "result", "=", "self", ".", "api_call", "(", "...
Returns the language pairs available on unbabel
[ "Returns", "the", "language", "pairs", "available", "on", "unbabel" ]
3bd6397174e184d89d2a11149d87be5d12570c64
https://github.com/Unbabel/unbabel-py/blob/3bd6397174e184d89d2a11149d87be5d12570c64/unbabel/api.py#L451-L476
train
Returns the language pairs available on unbabel
Unbabel/unbabel-py
unbabel/api.py
UnbabelApi.get_tones
def get_tones(self): ''' Returns the tones available on unbabel ''' result = self.api_call('tone/') tones_json = json.loads(result.content) tones = [Tone(name=tone_json["tone"]["name"], description=tone_json["tone"]["description"]) ...
python
def get_tones(self): ''' Returns the tones available on unbabel ''' result = self.api_call('tone/') tones_json = json.loads(result.content) tones = [Tone(name=tone_json["tone"]["name"], description=tone_json["tone"]["description"]) ...
[ "def", "get_tones", "(", "self", ")", ":", "result", "=", "self", ".", "api_call", "(", "'tone/'", ")", "tones_json", "=", "json", ".", "loads", "(", "result", ".", "content", ")", "tones", "=", "[", "Tone", "(", "name", "=", "tone_json", "[", "\"ton...
Returns the tones available on unbabel
[ "Returns", "the", "tones", "available", "on", "unbabel" ]
3bd6397174e184d89d2a11149d87be5d12570c64
https://github.com/Unbabel/unbabel-py/blob/3bd6397174e184d89d2a11149d87be5d12570c64/unbabel/api.py#L478-L487
train
Returns the tones available on unbabel
Unbabel/unbabel-py
unbabel/api.py
UnbabelApi.get_topics
def get_topics(self): ''' Returns the topics available on unbabel ''' result = self.api_call('topic/') topics_json = json.loads(result.content) topics = [Topic(name=topic_json["topic"]["name"]) for topic_json in topics_json["objects"]] return...
python
def get_topics(self): ''' Returns the topics available on unbabel ''' result = self.api_call('topic/') topics_json = json.loads(result.content) topics = [Topic(name=topic_json["topic"]["name"]) for topic_json in topics_json["objects"]] return...
[ "def", "get_topics", "(", "self", ")", ":", "result", "=", "self", ".", "api_call", "(", "'topic/'", ")", "topics_json", "=", "json", ".", "loads", "(", "result", ".", "content", ")", "topics", "=", "[", "Topic", "(", "name", "=", "topic_json", "[", ...
Returns the topics available on unbabel
[ "Returns", "the", "topics", "available", "on", "unbabel" ]
3bd6397174e184d89d2a11149d87be5d12570c64
https://github.com/Unbabel/unbabel-py/blob/3bd6397174e184d89d2a11149d87be5d12570c64/unbabel/api.py#L489-L497
train
Returns the topics available on unbabel
vmonaco/pohmm
pohmm/pohmm.py
Pohmm.rand
def rand(self, unique_pstates, random_state=None): """ Randomize the POHMM parameters """ self._init_pstates(unique_pstates) self._init_random(random_state=random_state) self._compute_marginals() return self
python
def rand(self, unique_pstates, random_state=None): """ Randomize the POHMM parameters """ self._init_pstates(unique_pstates) self._init_random(random_state=random_state) self._compute_marginals() return self
[ "def", "rand", "(", "self", ",", "unique_pstates", ",", "random_state", "=", "None", ")", ":", "self", ".", "_init_pstates", "(", "unique_pstates", ")", "self", ".", "_init_random", "(", "random_state", "=", "random_state", ")", "self", ".", "_compute_marginal...
Randomize the POHMM parameters
[ "Randomize", "the", "POHMM", "parameters" ]
c00f8a62d3005a171d424549a55d46c421859ae9
https://github.com/vmonaco/pohmm/blob/c00f8a62d3005a171d424549a55d46c421859ae9/pohmm/pohmm.py#L662-L669
train
Randomize the POHMM parameters
vmonaco/pohmm
pohmm/pohmm.py
Pohmm.fit
def fit(self, obs, pstates, unique_pstates=None): """ Estimate model parameters. """ obs = [np.array(o) for o in obs] pstates = [np.array(p) for p in pstates] # List or array of observation sequences assert len(obs) == len(pstates) assert obs[0].ndim == 2...
python
def fit(self, obs, pstates, unique_pstates=None): """ Estimate model parameters. """ obs = [np.array(o) for o in obs] pstates = [np.array(p) for p in pstates] # List or array of observation sequences assert len(obs) == len(pstates) assert obs[0].ndim == 2...
[ "def", "fit", "(", "self", ",", "obs", ",", "pstates", ",", "unique_pstates", "=", "None", ")", ":", "obs", "=", "[", "np", ".", "array", "(", "o", ")", "for", "o", "in", "obs", "]", "pstates", "=", "[", "np", ".", "array", "(", "p", ")", "fo...
Estimate model parameters.
[ "Estimate", "model", "parameters", "." ]
c00f8a62d3005a171d424549a55d46c421859ae9
https://github.com/vmonaco/pohmm/blob/c00f8a62d3005a171d424549a55d46c421859ae9/pohmm/pohmm.py#L671-L731
train
Fits the model to obtain the log probability of the observation and the partial state states.
vmonaco/pohmm
pohmm/pohmm.py
Pohmm.score
def score(self, obs, pstates): """ Compute the log probability under the model. """ pstates_idx = np.array([self.e[p] for p in pstates]) framelogprob = self._compute_log_likelihood(obs, pstates_idx) logprob, _ = self._do_forward_pass(framelogprob, pstates_idx) ret...
python
def score(self, obs, pstates): """ Compute the log probability under the model. """ pstates_idx = np.array([self.e[p] for p in pstates]) framelogprob = self._compute_log_likelihood(obs, pstates_idx) logprob, _ = self._do_forward_pass(framelogprob, pstates_idx) ret...
[ "def", "score", "(", "self", ",", "obs", ",", "pstates", ")", ":", "pstates_idx", "=", "np", ".", "array", "(", "[", "self", ".", "e", "[", "p", "]", "for", "p", "in", "pstates", "]", ")", "framelogprob", "=", "self", ".", "_compute_log_likelihood", ...
Compute the log probability under the model.
[ "Compute", "the", "log", "probability", "under", "the", "model", "." ]
c00f8a62d3005a171d424549a55d46c421859ae9
https://github.com/vmonaco/pohmm/blob/c00f8a62d3005a171d424549a55d46c421859ae9/pohmm/pohmm.py#L733-L740
train
Compute the log probability under the model.
vmonaco/pohmm
pohmm/pohmm.py
Pohmm.score_events
def score_events(self, obs, pstates): """ Compute the log probability of each event under the model. """ pstates_idx = np.array([self.e[p] for p in pstates]) framelogprob = self._compute_log_likelihood(obs, pstates_idx) _, fwdlattice = self._do_forward_pass(framelogprob,...
python
def score_events(self, obs, pstates): """ Compute the log probability of each event under the model. """ pstates_idx = np.array([self.e[p] for p in pstates]) framelogprob = self._compute_log_likelihood(obs, pstates_idx) _, fwdlattice = self._do_forward_pass(framelogprob,...
[ "def", "score_events", "(", "self", ",", "obs", ",", "pstates", ")", ":", "pstates_idx", "=", "np", ".", "array", "(", "[", "self", ".", "e", "[", "p", "]", "for", "p", "in", "pstates", "]", ")", "framelogprob", "=", "self", ".", "_compute_log_likeli...
Compute the log probability of each event under the model.
[ "Compute", "the", "log", "probability", "of", "each", "event", "under", "the", "model", "." ]
c00f8a62d3005a171d424549a55d46c421859ae9
https://github.com/vmonaco/pohmm/blob/c00f8a62d3005a171d424549a55d46c421859ae9/pohmm/pohmm.py#L742-L751
train
Compute the log probability of each event under the model.
vmonaco/pohmm
pohmm/pohmm.py
Pohmm.predict
def predict(self, obs, pstates, next_pstate=None): """ Predict the next observation """ assert len(obs) == len(pstates) pstates_idx = np.array([self.e[ei] for ei in pstates]) next_pstate_idx = self.e[next_pstate] if len(obs) == 0: # No history, use th...
python
def predict(self, obs, pstates, next_pstate=None): """ Predict the next observation """ assert len(obs) == len(pstates) pstates_idx = np.array([self.e[ei] for ei in pstates]) next_pstate_idx = self.e[next_pstate] if len(obs) == 0: # No history, use th...
[ "def", "predict", "(", "self", ",", "obs", ",", "pstates", ",", "next_pstate", "=", "None", ")", ":", "assert", "len", "(", "obs", ")", "==", "len", "(", "pstates", ")", "pstates_idx", "=", "np", ".", "array", "(", "[", "self", ".", "e", "[", "ei...
Predict the next observation
[ "Predict", "the", "next", "observation" ]
c00f8a62d3005a171d424549a55d46c421859ae9
https://github.com/vmonaco/pohmm/blob/c00f8a62d3005a171d424549a55d46c421859ae9/pohmm/pohmm.py#L759-L800
train
Predict the next observation for the next observation in the given pstates.
vmonaco/pohmm
pohmm/pohmm.py
Pohmm.fit_df
def fit_df(self, dfs, pstate_col=PSTATE_COL): """ Convenience function to fit a model from a list of dataframes """ obs_cols = list(self.emission_name) obs = [df[df.columns.difference([pstate_col])][obs_cols].values for df in dfs] pstates = [df[pstate_col].values for df i...
python
def fit_df(self, dfs, pstate_col=PSTATE_COL): """ Convenience function to fit a model from a list of dataframes """ obs_cols = list(self.emission_name) obs = [df[df.columns.difference([pstate_col])][obs_cols].values for df in dfs] pstates = [df[pstate_col].values for df i...
[ "def", "fit_df", "(", "self", ",", "dfs", ",", "pstate_col", "=", "PSTATE_COL", ")", ":", "obs_cols", "=", "list", "(", "self", ".", "emission_name", ")", "obs", "=", "[", "df", "[", "df", ".", "columns", ".", "difference", "(", "[", "pstate_col", "]...
Convenience function to fit a model from a list of dataframes
[ "Convenience", "function", "to", "fit", "a", "model", "from", "a", "list", "of", "dataframes" ]
c00f8a62d3005a171d424549a55d46c421859ae9
https://github.com/vmonaco/pohmm/blob/c00f8a62d3005a171d424549a55d46c421859ae9/pohmm/pohmm.py#L876-L883
train
Convenience function to fit a model from a list of dataframes