repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
thiagopbueno/pyrddl
pyrddl/parser.py
RDDLParser.p_case_list
def p_case_list(self, p): '''case_list : case_list COMMA case_def | case_def''' if len(p) == 4: p[1].append(p[3]) p[0] = p[1] elif len(p) == 2: p[0] = [p[1]]
python
def p_case_list(self, p): '''case_list : case_list COMMA case_def | case_def''' if len(p) == 4: p[1].append(p[3]) p[0] = p[1] elif len(p) == 2: p[0] = [p[1]]
[ "def", "p_case_list", "(", "self", ",", "p", ")", ":", "if", "len", "(", "p", ")", "==", "4", ":", "p", "[", "1", "]", ".", "append", "(", "p", "[", "3", "]", ")", "p", "[", "0", "]", "=", "p", "[", "1", "]", "elif", "len", "(", "p", ...
case_list : case_list COMMA case_def | case_def
[ "case_list", ":", "case_list", "COMMA", "case_def", "|", "case_def" ]
train
https://github.com/thiagopbueno/pyrddl/blob/3bcfa850b1a7532c7744358f3c6b9e0f8ab978c9/pyrddl/parser.py#L632-L639
thiagopbueno/pyrddl
pyrddl/parser.py
RDDLParser.p_case_def
def p_case_def(self, p): '''case_def : CASE term COLON expr | DEFAULT COLON expr''' if len(p) == 5: p[0] = ('case', (p[2], p[4])) elif len(p) == 4: p[0] = ('default', p[3])
python
def p_case_def(self, p): '''case_def : CASE term COLON expr | DEFAULT COLON expr''' if len(p) == 5: p[0] = ('case', (p[2], p[4])) elif len(p) == 4: p[0] = ('default', p[3])
[ "def", "p_case_def", "(", "self", ",", "p", ")", ":", "if", "len", "(", "p", ")", "==", "5", ":", "p", "[", "0", "]", "=", "(", "'case'", ",", "(", "p", "[", "2", "]", ",", "p", "[", "4", "]", ")", ")", "elif", "len", "(", "p", ")", "...
case_def : CASE term COLON expr | DEFAULT COLON expr
[ "case_def", ":", "CASE", "term", "COLON", "expr", "|", "DEFAULT", "COLON", "expr" ]
train
https://github.com/thiagopbueno/pyrddl/blob/3bcfa850b1a7532c7744358f3c6b9e0f8ab978c9/pyrddl/parser.py#L641-L647
thiagopbueno/pyrddl
pyrddl/parser.py
RDDLParser.p_lconst_case_list
def p_lconst_case_list(self, p): '''lconst_case_list : lconst COLON expr | lconst COLON OTHERWISE | lconst_case_list COMMA lconst COLON expr''' if len(p) == 4: p[0] = [('lconst', (p[1], p[3]))] elif len(p) == 6: p[1]...
python
def p_lconst_case_list(self, p): '''lconst_case_list : lconst COLON expr | lconst COLON OTHERWISE | lconst_case_list COMMA lconst COLON expr''' if len(p) == 4: p[0] = [('lconst', (p[1], p[3]))] elif len(p) == 6: p[1]...
[ "def", "p_lconst_case_list", "(", "self", ",", "p", ")", ":", "if", "len", "(", "p", ")", "==", "4", ":", "p", "[", "0", "]", "=", "[", "(", "'lconst'", ",", "(", "p", "[", "1", "]", ",", "p", "[", "3", "]", ")", ")", "]", "elif", "len", ...
lconst_case_list : lconst COLON expr | lconst COLON OTHERWISE | lconst_case_list COMMA lconst COLON expr
[ "lconst_case_list", ":", "lconst", "COLON", "expr", "|", "lconst", "COLON", "OTHERWISE", "|", "lconst_case_list", "COMMA", "lconst", "COLON", "expr" ]
train
https://github.com/thiagopbueno/pyrddl/blob/3bcfa850b1a7532c7744358f3c6b9e0f8ab978c9/pyrddl/parser.py#L649-L657
thiagopbueno/pyrddl
pyrddl/parser.py
RDDLParser.p_instance_list
def p_instance_list(self, p): '''instance_list : instance_list domain_section | instance_list nonfluents_section | instance_list objects_section | instance_list init_state_section | instance_list max_nondef_actio...
python
def p_instance_list(self, p): '''instance_list : instance_list domain_section | instance_list nonfluents_section | instance_list objects_section | instance_list init_state_section | instance_list max_nondef_actio...
[ "def", "p_instance_list", "(", "self", ",", "p", ")", ":", "if", "p", "[", "1", "]", "is", "None", ":", "p", "[", "0", "]", "=", "dict", "(", ")", "else", ":", "name", ",", "section", "=", "p", "[", "2", "]", "p", "[", "1", "]", "[", "nam...
instance_list : instance_list domain_section | instance_list nonfluents_section | instance_list objects_section | instance_list init_state_section | instance_list max_nondef_actions_section | ins...
[ "instance_list", ":", "instance_list", "domain_section", "|", "instance_list", "nonfluents_section", "|", "instance_list", "objects_section", "|", "instance_list", "init_state_section", "|", "instance_list", "max_nondef_actions_section", "|", "instance_list", "horizon_spec_sectio...
train
https://github.com/thiagopbueno/pyrddl/blob/3bcfa850b1a7532c7744358f3c6b9e0f8ab978c9/pyrddl/parser.py#L709-L723
thiagopbueno/pyrddl
pyrddl/parser.py
RDDLParser.p_horizon_spec_section
def p_horizon_spec_section(self, p): '''horizon_spec_section : HORIZON ASSIGN_EQUAL pos_int_type_or_pos_inf SEMI | HORIZON ASSIGN_EQUAL TERMINATE_WHEN LPAREN expr RPAREN''' if len(p) == 5: p[0] = ('horizon', p[3]) elif len(p) == 7: p[0] = (...
python
def p_horizon_spec_section(self, p): '''horizon_spec_section : HORIZON ASSIGN_EQUAL pos_int_type_or_pos_inf SEMI | HORIZON ASSIGN_EQUAL TERMINATE_WHEN LPAREN expr RPAREN''' if len(p) == 5: p[0] = ('horizon', p[3]) elif len(p) == 7: p[0] = (...
[ "def", "p_horizon_spec_section", "(", "self", ",", "p", ")", ":", "if", "len", "(", "p", ")", "==", "5", ":", "p", "[", "0", "]", "=", "(", "'horizon'", ",", "p", "[", "3", "]", ")", "elif", "len", "(", "p", ")", "==", "7", ":", "p", "[", ...
horizon_spec_section : HORIZON ASSIGN_EQUAL pos_int_type_or_pos_inf SEMI | HORIZON ASSIGN_EQUAL TERMINATE_WHEN LPAREN expr RPAREN
[ "horizon_spec_section", ":", "HORIZON", "ASSIGN_EQUAL", "pos_int_type_or_pos_inf", "SEMI", "|", "HORIZON", "ASSIGN_EQUAL", "TERMINATE_WHEN", "LPAREN", "expr", "RPAREN" ]
train
https://github.com/thiagopbueno/pyrddl/blob/3bcfa850b1a7532c7744358f3c6b9e0f8ab978c9/pyrddl/parser.py#L749-L756
thiagopbueno/pyrddl
pyrddl/parser.py
RDDLParser.p_nonfluent_list
def p_nonfluent_list(self, p): '''nonfluent_list : nonfluent_list domain_section | nonfluent_list objects_section | nonfluent_list init_non_fluent_section | empty''' if p[1] is None: p[0] = dict() else: ...
python
def p_nonfluent_list(self, p): '''nonfluent_list : nonfluent_list domain_section | nonfluent_list objects_section | nonfluent_list init_non_fluent_section | empty''' if p[1] is None: p[0] = dict() else: ...
[ "def", "p_nonfluent_list", "(", "self", ",", "p", ")", ":", "if", "p", "[", "1", "]", "is", "None", ":", "p", "[", "0", "]", "=", "dict", "(", ")", "else", ":", "name", ",", "section", "=", "p", "[", "2", "]", "p", "[", "1", "]", "[", "na...
nonfluent_list : nonfluent_list domain_section | nonfluent_list objects_section | nonfluent_list init_non_fluent_section | empty
[ "nonfluent_list", ":", "nonfluent_list", "domain_section", "|", "nonfluent_list", "objects_section", "|", "nonfluent_list", "init_non_fluent_section", "|", "empty" ]
train
https://github.com/thiagopbueno/pyrddl/blob/3bcfa850b1a7532c7744358f3c6b9e0f8ab978c9/pyrddl/parser.py#L768-L778
thiagopbueno/pyrddl
pyrddl/parser.py
RDDLParser.p_objects_list
def p_objects_list(self, p): '''objects_list : objects_list objects_def | objects_def | empty''' if len(p) == 3: p[1].append(p[2]) p[0] = p[1] elif len(p) == 2: p[0] = [p[1]]
python
def p_objects_list(self, p): '''objects_list : objects_list objects_def | objects_def | empty''' if len(p) == 3: p[1].append(p[2]) p[0] = p[1] elif len(p) == 2: p[0] = [p[1]]
[ "def", "p_objects_list", "(", "self", ",", "p", ")", ":", "if", "len", "(", "p", ")", "==", "3", ":", "p", "[", "1", "]", ".", "append", "(", "p", "[", "2", "]", ")", "p", "[", "0", "]", "=", "p", "[", "1", "]", "elif", "len", "(", "p",...
objects_list : objects_list objects_def | objects_def | empty
[ "objects_list", ":", "objects_list", "objects_def", "|", "objects_def", "|", "empty" ]
train
https://github.com/thiagopbueno/pyrddl/blob/3bcfa850b1a7532c7744358f3c6b9e0f8ab978c9/pyrddl/parser.py#L785-L793
thiagopbueno/pyrddl
pyrddl/parser.py
RDDLParser.p_object_const_list
def p_object_const_list(self, p): '''object_const_list : object_const_list COMMA IDENT | IDENT''' if len(p) == 4: p[1].append(p[3]) p[0] = p[1] elif len(p) == 2: p[0] = [p[1]]
python
def p_object_const_list(self, p): '''object_const_list : object_const_list COMMA IDENT | IDENT''' if len(p) == 4: p[1].append(p[3]) p[0] = p[1] elif len(p) == 2: p[0] = [p[1]]
[ "def", "p_object_const_list", "(", "self", ",", "p", ")", ":", "if", "len", "(", "p", ")", "==", "4", ":", "p", "[", "1", "]", ".", "append", "(", "p", "[", "3", "]", ")", "p", "[", "0", "]", "=", "p", "[", "1", "]", "elif", "len", "(", ...
object_const_list : object_const_list COMMA IDENT | IDENT
[ "object_const_list", ":", "object_const_list", "COMMA", "IDENT", "|", "IDENT" ]
train
https://github.com/thiagopbueno/pyrddl/blob/3bcfa850b1a7532c7744358f3c6b9e0f8ab978c9/pyrddl/parser.py#L799-L806
thiagopbueno/pyrddl
pyrddl/parser.py
RDDLParser.p_pvar_inst_list
def p_pvar_inst_list(self, p): '''pvar_inst_list : pvar_inst_list pvar_inst_def | pvar_inst_def''' if len(p) == 3: p[1].append(p[2]) p[0] = p[1] elif len(p) == 2: p[0] = [p[1]]
python
def p_pvar_inst_list(self, p): '''pvar_inst_list : pvar_inst_list pvar_inst_def | pvar_inst_def''' if len(p) == 3: p[1].append(p[2]) p[0] = p[1] elif len(p) == 2: p[0] = [p[1]]
[ "def", "p_pvar_inst_list", "(", "self", ",", "p", ")", ":", "if", "len", "(", "p", ")", "==", "3", ":", "p", "[", "1", "]", ".", "append", "(", "p", "[", "2", "]", ")", "p", "[", "0", "]", "=", "p", "[", "1", "]", "elif", "len", "(", "p...
pvar_inst_list : pvar_inst_list pvar_inst_def | pvar_inst_def
[ "pvar_inst_list", ":", "pvar_inst_list", "pvar_inst_def", "|", "pvar_inst_def" ]
train
https://github.com/thiagopbueno/pyrddl/blob/3bcfa850b1a7532c7744358f3c6b9e0f8ab978c9/pyrddl/parser.py#L808-L815
thiagopbueno/pyrddl
pyrddl/parser.py
RDDLParser.p_pvar_inst_def
def p_pvar_inst_def(self, p): '''pvar_inst_def : IDENT LPAREN lconst_list RPAREN SEMI | IDENT SEMI | NOT IDENT LPAREN lconst_list RPAREN SEMI | NOT IDENT SEMI | IDENT LPAREN lconst_list RPAREN ASSIGN_EQUAL range_...
python
def p_pvar_inst_def(self, p): '''pvar_inst_def : IDENT LPAREN lconst_list RPAREN SEMI | IDENT SEMI | NOT IDENT LPAREN lconst_list RPAREN SEMI | NOT IDENT SEMI | IDENT LPAREN lconst_list RPAREN ASSIGN_EQUAL range_...
[ "def", "p_pvar_inst_def", "(", "self", ",", "p", ")", ":", "if", "len", "(", "p", ")", "==", "6", ":", "p", "[", "0", "]", "=", "(", "(", "p", "[", "1", "]", ",", "p", "[", "3", "]", ")", ",", "True", ")", "elif", "len", "(", "p", ")", ...
pvar_inst_def : IDENT LPAREN lconst_list RPAREN SEMI | IDENT SEMI | NOT IDENT LPAREN lconst_list RPAREN SEMI | NOT IDENT SEMI | IDENT LPAREN lconst_list RPAREN ASSIGN_EQUAL range_const SEMI | IDE...
[ "pvar_inst_def", ":", "IDENT", "LPAREN", "lconst_list", "RPAREN", "SEMI", "|", "IDENT", "SEMI", "|", "NOT", "IDENT", "LPAREN", "lconst_list", "RPAREN", "SEMI", "|", "NOT", "IDENT", "SEMI", "|", "IDENT", "LPAREN", "lconst_list", "RPAREN", "ASSIGN_EQUAL", "range_c...
train
https://github.com/thiagopbueno/pyrddl/blob/3bcfa850b1a7532c7744358f3c6b9e0f8ab978c9/pyrddl/parser.py#L817-L835
thiagopbueno/pyrddl
pyrddl/parser.py
RDDLParser.p_lconst_list
def p_lconst_list(self, p): '''lconst_list : lconst_list COMMA lconst | lconst''' if len(p) == 4: p[1].append(p[3]) p[0] = p[1] elif len(p) == 2: p[0] = [p[1]]
python
def p_lconst_list(self, p): '''lconst_list : lconst_list COMMA lconst | lconst''' if len(p) == 4: p[1].append(p[3]) p[0] = p[1] elif len(p) == 2: p[0] = [p[1]]
[ "def", "p_lconst_list", "(", "self", ",", "p", ")", ":", "if", "len", "(", "p", ")", "==", "4", ":", "p", "[", "1", "]", ".", "append", "(", "p", "[", "3", "]", ")", "p", "[", "0", "]", "=", "p", "[", "1", "]", "elif", "len", "(", "p", ...
lconst_list : lconst_list COMMA lconst | lconst
[ "lconst_list", ":", "lconst_list", "COMMA", "lconst", "|", "lconst" ]
train
https://github.com/thiagopbueno/pyrddl/blob/3bcfa850b1a7532c7744358f3c6b9e0f8ab978c9/pyrddl/parser.py#L837-L844
thiagopbueno/pyrddl
pyrddl/parser.py
RDDLParser.p_string_list
def p_string_list(self, p): '''string_list : string_list COMMA IDENT | IDENT | empty''' if p[1] is None: p[0] = [] elif len(p) == 4: p[1].append(p[3]) p[0] = p[1] elif len(p) == 2: p[0] = [p[1]]
python
def p_string_list(self, p): '''string_list : string_list COMMA IDENT | IDENT | empty''' if p[1] is None: p[0] = [] elif len(p) == 4: p[1].append(p[3]) p[0] = p[1] elif len(p) == 2: p[0] = [p[1]]
[ "def", "p_string_list", "(", "self", ",", "p", ")", ":", "if", "p", "[", "1", "]", "is", "None", ":", "p", "[", "0", "]", "=", "[", "]", "elif", "len", "(", "p", ")", "==", "4", ":", "p", "[", "1", "]", ".", "append", "(", "p", "[", "3"...
string_list : string_list COMMA IDENT | IDENT | empty
[ "string_list", ":", "string_list", "COMMA", "IDENT", "|", "IDENT", "|", "empty" ]
train
https://github.com/thiagopbueno/pyrddl/blob/3bcfa850b1a7532c7744358f3c6b9e0f8ab978c9/pyrddl/parser.py#L846-L856
tek/proteome
integration/unite_spec.py
UniteSpec.selectable_delete
def selectable_delete(self) -> Expectation: ''' Remove two projects by selecting them via `<space>` and pressing `d` ''' self.cmd_sync('ProAdd! tpe2/dep') self._count(2) self.cmd_sync('Projects') self.cmd_sync('call feedkeys("\\<space>\\<space>d")') return...
python
def selectable_delete(self) -> Expectation: ''' Remove two projects by selecting them via `<space>` and pressing `d` ''' self.cmd_sync('ProAdd! tpe2/dep') self._count(2) self.cmd_sync('Projects') self.cmd_sync('call feedkeys("\\<space>\\<space>d")') return...
[ "def", "selectable_delete", "(", "self", ")", "->", "Expectation", ":", "self", ".", "cmd_sync", "(", "'ProAdd! tpe2/dep'", ")", "self", ".", "_count", "(", "2", ")", "self", ".", "cmd_sync", "(", "'Projects'", ")", "self", ".", "cmd_sync", "(", "'call fee...
Remove two projects by selecting them via `<space>` and pressing `d`
[ "Remove", "two", "projects", "by", "selecting", "them", "via", "<space", ">", "and", "pressing", "d" ]
train
https://github.com/tek/proteome/blob/b4fea6ca633a5b9ff56eaaf2507028fc6ff078b9/integration/unite_spec.py#L103-L111
photo/openphoto-python
trovebox/objects/tag.py
Tag.delete
def delete(self, **kwds): """ Endpoint: /tag/<id>/delete.json Deletes this tag. Returns True if successful. Raises a TroveboxError if not. """ result = self._client.tag.delete(self, **kwds) self._delete_fields() return result
python
def delete(self, **kwds): """ Endpoint: /tag/<id>/delete.json Deletes this tag. Returns True if successful. Raises a TroveboxError if not. """ result = self._client.tag.delete(self, **kwds) self._delete_fields() return result
[ "def", "delete", "(", "self", ",", "*", "*", "kwds", ")", ":", "result", "=", "self", ".", "_client", ".", "tag", ".", "delete", "(", "self", ",", "*", "*", "kwds", ")", "self", ".", "_delete_fields", "(", ")", "return", "result" ]
Endpoint: /tag/<id>/delete.json Deletes this tag. Returns True if successful. Raises a TroveboxError if not.
[ "Endpoint", ":", "/", "tag", "/", "<id", ">", "/", "delete", ".", "json" ]
train
https://github.com/photo/openphoto-python/blob/209a1da27c8d8c88dbcf4ea6c6f57031ea1bc44b/trovebox/objects/tag.py#L10-L20
photo/openphoto-python
trovebox/objects/tag.py
Tag.update
def update(self, **kwds): """ Endpoint: /tag/<id>/update.json Updates this tag with the specified parameters. Returns the updated tag object. """ result = self._client.tag.update(self, **kwds) self._replace_fields(result.get_fields())
python
def update(self, **kwds): """ Endpoint: /tag/<id>/update.json Updates this tag with the specified parameters. Returns the updated tag object. """ result = self._client.tag.update(self, **kwds) self._replace_fields(result.get_fields())
[ "def", "update", "(", "self", ",", "*", "*", "kwds", ")", ":", "result", "=", "self", ".", "_client", ".", "tag", ".", "update", "(", "self", ",", "*", "*", "kwds", ")", "self", ".", "_replace_fields", "(", "result", ".", "get_fields", "(", ")", ...
Endpoint: /tag/<id>/update.json Updates this tag with the specified parameters. Returns the updated tag object.
[ "Endpoint", ":", "/", "tag", "/", "<id", ">", "/", "update", ".", "json" ]
train
https://github.com/photo/openphoto-python/blob/209a1da27c8d8c88dbcf4ea6c6f57031ea1bc44b/trovebox/objects/tag.py#L22-L30
sebdah/password-generator
password_generator.py
generate
def generate(count=1, length=12, chars=ALPHNUM): """ Generate password Kwargs: count (int):: How many passwords should be returned? length (int):: How many characters should the password contain allowed_chars (str):: Characters Returns: S...
python
def generate(count=1, length=12, chars=ALPHNUM): """ Generate password Kwargs: count (int):: How many passwords should be returned? length (int):: How many characters should the password contain allowed_chars (str):: Characters Returns: S...
[ "def", "generate", "(", "count", "=", "1", ",", "length", "=", "12", ",", "chars", "=", "ALPHNUM", ")", ":", "if", "count", "==", "1", ":", "return", "''", ".", "join", "(", "sample", "(", "chars", ",", "length", ")", ")", "passwords", "=", "[", ...
Generate password Kwargs: count (int):: How many passwords should be returned? length (int):: How many characters should the password contain allowed_chars (str):: Characters Returns: String with the password. If count > 1 then the return val...
[ "Generate", "password" ]
train
https://github.com/sebdah/password-generator/blob/273b2c4639be622130cbc9bcbf668670be47de84/password_generator.py#L28-L51
ryanpetrello/cleaver
cleaver/base.py
Cleaver.identity
def identity(self): """ A unique identifier for the current visitor. """ if hasattr(self._identity, 'get_identity'): return self._identity.get_identity(self._environ) return self._identity(self._environ)
python
def identity(self): """ A unique identifier for the current visitor. """ if hasattr(self._identity, 'get_identity'): return self._identity.get_identity(self._environ) return self._identity(self._environ)
[ "def", "identity", "(", "self", ")", ":", "if", "hasattr", "(", "self", ".", "_identity", ",", "'get_identity'", ")", ":", "return", "self", ".", "_identity", ".", "get_identity", "(", "self", ".", "_environ", ")", "return", "self", ".", "_identity", "("...
A unique identifier for the current visitor.
[ "A", "unique", "identifier", "for", "the", "current", "visitor", "." ]
train
https://github.com/ryanpetrello/cleaver/blob/0ef266e1a0603c6d414df4b9926ce2a59844db35/cleaver/base.py#L54-L60
ryanpetrello/cleaver
cleaver/base.py
Cleaver.split
def split(self, experiment_name, *variants): """ Used to split and track user experience amongst one or more variants. :param experiment_name a unique string name for the experiment :param *variants can take many forms, depending on usage. Variants should be provided as arb...
python
def split(self, experiment_name, *variants): """ Used to split and track user experience amongst one or more variants. :param experiment_name a unique string name for the experiment :param *variants can take many forms, depending on usage. Variants should be provided as arb...
[ "def", "split", "(", "self", ",", "experiment_name", ",", "*", "variants", ")", ":", "# Perform some minimal type checking", "if", "not", "isinstance", "(", "experiment_name", ",", "string_types", ")", ":", "raise", "RuntimeError", "(", "'Invalid experiment name: %s m...
Used to split and track user experience amongst one or more variants. :param experiment_name a unique string name for the experiment :param *variants can take many forms, depending on usage. Variants should be provided as arbitrary tuples in the format ('unique_string_label', a...
[ "Used", "to", "split", "and", "track", "user", "experience", "amongst", "one", "or", "more", "variants", "." ]
train
https://github.com/ryanpetrello/cleaver/blob/0ef266e1a0603c6d414df4b9926ce2a59844db35/cleaver/base.py#L66-L132
ryanpetrello/cleaver
cleaver/base.py
Cleaver.score
def score(self, experiment_name): """ Used to mark the current user's experiment variant as "converted" e.g., "Suzy, who was shown the large button, just signed up." Conversions will *only* be marked for visitors who have been verified as humans (to avoid skewing reports with r...
python
def score(self, experiment_name): """ Used to mark the current user's experiment variant as "converted" e.g., "Suzy, who was shown the large button, just signed up." Conversions will *only* be marked for visitors who have been verified as humans (to avoid skewing reports with r...
[ "def", "score", "(", "self", ",", "experiment_name", ")", ":", "if", "self", ".", "_backend", ".", "get_variant", "(", "self", ".", "identity", ",", "experiment_name", ")", "and", "self", ".", "human", "is", "True", ":", "self", ".", "_backend", ".", "...
Used to mark the current user's experiment variant as "converted" e.g., "Suzy, who was shown the large button, just signed up." Conversions will *only* be marked for visitors who have been verified as humans (to avoid skewing reports with requests from bots and web crawlers). ...
[ "Used", "to", "mark", "the", "current", "user", "s", "experiment", "variant", "as", "converted", "e", ".", "g", "." ]
train
https://github.com/ryanpetrello/cleaver/blob/0ef266e1a0603c6d414df4b9926ce2a59844db35/cleaver/base.py#L134-L151
ilblackdragon/django-misc
misc/templatetags/misc_tags.py
find_element
def find_element(list, index, index2=1): """ When you have list like: a = [(0, 10), (1, 20), (2, 30)] and you need to get value from tuple with first value == index Usage: {% find_element 1 %} will return 20 """ for x in list: if x[0] == index: return x[index2] ...
python
def find_element(list, index, index2=1): """ When you have list like: a = [(0, 10), (1, 20), (2, 30)] and you need to get value from tuple with first value == index Usage: {% find_element 1 %} will return 20 """ for x in list: if x[0] == index: return x[index2] ...
[ "def", "find_element", "(", "list", ",", "index", ",", "index2", "=", "1", ")", ":", "for", "x", "in", "list", ":", "if", "x", "[", "0", "]", "==", "index", ":", "return", "x", "[", "index2", "]", "return", "None" ]
When you have list like: a = [(0, 10), (1, 20), (2, 30)] and you need to get value from tuple with first value == index Usage: {% find_element 1 %} will return 20
[ "When", "you", "have", "list", "like", ":", "a", "=", "[", "(", "0", "10", ")", "(", "1", "20", ")", "(", "2", "30", ")", "]", "and", "you", "need", "to", "get", "value", "from", "tuple", "with", "first", "value", "==", "index", "Usage", ":", ...
train
https://github.com/ilblackdragon/django-misc/blob/0accd2dc97de656a1c9e275be81e817f78a2eb9d/misc/templatetags/misc_tags.py#L27-L36
ilblackdragon/django-misc
misc/templatetags/misc_tags.py
get_dict
def get_dict(parser, token): """ Call {% get_dict dict key default_key %} or {% get_dict dict key %} Return value from dict of key element. If there are no key in get_dict it returns default_key (or '') Return value will be in parameter 'value' """ bits = token.contents.split(' ') ...
python
def get_dict(parser, token): """ Call {% get_dict dict key default_key %} or {% get_dict dict key %} Return value from dict of key element. If there are no key in get_dict it returns default_key (or '') Return value will be in parameter 'value' """ bits = token.contents.split(' ') ...
[ "def", "get_dict", "(", "parser", ",", "token", ")", ":", "bits", "=", "token", ".", "contents", ".", "split", "(", "' '", ")", "return", "GetDict", "(", "bits", "[", "1", "]", ",", "bits", "[", "2", "]", ",", "(", "(", "len", "(", "bits", ")",...
Call {% get_dict dict key default_key %} or {% get_dict dict key %} Return value from dict of key element. If there are no key in get_dict it returns default_key (or '') Return value will be in parameter 'value'
[ "Call", "{", "%", "get_dict", "dict", "key", "default_key", "%", "}", "or", "{", "%", "get_dict", "dict", "key", "%", "}", "Return", "value", "from", "dict", "of", "key", "element", ".", "If", "there", "are", "no", "key", "in", "get_dict", "it", "ret...
train
https://github.com/ilblackdragon/django-misc/blob/0accd2dc97de656a1c9e275be81e817f78a2eb9d/misc/templatetags/misc_tags.py#L39-L46
ilblackdragon/django-misc
misc/templatetags/misc_tags.py
filter
def filter(parser, token): """ Filter tag for Query sets. Use with set tag =) {% set filter posts status 0 drafts %} """ bits = token.contents.split(' ') return FilterTag(bits[1], bits[2:])
python
def filter(parser, token): """ Filter tag for Query sets. Use with set tag =) {% set filter posts status 0 drafts %} """ bits = token.contents.split(' ') return FilterTag(bits[1], bits[2:])
[ "def", "filter", "(", "parser", ",", "token", ")", ":", "bits", "=", "token", ".", "contents", ".", "split", "(", "' '", ")", "return", "FilterTag", "(", "bits", "[", "1", "]", ",", "bits", "[", "2", ":", "]", ")" ]
Filter tag for Query sets. Use with set tag =) {% set filter posts status 0 drafts %}
[ "Filter", "tag", "for", "Query", "sets", ".", "Use", "with", "set", "tag", "=", ")", "{", "%", "set", "filter", "posts", "status", "0", "drafts", "%", "}" ]
train
https://github.com/ilblackdragon/django-misc/blob/0accd2dc97de656a1c9e275be81e817f78a2eb9d/misc/templatetags/misc_tags.py#L166-L172
ilblackdragon/django-misc
misc/templatetags/misc_tags.py
CallableVariable._resolve_lookup
def _resolve_lookup(self, context): """ Performs resolution of a real variable (i.e. not a literal) against the given context. As indicated by the method's name, this method is an implementation detail and shouldn't be called by external code. Use Variable.resolve() inst...
python
def _resolve_lookup(self, context): """ Performs resolution of a real variable (i.e. not a literal) against the given context. As indicated by the method's name, this method is an implementation detail and shouldn't be called by external code. Use Variable.resolve() inst...
[ "def", "_resolve_lookup", "(", "self", ",", "context", ")", ":", "current", "=", "context", "try", ":", "# catch-all for silent variable failures", "for", "bit", "in", "self", ".", "lookups", ":", "if", "callable", "(", "current", ")", ":", "if", "getattr", ...
Performs resolution of a real variable (i.e. not a literal) against the given context. As indicated by the method's name, this method is an implementation detail and shouldn't be called by external code. Use Variable.resolve() instead.
[ "Performs", "resolution", "of", "a", "real", "variable", "(", "i", ".", "e", ".", "not", "a", "literal", ")", "against", "the", "given", "context", "." ]
train
https://github.com/ilblackdragon/django-misc/blob/0accd2dc97de656a1c9e275be81e817f78a2eb9d/misc/templatetags/misc_tags.py#L77-L119
radjkarl/fancyWidgets
DUMP/pyqtgraphBased/Dock.py
Dock.setWidget
def setWidget(self, widget, index=0, row=None, col=0, rowspan=1, colspan=1): """ Add new widget inside dock, remove old one if existent """ if row is None: row = self.currentRow self.currentRow = max(row + 1, self.currentRow) if index > len(s...
python
def setWidget(self, widget, index=0, row=None, col=0, rowspan=1, colspan=1): """ Add new widget inside dock, remove old one if existent """ if row is None: row = self.currentRow self.currentRow = max(row + 1, self.currentRow) if index > len(s...
[ "def", "setWidget", "(", "self", ",", "widget", ",", "index", "=", "0", ",", "row", "=", "None", ",", "col", "=", "0", ",", "rowspan", "=", "1", ",", "colspan", "=", "1", ")", ":", "if", "row", "is", "None", ":", "row", "=", "self", ".", "cur...
Add new widget inside dock, remove old one if existent
[ "Add", "new", "widget", "inside", "dock", "remove", "old", "one", "if", "existent" ]
train
https://github.com/radjkarl/fancyWidgets/blob/ffe0d5747c5296c78575f0e0909af915a4a5698f/DUMP/pyqtgraphBased/Dock.py#L68-L83
eyeseast/python-tablefu
table_fu/formatting.py
_saferound
def _saferound(value, decimal_places): """ Rounds a float value off to the desired precision """ try: f = float(value) except ValueError: return '' format = '%%.%df' % decimal_places return format % f
python
def _saferound(value, decimal_places): """ Rounds a float value off to the desired precision """ try: f = float(value) except ValueError: return '' format = '%%.%df' % decimal_places return format % f
[ "def", "_saferound", "(", "value", ",", "decimal_places", ")", ":", "try", ":", "f", "=", "float", "(", "value", ")", "except", "ValueError", ":", "return", "''", "format", "=", "'%%.%df'", "%", "decimal_places", "return", "format", "%", "f" ]
Rounds a float value off to the desired precision
[ "Rounds", "a", "float", "value", "off", "to", "the", "desired", "precision" ]
train
https://github.com/eyeseast/python-tablefu/blob/d8761c1f87e3f89d9b89b0b6b9283fc4738b6676/table_fu/formatting.py#L10-L19
eyeseast/python-tablefu
table_fu/formatting.py
ap_state
def ap_state(value, failure_string=None): """ Converts a state's name, postal abbreviation or FIPS to A.P. style. Example usage: >> ap_state("California") 'Calif.' """ try: return statestyle.get(value).ap except: if failure_string: retur...
python
def ap_state(value, failure_string=None): """ Converts a state's name, postal abbreviation or FIPS to A.P. style. Example usage: >> ap_state("California") 'Calif.' """ try: return statestyle.get(value).ap except: if failure_string: retur...
[ "def", "ap_state", "(", "value", ",", "failure_string", "=", "None", ")", ":", "try", ":", "return", "statestyle", ".", "get", "(", "value", ")", ".", "ap", "except", ":", "if", "failure_string", ":", "return", "failure_string", "else", ":", "return", "v...
Converts a state's name, postal abbreviation or FIPS to A.P. style. Example usage: >> ap_state("California") 'Calif.'
[ "Converts", "a", "state", "s", "name", "postal", "abbreviation", "or", "FIPS", "to", "A", ".", "P", ".", "style", ".", "Example", "usage", ":", ">>", "ap_state", "(", "California", ")", "Calif", "." ]
train
https://github.com/eyeseast/python-tablefu/blob/d8761c1f87e3f89d9b89b0b6b9283fc4738b6676/table_fu/formatting.py#L22-L38
eyeseast/python-tablefu
table_fu/formatting.py
capfirst
def capfirst(value, failure_string='N/A'): """ Capitalizes the first character of the value. If the submitted value isn't a string, returns the `failure_string` keyword argument. Cribbs from django's default filter set """ try: value = value.lower() return value[0]....
python
def capfirst(value, failure_string='N/A'): """ Capitalizes the first character of the value. If the submitted value isn't a string, returns the `failure_string` keyword argument. Cribbs from django's default filter set """ try: value = value.lower() return value[0]....
[ "def", "capfirst", "(", "value", ",", "failure_string", "=", "'N/A'", ")", ":", "try", ":", "value", "=", "value", ".", "lower", "(", ")", "return", "value", "[", "0", "]", ".", "upper", "(", ")", "+", "value", "[", "1", ":", "]", "except", ":", ...
Capitalizes the first character of the value. If the submitted value isn't a string, returns the `failure_string` keyword argument. Cribbs from django's default filter set
[ "Capitalizes", "the", "first", "character", "of", "the", "value", ".", "If", "the", "submitted", "value", "isn", "t", "a", "string", "returns", "the", "failure_string", "keyword", "argument", ".", "Cribbs", "from", "django", "s", "default", "filter", "set" ]
train
https://github.com/eyeseast/python-tablefu/blob/d8761c1f87e3f89d9b89b0b6b9283fc4738b6676/table_fu/formatting.py#L41-L54
eyeseast/python-tablefu
table_fu/formatting.py
dollar_signs
def dollar_signs(value, failure_string='N/A'): """ Converts an integer into the corresponding number of dollar sign symbols. If the submitted value isn't a string, returns the `failure_string` keyword argument. Meant to emulate the illustration of price range on Yelp. """ try: ...
python
def dollar_signs(value, failure_string='N/A'): """ Converts an integer into the corresponding number of dollar sign symbols. If the submitted value isn't a string, returns the `failure_string` keyword argument. Meant to emulate the illustration of price range on Yelp. """ try: ...
[ "def", "dollar_signs", "(", "value", ",", "failure_string", "=", "'N/A'", ")", ":", "try", ":", "count", "=", "int", "(", "value", ")", "except", "ValueError", ":", "return", "failure_string", "string", "=", "''", "for", "i", "in", "range", "(", "0", "...
Converts an integer into the corresponding number of dollar sign symbols. If the submitted value isn't a string, returns the `failure_string` keyword argument. Meant to emulate the illustration of price range on Yelp.
[ "Converts", "an", "integer", "into", "the", "corresponding", "number", "of", "dollar", "sign", "symbols", ".", "If", "the", "submitted", "value", "isn", "t", "a", "string", "returns", "the", "failure_string", "keyword", "argument", ".", "Meant", "to", "emulate...
train
https://github.com/eyeseast/python-tablefu/blob/d8761c1f87e3f89d9b89b0b6b9283fc4738b6676/table_fu/formatting.py#L61-L77
eyeseast/python-tablefu
table_fu/formatting.py
image
def image(value, width='', height=''): """ Accepts a URL and returns an HTML image tag ready to be displayed. Optionally, you can set the height and width with keyword arguments. """ style = "" if width: style += "width:%s" % width if height: style += "height:%s" % heigh...
python
def image(value, width='', height=''): """ Accepts a URL and returns an HTML image tag ready to be displayed. Optionally, you can set the height and width with keyword arguments. """ style = "" if width: style += "width:%s" % width if height: style += "height:%s" % heigh...
[ "def", "image", "(", "value", ",", "width", "=", "''", ",", "height", "=", "''", ")", ":", "style", "=", "\"\"", "if", "width", ":", "style", "+=", "\"width:%s\"", "%", "width", "if", "height", ":", "style", "+=", "\"height:%s\"", "%", "height", "dat...
Accepts a URL and returns an HTML image tag ready to be displayed. Optionally, you can set the height and width with keyword arguments.
[ "Accepts", "a", "URL", "and", "returns", "an", "HTML", "image", "tag", "ready", "to", "be", "displayed", ".", "Optionally", "you", "can", "set", "the", "height", "and", "width", "with", "keyword", "arguments", "." ]
train
https://github.com/eyeseast/python-tablefu/blob/d8761c1f87e3f89d9b89b0b6b9283fc4738b6676/table_fu/formatting.py#L80-L92
eyeseast/python-tablefu
table_fu/formatting.py
intcomma
def intcomma(value): """ Borrowed from django.contrib.humanize Converts an integer to a string containing commas every three digits. For example, 3000 becomes '3,000' and 45000 becomes '45,000'. """ orig = str(value) new = re.sub("^(-?\d+)(\d{3})", '\g<1>,\g<2>', orig) if orig == ne...
python
def intcomma(value): """ Borrowed from django.contrib.humanize Converts an integer to a string containing commas every three digits. For example, 3000 becomes '3,000' and 45000 becomes '45,000'. """ orig = str(value) new = re.sub("^(-?\d+)(\d{3})", '\g<1>,\g<2>', orig) if orig == ne...
[ "def", "intcomma", "(", "value", ")", ":", "orig", "=", "str", "(", "value", ")", "new", "=", "re", ".", "sub", "(", "\"^(-?\\d+)(\\d{3})\"", ",", "'\\g<1>,\\g<2>'", ",", "orig", ")", "if", "orig", "==", "new", ":", "return", "new", "else", ":", "ret...
Borrowed from django.contrib.humanize Converts an integer to a string containing commas every three digits. For example, 3000 becomes '3,000' and 45000 becomes '45,000'.
[ "Borrowed", "from", "django", ".", "contrib", ".", "humanize", "Converts", "an", "integer", "to", "a", "string", "containing", "commas", "every", "three", "digits", ".", "For", "example", "3000", "becomes", "3", "000", "and", "45000", "becomes", "45", "000",...
train
https://github.com/eyeseast/python-tablefu/blob/d8761c1f87e3f89d9b89b0b6b9283fc4738b6676/table_fu/formatting.py#L102-L114
eyeseast/python-tablefu
table_fu/formatting.py
percentage
def percentage(value, decimal_places=1, multiply=True, failure_string='N/A'): """ Converts a floating point value into a percentage value. Number of decimal places set by the `decimal_places` kwarg. Default is one. By default the number is multiplied by 100. You can prevent it from doing t...
python
def percentage(value, decimal_places=1, multiply=True, failure_string='N/A'): """ Converts a floating point value into a percentage value. Number of decimal places set by the `decimal_places` kwarg. Default is one. By default the number is multiplied by 100. You can prevent it from doing t...
[ "def", "percentage", "(", "value", ",", "decimal_places", "=", "1", ",", "multiply", "=", "True", ",", "failure_string", "=", "'N/A'", ")", ":", "try", ":", "value", "=", "float", "(", "value", ")", "except", "ValueError", ":", "return", "failure_string", ...
Converts a floating point value into a percentage value. Number of decimal places set by the `decimal_places` kwarg. Default is one. By default the number is multiplied by 100. You can prevent it from doing that by setting the `multiply` keyword argument to False. If the submitted value i...
[ "Converts", "a", "floating", "point", "value", "into", "a", "percentage", "value", ".", "Number", "of", "decimal", "places", "set", "by", "the", "decimal_places", "kwarg", ".", "Default", "is", "one", ".", "By", "default", "the", "number", "is", "multiplied"...
train
https://github.com/eyeseast/python-tablefu/blob/d8761c1f87e3f89d9b89b0b6b9283fc4738b6676/table_fu/formatting.py#L117-L135
eyeseast/python-tablefu
table_fu/formatting.py
percent_change
def percent_change(value, decimal_places=1, multiply=True, failure_string='N/A'): """ Converts a floating point value into a percentage change value. Number of decimal places set by the `precision` kwarg. Default is one. Non-floats are assumed to be zero division errors and are presented as ...
python
def percent_change(value, decimal_places=1, multiply=True, failure_string='N/A'): """ Converts a floating point value into a percentage change value. Number of decimal places set by the `precision` kwarg. Default is one. Non-floats are assumed to be zero division errors and are presented as ...
[ "def", "percent_change", "(", "value", ",", "decimal_places", "=", "1", ",", "multiply", "=", "True", ",", "failure_string", "=", "'N/A'", ")", ":", "try", ":", "f", "=", "float", "(", "value", ")", "if", "multiply", ":", "f", "=", "f", "*", "100", ...
Converts a floating point value into a percentage change value. Number of decimal places set by the `precision` kwarg. Default is one. Non-floats are assumed to be zero division errors and are presented as 'N/A' in the output. By default the number is multiplied by 100. You can prevent it...
[ "Converts", "a", "floating", "point", "value", "into", "a", "percentage", "change", "value", ".", "Number", "of", "decimal", "places", "set", "by", "the", "precision", "kwarg", ".", "Default", "is", "one", ".", "Non", "-", "floats", "are", "assumed", "to",...
train
https://github.com/eyeseast/python-tablefu/blob/d8761c1f87e3f89d9b89b0b6b9283fc4738b6676/table_fu/formatting.py#L138-L160
eyeseast/python-tablefu
table_fu/formatting.py
ratio
def ratio(value, decimal_places=0, failure_string='N/A'): """ Converts a floating point value a X:1 ratio. Number of decimal places set by the `precision` kwarg. Default is one. """ try: f = float(value) except ValueError: return failure_string return _saferound(f, decim...
python
def ratio(value, decimal_places=0, failure_string='N/A'): """ Converts a floating point value a X:1 ratio. Number of decimal places set by the `precision` kwarg. Default is one. """ try: f = float(value) except ValueError: return failure_string return _saferound(f, decim...
[ "def", "ratio", "(", "value", ",", "decimal_places", "=", "0", ",", "failure_string", "=", "'N/A'", ")", ":", "try", ":", "f", "=", "float", "(", "value", ")", "except", "ValueError", ":", "return", "failure_string", "return", "_saferound", "(", "f", ","...
Converts a floating point value a X:1 ratio. Number of decimal places set by the `precision` kwarg. Default is one.
[ "Converts", "a", "floating", "point", "value", "a", "X", ":", "1", "ratio", ".", "Number", "of", "decimal", "places", "set", "by", "the", "precision", "kwarg", ".", "Default", "is", "one", "." ]
train
https://github.com/eyeseast/python-tablefu/blob/d8761c1f87e3f89d9b89b0b6b9283fc4738b6676/table_fu/formatting.py#L163-L173
eyeseast/python-tablefu
table_fu/formatting.py
title
def title(value, failure_string='N/A'): """ Converts a string into titlecase. Lifted from Django. """ try: value = value.lower() t = re.sub("([a-z])'([A-Z])", lambda m: m.group(0).lower(), value.title()) result = re.sub("\d([A-Z])", lambda m: m.group(0).lower(), t) ...
python
def title(value, failure_string='N/A'): """ Converts a string into titlecase. Lifted from Django. """ try: value = value.lower() t = re.sub("([a-z])'([A-Z])", lambda m: m.group(0).lower(), value.title()) result = re.sub("\d([A-Z])", lambda m: m.group(0).lower(), t) ...
[ "def", "title", "(", "value", ",", "failure_string", "=", "'N/A'", ")", ":", "try", ":", "value", "=", "value", ".", "lower", "(", ")", "t", "=", "re", ".", "sub", "(", "\"([a-z])'([A-Z])\"", ",", "lambda", "m", ":", "m", ".", "group", "(", "0", ...
Converts a string into titlecase. Lifted from Django.
[ "Converts", "a", "string", "into", "titlecase", ".", "Lifted", "from", "Django", "." ]
train
https://github.com/eyeseast/python-tablefu/blob/d8761c1f87e3f89d9b89b0b6b9283fc4738b6676/table_fu/formatting.py#L210-L224
radujica/baloo
baloo/core/strings.py
StringMethods.get
def get(self, i): """Extract i'th character of each element. Parameters ---------- i : int Returns ------- Series """ check_type(i, int) return _series_str_result(self, weld_str_get, i=i)
python
def get(self, i): """Extract i'th character of each element. Parameters ---------- i : int Returns ------- Series """ check_type(i, int) return _series_str_result(self, weld_str_get, i=i)
[ "def", "get", "(", "self", ",", "i", ")", ":", "check_type", "(", "i", ",", "int", ")", "return", "_series_str_result", "(", "self", ",", "weld_str_get", ",", "i", "=", "i", ")" ]
Extract i'th character of each element. Parameters ---------- i : int Returns ------- Series
[ "Extract", "i", "th", "character", "of", "each", "element", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/core/strings.py#L42-L56
radujica/baloo
baloo/core/strings.py
StringMethods.slice
def slice(self, start=None, stop=None, step=None): """Slice substrings from each element. Note that negative step is currently not supported. Parameters ---------- start : int stop : int step : int Returns ------- Series """ ...
python
def slice(self, start=None, stop=None, step=None): """Slice substrings from each element. Note that negative step is currently not supported. Parameters ---------- start : int stop : int step : int Returns ------- Series """ ...
[ "def", "slice", "(", "self", ",", "start", "=", "None", ",", "stop", "=", "None", ",", "step", "=", "None", ")", ":", "check_type", "(", "start", ",", "int", ")", "check_type", "(", "stop", ",", "int", ")", "check_type", "(", "step", ",", "int", ...
Slice substrings from each element. Note that negative step is currently not supported. Parameters ---------- start : int stop : int step : int Returns ------- Series
[ "Slice", "substrings", "from", "each", "element", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/core/strings.py#L70-L93
radujica/baloo
baloo/core/strings.py
StringMethods.contains
def contains(self, pat): """Test if pat is included within elements. Parameters ---------- pat : str Returns ------- Series """ check_type(pat, str) return _series_bool_result(self, weld_str_contains, pat=pat)
python
def contains(self, pat): """Test if pat is included within elements. Parameters ---------- pat : str Returns ------- Series """ check_type(pat, str) return _series_bool_result(self, weld_str_contains, pat=pat)
[ "def", "contains", "(", "self", ",", "pat", ")", ":", "check_type", "(", "pat", ",", "str", ")", "return", "_series_bool_result", "(", "self", ",", "weld_str_contains", ",", "pat", "=", "pat", ")" ]
Test if pat is included within elements. Parameters ---------- pat : str Returns ------- Series
[ "Test", "if", "pat", "is", "included", "within", "elements", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/core/strings.py#L95-L109
radujica/baloo
baloo/core/strings.py
StringMethods.startswith
def startswith(self, pat): """Test if elements start with pat. Parameters ---------- pat : str Returns ------- Series """ check_type(pat, str) return _series_bool_result(self, weld_str_startswith, pat=pat)
python
def startswith(self, pat): """Test if elements start with pat. Parameters ---------- pat : str Returns ------- Series """ check_type(pat, str) return _series_bool_result(self, weld_str_startswith, pat=pat)
[ "def", "startswith", "(", "self", ",", "pat", ")", ":", "check_type", "(", "pat", ",", "str", ")", "return", "_series_bool_result", "(", "self", ",", "weld_str_startswith", ",", "pat", "=", "pat", ")" ]
Test if elements start with pat. Parameters ---------- pat : str Returns ------- Series
[ "Test", "if", "elements", "start", "with", "pat", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/core/strings.py#L111-L125
radujica/baloo
baloo/core/strings.py
StringMethods.endswith
def endswith(self, pat): """Test if elements end with pat. Parameters ---------- pat : str Returns ------- Series """ check_type(pat, str) return _series_bool_result(self, weld_str_endswith, pat=pat)
python
def endswith(self, pat): """Test if elements end with pat. Parameters ---------- pat : str Returns ------- Series """ check_type(pat, str) return _series_bool_result(self, weld_str_endswith, pat=pat)
[ "def", "endswith", "(", "self", ",", "pat", ")", ":", "check_type", "(", "pat", ",", "str", ")", "return", "_series_bool_result", "(", "self", ",", "weld_str_endswith", ",", "pat", "=", "pat", ")" ]
Test if elements end with pat. Parameters ---------- pat : str Returns ------- Series
[ "Test", "if", "elements", "end", "with", "pat", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/core/strings.py#L127-L141
radujica/baloo
baloo/core/strings.py
StringMethods.find
def find(self, sub, start=0, end=None): """Test if elements contain substring. Parameters ---------- sub : str start : int, optional Index to start searching from. end : int, optional Index to stop searching from. Returns ------- ...
python
def find(self, sub, start=0, end=None): """Test if elements contain substring. Parameters ---------- sub : str start : int, optional Index to start searching from. end : int, optional Index to stop searching from. Returns ------- ...
[ "def", "find", "(", "self", ",", "sub", ",", "start", "=", "0", ",", "end", "=", "None", ")", ":", "check_type", "(", "sub", ",", "str", ")", "check_type", "(", "start", ",", "int", ")", "check_type", "(", "end", ",", "int", ")", "if", "end", "...
Test if elements contain substring. Parameters ---------- sub : str start : int, optional Index to start searching from. end : int, optional Index to stop searching from. Returns ------- Series
[ "Test", "if", "elements", "contain", "substring", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/core/strings.py#L143-L169
radujica/baloo
baloo/core/strings.py
StringMethods.replace
def replace(self, pat, rep): """Replace first occurrence of pat with rep in each element. Parameters ---------- pat : str rep : str Returns ------- Series """ check_type(pat, str) check_type(rep, str) return _series_str_...
python
def replace(self, pat, rep): """Replace first occurrence of pat with rep in each element. Parameters ---------- pat : str rep : str Returns ------- Series """ check_type(pat, str) check_type(rep, str) return _series_str_...
[ "def", "replace", "(", "self", ",", "pat", ",", "rep", ")", ":", "check_type", "(", "pat", ",", "str", ")", "check_type", "(", "rep", ",", "str", ")", "return", "_series_str_result", "(", "self", ",", "weld_str_replace", ",", "pat", "=", "pat", ",", ...
Replace first occurrence of pat with rep in each element. Parameters ---------- pat : str rep : str Returns ------- Series
[ "Replace", "first", "occurrence", "of", "pat", "with", "rep", "in", "each", "element", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/core/strings.py#L172-L188
radujica/baloo
baloo/core/strings.py
StringMethods.split
def split(self, pat, side='left'): """Split once each element from the left and select a side to return. Note this is unlike pandas split in that it essentially combines the split with a select. Parameters ---------- pat : str side : {'left', 'right'} Which ...
python
def split(self, pat, side='left'): """Split once each element from the left and select a side to return. Note this is unlike pandas split in that it essentially combines the split with a select. Parameters ---------- pat : str side : {'left', 'right'} Which ...
[ "def", "split", "(", "self", ",", "pat", ",", "side", "=", "'left'", ")", ":", "check_type", "(", "pat", ",", "str", ")", "check_type", "(", "side", ",", "str", ")", "# don't want this made with the object", "_split_mapping", "=", "{", "'left'", ":", "0", ...
Split once each element from the left and select a side to return. Note this is unlike pandas split in that it essentially combines the split with a select. Parameters ---------- pat : str side : {'left', 'right'} Which side of the split to select and return in each...
[ "Split", "once", "each", "element", "from", "the", "left", "and", "select", "a", "side", "to", "return", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/core/strings.py#L191-L219
ilblackdragon/django-misc
misc/admin.py
admin_tagify
def admin_tagify(short_description=None, allow_tags=True): """ Decorator that add short_description and allow_tags to ModelAdmin list_display function. Example: class AlbumAdmin(admin.ModelAdmin): ...
python
def admin_tagify(short_description=None, allow_tags=True): """ Decorator that add short_description and allow_tags to ModelAdmin list_display function. Example: class AlbumAdmin(admin.ModelAdmin): ...
[ "def", "admin_tagify", "(", "short_description", "=", "None", ",", "allow_tags", "=", "True", ")", ":", "def", "tagify", "(", "func", ")", ":", "func", ".", "allow_tags", "=", "bool", "(", "allow_tags", ")", "if", "short_description", ":", "func", ".", "...
Decorator that add short_description and allow_tags to ModelAdmin list_display function. Example: class AlbumAdmin(admin.ModelAdmin): list_display = ['title', 'year',...
[ "Decorator", "that", "add", "short_description", "and", "allow_tags", "to", "ModelAdmin", "list_display", "function", "." ]
train
https://github.com/ilblackdragon/django-misc/blob/0accd2dc97de656a1c9e275be81e817f78a2eb9d/misc/admin.py#L4-L23
ilblackdragon/django-misc
misc/admin.py
foreign_field_func
def foreign_field_func(field_name, short_description=None, admin_order_field=None): """ Allow to use ForeignKey field attributes at list_display in a simple way. Example: from misc.admin import foreign_field_func as ff class SongAdmin(admin.ModelAdmin): ...
python
def foreign_field_func(field_name, short_description=None, admin_order_field=None): """ Allow to use ForeignKey field attributes at list_display in a simple way. Example: from misc.admin import foreign_field_func as ff class SongAdmin(admin.ModelAdmin): ...
[ "def", "foreign_field_func", "(", "field_name", ",", "short_description", "=", "None", ",", "admin_order_field", "=", "None", ")", ":", "def", "accessor", "(", "obj", ")", ":", "val", "=", "obj", "for", "part", "in", "field_name", ".", "split", "(", "'__'"...
Allow to use ForeignKey field attributes at list_display in a simple way. Example: from misc.admin import foreign_field_func as ff class SongAdmin(admin.ModelAdmin): ...
[ "Allow", "to", "use", "ForeignKey", "field", "attributes", "at", "list_display", "in", "a", "simple", "way", "." ]
train
https://github.com/ilblackdragon/django-misc/blob/0accd2dc97de656a1c9e275be81e817f78a2eb9d/misc/admin.py#L26-L52
ilblackdragon/django-misc
misc/admin.py
SoftDeleteAdmin.queryset
def queryset(self, request): """Returns a Queryset of all model instances that can be edited by the admin site. This is used by changelist_view.""" query_set = self.model._default_manager.all_with_deleted() ordering = self.ordering or () if ordering: query_set = quer...
python
def queryset(self, request): """Returns a Queryset of all model instances that can be edited by the admin site. This is used by changelist_view.""" query_set = self.model._default_manager.all_with_deleted() ordering = self.ordering or () if ordering: query_set = quer...
[ "def", "queryset", "(", "self", ",", "request", ")", ":", "query_set", "=", "self", ".", "model", ".", "_default_manager", ".", "all_with_deleted", "(", ")", "ordering", "=", "self", ".", "ordering", "or", "(", ")", "if", "ordering", ":", "query_set", "=...
Returns a Queryset of all model instances that can be edited by the admin site. This is used by changelist_view.
[ "Returns", "a", "Queryset", "of", "all", "model", "instances", "that", "can", "be", "edited", "by", "the", "admin", "site", ".", "This", "is", "used", "by", "changelist_view", "." ]
train
https://github.com/ilblackdragon/django-misc/blob/0accd2dc97de656a1c9e275be81e817f78a2eb9d/misc/admin.py#L99-L106
benpryke/PyNewtonMath
pynewtonmath/core.py
send_request
def send_request (operation, expression): """ Send an HTTP GET request to the newton API operation: one of the API endpoints expression: the str for the given endpoint to evaluate """ base = 'https://newton.now.sh' url = '%s/%s/%s' % (base, operation, urllib.parse.quote(expression)) ...
python
def send_request (operation, expression): """ Send an HTTP GET request to the newton API operation: one of the API endpoints expression: the str for the given endpoint to evaluate """ base = 'https://newton.now.sh' url = '%s/%s/%s' % (base, operation, urllib.parse.quote(expression)) ...
[ "def", "send_request", "(", "operation", ",", "expression", ")", ":", "base", "=", "'https://newton.now.sh'", "url", "=", "'%s/%s/%s'", "%", "(", "base", ",", "operation", ",", "urllib", ".", "parse", ".", "quote", "(", "expression", ")", ")", "with", "url...
Send an HTTP GET request to the newton API operation: one of the API endpoints expression: the str for the given endpoint to evaluate
[ "Send", "an", "HTTP", "GET", "request", "to", "the", "newton", "API", "operation", ":", "one", "of", "the", "API", "endpoints", "expression", ":", "the", "str", "for", "the", "given", "endpoint", "to", "evaluate" ]
train
https://github.com/benpryke/PyNewtonMath/blob/9ef7de1fcaa5fe9be66dbf517715defe7a8a8abd/pynewtonmath/core.py#L12-L23
benpryke/PyNewtonMath
pynewtonmath/core.py
handle_response
def handle_response (response): """ Handle a response from the newton API """ response = json.loads(response.read()) # Was the expression valid? if 'error' in response: raise ValueError(response['error']) else: # Some of the strings returned can be parsed to integer...
python
def handle_response (response): """ Handle a response from the newton API """ response = json.loads(response.read()) # Was the expression valid? if 'error' in response: raise ValueError(response['error']) else: # Some of the strings returned can be parsed to integer...
[ "def", "handle_response", "(", "response", ")", ":", "response", "=", "json", ".", "loads", "(", "response", ".", "read", "(", ")", ")", "# Was the expression valid?", "if", "'error'", "in", "response", ":", "raise", "ValueError", "(", "response", "[", "'err...
Handle a response from the newton API
[ "Handle", "a", "response", "from", "the", "newton", "API" ]
train
https://github.com/benpryke/PyNewtonMath/blob/9ef7de1fcaa5fe9be66dbf517715defe7a8a8abd/pynewtonmath/core.py#L26-L45
benpryke/PyNewtonMath
pynewtonmath/core.py
expose_endpoints
def expose_endpoints (module, *args): """ Expose methods to the given module for each API endpoint """ for op in args: # Capture the closure state def create_method (o): return lambda exp: send_request(o, exp) setattr(sys.modules[__name__], op, create_me...
python
def expose_endpoints (module, *args): """ Expose methods to the given module for each API endpoint """ for op in args: # Capture the closure state def create_method (o): return lambda exp: send_request(o, exp) setattr(sys.modules[__name__], op, create_me...
[ "def", "expose_endpoints", "(", "module", ",", "*", "args", ")", ":", "for", "op", "in", "args", ":", "# Capture the closure state", "def", "create_method", "(", "o", ")", ":", "return", "lambda", "exp", ":", "send_request", "(", "o", ",", "exp", ")", "s...
Expose methods to the given module for each API endpoint
[ "Expose", "methods", "to", "the", "given", "module", "for", "each", "API", "endpoint" ]
train
https://github.com/benpryke/PyNewtonMath/blob/9ef7de1fcaa5fe9be66dbf517715defe7a8a8abd/pynewtonmath/core.py#L48-L59
photo/openphoto-python
trovebox/auth.py
get_config_path
def get_config_path(config_file): """ Given the name of a config file, returns the full path """ config_path = os.getenv('XDG_CONFIG_HOME') if not config_path: config_path = os.path.join(os.getenv('HOME'), ".config") if not config_file: config_file = "default" return os.path....
python
def get_config_path(config_file): """ Given the name of a config file, returns the full path """ config_path = os.getenv('XDG_CONFIG_HOME') if not config_path: config_path = os.path.join(os.getenv('HOME'), ".config") if not config_file: config_file = "default" return os.path....
[ "def", "get_config_path", "(", "config_file", ")", ":", "config_path", "=", "os", ".", "getenv", "(", "'XDG_CONFIG_HOME'", ")", "if", "not", "config_path", ":", "config_path", "=", "os", ".", "path", ".", "join", "(", "os", ".", "getenv", "(", "'HOME'", ...
Given the name of a config file, returns the full path
[ "Given", "the", "name", "of", "a", "config", "file", "returns", "the", "full", "path" ]
train
https://github.com/photo/openphoto-python/blob/209a1da27c8d8c88dbcf4ea6c6f57031ea1bc44b/trovebox/auth.py#L36-L45
photo/openphoto-python
trovebox/auth.py
read_config
def read_config(config_path): """ Loads config data from the specified file path. If config_file doesn't exist, returns an empty authentication config for localhost. """ section = "DUMMY" defaults = {'host': 'localhost', 'consumerKey': '', 'consumerSecret': '', ...
python
def read_config(config_path): """ Loads config data from the specified file path. If config_file doesn't exist, returns an empty authentication config for localhost. """ section = "DUMMY" defaults = {'host': 'localhost', 'consumerKey': '', 'consumerSecret': '', ...
[ "def", "read_config", "(", "config_path", ")", ":", "section", "=", "\"DUMMY\"", "defaults", "=", "{", "'host'", ":", "'localhost'", ",", "'consumerKey'", ":", "''", ",", "'consumerSecret'", ":", "''", ",", "'token'", ":", "''", ",", "'tokenSecret'", ":", ...
Loads config data from the specified file path. If config_file doesn't exist, returns an empty authentication config for localhost.
[ "Loads", "config", "data", "from", "the", "specified", "file", "path", ".", "If", "config_file", "doesn", "t", "exist", "returns", "an", "empty", "authentication", "config", "for", "localhost", "." ]
train
https://github.com/photo/openphoto-python/blob/209a1da27c8d8c88dbcf4ea6c6f57031ea1bc44b/trovebox/auth.py#L47-L86
thiagopbueno/pyrddl
pyrddl/expr.py
Expression.etype
def etype(self) -> Tuple[str, str]: '''Returns the expression's type.''' if self._expr[0] in ['number', 'boolean']: return ('constant', str(type(self._expr[1]))) elif self._expr[0] == 'pvar_expr': return ('pvar', self._expr[1][0]) elif self._expr[0] == 'randomvar'...
python
def etype(self) -> Tuple[str, str]: '''Returns the expression's type.''' if self._expr[0] in ['number', 'boolean']: return ('constant', str(type(self._expr[1]))) elif self._expr[0] == 'pvar_expr': return ('pvar', self._expr[1][0]) elif self._expr[0] == 'randomvar'...
[ "def", "etype", "(", "self", ")", "->", "Tuple", "[", "str", ",", "str", "]", ":", "if", "self", ".", "_expr", "[", "0", "]", "in", "[", "'number'", ",", "'boolean'", "]", ":", "return", "(", "'constant'", ",", "str", "(", "type", "(", "self", ...
Returns the expression's type.
[ "Returns", "the", "expression", "s", "type", "." ]
train
https://github.com/thiagopbueno/pyrddl/blob/3bcfa850b1a7532c7744358f3c6b9e0f8ab978c9/pyrddl/expr.py#L41-L74
thiagopbueno/pyrddl
pyrddl/expr.py
Expression.args
def args(self) -> Union[Value, Sequence[ExprArg]]: '''Returns the expression's arguments.''' if self._expr[0] in ['number', 'boolean']: return self._expr[1] elif self._expr[0] == 'pvar_expr': return self._expr[1] elif self._expr[0] == 'randomvar': retu...
python
def args(self) -> Union[Value, Sequence[ExprArg]]: '''Returns the expression's arguments.''' if self._expr[0] in ['number', 'boolean']: return self._expr[1] elif self._expr[0] == 'pvar_expr': return self._expr[1] elif self._expr[0] == 'randomvar': retu...
[ "def", "args", "(", "self", ")", "->", "Union", "[", "Value", ",", "Sequence", "[", "ExprArg", "]", "]", ":", "if", "self", ".", "_expr", "[", "0", "]", "in", "[", "'number'", ",", "'boolean'", "]", ":", "return", "self", ".", "_expr", "[", "1", ...
Returns the expression's arguments.
[ "Returns", "the", "expression", "s", "arguments", "." ]
train
https://github.com/thiagopbueno/pyrddl/blob/3bcfa850b1a7532c7744358f3c6b9e0f8ab978c9/pyrddl/expr.py#L77-L98
thiagopbueno/pyrddl
pyrddl/expr.py
Expression.name
def name(self) -> str: '''Returns the name of pvariable. Returns: Name of pvariable. Raises: ValueError: If not a pvariable expression. ''' if not self.is_pvariable_expression(): raise ValueError('Expression is not a pvariable.') retu...
python
def name(self) -> str: '''Returns the name of pvariable. Returns: Name of pvariable. Raises: ValueError: If not a pvariable expression. ''' if not self.is_pvariable_expression(): raise ValueError('Expression is not a pvariable.') retu...
[ "def", "name", "(", "self", ")", "->", "str", ":", "if", "not", "self", ".", "is_pvariable_expression", "(", ")", ":", "raise", "ValueError", "(", "'Expression is not a pvariable.'", ")", "return", "self", ".", "_pvar_to_name", "(", "self", ".", "args", ")" ...
Returns the name of pvariable. Returns: Name of pvariable. Raises: ValueError: If not a pvariable expression.
[ "Returns", "the", "name", "of", "pvariable", "." ]
train
https://github.com/thiagopbueno/pyrddl/blob/3bcfa850b1a7532c7744358f3c6b9e0f8ab978c9/pyrddl/expr.py#L109-L120
thiagopbueno/pyrddl
pyrddl/expr.py
Expression.__expr_str
def __expr_str(cls, expr, level): '''Returns string representing the expression.''' ident = ' ' * level * 4 if isinstance(expr, tuple): return '{}{}'.format(ident, str(expr)) if expr.etype[0] in ['pvar', 'constant']: return '{}Expression(etype={}, args={})'.form...
python
def __expr_str(cls, expr, level): '''Returns string representing the expression.''' ident = ' ' * level * 4 if isinstance(expr, tuple): return '{}{}'.format(ident, str(expr)) if expr.etype[0] in ['pvar', 'constant']: return '{}Expression(etype={}, args={})'.form...
[ "def", "__expr_str", "(", "cls", ",", "expr", ",", "level", ")", ":", "ident", "=", "' '", "*", "level", "*", "4", "if", "isinstance", "(", "expr", ",", "tuple", ")", ":", "return", "'{}{}'", ".", "format", "(", "ident", ",", "str", "(", "expr", ...
Returns string representing the expression.
[ "Returns", "string", "representing", "the", "expression", "." ]
train
https://github.com/thiagopbueno/pyrddl/blob/3bcfa850b1a7532c7744358f3c6b9e0f8ab978c9/pyrddl/expr.py#L141-L156
thiagopbueno/pyrddl
pyrddl/expr.py
Expression.__get_scope
def __get_scope(cls, expr: Union['Expression', Tuple]) -> Set[str]: '''Returns the set of fluents in the expression's scope. Args: expr: Expression object or nested tuple of Expressions. Returns: The set of fluents in the expression's scope. ''' ...
python
def __get_scope(cls, expr: Union['Expression', Tuple]) -> Set[str]: '''Returns the set of fluents in the expression's scope. Args: expr: Expression object or nested tuple of Expressions. Returns: The set of fluents in the expression's scope. ''' ...
[ "def", "__get_scope", "(", "cls", ",", "expr", ":", "Union", "[", "'Expression'", ",", "Tuple", "]", ")", "->", "Set", "[", "str", "]", ":", "scope", "=", "set", "(", ")", "for", "i", ",", "atom", "in", "enumerate", "(", "expr", ")", ":", "if", ...
Returns the set of fluents in the expression's scope. Args: expr: Expression object or nested tuple of Expressions. Returns: The set of fluents in the expression's scope.
[ "Returns", "the", "set", "of", "fluents", "in", "the", "expression", "s", "scope", "." ]
train
https://github.com/thiagopbueno/pyrddl/blob/3bcfa850b1a7532c7744358f3c6b9e0f8ab978c9/pyrddl/expr.py#L168-L190
thiagopbueno/pyrddl
pyrddl/expr.py
Expression._pvar_to_name
def _pvar_to_name(cls, pvar_expr): '''Returns the name of pvariable. Returns: Name of pvariable. ''' functor = pvar_expr[0] arity = len(pvar_expr[1]) if pvar_expr[1] is not None else 0 return '{}/{}'.format(functor, arity)
python
def _pvar_to_name(cls, pvar_expr): '''Returns the name of pvariable. Returns: Name of pvariable. ''' functor = pvar_expr[0] arity = len(pvar_expr[1]) if pvar_expr[1] is not None else 0 return '{}/{}'.format(functor, arity)
[ "def", "_pvar_to_name", "(", "cls", ",", "pvar_expr", ")", ":", "functor", "=", "pvar_expr", "[", "0", "]", "arity", "=", "len", "(", "pvar_expr", "[", "1", "]", ")", "if", "pvar_expr", "[", "1", "]", "is", "not", "None", "else", "0", "return", "'{...
Returns the name of pvariable. Returns: Name of pvariable.
[ "Returns", "the", "name", "of", "pvariable", "." ]
train
https://github.com/thiagopbueno/pyrddl/blob/3bcfa850b1a7532c7744358f3c6b9e0f8ab978c9/pyrddl/expr.py#L193-L201
tomi77/django-extra-tools
django_extra_tools/wsgi_request.py
get_client_ip
def get_client_ip(request): """ Get the client IP from the request """ # set the default value of the ip to be the REMOTE_ADDR if available # else None ip = request.META.get('REMOTE_ADDR') # try to get the first non-proxy ip (not a private ip) from the # HTTP_X_FORWARDED_FOR x_forwar...
python
def get_client_ip(request): """ Get the client IP from the request """ # set the default value of the ip to be the REMOTE_ADDR if available # else None ip = request.META.get('REMOTE_ADDR') # try to get the first non-proxy ip (not a private ip) from the # HTTP_X_FORWARDED_FOR x_forwar...
[ "def", "get_client_ip", "(", "request", ")", ":", "# set the default value of the ip to be the REMOTE_ADDR if available", "# else None", "ip", "=", "request", ".", "META", ".", "get", "(", "'REMOTE_ADDR'", ")", "# try to get the first non-proxy ip (not a private ip) from the", ...
Get the client IP from the request
[ "Get", "the", "client", "IP", "from", "the", "request" ]
train
https://github.com/tomi77/django-extra-tools/blob/fb6d226bc5cf3fc0eb8abe61a512c3f5c7dcc8a8/django_extra_tools/wsgi_request.py#L4-L23
tek/proteome
integration/history_spec.py
FileHistoryBrowseSpec.browse
def browse(self): ''' Browse the history of a single file adds one commit that doesn't contain changes in test_file_1. there are four commits in summary, so the check for buffer line count compares with 3. at the end, a fifth commit must be present due to resetting the fi...
python
def browse(self): ''' Browse the history of a single file adds one commit that doesn't contain changes in test_file_1. there are four commits in summary, so the check for buffer line count compares with 3. at the end, a fifth commit must be present due to resetting the fi...
[ "def", "browse", "(", "self", ")", ":", "check", "=", "self", ".", "_check", "marker_text", "=", "Random", ".", "string", "(", ")", "self", ".", "vim", ".", "buffer", ".", "set_content", "(", "[", "marker_text", "]", ")", "self", ".", "_save", "(", ...
Browse the history of a single file adds one commit that doesn't contain changes in test_file_1. there are four commits in summary, so the check for buffer line count compares with 3. at the end, a fifth commit must be present due to resetting the file contents.
[ "Browse", "the", "history", "of", "a", "single", "file", "adds", "one", "commit", "that", "doesn", "t", "contain", "changes", "in", "test_file_1", ".", "there", "are", "four", "commits", "in", "summary", "so", "the", "check", "for", "buffer", "line", "coun...
train
https://github.com/tek/proteome/blob/b4fea6ca633a5b9ff56eaaf2507028fc6ff078b9/integration/history_spec.py#L173-L199
revarbat/ssltelnet
ssltelnet/__init__.py
SslTelnet.open
def open(self, *args, **kwargs): """ Works exactly like the Telnet.open() call from the telnetlib module, except SSL/TLS may be transparently negotiated. """ Telnet.open(self, *args, **kwargs) if self.force_ssl: self._start_tls()
python
def open(self, *args, **kwargs): """ Works exactly like the Telnet.open() call from the telnetlib module, except SSL/TLS may be transparently negotiated. """ Telnet.open(self, *args, **kwargs) if self.force_ssl: self._start_tls()
[ "def", "open", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "Telnet", ".", "open", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "if", "self", ".", "force_ssl", ":", "self", ".", "_start_tls", "(", ")" ]
Works exactly like the Telnet.open() call from the telnetlib module, except SSL/TLS may be transparently negotiated.
[ "Works", "exactly", "like", "the", "Telnet", ".", "open", "()", "call", "from", "the", "telnetlib", "module", "except", "SSL", "/", "TLS", "may", "be", "transparently", "negotiated", "." ]
train
https://github.com/revarbat/ssltelnet/blob/f2d6171c168f3f8b51a0793323cfaa27bc01a3e0/ssltelnet/__init__.py#L61-L68
jtmoulia/switchboard-python
switchboard/__init__.py
_take
def _take(d, key, default=None): """ If the key is present in dictionary, remove it and return it's value. If it is not present, return None. """ if key in d: cmd = d[key] del d[key] return cmd else: return default
python
def _take(d, key, default=None): """ If the key is present in dictionary, remove it and return it's value. If it is not present, return None. """ if key in d: cmd = d[key] del d[key] return cmd else: return default
[ "def", "_take", "(", "d", ",", "key", ",", "default", "=", "None", ")", ":", "if", "key", "in", "d", ":", "cmd", "=", "d", "[", "key", "]", "del", "d", "[", "key", "]", "return", "cmd", "else", ":", "return", "default" ]
If the key is present in dictionary, remove it and return it's value. If it is not present, return None.
[ "If", "the", "key", "is", "present", "in", "dictionary", "remove", "it", "and", "return", "it", "s", "value", ".", "If", "it", "is", "not", "present", "return", "None", "." ]
train
https://github.com/jtmoulia/switchboard-python/blob/c9b0cb74cb12a64385465091be633e78d39f08b1/switchboard/__init__.py#L141-L151
jtmoulia/switchboard-python
switchboard/__init__.py
_get_cmds_id
def _get_cmds_id(*cmds): """ Returns an identifier for a group of partially tagged commands. If there are no tagged commands, returns None. """ tags = [cmd[2] if len(cmd) == 3 else None for cmd in cmds] if [tag for tag in tags if tag != None]: return tuple(tags) else: return ...
python
def _get_cmds_id(*cmds): """ Returns an identifier for a group of partially tagged commands. If there are no tagged commands, returns None. """ tags = [cmd[2] if len(cmd) == 3 else None for cmd in cmds] if [tag for tag in tags if tag != None]: return tuple(tags) else: return ...
[ "def", "_get_cmds_id", "(", "*", "cmds", ")", ":", "tags", "=", "[", "cmd", "[", "2", "]", "if", "len", "(", "cmd", ")", "==", "3", "else", "None", "for", "cmd", "in", "cmds", "]", "if", "[", "tag", "for", "tag", "in", "tags", "if", "tag", "!...
Returns an identifier for a group of partially tagged commands. If there are no tagged commands, returns None.
[ "Returns", "an", "identifier", "for", "a", "group", "of", "partially", "tagged", "commands", ".", "If", "there", "are", "no", "tagged", "commands", "returns", "None", "." ]
train
https://github.com/jtmoulia/switchboard-python/blob/c9b0cb74cb12a64385465091be633e78d39f08b1/switchboard/__init__.py#L154-L163
jtmoulia/switchboard-python
switchboard/__init__.py
Client.received_message
def received_message(self, msg): """ Handle receiving a message by checking whether it is in response to a command or unsolicited, and dispatching it to the appropriate object method. """ logger.debug("Received message: %s", msg) if msg.is_binary: rais...
python
def received_message(self, msg): """ Handle receiving a message by checking whether it is in response to a command or unsolicited, and dispatching it to the appropriate object method. """ logger.debug("Received message: %s", msg) if msg.is_binary: rais...
[ "def", "received_message", "(", "self", ",", "msg", ")", ":", "logger", ".", "debug", "(", "\"Received message: %s\"", ",", "msg", ")", "if", "msg", ".", "is_binary", ":", "raise", "ValueError", "(", "\"Binary messages not supported\"", ")", "resps", "=", "jso...
Handle receiving a message by checking whether it is in response to a command or unsolicited, and dispatching it to the appropriate object method.
[ "Handle", "receiving", "a", "message", "by", "checking", "whether", "it", "is", "in", "response", "to", "a", "command", "or", "unsolicited", "and", "dispatching", "it", "to", "the", "appropriate", "object", "method", "." ]
train
https://github.com/jtmoulia/switchboard-python/blob/c9b0cb74cb12a64385465091be633e78d39f08b1/switchboard/__init__.py#L46-L66
jtmoulia/switchboard-python
switchboard/__init__.py
Client._tag_cmds
def _tag_cmds(self, *cmds): """ Yields tagged commands. """ for (method, args) in cmds: tagged_cmd = [method, args, self._tag] self._tag = self._tag + 1 yield tagged_cmd
python
def _tag_cmds(self, *cmds): """ Yields tagged commands. """ for (method, args) in cmds: tagged_cmd = [method, args, self._tag] self._tag = self._tag + 1 yield tagged_cmd
[ "def", "_tag_cmds", "(", "self", ",", "*", "cmds", ")", ":", "for", "(", "method", ",", "args", ")", "in", "cmds", ":", "tagged_cmd", "=", "[", "method", ",", "args", ",", "self", ".", "_tag", "]", "self", ".", "_tag", "=", "self", ".", "_tag", ...
Yields tagged commands.
[ "Yields", "tagged", "commands", "." ]
train
https://github.com/jtmoulia/switchboard-python/blob/c9b0cb74cb12a64385465091be633e78d39f08b1/switchboard/__init__.py#L80-L87
jtmoulia/switchboard-python
switchboard/__init__.py
Client.send_cmds
def send_cmds(self, *cmds): """ Tags and sends the commands to the Switchboard server, returning None. Each cmd be a 2-tuple where the first element is the method name, and the second is the arguments, e.g. ("connect", {"host": ...}). """ promise = aplus.Promise(...
python
def send_cmds(self, *cmds): """ Tags and sends the commands to the Switchboard server, returning None. Each cmd be a 2-tuple where the first element is the method name, and the second is the arguments, e.g. ("connect", {"host": ...}). """ promise = aplus.Promise(...
[ "def", "send_cmds", "(", "self", ",", "*", "cmds", ")", ":", "promise", "=", "aplus", ".", "Promise", "(", ")", "tagged_cmds", "=", "list", "(", "self", ".", "_tag_cmds", "(", "*", "cmds", ")", ")", "logger", ".", "debug", "(", "\"Sending cmds: %s\"", ...
Tags and sends the commands to the Switchboard server, returning None. Each cmd be a 2-tuple where the first element is the method name, and the second is the arguments, e.g. ("connect", {"host": ...}).
[ "Tags", "and", "sends", "the", "commands", "to", "the", "Switchboard", "server", "returning", "None", "." ]
train
https://github.com/jtmoulia/switchboard-python/blob/c9b0cb74cb12a64385465091be633e78d39f08b1/switchboard/__init__.py#L89-L104
gasparka/pyhacores
under_construction/interpolator/model.py
FIR.main
def main(self, x): """ Transposed form FIR implementation, uses full precision """ for i in range(len(self.taps_fix_reversed)): self.next.mul[i] = x * self.taps_fix_reversed[i] if i == 0: self.next.acc[0] = self.mul[i] else: ...
python
def main(self, x): """ Transposed form FIR implementation, uses full precision """ for i in range(len(self.taps_fix_reversed)): self.next.mul[i] = x * self.taps_fix_reversed[i] if i == 0: self.next.acc[0] = self.mul[i] else: ...
[ "def", "main", "(", "self", ",", "x", ")", ":", "for", "i", "in", "range", "(", "len", "(", "self", ".", "taps_fix_reversed", ")", ")", ":", "self", ".", "next", ".", "mul", "[", "i", "]", "=", "x", "*", "self", ".", "taps_fix_reversed", "[", "...
Transposed form FIR implementation, uses full precision
[ "Transposed", "form", "FIR", "implementation", "uses", "full", "precision" ]
train
https://github.com/gasparka/pyhacores/blob/16c186fbbf90385f2ba3498395123e79b6fcf340/under_construction/interpolator/model.py#L204-L216
lemieuxl/pyGenClean
pyGenClean/Contamination/contamination.py
main
def main(argString=None): """The main function of the module. :param argString: the options. :type argString: list These are the steps: 1. Prints the options. 2. Compute frequency using Plink. 3. Runs bafRegress. """ # Getting and checking the options args = parseArgs(argStr...
python
def main(argString=None): """The main function of the module. :param argString: the options. :type argString: list These are the steps: 1. Prints the options. 2. Compute frequency using Plink. 3. Runs bafRegress. """ # Getting and checking the options args = parseArgs(argStr...
[ "def", "main", "(", "argString", "=", "None", ")", ":", "# Getting and checking the options", "args", "=", "parseArgs", "(", "argString", ")", "checkArgs", "(", "args", ")", "logger", ".", "info", "(", "\"Options used:\"", ")", "for", "key", ",", "value", "i...
The main function of the module. :param argString: the options. :type argString: list These are the steps: 1. Prints the options. 2. Compute frequency using Plink. 3. Runs bafRegress.
[ "The", "main", "function", "of", "the", "module", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/Contamination/contamination.py#L32-L73
lemieuxl/pyGenClean
pyGenClean/Contamination/contamination.py
check_sample_files
def check_sample_files(fam_filename, raw_dirname): """Checks the raw sample files. :param fam_filename: the name of the FAM file. :param raw_dirname: the name of the directory containing the raw file. :type fam_filename: str :type raw_dirname: str :returns: the set of all the sample files tha...
python
def check_sample_files(fam_filename, raw_dirname): """Checks the raw sample files. :param fam_filename: the name of the FAM file. :param raw_dirname: the name of the directory containing the raw file. :type fam_filename: str :type raw_dirname: str :returns: the set of all the sample files tha...
[ "def", "check_sample_files", "(", "fam_filename", ",", "raw_dirname", ")", ":", "# Reading the sample identification number from the FAM file", "fam_samples", "=", "None", "with", "open", "(", "fam_filename", ",", "\"r\"", ")", "as", "i_file", ":", "fam_samples", "=", ...
Checks the raw sample files. :param fam_filename: the name of the FAM file. :param raw_dirname: the name of the directory containing the raw file. :type fam_filename: str :type raw_dirname: str :returns: the set of all the sample files that are compatible with the FAM file. :rty...
[ "Checks", "the", "raw", "sample", "files", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/Contamination/contamination.py#L76-L112
lemieuxl/pyGenClean
pyGenClean/Contamination/contamination.py
create_extraction_file
def create_extraction_file(bim_filename, out_prefix): """Creates an extraction file (keeping only markers on autosomes). :param bim_filename: the name of the BIM file. :param out_prefix: the prefix for the output file. :type bim_filename: str :type out_prefix: str """ o_file = None tr...
python
def create_extraction_file(bim_filename, out_prefix): """Creates an extraction file (keeping only markers on autosomes). :param bim_filename: the name of the BIM file. :param out_prefix: the prefix for the output file. :type bim_filename: str :type out_prefix: str """ o_file = None tr...
[ "def", "create_extraction_file", "(", "bim_filename", ",", "out_prefix", ")", ":", "o_file", "=", "None", "try", ":", "o_file", "=", "open", "(", "out_prefix", "+", "\".to_extract\"", ",", "\"w\"", ")", "except", "IOError", ":", "raise", "ProgramError", "(", ...
Creates an extraction file (keeping only markers on autosomes). :param bim_filename: the name of the BIM file. :param out_prefix: the prefix for the output file. :type bim_filename: str :type out_prefix: str
[ "Creates", "an", "extraction", "file", "(", "keeping", "only", "markers", "on", "autosomes", ")", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/Contamination/contamination.py#L115-L148
lemieuxl/pyGenClean
pyGenClean/Contamination/contamination.py
run_bafRegress
def run_bafRegress(filenames, out_prefix, extract_filename, freq_filename, options): """Runs the bafRegress function. :param filenames: the set of all sample files. :param out_prefix: the output prefix. :param extract_filename: the name of the markers to extract. :param freq_file...
python
def run_bafRegress(filenames, out_prefix, extract_filename, freq_filename, options): """Runs the bafRegress function. :param filenames: the set of all sample files. :param out_prefix: the output prefix. :param extract_filename: the name of the markers to extract. :param freq_file...
[ "def", "run_bafRegress", "(", "filenames", ",", "out_prefix", ",", "extract_filename", ",", "freq_filename", ",", "options", ")", ":", "# The command", "command", "=", "[", "\"bafRegress.py\"", ",", "\"estimate\"", ",", "\"--freqfile\"", ",", "freq_filename", ",", ...
Runs the bafRegress function. :param filenames: the set of all sample files. :param out_prefix: the output prefix. :param extract_filename: the name of the markers to extract. :param freq_filename: the name of the file containing the frequency. :param options: the other options. :type filename...
[ "Runs", "the", "bafRegress", "function", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/Contamination/contamination.py#L151-L198
lemieuxl/pyGenClean
pyGenClean/Contamination/contamination.py
run_bafRegress_sge
def run_bafRegress_sge(filenames, out_prefix, extract_filename, freq_filename, options): """Runs the bafRegress function using SGE. :param filenames: the set of all sample files. :param out_prefix: the output prefix. :param extract_filename: the name of the markers to extract. ...
python
def run_bafRegress_sge(filenames, out_prefix, extract_filename, freq_filename, options): """Runs the bafRegress function using SGE. :param filenames: the set of all sample files. :param out_prefix: the output prefix. :param extract_filename: the name of the markers to extract. ...
[ "def", "run_bafRegress_sge", "(", "filenames", ",", "out_prefix", ",", "extract_filename", ",", "freq_filename", ",", "options", ")", ":", "# Checks the environment variable for DRMAA package", "if", "\"DRMAA_LIBRARY_PATH\"", "not", "in", "os", ".", "environ", ":", "msg...
Runs the bafRegress function using SGE. :param filenames: the set of all sample files. :param out_prefix: the output prefix. :param extract_filename: the name of the markers to extract. :param freq_filename: the name of the file containing the frequency. :param options: the other options. :typ...
[ "Runs", "the", "bafRegress", "function", "using", "SGE", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/Contamination/contamination.py#L201-L332
lemieuxl/pyGenClean
pyGenClean/Contamination/contamination.py
run_plink
def run_plink(in_prefix, out_prefix, extract_filename): """Runs Plink with the geno option. :param in_prefix: the input prefix. :param out_prefix: the output prefix. :param extract_filename: the name of the file containing markers to extract. :type in_prefix: str :...
python
def run_plink(in_prefix, out_prefix, extract_filename): """Runs Plink with the geno option. :param in_prefix: the input prefix. :param out_prefix: the output prefix. :param extract_filename: the name of the file containing markers to extract. :type in_prefix: str :...
[ "def", "run_plink", "(", "in_prefix", ",", "out_prefix", ",", "extract_filename", ")", ":", "# The plink command", "plink_command", "=", "[", "\"plink\"", ",", "\"--noweb\"", ",", "\"--bfile\"", ",", "in_prefix", ",", "\"--extract\"", ",", "extract_filename", ",", ...
Runs Plink with the geno option. :param in_prefix: the input prefix. :param out_prefix: the output prefix. :param extract_filename: the name of the file containing markers to extract. :type in_prefix: str :type out_prefix: str :param extract_filename: str
[ "Runs", "Plink", "with", "the", "geno", "option", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/Contamination/contamination.py#L335-L363
lemieuxl/pyGenClean
pyGenClean/Contamination/contamination.py
checkArgs
def checkArgs(args): """Checks the arguments and options. :param args: an object containing the options of the program. :type args: argparse.Namespace :returns: ``True`` if everything was OK. If there is a problem with an option, an exception is raised using the :py:class:`ProgramError` clas...
python
def checkArgs(args): """Checks the arguments and options. :param args: an object containing the options of the program. :type args: argparse.Namespace :returns: ``True`` if everything was OK. If there is a problem with an option, an exception is raised using the :py:class:`ProgramError` clas...
[ "def", "checkArgs", "(", "args", ")", ":", "# Check if we have the tped and the tfam files", "for", "filename", "in", "[", "args", ".", "bfile", "+", "i", "for", "i", "in", "[", "\".bed\"", ",", "\".bim\"", ",", "\".fam\"", "]", "]", ":", "if", "not", "os"...
Checks the arguments and options. :param args: an object containing the options of the program. :type args: argparse.Namespace :returns: ``True`` if everything was OK. If there is a problem with an option, an exception is raised using the :py:class:`ProgramError` class, a message is printed to t...
[ "Checks", "the", "arguments", "and", "options", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/Contamination/contamination.py#L366-L389
williamjameshandley/fgivenx
fgivenx/drivers.py
plot_contours
def plot_contours(f, x, samples, ax=None, **kwargs): r""" Plot the probability mass function given `x` at a range of :math:`y` values for :math:`y = f(x|\theta)` :math:`P(y|x) = \int P(y=f(x;\theta)|x,\theta) P(\theta) d\theta` :math:`\mathrm{pmf}(y|x) = \int_{P(y'|x) < P(y|x)} P(y'|x) dy'` A...
python
def plot_contours(f, x, samples, ax=None, **kwargs): r""" Plot the probability mass function given `x` at a range of :math:`y` values for :math:`y = f(x|\theta)` :math:`P(y|x) = \int P(y=f(x;\theta)|x,\theta) P(\theta) d\theta` :math:`\mathrm{pmf}(y|x) = \int_{P(y'|x) < P(y|x)} P(y'|x) dy'` A...
[ "def", "plot_contours", "(", "f", ",", "x", ",", "samples", ",", "ax", "=", "None", ",", "*", "*", "kwargs", ")", ":", "logZ", "=", "kwargs", ".", "pop", "(", "'logZ'", ",", "None", ")", "weights", "=", "kwargs", ".", "pop", "(", "'weights'", ","...
r""" Plot the probability mass function given `x` at a range of :math:`y` values for :math:`y = f(x|\theta)` :math:`P(y|x) = \int P(y=f(x;\theta)|x,\theta) P(\theta) d\theta` :math:`\mathrm{pmf}(y|x) = \int_{P(y'|x) < P(y|x)} P(y'|x) dy'` Additionally, if a list of log-evidences are passed, along...
[ "r", "Plot", "the", "probability", "mass", "function", "given", "x", "at", "a", "range", "of", ":", "math", ":", "y", "values", "for", ":", "math", ":", "y", "=", "f", "(", "x|", "\\", "theta", ")" ]
train
https://github.com/williamjameshandley/fgivenx/blob/a16790652a3cef3cfacd4b97da62786cb66fec13/fgivenx/drivers.py#L42-L127
williamjameshandley/fgivenx
fgivenx/drivers.py
plot_lines
def plot_lines(f, x, samples, ax=None, **kwargs): r""" Plot a representative set of functions to sample Additionally, if a list of log-evidences are passed, along with list of functions, and list of samples, this function plots the probability mass function for all models marginalised according to ...
python
def plot_lines(f, x, samples, ax=None, **kwargs): r""" Plot a representative set of functions to sample Additionally, if a list of log-evidences are passed, along with list of functions, and list of samples, this function plots the probability mass function for all models marginalised according to ...
[ "def", "plot_lines", "(", "f", ",", "x", ",", "samples", ",", "ax", "=", "None", ",", "*", "*", "kwargs", ")", ":", "logZ", "=", "kwargs", ".", "pop", "(", "'logZ'", ",", "None", ")", "weights", "=", "kwargs", ".", "pop", "(", "'weights'", ",", ...
r""" Plot a representative set of functions to sample Additionally, if a list of log-evidences are passed, along with list of functions, and list of samples, this function plots the probability mass function for all models marginalised according to the evidences. Parameters ---------- f: f...
[ "r", "Plot", "a", "representative", "set", "of", "functions", "to", "sample" ]
train
https://github.com/williamjameshandley/fgivenx/blob/a16790652a3cef3cfacd4b97da62786cb66fec13/fgivenx/drivers.py#L130-L193
williamjameshandley/fgivenx
fgivenx/drivers.py
plot_dkl
def plot_dkl(f, x, samples, prior_samples, ax=None, **kwargs): r""" Plot the Kullback-Leibler divergence at each value of :math:`x` for the prior and posterior defined by `prior_samples` and `samples`. Let the posterior be: :math:`P(y|x) = \int P(y=f(x;\theta)|x,\theta)P(\theta) d\theta` and ...
python
def plot_dkl(f, x, samples, prior_samples, ax=None, **kwargs): r""" Plot the Kullback-Leibler divergence at each value of :math:`x` for the prior and posterior defined by `prior_samples` and `samples`. Let the posterior be: :math:`P(y|x) = \int P(y=f(x;\theta)|x,\theta)P(\theta) d\theta` and ...
[ "def", "plot_dkl", "(", "f", ",", "x", ",", "samples", ",", "prior_samples", ",", "ax", "=", "None", ",", "*", "*", "kwargs", ")", ":", "logZ", "=", "kwargs", ".", "pop", "(", "'logZ'", ",", "None", ")", "weights", "=", "kwargs", ".", "pop", "(",...
r""" Plot the Kullback-Leibler divergence at each value of :math:`x` for the prior and posterior defined by `prior_samples` and `samples`. Let the posterior be: :math:`P(y|x) = \int P(y=f(x;\theta)|x,\theta)P(\theta) d\theta` and the prior be: :math:`Q(y|x) = \int P(y=f(x;\theta)|x,\theta)Q(...
[ "r", "Plot", "the", "Kullback", "-", "Leibler", "divergence", "at", "each", "value", "of", ":", "math", ":", "x", "for", "the", "prior", "and", "posterior", "defined", "by", "prior_samples", "and", "samples", "." ]
train
https://github.com/williamjameshandley/fgivenx/blob/a16790652a3cef3cfacd4b97da62786cb66fec13/fgivenx/drivers.py#L196-L280
williamjameshandley/fgivenx
fgivenx/drivers.py
compute_samples
def compute_samples(f, x, samples, **kwargs): r""" Apply the function(s) :math:`f(x;\theta)` to the arrays defined in `x` and `samples`. Has options for weighting, trimming, cacheing & parallelising. Additionally, if a list of log-evidences are passed, along with list of functions, samples and opt...
python
def compute_samples(f, x, samples, **kwargs): r""" Apply the function(s) :math:`f(x;\theta)` to the arrays defined in `x` and `samples`. Has options for weighting, trimming, cacheing & parallelising. Additionally, if a list of log-evidences are passed, along with list of functions, samples and opt...
[ "def", "compute_samples", "(", "f", ",", "x", ",", "samples", ",", "*", "*", "kwargs", ")", ":", "logZ", "=", "kwargs", ".", "pop", "(", "'logZ'", ",", "None", ")", "weights", "=", "kwargs", ".", "pop", "(", "'weights'", ",", "None", ")", "ntrim", ...
r""" Apply the function(s) :math:`f(x;\theta)` to the arrays defined in `x` and `samples`. Has options for weighting, trimming, cacheing & parallelising. Additionally, if a list of log-evidences are passed, along with list of functions, samples and optional weights it marginalises over the models ...
[ "r", "Apply", "the", "function", "(", "s", ")", ":", "math", ":", "f", "(", "x", ";", "\\", "theta", ")", "to", "the", "arrays", "defined", "in", "x", "and", "samples", ".", "Has", "options", "for", "weighting", "trimming", "cacheing", "&", "parallel...
train
https://github.com/williamjameshandley/fgivenx/blob/a16790652a3cef3cfacd4b97da62786cb66fec13/fgivenx/drivers.py#L283-L352
williamjameshandley/fgivenx
fgivenx/drivers.py
compute_pmf
def compute_pmf(f, x, samples, **kwargs): r""" Compute the probability mass function given `x` at a range of `x` values for :math:`y = f(x|\theta)` :math:`P(y|x) = \int P(y=f(x;\theta)|x,\theta) P(\theta) d\theta` :math:`\mathrm{pmf}(y|x) = \int_{P(y'|x) < P(y|x)} P(y'|x) dy'` Additionally, i...
python
def compute_pmf(f, x, samples, **kwargs): r""" Compute the probability mass function given `x` at a range of `x` values for :math:`y = f(x|\theta)` :math:`P(y|x) = \int P(y=f(x;\theta)|x,\theta) P(\theta) d\theta` :math:`\mathrm{pmf}(y|x) = \int_{P(y'|x) < P(y|x)} P(y'|x) dy'` Additionally, i...
[ "def", "compute_pmf", "(", "f", ",", "x", ",", "samples", ",", "*", "*", "kwargs", ")", ":", "logZ", "=", "kwargs", ".", "pop", "(", "'logZ'", ",", "None", ")", "weights", "=", "kwargs", ".", "pop", "(", "'weights'", ",", "None", ")", "ny", "=", ...
r""" Compute the probability mass function given `x` at a range of `x` values for :math:`y = f(x|\theta)` :math:`P(y|x) = \int P(y=f(x;\theta)|x,\theta) P(\theta) d\theta` :math:`\mathrm{pmf}(y|x) = \int_{P(y'|x) < P(y|x)} P(y'|x) dy'` Additionally, if a list of log-evidences are passed, along wi...
[ "r", "Compute", "the", "probability", "mass", "function", "given", "x", "at", "a", "range", "of", "x", "values", "for", ":", "math", ":", "y", "=", "f", "(", "x|", "\\", "theta", ")" ]
train
https://github.com/williamjameshandley/fgivenx/blob/a16790652a3cef3cfacd4b97da62786cb66fec13/fgivenx/drivers.py#L355-L448
williamjameshandley/fgivenx
fgivenx/drivers.py
compute_dkl
def compute_dkl(f, x, samples, prior_samples, **kwargs): r""" Compute the Kullback-Leibler divergence at each value of `x` for the prior and posterior defined by `prior_samples` and `samples`. Parameters ---------- f: function function :math:`f(x;\theta)` (or list of functions for each ...
python
def compute_dkl(f, x, samples, prior_samples, **kwargs): r""" Compute the Kullback-Leibler divergence at each value of `x` for the prior and posterior defined by `prior_samples` and `samples`. Parameters ---------- f: function function :math:`f(x;\theta)` (or list of functions for each ...
[ "def", "compute_dkl", "(", "f", ",", "x", ",", "samples", ",", "prior_samples", ",", "*", "*", "kwargs", ")", ":", "logZ", "=", "kwargs", ".", "pop", "(", "'logZ'", ",", "None", ")", "weights", "=", "kwargs", ".", "pop", "(", "'weights'", ",", "Non...
r""" Compute the Kullback-Leibler divergence at each value of `x` for the prior and posterior defined by `prior_samples` and `samples`. Parameters ---------- f: function function :math:`f(x;\theta)` (or list of functions for each model) with dependent variable :math:`x`, parameteris...
[ "r", "Compute", "the", "Kullback", "-", "Leibler", "divergence", "at", "each", "value", "of", "x", "for", "the", "prior", "and", "posterior", "defined", "by", "prior_samples", "and", "samples", "." ]
train
https://github.com/williamjameshandley/fgivenx/blob/a16790652a3cef3cfacd4b97da62786cb66fec13/fgivenx/drivers.py#L451-L546
fbngrm/babelpy
babelpy/reader.py
read_txt_file
def read_txt_file(filepath): """read text from `filepath` and remove linebreaks """ if sys.version > '3': with open(filepath,'r',encoding='utf-8') as txt_file: return txt_file.readlines() else: with open(filepath) as txt_file: return txt_file.readlines()
python
def read_txt_file(filepath): """read text from `filepath` and remove linebreaks """ if sys.version > '3': with open(filepath,'r',encoding='utf-8') as txt_file: return txt_file.readlines() else: with open(filepath) as txt_file: return txt_file.readlines()
[ "def", "read_txt_file", "(", "filepath", ")", ":", "if", "sys", ".", "version", ">", "'3'", ":", "with", "open", "(", "filepath", ",", "'r'", ",", "encoding", "=", "'utf-8'", ")", "as", "txt_file", ":", "return", "txt_file", ".", "readlines", "(", ")",...
read text from `filepath` and remove linebreaks
[ "read", "text", "from", "filepath", "and", "remove", "linebreaks" ]
train
https://github.com/fbngrm/babelpy/blob/ff305abecddd66aed40c32f0010485cf192e5f17/babelpy/reader.py#L3-L11
limix/pickle-mixin
pickle_mixin/_core.py
SlotPickleMixin._get_all_slots
def _get_all_slots(self): """Returns all slots as set""" all_slots = (getattr(cls, '__slots__', []) for cls in self.__class__.__mro__) return set(slot for slots in all_slots for slot in slots)
python
def _get_all_slots(self): """Returns all slots as set""" all_slots = (getattr(cls, '__slots__', []) for cls in self.__class__.__mro__) return set(slot for slots in all_slots for slot in slots)
[ "def", "_get_all_slots", "(", "self", ")", ":", "all_slots", "=", "(", "getattr", "(", "cls", ",", "'__slots__'", ",", "[", "]", ")", "for", "cls", "in", "self", ".", "__class__", ".", "__mro__", ")", "return", "set", "(", "slot", "for", "slots", "in...
Returns all slots as set
[ "Returns", "all", "slots", "as", "set" ]
train
https://github.com/limix/pickle-mixin/blob/03d0b958a9094164a347eb9137c195b15f01394e/pickle_mixin/_core.py#L59-L63
mozilla/popcoder
popcoder/editor.py
Editor.trim
def trim(self, video_name, out, start, duration): """ Trims a clip to be duration starting at start @param video_name : name of the input video @param out : name of the output video @param start : starting position after the trim @param duration : duration of video after ...
python
def trim(self, video_name, out, start, duration): """ Trims a clip to be duration starting at start @param video_name : name of the input video @param out : name of the output video @param start : starting position after the trim @param duration : duration of video after ...
[ "def", "trim", "(", "self", ",", "video_name", ",", "out", ",", "start", ",", "duration", ")", ":", "command", "=", "[", "'ffmpeg'", ",", "'-ss'", ",", "start", ",", "'-i'", ",", "video_name", ",", "'-c:v'", ",", "'huffyuv'", ",", "'-y'", ",", "'-pre...
Trims a clip to be duration starting at start @param video_name : name of the input video @param out : name of the output video @param start : starting position after the trim @param duration : duration of video after start
[ "Trims", "a", "clip", "to", "be", "duration", "starting", "at", "start" ]
train
https://github.com/mozilla/popcoder/blob/9b1b99a14b942e5dbfa76bc6de7c7074afa736e8/popcoder/editor.py#L11-L24
mozilla/popcoder
popcoder/editor.py
Editor.skip
def skip(self, video_name, out, start, duration): """ Skips a section of the clip @param video_name : name of video input file @param out : name of output file @param start : start time of the skip (seconds) @param duration : duration of the skip (seconds) """ ...
python
def skip(self, video_name, out, start, duration): """ Skips a section of the clip @param video_name : name of video input file @param out : name of output file @param start : start time of the skip (seconds) @param duration : duration of the skip (seconds) """ ...
[ "def", "skip", "(", "self", ",", "video_name", ",", "out", ",", "start", ",", "duration", ")", ":", "cfilter", "=", "(", "r\"[0:v]trim=duration={start}[av];\"", "r\"[0:a]atrim=duration={start}[aa];\"", "r\"[0:v]trim=start={offset},setpts=PTS-STARTPTS[bv];\"", "r\"[0:a]atrim=s...
Skips a section of the clip @param video_name : name of video input file @param out : name of output file @param start : start time of the skip (seconds) @param duration : duration of the skip (seconds)
[ "Skips", "a", "section", "of", "the", "clip" ]
train
https://github.com/mozilla/popcoder/blob/9b1b99a14b942e5dbfa76bc6de7c7074afa736e8/popcoder/editor.py#L26-L52
mozilla/popcoder
popcoder/editor.py
Editor.draw_video
def draw_video(self, underlay, overlay, out, x, y): """ Draws one video over another @param underlay : video file on bottom @param overlay : video file to render on top @param out : output file @param start : starting position of overlay @param end : end position ...
python
def draw_video(self, underlay, overlay, out, x, y): """ Draws one video over another @param underlay : video file on bottom @param overlay : video file to render on top @param out : output file @param start : starting position of overlay @param end : end position ...
[ "def", "draw_video", "(", "self", ",", "underlay", ",", "overlay", ",", "out", ",", "x", ",", "y", ")", ":", "cfilter", "=", "r\"[0:1][1:1]amerge=inputs=2[aout];overlay=x={0}:y={1}\"", ".", "format", "(", "x", ",", "y", ")", "# Manually set the color space because...
Draws one video over another @param underlay : video file on bottom @param overlay : video file to render on top @param out : output file @param start : starting position of overlay @param end : end position of overlay @param x : x position of overlay @param y : y...
[ "Draws", "one", "video", "over", "another" ]
train
https://github.com/mozilla/popcoder/blob/9b1b99a14b942e5dbfa76bc6de7c7074afa736e8/popcoder/editor.py#L54-L82
mozilla/popcoder
popcoder/editor.py
Editor.draw_text
def draw_text(self, video_name, out, start, end, x, y, text, color='0xFFFFFF', show_background=0, background_color='0x000000', size=16): """ Draws text over a video @param video_name : name of video input file @param out : name of video output file ...
python
def draw_text(self, video_name, out, start, end, x, y, text, color='0xFFFFFF', show_background=0, background_color='0x000000', size=16): """ Draws text over a video @param video_name : name of video input file @param out : name of video output file ...
[ "def", "draw_text", "(", "self", ",", "video_name", ",", "out", ",", "start", ",", "end", ",", "x", ",", "y", ",", "text", ",", "color", "=", "'0xFFFFFF'", ",", "show_background", "=", "0", ",", "background_color", "=", "'0x000000'", ",", "size", "=", ...
Draws text over a video @param video_name : name of video input file @param out : name of video output file @param start : start timecode to draw text hh:mm:ss @param end : end timecode to draw text hh:mm:ss @param x : x position of text (px) @param y : y position of text...
[ "Draws", "text", "over", "a", "video" ]
train
https://github.com/mozilla/popcoder/blob/9b1b99a14b942e5dbfa76bc6de7c7074afa736e8/popcoder/editor.py#L84-L126
mozilla/popcoder
popcoder/editor.py
Editor.draw_image
def draw_image(self, video_name, image_name, out, start, end, x, y, verbose=False): """ Draws an image over the video @param video_name : name of video input file @param image_name: name of image input file @param out : name of video output file @param ...
python
def draw_image(self, video_name, image_name, out, start, end, x, y, verbose=False): """ Draws an image over the video @param video_name : name of video input file @param image_name: name of image input file @param out : name of video output file @param ...
[ "def", "draw_image", "(", "self", ",", "video_name", ",", "image_name", ",", "out", ",", "start", ",", "end", ",", "x", ",", "y", ",", "verbose", "=", "False", ")", ":", "cfilter", "=", "(", "r\"[0] [1] overlay=x={x}: y={y}:\"", "\"enable='between(t, {start}, ...
Draws an image over the video @param video_name : name of video input file @param image_name: name of image input file @param out : name of video output file @param start : when to start overlay @param end : when to end overlay @param x : x pos of image @param y :...
[ "Draws", "an", "image", "over", "the", "video" ]
train
https://github.com/mozilla/popcoder/blob/9b1b99a14b942e5dbfa76bc6de7c7074afa736e8/popcoder/editor.py#L149-L166
mozilla/popcoder
popcoder/editor.py
Editor.loop
def loop(self, video_name, out, start, duration, iterations, video_length, verbose=False): """ Loops a section of a video @param video_name : name of video input file @param out : name of video output file @param start : start time of loop (timestamp hh:mm:ss) ...
python
def loop(self, video_name, out, start, duration, iterations, video_length, verbose=False): """ Loops a section of a video @param video_name : name of video input file @param out : name of video output file @param start : start time of loop (timestamp hh:mm:ss) ...
[ "def", "loop", "(", "self", ",", "video_name", ",", "out", ",", "start", ",", "duration", ",", "iterations", ",", "video_length", ",", "verbose", "=", "False", ")", ":", "beginning", "=", "NamedTemporaryFile", "(", "suffix", "=", "'.avi'", ")", "# section ...
Loops a section of a video @param video_name : name of video input file @param out : name of video output file @param start : start time of loop (timestamp hh:mm:ss) @param duration : duration of loop section (seconds) @param iterations : amount of times to loop @param vi...
[ "Loops", "a", "section", "of", "a", "video" ]
train
https://github.com/mozilla/popcoder/blob/9b1b99a14b942e5dbfa76bc6de7c7074afa736e8/popcoder/editor.py#L168-L206
chapel-lang/sphinxcontrib-chapeldomain
sphinxcontrib/chapeldomain.py
ChapelTypedField.make_field
def make_field(self, types, domain, items): """Copy+Paste of TypedField.make_field() from Sphinx version 1.2.3. The first and second nodes.Text() instance are changed in this implementation to be ' : ' and '' respectively (instead of ' (' and ')'). TODO: Ask sphinx devs if there is a be...
python
def make_field(self, types, domain, items): """Copy+Paste of TypedField.make_field() from Sphinx version 1.2.3. The first and second nodes.Text() instance are changed in this implementation to be ' : ' and '' respectively (instead of ' (' and ')'). TODO: Ask sphinx devs if there is a be...
[ "def", "make_field", "(", "self", ",", "types", ",", "domain", ",", "items", ")", ":", "def", "handle_item", "(", "fieldarg", ",", "content", ")", ":", "par", "=", "nodes", ".", "paragraph", "(", ")", "par", "+=", "self", ".", "make_xref", "(", "self...
Copy+Paste of TypedField.make_field() from Sphinx version 1.2.3. The first and second nodes.Text() instance are changed in this implementation to be ' : ' and '' respectively (instead of ' (' and ')'). TODO: Ask sphinx devs if there is a better way to support this that is less cop...
[ "Copy", "+", "Paste", "of", "TypedField", ".", "make_field", "()", "from", "Sphinx", "version", "1", ".", "2", ".", "3", ".", "The", "first", "and", "second", "nodes", ".", "Text", "()", "instance", "are", "changed", "in", "this", "implementation", "to",...
train
https://github.com/chapel-lang/sphinxcontrib-chapeldomain/blob/00970fe1b3aed5deb1186bec19bf0912d2f92853/sphinxcontrib/chapeldomain.py#L72-L110
chapel-lang/sphinxcontrib-chapeldomain
sphinxcontrib/chapeldomain.py
ChapelObject._pseudo_parse_arglist
def _pseudo_parse_arglist(signode, arglist): """Parse list of comma separated arguments. Arguments can have optional types. """ paramlist = addnodes.desc_parameterlist() stack = [paramlist] try: for argument in arglist.split(','): argument = a...
python
def _pseudo_parse_arglist(signode, arglist): """Parse list of comma separated arguments. Arguments can have optional types. """ paramlist = addnodes.desc_parameterlist() stack = [paramlist] try: for argument in arglist.split(','): argument = a...
[ "def", "_pseudo_parse_arglist", "(", "signode", ",", "arglist", ")", ":", "paramlist", "=", "addnodes", ".", "desc_parameterlist", "(", ")", "stack", "=", "[", "paramlist", "]", "try", ":", "for", "argument", "in", "arglist", ".", "split", "(", "','", ")",...
Parse list of comma separated arguments. Arguments can have optional types.
[ "Parse", "list", "of", "comma", "separated", "arguments", "." ]
train
https://github.com/chapel-lang/sphinxcontrib-chapeldomain/blob/00970fe1b3aed5deb1186bec19bf0912d2f92853/sphinxcontrib/chapeldomain.py#L143-L186
chapel-lang/sphinxcontrib-chapeldomain
sphinxcontrib/chapeldomain.py
ChapelObject._get_attr_like_prefix
def _get_attr_like_prefix(self, sig): """Return prefix text for attribute or data directive.""" sig_match = chpl_attr_sig_pattern.match(sig) if sig_match is None: return ChapelObject.get_signature_prefix(self, sig) prefixes, _, _, _ = sig_match.groups() if prefixes: ...
python
def _get_attr_like_prefix(self, sig): """Return prefix text for attribute or data directive.""" sig_match = chpl_attr_sig_pattern.match(sig) if sig_match is None: return ChapelObject.get_signature_prefix(self, sig) prefixes, _, _, _ = sig_match.groups() if prefixes: ...
[ "def", "_get_attr_like_prefix", "(", "self", ",", "sig", ")", ":", "sig_match", "=", "chpl_attr_sig_pattern", ".", "match", "(", "sig", ")", "if", "sig_match", "is", "None", ":", "return", "ChapelObject", ".", "get_signature_prefix", "(", "self", ",", "sig", ...
Return prefix text for attribute or data directive.
[ "Return", "prefix", "text", "for", "attribute", "or", "data", "directive", "." ]
train
https://github.com/chapel-lang/sphinxcontrib-chapeldomain/blob/00970fe1b3aed5deb1186bec19bf0912d2f92853/sphinxcontrib/chapeldomain.py#L188-L200
chapel-lang/sphinxcontrib-chapeldomain
sphinxcontrib/chapeldomain.py
ChapelObject._get_proc_like_prefix
def _get_proc_like_prefix(self, sig): """Return prefix text for function or method directive (and similar). """ sig_match = chpl_sig_pattern.match(sig) if sig_match is None: return ChapelObject.get_signature_prefix(self, sig) prefixes, _, _, _, _ = sig_match....
python
def _get_proc_like_prefix(self, sig): """Return prefix text for function or method directive (and similar). """ sig_match = chpl_sig_pattern.match(sig) if sig_match is None: return ChapelObject.get_signature_prefix(self, sig) prefixes, _, _, _, _ = sig_match....
[ "def", "_get_proc_like_prefix", "(", "self", ",", "sig", ")", ":", "sig_match", "=", "chpl_sig_pattern", ".", "match", "(", "sig", ")", "if", "sig_match", "is", "None", ":", "return", "ChapelObject", ".", "get_signature_prefix", "(", "self", ",", "sig", ")",...
Return prefix text for function or method directive (and similar).
[ "Return", "prefix", "text", "for", "function", "or", "method", "directive", "(", "and", "similar", ")", "." ]
train
https://github.com/chapel-lang/sphinxcontrib-chapeldomain/blob/00970fe1b3aed5deb1186bec19bf0912d2f92853/sphinxcontrib/chapeldomain.py#L202-L218
chapel-lang/sphinxcontrib-chapeldomain
sphinxcontrib/chapeldomain.py
ChapelObject._get_sig_prefix
def _get_sig_prefix(self, sig): """Return signature prefix text. For attribute, data, and proc/iter directives this might be part of the signature. E.g. `type myNewType` will return a prefix of 'type' and `inline proc foo()` will return 'inline proc'. """ if self._is_proc_like():...
python
def _get_sig_prefix(self, sig): """Return signature prefix text. For attribute, data, and proc/iter directives this might be part of the signature. E.g. `type myNewType` will return a prefix of 'type' and `inline proc foo()` will return 'inline proc'. """ if self._is_proc_like():...
[ "def", "_get_sig_prefix", "(", "self", ",", "sig", ")", ":", "if", "self", ".", "_is_proc_like", "(", ")", ":", "return", "self", ".", "_get_proc_like_prefix", "(", "sig", ")", "elif", "self", ".", "_is_attr_like", "(", ")", ":", "return", "self", ".", ...
Return signature prefix text. For attribute, data, and proc/iter directives this might be part of the signature. E.g. `type myNewType` will return a prefix of 'type' and `inline proc foo()` will return 'inline proc'.
[ "Return", "signature", "prefix", "text", ".", "For", "attribute", "data", "and", "proc", "/", "iter", "directives", "this", "might", "be", "part", "of", "the", "signature", ".", "E", ".", "g", ".", "type", "myNewType", "will", "return", "a", "prefix", "o...
train
https://github.com/chapel-lang/sphinxcontrib-chapeldomain/blob/00970fe1b3aed5deb1186bec19bf0912d2f92853/sphinxcontrib/chapeldomain.py#L229-L239
chapel-lang/sphinxcontrib-chapeldomain
sphinxcontrib/chapeldomain.py
ChapelObject.handle_signature
def handle_signature(self, sig, signode): """Parse the signature *sig* into individual nodes and append them to the *signode*. If ValueError is raises, parsing is aborted and the whole *sig* string is put into a single desc_name node. The return value is the value that identifies the ob...
python
def handle_signature(self, sig, signode): """Parse the signature *sig* into individual nodes and append them to the *signode*. If ValueError is raises, parsing is aborted and the whole *sig* string is put into a single desc_name node. The return value is the value that identifies the ob...
[ "def", "handle_signature", "(", "self", ",", "sig", ",", "signode", ")", ":", "if", "self", ".", "_is_attr_like", "(", ")", ":", "sig_match", "=", "chpl_attr_sig_pattern", ".", "match", "(", "sig", ")", "if", "sig_match", "is", "None", ":", "raise", "Val...
Parse the signature *sig* into individual nodes and append them to the *signode*. If ValueError is raises, parsing is aborted and the whole *sig* string is put into a single desc_name node. The return value is the value that identifies the object. IOW, it is the identifier that will be ...
[ "Parse", "the", "signature", "*", "sig", "*", "into", "individual", "nodes", "and", "append", "them", "to", "the", "*", "signode", "*", ".", "If", "ValueError", "is", "raises", "parsing", "is", "aborted", "and", "the", "whole", "*", "sig", "*", "string",...
train
https://github.com/chapel-lang/sphinxcontrib-chapeldomain/blob/00970fe1b3aed5deb1186bec19bf0912d2f92853/sphinxcontrib/chapeldomain.py#L253-L337
chapel-lang/sphinxcontrib-chapeldomain
sphinxcontrib/chapeldomain.py
ChapelObject.add_target_and_index
def add_target_and_index(self, name_cls, sig, signode): """Add cross-reference IDs and entries to the index node, if applicable. *name_cls* is the return value of :py:meth:`handle_signature`. """ modname = self.options.get( 'module', self.env.temp_data.get('chpl:modul...
python
def add_target_and_index(self, name_cls, sig, signode): """Add cross-reference IDs and entries to the index node, if applicable. *name_cls* is the return value of :py:meth:`handle_signature`. """ modname = self.options.get( 'module', self.env.temp_data.get('chpl:modul...
[ "def", "add_target_and_index", "(", "self", ",", "name_cls", ",", "sig", ",", "signode", ")", ":", "modname", "=", "self", ".", "options", ".", "get", "(", "'module'", ",", "self", ".", "env", ".", "temp_data", ".", "get", "(", "'chpl:module'", ")", ")...
Add cross-reference IDs and entries to the index node, if applicable. *name_cls* is the return value of :py:meth:`handle_signature`.
[ "Add", "cross", "-", "reference", "IDs", "and", "entries", "to", "the", "index", "node", "if", "applicable", ".", "*", "name_cls", "*", "is", "the", "return", "value", "of", ":", "py", ":", "meth", ":", "handle_signature", "." ]
train
https://github.com/chapel-lang/sphinxcontrib-chapeldomain/blob/00970fe1b3aed5deb1186bec19bf0912d2f92853/sphinxcontrib/chapeldomain.py#L343-L370
chapel-lang/sphinxcontrib-chapeldomain
sphinxcontrib/chapeldomain.py
ChapelModule.run
def run(self): """Custom execution for chapel module directive. This class is instantiated by the directive implementation and then this method is called. It parses the options on the module directive, updates the environment according, and creates an index entry for the module. ...
python
def run(self): """Custom execution for chapel module directive. This class is instantiated by the directive implementation and then this method is called. It parses the options on the module directive, updates the environment according, and creates an index entry for the module. ...
[ "def", "run", "(", "self", ")", ":", "env", "=", "self", ".", "state", ".", "document", ".", "settings", ".", "env", "modname", "=", "self", ".", "arguments", "[", "0", "]", ".", "strip", "(", ")", "noindex", "=", "'noindex'", "in", "self", ".", ...
Custom execution for chapel module directive. This class is instantiated by the directive implementation and then this method is called. It parses the options on the module directive, updates the environment according, and creates an index entry for the module. Based on the python domai...
[ "Custom", "execution", "for", "chapel", "module", "directive", ".", "This", "class", "is", "instantiated", "by", "the", "directive", "implementation", "and", "then", "this", "method", "is", "called", ".", "It", "parses", "the", "options", "on", "the", "module"...
train
https://github.com/chapel-lang/sphinxcontrib-chapeldomain/blob/00970fe1b3aed5deb1186bec19bf0912d2f92853/sphinxcontrib/chapeldomain.py#L399-L433
chapel-lang/sphinxcontrib-chapeldomain
sphinxcontrib/chapeldomain.py
ChapelClassMember.chpl_type_name
def chpl_type_name(self): """Returns iterator or method or '' depending on object type.""" if not self.objtype.endswith('method'): return '' elif self.objtype.startswith('iter'): return 'iterator' elif self.objtype == 'method': return 'method' ...
python
def chpl_type_name(self): """Returns iterator or method or '' depending on object type.""" if not self.objtype.endswith('method'): return '' elif self.objtype.startswith('iter'): return 'iterator' elif self.objtype == 'method': return 'method' ...
[ "def", "chpl_type_name", "(", "self", ")", ":", "if", "not", "self", ".", "objtype", ".", "endswith", "(", "'method'", ")", ":", "return", "''", "elif", "self", ".", "objtype", ".", "startswith", "(", "'iter'", ")", ":", "return", "'iterator'", "elif", ...
Returns iterator or method or '' depending on object type.
[ "Returns", "iterator", "or", "method", "or", "depending", "on", "object", "type", "." ]
train
https://github.com/chapel-lang/sphinxcontrib-chapeldomain/blob/00970fe1b3aed5deb1186bec19bf0912d2f92853/sphinxcontrib/chapeldomain.py#L464-L473
chapel-lang/sphinxcontrib-chapeldomain
sphinxcontrib/chapeldomain.py
ChapelClassMember.get_index_text
def get_index_text(self, modname, name_cls): """Return text for index entry based on object type.""" name, cls = name_cls add_modules = self.env.config.add_module_names if self.objtype.endswith('method'): try: clsname, methname = name.rsplit('.', 1) ...
python
def get_index_text(self, modname, name_cls): """Return text for index entry based on object type.""" name, cls = name_cls add_modules = self.env.config.add_module_names if self.objtype.endswith('method'): try: clsname, methname = name.rsplit('.', 1) ...
[ "def", "get_index_text", "(", "self", ",", "modname", ",", "name_cls", ")", ":", "name", ",", "cls", "=", "name_cls", "add_modules", "=", "self", ".", "env", ".", "config", ".", "add_module_names", "if", "self", ".", "objtype", ".", "endswith", "(", "'me...
Return text for index entry based on object type.
[ "Return", "text", "for", "index", "entry", "based", "on", "object", "type", "." ]
train
https://github.com/chapel-lang/sphinxcontrib-chapeldomain/blob/00970fe1b3aed5deb1186bec19bf0912d2f92853/sphinxcontrib/chapeldomain.py#L485-L516
chapel-lang/sphinxcontrib-chapeldomain
sphinxcontrib/chapeldomain.py
ChapelClassObject.get_index_text
def get_index_text(self, modname, name_cls): """Return index entry text based on object type.""" if self.objtype in ('class', 'record'): if not modname: return _('%s (built-in %s)') % (name_cls[0], self.objtype) return _('%s (%s in %s)') % (name_cls[0], self.objty...
python
def get_index_text(self, modname, name_cls): """Return index entry text based on object type.""" if self.objtype in ('class', 'record'): if not modname: return _('%s (built-in %s)') % (name_cls[0], self.objtype) return _('%s (%s in %s)') % (name_cls[0], self.objty...
[ "def", "get_index_text", "(", "self", ",", "modname", ",", "name_cls", ")", ":", "if", "self", ".", "objtype", "in", "(", "'class'", ",", "'record'", ")", ":", "if", "not", "modname", ":", "return", "_", "(", "'%s (built-in %s)'", ")", "%", "(", "name_...
Return index entry text based on object type.
[ "Return", "index", "entry", "text", "based", "on", "object", "type", "." ]
train
https://github.com/chapel-lang/sphinxcontrib-chapeldomain/blob/00970fe1b3aed5deb1186bec19bf0912d2f92853/sphinxcontrib/chapeldomain.py#L526-L533
chapel-lang/sphinxcontrib-chapeldomain
sphinxcontrib/chapeldomain.py
ChapelClassObject.before_content
def before_content(self): """Called before parsing content. Push the class name onto the class name stack. Used to construct the full name for members. """ ChapelObject.before_content(self) if self.names: self.env.temp_data['chpl:class'] = self.names[0][0] ...
python
def before_content(self): """Called before parsing content. Push the class name onto the class name stack. Used to construct the full name for members. """ ChapelObject.before_content(self) if self.names: self.env.temp_data['chpl:class'] = self.names[0][0] ...
[ "def", "before_content", "(", "self", ")", ":", "ChapelObject", ".", "before_content", "(", "self", ")", "if", "self", ".", "names", ":", "self", ".", "env", ".", "temp_data", "[", "'chpl:class'", "]", "=", "self", ".", "names", "[", "0", "]", "[", "...
Called before parsing content. Push the class name onto the class name stack. Used to construct the full name for members.
[ "Called", "before", "parsing", "content", ".", "Push", "the", "class", "name", "onto", "the", "class", "name", "stack", ".", "Used", "to", "construct", "the", "full", "name", "for", "members", "." ]
train
https://github.com/chapel-lang/sphinxcontrib-chapeldomain/blob/00970fe1b3aed5deb1186bec19bf0912d2f92853/sphinxcontrib/chapeldomain.py#L535-L542
chapel-lang/sphinxcontrib-chapeldomain
sphinxcontrib/chapeldomain.py
ChapelModuleLevel.get_index_text
def get_index_text(self, modname, name_cls): """Return text for index entry based on object type.""" if self.objtype.endswith('function'): if not modname: return _('%s() (built-in %s)') % \ (name_cls[0], self.chpl_type_name) return _('%s() (in ...
python
def get_index_text(self, modname, name_cls): """Return text for index entry based on object type.""" if self.objtype.endswith('function'): if not modname: return _('%s() (built-in %s)') % \ (name_cls[0], self.chpl_type_name) return _('%s() (in ...
[ "def", "get_index_text", "(", "self", ",", "modname", ",", "name_cls", ")", ":", "if", "self", ".", "objtype", ".", "endswith", "(", "'function'", ")", ":", "if", "not", "modname", ":", "return", "_", "(", "'%s() (built-in %s)'", ")", "%", "(", "name_cls...
Return text for index entry based on object type.
[ "Return", "text", "for", "index", "entry", "based", "on", "object", "type", "." ]
train
https://github.com/chapel-lang/sphinxcontrib-chapeldomain/blob/00970fe1b3aed5deb1186bec19bf0912d2f92853/sphinxcontrib/chapeldomain.py#L576-L591
chapel-lang/sphinxcontrib-chapeldomain
sphinxcontrib/chapeldomain.py
ChapelXRefRole.process_link
def process_link(self, env, refnode, has_explicit_title, title, target): """Called after parsing title and target text, and creating the reference node. Alter the reference node and return it with chapel module and class information, if relevant. """ refnode['chpl:module'] = env....
python
def process_link(self, env, refnode, has_explicit_title, title, target): """Called after parsing title and target text, and creating the reference node. Alter the reference node and return it with chapel module and class information, if relevant. """ refnode['chpl:module'] = env....
[ "def", "process_link", "(", "self", ",", "env", ",", "refnode", ",", "has_explicit_title", ",", "title", ",", "target", ")", ":", "refnode", "[", "'chpl:module'", "]", "=", "env", ".", "temp_data", ".", "get", "(", "'chpl:module'", ")", "refnode", "[", "...
Called after parsing title and target text, and creating the reference node. Alter the reference node and return it with chapel module and class information, if relevant.
[ "Called", "after", "parsing", "title", "and", "target", "text", "and", "creating", "the", "reference", "node", ".", "Alter", "the", "reference", "node", "and", "return", "it", "with", "chapel", "module", "and", "class", "information", "if", "relevant", "." ]
train
https://github.com/chapel-lang/sphinxcontrib-chapeldomain/blob/00970fe1b3aed5deb1186bec19bf0912d2f92853/sphinxcontrib/chapeldomain.py#L601-L627