repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
jbeluch/xbmcswift2
xbmcswift2/cli/app.py
https://github.com/jbeluch/xbmcswift2/blob/0e7a3642499554edc8265fdf1ba6c5ee567daa78/xbmcswift2/cli/app.py#L147-L162
def once(plugin, parent_stack=None): '''A run mode for the CLI that runs the plugin once and exits.''' plugin.clear_added_items() items = plugin.run() # if update_listing=True, we need to remove the last url from the parent # stack if parent_stack and plugin._update_listing: del parent_...
[ "def", "once", "(", "plugin", ",", "parent_stack", "=", "None", ")", ":", "plugin", ".", "clear_added_items", "(", ")", "items", "=", "plugin", ".", "run", "(", ")", "# if update_listing=True, we need to remove the last url from the parent", "# stack", "if", "parent...
A run mode for the CLI that runs the plugin once and exits.
[ "A", "run", "mode", "for", "the", "CLI", "that", "runs", "the", "plugin", "once", "and", "exits", "." ]
python
train
pypa/pipenv
pipenv/vendor/urllib3/response.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/response.py#L696-L705
def geturl(self): """ Returns the URL that was the source of this response. If the request that generated this response redirected, this method will return the final redirect location. """ if self.retries is not None and len(self.retries.history): return self....
[ "def", "geturl", "(", "self", ")", ":", "if", "self", ".", "retries", "is", "not", "None", "and", "len", "(", "self", ".", "retries", ".", "history", ")", ":", "return", "self", ".", "retries", ".", "history", "[", "-", "1", "]", ".", "redirect_loc...
Returns the URL that was the source of this response. If the request that generated this response redirected, this method will return the final redirect location.
[ "Returns", "the", "URL", "that", "was", "the", "source", "of", "this", "response", ".", "If", "the", "request", "that", "generated", "this", "response", "redirected", "this", "method", "will", "return", "the", "final", "redirect", "location", "." ]
python
train
mk-fg/python-pulse-control
pulsectl/pulsectl.py
https://github.com/mk-fg/python-pulse-control/blob/902d5e9e5591b89c356e5194a370212e23fb0e93/pulsectl/pulsectl.py#L287-L302
def struct_from_value( cls, name, volume, channel_list=None, mute=False, device=None ): 'Same arguments as with class instance init.' chan_map = c.PA_CHANNEL_MAP() if not channel_list: c.pa.channel_map_init_mono(chan_map) else: if not is_str(channel_list): channel_list = b','.join(map(c.force_bytes, c...
[ "def", "struct_from_value", "(", "cls", ",", "name", ",", "volume", ",", "channel_list", "=", "None", ",", "mute", "=", "False", ",", "device", "=", "None", ")", ":", "chan_map", "=", "c", ".", "PA_CHANNEL_MAP", "(", ")", "if", "not", "channel_list", "...
Same arguments as with class instance init.
[ "Same", "arguments", "as", "with", "class", "instance", "init", "." ]
python
train
bspaans/python-mingus
mingus/extra/tunings.py
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/extra/tunings.py#L385-L415
def get_tuning(instrument, description, nr_of_strings=None, nr_of_courses=None): """Get the first tuning that satisfies the constraints. The instrument and description arguments are treated like case-insensitive prefixes. So search for 'bass' is the same is 'Bass Guitar'. Example: >>> tunings....
[ "def", "get_tuning", "(", "instrument", ",", "description", ",", "nr_of_strings", "=", "None", ",", "nr_of_courses", "=", "None", ")", ":", "searchi", "=", "str", ".", "upper", "(", "instrument", ")", "searchd", "=", "str", ".", "upper", "(", "description"...
Get the first tuning that satisfies the constraints. The instrument and description arguments are treated like case-insensitive prefixes. So search for 'bass' is the same is 'Bass Guitar'. Example: >>> tunings.get_tuning('guitar', 'standard') <tunings.StringTuning instance at 0x139ac20>
[ "Get", "the", "first", "tuning", "that", "satisfies", "the", "constraints", "." ]
python
train
aio-libs/aiohttp-security
aiohttp_security/api.py
https://github.com/aio-libs/aiohttp-security/blob/901cf1a7e0d884313966d6c569b118a0c6cb12b3/aiohttp_security/api.py#L12-L30
async def remember(request, response, identity, **kwargs): """Remember identity into response. The action is performed by identity_policy.remember() Usually the identity is stored in user cookies somehow but may be pushed into custom header also. """ assert isinstance(identity, str), identity ...
[ "async", "def", "remember", "(", "request", ",", "response", ",", "identity", ",", "*", "*", "kwargs", ")", ":", "assert", "isinstance", "(", "identity", ",", "str", ")", ",", "identity", "assert", "identity", "identity_policy", "=", "request", ".", "confi...
Remember identity into response. The action is performed by identity_policy.remember() Usually the identity is stored in user cookies somehow but may be pushed into custom header also.
[ "Remember", "identity", "into", "response", "." ]
python
train
brocade/pynos
pynos/versions/base/yang/brocade_ras.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/base/yang/brocade_ras.py#L267-L278
def bna_config_cmd_output_session_id(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") bna_config_cmd = ET.Element("bna_config_cmd") config = bna_config_cmd output = ET.SubElement(bna_config_cmd, "output") session_id = ET.SubElement(output,...
[ "def", "bna_config_cmd_output_session_id", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "bna_config_cmd", "=", "ET", ".", "Element", "(", "\"bna_config_cmd\"", ")", "config", "=", "bna_config_cmd"...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
wakatime/wakatime
wakatime/packages/ntlm_auth/compute_keys.py
https://github.com/wakatime/wakatime/blob/74519ace04e8472f3a3993269963732b9946a01d/wakatime/packages/ntlm_auth/compute_keys.py#L63-L74
def get_sign_key(exported_session_key, magic_constant): """ 3.4.5.2 SIGNKEY @param exported_session_key: A 128-bit session key used to derive signing and sealing keys @param magic_constant: A constant value set in the MS-NLMP documentation (constants.SignSealConstants) @return sign_key: Key used to...
[ "def", "get_sign_key", "(", "exported_session_key", ",", "magic_constant", ")", ":", "sign_key", "=", "hashlib", ".", "md5", "(", "exported_session_key", "+", "magic_constant", ")", ".", "digest", "(", ")", "return", "sign_key" ]
3.4.5.2 SIGNKEY @param exported_session_key: A 128-bit session key used to derive signing and sealing keys @param magic_constant: A constant value set in the MS-NLMP documentation (constants.SignSealConstants) @return sign_key: Key used to sign messages
[ "3", ".", "4", ".", "5", ".", "2", "SIGNKEY" ]
python
train
scanny/python-pptx
pptx/shapes/shapetree.py
https://github.com/scanny/python-pptx/blob/d6ab8234f8b03953d2f831ff9394b1852db34130/pptx/shapes/shapetree.py#L208-L220
def _next_shape_id(self): """Return a unique shape id suitable for use with a new shape. The returned id is 1 greater than the maximum shape id used so far. In practice, the minimum id is 2 because the spTree element is always assigned id="1". """ # ---presence of cached...
[ "def", "_next_shape_id", "(", "self", ")", ":", "# ---presence of cached-max-shape-id indicates turbo mode is on---", "if", "self", ".", "_cached_max_shape_id", "is", "not", "None", ":", "self", ".", "_cached_max_shape_id", "+=", "1", "return", "self", ".", "_cached_max...
Return a unique shape id suitable for use with a new shape. The returned id is 1 greater than the maximum shape id used so far. In practice, the minimum id is 2 because the spTree element is always assigned id="1".
[ "Return", "a", "unique", "shape", "id", "suitable", "for", "use", "with", "a", "new", "shape", "." ]
python
train
scottphilip/google-token
GoogleToken/Main.py
https://github.com/scottphilip/google-token/blob/5b7d5078d291980f686bd8b9f2129f8dfa2addb3/GoogleToken/Main.py#L8-L36
def get_google_token(account_email, oauth_client_id, oauth_redirect_uri, oauth_scope, account_password=None, account_otp_secret=None, **kwargs): """ :param account_email: (REQUIRED) ...
[ "def", "get_google_token", "(", "account_email", ",", "oauth_client_id", ",", "oauth_redirect_uri", ",", "oauth_scope", ",", "account_password", "=", "None", ",", "account_otp_secret", "=", "None", ",", "*", "*", "kwargs", ")", ":", "items", "=", "{", "\"account...
:param account_email: (REQUIRED) :param oauth_client_id: (REQUIRED) :param oauth_redirect_uri: (REQUIRED) :param oauth_scope: (REQUIRED) :param account_password: Necessary for first use. :param account_otp_secret: Necessary for first use if enabled on account :return: generated token
[ ":", "param", "account_email", ":", "(", "REQUIRED", ")", ":", "param", "oauth_client_id", ":", "(", "REQUIRED", ")", ":", "param", "oauth_redirect_uri", ":", "(", "REQUIRED", ")", ":", "param", "oauth_scope", ":", "(", "REQUIRED", ")", ":", "param", "acco...
python
train
SetBased/py-etlt
etlt/helper/Type2Helper.py
https://github.com/SetBased/py-etlt/blob/1c5b8ea60293c14f54d7845a9fe5c595021f66f2/etlt/helper/Type2Helper.py#L339-L356
def prepare_data(self, rows): """ Sets and prepares the rows. The rows are stored in groups in a dictionary. A group is a list of rows with the same pseudo key. The key in the dictionary is a tuple with the values of the pseudo key. :param list[dict] rows: The rows """ s...
[ "def", "prepare_data", "(", "self", ",", "rows", ")", ":", "self", ".", "_rows", "=", "dict", "(", ")", "for", "row", "in", "copy", ".", "copy", "(", "rows", ")", "if", "self", ".", "copy", "else", "rows", ":", "pseudo_key", "=", "self", ".", "_g...
Sets and prepares the rows. The rows are stored in groups in a dictionary. A group is a list of rows with the same pseudo key. The key in the dictionary is a tuple with the values of the pseudo key. :param list[dict] rows: The rows
[ "Sets", "and", "prepares", "the", "rows", ".", "The", "rows", "are", "stored", "in", "groups", "in", "a", "dictionary", ".", "A", "group", "is", "a", "list", "of", "rows", "with", "the", "same", "pseudo", "key", ".", "The", "key", "in", "the", "dicti...
python
train
manns/pyspread
pyspread/src/interfaces/pys.py
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/interfaces/pys.py#L308-L317
def _pys2macros(self, line): """Updates macros in code_array""" if self.code_array.dict_grid.macros and \ self.code_array.dict_grid.macros[-1] != "\n": # The last macro line does not end with \n # Therefore, if not new line is inserted, the codeis broken s...
[ "def", "_pys2macros", "(", "self", ",", "line", ")", ":", "if", "self", ".", "code_array", ".", "dict_grid", ".", "macros", "and", "self", ".", "code_array", ".", "dict_grid", ".", "macros", "[", "-", "1", "]", "!=", "\"\\n\"", ":", "# The last macro lin...
Updates macros in code_array
[ "Updates", "macros", "in", "code_array" ]
python
train
itamarst/eliot
eliot/_output.py
https://github.com/itamarst/eliot/blob/c03c96520c5492fadfc438b4b0f6336e2785ba2d/eliot/_output.py#L236-L245
def exclusively(f): """ Decorate a function to make it thread-safe by serializing invocations using a per-instance lock. """ @wraps(f) def exclusively_f(self, *a, **kw): with self._lock: return f(self, *a, **kw) return exclusively_f
[ "def", "exclusively", "(", "f", ")", ":", "@", "wraps", "(", "f", ")", "def", "exclusively_f", "(", "self", ",", "*", "a", ",", "*", "*", "kw", ")", ":", "with", "self", ".", "_lock", ":", "return", "f", "(", "self", ",", "*", "a", ",", "*", ...
Decorate a function to make it thread-safe by serializing invocations using a per-instance lock.
[ "Decorate", "a", "function", "to", "make", "it", "thread", "-", "safe", "by", "serializing", "invocations", "using", "a", "per", "-", "instance", "lock", "." ]
python
train
agoragames/haigha
haigha/classes/basic_class.py
https://github.com/agoragames/haigha/blob/7b004e1c0316ec14b94fec1c54554654c38b1a25/haigha/classes/basic_class.py#L179-L191
def _lookup_consumer_tag_by_consumer(self, consumer): '''Look up consumer tag given its consumer function NOTE: this protected method may be called by derived classes :param callable consumer: consumer function :returns: matching consumer tag or None :rtype: str or None ...
[ "def", "_lookup_consumer_tag_by_consumer", "(", "self", ",", "consumer", ")", ":", "for", "(", "tag", ",", "func", ")", "in", "self", ".", "_consumer_cb", ".", "iteritems", "(", ")", ":", "if", "func", "==", "consumer", ":", "return", "tag" ]
Look up consumer tag given its consumer function NOTE: this protected method may be called by derived classes :param callable consumer: consumer function :returns: matching consumer tag or None :rtype: str or None
[ "Look", "up", "consumer", "tag", "given", "its", "consumer", "function" ]
python
train
daknuett/py_register_machine2
core/parts.py
https://github.com/daknuett/py_register_machine2/blob/599c53cd7576297d0d7a53344ed5d9aa98acc751/core/parts.py#L149-L158
def setvalue(self, value): """ .. _setvalue: Set the signed value of the Integer. """ self._value = abs(value) self._sign = 0 if(value < 0): self._sign = 1
[ "def", "setvalue", "(", "self", ",", "value", ")", ":", "self", ".", "_value", "=", "abs", "(", "value", ")", "self", ".", "_sign", "=", "0", "if", "(", "value", "<", "0", ")", ":", "self", ".", "_sign", "=", "1" ]
.. _setvalue: Set the signed value of the Integer.
[ "..", "_setvalue", ":" ]
python
train
phac-nml/sistr_cmd
sistr/src/blast_wrapper/__init__.py
https://github.com/phac-nml/sistr_cmd/blob/4630fae72439723b354a94b94fbe76ad2f9f6295/sistr/src/blast_wrapper/__init__.py#L264-L277
def perfect_matches(self): """ Return pandas DataFrame with perfect BLAST matches (100% identity and coverage) Returns: pandas.DataFrame or None: DataFrame of perfect BLAST matches or None if no perfect matches exist """ if self.is_missing: return None ...
[ "def", "perfect_matches", "(", "self", ")", ":", "if", "self", ".", "is_missing", ":", "return", "None", "df_perfect_matches", "=", "self", ".", "df", "[", "(", "self", ".", "df", "[", "'coverage'", "]", "==", "1.0", ")", "&", "(", "self", ".", "df",...
Return pandas DataFrame with perfect BLAST matches (100% identity and coverage) Returns: pandas.DataFrame or None: DataFrame of perfect BLAST matches or None if no perfect matches exist
[ "Return", "pandas", "DataFrame", "with", "perfect", "BLAST", "matches", "(", "100%", "identity", "and", "coverage", ")" ]
python
train
buguroo/pyknow
pyknow/operator.py
https://github.com/buguroo/pyknow/blob/48818336f2e9a126f1964f2d8dc22d37ff800fe8/pyknow/operator.py#L137-L139
def ILIKE(pattern): """Unix shell-style wildcards. Case-insensitive""" return P(lambda x: fnmatch.fnmatch(x.lower(), pattern.lower()))
[ "def", "ILIKE", "(", "pattern", ")", ":", "return", "P", "(", "lambda", "x", ":", "fnmatch", ".", "fnmatch", "(", "x", ".", "lower", "(", ")", ",", "pattern", ".", "lower", "(", ")", ")", ")" ]
Unix shell-style wildcards. Case-insensitive
[ "Unix", "shell", "-", "style", "wildcards", ".", "Case", "-", "insensitive" ]
python
train
GetmeUK/MongoFrames
mongoframes/factory/blueprints.py
https://github.com/GetmeUK/MongoFrames/blob/7d2bd792235dfa77a9deecab5366f5f73480823d/mongoframes/factory/blueprints.py#L84-L97
def finish(cls, document): """ Take a assembled document and convert all assembled values to finished values. """ target_document = {} document_copy = {} for field_name, value in document.items(): maker = cls._instructions[field_name] targe...
[ "def", "finish", "(", "cls", ",", "document", ")", ":", "target_document", "=", "{", "}", "document_copy", "=", "{", "}", "for", "field_name", ",", "value", "in", "document", ".", "items", "(", ")", ":", "maker", "=", "cls", ".", "_instructions", "[", ...
Take a assembled document and convert all assembled values to finished values.
[ "Take", "a", "assembled", "document", "and", "convert", "all", "assembled", "values", "to", "finished", "values", "." ]
python
train
lemieuxl/pyGenClean
pyGenClean/Ethnicity/find_outliers.py
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/Ethnicity/find_outliers.py#L696-L720
def add_custom_options(parser): """Adds custom options to a parser. :param parser: the parser to which to add options. :type parser: argparse.ArgumentParser """ parser.add_argument("--outliers-of", type=str, metavar="POP", default="CEU", choices=["CEU", "YRI", "JPT-CHB"], ...
[ "def", "add_custom_options", "(", "parser", ")", ":", "parser", ".", "add_argument", "(", "\"--outliers-of\"", ",", "type", "=", "str", ",", "metavar", "=", "\"POP\"", ",", "default", "=", "\"CEU\"", ",", "choices", "=", "[", "\"CEU\"", ",", "\"YRI\"", ","...
Adds custom options to a parser. :param parser: the parser to which to add options. :type parser: argparse.ArgumentParser
[ "Adds", "custom", "options", "to", "a", "parser", "." ]
python
train
SylvanasSun/FishFishJump
fish_core/utils/common_utils.py
https://github.com/SylvanasSun/FishFishJump/blob/696212d242d8d572f3f1b43925f3d8ab8acc6a2d/fish_core/utils/common_utils.py#L58-L71
def check_validity_for_dict(keys, dict): """ >>> dict = {'a': 0, 'b': 1, 'c': 2} >>> keys = ['a', 'd', 'e'] >>> check_validity_for_dict(keys, dict) == False True >>> keys = ['a', 'b', 'c'] >>> check_validity_for_dict(keys, dict) == False False """ for key in keys: if key ...
[ "def", "check_validity_for_dict", "(", "keys", ",", "dict", ")", ":", "for", "key", "in", "keys", ":", "if", "key", "not", "in", "dict", "or", "dict", "[", "key", "]", "is", "''", "or", "dict", "[", "key", "]", "is", "None", ":", "return", "False",...
>>> dict = {'a': 0, 'b': 1, 'c': 2} >>> keys = ['a', 'd', 'e'] >>> check_validity_for_dict(keys, dict) == False True >>> keys = ['a', 'b', 'c'] >>> check_validity_for_dict(keys, dict) == False False
[ ">>>", "dict", "=", "{", "a", ":", "0", "b", ":", "1", "c", ":", "2", "}", ">>>", "keys", "=", "[", "a", "d", "e", "]", ">>>", "check_validity_for_dict", "(", "keys", "dict", ")", "==", "False", "True", ">>>", "keys", "=", "[", "a", "b", "c",...
python
train
cloudsmith-io/cloudsmith-cli
cloudsmith_cli/cli/config.py
https://github.com/cloudsmith-io/cloudsmith-cli/blob/5bc245ca5d0bfa85380be48e7c206b4c86cc6c8e/cloudsmith_cli/cli/config.py#L188-L191
def load_creds_file(self, path, profile=None): """Load the credentials config file.""" config_cls = self.get_creds_reader() return config_cls.load_config(self, path, profile=profile)
[ "def", "load_creds_file", "(", "self", ",", "path", ",", "profile", "=", "None", ")", ":", "config_cls", "=", "self", ".", "get_creds_reader", "(", ")", "return", "config_cls", ".", "load_config", "(", "self", ",", "path", ",", "profile", "=", "profile", ...
Load the credentials config file.
[ "Load", "the", "credentials", "config", "file", "." ]
python
train
mpg-age-bioinformatics/AGEpy
AGEpy/fasta.py
https://github.com/mpg-age-bioinformatics/AGEpy/blob/887808a7a2c1504f39ce8d8cb36c15c1721cd29f/AGEpy/fasta.py#L2-L34
def getFasta(opened_file, sequence_name): """ Retrieves a sequence from an opened multifasta file :param opened_file: an opened multifasta file eg. opened_file=open("/path/to/file.fa",'r+') :param sequence_name: the name of the sequence to be retrieved eg. for '>2 dna:chromosome chromosome:GRCm38:2:1:1...
[ "def", "getFasta", "(", "opened_file", ",", "sequence_name", ")", ":", "lines", "=", "opened_file", ".", "readlines", "(", ")", "seq", "=", "str", "(", "\"\"", ")", "for", "i", "in", "range", "(", "0", ",", "len", "(", "lines", ")", ")", ":", "line...
Retrieves a sequence from an opened multifasta file :param opened_file: an opened multifasta file eg. opened_file=open("/path/to/file.fa",'r+') :param sequence_name: the name of the sequence to be retrieved eg. for '>2 dna:chromosome chromosome:GRCm38:2:1:182113224:1 REF' use: sequence_name=str(2) returns...
[ "Retrieves", "a", "sequence", "from", "an", "opened", "multifasta", "file" ]
python
train
pv8/noipy
noipy/authinfo.py
https://github.com/pv8/noipy/blob/e37342505a463d02ea81b18a060eb7d84a5d1c27/noipy/authinfo.py#L84-L101
def load(provider, config_location=DEFAULT_CONFIG_DIR): """Load provider specific auth info from file """ auth = None auth_file = None try: config_dir = os.path.join(config_location, NOIPY_CONFIG) print("Loading stored auth info [%s]... " % config_dir, end="") auth_file = os.pat...
[ "def", "load", "(", "provider", ",", "config_location", "=", "DEFAULT_CONFIG_DIR", ")", ":", "auth", "=", "None", "auth_file", "=", "None", "try", ":", "config_dir", "=", "os", ".", "path", ".", "join", "(", "config_location", ",", "NOIPY_CONFIG", ")", "pr...
Load provider specific auth info from file
[ "Load", "provider", "specific", "auth", "info", "from", "file" ]
python
train
NetEaseGame/ATX
atx/ext/report/__init__.py
https://github.com/NetEaseGame/ATX/blob/f4415c57b45cb0730e08899cbc92a2af1c047ffb/atx/ext/report/__init__.py#L223-L238
def _take_screenshot(self, screenshot=False, name_prefix='unknown'): """ This is different from _save_screenshot. The return value maybe None or the screenshot path Args: screenshot: bool or PIL image """ if isinstance(screenshot, bool): if not sc...
[ "def", "_take_screenshot", "(", "self", ",", "screenshot", "=", "False", ",", "name_prefix", "=", "'unknown'", ")", ":", "if", "isinstance", "(", "screenshot", ",", "bool", ")", ":", "if", "not", "screenshot", ":", "return", "return", "self", ".", "_save_s...
This is different from _save_screenshot. The return value maybe None or the screenshot path Args: screenshot: bool or PIL image
[ "This", "is", "different", "from", "_save_screenshot", ".", "The", "return", "value", "maybe", "None", "or", "the", "screenshot", "path" ]
python
train
djgagne/hagelslag
hagelslag/processing/TrackModeler.py
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackModeler.py#L113-L142
def calc_copulas(self, output_file, model_names=("start-time", "translation-x", "translation-y"), label_columns=("Start_Time_Error", "Translation_Error_X", "Translation_Error_Y")): """ Calculate a copula multivariate normal distribution from...
[ "def", "calc_copulas", "(", "self", ",", "output_file", ",", "model_names", "=", "(", "\"start-time\"", ",", "\"translation-x\"", ",", "\"translation-y\"", ")", ",", "label_columns", "=", "(", "\"Start_Time_Error\"", ",", "\"Translation_Error_X\"", ",", "\"Translation...
Calculate a copula multivariate normal distribution from the training data for each group of ensemble members. Distributions are written to a pickle file for later use. Args: output_file: Pickle file model_names: Names of the tracking models label_columns: Names of th...
[ "Calculate", "a", "copula", "multivariate", "normal", "distribution", "from", "the", "training", "data", "for", "each", "group", "of", "ensemble", "members", ".", "Distributions", "are", "written", "to", "a", "pickle", "file", "for", "later", "use", ".", "Args...
python
train
jxtech/wechatpy
wechatpy/enterprise/client/api/material.py
https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/enterprise/client/api/material.py#L63-L82
def get_url(self, agent_id, media_id): """ 获取永久素材下载地址 详情请参考 https://qydev.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E6%B0%B8%E4%B9%85%E7%B4%A0%E6%9D%90 :param agent_id: 企业应用的id :param media_id: 媒体文件 ID :return: 临时素材下载地址 """ parts = ( ...
[ "def", "get_url", "(", "self", ",", "agent_id", ",", "media_id", ")", ":", "parts", "=", "(", "'https://qyapi.weixin.qq.com/cgi-bin/material/get'", ",", "'?access_token='", ",", "self", ".", "access_token", ",", "'&media_id='", ",", "media_id", ",", "'&agentid='", ...
获取永久素材下载地址 详情请参考 https://qydev.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E6%B0%B8%E4%B9%85%E7%B4%A0%E6%9D%90 :param agent_id: 企业应用的id :param media_id: 媒体文件 ID :return: 临时素材下载地址
[ "获取永久素材下载地址", "详情请参考", "https", ":", "//", "qydev", ".", "weixin", ".", "qq", ".", "com", "/", "wiki", "/", "index", ".", "php?title", "=", "%E8%8E%B7%E5%8F%96%E6%B0%B8%E4%B9%85%E7%B4%A0%E6%9D%90" ]
python
train
Erotemic/utool
utool/util_dict.py
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_dict.py#L751-L796
def update_existing(dict1, dict2, copy=False, assert_exists=False, iswarning=False, alias_dict=None): r""" updates vals in dict1 using vals from dict2 only if the key is already in dict1. Args: dict1 (dict): dict2 (dict): copy (bool): if true modifies diction...
[ "def", "update_existing", "(", "dict1", ",", "dict2", ",", "copy", "=", "False", ",", "assert_exists", "=", "False", ",", "iswarning", "=", "False", ",", "alias_dict", "=", "None", ")", ":", "if", "assert_exists", ":", "try", ":", "assert_keys_are_subset", ...
r""" updates vals in dict1 using vals from dict2 only if the key is already in dict1. Args: dict1 (dict): dict2 (dict): copy (bool): if true modifies dictionary in place (default = False) assert_exists (bool): if True throws error if new key specified (default = False) ...
[ "r", "updates", "vals", "in", "dict1", "using", "vals", "from", "dict2", "only", "if", "the", "key", "is", "already", "in", "dict1", "." ]
python
train
saltstack/salt
salt/utils/compat.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/compat.py#L18-L26
def pack_dunder(name): ''' Compatibility helper function to make __utils__ available on demand. ''' # TODO: Deprecate starting with Beryllium mod = sys.modules[name] if not hasattr(mod, '__utils__'): setattr(mod, '__utils__', salt.loader.utils(mod.__opts__))
[ "def", "pack_dunder", "(", "name", ")", ":", "# TODO: Deprecate starting with Beryllium", "mod", "=", "sys", ".", "modules", "[", "name", "]", "if", "not", "hasattr", "(", "mod", ",", "'__utils__'", ")", ":", "setattr", "(", "mod", ",", "'__utils__'", ",", ...
Compatibility helper function to make __utils__ available on demand.
[ "Compatibility", "helper", "function", "to", "make", "__utils__", "available", "on", "demand", "." ]
python
train
erikrose/nose-progressive
noseprogressive/bar.py
https://github.com/erikrose/nose-progressive/blob/42853f11290cfaac8aa3d204714b71e27cc4ec07/noseprogressive/bar.py#L74-L78
def erase(self): """White out the progress bar.""" with self._at_last_line(): self.stream.write(self._term.clear_eol) self.stream.flush()
[ "def", "erase", "(", "self", ")", ":", "with", "self", ".", "_at_last_line", "(", ")", ":", "self", ".", "stream", ".", "write", "(", "self", ".", "_term", ".", "clear_eol", ")", "self", ".", "stream", ".", "flush", "(", ")" ]
White out the progress bar.
[ "White", "out", "the", "progress", "bar", "." ]
python
train
tijme/not-your-average-web-crawler
nyawc/Crawler.py
https://github.com/tijme/not-your-average-web-crawler/blob/d77c14e1616c541bb3980f649a7e6f8ed02761fb/nyawc/Crawler.py#L213-L241
def __request_start(self, queue_item): """Execute the request in given queue item. Args: queue_item (:class:`nyawc.QueueItem`): The request/response pair to scrape. """ try: action = self.__options.callbacks.request_before_start(self.queue, queue_item) ...
[ "def", "__request_start", "(", "self", ",", "queue_item", ")", ":", "try", ":", "action", "=", "self", ".", "__options", ".", "callbacks", ".", "request_before_start", "(", "self", ".", "queue", ",", "queue_item", ")", "except", "Exception", "as", "e", ":"...
Execute the request in given queue item. Args: queue_item (:class:`nyawc.QueueItem`): The request/response pair to scrape.
[ "Execute", "the", "request", "in", "given", "queue", "item", "." ]
python
train
nfcpy/nfcpy
src/nfc/tag/tt1.py
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/tag/tt1.py#L403-L410
def read_block(self, block): """Read an 8-byte data block at address (block * 8). """ if block < 0 or block > 255: raise ValueError("invalid block number") log.debug("read block {0}".format(block)) cmd = "\x02" + chr(block) + 8 * chr(0) + self.uid return self....
[ "def", "read_block", "(", "self", ",", "block", ")", ":", "if", "block", "<", "0", "or", "block", ">", "255", ":", "raise", "ValueError", "(", "\"invalid block number\"", ")", "log", ".", "debug", "(", "\"read block {0}\"", ".", "format", "(", "block", "...
Read an 8-byte data block at address (block * 8).
[ "Read", "an", "8", "-", "byte", "data", "block", "at", "address", "(", "block", "*", "8", ")", "." ]
python
train
raiden-network/raiden
raiden/network/transport/matrix/transport.py
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/transport.py#L547-L559
def send_global(self, room: str, message: Message) -> None: """Sends a message to one of the global rooms These rooms aren't being listened on and therefore no reply could be heard, so these messages are sent in a send-and-forget async way. The actual room name is composed from the suff...
[ "def", "send_global", "(", "self", ",", "room", ":", "str", ",", "message", ":", "Message", ")", "->", "None", ":", "self", ".", "_global_send_queue", ".", "put", "(", "(", "room", ",", "message", ")", ")", "self", ".", "_global_send_event", ".", "set"...
Sends a message to one of the global rooms These rooms aren't being listened on and therefore no reply could be heard, so these messages are sent in a send-and-forget async way. The actual room name is composed from the suffix given as parameter and chain name or id e.g.: raiden_ropsten...
[ "Sends", "a", "message", "to", "one", "of", "the", "global", "rooms" ]
python
train
rbuffat/pyepw
pyepw/epw.py
https://github.com/rbuffat/pyepw/blob/373d4d3c8386c8d35789f086ac5f6018c2711745/pyepw/epw.py#L3220-L3240
def dbmax50years(self, value=None): """ Corresponds to IDD Field `dbmax50years` 50-year return period values for maximum extreme dry-bulb temperature Args: value (float): value for IDD Field `dbmax50years` Unit: C if `value` is None it will not be ch...
[ "def", "dbmax50years", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "not", "None", ":", "try", ":", "value", "=", "float", "(", "value", ")", "except", "ValueError", ":", "raise", "ValueError", "(", "'value {} need to be of type f...
Corresponds to IDD Field `dbmax50years` 50-year return period values for maximum extreme dry-bulb temperature Args: value (float): value for IDD Field `dbmax50years` Unit: C if `value` is None it will not be checked against the specification a...
[ "Corresponds", "to", "IDD", "Field", "dbmax50years", "50", "-", "year", "return", "period", "values", "for", "maximum", "extreme", "dry", "-", "bulb", "temperature" ]
python
train
SBRG/ssbio
ssbio/protein/sequence/properties/cctop.py
https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/properties/cctop.py#L61-L92
def parse_cctop_full(infile): """Parse a CCTOP XML results file and return a list of the consensus TM domains in the format:: [(1, inside_outside_or_tm), (2, inside_outside_or_tm), ...] Where the first value of a tuple is the sequence residue number, and the second is the...
[ "def", "parse_cctop_full", "(", "infile", ")", ":", "parser", "=", "etree", ".", "XMLParser", "(", "ns_clean", "=", "True", ")", "with", "open", "(", "infile", ",", "'r'", ")", "as", "f", ":", "tree", "=", "etree", ".", "fromstring", "(", "f", ".", ...
Parse a CCTOP XML results file and return a list of the consensus TM domains in the format:: [(1, inside_outside_or_tm), (2, inside_outside_or_tm), ...] Where the first value of a tuple is the sequence residue number, and the second is the predicted location with the valu...
[ "Parse", "a", "CCTOP", "XML", "results", "file", "and", "return", "a", "list", "of", "the", "consensus", "TM", "domains", "in", "the", "format", "::" ]
python
train
mikedh/trimesh
trimesh/path/path.py
https://github.com/mikedh/trimesh/blob/25e059bf6d4caa74f62ffd58ce4f61a90ee4e518/trimesh/path/path.py#L315-L327
def is_closed(self): """ Are all entities connected to other entities. Returns ----------- closed : bool Every entity is connected at its ends """ closed = all(i == 2 for i in dict(self.vertex_graph.degree()).values()) retu...
[ "def", "is_closed", "(", "self", ")", ":", "closed", "=", "all", "(", "i", "==", "2", "for", "i", "in", "dict", "(", "self", ".", "vertex_graph", ".", "degree", "(", ")", ")", ".", "values", "(", ")", ")", "return", "closed" ]
Are all entities connected to other entities. Returns ----------- closed : bool Every entity is connected at its ends
[ "Are", "all", "entities", "connected", "to", "other", "entities", "." ]
python
train
evhub/coconut
coconut/compiler/matching.py
https://github.com/evhub/coconut/blob/ff97177344e7604e89a0a98a977a87ed2a56fc6d/coconut/compiler/matching.py#L145-L149
def get_defs(self, position=None): """Gets the defs at the position.""" if position is None: position = self.position return self.checkdefs[position][1]
[ "def", "get_defs", "(", "self", ",", "position", "=", "None", ")", ":", "if", "position", "is", "None", ":", "position", "=", "self", ".", "position", "return", "self", ".", "checkdefs", "[", "position", "]", "[", "1", "]" ]
Gets the defs at the position.
[ "Gets", "the", "defs", "at", "the", "position", "." ]
python
train
DataONEorg/d1_python
lib_common/src/d1_common/resource_map.py
https://github.com/DataONEorg/d1_python/blob/3ac4d4f3ca052d3e8641a6a329cab526c8ddcb0d/lib_common/src/d1_common/resource_map.py#L400-L425
def addDataDocuments(self, scidata_pid_list, scimeta_pid=None): """Add Science Data object(s) Args: scidata_pid_list : list of str List of one or more PIDs of Science Data objects scimeta_pid: str PID of a Science Metadata object that documents the Science D...
[ "def", "addDataDocuments", "(", "self", ",", "scidata_pid_list", ",", "scimeta_pid", "=", "None", ")", ":", "mpids", "=", "self", ".", "getAggregatedScienceMetadataPids", "(", ")", "if", "scimeta_pid", "is", "None", ":", "if", "len", "(", "mpids", ")", ">", ...
Add Science Data object(s) Args: scidata_pid_list : list of str List of one or more PIDs of Science Data objects scimeta_pid: str PID of a Science Metadata object that documents the Science Data objects.
[ "Add", "Science", "Data", "object", "(", "s", ")" ]
python
train
roll/interest-py
interest/helpers/chain.py
https://github.com/roll/interest-py/blob/e6e1def4f2999222aac2fb1d290ae94250673b89/interest/helpers/chain.py#L38-L47
def push(self, item, *, index=None): """Push item to the chain. """ if index is None: self.__list.append(item) else: self.__list.insert(index, item) name = getattr(item, 'name', None) if name is not None: self.__dict[name] = item
[ "def", "push", "(", "self", ",", "item", ",", "*", ",", "index", "=", "None", ")", ":", "if", "index", "is", "None", ":", "self", ".", "__list", ".", "append", "(", "item", ")", "else", ":", "self", ".", "__list", ".", "insert", "(", "index", "...
Push item to the chain.
[ "Push", "item", "to", "the", "chain", "." ]
python
train
harlowja/fasteners
fasteners/lock.py
https://github.com/harlowja/fasteners/blob/8f3bbab0204a50037448a8fad7a6bf12eb1a2695/fasteners/lock.py#L257-L305
def locked(*args, **kwargs): """A locking **method** decorator. It will look for a provided attribute (typically a lock or a list of locks) on the first argument of the function decorated (typically this is the 'self' object) and before executing the decorated function it activates the given lock o...
[ "def", "locked", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "def", "decorator", "(", "f", ")", ":", "attr_name", "=", "kwargs", ".", "get", "(", "'lock'", ",", "'_lock'", ")", "logger", "=", "kwargs", ".", "get", "(", "'logger'", ")", "...
A locking **method** decorator. It will look for a provided attribute (typically a lock or a list of locks) on the first argument of the function decorated (typically this is the 'self' object) and before executing the decorated function it activates the given lock or list of locks as a context manager...
[ "A", "locking", "**", "method", "**", "decorator", "." ]
python
train
PyProphet/pyprophet
pyprophet/stats.py
https://github.com/PyProphet/pyprophet/blob/f546ad171750cd7685afbde6785fe71f82cadb35/pyprophet/stats.py#L122-L130
def pnorm(stat, stat0): """ [P(X>pi, mu, sigma) for pi in pvalues] for normal distributed stat with expectation value mu and std deviation sigma """ mu, sigma = mean_and_std_dev(stat0) stat = to_one_dim_array(stat, np.float64) args = (stat - mu) / sigma return 1-(0.5 * (1.0 + scipy.special.erf...
[ "def", "pnorm", "(", "stat", ",", "stat0", ")", ":", "mu", ",", "sigma", "=", "mean_and_std_dev", "(", "stat0", ")", "stat", "=", "to_one_dim_array", "(", "stat", ",", "np", ".", "float64", ")", "args", "=", "(", "stat", "-", "mu", ")", "/", "sigma...
[P(X>pi, mu, sigma) for pi in pvalues] for normal distributed stat with expectation value mu and std deviation sigma
[ "[", "P", "(", "X", ">", "pi", "mu", "sigma", ")", "for", "pi", "in", "pvalues", "]", "for", "normal", "distributed", "stat", "with", "expectation", "value", "mu", "and", "std", "deviation", "sigma" ]
python
test
JukeboxPipeline/jukebox-core
src/jukeboxcore/addons/guerilla/guerillamgmt.py
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/addons/guerilla/guerillamgmt.py#L428-L444
def add_user(self, ): """Add a user and store it in the self.users :returns: None :rtype: None :raises: None """ i = self.user_tablev.currentIndex() item = i.internalPointer() if item: user = item.internal_data() if self._project: ...
[ "def", "add_user", "(", "self", ",", ")", ":", "i", "=", "self", ".", "user_tablev", ".", "currentIndex", "(", ")", "item", "=", "i", ".", "internalPointer", "(", ")", "if", "item", ":", "user", "=", "item", ".", "internal_data", "(", ")", "if", "s...
Add a user and store it in the self.users :returns: None :rtype: None :raises: None
[ "Add", "a", "user", "and", "store", "it", "in", "the", "self", ".", "users" ]
python
train
ghickman/django-cache-url
django_cache_url.py
https://github.com/ghickman/django-cache-url/blob/aba81916a3e0b6e49007eb514b690bcd2ccca118/django_cache_url.py#L41-L50
def config(env=DEFAULT_ENV, default='locmem://'): """Returns configured CACHES dictionary from CACHE_URL""" config = {} s = os.environ.get(env, default) if s: config = parse(s) return config
[ "def", "config", "(", "env", "=", "DEFAULT_ENV", ",", "default", "=", "'locmem://'", ")", ":", "config", "=", "{", "}", "s", "=", "os", ".", "environ", ".", "get", "(", "env", ",", "default", ")", "if", "s", ":", "config", "=", "parse", "(", "s",...
Returns configured CACHES dictionary from CACHE_URL
[ "Returns", "configured", "CACHES", "dictionary", "from", "CACHE_URL" ]
python
train
pipermerriam/flex
flex/validation/common.py
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/validation/common.py#L139-L143
def generate_minimum_validator(minimum, exclusiveMinimum=False, **kwargs): """ Generator function returning a callable for minimum value validation. """ return functools.partial(validate_minimum, minimum=minimum, is_exclusive=exclusiveMinimum)
[ "def", "generate_minimum_validator", "(", "minimum", ",", "exclusiveMinimum", "=", "False", ",", "*", "*", "kwargs", ")", ":", "return", "functools", ".", "partial", "(", "validate_minimum", ",", "minimum", "=", "minimum", ",", "is_exclusive", "=", "exclusiveMin...
Generator function returning a callable for minimum value validation.
[ "Generator", "function", "returning", "a", "callable", "for", "minimum", "value", "validation", "." ]
python
train
moderngl/moderngl
moderngl/context.py
https://github.com/moderngl/moderngl/blob/a8f5dce8dc72ae84a2f9523887fb5f6b620049b9/moderngl/context.py#L770-L829
def program(self, *, vertex_shader, fragment_shader=None, geometry_shader=None, tess_control_shader=None, tess_evaluation_shader=None, varyings=()) -> 'Program': ''' Create a :py:class:`Program` object. Only linked programs will be returned. A single shader ...
[ "def", "program", "(", "self", ",", "*", ",", "vertex_shader", ",", "fragment_shader", "=", "None", ",", "geometry_shader", "=", "None", ",", "tess_control_shader", "=", "None", ",", "tess_evaluation_shader", "=", "None", ",", "varyings", "=", "(", ")", ")",...
Create a :py:class:`Program` object. Only linked programs will be returned. A single shader in the `shaders` parameter is also accepted. The varyings are only used when a transform program is created. Args: shaders (list): A list of :py:class:`Shader` o...
[ "Create", "a", ":", "py", ":", "class", ":", "Program", "object", "." ]
python
train
django-fluent/django-fluent-contents
fluent_contents/plugins/markup/content_plugins.py
https://github.com/django-fluent/django-fluent-contents/blob/896f14add58471b98d7aa295b2c9e6abedec9003/fluent_contents/plugins/markup/content_plugins.py#L43-L57
def _create_markup_plugin(language, model): """ Create a new MarkupPlugin class that represents the plugin type. """ form = type("{0}MarkupItemForm".format(language.capitalize()), (MarkupItemForm,), { 'default_language': language, }) classname = "{0}MarkupPlugin".format(language.capital...
[ "def", "_create_markup_plugin", "(", "language", ",", "model", ")", ":", "form", "=", "type", "(", "\"{0}MarkupItemForm\"", ".", "format", "(", "language", ".", "capitalize", "(", ")", ")", ",", "(", "MarkupItemForm", ",", ")", ",", "{", "'default_language'"...
Create a new MarkupPlugin class that represents the plugin type.
[ "Create", "a", "new", "MarkupPlugin", "class", "that", "represents", "the", "plugin", "type", "." ]
python
train
KnowledgeLinks/rdfframework
rdfframework/datatypes/namespaces.py
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datatypes/namespaces.py#L651-L662
def rpyhttp(value): """ converts a no namespace pyuri back to a standard uri """ if value.startswith("http"): return value try: parts = value.split("_") del parts[0] _uri = base64.b64decode(parts.pop(0)).decode() return _uri + "_".join(...
[ "def", "rpyhttp", "(", "value", ")", ":", "if", "value", ".", "startswith", "(", "\"http\"", ")", ":", "return", "value", "try", ":", "parts", "=", "value", ".", "split", "(", "\"_\"", ")", "del", "parts", "[", "0", "]", "_uri", "=", "base64", ".",...
converts a no namespace pyuri back to a standard uri
[ "converts", "a", "no", "namespace", "pyuri", "back", "to", "a", "standard", "uri" ]
python
train
ubyssey/dispatch
dispatch/modules/content/managers.py
https://github.com/ubyssey/dispatch/blob/8da6084fe61726f20e9cf675190480cfc45ee764/dispatch/modules/content/managers.py#L6-L31
def get(self, *args, **kwargs): """Get the latest article with the given primary key.""" if 'pk' in kwargs: kwargs['parent'] = kwargs['pk'] kwargs['head'] = True del kwargs['pk'] """If the url requested includes the querystring parameters 'version' and 'previ...
[ "def", "get", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "'pk'", "in", "kwargs", ":", "kwargs", "[", "'parent'", "]", "=", "kwargs", "[", "'pk'", "]", "kwargs", "[", "'head'", "]", "=", "True", "del", "kwargs", "[", ...
Get the latest article with the given primary key.
[ "Get", "the", "latest", "article", "with", "the", "given", "primary", "key", "." ]
python
test
elastic/elasticsearch-dsl-py
elasticsearch_dsl/index.py
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L436-L443
def get_alias(self, using=None, **kwargs): """ Retrieve a specified alias. Any additional keyword arguments will be passed to ``Elasticsearch.indices.get_alias`` unchanged. """ return self._get_connection(using).indices.get_alias(index=self._name, **kwargs)
[ "def", "get_alias", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "get_alias", "(", "index", "=", "self", ".", "_name", ",", "*", "*", "k...
Retrieve a specified alias. Any additional keyword arguments will be passed to ``Elasticsearch.indices.get_alias`` unchanged.
[ "Retrieve", "a", "specified", "alias", "." ]
python
train
monarch-initiative/dipper
dipper/sources/MyDrug.py
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/MyDrug.py#L143-L153
def _add_outcome_provenance(self, association, outcome): """ :param association: str association curie :param outcome: dict (json) :return: None """ provenance = Provenance(self.graph) base = self.curie_map.get_base() provenance.add_agent_to_graph(base, '...
[ "def", "_add_outcome_provenance", "(", "self", ",", "association", ",", "outcome", ")", ":", "provenance", "=", "Provenance", "(", "self", ".", "graph", ")", "base", "=", "self", ".", "curie_map", ".", "get_base", "(", ")", "provenance", ".", "add_agent_to_g...
:param association: str association curie :param outcome: dict (json) :return: None
[ ":", "param", "association", ":", "str", "association", "curie", ":", "param", "outcome", ":", "dict", "(", "json", ")", ":", "return", ":", "None" ]
python
train
metglobal/django-exchange
exchange/utils.py
https://github.com/metglobal/django-exchange/blob/2133593885e02f42a4ed2ed4be2763c4777a1245/exchange/utils.py#L101-L119
def memoize(ttl=None): """ Cache the result of the function call with given args for until ttl (datetime.timedelta) expires. """ def decorator(obj): cache = obj.cache = {} @functools.wraps(obj) def memoizer(*args, **kwargs): now = datetime.now() key =...
[ "def", "memoize", "(", "ttl", "=", "None", ")", ":", "def", "decorator", "(", "obj", ")", ":", "cache", "=", "obj", ".", "cache", "=", "{", "}", "@", "functools", ".", "wraps", "(", "obj", ")", "def", "memoizer", "(", "*", "args", ",", "*", "*"...
Cache the result of the function call with given args for until ttl (datetime.timedelta) expires.
[ "Cache", "the", "result", "of", "the", "function", "call", "with", "given", "args", "for", "until", "ttl", "(", "datetime", ".", "timedelta", ")", "expires", "." ]
python
train
maas/python-libmaas
maas/client/bones/helpers.py
https://github.com/maas/python-libmaas/blob/4092c68ef7fb1753efc843569848e2bcc3415002/maas/client/bones/helpers.py#L43-L60
async def fetch_api_description( url: typing.Union[str, ParseResult, SplitResult], insecure: bool = False): """Fetch the API description from the remote MAAS instance.""" url_describe = urljoin(_ensure_url_string(url), "describe/") connector = aiohttp.TCPConnector(verify_ssl=(not insecure)) ...
[ "async", "def", "fetch_api_description", "(", "url", ":", "typing", ".", "Union", "[", "str", ",", "ParseResult", ",", "SplitResult", "]", ",", "insecure", ":", "bool", "=", "False", ")", ":", "url_describe", "=", "urljoin", "(", "_ensure_url_string", "(", ...
Fetch the API description from the remote MAAS instance.
[ "Fetch", "the", "API", "description", "from", "the", "remote", "MAAS", "instance", "." ]
python
train
snowblink14/smatch
smatch-table.py
https://github.com/snowblink14/smatch/blob/ad7e6553a3d52e469b2eef69d7716c87a67eedac/smatch-table.py#L167-L181
def build_arg_parser2(): """ Build an argument parser using optparse. Use it when python version is 2.5 or 2.6. """ usage_str = "Smatch table calculator -- arguments" parser = optparse.OptionParser(usage=usage_str) parser.add_option("--fl", dest="fl", type="string", help='AMR ID list file') ...
[ "def", "build_arg_parser2", "(", ")", ":", "usage_str", "=", "\"Smatch table calculator -- arguments\"", "parser", "=", "optparse", ".", "OptionParser", "(", "usage", "=", "usage_str", ")", "parser", ".", "add_option", "(", "\"--fl\"", ",", "dest", "=", "\"fl\"", ...
Build an argument parser using optparse. Use it when python version is 2.5 or 2.6.
[ "Build", "an", "argument", "parser", "using", "optparse", ".", "Use", "it", "when", "python", "version", "is", "2", ".", "5", "or", "2", ".", "6", "." ]
python
train
ababic/django-cogwheels
cogwheels/helpers/settings.py
https://github.com/ababic/django-cogwheels/blob/f185245f6ea1d6a2c23b94ff7304c1594049ca56/cogwheels/helpers/settings.py#L312-L358
def _get_raw_value(self, setting_name, accept_deprecated='', warn_if_overridden=False, suppress_warnings=False, warning_stacklevel=3): """ Returns the original/raw value for an app setting with the name ``setting_name``, exactly as it has been define...
[ "def", "_get_raw_value", "(", "self", ",", "setting_name", ",", "accept_deprecated", "=", "''", ",", "warn_if_overridden", "=", "False", ",", "suppress_warnings", "=", "False", ",", "warning_stacklevel", "=", "3", ")", ":", "if", "not", "self", ".", "in_defaul...
Returns the original/raw value for an app setting with the name ``setting_name``, exactly as it has been defined in the defaults module or a user's Django settings. If the requested setting is deprecated, ``warn_if_overridden`` is ``True``, and the setting is overridden by a user, a sui...
[ "Returns", "the", "original", "/", "raw", "value", "for", "an", "app", "setting", "with", "the", "name", "setting_name", "exactly", "as", "it", "has", "been", "defined", "in", "the", "defaults", "module", "or", "a", "user", "s", "Django", "settings", "." ]
python
train
materialsproject/pymatgen
pymatgen/analysis/substrate_analyzer.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/substrate_analyzer.py#L247-L296
def calculate(self, film, substrate, elasticity_tensor=None, film_millers=None, substrate_millers=None, ground_state_energy=0, lowest=False): """ Finds all topological matches for the substrate and calculates elastic strain energy and total energy for the film...
[ "def", "calculate", "(", "self", ",", "film", ",", "substrate", ",", "elasticity_tensor", "=", "None", ",", "film_millers", "=", "None", ",", "substrate_millers", "=", "None", ",", "ground_state_energy", "=", "0", ",", "lowest", "=", "False", ")", ":", "se...
Finds all topological matches for the substrate and calculates elastic strain energy and total energy for the film if elasticity tensor and ground state energy are provided: Args: film(Structure): conventional standard structure for the film substrate(Structure): convent...
[ "Finds", "all", "topological", "matches", "for", "the", "substrate", "and", "calculates", "elastic", "strain", "energy", "and", "total", "energy", "for", "the", "film", "if", "elasticity", "tensor", "and", "ground", "state", "energy", "are", "provided", ":" ]
python
train
pallets/flask-sqlalchemy
flask_sqlalchemy/__init__.py
https://github.com/pallets/flask-sqlalchemy/blob/3d3261f4fc6d28f5bf407cf7d523e36a09a8c144/flask_sqlalchemy/__init__.py#L331-L337
def pages(self): """The total number of pages""" if self.per_page == 0 or self.total is None: pages = 0 else: pages = int(ceil(self.total / float(self.per_page))) return pages
[ "def", "pages", "(", "self", ")", ":", "if", "self", ".", "per_page", "==", "0", "or", "self", ".", "total", "is", "None", ":", "pages", "=", "0", "else", ":", "pages", "=", "int", "(", "ceil", "(", "self", ".", "total", "/", "float", "(", "sel...
The total number of pages
[ "The", "total", "number", "of", "pages" ]
python
train
Azure/azure-uamqp-python
uamqp/async_ops/client_async.py
https://github.com/Azure/azure-uamqp-python/blob/b67e4fcaf2e8a337636947523570239c10a58ae2/uamqp/async_ops/client_async.py#L546-L566
async def redirect_async(self, redirect, auth): """Redirect the client endpoint using a Link DETACH redirect response. :param redirect: The Link DETACH redirect details. :type redirect: ~uamqp.errors.LinkRedirect :param auth: Authentication credentials to the redirected endpoint...
[ "async", "def", "redirect_async", "(", "self", ",", "redirect", ",", "auth", ")", ":", "if", "self", ".", "_ext_connection", ":", "raise", "ValueError", "(", "\"Clients with a shared connection cannot be \"", "\"automatically redirected.\"", ")", "if", "self", ".", ...
Redirect the client endpoint using a Link DETACH redirect response. :param redirect: The Link DETACH redirect details. :type redirect: ~uamqp.errors.LinkRedirect :param auth: Authentication credentials to the redirected endpoint. :type auth: ~uamqp.authentication.common.AMQPAuth
[ "Redirect", "the", "client", "endpoint", "using", "a", "Link", "DETACH", "redirect", "response", "." ]
python
train
hapylestat/apputils
apputils/settings/general.py
https://github.com/hapylestat/apputils/blob/5d185616feda27e6e21273307161471ef11a3518/apputils/settings/general.py#L134-L154
def exists(self, path): """ Check for property existence :param path: path to the property with name including :return: """ if self._json is None: return False node = self._json path_arr = path.split('.') while len(path_arr) > 0: path_item = path_arr.pop(0) if path...
[ "def", "exists", "(", "self", ",", "path", ")", ":", "if", "self", ".", "_json", "is", "None", ":", "return", "False", "node", "=", "self", ".", "_json", "path_arr", "=", "path", ".", "split", "(", "'.'", ")", "while", "len", "(", "path_arr", ")", ...
Check for property existence :param path: path to the property with name including :return:
[ "Check", "for", "property", "existence", ":", "param", "path", ":", "path", "to", "the", "property", "with", "name", "including", ":", "return", ":" ]
python
train
reingart/gui2py
gui/dialog.py
https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/dialog.py#L86-L97
def open_file(title="Open", directory='', filename='', wildcard='All Files (*.*)|*.*', multiple=False, parent=None): "Show a dialog to select files to open, return path(s) if accepted" style = wx.OPEN if multiple: style |= wx.MULTIPLE result = dialogs.fileDialog(parent, ti...
[ "def", "open_file", "(", "title", "=", "\"Open\"", ",", "directory", "=", "''", ",", "filename", "=", "''", ",", "wildcard", "=", "'All Files (*.*)|*.*'", ",", "multiple", "=", "False", ",", "parent", "=", "None", ")", ":", "style", "=", "wx", ".", "OP...
Show a dialog to select files to open, return path(s) if accepted
[ "Show", "a", "dialog", "to", "select", "files", "to", "open", "return", "path", "(", "s", ")", "if", "accepted" ]
python
test
yueyoum/social-oauth
example/_bottle.py
https://github.com/yueyoum/social-oauth/blob/80600ea737355b20931c8a0b5223f5b68175d930/example/_bottle.py#L1512-L1517
def remove(self, name, func): ''' Remove a callback from a hook. ''' was_empty = self._empty() if name in self.hooks and func in self.hooks[name]: self.hooks[name].remove(func) if self.app and not was_empty and self._empty(): self.app.reset()
[ "def", "remove", "(", "self", ",", "name", ",", "func", ")", ":", "was_empty", "=", "self", ".", "_empty", "(", ")", "if", "name", "in", "self", ".", "hooks", "and", "func", "in", "self", ".", "hooks", "[", "name", "]", ":", "self", ".", "hooks",...
Remove a callback from a hook.
[ "Remove", "a", "callback", "from", "a", "hook", "." ]
python
train
xmartlabs/benderthon
benderthon/tf_freeze.py
https://github.com/xmartlabs/benderthon/blob/810b6fb90f56136257e7ed12e5a30d17ad7ce6ba/benderthon/tf_freeze.py#L62-L82
def save_weights(sess, output_path, conv_var_names=None, conv_transpose_var_names=None): """Save the weights of the trainable variables, each one in a different file in output_path.""" if not conv_var_names: conv_var_names = [] if not conv_transpose_var_names: conv_transpose_var_names = [] ...
[ "def", "save_weights", "(", "sess", ",", "output_path", ",", "conv_var_names", "=", "None", ",", "conv_transpose_var_names", "=", "None", ")", ":", "if", "not", "conv_var_names", ":", "conv_var_names", "=", "[", "]", "if", "not", "conv_transpose_var_names", ":",...
Save the weights of the trainable variables, each one in a different file in output_path.
[ "Save", "the", "weights", "of", "the", "trainable", "variables", "each", "one", "in", "a", "different", "file", "in", "output_path", "." ]
python
test
artefactual-labs/mets-reader-writer
metsrw/fsentry.py
https://github.com/artefactual-labs/mets-reader-writer/blob/d95939cabdfdc25cb1bf67df0c84bd0d6e6a73ff/metsrw/fsentry.py#L376-L416
def serialize_filesec(self): """ Return the file Element for this file, appropriate for use in a fileSec. If this is not an Item or has no use, return None. :return: fileSec element for this FSEntry """ if ( self.type.lower() not in ("item", "archival inform...
[ "def", "serialize_filesec", "(", "self", ")", ":", "if", "(", "self", ".", "type", ".", "lower", "(", ")", "not", "in", "(", "\"item\"", ",", "\"archival information package\"", ")", "or", "self", ".", "use", "is", "None", ")", ":", "return", "None", "...
Return the file Element for this file, appropriate for use in a fileSec. If this is not an Item or has no use, return None. :return: fileSec element for this FSEntry
[ "Return", "the", "file", "Element", "for", "this", "file", "appropriate", "for", "use", "in", "a", "fileSec", "." ]
python
train
DarkEnergySurvey/ugali
ugali/utils/plotting.py
https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/utils/plotting.py#L241-L298
def getDSSImage(ra,dec,radius=1.0,xsize=800,**kwargs): """ Download Digitized Sky Survey images https://archive.stsci.edu/cgi-bin/dss_form https://archive.stsci.edu/cgi-bin/dss_search Image is in celestial orientation (RA increases to the right) https://archive.stsci.edu/dss/script_usage.h...
[ "def", "getDSSImage", "(", "ra", ",", "dec", ",", "radius", "=", "1.0", ",", "xsize", "=", "800", ",", "*", "*", "kwargs", ")", ":", "import", "subprocess", "import", "tempfile", "service", "=", "'skyview'", "if", "service", "==", "'stsci'", ":", "url"...
Download Digitized Sky Survey images https://archive.stsci.edu/cgi-bin/dss_form https://archive.stsci.edu/cgi-bin/dss_search Image is in celestial orientation (RA increases to the right) https://archive.stsci.edu/dss/script_usage.html ra (r) - right ascension dec (d) - declination equ...
[ "Download", "Digitized", "Sky", "Survey", "images" ]
python
train
O365/python-o365
O365/excel.py
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/excel.py#L111-L134
def prepare_request(self, kwargs): """ If session is in use, prepares the request headers and checks if the session is expired. """ if self.session_id is not None: actual = dt.datetime.now() if (self.last_activity + self.inactivity_limit) < actual: ...
[ "def", "prepare_request", "(", "self", ",", "kwargs", ")", ":", "if", "self", ".", "session_id", "is", "not", "None", ":", "actual", "=", "dt", ".", "datetime", ".", "now", "(", ")", "if", "(", "self", ".", "last_activity", "+", "self", ".", "inactiv...
If session is in use, prepares the request headers and checks if the session is expired.
[ "If", "session", "is", "in", "use", "prepares", "the", "request", "headers", "and", "checks", "if", "the", "session", "is", "expired", "." ]
python
train
inveniosoftware/invenio-oauth2server
invenio_oauth2server/provider.py
https://github.com/inveniosoftware/invenio-oauth2server/blob/7033d3495c1a2b830e101e43918e92a37bbb49f2/invenio_oauth2server/provider.py#L45-L71
def get_token(access_token=None, refresh_token=None): """Load an access token. Add support for personal access tokens compared to flask-oauthlib. If the access token is ``None``, it looks for the refresh token. :param access_token: The access token. (Default: ``None``) :param refresh_token: The re...
[ "def", "get_token", "(", "access_token", "=", "None", ",", "refresh_token", "=", "None", ")", ":", "if", "access_token", ":", "t", "=", "Token", ".", "query", ".", "filter_by", "(", "access_token", "=", "access_token", ")", ".", "first", "(", ")", "if", ...
Load an access token. Add support for personal access tokens compared to flask-oauthlib. If the access token is ``None``, it looks for the refresh token. :param access_token: The access token. (Default: ``None``) :param refresh_token: The refresh token. (Default: ``None``) :returns: The token inst...
[ "Load", "an", "access", "token", "." ]
python
train
edx/edx-django-release-util
release_util/management/commands/__init__.py
https://github.com/edx/edx-django-release-util/blob/de0fde41d6a19885ab7dc309472b94fd0fccbc1d/release_util/management/commands/__init__.py#L294-L308
def apply(self): """ Applies all migrations that have been added. Note that some migrations depend on others, so you might end up running more than one. """ if self.__closed: raise MigrationSessionError("Can't apply applied session") try: w...
[ "def", "apply", "(", "self", ")", ":", "if", "self", ".", "__closed", ":", "raise", "MigrationSessionError", "(", "\"Can't apply applied session\"", ")", "try", ":", "while", "self", ".", "_to_apply", ":", "self", ".", "__apply", "(", "migration", "=", "self...
Applies all migrations that have been added. Note that some migrations depend on others, so you might end up running more than one.
[ "Applies", "all", "migrations", "that", "have", "been", "added", ".", "Note", "that", "some", "migrations", "depend", "on", "others", "so", "you", "might", "end", "up", "running", "more", "than", "one", "." ]
python
train
ajslater/picopt
picopt/timestamp.py
https://github.com/ajslater/picopt/blob/261da837027563c1dc3ed07b70e1086520a60402/picopt/timestamp.py#L62-L77
def _get_parent_timestamp(dirname, mtime): """ Get the timestamps up the directory tree. All the way to root. Because they affect every subdirectory. """ parent_pathname = os.path.dirname(dirname) # max between the parent timestamp the one passed in mtime = _max_timestamps(parent_pathname,...
[ "def", "_get_parent_timestamp", "(", "dirname", ",", "mtime", ")", ":", "parent_pathname", "=", "os", ".", "path", ".", "dirname", "(", "dirname", ")", "# max between the parent timestamp the one passed in", "mtime", "=", "_max_timestamps", "(", "parent_pathname", ","...
Get the timestamps up the directory tree. All the way to root. Because they affect every subdirectory.
[ "Get", "the", "timestamps", "up", "the", "directory", "tree", ".", "All", "the", "way", "to", "root", "." ]
python
train
vpelletier/python-functionfs
functionfs/__init__.py
https://github.com/vpelletier/python-functionfs/blob/e19f729bb47a7d1edd2488531af24551bb86726f/functionfs/__init__.py#L559-L572
def halt(self, request_type): """ Halt current endpoint. """ try: if request_type & ch9.USB_DIR_IN: self.read(0) else: self.write(b'') except IOError as exc: if exc.errno != errno.EL2HLT: raise ...
[ "def", "halt", "(", "self", ",", "request_type", ")", ":", "try", ":", "if", "request_type", "&", "ch9", ".", "USB_DIR_IN", ":", "self", ".", "read", "(", "0", ")", "else", ":", "self", ".", "write", "(", "b''", ")", "except", "IOError", "as", "exc...
Halt current endpoint.
[ "Halt", "current", "endpoint", "." ]
python
train
echonest/pyechonest
pyechonest/song.py
https://github.com/echonest/pyechonest/blob/d8c7af6c1da699b50b2f4b1bd3c0febe72e7f1ee/pyechonest/song.py#L300-L319
def get_song_currency(self, cache=True): """ Args: cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True. Returns: A float representing a song's currency rank. Example: ...
[ "def", "get_song_currency", "(", "self", ",", "cache", "=", "True", ")", ":", "if", "not", "(", "cache", "and", "(", "'song_currency'", "in", "self", ".", "cache", ")", ")", ":", "response", "=", "self", ".", "get_attribute", "(", "'profile'", ",", "bu...
Args: cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True. Returns: A float representing a song's currency rank. Example: >>> s = song.Song('SOQKVPH12A58A7AF4D') >>> s.get...
[ "Args", ":", "cache", "(", "bool", ")", ":", "A", "boolean", "indicating", "whether", "or", "not", "the", "cached", "value", "should", "be", "used", "(", "if", "available", ")", ".", "Defaults", "to", "True", ".", "Returns", ":", "A", "float", "represe...
python
train
mikewaters/command-session
commandsession/commandsession.py
https://github.com/mikewaters/command-session/blob/cea0d81a56551530f52f1cf3780c0ac408e069ef/commandsession/commandsession.py#L212-L252
def unpack_pargs(positional_args, param_kwargs, gnu=False): """Unpack multidict and positional args into a list appropriate for subprocess. :param param_kwargs: ``ParamDict`` storing '--param' style data. :param positional_args: flags :param gnu: if True...
[ "def", "unpack_pargs", "(", "positional_args", ",", "param_kwargs", ",", "gnu", "=", "False", ")", ":", "def", "_transform", "(", "argname", ")", ":", "\"\"\"Transform a python identifier into a \n shell-appropriate argument name\n \"\"\"", "if", "len", ...
Unpack multidict and positional args into a list appropriate for subprocess. :param param_kwargs: ``ParamDict`` storing '--param' style data. :param positional_args: flags :param gnu: if True, long-name args are unpacked as: --parameter=argument ...
[ "Unpack", "multidict", "and", "positional", "args", "into", "a", "list", "appropriate", "for", "subprocess", ".", ":", "param", "param_kwargs", ":", "ParamDict", "storing", "--", "param", "style", "data", ".", ":", "param", "positional_args", ":", "flags", ":"...
python
test
Unidata/siphon
siphon/simplewebservice/igra2.py
https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/simplewebservice/igra2.py#L74-L97
def _get_data(self): """Process the IGRA2 text file for observations at site_id matching time. Return: ------- :class: `pandas.DataFrame` containing the body data. :class: `pandas.DataFrame` containing the header data. """ # Split the list of times into b...
[ "def", "_get_data", "(", "self", ")", ":", "# Split the list of times into begin and end dates. If only", "# one date is supplied, set both begin and end dates equal to that date.", "body", ",", "header", ",", "dates_long", ",", "dates", "=", "self", ".", "_get_data_raw", "(", ...
Process the IGRA2 text file for observations at site_id matching time. Return: ------- :class: `pandas.DataFrame` containing the body data. :class: `pandas.DataFrame` containing the header data.
[ "Process", "the", "IGRA2", "text", "file", "for", "observations", "at", "site_id", "matching", "time", "." ]
python
train
googledatalab/pydatalab
datalab/context/_utils.py
https://github.com/googledatalab/pydatalab/blob/d9031901d5bca22fe0d5925d204e6698df9852e1/datalab/context/_utils.py#L72-L103
def get_credentials(): """ Get the credentials to use. We try application credentials first, followed by user credentials. The path to the application credentials can be overridden by pointing the GOOGLE_APPLICATION_CREDENTIALS environment variable to some file; the path to the user credentials can ...
[ "def", "get_credentials", "(", ")", ":", "try", ":", "credentials", ",", "_", "=", "google", ".", "auth", ".", "default", "(", ")", "credentials", "=", "google", ".", "auth", ".", "credentials", ".", "with_scopes_if_required", "(", "credentials", ",", "CRE...
Get the credentials to use. We try application credentials first, followed by user credentials. The path to the application credentials can be overridden by pointing the GOOGLE_APPLICATION_CREDENTIALS environment variable to some file; the path to the user credentials can be overridden by pointing the...
[ "Get", "the", "credentials", "to", "use", ".", "We", "try", "application", "credentials", "first", "followed", "by", "user", "credentials", ".", "The", "path", "to", "the", "application", "credentials", "can", "be", "overridden", "by", "pointing", "the", "GOOG...
python
train
awslabs/sockeye
sockeye/training.py
https://github.com/awslabs/sockeye/blob/5d64a1ee1ef3cbba17c6d1d94bc061020c43f6ab/sockeye/training.py#L1304-L1317
def start_decoder(self, checkpoint: int): """ Starts a new CheckpointDecoder process and returns. No other process may exist. :param checkpoint: The checkpoint to decode. """ assert self.decoder_process is None output_name = os.path.join(self.output_folder, C.DECODE_OUT_...
[ "def", "start_decoder", "(", "self", ",", "checkpoint", ":", "int", ")", ":", "assert", "self", ".", "decoder_process", "is", "None", "output_name", "=", "os", ".", "path", ".", "join", "(", "self", ".", "output_folder", ",", "C", ".", "DECODE_OUT_NAME", ...
Starts a new CheckpointDecoder process and returns. No other process may exist. :param checkpoint: The checkpoint to decode.
[ "Starts", "a", "new", "CheckpointDecoder", "process", "and", "returns", ".", "No", "other", "process", "may", "exist", "." ]
python
train
oanda/v20-python
src/v20/order.py
https://github.com/oanda/v20-python/blob/f28192f4a31bce038cf6dfa302f5878bec192fe5/src/v20/order.py#L916-L967
def from_dict(data, ctx): """ Instantiate a new LimitOrder from a dict (generally from loading a JSON response). The data used to instantiate the LimitOrder is a shallow copy of the dict passed in, with any complex child types instantiated appropriately. """ data...
[ "def", "from_dict", "(", "data", ",", "ctx", ")", ":", "data", "=", "data", ".", "copy", "(", ")", "if", "data", ".", "get", "(", "'clientExtensions'", ")", "is", "not", "None", ":", "data", "[", "'clientExtensions'", "]", "=", "ctx", ".", "transacti...
Instantiate a new LimitOrder from a dict (generally from loading a JSON response). The data used to instantiate the LimitOrder is a shallow copy of the dict passed in, with any complex child types instantiated appropriately.
[ "Instantiate", "a", "new", "LimitOrder", "from", "a", "dict", "(", "generally", "from", "loading", "a", "JSON", "response", ")", ".", "The", "data", "used", "to", "instantiate", "the", "LimitOrder", "is", "a", "shallow", "copy", "of", "the", "dict", "passe...
python
train
DreamLab/VmShepherd
src/vmshepherd/iaas/openstack_driver.py
https://github.com/DreamLab/VmShepherd/blob/709a412c372b897d53808039c5c64a8b69c12c8d/src/vmshepherd/iaas/openstack_driver.py#L83-L118
async def create_vm(self, preset_name, image, flavor, security_groups=None, userdata=None, key_name=None, availability_zone=None, subnets=None): ''' Create VM :arg preset_name: string :arg image: string image id :arg flavor: string flavor id ...
[ "async", "def", "create_vm", "(", "self", ",", "preset_name", ",", "image", ",", "flavor", ",", "security_groups", "=", "None", ",", "userdata", "=", "None", ",", "key_name", "=", "None", ",", "availability_zone", "=", "None", ",", "subnets", "=", "None", ...
Create VM :arg preset_name: string :arg image: string image id :arg flavor: string flavor id :arg security_groups: list :arg userdata: string :arg key_name: string :arg availability_zone: string :arg subnets: list :returns list Vm objects...
[ "Create", "VM", ":", "arg", "preset_name", ":", "string", ":", "arg", "image", ":", "string", "image", "id", ":", "arg", "flavor", ":", "string", "flavor", "id", ":", "arg", "security_groups", ":", "list", ":", "arg", "userdata", ":", "string", ":", "a...
python
train
ubc/github2gitlab
github2gitlab/main.py
https://github.com/ubc/github2gitlab/blob/795898f6d438621fa0c996a7156d70c382ff0493/github2gitlab/main.py#L254-L281
def add_key(self): "Add ssh key to gitlab if necessary" try: with open(self.args.ssh_public_key) as f: public_key = f.read().strip() except: log.debug("No key found in {}".format(self.args.ssh_public_key)) return None g = self.gitlab ...
[ "def", "add_key", "(", "self", ")", ":", "try", ":", "with", "open", "(", "self", ".", "args", ".", "ssh_public_key", ")", "as", "f", ":", "public_key", "=", "f", ".", "read", "(", ")", ".", "strip", "(", ")", "except", ":", "log", ".", "debug", ...
Add ssh key to gitlab if necessary
[ "Add", "ssh", "key", "to", "gitlab", "if", "necessary" ]
python
train
jgorset/django-respite
respite/views/resource.py
https://github.com/jgorset/django-respite/blob/719469d11baf91d05917bab1623bd82adc543546/respite/views/resource.py#L96-L119
def create(self, request): """Create a new object.""" form = (self.form or generate_form(self.model))(request.POST) if form.is_valid(): object = form.save() return self._render( request = request, template = 'show', contex...
[ "def", "create", "(", "self", ",", "request", ")", ":", "form", "=", "(", "self", ".", "form", "or", "generate_form", "(", "self", ".", "model", ")", ")", "(", "request", ".", "POST", ")", "if", "form", ".", "is_valid", "(", ")", ":", "object", "...
Create a new object.
[ "Create", "a", "new", "object", "." ]
python
train
fermiPy/fermipy
fermipy/jobs/scatter_gather.py
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/scatter_gather.py#L566-L585
def print_update(self, stream=sys.stdout, job_stats=None): """Print an update about the current number of jobs running """ if job_stats is None: job_stats = JobStatusVector() job_det_list = [] job_det_list += self._scatter_link.jobs.values() for job_dets ...
[ "def", "print_update", "(", "self", ",", "stream", "=", "sys", ".", "stdout", ",", "job_stats", "=", "None", ")", ":", "if", "job_stats", "is", "None", ":", "job_stats", "=", "JobStatusVector", "(", ")", "job_det_list", "=", "[", "]", "job_det_list", "+=...
Print an update about the current number of jobs running
[ "Print", "an", "update", "about", "the", "current", "number", "of", "jobs", "running" ]
python
train
ramrod-project/database-brain
schema/brain/jobs.py
https://github.com/ramrod-project/database-brain/blob/b024cb44f34cabb9d80af38271ddb65c25767083/schema/brain/jobs.py#L135-L152
def transition(prior_state, next_state): """ Transitions to a non-standard state Raises InvalidStateTransition if next_state is not allowed. :param prior_state: <str> :param next_state: <str> :return: <str> """ if next_state not in STATES[prior_state][TRANSITION]: acceptable = ...
[ "def", "transition", "(", "prior_state", ",", "next_state", ")", ":", "if", "next_state", "not", "in", "STATES", "[", "prior_state", "]", "[", "TRANSITION", "]", ":", "acceptable", "=", "STATES", "[", "prior_state", "]", "[", "TRANSITION", "]", "err", "=",...
Transitions to a non-standard state Raises InvalidStateTransition if next_state is not allowed. :param prior_state: <str> :param next_state: <str> :return: <str>
[ "Transitions", "to", "a", "non", "-", "standard", "state" ]
python
train
ggaughan/pipe2py
pipe2py/twisted/utils.py
https://github.com/ggaughan/pipe2py/blob/4767d6d1fd354d2a35e6528594b8deb8a033eed4/pipe2py/twisted/utils.py#L86-L90
def asyncImap(asyncCallable, *iterables): """itertools.imap for deferred callables """ deferreds = imap(asyncCallable, *iterables) return gatherResults(deferreds, consumeErrors=True)
[ "def", "asyncImap", "(", "asyncCallable", ",", "*", "iterables", ")", ":", "deferreds", "=", "imap", "(", "asyncCallable", ",", "*", "iterables", ")", "return", "gatherResults", "(", "deferreds", ",", "consumeErrors", "=", "True", ")" ]
itertools.imap for deferred callables
[ "itertools", ".", "imap", "for", "deferred", "callables" ]
python
train
hannes-brt/hebel
hebel/config.py
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/config.py#L56-L100
def load(stream, overrides=None, **kwargs): """ Loads a YAML configuration from a string or file-like object. Parameters ---------- stream : str or object Either a string containing valid YAML or a file-like object supporting the .read() interface. overrides : dict, optional ...
[ "def", "load", "(", "stream", ",", "overrides", "=", "None", ",", "*", "*", "kwargs", ")", ":", "global", "is_initialized", "if", "not", "is_initialized", ":", "initialize", "(", ")", "if", "isinstance", "(", "stream", ",", "basestring", ")", ":", "strin...
Loads a YAML configuration from a string or file-like object. Parameters ---------- stream : str or object Either a string containing valid YAML or a file-like object supporting the .read() interface. overrides : dict, optional A dictionary containing overrides to apply. The loc...
[ "Loads", "a", "YAML", "configuration", "from", "a", "string", "or", "file", "-", "like", "object", "." ]
python
train
FujiMakoto/AgentML
agentml/__init__.py
https://github.com/FujiMakoto/AgentML/blob/c8cb64b460d876666bf29ea2c682189874c7c403/agentml/__init__.py#L375-L387
def set_limit(self, identifier, expires_at, blocking=False): """ Set a new global trigger or response limit :param identifier: The Trigger or Response object :type identifier: parser.trigger.Trigger or parser.trigger.response.Response :param expires_at: The limit expiration as ...
[ "def", "set_limit", "(", "self", ",", "identifier", ",", "expires_at", ",", "blocking", "=", "False", ")", ":", "self", ".", "_limits", "[", "identifier", "]", "=", "(", "expires_at", ",", "blocking", ")" ]
Set a new global trigger or response limit :param identifier: The Trigger or Response object :type identifier: parser.trigger.Trigger or parser.trigger.response.Response :param expires_at: The limit expiration as a Unix timestamp :type expires_at: float :param blocking: When ...
[ "Set", "a", "new", "global", "trigger", "or", "response", "limit", ":", "param", "identifier", ":", "The", "Trigger", "or", "Response", "object", ":", "type", "identifier", ":", "parser", ".", "trigger", ".", "Trigger", "or", "parser", ".", "trigger", ".",...
python
train
peopledoc/workalendar
setup.py
https://github.com/peopledoc/workalendar/blob/d044d5dfc1709ec388db34dab583dd554cc66c4e/setup.py#L8-L16
def read_relative_file(filename): """ Return the contents of the given file. Its path is supposed relative to this module. """ path = join(dirname(abspath(__file__)), filename) with io.open(path, encoding='utf-8') as f: return f.read()
[ "def", "read_relative_file", "(", "filename", ")", ":", "path", "=", "join", "(", "dirname", "(", "abspath", "(", "__file__", ")", ")", ",", "filename", ")", "with", "io", ".", "open", "(", "path", ",", "encoding", "=", "'utf-8'", ")", "as", "f", ":"...
Return the contents of the given file. Its path is supposed relative to this module.
[ "Return", "the", "contents", "of", "the", "given", "file", "." ]
python
train
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/profilehooks.py
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/profilehooks.py#L569-L590
def atexit(self): """Stop profiling and print profile information to sys.stderr. This function is registered as an atexit hook. """ funcname = self.fn.__name__ filename = self.fn.__code__.co_filename lineno = self.fn.__code__.co_firstlineno print("") prin...
[ "def", "atexit", "(", "self", ")", ":", "funcname", "=", "self", ".", "fn", ".", "__name__", "filename", "=", "self", ".", "fn", ".", "__code__", ".", "co_filename", "lineno", "=", "self", ".", "fn", ".", "__code__", ".", "co_firstlineno", "print", "("...
Stop profiling and print profile information to sys.stderr. This function is registered as an atexit hook.
[ "Stop", "profiling", "and", "print", "profile", "information", "to", "sys", ".", "stderr", "." ]
python
train
quodlibet/mutagen
mutagen/aac.py
https://github.com/quodlibet/mutagen/blob/e393df5971ba41ba5a50de9c2c9e7e5484d82c4e/mutagen/aac.py#L91-L99
def bitrate(self): """Bitrate of the raw aac blocks, excluding framing/crc""" assert self.parsed_frames, "no frame parsed yet" if self._samples == 0: return 0 return (8 * self._payload * self.frequency) // self._samples
[ "def", "bitrate", "(", "self", ")", ":", "assert", "self", ".", "parsed_frames", ",", "\"no frame parsed yet\"", "if", "self", ".", "_samples", "==", "0", ":", "return", "0", "return", "(", "8", "*", "self", ".", "_payload", "*", "self", ".", "frequency"...
Bitrate of the raw aac blocks, excluding framing/crc
[ "Bitrate", "of", "the", "raw", "aac", "blocks", "excluding", "framing", "/", "crc" ]
python
train
oauthlib/oauthlib
oauthlib/common.py
https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/common.py#L306-L328
def to_unicode(data, encoding='UTF-8'): """Convert a number of different types of objects to unicode.""" if isinstance(data, unicode_type): return data if isinstance(data, bytes): return unicode_type(data, encoding=encoding) if hasattr(data, '__iter__'): try: dict(d...
[ "def", "to_unicode", "(", "data", ",", "encoding", "=", "'UTF-8'", ")", ":", "if", "isinstance", "(", "data", ",", "unicode_type", ")", ":", "return", "data", "if", "isinstance", "(", "data", ",", "bytes", ")", ":", "return", "unicode_type", "(", "data",...
Convert a number of different types of objects to unicode.
[ "Convert", "a", "number", "of", "different", "types", "of", "objects", "to", "unicode", "." ]
python
train
ktdreyer/txkoji
txkoji/cache.py
https://github.com/ktdreyer/txkoji/blob/a7de380f29f745bf11730b27217208f6d4da7733/txkoji/cache.py#L29-L43
def get_name(self, type_, id_): """ Read a cached name if available. :param type_: str, "owner" or "tag" :param id_: int, eg. 123456 :returns: str, or None """ cachefile = self.filename(type_, id_) try: with open(cachefile, 'r') as f: ...
[ "def", "get_name", "(", "self", ",", "type_", ",", "id_", ")", ":", "cachefile", "=", "self", ".", "filename", "(", "type_", ",", "id_", ")", "try", ":", "with", "open", "(", "cachefile", ",", "'r'", ")", "as", "f", ":", "return", "f", ".", "read...
Read a cached name if available. :param type_: str, "owner" or "tag" :param id_: int, eg. 123456 :returns: str, or None
[ "Read", "a", "cached", "name", "if", "available", "." ]
python
train
inasafe/inasafe
safe/utilities/rounding.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/rounding.py#L142-L163
def rounding_full(number, is_population=False): """This function performs a rigorous rounding. :param number: The amount to round. :type number: int, float :param is_population: If we should use the population rounding rule, #4062. :type is_population: bool :returns: result and rounding brack...
[ "def", "rounding_full", "(", "number", ",", "is_population", "=", "False", ")", ":", "if", "number", "<", "1000", "and", "not", "is_population", ":", "rounding_number", "=", "1", "# See ticket #4062", "elif", "number", "<", "1000", "and", "is_population", ":",...
This function performs a rigorous rounding. :param number: The amount to round. :type number: int, float :param is_population: If we should use the population rounding rule, #4062. :type is_population: bool :returns: result and rounding bracket. :rtype: (int, int)
[ "This", "function", "performs", "a", "rigorous", "rounding", "." ]
python
train
openpermissions/perch
perch/organisation.py
https://github.com/openpermissions/perch/blob/36d78994133918f3c52c187f19e50132960a0156/perch/organisation.py#L754-L763
def generate_secret(length=30): """ Generate an ASCII secret using random.SysRandom Based on oauthlib's common.generate_token function """ rand = random.SystemRandom() ascii_characters = string.ascii_letters + string.digits return ''.join(rand.choice(ascii_characters) for _ in range(length...
[ "def", "generate_secret", "(", "length", "=", "30", ")", ":", "rand", "=", "random", ".", "SystemRandom", "(", ")", "ascii_characters", "=", "string", ".", "ascii_letters", "+", "string", ".", "digits", "return", "''", ".", "join", "(", "rand", ".", "cho...
Generate an ASCII secret using random.SysRandom Based on oauthlib's common.generate_token function
[ "Generate", "an", "ASCII", "secret", "using", "random", ".", "SysRandom" ]
python
train
biolink/biolink-model
metamodel/generators/contextgen.py
https://github.com/biolink/biolink-model/blob/f379e28d5d4085e1115798c6cb28e5acc4dba8b4/metamodel/generators/contextgen.py#L92-L103
def add_prefix(self, ncname: str) -> None: """ Look up ncname and add it to the prefix map if necessary @param ncname: name to add """ if ncname not in self.prefixmap: uri = cu.expand_uri(ncname + ':', self.curi_maps) if uri and '://' in uri: self...
[ "def", "add_prefix", "(", "self", ",", "ncname", ":", "str", ")", "->", "None", ":", "if", "ncname", "not", "in", "self", ".", "prefixmap", ":", "uri", "=", "cu", ".", "expand_uri", "(", "ncname", "+", "':'", ",", "self", ".", "curi_maps", ")", "if...
Look up ncname and add it to the prefix map if necessary @param ncname: name to add
[ "Look", "up", "ncname", "and", "add", "it", "to", "the", "prefix", "map", "if", "necessary" ]
python
train
Yelp/threat_intel
threat_intel/util/http.py
https://github.com/Yelp/threat_intel/blob/60eef841d7cca115ec7857aeb9c553b72b694851/threat_intel/util/http.py#L203-L218
def multi_get(self, urls, query_params=None, to_json=True): """Issue multiple GET requests. Args: urls - A string URL or list of string URLs query_params - None, a dict, or a list of dicts representing the query params to_json - A boolean, should the responses be ret...
[ "def", "multi_get", "(", "self", ",", "urls", ",", "query_params", "=", "None", ",", "to_json", "=", "True", ")", ":", "return", "self", ".", "_multi_request", "(", "MultiRequest", ".", "_VERB_GET", ",", "urls", ",", "query_params", ",", "data", "=", "No...
Issue multiple GET requests. Args: urls - A string URL or list of string URLs query_params - None, a dict, or a list of dicts representing the query params to_json - A boolean, should the responses be returned as JSON blobs Returns: a list of dicts if to_...
[ "Issue", "multiple", "GET", "requests", "." ]
python
train
genicam/harvesters
src/harvesters/core.py
https://github.com/genicam/harvesters/blob/c3314a7f9d320bbf943e599aabac02521cd8e80b/src/harvesters/core.py#L679-L690
def data_format_value(self): """ :return: The data type of the data component as integer value. """ try: if self._part: value = self._part.data_format else: value = self._buffer.pixel_format except InvalidParameterException:...
[ "def", "data_format_value", "(", "self", ")", ":", "try", ":", "if", "self", ".", "_part", ":", "value", "=", "self", ".", "_part", ".", "data_format", "else", ":", "value", "=", "self", ".", "_buffer", ".", "pixel_format", "except", "InvalidParameterExcep...
:return: The data type of the data component as integer value.
[ ":", "return", ":", "The", "data", "type", "of", "the", "data", "component", "as", "integer", "value", "." ]
python
valid
basho/riak-python-client
riak/transports/transport.py
https://github.com/basho/riak-python-client/blob/91de13a16607cdf553d1a194e762734e3bec4231/riak/transports/transport.py#L77-L82
def put(self, robj, w=None, dw=None, pw=None, return_body=None, if_none_match=None, timeout=None): """ Stores an object. """ raise NotImplementedError
[ "def", "put", "(", "self", ",", "robj", ",", "w", "=", "None", ",", "dw", "=", "None", ",", "pw", "=", "None", ",", "return_body", "=", "None", ",", "if_none_match", "=", "None", ",", "timeout", "=", "None", ")", ":", "raise", "NotImplementedError" ]
Stores an object.
[ "Stores", "an", "object", "." ]
python
train
senaite/senaite.core
bika/lims/browser/clientfolder.py
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/browser/clientfolder.py#L132-L145
def before_render(self): """Before template render hook """ # Render the Add button if the user has the AddClient permission if check_permission(AddClient, self.context): self.context_actions[_("Add")] = { "url": "createObject?type_name=Client", ...
[ "def", "before_render", "(", "self", ")", ":", "# Render the Add button if the user has the AddClient permission", "if", "check_permission", "(", "AddClient", ",", "self", ".", "context", ")", ":", "self", ".", "context_actions", "[", "_", "(", "\"Add\"", ")", "]", ...
Before template render hook
[ "Before", "template", "render", "hook" ]
python
train
richardkiss/pycoin
pycoin/coins/bgold/Block.py
https://github.com/richardkiss/pycoin/blob/1e8d0d9fe20ce0347b97847bb529cd1bd84c7442/pycoin/coins/bgold/Block.py#L68-L73
def stream_header(self, f): """Stream the block header in the standard way to the file-like object f.""" stream_struct("L##L", f, self.version, self.previous_block_hash, self.merkle_root, self.height) f.write(b'\0' * 28) stream_struct("LL#S", f, self.timestamp, self...
[ "def", "stream_header", "(", "self", ",", "f", ")", ":", "stream_struct", "(", "\"L##L\"", ",", "f", ",", "self", ".", "version", ",", "self", ".", "previous_block_hash", ",", "self", ".", "merkle_root", ",", "self", ".", "height", ")", "f", ".", "writ...
Stream the block header in the standard way to the file-like object f.
[ "Stream", "the", "block", "header", "in", "the", "standard", "way", "to", "the", "file", "-", "like", "object", "f", "." ]
python
train
videntity/django-djmongo
djmongo/decorators.py
https://github.com/videntity/django-djmongo/blob/7534e0981a2bc12634cf3f1ed03353623dc57565/djmongo/decorators.py#L52-L77
def ip_verification_required(func): """ Put this decorator before your view to check if the function is coming from an IP on file """ def wrapper(request, *args, **kwargs): slug = kwargs.get('slug', "") if not slug: return kickoutt_404("Not found.", content_type="applic...
[ "def", "ip_verification_required", "(", "func", ")", ":", "def", "wrapper", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "slug", "=", "kwargs", ".", "get", "(", "'slug'", ",", "\"\"", ")", "if", "not", "slug", ":", "return", ...
Put this decorator before your view to check if the function is coming from an IP on file
[ "Put", "this", "decorator", "before", "your", "view", "to", "check", "if", "the", "function", "is", "coming", "from", "an", "IP", "on", "file" ]
python
train
saltstack/salt
salt/modules/vsphere.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vsphere.py#L5107-L5147
def list_cluster(datacenter=None, cluster=None, service_instance=None): ''' Returns a dict representation of an ESX cluster. datacenter Name of datacenter containing the cluster. Ignored if already contained by proxy details. Default value is None. cluster Name of clust...
[ "def", "list_cluster", "(", "datacenter", "=", "None", ",", "cluster", "=", "None", ",", "service_instance", "=", "None", ")", ":", "proxy_type", "=", "get_proxy_type", "(", ")", "if", "proxy_type", "==", "'esxdatacenter'", ":", "dc_ref", "=", "_get_proxy_targ...
Returns a dict representation of an ESX cluster. datacenter Name of datacenter containing the cluster. Ignored if already contained by proxy details. Default value is None. cluster Name of cluster. Ignored if already contained by proxy details. Default value is ...
[ "Returns", "a", "dict", "representation", "of", "an", "ESX", "cluster", "." ]
python
train
shoeffner/pandoc-source-exec
pandoc_source_exec.py
https://github.com/shoeffner/pandoc-source-exec/blob/9a13b9054d629a60b63196a906fafe2673722d13/pandoc_source_exec.py#L409-L442
def finalize(doc): """Adds the pgfplots and caption packages to the header-includes if needed. """ if doc.plot_found: pgfplots_inline = pf.MetaInlines(pf.RawInline( r'''% \makeatletter \@ifpackageloaded{pgfplots}{}{\usepackage{pgfplots}} \makeatother \usepgfplotslibrary{groupplots} ''', ...
[ "def", "finalize", "(", "doc", ")", ":", "if", "doc", ".", "plot_found", ":", "pgfplots_inline", "=", "pf", ".", "MetaInlines", "(", "pf", ".", "RawInline", "(", "r'''%\n\\makeatletter\n\\@ifpackageloaded{pgfplots}{}{\\usepackage{pgfplots}}\n\\makeatother\n\\usepgfplotslibr...
Adds the pgfplots and caption packages to the header-includes if needed.
[ "Adds", "the", "pgfplots", "and", "caption", "packages", "to", "the", "header", "-", "includes", "if", "needed", "." ]
python
train
ionelmc/python-cogen
examples/cogen-irc/CogenIrcApp/cogenircapp/controllers/irc.py
https://github.com/ionelmc/python-cogen/blob/83b0edb88425eba6e5bfda9f1dcd34642517e2a8/examples/cogen-irc/CogenIrcApp/cogenircapp/controllers/irc.py#L108-L138
def push(self, id): "Sends a message to the specified connection (id)" conn = session['connections'].get(id, None) if conn: msgs = simplejson.loads(request.body) for msg in msgs: try: cmd = msg.pop(0).upper() ...
[ "def", "push", "(", "self", ",", "id", ")", ":", "conn", "=", "session", "[", "'connections'", "]", ".", "get", "(", "id", ",", "None", ")", "if", "conn", ":", "msgs", "=", "simplejson", ".", "loads", "(", "request", ".", "body", ")", "for", "msg...
Sends a message to the specified connection (id)
[ "Sends", "a", "message", "to", "the", "specified", "connection", "(", "id", ")" ]
python
train
timothydmorton/isochrones
isochrones/observation.py
https://github.com/timothydmorton/isochrones/blob/d84495573044c66db2fd6b959fe69e370757ea14/isochrones/observation.py#L215-L230
def select_leaves(self, name): """Returns all leaves under all nodes matching name """ if self.is_leaf: return [self] if re.search(name, self.label) else [] else: leaves = [] if re.search(name, self.label): for c in self.children: ...
[ "def", "select_leaves", "(", "self", ",", "name", ")", ":", "if", "self", ".", "is_leaf", ":", "return", "[", "self", "]", "if", "re", ".", "search", "(", "name", ",", "self", ".", "label", ")", "else", "[", "]", "else", ":", "leaves", "=", "[", ...
Returns all leaves under all nodes matching name
[ "Returns", "all", "leaves", "under", "all", "nodes", "matching", "name" ]
python
train
hydpy-dev/hydpy
hydpy/core/variabletools.py
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/variabletools.py#L470-L495
def _compare_variables_function_generator( method_string, aggregation_func): """Return a function usable as a comparison method for class |Variable|. Pass the specific method (e.g. `__eq__`) and the corresponding operator (e.g. `==`) as strings. Also pass either |numpy.all| or |numpy.any| for...
[ "def", "_compare_variables_function_generator", "(", "method_string", ",", "aggregation_func", ")", ":", "def", "comparison_function", "(", "self", ",", "other", ")", ":", "\"\"\"Wrapper for comparison functions for class |Variable|.\"\"\"", "if", "self", "is", "other", ":"...
Return a function usable as a comparison method for class |Variable|. Pass the specific method (e.g. `__eq__`) and the corresponding operator (e.g. `==`) as strings. Also pass either |numpy.all| or |numpy.any| for aggregating multiple boolean values.
[ "Return", "a", "function", "usable", "as", "a", "comparison", "method", "for", "class", "|Variable|", "." ]
python
train
Jammy2211/PyAutoLens
autolens/lens/util/lens_fit_util.py
https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/lens/util/lens_fit_util.py#L114-L149
def unmasked_blurred_image_of_planes_from_padded_grid_stack_and_psf(planes, padded_grid_stack, psf): """For lens data, compute the unmasked blurred image of every unmasked unblurred image of each plane. To do this, \ this function iterates over all planes to extract their unmasked unblurred images. If a ga...
[ "def", "unmasked_blurred_image_of_planes_from_padded_grid_stack_and_psf", "(", "planes", ",", "padded_grid_stack", ",", "psf", ")", ":", "unmasked_blurred_image_of_planes", "=", "[", "]", "for", "plane", "in", "planes", ":", "if", "plane", ".", "has_pixelization", ":", ...
For lens data, compute the unmasked blurred image of every unmasked unblurred image of each plane. To do this, \ this function iterates over all planes to extract their unmasked unblurred images. If a galaxy in a plane has a pixelization, the unmasked image is returned as None, as as the inversion's model \ ...
[ "For", "lens", "data", "compute", "the", "unmasked", "blurred", "image", "of", "every", "unmasked", "unblurred", "image", "of", "each", "plane", ".", "To", "do", "this", "\\", "this", "function", "iterates", "over", "all", "planes", "to", "extract", "their",...
python
valid