repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
sio2project/filetracker
filetracker/servers/storage.py
FileStorage.stored_version
def stored_version(self, name): """Returns the version of file `name` or None if it doesn't exist.""" link_path = self._link_path(name) if not _path_exists(link_path): return None return _file_version(link_path)
python
def stored_version(self, name): """Returns the version of file `name` or None if it doesn't exist.""" link_path = self._link_path(name) if not _path_exists(link_path): return None return _file_version(link_path)
[ "def", "stored_version", "(", "self", ",", "name", ")", ":", "link_path", "=", "self", ".", "_link_path", "(", "name", ")", "if", "not", "_path_exists", "(", "link_path", ")", ":", "return", "None", "return", "_file_version", "(", "link_path", ")" ]
Returns the version of file `name` or None if it doesn't exist.
[ "Returns", "the", "version", "of", "file", "name", "or", "None", "if", "it", "doesn", "t", "exist", "." ]
359b474850622e3d0c25ee2596d7242c02f84efb
https://github.com/sio2project/filetracker/blob/359b474850622e3d0c25ee2596d7242c02f84efb/filetracker/servers/storage.py#L289-L294
train
sio2project/filetracker
filetracker/servers/storage.py
_InputStreamWrapper.save
def save(self, new_path=None): """Moves or creates the file with stream contents to a new location. Args: new_path: path to move to, if None a temporary file is created. """ self.saved_in_temp = new_path is None if new_path is None: fd, new_path = tempfil...
python
def save(self, new_path=None): """Moves or creates the file with stream contents to a new location. Args: new_path: path to move to, if None a temporary file is created. """ self.saved_in_temp = new_path is None if new_path is None: fd, new_path = tempfil...
[ "def", "save", "(", "self", ",", "new_path", "=", "None", ")", ":", "self", ".", "saved_in_temp", "=", "new_path", "is", "None", "if", "new_path", "is", "None", ":", "fd", ",", "new_path", "=", "tempfile", ".", "mkstemp", "(", ")", "os", ".", "close"...
Moves or creates the file with stream contents to a new location. Args: new_path: path to move to, if None a temporary file is created.
[ "Moves", "or", "creates", "the", "file", "with", "stream", "contents", "to", "a", "new", "location", "." ]
359b474850622e3d0c25ee2596d7242c02f84efb
https://github.com/sio2project/filetracker/blob/359b474850622e3d0c25ee2596d7242c02f84efb/filetracker/servers/storage.py#L353-L369
train
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.get_lps
def get_lps(self): """Iterator that returns all the lp objects from linguistic processors layers from the header @rtype: L{Clp} @return: list of lp objects """ if self.header is not None: for linguisticProcessor in self.header: for lp in linguisticProc...
python
def get_lps(self): """Iterator that returns all the lp objects from linguistic processors layers from the header @rtype: L{Clp} @return: list of lp objects """ if self.header is not None: for linguisticProcessor in self.header: for lp in linguisticProc...
[ "def", "get_lps", "(", "self", ")", ":", "if", "self", ".", "header", "is", "not", "None", ":", "for", "linguisticProcessor", "in", "self", ".", "header", ":", "for", "lp", "in", "linguisticProcessor", ":", "yield", "lp" ]
Iterator that returns all the lp objects from linguistic processors layers from the header @rtype: L{Clp} @return: list of lp objects
[ "Iterator", "that", "returns", "all", "the", "lp", "objects", "from", "linguistic", "processors", "layers", "from", "the", "header" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L404-L412
train
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.get_trees_as_list
def get_trees_as_list(self): """ Iterator that returns the constituency trees @rtype: L{Ctree} @return: iterator to all the constituency trees """ mytrees = [] if self.constituency_layer is not None: for tree in self.constituency_layer.get_trees(): ...
python
def get_trees_as_list(self): """ Iterator that returns the constituency trees @rtype: L{Ctree} @return: iterator to all the constituency trees """ mytrees = [] if self.constituency_layer is not None: for tree in self.constituency_layer.get_trees(): ...
[ "def", "get_trees_as_list", "(", "self", ")", ":", "mytrees", "=", "[", "]", "if", "self", ".", "constituency_layer", "is", "not", "None", ":", "for", "tree", "in", "self", ".", "constituency_layer", ".", "get_trees", "(", ")", ":", "mytrees", ".", "appe...
Iterator that returns the constituency trees @rtype: L{Ctree} @return: iterator to all the constituency trees
[ "Iterator", "that", "returns", "the", "constituency", "trees" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L425-L435
train
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
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", ":", "if", "self", ".", "my_constituency_extractor", "is", "None", ":", "self", ".", "my_constituency_extractor", "=", "Cconstituency_extractor"...
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
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", ":", "if", "self", ".", "my_dependency_extractor", "is", "None", ":", "self", ".", "my_dependency_extractor", "=", "Cdependency_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
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
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
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
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
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
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
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
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
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
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
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
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", ".", "add_linguis...
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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", ")", ":", "\"wait on our events\"", "with", "self", ".", "_registered", "(", "reading", ",", "not", "reading", ")", ":", "(", "self", ".", "_readable", "if", "reading", "else", "self", ".", "_writable", ")...
wait on our events
[ "wait", "on", "our", "events" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/io/files.py#L273-L279
train
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", ")", "fp", ".", "_rbuf", "=", "StringIO", "(", ")", "fp", ".", "encoding", "=", "None", ...
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
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", ")", ":", "\"return whether the file is connected to a tty or not\"", "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
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", ")", "buf", "=", "self", ".", "_rbuf", "buf", ".", "seek", "(", "0", ")", "buf", ...
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
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", ")", ":", "\"get the file descriptor's position relative to the file's beginning\"", "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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
vmonaco/pohmm
pohmm/pohmm.py
Pohmm.sample_df
def sample_df(self, pstates=None, n_obs=None, random_state=None, pstate_col=PSTATE_COL, hstate_col=HSTATE_COL): """ Convenience function to generate samples a model and create a dataframe """ try: import pandas as pd except Exception as e: raise e ...
python
def sample_df(self, pstates=None, n_obs=None, random_state=None, pstate_col=PSTATE_COL, hstate_col=HSTATE_COL): """ Convenience function to generate samples a model and create a dataframe """ try: import pandas as pd except Exception as e: raise e ...
[ "def", "sample_df", "(", "self", ",", "pstates", "=", "None", ",", "n_obs", "=", "None", ",", "random_state", "=", "None", ",", "pstate_col", "=", "PSTATE_COL", ",", "hstate_col", "=", "HSTATE_COL", ")", ":", "try", ":", "import", "pandas", "as", "pd", ...
Convenience function to generate samples a model and create a dataframe
[ "Convenience", "function", "to", "generate", "samples", "a", "model", "and", "create", "a", "dataframe" ]
c00f8a62d3005a171d424549a55d46c421859ae9
https://github.com/vmonaco/pohmm/blob/c00f8a62d3005a171d424549a55d46c421859ae9/pohmm/pohmm.py#L919-L939
train
nickpandolfi/Cyther
cyther/__main__.py
main
def main(args=None): """ Entry point for cyther-script, generated by setup.py on installation """ if args is None: args = sys.argv[1:] if not args: args = ['-h'] namespace = parser.parse_args(args) entry_function = namespace.func del namespace.func kwargs = namespac...
python
def main(args=None): """ Entry point for cyther-script, generated by setup.py on installation """ if args is None: args = sys.argv[1:] if not args: args = ['-h'] namespace = parser.parse_args(args) entry_function = namespace.func del namespace.func kwargs = namespac...
[ "def", "main", "(", "args", "=", "None", ")", ":", "if", "args", "is", "None", ":", "args", "=", "sys", ".", "argv", "[", "1", ":", "]", "if", "not", "args", ":", "args", "=", "[", "'-h'", "]", "namespace", "=", "parser", ".", "parse_args", "("...
Entry point for cyther-script, generated by setup.py on installation
[ "Entry", "point", "for", "cyther", "-", "script", "generated", "by", "setup", ".", "py", "on", "installation" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/__main__.py#L11-L25
train
marchete/django-adldap-sync
adldap_sync/management/commands/syncldap.py
Command.get_ldap_users
def get_ldap_users(self): """Retrieve user data from LDAP server.""" if (not self.conf_LDAP_SYNC_USER): return (None, None) user_keys = set(self.conf_LDAP_SYNC_USER_ATTRIBUTES.keys()) user_keys.update(self.conf_LDAP_SYNC_USER_EXTRA_ATTRIBUTES) uri_users_server, users ...
python
def get_ldap_users(self): """Retrieve user data from LDAP server.""" if (not self.conf_LDAP_SYNC_USER): return (None, None) user_keys = set(self.conf_LDAP_SYNC_USER_ATTRIBUTES.keys()) user_keys.update(self.conf_LDAP_SYNC_USER_EXTRA_ATTRIBUTES) uri_users_server, users ...
[ "def", "get_ldap_users", "(", "self", ")", ":", "if", "(", "not", "self", ".", "conf_LDAP_SYNC_USER", ")", ":", "return", "(", "None", ",", "None", ")", "user_keys", "=", "set", "(", "self", ".", "conf_LDAP_SYNC_USER_ATTRIBUTES", ".", "keys", "(", ")", "...
Retrieve user data from LDAP server.
[ "Retrieve", "user", "data", "from", "LDAP", "server", "." ]
f6be226a4fb2a433d22e95043bd656ce902f8254
https://github.com/marchete/django-adldap-sync/blob/f6be226a4fb2a433d22e95043bd656ce902f8254/adldap_sync/management/commands/syncldap.py#L290-L298
train
marchete/django-adldap-sync
adldap_sync/management/commands/syncldap.py
Command.get_ldap_groups
def get_ldap_groups(self): """Retrieve groups from LDAP server.""" if (not self.conf_LDAP_SYNC_GROUP): return (None, None) uri_groups_server, groups = self.ldap_search(self.conf_LDAP_SYNC_GROUP_FILTER, self.conf_LDAP_SYNC_GROUP_ATTRIBUTES.keys(), self.conf_LDAP_SYNC_GROUP_INCREMENTAL...
python
def get_ldap_groups(self): """Retrieve groups from LDAP server.""" if (not self.conf_LDAP_SYNC_GROUP): return (None, None) uri_groups_server, groups = self.ldap_search(self.conf_LDAP_SYNC_GROUP_FILTER, self.conf_LDAP_SYNC_GROUP_ATTRIBUTES.keys(), self.conf_LDAP_SYNC_GROUP_INCREMENTAL...
[ "def", "get_ldap_groups", "(", "self", ")", ":", "if", "(", "not", "self", ".", "conf_LDAP_SYNC_GROUP", ")", ":", "return", "(", "None", ",", "None", ")", "uri_groups_server", ",", "groups", "=", "self", ".", "ldap_search", "(", "self", ".", "conf_LDAP_SYN...
Retrieve groups from LDAP server.
[ "Retrieve", "groups", "from", "LDAP", "server", "." ]
f6be226a4fb2a433d22e95043bd656ce902f8254
https://github.com/marchete/django-adldap-sync/blob/f6be226a4fb2a433d22e95043bd656ce902f8254/adldap_sync/management/commands/syncldap.py#L558-L564
train
marchete/django-adldap-sync
adldap_sync/management/commands/syncldap.py
Command.get_ldap_user_membership
def get_ldap_user_membership(self, user_dn): """Retrieve user membership from LDAP server.""" #Escape parenthesis in DN membership_filter = self.conf_LDAP_SYNC_GROUP_MEMBERSHIP_FILTER.replace('{distinguishedName}', user_dn.replace('(', "\(").replace(')', "\)")) try: uri, grou...
python
def get_ldap_user_membership(self, user_dn): """Retrieve user membership from LDAP server.""" #Escape parenthesis in DN membership_filter = self.conf_LDAP_SYNC_GROUP_MEMBERSHIP_FILTER.replace('{distinguishedName}', user_dn.replace('(', "\(").replace(')', "\)")) try: uri, grou...
[ "def", "get_ldap_user_membership", "(", "self", ",", "user_dn", ")", ":", "membership_filter", "=", "self", ".", "conf_LDAP_SYNC_GROUP_MEMBERSHIP_FILTER", ".", "replace", "(", "'{distinguishedName}'", ",", "user_dn", ".", "replace", "(", "'('", ",", "\"\\(\"", ")", ...
Retrieve user membership from LDAP server.
[ "Retrieve", "user", "membership", "from", "LDAP", "server", "." ]
f6be226a4fb2a433d22e95043bd656ce902f8254
https://github.com/marchete/django-adldap-sync/blob/f6be226a4fb2a433d22e95043bd656ce902f8254/adldap_sync/management/commands/syncldap.py#L603-L613
train
marchete/django-adldap-sync
adldap_sync/management/commands/syncldap.py
Command.sync_ldap_user_membership
def sync_ldap_user_membership(self, user, ldap_groups): """Synchronize LDAP membership to Django membership""" groupname_field = 'name' actualGroups = user.groups.values_list('name', flat=True) user_Membership_total = len(ldap_groups) user_Membership_added = 0 user_Member...
python
def sync_ldap_user_membership(self, user, ldap_groups): """Synchronize LDAP membership to Django membership""" groupname_field = 'name' actualGroups = user.groups.values_list('name', flat=True) user_Membership_total = len(ldap_groups) user_Membership_added = 0 user_Member...
[ "def", "sync_ldap_user_membership", "(", "self", ",", "user", ",", "ldap_groups", ")", ":", "groupname_field", "=", "'name'", "actualGroups", "=", "user", ".", "groups", ".", "values_list", "(", "'name'", ",", "flat", "=", "True", ")", "user_Membership_total", ...
Synchronize LDAP membership to Django membership
[ "Synchronize", "LDAP", "membership", "to", "Django", "membership" ]
f6be226a4fb2a433d22e95043bd656ce902f8254
https://github.com/marchete/django-adldap-sync/blob/f6be226a4fb2a433d22e95043bd656ce902f8254/adldap_sync/management/commands/syncldap.py#L615-L686
train
marchete/django-adldap-sync
adldap_sync/management/commands/syncldap.py
Command.ldap_search
def ldap_search(self, filter, attributes, incremental, incremental_filter): """ Query the configured LDAP server with the provided search filter and attribute list. """ for uri in self.conf_LDAP_SYNC_BIND_URI: #Read record of this uri if (self.working_uri ...
python
def ldap_search(self, filter, attributes, incremental, incremental_filter): """ Query the configured LDAP server with the provided search filter and attribute list. """ for uri in self.conf_LDAP_SYNC_BIND_URI: #Read record of this uri if (self.working_uri ...
[ "def", "ldap_search", "(", "self", ",", "filter", ",", "attributes", ",", "incremental", ",", "incremental_filter", ")", ":", "for", "uri", "in", "self", ".", "conf_LDAP_SYNC_BIND_URI", ":", "if", "(", "self", ".", "working_uri", "==", "uri", ")", ":", "ad...
Query the configured LDAP server with the provided search filter and attribute list.
[ "Query", "the", "configured", "LDAP", "server", "with", "the", "provided", "search", "filter", "and", "attribute", "list", "." ]
f6be226a4fb2a433d22e95043bd656ce902f8254
https://github.com/marchete/django-adldap-sync/blob/f6be226a4fb2a433d22e95043bd656ce902f8254/adldap_sync/management/commands/syncldap.py#L688-L735
train
mjirik/imtools
imtools/datasets.py
sliver_reader
def sliver_reader(filename_end_mask="*[0-9].mhd", sliver_reference_dir="~/data/medical/orig/sliver07/training/", read_orig=True, read_seg=False): """ Generator for reading sliver data from directory structure. :param filename_end_mask: file selection can be controlled with this parameter :param sliver_...
python
def sliver_reader(filename_end_mask="*[0-9].mhd", sliver_reference_dir="~/data/medical/orig/sliver07/training/", read_orig=True, read_seg=False): """ Generator for reading sliver data from directory structure. :param filename_end_mask: file selection can be controlled with this parameter :param sliver_...
[ "def", "sliver_reader", "(", "filename_end_mask", "=", "\"*[0-9].mhd\"", ",", "sliver_reference_dir", "=", "\"~/data/medical/orig/sliver07/training/\"", ",", "read_orig", "=", "True", ",", "read_seg", "=", "False", ")", ":", "sliver_reference_dir", "=", "op", ".", "ex...
Generator for reading sliver data from directory structure. :param filename_end_mask: file selection can be controlled with this parameter :param sliver_reference_dir: directory with sliver .mhd and .raw files :param read_orig: read image data if is set True :param read_seg: read segmentation data if i...
[ "Generator", "for", "reading", "sliver", "data", "from", "directory", "structure", "." ]
eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a
https://github.com/mjirik/imtools/blob/eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a/imtools/datasets.py#L14-L47
train
EVEprosper/ProsperCommon
prosper/common/flask_utils.py
make_gunicorn_config
def make_gunicorn_config( _gunicorn_config_path='', ): """makes gunicorn.conf file for launching in docker Notes: https://sebest.github.io/post/protips-using-gunicorn-inside-a-docker-image/ renders gunicorn.config (python) file in running dir looks for GUNICORN_{option} in envir...
python
def make_gunicorn_config( _gunicorn_config_path='', ): """makes gunicorn.conf file for launching in docker Notes: https://sebest.github.io/post/protips-using-gunicorn-inside-a-docker-image/ renders gunicorn.config (python) file in running dir looks for GUNICORN_{option} in envir...
[ "def", "make_gunicorn_config", "(", "_gunicorn_config_path", "=", "''", ",", ")", ":", "gunicorn_py", "=", "gunicorn_file", "=", "'gunicorn.conf'", "if", "_gunicorn_config_path", ":", "gunicorn_file", "=", "_gunicorn_config_path", "with", "open", "(", "gunicorn_file", ...
makes gunicorn.conf file for launching in docker Notes: https://sebest.github.io/post/protips-using-gunicorn-inside-a-docker-image/ renders gunicorn.config (python) file in running dir looks for GUNICORN_{option} in environment vars Args: _gunicorn_config_path (str): TEST HOOK, ...
[ "makes", "gunicorn", ".", "conf", "file", "for", "launching", "in", "docker" ]
bcada3b25420099e1f204db8d55eb268e7b4dc27
https://github.com/EVEprosper/ProsperCommon/blob/bcada3b25420099e1f204db8d55eb268e7b4dc27/prosper/common/flask_utils.py#L4-L34
train
polysquare/cmake-ast
cmakeast/printer.py
_print_details
def _print_details(extra=None): """Return a function that prints node details.""" def print_node_handler(name, node, depth): """Standard printer for a node.""" line = "{0}{1} {2} ({3}:{4})".format(depth, (" " * depth), ...
python
def _print_details(extra=None): """Return a function that prints node details.""" def print_node_handler(name, node, depth): """Standard printer for a node.""" line = "{0}{1} {2} ({3}:{4})".format(depth, (" " * depth), ...
[ "def", "_print_details", "(", "extra", "=", "None", ")", ":", "def", "print_node_handler", "(", "name", ",", "node", ",", "depth", ")", ":", "line", "=", "\"{0}{1} {2} ({3}:{4})\"", ".", "format", "(", "depth", ",", "(", "\" \"", "*", "depth", ")", ",", ...
Return a function that prints node details.
[ "Return", "a", "function", "that", "prints", "node", "details", "." ]
431a32d595d76f1f8f993eb6ddcc79effbadff9d
https://github.com/polysquare/cmake-ast/blob/431a32d595d76f1f8f993eb6ddcc79effbadff9d/cmakeast/printer.py#L24-L38
train
polysquare/cmake-ast
cmakeast/printer.py
do_print
def do_print(filename): """Print the AST of filename.""" with open(filename) as cmake_file: body = ast.parse(cmake_file.read()) word_print = _print_details(lambda n: "{0} {1}".format(n.type, n.contents)) ast_visitor.recurse(...
python
def do_print(filename): """Print the AST of filename.""" with open(filename) as cmake_file: body = ast.parse(cmake_file.read()) word_print = _print_details(lambda n: "{0} {1}".format(n.type, n.contents)) ast_visitor.recurse(...
[ "def", "do_print", "(", "filename", ")", ":", "with", "open", "(", "filename", ")", "as", "cmake_file", ":", "body", "=", "ast", ".", "parse", "(", "cmake_file", ".", "read", "(", ")", ")", "word_print", "=", "_print_details", "(", "lambda", "n", ":", ...
Print the AST of filename.
[ "Print", "the", "AST", "of", "filename", "." ]
431a32d595d76f1f8f993eb6ddcc79effbadff9d
https://github.com/polysquare/cmake-ast/blob/431a32d595d76f1f8f993eb6ddcc79effbadff9d/cmakeast/printer.py#L41-L58
train