repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
nilp0inter/cpe
cpe/cpeset2_3.py
CPESet2_3.cpe_superset
def cpe_superset(cls, source, target): """ Compares two WFNs and returns True if the set-theoretic relation between the names is (non-proper) SUPERSET. :param CPE2_3_WFN source: first WFN CPE Name :param CPE2_3_WFN target: seconds WFN CPE Name :returns: True if the set r...
python
def cpe_superset(cls, source, target): """ Compares two WFNs and returns True if the set-theoretic relation between the names is (non-proper) SUPERSET. :param CPE2_3_WFN source: first WFN CPE Name :param CPE2_3_WFN target: seconds WFN CPE Name :returns: True if the set r...
[ "def", "cpe_superset", "(", "cls", ",", "source", ",", "target", ")", ":", "# If any pairwise comparison returned something other than SUPERSET", "# or EQUAL, then SUPERSET is False.", "for", "att", ",", "result", "in", "CPESet2_3", ".", "compare_wfns", "(", "source", ","...
Compares two WFNs and returns True if the set-theoretic relation between the names is (non-proper) SUPERSET. :param CPE2_3_WFN source: first WFN CPE Name :param CPE2_3_WFN target: seconds WFN CPE Name :returns: True if the set relation between source and target is SUPERSET, ...
[ "Compares", "two", "WFNs", "and", "returns", "True", "if", "the", "set", "-", "theoretic", "relation", "between", "the", "names", "is", "(", "non", "-", "proper", ")", "SUPERSET", "." ]
train
https://github.com/nilp0inter/cpe/blob/670d947472a7652af5149324977b50f9a7af9bcf/cpe/cpeset2_3.py#L370-L390
nilp0inter/cpe
cpe/cpeset2_3.py
CPESet2_3.append
def append(self, cpe): """ Adds a CPE element to the set if not already. Only WFN CPE Names are valid, so this function converts the input CPE object of version 2.3 to WFN style. :param CPE cpe: CPE Name to store in set :returns: None :exception: ValueError - inv...
python
def append(self, cpe): """ Adds a CPE element to the set if not already. Only WFN CPE Names are valid, so this function converts the input CPE object of version 2.3 to WFN style. :param CPE cpe: CPE Name to store in set :returns: None :exception: ValueError - inv...
[ "def", "append", "(", "self", ",", "cpe", ")", ":", "if", "cpe", ".", "VERSION", "!=", "CPE2_3", ".", "VERSION", ":", "errmsg", "=", "\"CPE Name version {0} not valid, version 2.3 expected\"", ".", "format", "(", "cpe", ".", "VERSION", ")", "raise", "ValueErro...
Adds a CPE element to the set if not already. Only WFN CPE Names are valid, so this function converts the input CPE object of version 2.3 to WFN style. :param CPE cpe: CPE Name to store in set :returns: None :exception: ValueError - invalid version of CPE Name
[ "Adds", "a", "CPE", "element", "to", "the", "set", "if", "not", "already", ".", "Only", "WFN", "CPE", "Names", "are", "valid", "so", "this", "function", "converts", "the", "input", "CPE", "object", "of", "version", "2", ".", "3", "to", "WFN", "style", ...
train
https://github.com/nilp0inter/cpe/blob/670d947472a7652af5149324977b50f9a7af9bcf/cpe/cpeset2_3.py#L396-L421
nilp0inter/cpe
cpe/cpeset2_3.py
CPESet2_3.name_match
def name_match(self, wfn): """ Accepts a set of CPE Names K and a candidate CPE Name X. It returns 'True' if X matches any member of K, and 'False' otherwise. :param CPESet self: A set of m known CPE Names K = {K1, K2, …, Km}. :param CPE cpe: A candidate CPE Name X. :ret...
python
def name_match(self, wfn): """ Accepts a set of CPE Names K and a candidate CPE Name X. It returns 'True' if X matches any member of K, and 'False' otherwise. :param CPESet self: A set of m known CPE Names K = {K1, K2, …, Km}. :param CPE cpe: A candidate CPE Name X. :ret...
[ "def", "name_match", "(", "self", ",", "wfn", ")", ":", "for", "N", "in", "self", ".", "K", ":", "if", "CPESet2_3", ".", "cpe_superset", "(", "wfn", ",", "N", ")", ":", "return", "True", "return", "False" ]
Accepts a set of CPE Names K and a candidate CPE Name X. It returns 'True' if X matches any member of K, and 'False' otherwise. :param CPESet self: A set of m known CPE Names K = {K1, K2, …, Km}. :param CPE cpe: A candidate CPE Name X. :returns: True if X matches K, otherwise False. ...
[ "Accepts", "a", "set", "of", "CPE", "Names", "K", "and", "a", "candidate", "CPE", "Name", "X", ".", "It", "returns", "True", "if", "X", "matches", "any", "member", "of", "K", "and", "False", "otherwise", "." ]
train
https://github.com/nilp0inter/cpe/blob/670d947472a7652af5149324977b50f9a7af9bcf/cpe/cpeset2_3.py#L423-L437
nilp0inter/cpe
cpe/cpe2_3_wfn.py
CPE2_3_WFN._parse
def _parse(self): """ Checks if the CPE Name is valid. :returns: None :exception: ValueError - bad-formed CPE Name """ # Check prefix and initial bracket of WFN if self._str[0:5] != CPE2_3_WFN.CPE_PREFIX: errmsg = "Bad-formed CPE Name: WFN prefix not...
python
def _parse(self): """ Checks if the CPE Name is valid. :returns: None :exception: ValueError - bad-formed CPE Name """ # Check prefix and initial bracket of WFN if self._str[0:5] != CPE2_3_WFN.CPE_PREFIX: errmsg = "Bad-formed CPE Name: WFN prefix not...
[ "def", "_parse", "(", "self", ")", ":", "# Check prefix and initial bracket of WFN", "if", "self", ".", "_str", "[", "0", ":", "5", "]", "!=", "CPE2_3_WFN", ".", "CPE_PREFIX", ":", "errmsg", "=", "\"Bad-formed CPE Name: WFN prefix not found\"", "raise", "ValueError"...
Checks if the CPE Name is valid. :returns: None :exception: ValueError - bad-formed CPE Name
[ "Checks", "if", "the", "CPE", "Name", "is", "valid", "." ]
train
https://github.com/nilp0inter/cpe/blob/670d947472a7652af5149324977b50f9a7af9bcf/cpe/cpe2_3_wfn.py#L110-L216
nilp0inter/cpe
cpe/cpelang2_2.py
CPELanguage2_2.language_match
def language_match(self, cpeset, cpel_dom=None): """ Accepts a set of known CPE Names and an expression in the CPE language, and delivers the answer True if the expression matches with the set. Otherwise, it returns False. :param CPELanguage self: An expression in the CPE Applic...
python
def language_match(self, cpeset, cpel_dom=None): """ Accepts a set of known CPE Names and an expression in the CPE language, and delivers the answer True if the expression matches with the set. Otherwise, it returns False. :param CPELanguage self: An expression in the CPE Applic...
[ "def", "language_match", "(", "self", ",", "cpeset", ",", "cpel_dom", "=", "None", ")", ":", "# Root element tag", "TAG_ROOT", "=", "'#document'", "# A container for child platform definitions", "TAG_PLATSPEC", "=", "'cpe:platform-specification'", "# Information about a platf...
Accepts a set of known CPE Names and an expression in the CPE language, and delivers the answer True if the expression matches with the set. Otherwise, it returns False. :param CPELanguage self: An expression in the CPE Applicability Language, represented as the XML infoset for the ...
[ "Accepts", "a", "set", "of", "known", "CPE", "Names", "and", "an", "expression", "in", "the", "CPE", "language", "and", "delivers", "the", "answer", "True", "if", "the", "expression", "matches", "with", "the", "set", ".", "Otherwise", "it", "returns", "Fal...
train
https://github.com/nilp0inter/cpe/blob/670d947472a7652af5149324977b50f9a7af9bcf/cpe/cpelang2_2.py#L59-L149
nilp0inter/cpe
cpe/cpeset2_2.py
CPESet2_2.append
def append(self, cpe): """ Adds a CPE Name to the set if not already. :param CPE cpe: CPE Name to store in set :returns: None :exception: ValueError - invalid version of CPE Name TEST: >>> from .cpeset2_2 import CPESet2_2 >>> from .cpe2_2 import CPE2_2...
python
def append(self, cpe): """ Adds a CPE Name to the set if not already. :param CPE cpe: CPE Name to store in set :returns: None :exception: ValueError - invalid version of CPE Name TEST: >>> from .cpeset2_2 import CPESet2_2 >>> from .cpe2_2 import CPE2_2...
[ "def", "append", "(", "self", ",", "cpe", ")", ":", "if", "cpe", ".", "VERSION", "!=", "CPE", ".", "VERSION_2_2", ":", "errmsg", "=", "\"CPE Name version {0} not valid, version 2.2 expected\"", ".", "format", "(", "cpe", ".", "VERSION", ")", "raise", "ValueErr...
Adds a CPE Name to the set if not already. :param CPE cpe: CPE Name to store in set :returns: None :exception: ValueError - invalid version of CPE Name TEST: >>> from .cpeset2_2 import CPESet2_2 >>> from .cpe2_2 import CPE2_2 >>> uri1 = 'cpe:/h:hp' >>>...
[ "Adds", "a", "CPE", "Name", "to", "the", "set", "if", "not", "already", "." ]
train
https://github.com/nilp0inter/cpe/blob/670d947472a7652af5149324977b50f9a7af9bcf/cpe/cpeset2_2.py#L58-L86
nilp0inter/cpe
cpe/comp/cpecomp2_3_wfn.py
CPEComponent2_3_WFN.set_value
def set_value(self, comp_str, comp_att): """ Set the value of component. :param string comp_str: value of component :param string comp_att: attribute associated with comp_str :returns: None :exception: ValueError - incorrect value of component """ # Del ...
python
def set_value(self, comp_str, comp_att): """ Set the value of component. :param string comp_str: value of component :param string comp_att: attribute associated with comp_str :returns: None :exception: ValueError - incorrect value of component """ # Del ...
[ "def", "set_value", "(", "self", ",", "comp_str", ",", "comp_att", ")", ":", "# Del double quotes of value", "str", "=", "comp_str", "[", "1", ":", "-", "1", "]", "self", ".", "_standard_value", "=", "str", "# Parse the value", "super", "(", "CPEComponent2_3_W...
Set the value of component. :param string comp_str: value of component :param string comp_att: attribute associated with comp_str :returns: None :exception: ValueError - incorrect value of component
[ "Set", "the", "value", "of", "component", "." ]
train
https://github.com/nilp0inter/cpe/blob/670d947472a7652af5149324977b50f9a7af9bcf/cpe/comp/cpecomp2_3_wfn.py#L132-L147
nilp0inter/cpe
cpe/cpeset1_1.py
CPESet1_1.append
def append(self, cpe): """ Adds a CPE Name to the set if not already. :param CPE cpe: CPE Name to store in set :returns: None :exception: ValueError - invalid version of CPE Name TEST: >>> from .cpeset1_1 import CPESet1_1 >>> from .cpe1_1 import CPE1_1 ...
python
def append(self, cpe): """ Adds a CPE Name to the set if not already. :param CPE cpe: CPE Name to store in set :returns: None :exception: ValueError - invalid version of CPE Name TEST: >>> from .cpeset1_1 import CPESet1_1 >>> from .cpe1_1 import CPE1_1 ...
[ "def", "append", "(", "self", ",", "cpe", ")", ":", "if", "cpe", ".", "VERSION", "!=", "CPE", ".", "VERSION_1_1", ":", "msg", "=", "\"CPE Name version {0} not valid, version 1.1 expected\"", ".", "format", "(", "cpe", ".", "VERSION", ")", "raise", "ValueError"...
Adds a CPE Name to the set if not already. :param CPE cpe: CPE Name to store in set :returns: None :exception: ValueError - invalid version of CPE Name TEST: >>> from .cpeset1_1 import CPESet1_1 >>> from .cpe1_1 import CPE1_1 >>> uri1 = 'cpe://microsoft:windows...
[ "Adds", "a", "CPE", "Name", "to", "the", "set", "if", "not", "already", "." ]
train
https://github.com/nilp0inter/cpe/blob/670d947472a7652af5149324977b50f9a7af9bcf/cpe/cpeset1_1.py#L56-L83
nilp0inter/cpe
cpe/cpeset1_1.py
CPESet1_1.name_match
def name_match(self, cpe): """ Accepts a set of known instances of CPE Names and a candidate CPE Name, and returns 'True' if the candidate can be shown to be an instance based on the content of the known instances. Otherwise, it returns 'False'. :param CPESet self: A set...
python
def name_match(self, cpe): """ Accepts a set of known instances of CPE Names and a candidate CPE Name, and returns 'True' if the candidate can be shown to be an instance based on the content of the known instances. Otherwise, it returns 'False'. :param CPESet self: A set...
[ "def", "name_match", "(", "self", ",", "cpe", ")", ":", "# An empty set not matching with any CPE", "if", "len", "(", "self", ")", "==", "0", ":", "return", "False", "# If input CPE Name string is in set of CPE Name strings", "# not do searching more because there is a matchi...
Accepts a set of known instances of CPE Names and a candidate CPE Name, and returns 'True' if the candidate can be shown to be an instance based on the content of the known instances. Otherwise, it returns 'False'. :param CPESet self: A set of m known CPE Names K = {K1, K2, …, Km}. ...
[ "Accepts", "a", "set", "of", "known", "instances", "of", "CPE", "Names", "and", "a", "candidate", "CPE", "Name", "and", "returns", "True", "if", "the", "candidate", "can", "be", "shown", "to", "be", "an", "instance", "based", "on", "the", "content", "of"...
train
https://github.com/nilp0inter/cpe/blob/670d947472a7652af5149324977b50f9a7af9bcf/cpe/cpeset1_1.py#L85-L169
nilp0inter/cpe
cpe/cpe2_3_fs.py
CPE2_3_FS._parse
def _parse(self): """ Checks if the CPE Name is valid. :returns: None :exception: ValueError - bad-formed CPE Name """ # CPE Name must not have whitespaces if (self._str.find(" ") != -1): msg = "Bad-formed CPE Name: it must not have whitespaces" ...
python
def _parse(self): """ Checks if the CPE Name is valid. :returns: None :exception: ValueError - bad-formed CPE Name """ # CPE Name must not have whitespaces if (self._str.find(" ") != -1): msg = "Bad-formed CPE Name: it must not have whitespaces" ...
[ "def", "_parse", "(", "self", ")", ":", "# CPE Name must not have whitespaces", "if", "(", "self", ".", "_str", ".", "find", "(", "\" \"", ")", "!=", "-", "1", ")", ":", "msg", "=", "\"Bad-formed CPE Name: it must not have whitespaces\"", "raise", "ValueError", ...
Checks if the CPE Name is valid. :returns: None :exception: ValueError - bad-formed CPE Name
[ "Checks", "if", "the", "CPE", "Name", "is", "valid", "." ]
train
https://github.com/nilp0inter/cpe/blob/670d947472a7652af5149324977b50f9a7af9bcf/cpe/cpe2_3_fs.py#L130-L199
nilp0inter/cpe
cpe/cpe2_3_fs.py
CPE2_3_FS.get_attribute_values
def get_attribute_values(self, att_name): """ Returns the values of attribute "att_name" of CPE Name. By default a only element in each part. :param string att_name: Attribute name to get :returns: List of attribute values :rtype: list :exception: ValueError - in...
python
def get_attribute_values(self, att_name): """ Returns the values of attribute "att_name" of CPE Name. By default a only element in each part. :param string att_name: Attribute name to get :returns: List of attribute values :rtype: list :exception: ValueError - in...
[ "def", "get_attribute_values", "(", "self", ",", "att_name", ")", ":", "lc", "=", "[", "]", "if", "not", "CPEComponent", ".", "is_valid_attribute", "(", "att_name", ")", ":", "errmsg", "=", "\"Invalid attribute name: {0}\"", ".", "format", "(", "att_name", ")"...
Returns the values of attribute "att_name" of CPE Name. By default a only element in each part. :param string att_name: Attribute name to get :returns: List of attribute values :rtype: list :exception: ValueError - invalid attribute name
[ "Returns", "the", "values", "of", "attribute", "att_name", "of", "CPE", "Name", ".", "By", "default", "a", "only", "element", "in", "each", "part", "." ]
train
https://github.com/nilp0inter/cpe/blob/670d947472a7652af5149324977b50f9a7af9bcf/cpe/cpe2_3_fs.py#L201-L233
nilp0inter/cpe
cpe/cpe2_2.py
CPE2_2._parse
def _parse(self): """ Checks if CPE Name is valid. :returns: None :exception: ValueError - bad-formed CPE Name """ # CPE Name must not have whitespaces if (self._str.find(" ") != -1): msg = "Bad-formed CPE Name: it must not have whitespaces" ...
python
def _parse(self): """ Checks if CPE Name is valid. :returns: None :exception: ValueError - bad-formed CPE Name """ # CPE Name must not have whitespaces if (self._str.find(" ") != -1): msg = "Bad-formed CPE Name: it must not have whitespaces" ...
[ "def", "_parse", "(", "self", ")", ":", "# CPE Name must not have whitespaces", "if", "(", "self", ".", "_str", ".", "find", "(", "\" \"", ")", "!=", "-", "1", ")", ":", "msg", "=", "\"Bad-formed CPE Name: it must not have whitespaces\"", "raise", "ValueError", ...
Checks if CPE Name is valid. :returns: None :exception: ValueError - bad-formed CPE Name
[ "Checks", "if", "CPE", "Name", "is", "valid", "." ]
train
https://github.com/nilp0inter/cpe/blob/670d947472a7652af5149324977b50f9a7af9bcf/cpe/cpe2_2.py#L127-L193
nilp0inter/cpe
cpe/cpe2_2.py
CPE2_2.as_wfn
def as_wfn(self): """ Returns the CPE Name as WFN string of version 2.3. Only shows the first seven components. :return: CPE Name as WFN string :rtype: string :exception: TypeError - incompatible version """ wfn = [] wfn.append(CPE2_3_WFN.CPE_PRE...
python
def as_wfn(self): """ Returns the CPE Name as WFN string of version 2.3. Only shows the first seven components. :return: CPE Name as WFN string :rtype: string :exception: TypeError - incompatible version """ wfn = [] wfn.append(CPE2_3_WFN.CPE_PRE...
[ "def", "as_wfn", "(", "self", ")", ":", "wfn", "=", "[", "]", "wfn", ".", "append", "(", "CPE2_3_WFN", ".", "CPE_PREFIX", ")", "for", "ck", "in", "CPEComponent", ".", "CPE_COMP_KEYS", ":", "lc", "=", "self", ".", "_get_attribute_components", "(", "ck", ...
Returns the CPE Name as WFN string of version 2.3. Only shows the first seven components. :return: CPE Name as WFN string :rtype: string :exception: TypeError - incompatible version
[ "Returns", "the", "CPE", "Name", "as", "WFN", "string", "of", "version", "2", ".", "3", ".", "Only", "shows", "the", "first", "seven", "components", "." ]
train
https://github.com/nilp0inter/cpe/blob/670d947472a7652af5149324977b50f9a7af9bcf/cpe/cpe2_2.py#L195-L238
nilp0inter/cpe
cpe/cpelang2_3.py
CPELanguage2_3._fact_ref_eval
def _fact_ref_eval(cls, cpeset, wfn): """ Returns True if wfn is a non-proper superset (True superset or equal to) any of the names in cpeset, otherwise False. :param CPESet cpeset: list of CPE bound Names. :param CPE2_3_WFN wfn: WFN CPE Name. :returns: True if wfn is a ...
python
def _fact_ref_eval(cls, cpeset, wfn): """ Returns True if wfn is a non-proper superset (True superset or equal to) any of the names in cpeset, otherwise False. :param CPESet cpeset: list of CPE bound Names. :param CPE2_3_WFN wfn: WFN CPE Name. :returns: True if wfn is a ...
[ "def", "_fact_ref_eval", "(", "cls", ",", "cpeset", ",", "wfn", ")", ":", "for", "n", "in", "cpeset", ":", "# Need to convert each n from bound form to WFN", "if", "(", "CPESet2_3", ".", "cpe_superset", "(", "wfn", ",", "n", ")", ")", ":", "return", "True", ...
Returns True if wfn is a non-proper superset (True superset or equal to) any of the names in cpeset, otherwise False. :param CPESet cpeset: list of CPE bound Names. :param CPE2_3_WFN wfn: WFN CPE Name. :returns: True if wfn is a non-proper superset any of the names in cpeset, otherwise ...
[ "Returns", "True", "if", "wfn", "is", "a", "non", "-", "proper", "superset", "(", "True", "superset", "or", "equal", "to", ")", "any", "of", "the", "names", "in", "cpeset", "otherwise", "False", "." ]
train
https://github.com/nilp0inter/cpe/blob/670d947472a7652af5149324977b50f9a7af9bcf/cpe/cpelang2_3.py#L62-L78
nilp0inter/cpe
cpe/cpelang2_3.py
CPELanguage2_3._check_fact_ref_eval
def _check_fact_ref_eval(cls, cpel_dom): """ Returns the result (True, False, Error) of performing the specified check, unless the check isn’t supported, in which case it returns False. Error is a catch-all for all results other than True and False. :param string cpel_do...
python
def _check_fact_ref_eval(cls, cpel_dom): """ Returns the result (True, False, Error) of performing the specified check, unless the check isn’t supported, in which case it returns False. Error is a catch-all for all results other than True and False. :param string cpel_do...
[ "def", "_check_fact_ref_eval", "(", "cls", ",", "cpel_dom", ")", ":", "CHECK_SYSTEM", "=", "\"check-system\"", "CHECK_LOCATION", "=", "\"check-location\"", "CHECK_ID", "=", "\"check-id\"", "checksystemID", "=", "cpel_dom", ".", "getAttribute", "(", "CHECK_SYSTEM", ")"...
Returns the result (True, False, Error) of performing the specified check, unless the check isn’t supported, in which case it returns False. Error is a catch-all for all results other than True and False. :param string cpel_dom: XML infoset for the check_fact_ref element. :retur...
[ "Returns", "the", "result", "(", "True", "False", "Error", ")", "of", "performing", "the", "specified", "check", "unless", "the", "check", "isn’t", "supported", "in", "which", "case", "it", "returns", "False", ".", "Error", "is", "a", "catch", "-", "all", ...
train
https://github.com/nilp0inter/cpe/blob/670d947472a7652af5149324977b50f9a7af9bcf/cpe/cpelang2_3.py#L81-L114
nilp0inter/cpe
cpe/cpelang2_3.py
CPELanguage2_3._unbind
def _unbind(cls, boundname): """ Unbinds a bound form to a WFN. :param string boundname: CPE name :returns: WFN object associated with boundname. :rtype: CPE2_3_WFN """ try: fs = CPE2_3_FS(boundname) except: # CPE name is not form...
python
def _unbind(cls, boundname): """ Unbinds a bound form to a WFN. :param string boundname: CPE name :returns: WFN object associated with boundname. :rtype: CPE2_3_WFN """ try: fs = CPE2_3_FS(boundname) except: # CPE name is not form...
[ "def", "_unbind", "(", "cls", ",", "boundname", ")", ":", "try", ":", "fs", "=", "CPE2_3_FS", "(", "boundname", ")", "except", ":", "# CPE name is not formatted string", "try", ":", "uri", "=", "CPE2_3_URI", "(", "boundname", ")", "except", ":", "# CPE name ...
Unbinds a bound form to a WFN. :param string boundname: CPE name :returns: WFN object associated with boundname. :rtype: CPE2_3_WFN
[ "Unbinds", "a", "bound", "form", "to", "a", "WFN", "." ]
train
https://github.com/nilp0inter/cpe/blob/670d947472a7652af5149324977b50f9a7af9bcf/cpe/cpelang2_3.py#L145-L166
nilp0inter/cpe
cpe/cpelang2_3.py
CPELanguage2_3.language_match
def language_match(self, cpeset, cpel_dom=None): """ Accepts a set of known CPE Names and an expression in the CPE language, and delivers the answer True if the expression matches with the set. Otherwise, it returns False. :param CPELanguage self: An expression in the CPE Applic...
python
def language_match(self, cpeset, cpel_dom=None): """ Accepts a set of known CPE Names and an expression in the CPE language, and delivers the answer True if the expression matches with the set. Otherwise, it returns False. :param CPELanguage self: An expression in the CPE Applic...
[ "def", "language_match", "(", "self", ",", "cpeset", ",", "cpel_dom", "=", "None", ")", ":", "# Root element tag", "TAG_ROOT", "=", "'#document'", "# A container for child platform definitions", "TAG_PLATSPEC", "=", "'cpe:platform-specification'", "# Information about a platf...
Accepts a set of known CPE Names and an expression in the CPE language, and delivers the answer True if the expression matches with the set. Otherwise, it returns False. :param CPELanguage self: An expression in the CPE Applicability Language, represented as the XML infoset for the ...
[ "Accepts", "a", "set", "of", "known", "CPE", "Names", "and", "an", "expression", "in", "the", "CPE", "language", "and", "delivers", "the", "answer", "True", "if", "the", "expression", "matches", "with", "the", "set", ".", "Otherwise", "it", "returns", "Fal...
train
https://github.com/nilp0inter/cpe/blob/670d947472a7652af5149324977b50f9a7af9bcf/cpe/cpelang2_3.py#L172-L277
nilp0inter/cpe
cpe/cpeset.py
CPESet.name_match
def name_match(self, cpe): """ Accepts a set of known instances of CPE Names and a candidate CPE Name, and returns 'True' if the candidate can be shown to be an instance based on the content of the known instances. Otherwise, it returns 'False'. :param CPESet self: A set...
python
def name_match(self, cpe): """ Accepts a set of known instances of CPE Names and a candidate CPE Name, and returns 'True' if the candidate can be shown to be an instance based on the content of the known instances. Otherwise, it returns 'False'. :param CPESet self: A set...
[ "def", "name_match", "(", "self", ",", "cpe", ")", ":", "# An empty set not matching with any CPE", "if", "len", "(", "self", ")", "==", "0", ":", "return", "False", "# If input CPE Name string is in set of CPE Name strings", "# not do searching more because there is a matchi...
Accepts a set of known instances of CPE Names and a candidate CPE Name, and returns 'True' if the candidate can be shown to be an instance based on the content of the known instances. Otherwise, it returns 'False'. :param CPESet self: A set of m known CPE Names K = {K1, K2, …, Km}. ...
[ "Accepts", "a", "set", "of", "known", "instances", "of", "CPE", "Names", "and", "a", "candidate", "CPE", "Name", "and", "returns", "True", "if", "the", "candidate", "can", "be", "shown", "to", "be", "an", "instance", "based", "on", "the", "content", "of"...
train
https://github.com/nilp0inter/cpe/blob/670d947472a7652af5149324977b50f9a7af9bcf/cpe/cpeset.py#L121-L195
nilp0inter/cpe
cpe/comp/cpecomp2_2.py
CPEComponent2_2._decode
def _decode(self): """ Convert the encoded value of component to standard value (WFN value). """ result = [] idx = 0 s = self._encoded_value while (idx < len(s)): # Get the idx'th character of s c = s[idx] if (c in CPECompone...
python
def _decode(self): """ Convert the encoded value of component to standard value (WFN value). """ result = [] idx = 0 s = self._encoded_value while (idx < len(s)): # Get the idx'th character of s c = s[idx] if (c in CPECompone...
[ "def", "_decode", "(", "self", ")", ":", "result", "=", "[", "]", "idx", "=", "0", "s", "=", "self", ".", "_encoded_value", "while", "(", "idx", "<", "len", "(", "s", ")", ")", ":", "# Get the idx'th character of s", "c", "=", "s", "[", "idx", "]",...
Convert the encoded value of component to standard value (WFN value).
[ "Convert", "the", "encoded", "value", "of", "component", "to", "standard", "value", "(", "WFN", "value", ")", "." ]
train
https://github.com/nilp0inter/cpe/blob/670d947472a7652af5149324977b50f9a7af9bcf/cpe/comp/cpecomp2_2.py#L90-L113
pysal/giddy
giddy/components.py
is_component
def is_component(w, ids): """Check if the set of ids form a single connected component Parameters ---------- w : spatial weights boject ids : list identifiers of units that are tested to be a single connected component Returns ------- True : if the list of ...
python
def is_component(w, ids): """Check if the set of ids form a single connected component Parameters ---------- w : spatial weights boject ids : list identifiers of units that are tested to be a single connected component Returns ------- True : if the list of ...
[ "def", "is_component", "(", "w", ",", "ids", ")", ":", "components", "=", "0", "marks", "=", "dict", "(", "[", "(", "node", ",", "0", ")", "for", "node", "in", "ids", "]", ")", "q", "=", "[", "]", "for", "node", "in", "ids", ":", "if", "marks...
Check if the set of ids form a single connected component Parameters ---------- w : spatial weights boject ids : list identifiers of units that are tested to be a single connected component Returns ------- True : if the list of ids represents a single connected...
[ "Check", "if", "the", "set", "of", "ids", "form", "a", "single", "connected", "component" ]
train
https://github.com/pysal/giddy/blob/13fae6c18933614be78e91a6b5060693bea33a04/giddy/components.py#L11-L50
pysal/giddy
giddy/components.py
check_contiguity
def check_contiguity(w, neighbors, leaver): """Check if contiguity is maintained if leaver is removed from neighbors Parameters ---------- w : spatial weights object simple contiguity based weights neighbors : list nodes that are to be checked if th...
python
def check_contiguity(w, neighbors, leaver): """Check if contiguity is maintained if leaver is removed from neighbors Parameters ---------- w : spatial weights object simple contiguity based weights neighbors : list nodes that are to be checked if th...
[ "def", "check_contiguity", "(", "w", ",", "neighbors", ",", "leaver", ")", ":", "ids", "=", "neighbors", "[", ":", "]", "ids", ".", "remove", "(", "leaver", ")", "return", "is_component", "(", "w", ",", "ids", ")" ]
Check if contiguity is maintained if leaver is removed from neighbors Parameters ---------- w : spatial weights object simple contiguity based weights neighbors : list nodes that are to be checked if they form a single \ connec...
[ "Check", "if", "contiguity", "is", "maintained", "if", "leaver", "is", "removed", "from", "neighbors" ]
train
https://github.com/pysal/giddy/blob/13fae6c18933614be78e91a6b5060693bea33a04/giddy/components.py#L53-L103
pyinvoke/invocations
invocations/console.py
confirm
def confirm(question, assume_yes=True): """ Ask user a yes/no question and return their response as a boolean. ``question`` should be a simple, grammatically complete question such as "Do you wish to continue?", and will have a string similar to ``" [Y/n] "`` appended automatically. This function w...
python
def confirm(question, assume_yes=True): """ Ask user a yes/no question and return their response as a boolean. ``question`` should be a simple, grammatically complete question such as "Do you wish to continue?", and will have a string similar to ``" [Y/n] "`` appended automatically. This function w...
[ "def", "confirm", "(", "question", ",", "assume_yes", "=", "True", ")", ":", "# Set up suffix", "if", "assume_yes", ":", "suffix", "=", "\"Y/n\"", "else", ":", "suffix", "=", "\"y/N\"", "# Loop till we get something we like", "# TODO: maybe don't do this? It can be anno...
Ask user a yes/no question and return their response as a boolean. ``question`` should be a simple, grammatically complete question such as "Do you wish to continue?", and will have a string similar to ``" [Y/n] "`` appended automatically. This function will *not* append a question mark for you. B...
[ "Ask", "user", "a", "yes", "/", "no", "question", "and", "return", "their", "response", "as", "a", "boolean", "." ]
train
https://github.com/pyinvoke/invocations/blob/bbf1b319bd1536817d5301ceb9eeb2f31830e5dc/invocations/console.py#L13-L59
kolypto/py-flask-jsontools
flask_jsontools/decorators.py
jsonapi
def jsonapi(f): """ Declare the view as a JSON API method This converts view return value into a :cls:JsonResponse. The following return types are supported: - tuple: a tuple of (response, status, headers) - any other object is converted to JSON """ @wraps(f) de...
python
def jsonapi(f): """ Declare the view as a JSON API method This converts view return value into a :cls:JsonResponse. The following return types are supported: - tuple: a tuple of (response, status, headers) - any other object is converted to JSON """ @wraps(f) de...
[ "def", "jsonapi", "(", "f", ")", ":", "@", "wraps", "(", "f", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "rv", "=", "f", "(", "*", "args", ",", "*", "*", "kwargs", ")", "return", "make_json_response", "(", "rv",...
Declare the view as a JSON API method This converts view return value into a :cls:JsonResponse. The following return types are supported: - tuple: a tuple of (response, status, headers) - any other object is converted to JSON
[ "Declare", "the", "view", "as", "a", "JSON", "API", "method" ]
train
https://github.com/kolypto/py-flask-jsontools/blob/1abee2d40e6db262e43f0c534e90faaa9b26246a/flask_jsontools/decorators.py#L6-L19
pyinvoke/invocations
invocations/packaging/vendorize.py
_unpack
def _unpack(c, tmp, package, version, git_url=None): """ Download + unpack given package into temp dir ``tmp``. Return ``(real_version, source)`` where ``real_version`` is the "actual" version downloaded (e.g. if a Git master was indicated, it will be the SHA of master HEAD) and ``source`` is the s...
python
def _unpack(c, tmp, package, version, git_url=None): """ Download + unpack given package into temp dir ``tmp``. Return ``(real_version, source)`` where ``real_version`` is the "actual" version downloaded (e.g. if a Git master was indicated, it will be the SHA of master HEAD) and ``source`` is the s...
[ "def", "_unpack", "(", "c", ",", "tmp", ",", "package", ",", "version", ",", "git_url", "=", "None", ")", ":", "real_version", "=", "version", "[", ":", "]", "source", "=", "None", "if", "git_url", ":", "pass", "# git clone into tempdir", "# git checko...
Download + unpack given package into temp dir ``tmp``. Return ``(real_version, source)`` where ``real_version`` is the "actual" version downloaded (e.g. if a Git master was indicated, it will be the SHA of master HEAD) and ``source`` is the source directory (relative to unpacked source) to import into ...
[ "Download", "+", "unpack", "given", "package", "into", "temp", "dir", "tmp", "." ]
train
https://github.com/pyinvoke/invocations/blob/bbf1b319bd1536817d5301ceb9eeb2f31830e5dc/invocations/packaging/vendorize.py#L13-L60
pyinvoke/invocations
invocations/packaging/vendorize.py
vendorize
def vendorize( c, distribution, version, vendor_dir, package=None, git_url=None, license=None, ): """ Vendorize Python package ``distribution`` at version/SHA ``version``. Specify the vendor folder (e.g. ``<mypackage>/vendor``) as ``vendor_dir``. For Crate/PyPI releases, ``...
python
def vendorize( c, distribution, version, vendor_dir, package=None, git_url=None, license=None, ): """ Vendorize Python package ``distribution`` at version/SHA ``version``. Specify the vendor folder (e.g. ``<mypackage>/vendor``) as ``vendor_dir``. For Crate/PyPI releases, ``...
[ "def", "vendorize", "(", "c", ",", "distribution", ",", "version", ",", "vendor_dir", ",", "package", "=", "None", ",", "git_url", "=", "None", ",", "license", "=", "None", ",", ")", ":", "with", "tmpdir", "(", ")", "as", "tmp", ":", "package", "=", ...
Vendorize Python package ``distribution`` at version/SHA ``version``. Specify the vendor folder (e.g. ``<mypackage>/vendor``) as ``vendor_dir``. For Crate/PyPI releases, ``package`` should be the name of the software entry on those sites, and ``version`` should be a specific version number. E.g. ``ven...
[ "Vendorize", "Python", "package", "distribution", "at", "version", "/", "SHA", "version", "." ]
train
https://github.com/pyinvoke/invocations/blob/bbf1b319bd1536817d5301ceb9eeb2f31830e5dc/invocations/packaging/vendorize.py#L64-L118
pyinvoke/invocations
invocations/travis.py
make_sudouser
def make_sudouser(c): """ Create a passworded sudo-capable user. Used by other tasks to execute the test suite so sudo tests work. """ user = c.travis.sudo.user password = c.travis.sudo.password # --create-home because we need a place to put conf files, keys etc # --groups travis becaus...
python
def make_sudouser(c): """ Create a passworded sudo-capable user. Used by other tasks to execute the test suite so sudo tests work. """ user = c.travis.sudo.user password = c.travis.sudo.password # --create-home because we need a place to put conf files, keys etc # --groups travis becaus...
[ "def", "make_sudouser", "(", "c", ")", ":", "user", "=", "c", ".", "travis", ".", "sudo", ".", "user", "password", "=", "c", ".", "travis", ".", "sudo", ".", "password", "# --create-home because we need a place to put conf files, keys etc", "# --groups travis becaus...
Create a passworded sudo-capable user. Used by other tasks to execute the test suite so sudo tests work.
[ "Create", "a", "passworded", "sudo", "-", "capable", "user", "." ]
train
https://github.com/pyinvoke/invocations/blob/bbf1b319bd1536817d5301ceb9eeb2f31830e5dc/invocations/travis.py#L26-L49
pyinvoke/invocations
invocations/travis.py
make_sshable
def make_sshable(c): """ Set up passwordless SSH keypair & authorized_hosts access to localhost. """ user = c.travis.sudo.user home = "~{0}".format(user) # Run sudo() as the new sudo user; means less chown'ing, etc. c.config.sudo.user = user ssh_dir = "{0}/.ssh".format(home) # TODO: ...
python
def make_sshable(c): """ Set up passwordless SSH keypair & authorized_hosts access to localhost. """ user = c.travis.sudo.user home = "~{0}".format(user) # Run sudo() as the new sudo user; means less chown'ing, etc. c.config.sudo.user = user ssh_dir = "{0}/.ssh".format(home) # TODO: ...
[ "def", "make_sshable", "(", "c", ")", ":", "user", "=", "c", ".", "travis", ".", "sudo", ".", "user", "home", "=", "\"~{0}\"", ".", "format", "(", "user", ")", "# Run sudo() as the new sudo user; means less chown'ing, etc.", "c", ".", "config", ".", "sudo", ...
Set up passwordless SSH keypair & authorized_hosts access to localhost.
[ "Set", "up", "passwordless", "SSH", "keypair", "&", "authorized_hosts", "access", "to", "localhost", "." ]
train
https://github.com/pyinvoke/invocations/blob/bbf1b319bd1536817d5301ceb9eeb2f31830e5dc/invocations/travis.py#L55-L68
pyinvoke/invocations
invocations/travis.py
sudo_run
def sudo_run(c, command): """ Run some command under Travis-oriented sudo subshell/virtualenv. :param str command: Command string to run, e.g. ``inv coverage``, ``inv integration``, etc. (Does not necessarily need to be an Invoke task, but...) """ # NOTE: explicit shell wrapper beca...
python
def sudo_run(c, command): """ Run some command under Travis-oriented sudo subshell/virtualenv. :param str command: Command string to run, e.g. ``inv coverage``, ``inv integration``, etc. (Does not necessarily need to be an Invoke task, but...) """ # NOTE: explicit shell wrapper beca...
[ "def", "sudo_run", "(", "c", ",", "command", ")", ":", "# NOTE: explicit shell wrapper because sourcing the venv works best here;", "# test tasks currently use their own subshell to call e.g. 'pytest --blah',", "# so the tactic of '$VIRTUAL_ENV/bin/inv coverage' doesn't help - only that", "# i...
Run some command under Travis-oriented sudo subshell/virtualenv. :param str command: Command string to run, e.g. ``inv coverage``, ``inv integration``, etc. (Does not necessarily need to be an Invoke task, but...)
[ "Run", "some", "command", "under", "Travis", "-", "oriented", "sudo", "subshell", "/", "virtualenv", "." ]
train
https://github.com/pyinvoke/invocations/blob/bbf1b319bd1536817d5301ceb9eeb2f31830e5dc/invocations/travis.py#L72-L85
pyinvoke/invocations
invocations/travis.py
blacken
def blacken(c): """ Install and execute ``black`` under appropriate circumstances, with diffs. Installs and runs ``black`` under Python 3.6 (the first version it supports). Since this sort of CI based task only needs to run once per commit (formatting is not going to change between interpreters) th...
python
def blacken(c): """ Install and execute ``black`` under appropriate circumstances, with diffs. Installs and runs ``black`` under Python 3.6 (the first version it supports). Since this sort of CI based task only needs to run once per commit (formatting is not going to change between interpreters) th...
[ "def", "blacken", "(", "c", ")", ":", "if", "not", "PYTHON", ".", "startswith", "(", "\"3.6\"", ")", ":", "msg", "=", "\"Not blackening, since Python {} != Python 3.6\"", ".", "format", "(", "PYTHON", ")", "print", "(", "msg", ",", "file", "=", "sys", ".",...
Install and execute ``black`` under appropriate circumstances, with diffs. Installs and runs ``black`` under Python 3.6 (the first version it supports). Since this sort of CI based task only needs to run once per commit (formatting is not going to change between interpreters) this seems like a worthwhi...
[ "Install", "and", "execute", "black", "under", "appropriate", "circumstances", "with", "diffs", "." ]
train
https://github.com/pyinvoke/invocations/blob/bbf1b319bd1536817d5301ceb9eeb2f31830e5dc/invocations/travis.py#L166-L190
pysal/giddy
giddy/rank.py
Tau._calc
def _calc(self, x, y): """ List based implementation of binary tree algorithm for concordance measure after :cite:`Christensen2005`. """ x = np.array(x) y = np.array(y) n = len(y) perm = list(range(n)) perm.sort(key=lambda a: (x[a], y[a])) ...
python
def _calc(self, x, y): """ List based implementation of binary tree algorithm for concordance measure after :cite:`Christensen2005`. """ x = np.array(x) y = np.array(y) n = len(y) perm = list(range(n)) perm.sort(key=lambda a: (x[a], y[a])) ...
[ "def", "_calc", "(", "self", ",", "x", ",", "y", ")", ":", "x", "=", "np", ".", "array", "(", "x", ")", "y", "=", "np", ".", "array", "(", "y", ")", "n", "=", "len", "(", "y", ")", "perm", "=", "list", "(", "range", "(", "n", ")", ")", ...
List based implementation of binary tree algorithm for concordance measure after :cite:`Christensen2005`.
[ "List", "based", "implementation", "of", "binary", "tree", "algorithm", "for", "concordance", "measure", "after", ":", "cite", ":", "Christensen2005", "." ]
train
https://github.com/pysal/giddy/blob/13fae6c18933614be78e91a6b5060693bea33a04/giddy/rank.py#L171-L261
kolypto/py-flask-jsontools
flask_jsontools/views.py
_MethodViewInfo.decorator
def decorator(self, func): """ Wrapper function to decorate a function """ if inspect.isfunction(func): func._methodview = self elif inspect.ismethod(func): func.__func__._methodview = self else: raise AssertionError('Can only decorate function and met...
python
def decorator(self, func): """ Wrapper function to decorate a function """ if inspect.isfunction(func): func._methodview = self elif inspect.ismethod(func): func.__func__._methodview = self else: raise AssertionError('Can only decorate function and met...
[ "def", "decorator", "(", "self", ",", "func", ")", ":", "if", "inspect", ".", "isfunction", "(", "func", ")", ":", "func", ".", "_methodview", "=", "self", "elif", "inspect", ".", "ismethod", "(", "func", ")", ":", "func", ".", "__func__", ".", "_met...
Wrapper function to decorate a function
[ "Wrapper", "function", "to", "decorate", "a", "function" ]
train
https://github.com/kolypto/py-flask-jsontools/blob/1abee2d40e6db262e43f0c534e90faaa9b26246a/flask_jsontools/views.py#L30-L38
kolypto/py-flask-jsontools
flask_jsontools/views.py
_MethodViewInfo.matches
def matches(self, verb, params): """ Test if the method matches the provided set of arguments :param verb: HTTP verb. Uppercase :type verb: str :param params: Existing route parameters :type params: set :returns: Whether this view matches :rtype: bool """...
python
def matches(self, verb, params): """ Test if the method matches the provided set of arguments :param verb: HTTP verb. Uppercase :type verb: str :param params: Existing route parameters :type params: set :returns: Whether this view matches :rtype: bool """...
[ "def", "matches", "(", "self", ",", "verb", ",", "params", ")", ":", "return", "(", "self", ".", "ifset", "is", "None", "or", "self", ".", "ifset", "<=", "params", ")", "and", "(", "self", ".", "ifnset", "is", "None", "or", "self", ".", "ifnset", ...
Test if the method matches the provided set of arguments :param verb: HTTP verb. Uppercase :type verb: str :param params: Existing route parameters :type params: set :returns: Whether this view matches :rtype: bool
[ "Test", "if", "the", "method", "matches", "the", "provided", "set", "of", "arguments" ]
train
https://github.com/kolypto/py-flask-jsontools/blob/1abee2d40e6db262e43f0c534e90faaa9b26246a/flask_jsontools/views.py#L63-L75
kolypto/py-flask-jsontools
flask_jsontools/views.py
MethodView._match_view
def _match_view(self, method, route_params): """ Detect a view matching the query :param method: HTTP method :param route_params: Route parameters dict :return: Method :rtype: Callable|None """ method = method.upper() route_params = frozenset(k for k, v i...
python
def _match_view(self, method, route_params): """ Detect a view matching the query :param method: HTTP method :param route_params: Route parameters dict :return: Method :rtype: Callable|None """ method = method.upper() route_params = frozenset(k for k, v i...
[ "def", "_match_view", "(", "self", ",", "method", ",", "route_params", ")", ":", "method", "=", "method", ".", "upper", "(", ")", "route_params", "=", "frozenset", "(", "k", "for", "k", ",", "v", "in", "route_params", ".", "items", "(", ")", "if", "v...
Detect a view matching the query :param method: HTTP method :param route_params: Route parameters dict :return: Method :rtype: Callable|None
[ "Detect", "a", "view", "matching", "the", "query" ]
train
https://github.com/kolypto/py-flask-jsontools/blob/1abee2d40e6db262e43f0c534e90faaa9b26246a/flask_jsontools/views.py#L112-L127
kolypto/py-flask-jsontools
flask_jsontools/views.py
MethodView.route_as_view
def route_as_view(cls, app, name, rules, *class_args, **class_kwargs): """ Register the view with an URL route :param app: Flask application :type app: flask.Flask|flask.Blueprint :param name: Unique view name :type name: str :param rules: List of route rules to use ...
python
def route_as_view(cls, app, name, rules, *class_args, **class_kwargs): """ Register the view with an URL route :param app: Flask application :type app: flask.Flask|flask.Blueprint :param name: Unique view name :type name: str :param rules: List of route rules to use ...
[ "def", "route_as_view", "(", "cls", ",", "app", ",", "name", ",", "rules", ",", "*", "class_args", ",", "*", "*", "class_kwargs", ")", ":", "view", "=", "super", "(", "MethodView", ",", "cls", ")", ".", "as_view", "(", "name", ",", "*", "class_args",...
Register the view with an URL route :param app: Flask application :type app: flask.Flask|flask.Blueprint :param name: Unique view name :type name: str :param rules: List of route rules to use :type rules: Iterable[str|werkzeug.routing.Rule] :param class_args: Args...
[ "Register", "the", "view", "with", "an", "URL", "route", ":", "param", "app", ":", "Flask", "application", ":", "type", "app", ":", "flask", ".", "Flask|flask", ".", "Blueprint", ":", "param", "name", ":", "Unique", "view", "name", ":", "type", "name", ...
train
https://github.com/kolypto/py-flask-jsontools/blob/1abee2d40e6db262e43f0c534e90faaa9b26246a/flask_jsontools/views.py#L136-L152
pysal/giddy
giddy/ergodic.py
steady_state
def steady_state(P): """ Calculates the steady state probability vector for a regular Markov transition matrix P. Parameters ---------- P : array (k, k), an ergodic Markov transition probability matrix. Returns ------- : array (k, ), st...
python
def steady_state(P): """ Calculates the steady state probability vector for a regular Markov transition matrix P. Parameters ---------- P : array (k, k), an ergodic Markov transition probability matrix. Returns ------- : array (k, ), st...
[ "def", "steady_state", "(", "P", ")", ":", "v", ",", "d", "=", "la", ".", "eig", "(", "np", ".", "transpose", "(", "P", ")", ")", "d", "=", "np", ".", "array", "(", "d", ")", "# for a regular P maximum eigenvalue will be 1", "mv", "=", "max", "(", ...
Calculates the steady state probability vector for a regular Markov transition matrix P. Parameters ---------- P : array (k, k), an ergodic Markov transition probability matrix. Returns ------- : array (k, ), steady state distribution. Exa...
[ "Calculates", "the", "steady", "state", "probability", "vector", "for", "a", "regular", "Markov", "transition", "matrix", "P", "." ]
train
https://github.com/pysal/giddy/blob/13fae6c18933614be78e91a6b5060693bea33a04/giddy/ergodic.py#L12-L59
pysal/giddy
giddy/ergodic.py
fmpt
def fmpt(P): """ Calculates the matrix of first mean passage times for an ergodic transition probability matrix. Parameters ---------- P : array (k, k), an ergodic Markov transition probability matrix. Returns ------- M : array (k, k), elements are the e...
python
def fmpt(P): """ Calculates the matrix of first mean passage times for an ergodic transition probability matrix. Parameters ---------- P : array (k, k), an ergodic Markov transition probability matrix. Returns ------- M : array (k, k), elements are the e...
[ "def", "fmpt", "(", "P", ")", ":", "P", "=", "np", ".", "matrix", "(", "P", ")", "k", "=", "P", ".", "shape", "[", "0", "]", "A", "=", "np", ".", "zeros_like", "(", "P", ")", "ss", "=", "steady_state", "(", "P", ")", ".", "reshape", "(", ...
Calculates the matrix of first mean passage times for an ergodic transition probability matrix. Parameters ---------- P : array (k, k), an ergodic Markov transition probability matrix. Returns ------- M : array (k, k), elements are the expected value for the num...
[ "Calculates", "the", "matrix", "of", "first", "mean", "passage", "times", "for", "an", "ergodic", "transition", "probability", "matrix", "." ]
train
https://github.com/pysal/giddy/blob/13fae6c18933614be78e91a6b5060693bea33a04/giddy/ergodic.py#L62-L118
pysal/giddy
giddy/ergodic.py
var_fmpt
def var_fmpt(P): """ Variances of first mean passage times for an ergodic transition probability matrix. Parameters ---------- P : array (k, k), an ergodic Markov transition probability matrix. Returns ------- : array (k, k), elements are the v...
python
def var_fmpt(P): """ Variances of first mean passage times for an ergodic transition probability matrix. Parameters ---------- P : array (k, k), an ergodic Markov transition probability matrix. Returns ------- : array (k, k), elements are the v...
[ "def", "var_fmpt", "(", "P", ")", ":", "P", "=", "np", ".", "matrix", "(", "P", ")", "A", "=", "P", "**", "1000", "n", ",", "k", "=", "A", ".", "shape", "I", "=", "np", ".", "identity", "(", "k", ")", "Z", "=", "la", ".", "inv", "(", "I...
Variances of first mean passage times for an ergodic transition probability matrix. Parameters ---------- P : array (k, k), an ergodic Markov transition probability matrix. Returns ------- : array (k, k), elements are the variances for the number of in...
[ "Variances", "of", "first", "mean", "passage", "times", "for", "an", "ergodic", "transition", "probability", "matrix", "." ]
train
https://github.com/pysal/giddy/blob/13fae6c18933614be78e91a6b5060693bea33a04/giddy/ergodic.py#L121-L167
pyinvoke/invocations
invocations/packaging/release.py
_converge
def _converge(c): """ Examine world state, returning data on what needs updating for release. :param c: Invoke ``Context`` object or subclass. :returns: Two dicts (technically, dict subclasses, which allow attribute access), ``actions`` and ``state`` (in that order.) ``actions...
python
def _converge(c): """ Examine world state, returning data on what needs updating for release. :param c: Invoke ``Context`` object or subclass. :returns: Two dicts (technically, dict subclasses, which allow attribute access), ``actions`` and ``state`` (in that order.) ``actions...
[ "def", "_converge", "(", "c", ")", ":", "#", "# Data/state gathering", "#", "# Get data about current repo context: what branch are we on & what kind of", "# release does it appear to represent?", "branch", ",", "release_type", "=", "_release_line", "(", "c", ")", "# Short-circ...
Examine world state, returning data on what needs updating for release. :param c: Invoke ``Context`` object or subclass. :returns: Two dicts (technically, dict subclasses, which allow attribute access), ``actions`` and ``state`` (in that order.) ``actions`` maps release component name...
[ "Examine", "world", "state", "returning", "data", "on", "what", "needs", "updating", "for", "release", "." ]
train
https://github.com/pyinvoke/invocations/blob/bbf1b319bd1536817d5301ceb9eeb2f31830e5dc/invocations/packaging/release.py#L110-L240
pyinvoke/invocations
invocations/packaging/release.py
status
def status(c): """ Print current release (version, changelog, tag, etc) status. Doubles as a subroutine, returning the return values from its inner call to ``_converge`` (an ``(actions, state)`` two-tuple of Lexicons). """ # TODO: wants some holistic "you don't actually HAVE any changes to ...
python
def status(c): """ Print current release (version, changelog, tag, etc) status. Doubles as a subroutine, returning the return values from its inner call to ``_converge`` (an ``(actions, state)`` two-tuple of Lexicons). """ # TODO: wants some holistic "you don't actually HAVE any changes to ...
[ "def", "status", "(", "c", ")", ":", "# TODO: wants some holistic \"you don't actually HAVE any changes to", "# release\" final status - i.e. all steps were at no-op status.", "actions", ",", "state", "=", "_converge", "(", "c", ")", "table", "=", "[", "]", "# NOTE: explicit ...
Print current release (version, changelog, tag, etc) status. Doubles as a subroutine, returning the return values from its inner call to ``_converge`` (an ``(actions, state)`` two-tuple of Lexicons).
[ "Print", "current", "release", "(", "version", "changelog", "tag", "etc", ")", "status", "." ]
train
https://github.com/pyinvoke/invocations/blob/bbf1b319bd1536817d5301ceb9eeb2f31830e5dc/invocations/packaging/release.py#L244-L260
pyinvoke/invocations
invocations/packaging/release.py
prepare
def prepare(c): """ Edit changelog & version, git commit, and git tag, to set up for release. """ # Print dry-run/status/actions-to-take data & grab programmatic result # TODO: maybe expand the enum-based stuff to have values that split up # textual description, command string, etc. See the TODO...
python
def prepare(c): """ Edit changelog & version, git commit, and git tag, to set up for release. """ # Print dry-run/status/actions-to-take data & grab programmatic result # TODO: maybe expand the enum-based stuff to have values that split up # textual description, command string, etc. See the TODO...
[ "def", "prepare", "(", "c", ")", ":", "# Print dry-run/status/actions-to-take data & grab programmatic result", "# TODO: maybe expand the enum-based stuff to have values that split up", "# textual description, command string, etc. See the TODO up by their", "# definition too, re: just making them ...
Edit changelog & version, git commit, and git tag, to set up for release.
[ "Edit", "changelog", "&", "version", "git", "commit", "and", "git", "tag", "to", "set", "up", "for", "release", "." ]
train
https://github.com/pyinvoke/invocations/blob/bbf1b319bd1536817d5301ceb9eeb2f31830e5dc/invocations/packaging/release.py#L277-L325
pyinvoke/invocations
invocations/packaging/release.py
_release_line
def _release_line(c): """ Examine current repo state to determine what type of release to prep. :returns: A two-tuple of ``(branch-name, line-type)`` where: - ``branch-name`` is the current branch name, e.g. ``1.1``, ``master``, ``gobbledygook`` (or, usually, ``HEAD`` if not on a...
python
def _release_line(c): """ Examine current repo state to determine what type of release to prep. :returns: A two-tuple of ``(branch-name, line-type)`` where: - ``branch-name`` is the current branch name, e.g. ``1.1``, ``master``, ``gobbledygook`` (or, usually, ``HEAD`` if not on a...
[ "def", "_release_line", "(", "c", ")", ":", "# TODO: I don't _think_ this technically overlaps with Releases (because", "# that only ever deals with changelog contents, and therefore full release", "# version numbers) but in case it does, move it there sometime.", "# TODO: this and similar calls i...
Examine current repo state to determine what type of release to prep. :returns: A two-tuple of ``(branch-name, line-type)`` where: - ``branch-name`` is the current branch name, e.g. ``1.1``, ``master``, ``gobbledygook`` (or, usually, ``HEAD`` if not on a branch). - ``line-type`` ...
[ "Examine", "current", "repo", "state", "to", "determine", "what", "type", "of", "release", "to", "prep", "." ]
train
https://github.com/pyinvoke/invocations/blob/bbf1b319bd1536817d5301ceb9eeb2f31830e5dc/invocations/packaging/release.py#L330-L364
pyinvoke/invocations
invocations/packaging/release.py
_versions_from_changelog
def _versions_from_changelog(changelog): """ Return all released versions from given ``changelog``, sorted. :param dict changelog: A changelog dict as returned by ``releases.util.parse_changelog``. :returns: A sorted list of `semantic_version.Version` objects. """ versions = [Version(x...
python
def _versions_from_changelog(changelog): """ Return all released versions from given ``changelog``, sorted. :param dict changelog: A changelog dict as returned by ``releases.util.parse_changelog``. :returns: A sorted list of `semantic_version.Version` objects. """ versions = [Version(x...
[ "def", "_versions_from_changelog", "(", "changelog", ")", ":", "versions", "=", "[", "Version", "(", "x", ")", "for", "x", "in", "changelog", "if", "BUGFIX_RELEASE_RE", ".", "match", "(", "x", ")", "]", "return", "sorted", "(", "versions", ")" ]
Return all released versions from given ``changelog``, sorted. :param dict changelog: A changelog dict as returned by ``releases.util.parse_changelog``. :returns: A sorted list of `semantic_version.Version` objects.
[ "Return", "all", "released", "versions", "from", "given", "changelog", "sorted", "." ]
train
https://github.com/pyinvoke/invocations/blob/bbf1b319bd1536817d5301ceb9eeb2f31830e5dc/invocations/packaging/release.py#L381-L391
pyinvoke/invocations
invocations/packaging/release.py
_release_and_issues
def _release_and_issues(changelog, branch, release_type): """ Return most recent branch-appropriate release, if any, and its contents. :param dict changelog: Changelog contents, as returned by ``releases.util.parse_changelog``. :param str branch: Branch name. :param release_type: ...
python
def _release_and_issues(changelog, branch, release_type): """ Return most recent branch-appropriate release, if any, and its contents. :param dict changelog: Changelog contents, as returned by ``releases.util.parse_changelog``. :param str branch: Branch name. :param release_type: ...
[ "def", "_release_and_issues", "(", "changelog", ",", "branch", ",", "release_type", ")", ":", "# Bugfix lines just use the branch to find issues", "bucket", "=", "branch", "# Features need a bit more logic", "if", "release_type", "is", "Release", ".", "FEATURE", ":", "buc...
Return most recent branch-appropriate release, if any, and its contents. :param dict changelog: Changelog contents, as returned by ``releases.util.parse_changelog``. :param str branch: Branch name. :param release_type: Member of `Release`, e.g. `Release.FEATURE`. :returns: ...
[ "Return", "most", "recent", "branch", "-", "appropriate", "release", "if", "any", "and", "its", "contents", "." ]
train
https://github.com/pyinvoke/invocations/blob/bbf1b319bd1536817d5301ceb9eeb2f31830e5dc/invocations/packaging/release.py#L395-L427
pyinvoke/invocations
invocations/packaging/release.py
_get_tags
def _get_tags(c): """ Return sorted list of release-style tags as semver objects. """ tags_ = [] for tagstr in c.run("git tag", hide=True).stdout.strip().split("\n"): try: tags_.append(Version(tagstr)) # Ignore anything non-semver; most of the time they'll be non-release ...
python
def _get_tags(c): """ Return sorted list of release-style tags as semver objects. """ tags_ = [] for tagstr in c.run("git tag", hide=True).stdout.strip().split("\n"): try: tags_.append(Version(tagstr)) # Ignore anything non-semver; most of the time they'll be non-release ...
[ "def", "_get_tags", "(", "c", ")", ":", "tags_", "=", "[", "]", "for", "tagstr", "in", "c", ".", "run", "(", "\"git tag\"", ",", "hide", "=", "True", ")", ".", "stdout", ".", "strip", "(", ")", ".", "split", "(", "\"\\n\"", ")", ":", "try", ":"...
Return sorted list of release-style tags as semver objects.
[ "Return", "sorted", "list", "of", "release", "-", "style", "tags", "as", "semver", "objects", "." ]
train
https://github.com/pyinvoke/invocations/blob/bbf1b319bd1536817d5301ceb9eeb2f31830e5dc/invocations/packaging/release.py#L430-L445
pyinvoke/invocations
invocations/packaging/release.py
_find_package
def _find_package(c): """ Try to find 'the' One True Package for this project. Mostly for obtaining the ``_version`` file within it. Uses the ``packaging.package`` config setting if defined. If not defined, fallback is to look for a single top-level Python package (directory containing ``__ini...
python
def _find_package(c): """ Try to find 'the' One True Package for this project. Mostly for obtaining the ``_version`` file within it. Uses the ``packaging.package`` config setting if defined. If not defined, fallback is to look for a single top-level Python package (directory containing ``__ini...
[ "def", "_find_package", "(", "c", ")", ":", "# TODO: is there a way to get this from the same place setup.py does w/o", "# setup.py barfing (since setup() runs at import time and assumes CLI use)?", "configured_value", "=", "c", ".", "get", "(", "\"packaging\"", ",", "{", "}", ")...
Try to find 'the' One True Package for this project. Mostly for obtaining the ``_version`` file within it. Uses the ``packaging.package`` config setting if defined. If not defined, fallback is to look for a single top-level Python package (directory containing ``__init__.py``). (This search ignores a ...
[ "Try", "to", "find", "the", "One", "True", "Package", "for", "this", "project", "." ]
train
https://github.com/pyinvoke/invocations/blob/bbf1b319bd1536817d5301ceb9eeb2f31830e5dc/invocations/packaging/release.py#L471-L502
pyinvoke/invocations
invocations/packaging/release.py
build
def build(c, sdist=True, wheel=False, directory=None, python=None, clean=True): """ Build sdist and/or wheel archives, optionally in a temp base directory. All parameters save ``directory`` honor config settings of the same name, under the ``packaging`` tree. E.g. say ``.configure({'packaging': {'wheel...
python
def build(c, sdist=True, wheel=False, directory=None, python=None, clean=True): """ Build sdist and/or wheel archives, optionally in a temp base directory. All parameters save ``directory`` honor config settings of the same name, under the ``packaging`` tree. E.g. say ``.configure({'packaging': {'wheel...
[ "def", "build", "(", "c", ",", "sdist", "=", "True", ",", "wheel", "=", "False", ",", "directory", "=", "None", ",", "python", "=", "None", ",", "clean", "=", "True", ")", ":", "# Config hooks", "config", "=", "c", ".", "config", ".", "get", "(", ...
Build sdist and/or wheel archives, optionally in a temp base directory. All parameters save ``directory`` honor config settings of the same name, under the ``packaging`` tree. E.g. say ``.configure({'packaging': {'wheel': True}})`` to force building wheel archives by default. :param bool sdist: ...
[ "Build", "sdist", "and", "/", "or", "wheel", "archives", "optionally", "in", "a", "temp", "base", "directory", "." ]
train
https://github.com/pyinvoke/invocations/blob/bbf1b319bd1536817d5301ceb9eeb2f31830e5dc/invocations/packaging/release.py#L518-L590
pyinvoke/invocations
invocations/packaging/release.py
publish
def publish( c, sdist=True, wheel=False, index=None, sign=False, dry_run=False, directory=None, dual_wheels=False, alt_python=None, check_desc=False, ): """ Publish code to PyPI or index of choice. All parameters save ``dry_run`` and ``directory`` honor config settin...
python
def publish( c, sdist=True, wheel=False, index=None, sign=False, dry_run=False, directory=None, dual_wheels=False, alt_python=None, check_desc=False, ): """ Publish code to PyPI or index of choice. All parameters save ``dry_run`` and ``directory`` honor config settin...
[ "def", "publish", "(", "c", ",", "sdist", "=", "True", ",", "wheel", "=", "False", ",", "index", "=", "None", ",", "sign", "=", "False", ",", "dry_run", "=", "False", ",", "directory", "=", "None", ",", "dual_wheels", "=", "False", ",", "alt_python",...
Publish code to PyPI or index of choice. All parameters save ``dry_run`` and ``directory`` honor config settings of the same name, under the ``packaging`` tree. E.g. say ``.configure({'packaging': {'wheel': True}})`` to force building wheel archives by default. :param bool sdist: Whether t...
[ "Publish", "code", "to", "PyPI", "or", "index", "of", "choice", "." ]
train
https://github.com/pyinvoke/invocations/blob/bbf1b319bd1536817d5301ceb9eeb2f31830e5dc/invocations/packaging/release.py#L605-L700
pyinvoke/invocations
invocations/packaging/release.py
upload
def upload(c, directory, index=None, sign=False, dry_run=False): """ Upload (potentially also signing) all artifacts in ``directory``. :param str index: Custom upload index/repository name. By default, uses whatever the invoked ``pip`` is configured to use. Modify your ``pypirc`` f...
python
def upload(c, directory, index=None, sign=False, dry_run=False): """ Upload (potentially also signing) all artifacts in ``directory``. :param str index: Custom upload index/repository name. By default, uses whatever the invoked ``pip`` is configured to use. Modify your ``pypirc`` f...
[ "def", "upload", "(", "c", ",", "directory", ",", "index", "=", "None", ",", "sign", "=", "False", ",", "dry_run", "=", "False", ")", ":", "# Obtain list of archive filenames, then ensure any wheels come first", "# so their improved metadata is what PyPI sees initially (oth...
Upload (potentially also signing) all artifacts in ``directory``. :param str index: Custom upload index/repository name. By default, uses whatever the invoked ``pip`` is configured to use. Modify your ``pypirc`` file to add new named repositories. :param bool sign: Whether to ...
[ "Upload", "(", "potentially", "also", "signing", ")", "all", "artifacts", "in", "directory", "." ]
train
https://github.com/pyinvoke/invocations/blob/bbf1b319bd1536817d5301ceb9eeb2f31830e5dc/invocations/packaging/release.py#L703-L766
pyinvoke/invocations
invocations/util.py
tmpdir
def tmpdir(skip_cleanup=False, explicit=None): """ Context-manage a temporary directory. Can be given ``skip_cleanup`` to skip cleanup, and ``explicit`` to choose a specific location. (If both are given, this is basically not doing anything, but it allows code that normally requires a secure t...
python
def tmpdir(skip_cleanup=False, explicit=None): """ Context-manage a temporary directory. Can be given ``skip_cleanup`` to skip cleanup, and ``explicit`` to choose a specific location. (If both are given, this is basically not doing anything, but it allows code that normally requires a secure t...
[ "def", "tmpdir", "(", "skip_cleanup", "=", "False", ",", "explicit", "=", "None", ")", ":", "tmp", "=", "explicit", "if", "explicit", "is", "not", "None", "else", "mkdtemp", "(", ")", "try", ":", "yield", "tmp", "finally", ":", "if", "not", "skip_clean...
Context-manage a temporary directory. Can be given ``skip_cleanup`` to skip cleanup, and ``explicit`` to choose a specific location. (If both are given, this is basically not doing anything, but it allows code that normally requires a secure temporary directory to 'dry run' instead.)
[ "Context", "-", "manage", "a", "temporary", "directory", "." ]
train
https://github.com/pyinvoke/invocations/blob/bbf1b319bd1536817d5301ceb9eeb2f31830e5dc/invocations/util.py#L7-L23
pysal/giddy
giddy/directional.py
Rose.permute
def permute(self, permutations=99, alternative='two.sided'): """ Generate ransom spatial permutations for inference on LISA vectors. Parameters ---------- permutations : int, optional Number of random permutations of observations. alternative : string, option...
python
def permute(self, permutations=99, alternative='two.sided'): """ Generate ransom spatial permutations for inference on LISA vectors. Parameters ---------- permutations : int, optional Number of random permutations of observations. alternative : string, option...
[ "def", "permute", "(", "self", ",", "permutations", "=", "99", ",", "alternative", "=", "'two.sided'", ")", ":", "rY", "=", "self", ".", "Y", ".", "copy", "(", ")", "idxs", "=", "np", ".", "arange", "(", "len", "(", "rY", ")", ")", "counts", "=",...
Generate ransom spatial permutations for inference on LISA vectors. Parameters ---------- permutations : int, optional Number of random permutations of observations. alternative : string, optional Type of alternative to form in generating p-values. Op...
[ "Generate", "ransom", "spatial", "permutations", "for", "inference", "on", "LISA", "vectors", "." ]
train
https://github.com/pysal/giddy/blob/13fae6c18933614be78e91a6b5060693bea33a04/giddy/directional.py#L227-L300
pysal/giddy
giddy/directional.py
Rose.plot
def plot(self, attribute=None, ax=None, **kwargs): """ Plot the rose diagram. Parameters ---------- attribute : (n,) ndarray, optional Variable to specify colors of the colorbars. ax : Matplotlib Axes instance, optional If given, the figure will b...
python
def plot(self, attribute=None, ax=None, **kwargs): """ Plot the rose diagram. Parameters ---------- attribute : (n,) ndarray, optional Variable to specify colors of the colorbars. ax : Matplotlib Axes instance, optional If given, the figure will b...
[ "def", "plot", "(", "self", ",", "attribute", "=", "None", ",", "ax", "=", "None", ",", "*", "*", "kwargs", ")", ":", "from", "splot", ".", "giddy", "import", "dynamic_lisa_rose", "fig", ",", "ax", "=", "dynamic_lisa_rose", "(", "self", ",", "attribute...
Plot the rose diagram. Parameters ---------- attribute : (n,) ndarray, optional Variable to specify colors of the colorbars. ax : Matplotlib Axes instance, optional If given, the figure will be created inside this axis. Default =None. Note, this axis ...
[ "Plot", "the", "rose", "diagram", "." ]
train
https://github.com/pysal/giddy/blob/13fae6c18933614be78e91a6b5060693bea33a04/giddy/directional.py#L324-L351
pysal/giddy
giddy/directional.py
Rose.plot_origin
def plot_origin(self): # TODO add attribute option to color vectors """ Plot vectors of positional transition of LISA values starting from the same origin. """ import matplotlib.cm as cm import matplotlib.pyplot as plt ax = plt.subplot(111) xlim = [self._...
python
def plot_origin(self): # TODO add attribute option to color vectors """ Plot vectors of positional transition of LISA values starting from the same origin. """ import matplotlib.cm as cm import matplotlib.pyplot as plt ax = plt.subplot(111) xlim = [self._...
[ "def", "plot_origin", "(", "self", ")", ":", "# TODO add attribute option to color vectors", "import", "matplotlib", ".", "cm", "as", "cm", "import", "matplotlib", ".", "pyplot", "as", "plt", "ax", "=", "plt", ".", "subplot", "(", "111", ")", "xlim", "=", "[...
Plot vectors of positional transition of LISA values starting from the same origin.
[ "Plot", "vectors", "of", "positional", "transition", "of", "LISA", "values", "starting", "from", "the", "same", "origin", "." ]
train
https://github.com/pysal/giddy/blob/13fae6c18933614be78e91a6b5060693bea33a04/giddy/directional.py#L353-L369
pysal/giddy
giddy/directional.py
Rose.plot_vectors
def plot_vectors(self, arrows=True): """ Plot vectors of positional transition of LISA values within quadrant in scatterplot in a polar plot. Parameters ---------- ax : Matplotlib Axes instance, optional If given, the figure will be created inside this axis. ...
python
def plot_vectors(self, arrows=True): """ Plot vectors of positional transition of LISA values within quadrant in scatterplot in a polar plot. Parameters ---------- ax : Matplotlib Axes instance, optional If given, the figure will be created inside this axis. ...
[ "def", "plot_vectors", "(", "self", ",", "arrows", "=", "True", ")", ":", "from", "splot", ".", "giddy", "import", "dynamic_lisa_vectors", "fig", ",", "ax", "=", "dynamic_lisa_vectors", "(", "self", ",", "arrows", "=", "arrows", ")", "return", "fig", ",", ...
Plot vectors of positional transition of LISA values within quadrant in scatterplot in a polar plot. Parameters ---------- ax : Matplotlib Axes instance, optional If given, the figure will be created inside this axis. Default =None. arrows : boolean, opti...
[ "Plot", "vectors", "of", "positional", "transition", "of", "LISA", "values", "within", "quadrant", "in", "scatterplot", "in", "a", "polar", "plot", "." ]
train
https://github.com/pysal/giddy/blob/13fae6c18933614be78e91a6b5060693bea33a04/giddy/directional.py#L372-L400
pyinvoke/invocations
invocations/docs.py
_clean
def _clean(c): """ Nuke docs build target directory so next build is clean. """ if isdir(c.sphinx.target): rmtree(c.sphinx.target)
python
def _clean(c): """ Nuke docs build target directory so next build is clean. """ if isdir(c.sphinx.target): rmtree(c.sphinx.target)
[ "def", "_clean", "(", "c", ")", ":", "if", "isdir", "(", "c", ".", "sphinx", ".", "target", ")", ":", "rmtree", "(", "c", ".", "sphinx", ".", "target", ")" ]
Nuke docs build target directory so next build is clean.
[ "Nuke", "docs", "build", "target", "directory", "so", "next", "build", "is", "clean", "." ]
train
https://github.com/pyinvoke/invocations/blob/bbf1b319bd1536817d5301ceb9eeb2f31830e5dc/invocations/docs.py#L17-L22
pyinvoke/invocations
invocations/docs.py
_browse
def _browse(c): """ Open build target's index.html in a browser (using 'open'). """ index = join(c.sphinx.target, c.sphinx.target_file) c.run("open {0}".format(index))
python
def _browse(c): """ Open build target's index.html in a browser (using 'open'). """ index = join(c.sphinx.target, c.sphinx.target_file) c.run("open {0}".format(index))
[ "def", "_browse", "(", "c", ")", ":", "index", "=", "join", "(", "c", ".", "sphinx", ".", "target", ",", "c", ".", "sphinx", ".", "target_file", ")", "c", ".", "run", "(", "\"open {0}\"", ".", "format", "(", "index", ")", ")" ]
Open build target's index.html in a browser (using 'open').
[ "Open", "build", "target", "s", "index", ".", "html", "in", "a", "browser", "(", "using", "open", ")", "." ]
train
https://github.com/pyinvoke/invocations/blob/bbf1b319bd1536817d5301ceb9eeb2f31830e5dc/invocations/docs.py#L27-L32
pyinvoke/invocations
invocations/docs.py
build
def build( c, clean=False, browse=False, nitpick=False, opts=None, source=None, target=None, ): """ Build the project's Sphinx docs. """ if clean: _clean(c) if opts is None: opts = "" if nitpick: opts += " -n -W -T" cmd = "sphinx-build{0} {...
python
def build( c, clean=False, browse=False, nitpick=False, opts=None, source=None, target=None, ): """ Build the project's Sphinx docs. """ if clean: _clean(c) if opts is None: opts = "" if nitpick: opts += " -n -W -T" cmd = "sphinx-build{0} {...
[ "def", "build", "(", "c", ",", "clean", "=", "False", ",", "browse", "=", "False", ",", "nitpick", "=", "False", ",", "opts", "=", "None", ",", "source", "=", "None", ",", "target", "=", "None", ",", ")", ":", "if", "clean", ":", "_clean", "(", ...
Build the project's Sphinx docs.
[ "Build", "the", "project", "s", "Sphinx", "docs", "." ]
train
https://github.com/pyinvoke/invocations/blob/bbf1b319bd1536817d5301ceb9eeb2f31830e5dc/invocations/docs.py#L46-L71
pyinvoke/invocations
invocations/docs.py
tree
def tree(c): """ Display documentation contents with the 'tree' program. """ ignore = ".git|*.pyc|*.swp|dist|*.egg-info|_static|_build|_templates" c.run('tree -Ca -I "{0}" {1}'.format(ignore, c.sphinx.source))
python
def tree(c): """ Display documentation contents with the 'tree' program. """ ignore = ".git|*.pyc|*.swp|dist|*.egg-info|_static|_build|_templates" c.run('tree -Ca -I "{0}" {1}'.format(ignore, c.sphinx.source))
[ "def", "tree", "(", "c", ")", ":", "ignore", "=", "\".git|*.pyc|*.swp|dist|*.egg-info|_static|_build|_templates\"", "c", ".", "run", "(", "'tree -Ca -I \"{0}\" {1}'", ".", "format", "(", "ignore", ",", "c", ".", "sphinx", ".", "source", ")", ")" ]
Display documentation contents with the 'tree' program.
[ "Display", "documentation", "contents", "with", "the", "tree", "program", "." ]
train
https://github.com/pyinvoke/invocations/blob/bbf1b319bd1536817d5301ceb9eeb2f31830e5dc/invocations/docs.py#L95-L100
pyinvoke/invocations
invocations/docs.py
sites
def sites(c): """ Build both doc sites w/ maxed nitpicking. """ # TODO: This is super lolzy but we haven't actually tackled nontrivial # in-Python task calling yet, so we do this to get a copy of 'our' context, # which has been updated with the per-collection config data of the # docs/www su...
python
def sites(c): """ Build both doc sites w/ maxed nitpicking. """ # TODO: This is super lolzy but we haven't actually tackled nontrivial # in-Python task calling yet, so we do this to get a copy of 'our' context, # which has been updated with the per-collection config data of the # docs/www su...
[ "def", "sites", "(", "c", ")", ":", "# TODO: This is super lolzy but we haven't actually tackled nontrivial", "# in-Python task calling yet, so we do this to get a copy of 'our' context,", "# which has been updated with the per-collection config data of the", "# docs/www subcollections.", "docs_...
Build both doc sites w/ maxed nitpicking.
[ "Build", "both", "doc", "sites", "w", "/", "maxed", "nitpicking", "." ]
train
https://github.com/pyinvoke/invocations/blob/bbf1b319bd1536817d5301ceb9eeb2f31830e5dc/invocations/docs.py#L143-L169
pyinvoke/invocations
invocations/docs.py
watch_docs
def watch_docs(c): """ Watch both doc trees & rebuild them if files change. This includes e.g. rebuilding the API docs if the source code changes; rebuilding the WWW docs if the README changes; etc. Reuses the configuration values ``packaging.package`` or ``tests.package`` (the former winning ...
python
def watch_docs(c): """ Watch both doc trees & rebuild them if files change. This includes e.g. rebuilding the API docs if the source code changes; rebuilding the WWW docs if the README changes; etc. Reuses the configuration values ``packaging.package`` or ``tests.package`` (the former winning ...
[ "def", "watch_docs", "(", "c", ")", ":", "# TODO: break back down into generic single-site version, then create split", "# tasks as with docs/www above. Probably wants invoke#63.", "# NOTE: 'www'/'docs' refer to the module level sub-collections. meh.", "# Readme & WWW triggers WWW", "www_c", "...
Watch both doc trees & rebuild them if files change. This includes e.g. rebuilding the API docs if the source code changes; rebuilding the WWW docs if the README changes; etc. Reuses the configuration values ``packaging.package`` or ``tests.package`` (the former winning over the latter if both defined...
[ "Watch", "both", "doc", "trees", "&", "rebuild", "them", "if", "files", "change", "." ]
train
https://github.com/pyinvoke/invocations/blob/bbf1b319bd1536817d5301ceb9eeb2f31830e5dc/invocations/docs.py#L173-L215
pysal/giddy
giddy/util.py
shuffle_matrix
def shuffle_matrix(X, ids): """ Random permutation of rows and columns of a matrix Parameters ---------- X : array (k, k), array to be permutated. ids : array range (k, ). Returns ------- X : array (k, k) with rows and columns randomly shuffled. ...
python
def shuffle_matrix(X, ids): """ Random permutation of rows and columns of a matrix Parameters ---------- X : array (k, k), array to be permutated. ids : array range (k, ). Returns ------- X : array (k, k) with rows and columns randomly shuffled. ...
[ "def", "shuffle_matrix", "(", "X", ",", "ids", ")", ":", "np", ".", "random", ".", "shuffle", "(", "ids", ")", "return", "X", "[", "ids", ",", ":", "]", "[", ":", ",", "ids", "]" ]
Random permutation of rows and columns of a matrix Parameters ---------- X : array (k, k), array to be permutated. ids : array range (k, ). Returns ------- X : array (k, k) with rows and columns randomly shuffled. Examples -------- >>> import ...
[ "Random", "permutation", "of", "rows", "and", "columns", "of", "a", "matrix" ]
train
https://github.com/pysal/giddy/blob/13fae6c18933614be78e91a6b5060693bea33a04/giddy/util.py#L9-L40
pysal/giddy
giddy/util.py
get_lower
def get_lower(matrix): """ Flattens the lower part of an n x n matrix into an n*(n-1)/2 x 1 vector. Parameters ---------- matrix : array (n, n) numpy array, a distance matrix. Returns ------- lowvec : array numpy array, the lower half of the distance matri...
python
def get_lower(matrix): """ Flattens the lower part of an n x n matrix into an n*(n-1)/2 x 1 vector. Parameters ---------- matrix : array (n, n) numpy array, a distance matrix. Returns ------- lowvec : array numpy array, the lower half of the distance matri...
[ "def", "get_lower", "(", "matrix", ")", ":", "n", "=", "matrix", ".", "shape", "[", "0", "]", "lowerlist", "=", "[", "]", "for", "i", "in", "range", "(", "n", ")", ":", "for", "j", "in", "range", "(", "n", ")", ":", "if", "i", ">", "j", ":"...
Flattens the lower part of an n x n matrix into an n*(n-1)/2 x 1 vector. Parameters ---------- matrix : array (n, n) numpy array, a distance matrix. Returns ------- lowvec : array numpy array, the lower half of the distance matrix flattened into a ve...
[ "Flattens", "the", "lower", "part", "of", "an", "n", "x", "n", "matrix", "into", "an", "n", "*", "(", "n", "-", "1", ")", "/", "2", "x", "1", "vector", "." ]
train
https://github.com/pysal/giddy/blob/13fae6c18933614be78e91a6b5060693bea33a04/giddy/util.py#L43-L81
pyinvoke/invocations
invocations/checks.py
blacken
def blacken( c, line_length=79, folders=None, check=False, diff=False, find_opts=None ): r""" Run black on the current source tree (all ``.py`` files). .. warning:: ``black`` only runs on Python 3.6 or above. (However, it can be executed against Python 2 compatible code.) :param in...
python
def blacken( c, line_length=79, folders=None, check=False, diff=False, find_opts=None ): r""" Run black on the current source tree (all ``.py`` files). .. warning:: ``black`` only runs on Python 3.6 or above. (However, it can be executed against Python 2 compatible code.) :param in...
[ "def", "blacken", "(", "c", ",", "line_length", "=", "79", ",", "folders", "=", "None", ",", "check", "=", "False", ",", "diff", "=", "False", ",", "find_opts", "=", "None", ")", ":", "config", "=", "c", ".", "config", ".", "get", "(", "\"blacken\"...
r""" Run black on the current source tree (all ``.py`` files). .. warning:: ``black`` only runs on Python 3.6 or above. (However, it can be executed against Python 2 compatible code.) :param int line_length: Line length argument. Default: ``79``. :param list folders: Li...
[ "r", "Run", "black", "on", "the", "current", "source", "tree", "(", "all", ".", "py", "files", ")", "." ]
train
https://github.com/pyinvoke/invocations/blob/bbf1b319bd1536817d5301ceb9eeb2f31830e5dc/invocations/checks.py#L13-L65
kolypto/py-flask-jsontools
flask_jsontools/response.py
normalize_response_value
def normalize_response_value(rv): """ Normalize the response value into a 3-tuple (rv, status, headers) :type rv: tuple|* :returns: tuple(rv, status, headers) :rtype: tuple(Response|JsonResponse|*, int|None, dict|None) """ status = headers = None if isinstance(rv, tuple): ...
python
def normalize_response_value(rv): """ Normalize the response value into a 3-tuple (rv, status, headers) :type rv: tuple|* :returns: tuple(rv, status, headers) :rtype: tuple(Response|JsonResponse|*, int|None, dict|None) """ status = headers = None if isinstance(rv, tuple): ...
[ "def", "normalize_response_value", "(", "rv", ")", ":", "status", "=", "headers", "=", "None", "if", "isinstance", "(", "rv", ",", "tuple", ")", ":", "rv", ",", "status", ",", "headers", "=", "rv", "+", "(", "None", ",", ")", "*", "(", "3", "-", ...
Normalize the response value into a 3-tuple (rv, status, headers) :type rv: tuple|* :returns: tuple(rv, status, headers) :rtype: tuple(Response|JsonResponse|*, int|None, dict|None)
[ "Normalize", "the", "response", "value", "into", "a", "3", "-", "tuple", "(", "rv", "status", "headers", ")", ":", "type", "rv", ":", "tuple|", "*", ":", "returns", ":", "tuple", "(", "rv", "status", "headers", ")", ":", "rtype", ":", "tuple", "(", ...
train
https://github.com/kolypto/py-flask-jsontools/blob/1abee2d40e6db262e43f0c534e90faaa9b26246a/flask_jsontools/response.py#L51-L60
kolypto/py-flask-jsontools
flask_jsontools/response.py
make_json_response
def make_json_response(rv): """ Make JsonResponse :param rv: Response: the object to encode, or tuple (response, status, headers) :type rv: tuple|* :rtype: JsonResponse """ # Tuple of (response, status, headers) rv, status, headers = normalize_response_value(rv) # JsonResponse if is...
python
def make_json_response(rv): """ Make JsonResponse :param rv: Response: the object to encode, or tuple (response, status, headers) :type rv: tuple|* :rtype: JsonResponse """ # Tuple of (response, status, headers) rv, status, headers = normalize_response_value(rv) # JsonResponse if is...
[ "def", "make_json_response", "(", "rv", ")", ":", "# Tuple of (response, status, headers)", "rv", ",", "status", ",", "headers", "=", "normalize_response_value", "(", "rv", ")", "# JsonResponse", "if", "isinstance", "(", "rv", ",", "JsonResponse", ")", ":", "retur...
Make JsonResponse :param rv: Response: the object to encode, or tuple (response, status, headers) :type rv: tuple|* :rtype: JsonResponse
[ "Make", "JsonResponse", ":", "param", "rv", ":", "Response", ":", "the", "object", "to", "encode", "or", "tuple", "(", "response", "status", "headers", ")", ":", "type", "rv", ":", "tuple|", "*", ":", "rtype", ":", "JsonResponse" ]
train
https://github.com/kolypto/py-flask-jsontools/blob/1abee2d40e6db262e43f0c534e90faaa9b26246a/flask_jsontools/response.py#L63-L77
pysal/giddy
giddy/mobility.py
markov_mobility
def markov_mobility(p, measure="P", ini=None): """ Markov-based mobility index. Parameters ---------- p : array (k, k), Markov transition probability matrix. measure : string If measure= "P", :math:`M_{P} = \\frac{m-\sum_{i=1}^m P_{ii}}{m-1}`; ...
python
def markov_mobility(p, measure="P", ini=None): """ Markov-based mobility index. Parameters ---------- p : array (k, k), Markov transition probability matrix. measure : string If measure= "P", :math:`M_{P} = \\frac{m-\sum_{i=1}^m P_{ii}}{m-1}`; ...
[ "def", "markov_mobility", "(", "p", ",", "measure", "=", "\"P\"", ",", "ini", "=", "None", ")", ":", "p", "=", "np", ".", "array", "(", "p", ")", "k", "=", "p", ".", "shape", "[", "1", "]", "if", "measure", "==", "\"P\"", ":", "t", "=", "np",...
Markov-based mobility index. Parameters ---------- p : array (k, k), Markov transition probability matrix. measure : string If measure= "P", :math:`M_{P} = \\frac{m-\sum_{i=1}^m P_{ii}}{m-1}`; if measure = "D", :math:`M_{D} = 1...
[ "Markov", "-", "based", "mobility", "index", "." ]
train
https://github.com/pysal/giddy/blob/13fae6c18933614be78e91a6b5060693bea33a04/giddy/mobility.py#L13-L131
pysal/giddy
giddy/markov.py
chi2
def chi2(T1, T2): """ chi-squared test of difference between two transition matrices. Parameters ---------- T1 : array (k, k), matrix of transitions (counts). T2 : array (k, k), matrix of transitions (counts) to use to form the probabilities under the n...
python
def chi2(T1, T2): """ chi-squared test of difference between two transition matrices. Parameters ---------- T1 : array (k, k), matrix of transitions (counts). T2 : array (k, k), matrix of transitions (counts) to use to form the probabilities under the n...
[ "def", "chi2", "(", "T1", ",", "T2", ")", ":", "rs2", "=", "T2", ".", "sum", "(", "axis", "=", "1", ")", "rs1", "=", "T1", ".", "sum", "(", "axis", "=", "1", ")", "rs2nz", "=", "rs2", ">", "0", "rs1nz", "=", "rs1", ">", "0", "dof1", "=", ...
chi-squared test of difference between two transition matrices. Parameters ---------- T1 : array (k, k), matrix of transitions (counts). T2 : array (k, k), matrix of transitions (counts) to use to form the probabilities under the null. Returns ------- ...
[ "chi", "-", "squared", "test", "of", "difference", "between", "two", "transition", "matrices", "." ]
train
https://github.com/pysal/giddy/blob/13fae6c18933614be78e91a6b5060693bea33a04/giddy/markov.py#L858-L932
pysal/giddy
giddy/markov.py
kullback
def kullback(F): """ Kullback information based test of Markov Homogeneity. Parameters ---------- F : array (s, r, r), values are transitions (not probabilities) for s strata, r initial states, r terminal states. Returns ------- Results : dictionary (key -...
python
def kullback(F): """ Kullback information based test of Markov Homogeneity. Parameters ---------- F : array (s, r, r), values are transitions (not probabilities) for s strata, r initial states, r terminal states. Returns ------- Results : dictionary (key -...
[ "def", "kullback", "(", "F", ")", ":", "F1", "=", "F", "==", "0", "F1", "=", "F", "+", "F1", "FLF", "=", "F", "*", "np", ".", "log", "(", "F1", ")", "T1", "=", "2", "*", "FLF", ".", "sum", "(", ")", "FdJK", "=", "F", ".", "sum", "(", ...
Kullback information based test of Markov Homogeneity. Parameters ---------- F : array (s, r, r), values are transitions (not probabilities) for s strata, r initial states, r terminal states. Returns ------- Results : dictionary (key - value) Condit...
[ "Kullback", "information", "based", "test", "of", "Markov", "Homogeneity", "." ]
train
https://github.com/pysal/giddy/blob/13fae6c18933614be78e91a6b5060693bea33a04/giddy/markov.py#L1336-L1425
pysal/giddy
giddy/markov.py
prais
def prais(pmat): """ Prais conditional mobility measure. Parameters ---------- pmat : matrix (k, k), Markov probability transition matrix. Returns ------- pr : matrix (1, k), conditional mobility measures for each of the k classes. Notes ----- Prais...
python
def prais(pmat): """ Prais conditional mobility measure. Parameters ---------- pmat : matrix (k, k), Markov probability transition matrix. Returns ------- pr : matrix (1, k), conditional mobility measures for each of the k classes. Notes ----- Prais...
[ "def", "prais", "(", "pmat", ")", ":", "pmat", "=", "np", ".", "array", "(", "pmat", ")", "pr", "=", "1", "-", "np", ".", "diag", "(", "pmat", ")", "return", "pr" ]
Prais conditional mobility measure. Parameters ---------- pmat : matrix (k, k), Markov probability transition matrix. Returns ------- pr : matrix (1, k), conditional mobility measures for each of the k classes. Notes ----- Prais' conditional mobility measur...
[ "Prais", "conditional", "mobility", "measure", "." ]
train
https://github.com/pysal/giddy/blob/13fae6c18933614be78e91a6b5060693bea33a04/giddy/markov.py#L1428-L1477
pysal/giddy
giddy/markov.py
homogeneity
def homogeneity(transition_matrices, regime_names=[], class_names=[], title="Markov Homogeneity Test"): """ Test for homogeneity of Markov transition probabilities across regimes. Parameters ---------- transition_matrices : list of transition matrices for r...
python
def homogeneity(transition_matrices, regime_names=[], class_names=[], title="Markov Homogeneity Test"): """ Test for homogeneity of Markov transition probabilities across regimes. Parameters ---------- transition_matrices : list of transition matrices for r...
[ "def", "homogeneity", "(", "transition_matrices", ",", "regime_names", "=", "[", "]", ",", "class_names", "=", "[", "]", ",", "title", "=", "\"Markov Homogeneity Test\"", ")", ":", "return", "Homogeneity_Results", "(", "transition_matrices", ",", "regime_names", "...
Test for homogeneity of Markov transition probabilities across regimes. Parameters ---------- transition_matrices : list of transition matrices for regimes, all matrices must have same size (r, c). r is the number of rows in the ...
[ "Test", "for", "homogeneity", "of", "Markov", "transition", "probabilities", "across", "regimes", "." ]
train
https://github.com/pysal/giddy/blob/13fae6c18933614be78e91a6b5060693bea33a04/giddy/markov.py#L1480-L1506
pysal/giddy
giddy/markov.py
sojourn_time
def sojourn_time(p): """ Calculate sojourn time based on a given transition probability matrix. Parameters ---------- p : array (k, k), a Markov transition probability matrix. Returns ------- : array (k, ), sojourn times. Each element is th...
python
def sojourn_time(p): """ Calculate sojourn time based on a given transition probability matrix. Parameters ---------- p : array (k, k), a Markov transition probability matrix. Returns ------- : array (k, ), sojourn times. Each element is th...
[ "def", "sojourn_time", "(", "p", ")", ":", "p", "=", "np", ".", "asarray", "(", "p", ")", "pii", "=", "p", ".", "diagonal", "(", ")", "if", "not", "(", "1", "-", "pii", ")", ".", "all", "(", ")", ":", "print", "(", "\"Sojourn times are infinite f...
Calculate sojourn time based on a given transition probability matrix. Parameters ---------- p : array (k, k), a Markov transition probability matrix. Returns ------- : array (k, ), sojourn times. Each element is the expected time a Markov ...
[ "Calculate", "sojourn", "time", "based", "on", "a", "given", "transition", "probability", "matrix", "." ]
train
https://github.com/pysal/giddy/blob/13fae6c18933614be78e91a6b5060693bea33a04/giddy/markov.py#L1830-L1864
pysal/giddy
giddy/markov.py
Spatial_Markov._calc
def _calc(self, y, w): '''Helper to estimate spatial lag conditioned Markov transition probability matrices based on maximum likelihood techniques. ''' if self.discrete: self.lclass_ids = weights.lag_categorical(w, self.class_ids, ...
python
def _calc(self, y, w): '''Helper to estimate spatial lag conditioned Markov transition probability matrices based on maximum likelihood techniques. ''' if self.discrete: self.lclass_ids = weights.lag_categorical(w, self.class_ids, ...
[ "def", "_calc", "(", "self", ",", "y", ",", "w", ")", ":", "if", "self", ".", "discrete", ":", "self", ".", "lclass_ids", "=", "weights", ".", "lag_categorical", "(", "w", ",", "self", ".", "class_ids", ",", "ties", "=", "\"tryself\"", ")", "else", ...
Helper to estimate spatial lag conditioned Markov transition probability matrices based on maximum likelihood techniques.
[ "Helper", "to", "estimate", "spatial", "lag", "conditioned", "Markov", "transition", "probability", "matrices", "based", "on", "maximum", "likelihood", "techniques", "." ]
train
https://github.com/pysal/giddy/blob/13fae6c18933614be78e91a6b5060693bea33a04/giddy/markov.py#L731-L759
pysal/giddy
giddy/markov.py
Spatial_Markov.summary
def summary(self, file_name=None): """ A summary method to call the Markov homogeneity test to test for temporally lagged spatial dependence. To learn more about the properties of the tests, refer to :cite:`Rey2016a` and :cite:`Kang2018`. """ class_names = ["C%d...
python
def summary(self, file_name=None): """ A summary method to call the Markov homogeneity test to test for temporally lagged spatial dependence. To learn more about the properties of the tests, refer to :cite:`Rey2016a` and :cite:`Kang2018`. """ class_names = ["C%d...
[ "def", "summary", "(", "self", ",", "file_name", "=", "None", ")", ":", "class_names", "=", "[", "\"C%d\"", "%", "i", "for", "i", "in", "range", "(", "self", ".", "k", ")", "]", "regime_names", "=", "[", "\"LAG%d\"", "%", "i", "for", "i", "in", "...
A summary method to call the Markov homogeneity test to test for temporally lagged spatial dependence. To learn more about the properties of the tests, refer to :cite:`Rey2016a` and :cite:`Kang2018`.
[ "A", "summary", "method", "to", "call", "the", "Markov", "homogeneity", "test", "to", "test", "for", "temporally", "lagged", "spatial", "dependence", "." ]
train
https://github.com/pysal/giddy/blob/13fae6c18933614be78e91a6b5060693bea33a04/giddy/markov.py#L811-L830
pysal/giddy
giddy/markov.py
Spatial_Markov._maybe_classify
def _maybe_classify(self, y, k, cutoffs): '''Helper method for classifying continuous data. ''' rows, cols = y.shape if cutoffs is None: if self.fixed: mcyb = mc.Quantiles(y.flatten(), k=k) yb = mcyb.yb.reshape(y.shape) cutoff...
python
def _maybe_classify(self, y, k, cutoffs): '''Helper method for classifying continuous data. ''' rows, cols = y.shape if cutoffs is None: if self.fixed: mcyb = mc.Quantiles(y.flatten(), k=k) yb = mcyb.yb.reshape(y.shape) cutoff...
[ "def", "_maybe_classify", "(", "self", ",", "y", ",", "k", ",", "cutoffs", ")", ":", "rows", ",", "cols", "=", "y", ".", "shape", "if", "cutoffs", "is", "None", ":", "if", "self", ".", "fixed", ":", "mcyb", "=", "mc", ".", "Quantiles", "(", "y", ...
Helper method for classifying continuous data.
[ "Helper", "method", "for", "classifying", "continuous", "data", "." ]
train
https://github.com/pysal/giddy/blob/13fae6c18933614be78e91a6b5060693bea33a04/giddy/markov.py#L832-L855
pysal/giddy
giddy/markov.py
LISA_Markov.spillover
def spillover(self, quadrant=1, neighbors_on=False): """ Detect spillover locations for diffusion in LISA Markov. Parameters ---------- quadrant : int which quadrant in the scatterplot should form the core of a cluster. n...
python
def spillover(self, quadrant=1, neighbors_on=False): """ Detect spillover locations for diffusion in LISA Markov. Parameters ---------- quadrant : int which quadrant in the scatterplot should form the core of a cluster. n...
[ "def", "spillover", "(", "self", ",", "quadrant", "=", "1", ",", "neighbors_on", "=", "False", ")", ":", "n", ",", "k", "=", "self", ".", "q", ".", "shape", "if", "self", ".", "permutations", ":", "spill_over", "=", "np", ".", "zeros", "(", "(", ...
Detect spillover locations for diffusion in LISA Markov. Parameters ---------- quadrant : int which quadrant in the scatterplot should form the core of a cluster. neighbors_on : binary If false, then only the 1st o...
[ "Detect", "spillover", "locations", "for", "diffusion", "in", "LISA", "Markov", "." ]
train
https://github.com/pysal/giddy/blob/13fae6c18933614be78e91a6b5060693bea33a04/giddy/markov.py#L1212-L1333
kolypto/py-flask-jsontools
flask_jsontools/formatting.py
get_entity_propnames
def get_entity_propnames(entity): """ Get entity property names :param entity: Entity :type entity: sqlalchemy.ext.declarative.api.DeclarativeMeta :returns: Set of entity property names :rtype: set """ ins = entity if isinstance(entity, InstanceState) else inspect(entity) ...
python
def get_entity_propnames(entity): """ Get entity property names :param entity: Entity :type entity: sqlalchemy.ext.declarative.api.DeclarativeMeta :returns: Set of entity property names :rtype: set """ ins = entity if isinstance(entity, InstanceState) else inspect(entity) ...
[ "def", "get_entity_propnames", "(", "entity", ")", ":", "ins", "=", "entity", "if", "isinstance", "(", "entity", ",", "InstanceState", ")", "else", "inspect", "(", "entity", ")", "return", "set", "(", "ins", ".", "mapper", ".", "column_attrs", ".", "keys",...
Get entity property names :param entity: Entity :type entity: sqlalchemy.ext.declarative.api.DeclarativeMeta :returns: Set of entity property names :rtype: set
[ "Get", "entity", "property", "names" ]
train
https://github.com/kolypto/py-flask-jsontools/blob/1abee2d40e6db262e43f0c534e90faaa9b26246a/flask_jsontools/formatting.py#L31-L43
kolypto/py-flask-jsontools
flask_jsontools/formatting.py
get_entity_loaded_propnames
def get_entity_loaded_propnames(entity): """ Get entity property names that are loaded (e.g. won't produce new queries) :param entity: Entity :type entity: sqlalchemy.ext.declarative.api.DeclarativeMeta :returns: Set of entity property names :rtype: set """ ins = inspect(ent...
python
def get_entity_loaded_propnames(entity): """ Get entity property names that are loaded (e.g. won't produce new queries) :param entity: Entity :type entity: sqlalchemy.ext.declarative.api.DeclarativeMeta :returns: Set of entity property names :rtype: set """ ins = inspect(ent...
[ "def", "get_entity_loaded_propnames", "(", "entity", ")", ":", "ins", "=", "inspect", "(", "entity", ")", "keynames", "=", "get_entity_propnames", "(", "ins", ")", "# If the entity is not transient -- exclude unloaded keys", "# Transient entities won't load these anyway, so it'...
Get entity property names that are loaded (e.g. won't produce new queries) :param entity: Entity :type entity: sqlalchemy.ext.declarative.api.DeclarativeMeta :returns: Set of entity property names :rtype: set
[ "Get", "entity", "property", "names", "that", "are", "loaded", "(", "e", ".", "g", ".", "won", "t", "produce", "new", "queries", ")" ]
train
https://github.com/kolypto/py-flask-jsontools/blob/1abee2d40e6db262e43f0c534e90faaa9b26246a/flask_jsontools/formatting.py#L46-L68
pyinvoke/invocations
invocations/packaging/semantic_version_monkey.py
next_minor
def next_minor(self): """ Return a Version whose minor number is one greater than self's. .. note:: The new Version will always have a zeroed-out bugfix/tertiary version number, because the "next minor release" of e.g. 1.2.1 is 1.3.0, not 1.3.1. """ clone = self.clone() ...
python
def next_minor(self): """ Return a Version whose minor number is one greater than self's. .. note:: The new Version will always have a zeroed-out bugfix/tertiary version number, because the "next minor release" of e.g. 1.2.1 is 1.3.0, not 1.3.1. """ clone = self.clone() ...
[ "def", "next_minor", "(", "self", ")", ":", "clone", "=", "self", ".", "clone", "(", ")", "clone", ".", "minor", "+=", "1", "clone", ".", "patch", "=", "0", "return", "clone" ]
Return a Version whose minor number is one greater than self's. .. note:: The new Version will always have a zeroed-out bugfix/tertiary version number, because the "next minor release" of e.g. 1.2.1 is 1.3.0, not 1.3.1.
[ "Return", "a", "Version", "whose", "minor", "number", "is", "one", "greater", "than", "self", "s", "." ]
train
https://github.com/pyinvoke/invocations/blob/bbf1b319bd1536817d5301ceb9eeb2f31830e5dc/invocations/packaging/semantic_version_monkey.py#L26-L38
roskakori/pygount
pygount/command.py
_check_encoding
def _check_encoding(name, encoding_to_check, alternative_encoding, source=None): """ Check that ``encoding`` is a valid Python encoding :param name: name under which the encoding is known to the user, e.g. 'default encoding' :param encoding_to_check: name of the encoding to check, e.g. 'utf-8' :para...
python
def _check_encoding(name, encoding_to_check, alternative_encoding, source=None): """ Check that ``encoding`` is a valid Python encoding :param name: name under which the encoding is known to the user, e.g. 'default encoding' :param encoding_to_check: name of the encoding to check, e.g. 'utf-8' :para...
[ "def", "_check_encoding", "(", "name", ",", "encoding_to_check", ",", "alternative_encoding", ",", "source", "=", "None", ")", ":", "assert", "name", "is", "not", "None", "if", "encoding_to_check", "not", "in", "(", "alternative_encoding", ",", "'chardet'", ",",...
Check that ``encoding`` is a valid Python encoding :param name: name under which the encoding is known to the user, e.g. 'default encoding' :param encoding_to_check: name of the encoding to check, e.g. 'utf-8' :param source: source where the encoding has been set, e.g. option name :raise pygount.common....
[ "Check", "that", "encoding", "is", "a", "valid", "Python", "encoding", ":", "param", "name", ":", "name", "under", "which", "the", "encoding", "is", "known", "to", "the", "user", "e", ".", "g", ".", "default", "encoding", ":", "param", "encoding_to_check",...
train
https://github.com/roskakori/pygount/blob/c2c150a534ba5be498eb39cb78fc6a531d62f145/pygount/command.py#L58-L75
roskakori/pygount
pygount/common.py
lines
def lines(text): """ Generator function to yield lines (delimited with ``'\n'``) stored in ``text``. This is useful when a regular expression should only match on a per line basis in a memory efficient way. """ assert text is not None assert '\r' not in text previous_newline_index = 0 ...
python
def lines(text): """ Generator function to yield lines (delimited with ``'\n'``) stored in ``text``. This is useful when a regular expression should only match on a per line basis in a memory efficient way. """ assert text is not None assert '\r' not in text previous_newline_index = 0 ...
[ "def", "lines", "(", "text", ")", ":", "assert", "text", "is", "not", "None", "assert", "'\\r'", "not", "in", "text", "previous_newline_index", "=", "0", "newline_index", "=", "text", ".", "find", "(", "'\\n'", ")", "while", "newline_index", "!=", "-", "...
Generator function to yield lines (delimited with ``'\n'``) stored in ``text``. This is useful when a regular expression should only match on a per line basis in a memory efficient way.
[ "Generator", "function", "to", "yield", "lines", "(", "delimited", "with", "\\", "n", ")", "stored", "in", "text", ".", "This", "is", "useful", "when", "a", "regular", "expression", "should", "only", "match", "on", "a", "per", "line", "basis", "in", "a",...
train
https://github.com/roskakori/pygount/blob/c2c150a534ba5be498eb39cb78fc6a531d62f145/pygount/common.py#L101-L117
roskakori/pygount
pygount/analysis.py
matching_number_line_and_regex
def matching_number_line_and_regex(source_lines, generated_regexes, max_line_count=15): """ The first line and its number (starting with 0) in the source code that indicated that the source code is generated. :param source_lines: lines of text to scan :param generated_regexes: regular expressions a ...
python
def matching_number_line_and_regex(source_lines, generated_regexes, max_line_count=15): """ The first line and its number (starting with 0) in the source code that indicated that the source code is generated. :param source_lines: lines of text to scan :param generated_regexes: regular expressions a ...
[ "def", "matching_number_line_and_regex", "(", "source_lines", ",", "generated_regexes", ",", "max_line_count", "=", "15", ")", ":", "initial_numbers_and_lines", "=", "enumerate", "(", "itertools", ".", "islice", "(", "source_lines", ",", "max_line_count", ")", ")", ...
The first line and its number (starting with 0) in the source code that indicated that the source code is generated. :param source_lines: lines of text to scan :param generated_regexes: regular expressions a line must match to indicate the source code is generated. :param max_line_count: maximum...
[ "The", "first", "line", "and", "its", "number", "(", "starting", "with", "0", ")", "in", "the", "source", "code", "that", "indicated", "that", "the", "source", "code", "is", "generated", ".", ":", "param", "source_lines", ":", "lines", "of", "text", "to"...
train
https://github.com/roskakori/pygount/blob/c2c150a534ba5be498eb39cb78fc6a531d62f145/pygount/analysis.py#L245-L266
roskakori/pygount
pygount/analysis.py
_pythonized_comments
def _pythonized_comments(tokens): """ Similar to tokens but converts strings after a colon (:) to comments. """ is_after_colon = True for token_type, token_text in tokens: if is_after_colon and (token_type in pygments.token.String): token_type = pygments.token.Comment eli...
python
def _pythonized_comments(tokens): """ Similar to tokens but converts strings after a colon (:) to comments. """ is_after_colon = True for token_type, token_text in tokens: if is_after_colon and (token_type in pygments.token.String): token_type = pygments.token.Comment eli...
[ "def", "_pythonized_comments", "(", "tokens", ")", ":", "is_after_colon", "=", "True", "for", "token_type", ",", "token_text", "in", "tokens", ":", "if", "is_after_colon", "and", "(", "token_type", "in", "pygments", ".", "token", ".", "String", ")", ":", "to...
Similar to tokens but converts strings after a colon (:) to comments.
[ "Similar", "to", "tokens", "but", "converts", "strings", "after", "a", "colon", "(", ":", ")", "to", "comments", "." ]
train
https://github.com/roskakori/pygount/blob/c2c150a534ba5be498eb39cb78fc6a531d62f145/pygount/analysis.py#L299-L313
roskakori/pygount
pygount/analysis.py
encoding_for
def encoding_for(source_path, encoding='automatic', fallback_encoding=None): """ The encoding used by the text file stored in ``source_path``. The algorithm used is: * If ``encoding`` is ``'automatic``, attempt the following: 1. Check BOM for UTF-8, UTF-16 and UTF-32. 2. Look for XML prolo...
python
def encoding_for(source_path, encoding='automatic', fallback_encoding=None): """ The encoding used by the text file stored in ``source_path``. The algorithm used is: * If ``encoding`` is ``'automatic``, attempt the following: 1. Check BOM for UTF-8, UTF-16 and UTF-32. 2. Look for XML prolo...
[ "def", "encoding_for", "(", "source_path", ",", "encoding", "=", "'automatic'", ",", "fallback_encoding", "=", "None", ")", ":", "assert", "encoding", "is", "not", "None", "if", "encoding", "==", "'automatic'", ":", "with", "open", "(", "source_path", ",", "...
The encoding used by the text file stored in ``source_path``. The algorithm used is: * If ``encoding`` is ``'automatic``, attempt the following: 1. Check BOM for UTF-8, UTF-16 and UTF-32. 2. Look for XML prolog or magic heading like ``# -*- coding: cp1252 -*-`` 3. Read the file using UTF-8. ...
[ "The", "encoding", "used", "by", "the", "text", "file", "stored", "in", "source_path", "." ]
train
https://github.com/roskakori/pygount/blob/c2c150a534ba5be498eb39cb78fc6a531d62f145/pygount/analysis.py#L340-L418
roskakori/pygount
pygount/analysis.py
has_lexer
def has_lexer(source_path): """ Initial quick check if there is a lexer for ``source_path``. This removes the need for calling :py:func:`pygments.lexers.guess_lexer_for_filename()` which fully reads the source file. """ result = bool(pygments.lexers.find_lexer_class_for_filename(source_path)) ...
python
def has_lexer(source_path): """ Initial quick check if there is a lexer for ``source_path``. This removes the need for calling :py:func:`pygments.lexers.guess_lexer_for_filename()` which fully reads the source file. """ result = bool(pygments.lexers.find_lexer_class_for_filename(source_path)) ...
[ "def", "has_lexer", "(", "source_path", ")", ":", "result", "=", "bool", "(", "pygments", ".", "lexers", ".", "find_lexer_class_for_filename", "(", "source_path", ")", ")", "if", "not", "result", ":", "suffix", "=", "os", ".", "path", ".", "splitext", "(",...
Initial quick check if there is a lexer for ``source_path``. This removes the need for calling :py:func:`pygments.lexers.guess_lexer_for_filename()` which fully reads the source file.
[ "Initial", "quick", "check", "if", "there", "is", "a", "lexer", "for", "source_path", ".", "This", "removes", "the", "need", "for", "calling", ":", "py", ":", "func", ":", "pygments", ".", "lexers", ".", "guess_lexer_for_filename", "()", "which", "fully", ...
train
https://github.com/roskakori/pygount/blob/c2c150a534ba5be498eb39cb78fc6a531d62f145/pygount/analysis.py#L459-L469
roskakori/pygount
pygount/analysis.py
source_analysis
def source_analysis( source_path, group, encoding='automatic', fallback_encoding='cp1252', generated_regexes=pygount.common.regexes_from(DEFAULT_GENERATED_PATTERNS_TEXT), duplicate_pool=None): """ Analysis for line counts in source code stored in ``source_path``. :param source_path:...
python
def source_analysis( source_path, group, encoding='automatic', fallback_encoding='cp1252', generated_regexes=pygount.common.regexes_from(DEFAULT_GENERATED_PATTERNS_TEXT), duplicate_pool=None): """ Analysis for line counts in source code stored in ``source_path``. :param source_path:...
[ "def", "source_analysis", "(", "source_path", ",", "group", ",", "encoding", "=", "'automatic'", ",", "fallback_encoding", "=", "'cp1252'", ",", "generated_regexes", "=", "pygount", ".", "common", ".", "regexes_from", "(", "DEFAULT_GENERATED_PATTERNS_TEXT", ")", ","...
Analysis for line counts in source code stored in ``source_path``. :param source_path: :param group: name of a logical group the sourc code belongs to, e.g. a package. :param encoding: encoding according to :func:`encoding_for` :param fallback_encoding: fallback encoding according to :func:...
[ "Analysis", "for", "line", "counts", "in", "source", "code", "stored", "in", "source_path", "." ]
train
https://github.com/roskakori/pygount/blob/c2c150a534ba5be498eb39cb78fc6a531d62f145/pygount/analysis.py#L484-L570
radjkarl/imgProcessor
DUMP/interpolationMethods.py
polynomial
def polynomial(img, mask, inplace=False, replace_all=False, max_dev=1e-5, max_iter=20, order=2): ''' replace all masked values calculate flatField from 2d-polynomal fit filling all high gradient areas within averaged fit-image returns flatField, average background level, fitte...
python
def polynomial(img, mask, inplace=False, replace_all=False, max_dev=1e-5, max_iter=20, order=2): ''' replace all masked values calculate flatField from 2d-polynomal fit filling all high gradient areas within averaged fit-image returns flatField, average background level, fitte...
[ "def", "polynomial", "(", "img", ",", "mask", ",", "inplace", "=", "False", ",", "replace_all", "=", "False", ",", "max_dev", "=", "1e-5", ",", "max_iter", "=", "20", ",", "order", "=", "2", ")", ":", "if", "inplace", ":", "out", "=", "img", "else"...
replace all masked values calculate flatField from 2d-polynomal fit filling all high gradient areas within averaged fit-image returns flatField, average background level, fitted image, valid indices mask
[ "replace", "all", "masked", "values", "calculate", "flatField", "from", "2d", "-", "polynomal", "fit", "filling", "all", "high", "gradient", "areas", "within", "averaged", "fit", "-", "image", "returns", "flatField", "average", "background", "level", "fitted", "...
train
https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/DUMP/interpolationMethods.py#L55-L88
radjkarl/imgProcessor
imgProcessor/uncertainty/simulateUncertDependencyOnExpTime.py
errorDist
def errorDist(scale, measExpTime, n_events_in_expTime, event_duration, std, points_per_time=100, n_repetitions=300): ''' TODO ''' ntimes = 10 s1 = measExpTime * scale * 10 # exp. time factor 1/16-->16: p2 = np.logspace(-4, 4, 18, base=2) t = np.lin...
python
def errorDist(scale, measExpTime, n_events_in_expTime, event_duration, std, points_per_time=100, n_repetitions=300): ''' TODO ''' ntimes = 10 s1 = measExpTime * scale * 10 # exp. time factor 1/16-->16: p2 = np.logspace(-4, 4, 18, base=2) t = np.lin...
[ "def", "errorDist", "(", "scale", ",", "measExpTime", ",", "n_events_in_expTime", ",", "event_duration", ",", "std", ",", "points_per_time", "=", "100", ",", "n_repetitions", "=", "300", ")", ":", "ntimes", "=", "10", "s1", "=", "measExpTime", "*", "scale", ...
TODO
[ "TODO" ]
train
https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/uncertainty/simulateUncertDependencyOnExpTime.py#L15-L47
radjkarl/imgProcessor
imgProcessor/uncertainty/simulateUncertDependencyOnExpTime.py
exampleSignals
def exampleSignals(std=1, dur1=1, dur2=3, dur3=0.2, n1=0.5, n2=0.5, n3=2): ''' std ... standard deviation of every signal dur1...dur3 --> event duration per second n1...n3 --> number of events per second ''' np.random.seed(123) t = np.linspace(0, 10, 100) ...
python
def exampleSignals(std=1, dur1=1, dur2=3, dur3=0.2, n1=0.5, n2=0.5, n3=2): ''' std ... standard deviation of every signal dur1...dur3 --> event duration per second n1...n3 --> number of events per second ''' np.random.seed(123) t = np.linspace(0, 10, 100) ...
[ "def", "exampleSignals", "(", "std", "=", "1", ",", "dur1", "=", "1", ",", "dur2", "=", "3", ",", "dur3", "=", "0.2", ",", "n1", "=", "0.5", ",", "n2", "=", "0.5", ",", "n3", "=", "2", ")", ":", "np", ".", "random", ".", "seed", "(", "123",...
std ... standard deviation of every signal dur1...dur3 --> event duration per second n1...n3 --> number of events per second
[ "std", "...", "standard", "deviation", "of", "every", "signal", "dur1", "...", "dur3", "--", ">", "event", "duration", "per", "second", "n1", "...", "n3", "--", ">", "number", "of", "events", "per", "second" ]
train
https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/uncertainty/simulateUncertDependencyOnExpTime.py#L50-L63
radjkarl/imgProcessor
imgProcessor/uncertainty/simulateUncertDependencyOnExpTime.py
_flux
def _flux(t, n, duration, std, offs=1): ''' returns Gaussian shaped signal fluctuations [events] t --> times to calculate event for n --> numbers of events per sec duration --> event duration per sec std --> std of event if averaged over time offs --> event offset ''' ...
python
def _flux(t, n, duration, std, offs=1): ''' returns Gaussian shaped signal fluctuations [events] t --> times to calculate event for n --> numbers of events per sec duration --> event duration per sec std --> std of event if averaged over time offs --> event offset ''' ...
[ "def", "_flux", "(", "t", ",", "n", ",", "duration", ",", "std", ",", "offs", "=", "1", ")", ":", "duration", "*=", "len", "(", "t", ")", "/", "t", "[", "-", "1", "]", "duration", "=", "int", "(", "max", "(", "duration", ",", "1", ")", ")",...
returns Gaussian shaped signal fluctuations [events] t --> times to calculate event for n --> numbers of events per sec duration --> event duration per sec std --> std of event if averaged over time offs --> event offset
[ "returns", "Gaussian", "shaped", "signal", "fluctuations", "[", "events", "]", "t", "--", ">", "times", "to", "calculate", "event", "for", "n", "--", ">", "numbers", "of", "events", "per", "sec", "duration", "--", ">", "event", "duration", "per", "sec", ...
train
https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/uncertainty/simulateUncertDependencyOnExpTime.py#L66-L113
radjkarl/imgProcessor
imgProcessor/uncertainty/simulateUncertDependencyOnExpTime.py
_capture
def _capture(f, t, t0, factor): ''' capture signal and return its standard deviation #TODO: more detail ''' n_per_sec = len(t) / t[-1] # len of one split: n = int(t0 * factor * n_per_sec) s = len(f) // n m = s * n f = f[:m] ff = np.split(f, s) m = np.mean(ff...
python
def _capture(f, t, t0, factor): ''' capture signal and return its standard deviation #TODO: more detail ''' n_per_sec = len(t) / t[-1] # len of one split: n = int(t0 * factor * n_per_sec) s = len(f) // n m = s * n f = f[:m] ff = np.split(f, s) m = np.mean(ff...
[ "def", "_capture", "(", "f", ",", "t", ",", "t0", ",", "factor", ")", ":", "n_per_sec", "=", "len", "(", "t", ")", "/", "t", "[", "-", "1", "]", "# len of one split:\r", "n", "=", "int", "(", "t0", "*", "factor", "*", "n_per_sec", ")", "s", "="...
capture signal and return its standard deviation #TODO: more detail
[ "capture", "signal", "and", "return", "its", "standard", "deviation", "#TODO", ":", "more", "detail" ]
train
https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/uncertainty/simulateUncertDependencyOnExpTime.py#L116-L131
radjkarl/imgProcessor
imgProcessor/utils/genericCameraMatrix.py
genericCameraMatrix
def genericCameraMatrix(shape, angularField=60): ''' Return a generic camera matrix [[fx, 0, cx], [ 0, fy, cy], [ 0, 0, 1]] for a given image shape ''' # http://nghiaho.com/?page_id=576 # assume that the optical centre is in the middle: cy = int(shape[0] / 2) cx ...
python
def genericCameraMatrix(shape, angularField=60): ''' Return a generic camera matrix [[fx, 0, cx], [ 0, fy, cy], [ 0, 0, 1]] for a given image shape ''' # http://nghiaho.com/?page_id=576 # assume that the optical centre is in the middle: cy = int(shape[0] / 2) cx ...
[ "def", "genericCameraMatrix", "(", "shape", ",", "angularField", "=", "60", ")", ":", "# http://nghiaho.com/?page_id=576\r", "# assume that the optical centre is in the middle:\r", "cy", "=", "int", "(", "shape", "[", "0", "]", "/", "2", ")", "cx", "=", "int", "("...
Return a generic camera matrix [[fx, 0, cx], [ 0, fy, cy], [ 0, 0, 1]] for a given image shape
[ "Return", "a", "generic", "camera", "matrix", "[[", "fx", "0", "cx", "]", "[", "0", "fy", "cy", "]", "[", "0", "0", "1", "]]", "for", "a", "given", "image", "shape" ]
train
https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/utils/genericCameraMatrix.py#L7-L28
radjkarl/imgProcessor
imgProcessor/filters/standardDeviation.py
standardDeviation2d
def standardDeviation2d(img, ksize=5, blurred=None): ''' calculate the spatial resolved standard deviation for a given 2d array ksize -> kernel size blurred(optional) -> with same ksize gaussian filtered image setting this parameter reduces processing time ...
python
def standardDeviation2d(img, ksize=5, blurred=None): ''' calculate the spatial resolved standard deviation for a given 2d array ksize -> kernel size blurred(optional) -> with same ksize gaussian filtered image setting this parameter reduces processing time ...
[ "def", "standardDeviation2d", "(", "img", ",", "ksize", "=", "5", ",", "blurred", "=", "None", ")", ":", "if", "ksize", "not", "in", "(", "list", ",", "tuple", ")", ":", "ksize", "=", "(", "ksize", ",", "ksize", ")", "if", "blurred", "is", "None", ...
calculate the spatial resolved standard deviation for a given 2d array ksize -> kernel size blurred(optional) -> with same ksize gaussian filtered image setting this parameter reduces processing time
[ "calculate", "the", "spatial", "resolved", "standard", "deviation", "for", "a", "given", "2d", "array", "ksize", "-", ">", "kernel", "size", "blurred", "(", "optional", ")", "-", ">", "with", "same", "ksize", "gaussian", "filtered", "image", "setting", "this...
train
https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/filters/standardDeviation.py#L9-L31
radjkarl/imgProcessor
imgProcessor/filters/maskedFilter.py
maskedFilter
def maskedFilter(arr, mask, ksize=30, fill_mask=True, fn='median'): ''' fn['mean', 'median'] fill_mask=True: replaced masked areas with filtered results fill_mask=False: masked areas are ignored ''' if fill_mask: mask1 = mask out = ar...
python
def maskedFilter(arr, mask, ksize=30, fill_mask=True, fn='median'): ''' fn['mean', 'median'] fill_mask=True: replaced masked areas with filtered results fill_mask=False: masked areas are ignored ''' if fill_mask: mask1 = mask out = ar...
[ "def", "maskedFilter", "(", "arr", ",", "mask", ",", "ksize", "=", "30", ",", "fill_mask", "=", "True", ",", "fn", "=", "'median'", ")", ":", "if", "fill_mask", ":", "mask1", "=", "mask", "out", "=", "arr", "else", ":", "mask1", "=", "~", "mask", ...
fn['mean', 'median'] fill_mask=True: replaced masked areas with filtered results fill_mask=False: masked areas are ignored
[ "fn", "[", "mean", "median", "]", "fill_mask", "=", "True", ":", "replaced", "masked", "areas", "with", "filtered", "results", "fill_mask", "=", "False", ":", "masked", "areas", "are", "ignored" ]
train
https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/filters/maskedFilter.py#L12-L37
radjkarl/imgProcessor
imgProcessor/camera/flatField/vignettingFromDifferentObjects.py
vignettingFromDifferentObjects
def vignettingFromDifferentObjects(imgs, bg): ''' Extract vignetting from a set of images containing different devices The devices spatial inhomogeneities are averaged This method is referred as 'Method C' in --- K.Bedrich, M.Bokalic et al.: ELECTROLUMINESCENCE IMAGING OF PV D...
python
def vignettingFromDifferentObjects(imgs, bg): ''' Extract vignetting from a set of images containing different devices The devices spatial inhomogeneities are averaged This method is referred as 'Method C' in --- K.Bedrich, M.Bokalic et al.: ELECTROLUMINESCENCE IMAGING OF PV D...
[ "def", "vignettingFromDifferentObjects", "(", "imgs", ",", "bg", ")", ":", "f", "=", "FlatFieldFromImgFit", "(", "imgs", ",", "bg", ")", "return", "f", ".", "result", ",", "f", ".", "mask" ]
Extract vignetting from a set of images containing different devices The devices spatial inhomogeneities are averaged This method is referred as 'Method C' in --- K.Bedrich, M.Bokalic et al.: ELECTROLUMINESCENCE IMAGING OF PV DEVICES: ADVANCED FLAT FIELD CALIBRATION,2017 ---
[ "Extract", "vignetting", "from", "a", "set", "of", "images", "containing", "different", "devices", "The", "devices", "spatial", "inhomogeneities", "are", "averaged", "This", "method", "is", "referred", "as", "Method", "C", "in", "---", "K", ".", "Bedrich", "M"...
train
https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/camera/flatField/vignettingFromDifferentObjects.py#L129-L144
radjkarl/imgProcessor
imgProcessor/measure/SNR/SNR_IEC.py
SNR_IEC
def SNR_IEC(i1, i2, ibg=0, allow_color_images=False): ''' Calculate the averaged signal-to-noise ratio SNR50 as defined by IEC NP 60904-13 needs 2 reference EL images and one background image ''' # ensure images are type float64 (double precision): i1 = np.asfarray(i1) i2 = np....
python
def SNR_IEC(i1, i2, ibg=0, allow_color_images=False): ''' Calculate the averaged signal-to-noise ratio SNR50 as defined by IEC NP 60904-13 needs 2 reference EL images and one background image ''' # ensure images are type float64 (double precision): i1 = np.asfarray(i1) i2 = np....
[ "def", "SNR_IEC", "(", "i1", ",", "i2", ",", "ibg", "=", "0", ",", "allow_color_images", "=", "False", ")", ":", "# ensure images are type float64 (double precision):\r", "i1", "=", "np", ".", "asfarray", "(", "i1", ")", "i2", "=", "np", ".", "asfarray", "...
Calculate the averaged signal-to-noise ratio SNR50 as defined by IEC NP 60904-13 needs 2 reference EL images and one background image
[ "Calculate", "the", "averaged", "signal", "-", "to", "-", "noise", "ratio", "SNR50", "as", "defined", "by", "IEC", "NP", "60904", "-", "13", "needs", "2", "reference", "EL", "images", "and", "one", "background", "image" ]
train
https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/measure/SNR/SNR_IEC.py#L7-L33
radjkarl/imgProcessor
imgProcessor/transform/StitchImages.py
StitchImages._rotate
def _rotate(img, angle): ''' angle [DEG] ''' s = img.shape if angle == 0: return img else: M = cv2.getRotationMatrix2D((s[1] // 2, s[0] // 2), angle, 1) return cv2.warpAffine(img, M, (s...
python
def _rotate(img, angle): ''' angle [DEG] ''' s = img.shape if angle == 0: return img else: M = cv2.getRotationMatrix2D((s[1] // 2, s[0] // 2), angle, 1) return cv2.warpAffine(img, M, (s...
[ "def", "_rotate", "(", "img", ",", "angle", ")", ":", "s", "=", "img", ".", "shape", "if", "angle", "==", "0", ":", "return", "img", "else", ":", "M", "=", "cv2", ".", "getRotationMatrix2D", "(", "(", "s", "[", "1", "]", "//", "2", ",", "s", ...
angle [DEG]
[ "angle", "[", "DEG", "]" ]
train
https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/transform/StitchImages.py#L83-L93
radjkarl/imgProcessor
imgProcessor/transform/StitchImages.py
StitchImages._findOverlap
def _findOverlap(self, img_rgb, overlap, overlapDeviation, rotation, rotationDeviation): ''' return offset(x,y) which fit best self._base_img through template matching ''' # get gray images if len(img_rgb.shape) != len(img_rgb.shape): ...
python
def _findOverlap(self, img_rgb, overlap, overlapDeviation, rotation, rotationDeviation): ''' return offset(x,y) which fit best self._base_img through template matching ''' # get gray images if len(img_rgb.shape) != len(img_rgb.shape): ...
[ "def", "_findOverlap", "(", "self", ",", "img_rgb", ",", "overlap", ",", "overlapDeviation", ",", "rotation", ",", "rotationDeviation", ")", ":", "# get gray images\r", "if", "len", "(", "img_rgb", ".", "shape", ")", "!=", "len", "(", "img_rgb", ".", "shape"...
return offset(x,y) which fit best self._base_img through template matching
[ "return", "offset", "(", "x", "y", ")", "which", "fit", "best", "self", ".", "_base_img", "through", "template", "matching" ]
train
https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/transform/StitchImages.py#L95-L136
radjkarl/imgProcessor
imgProcessor/camera/NoiseLevelFunction.py
estimateFromImages
def estimateFromImages(imgs1, imgs2=None, mn_mx=None, nbins=100): ''' estimate the noise level function as stDev over image intensity from a set of 2 image groups images at the same position have to show the identical setup, so imgs1[i] - imgs2[i] = noise ''' if imgs2 is None: ...
python
def estimateFromImages(imgs1, imgs2=None, mn_mx=None, nbins=100): ''' estimate the noise level function as stDev over image intensity from a set of 2 image groups images at the same position have to show the identical setup, so imgs1[i] - imgs2[i] = noise ''' if imgs2 is None: ...
[ "def", "estimateFromImages", "(", "imgs1", ",", "imgs2", "=", "None", ",", "mn_mx", "=", "None", ",", "nbins", "=", "100", ")", ":", "if", "imgs2", "is", "None", ":", "imgs2", "=", "[", "None", "]", "*", "len", "(", "imgs1", ")", "else", ":", "as...
estimate the noise level function as stDev over image intensity from a set of 2 image groups images at the same position have to show the identical setup, so imgs1[i] - imgs2[i] = noise
[ "estimate", "the", "noise", "level", "function", "as", "stDev", "over", "image", "intensity", "from", "a", "set", "of", "2", "image", "groups", "images", "at", "the", "same", "position", "have", "to", "show", "the", "identical", "setup", "so", "imgs1", "["...
train
https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/camera/NoiseLevelFunction.py#L11-L68
radjkarl/imgProcessor
imgProcessor/camera/NoiseLevelFunction.py
_evaluate
def _evaluate(x, y, weights): ''' get the parameters of the, needed by 'function' through curve fitting ''' i = _validI(x, y, weights) xx = x[i] y = y[i] try: fitParams = _fit(xx, y) # bound noise fn to min defined y value: minY = function(xx[0], *fit...
python
def _evaluate(x, y, weights): ''' get the parameters of the, needed by 'function' through curve fitting ''' i = _validI(x, y, weights) xx = x[i] y = y[i] try: fitParams = _fit(xx, y) # bound noise fn to min defined y value: minY = function(xx[0], *fit...
[ "def", "_evaluate", "(", "x", ",", "y", ",", "weights", ")", ":", "i", "=", "_validI", "(", "x", ",", "y", ",", "weights", ")", "xx", "=", "x", "[", "i", "]", "y", "=", "y", "[", "i", "]", "try", ":", "fitParams", "=", "_fit", "(", "xx", ...
get the parameters of the, needed by 'function' through curve fitting
[ "get", "the", "parameters", "of", "the", "needed", "by", "function", "through", "curve", "fitting" ]
train
https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/camera/NoiseLevelFunction.py#L71-L91
radjkarl/imgProcessor
imgProcessor/camera/NoiseLevelFunction.py
boundedFunction
def boundedFunction(x, minY, ax, ay): ''' limit [function] to a minimum y value ''' y = function(x, ax, ay) return np.maximum(np.nan_to_num(y), minY)
python
def boundedFunction(x, minY, ax, ay): ''' limit [function] to a minimum y value ''' y = function(x, ax, ay) return np.maximum(np.nan_to_num(y), minY)
[ "def", "boundedFunction", "(", "x", ",", "minY", ",", "ax", ",", "ay", ")", ":", "y", "=", "function", "(", "x", ",", "ax", ",", "ay", ")", "return", "np", ".", "maximum", "(", "np", ".", "nan_to_num", "(", "y", ")", ",", "minY", ")" ]
limit [function] to a minimum y value
[ "limit", "[", "function", "]", "to", "a", "minimum", "y", "value" ]
train
https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/camera/NoiseLevelFunction.py#L94-L99
radjkarl/imgProcessor
imgProcessor/camera/NoiseLevelFunction.py
function
def function(x, ax, ay): ''' general square root function ''' with np.errstate(invalid='ignore'): return ay * (x - ax)**0.5
python
def function(x, ax, ay): ''' general square root function ''' with np.errstate(invalid='ignore'): return ay * (x - ax)**0.5
[ "def", "function", "(", "x", ",", "ax", ",", "ay", ")", ":", "with", "np", ".", "errstate", "(", "invalid", "=", "'ignore'", ")", ":", "return", "ay", "*", "(", "x", "-", "ax", ")", "**", "0.5" ]
general square root function
[ "general", "square", "root", "function" ]
train
https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/camera/NoiseLevelFunction.py#L102-L107