repo
stringlengths
7
55
path
stringlengths
4
223
url
stringlengths
87
315
code
stringlengths
75
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
avg_line_len
float64
7.91
980
SoCo/SoCo
soco/core.py
https://github.com/SoCo/SoCo/blob/671937e07d7973b78c0cbee153d4f3ad68ec48c6/soco/core.py#L748-L759
def treble(self): """int: The speaker's treble EQ. An integer between -10 and 10. """ response = self.renderingControl.GetTreble([ ('InstanceID', 0), ('Channel', 'Master'), ]) treble = response['CurrentTreble'] return int(treble)
[ "def", "treble", "(", "self", ")", ":", "response", "=", "self", ".", "renderingControl", ".", "GetTreble", "(", "[", "(", "'InstanceID'", ",", "0", ")", ",", "(", "'Channel'", ",", "'Master'", ")", ",", "]", ")", "treble", "=", "response", "[", "'Cu...
int: The speaker's treble EQ. An integer between -10 and 10.
[ "int", ":", "The", "speaker", "s", "treble", "EQ", "." ]
python
train
25
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/core/logger.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/logger.py#L205-L217
def logstop(self): """Fully stop logging and close log file. In order to start logging again, a new logstart() call needs to be made, possibly (though not necessarily) with a new filename, mode and other options.""" if self.logfile is not None: self.logfile.close() ...
[ "def", "logstop", "(", "self", ")", ":", "if", "self", ".", "logfile", "is", "not", "None", ":", "self", ".", "logfile", ".", "close", "(", ")", "self", ".", "logfile", "=", "None", "else", ":", "print", "\"Logging hadn't been started.\"", "self", ".", ...
Fully stop logging and close log file. In order to start logging again, a new logstart() call needs to be made, possibly (though not necessarily) with a new filename, mode and other options.
[ "Fully", "stop", "logging", "and", "close", "log", "file", "." ]
python
test
33.384615
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/module.py
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/module.py#L631-L678
def get_label_at_address(self, address, offset = None): """ Creates a label from the given memory address. If the address belongs to the module, the label is made relative to it's base address. @type address: int @param address: Memory address. @type offset: ...
[ "def", "get_label_at_address", "(", "self", ",", "address", ",", "offset", "=", "None", ")", ":", "# Add the offset to the address.", "if", "offset", ":", "address", "=", "address", "+", "offset", "# Make the label relative to the base address if no match is found.", "mod...
Creates a label from the given memory address. If the address belongs to the module, the label is made relative to it's base address. @type address: int @param address: Memory address. @type offset: None or int @param offset: (Optional) Offset value. @rtype:...
[ "Creates", "a", "label", "from", "the", "given", "memory", "address", "." ]
python
train
33.375
Hackerfleet/hfos
hfos/tool/user.py
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/tool/user.py#L41-L45
def user(ctx, username, password): """[GROUP] User management operations""" ctx.obj['username'] = username ctx.obj['password'] = password
[ "def", "user", "(", "ctx", ",", "username", ",", "password", ")", ":", "ctx", ".", "obj", "[", "'username'", "]", "=", "username", "ctx", ".", "obj", "[", "'password'", "]", "=", "password" ]
[GROUP] User management operations
[ "[", "GROUP", "]", "User", "management", "operations" ]
python
train
29.2
9wfox/tornadoweb
tornadoweb/utility.py
https://github.com/9wfox/tornadoweb/blob/2286b66fbe10e4d9f212b979664c15fa17adf378/tornadoweb/utility.py#L120-L127
def args_range(min_value, max_value, *args): """ 检查参数范围 """ not_null(*args) if not all(map(lambda v: min_value <= v <= max_value, args)): raise ValueError("Argument must be between {0} and {1}!".format(min_value, max_value))
[ "def", "args_range", "(", "min_value", ",", "max_value", ",", "*", "args", ")", ":", "not_null", "(", "*", "args", ")", "if", "not", "all", "(", "map", "(", "lambda", "v", ":", "min_value", "<=", "v", "<=", "max_value", ",", "args", ")", ")", ":", ...
检查参数范围
[ "检查参数范围" ]
python
train
32.125
luhnmod10/python
luhnmod10/__init__.py
https://github.com/luhnmod10/python/blob/7cd1e9e4029dd364a10435bd80ed48a2cc180491/luhnmod10/__init__.py#L1-L27
def valid(number): """ Returns true if the number string is luhn valid, and false otherwise. The number string passed to the function must contain only numeric characters otherwise behavior is undefined. """ checksum = 0 number_len = len(number) offset = ord('0') i = number_len - ...
[ "def", "valid", "(", "number", ")", ":", "checksum", "=", "0", "number_len", "=", "len", "(", "number", ")", "offset", "=", "ord", "(", "'0'", ")", "i", "=", "number_len", "-", "1", "while", "i", ">=", "0", ":", "n", "=", "ord", "(", "number", ...
Returns true if the number string is luhn valid, and false otherwise. The number string passed to the function must contain only numeric characters otherwise behavior is undefined.
[ "Returns", "true", "if", "the", "number", "string", "is", "luhn", "valid", "and", "false", "otherwise", ".", "The", "number", "string", "passed", "to", "the", "function", "must", "contain", "only", "numeric", "characters", "otherwise", "behavior", "is", "undef...
python
train
20.888889
savvastj/nbashots
nbashots/charts.py
https://github.com/savvastj/nbashots/blob/76ece28d717f10b25eb0fc681b317df6ef6b5157/nbashots/charts.py#L644-L704
def bokeh_shot_chart(data, x="LOC_X", y="LOC_Y", fill_color="#1f77b4", scatter_size=10, fill_alpha=0.4, line_alpha=0.4, court_line_color='gray', court_line_width=1, hover_tool=False, tooltips=None, **kwargs): # TODO: Settings for hover tooltip """ ...
[ "def", "bokeh_shot_chart", "(", "data", ",", "x", "=", "\"LOC_X\"", ",", "y", "=", "\"LOC_Y\"", ",", "fill_color", "=", "\"#1f77b4\"", ",", "scatter_size", "=", "10", ",", "fill_alpha", "=", "0.4", ",", "line_alpha", "=", "0.4", ",", "court_line_color", "=...
Returns a figure with both FGA and basketball court lines drawn onto it. This function expects data to be a ColumnDataSource with the x and y values named "LOC_X" and "LOC_Y". Otherwise specify x and y. Parameters ---------- data : DataFrame The DataFrame that contains the shot chart dat...
[ "Returns", "a", "figure", "with", "both", "FGA", "and", "basketball", "court", "lines", "drawn", "onto", "it", "." ]
python
train
37.262295
olitheolix/qtmacs
qtmacs/extensions/qtmacstextedit_widget.py
https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacstextedit_widget.py#L275-L298
def reverseCommit(self): """ Remove the inserted character(s). """ # Move the cursor to the right of the text to delete. tc = self.qteWidget.textCursor() # Delete as many characters as necessary. For an image that would # be exactly 1 even though the HTML code t...
[ "def", "reverseCommit", "(", "self", ")", ":", "# Move the cursor to the right of the text to delete.", "tc", "=", "self", ".", "qteWidget", ".", "textCursor", "(", ")", "# Delete as many characters as necessary. For an image that would", "# be exactly 1 even though the HTML code t...
Remove the inserted character(s).
[ "Remove", "the", "inserted", "character", "(", "s", ")", "." ]
python
train
33.916667
rigetti/pyquil
pyquil/noise.py
https://github.com/rigetti/pyquil/blob/ec98e453084b0037d69d8c3245f6822a5422593d/pyquil/noise.py#L572-L619
def add_decoherence_noise(prog, T1=30e-6, T2=30e-6, gate_time_1q=50e-9, gate_time_2q=150e-09, ro_fidelity=0.95): """ Add generic damping and dephasing noise to a program. This high-level function is provided as a convenience to investigate the effects of a generic noise model ...
[ "def", "add_decoherence_noise", "(", "prog", ",", "T1", "=", "30e-6", ",", "T2", "=", "30e-6", ",", "gate_time_1q", "=", "50e-9", ",", "gate_time_2q", "=", "150e-09", ",", "ro_fidelity", "=", "0.95", ")", ":", "gates", "=", "_get_program_gates", "(", "prog...
Add generic damping and dephasing noise to a program. This high-level function is provided as a convenience to investigate the effects of a generic noise model on a program. For more fine-grained control, please investigate the other methods available in the ``pyquil.noise`` module. In an attempt to c...
[ "Add", "generic", "damping", "and", "dephasing", "noise", "to", "a", "program", "." ]
python
train
45.125
SmokinCaterpillar/pypet
pypet/environment.py
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/environment.py#L137-L173
def _configure_frozen_scoop(kwargs): """Wrapper function that configures a frozen SCOOP set up. Deletes of data if necessary. """ def _delete_old_scoop_rev_data(old_scoop_rev): if old_scoop_rev is not None: try: elements = shared.elements for key in ...
[ "def", "_configure_frozen_scoop", "(", "kwargs", ")", ":", "def", "_delete_old_scoop_rev_data", "(", "old_scoop_rev", ")", ":", "if", "old_scoop_rev", "is", "not", "None", ":", "try", ":", "elements", "=", "shared", ".", "elements", "for", "key", "in", "elemen...
Wrapper function that configures a frozen SCOOP set up. Deletes of data if necessary.
[ "Wrapper", "function", "that", "configures", "a", "frozen", "SCOOP", "set", "up", "." ]
python
test
46.054054
blockstack/blockstack-core
blockstack/lib/atlas.py
https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/atlas.py#L2453-L2488
def atlas_rank_peers_by_data_availability( peer_list=None, peer_table=None, local_inv=None, con=None, path=None ): """ Get a ranking of peers to contact for a zonefile. Peers are ranked by the number of zonefiles they have which we don't have. This is used to select neighbors. """ with Atl...
[ "def", "atlas_rank_peers_by_data_availability", "(", "peer_list", "=", "None", ",", "peer_table", "=", "None", ",", "local_inv", "=", "None", ",", "con", "=", "None", ",", "path", "=", "None", ")", ":", "with", "AtlasPeerTableLocked", "(", "peer_table", ")", ...
Get a ranking of peers to contact for a zonefile. Peers are ranked by the number of zonefiles they have which we don't have. This is used to select neighbors.
[ "Get", "a", "ranking", "of", "peers", "to", "contact", "for", "a", "zonefile", ".", "Peers", "are", "ranked", "by", "the", "number", "of", "zonefiles", "they", "have", "which", "we", "don", "t", "have", "." ]
python
train
36
pythonkc/pythonkc-meetups
pythonkc_meetups/client.py
https://github.com/pythonkc/pythonkc-meetups/blob/54b5062b2825011c87c303256f59c6c13d395ee7/pythonkc_meetups/client.py#L60-L84
def get_upcoming_events(self): """ Get upcoming PythonKC meetup events. Returns ------- List of ``pythonkc_meetups.types.MeetupEvent``, ordered by event time, ascending. Exceptions ---------- * PythonKCMeetupsBadJson * PythonKCMeetupsBadR...
[ "def", "get_upcoming_events", "(", "self", ")", ":", "query", "=", "urllib", ".", "urlencode", "(", "{", "'key'", ":", "self", ".", "_api_key", ",", "'group_urlname'", ":", "GROUP_URLNAME", "}", ")", "url", "=", "'{0}?{1}'", ".", "format", "(", "EVENTS_URL...
Get upcoming PythonKC meetup events. Returns ------- List of ``pythonkc_meetups.types.MeetupEvent``, ordered by event time, ascending. Exceptions ---------- * PythonKCMeetupsBadJson * PythonKCMeetupsBadResponse * PythonKCMeetupsMeetupDown ...
[ "Get", "upcoming", "PythonKC", "meetup", "events", "." ]
python
train
29.24
pandas-dev/pandas
pandas/core/nanops.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L443-L491
def nanmean(values, axis=None, skipna=True, mask=None): """ Compute the mean of the element along an axis ignoring NaNs Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns ------...
[ "def", "nanmean", "(", "values", ",", "axis", "=", "None", ",", "skipna", "=", "True", ",", "mask", "=", "None", ")", ":", "values", ",", "mask", ",", "dtype", ",", "dtype_max", ",", "_", "=", "_get_values", "(", "values", ",", "skipna", ",", "0", ...
Compute the mean of the element along an axis ignoring NaNs Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns ------- result : float Unless input is a float array, in which...
[ "Compute", "the", "mean", "of", "the", "element", "along", "an", "axis", "ignoring", "NaNs" ]
python
train
29.918367
project-ncl/pnc-cli
pnc_cli/products.py
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/products.py#L51-L57
def update_product(product_id, **kwargs): """ Update a Product with new information """ content = update_product_raw(product_id, **kwargs) if content: return utils.format_json(content)
[ "def", "update_product", "(", "product_id", ",", "*", "*", "kwargs", ")", ":", "content", "=", "update_product_raw", "(", "product_id", ",", "*", "*", "kwargs", ")", "if", "content", ":", "return", "utils", ".", "format_json", "(", "content", ")" ]
Update a Product with new information
[ "Update", "a", "Product", "with", "new", "information" ]
python
train
29.428571
EventTeam/beliefs
src/beliefs/cells/lazy.py
https://github.com/EventTeam/beliefs/blob/c07d22b61bebeede74a72800030dde770bf64208/src/beliefs/cells/lazy.py#L74-L84
def is_entailed_by(self, other): """ Means merging other with self does not produce any new information. """ if not set(self.include.keys()).issubset(set(other.include.keys())): return False if not self.exclude.isuperset(other.exclude): return False ...
[ "def", "is_entailed_by", "(", "self", ",", "other", ")", ":", "if", "not", "set", "(", "self", ".", "include", ".", "keys", "(", ")", ")", ".", "issubset", "(", "set", "(", "other", ".", "include", ".", "keys", "(", ")", ")", ")", ":", "return", ...
Means merging other with self does not produce any new information.
[ "Means", "merging", "other", "with", "self", "does", "not", "produce", "any", "new", "information", "." ]
python
train
37.363636
EntilZha/PyFunctional
functional/transformations.py
https://github.com/EntilZha/PyFunctional/blob/ac04e4a8552b0c464a7f492f7c9862424867b63e/functional/transformations.py#L90-L98
def filter_not_t(func): """ Transformation for Sequence.filter_not :param func: filter_not function :return: transformation """ return Transformation('filter_not({0})'.format(name(func)), partial(six.moves.filterfalse, func), {ExecutionStrategi...
[ "def", "filter_not_t", "(", "func", ")", ":", "return", "Transformation", "(", "'filter_not({0})'", ".", "format", "(", "name", "(", "func", ")", ")", ",", "partial", "(", "six", ".", "moves", ".", "filterfalse", ",", "func", ")", ",", "{", "ExecutionStr...
Transformation for Sequence.filter_not :param func: filter_not function :return: transformation
[ "Transformation", "for", "Sequence", ".", "filter_not", ":", "param", "func", ":", "filter_not", "function", ":", "return", ":", "transformation" ]
python
train
36.111111
mjj4791/python-buienradar
buienradar/buienradar.py
https://github.com/mjj4791/python-buienradar/blob/a70436f54e007ce921d5210cb296cf3e4adf9d09/buienradar/buienradar.py#L18-L27
def get_data(latitude=52.091579, longitude=5.119734, usexml=False): """Get buienradar xml data and return results.""" if usexml: log.info("Getting buienradar XML data for latitude=%s, longitude=%s", latitude, longitude) return get_xml_data(latitude, longitude) else: ...
[ "def", "get_data", "(", "latitude", "=", "52.091579", ",", "longitude", "=", "5.119734", ",", "usexml", "=", "False", ")", ":", "if", "usexml", ":", "log", ".", "info", "(", "\"Getting buienradar XML data for latitude=%s, longitude=%s\"", ",", "latitude", ",", "...
Get buienradar xml data and return results.
[ "Get", "buienradar", "xml", "data", "and", "return", "results", "." ]
python
train
46.9
Chilipp/psyplot
psyplot/plotter.py
https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L2145-L2168
def _set_sharing_keys(self, keys): """ Set the keys to share or unshare Parameters ---------- keys: string or iterable of strings The iterable may contain formatoptions that shall be shared (or unshared), or group names of formatoptions to share all ...
[ "def", "_set_sharing_keys", "(", "self", ",", "keys", ")", ":", "if", "isinstance", "(", "keys", ",", "str", ")", ":", "keys", "=", "{", "keys", "}", "keys", "=", "set", "(", "self", ")", "if", "keys", "is", "None", "else", "set", "(", "keys", ")...
Set the keys to share or unshare Parameters ---------- keys: string or iterable of strings The iterable may contain formatoptions that shall be shared (or unshared), or group names of formatoptions to share all formatoptions of that group (see the :attr:`fmt_...
[ "Set", "the", "keys", "to", "share", "or", "unshare" ]
python
train
38
Cadair/jupyter_environment_kernels
environment_kernels/core.py
https://github.com/Cadair/jupyter_environment_kernels/blob/3da304550b511bda7d5d39280379b5ca39bb31bc/environment_kernels/core.py#L181-L185
def get_all_kernel_specs_for_envs(self): """Returns the dict of name -> kernel_spec for all environments""" data = self._get_env_data() return {name: data[name][1] for name in data}
[ "def", "get_all_kernel_specs_for_envs", "(", "self", ")", ":", "data", "=", "self", ".", "_get_env_data", "(", ")", "return", "{", "name", ":", "data", "[", "name", "]", "[", "1", "]", "for", "name", "in", "data", "}" ]
Returns the dict of name -> kernel_spec for all environments
[ "Returns", "the", "dict", "of", "name", "-", ">", "kernel_spec", "for", "all", "environments" ]
python
train
40.4
saltstack/salt
salt/modules/win_lgpo.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4553-L4568
def _driver_signing_reg_reverse_conversion(cls, val, **kwargs): ''' converts the string value seen in the GUI to the correct registry value for secedit ''' if val is not None: if val.upper() == 'SILENTLY SUCCEED': return ','.join(['3', '0']) ...
[ "def", "_driver_signing_reg_reverse_conversion", "(", "cls", ",", "val", ",", "*", "*", "kwargs", ")", ":", "if", "val", "is", "not", "None", ":", "if", "val", ".", "upper", "(", ")", "==", "'SILENTLY SUCCEED'", ":", "return", "','", ".", "join", "(", ...
converts the string value seen in the GUI to the correct registry value for secedit
[ "converts", "the", "string", "value", "seen", "in", "the", "GUI", "to", "the", "correct", "registry", "value", "for", "secedit" ]
python
train
38.5
halcy/Mastodon.py
mastodon/Mastodon.py
https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1009-L1019
def account_lists(self, id): """ Get all of the logged-in users lists which the specified user is a member of. Returns a list of `list dicts`_. """ id = self.__unpack_id(id) params = self.__generate_params(locals(), ['id']) url = '/api/v1/accounts...
[ "def", "account_lists", "(", "self", ",", "id", ")", ":", "id", "=", "self", ".", "__unpack_id", "(", "id", ")", "params", "=", "self", ".", "__generate_params", "(", "locals", "(", ")", ",", "[", "'id'", "]", ")", "url", "=", "'/api/v1/accounts/{0}/li...
Get all of the logged-in users lists which the specified user is a member of. Returns a list of `list dicts`_.
[ "Get", "all", "of", "the", "logged", "-", "in", "users", "lists", "which", "the", "specified", "user", "is", "a", "member", "of", ".", "Returns", "a", "list", "of", "list", "dicts", "_", "." ]
python
train
35.545455
Opentrons/opentrons
update-server/otupdate/buildroot/update.py
https://github.com/Opentrons/opentrons/blob/a7c15cc2636ecb64ab56c7edc1d8a57163aaeadf/update-server/otupdate/buildroot/update.py#L45-L61
async def begin(request: web.Request) -> web.Response: """ Begin a session """ if None is not session_from_request(request): LOG.warning("begin: requested with active session") return web.json_response( data={'message': 'An update session is already active on th...
[ "async", "def", "begin", "(", "request", ":", "web", ".", "Request", ")", "->", "web", ".", "Response", ":", "if", "None", "is", "not", "session_from_request", "(", "request", ")", ":", "LOG", ".", "warning", "(", "\"begin: requested with active session\"", ...
Begin a session
[ "Begin", "a", "session" ]
python
train
36.529412
maas/python-libmaas
maas/client/bones/__init__.py
https://github.com/maas/python-libmaas/blob/4092c68ef7fb1753efc843569848e2bcc3415002/maas/client/bones/__init__.py#L59-L65
def fromProfileName(cls, name): """Return a `SessionAPI` from a given configuration profile name. :see: `ProfileStore`. """ with profiles.ProfileStore.open() as config: return cls.fromProfile(config.load(name))
[ "def", "fromProfileName", "(", "cls", ",", "name", ")", ":", "with", "profiles", ".", "ProfileStore", ".", "open", "(", ")", "as", "config", ":", "return", "cls", ".", "fromProfile", "(", "config", ".", "load", "(", "name", ")", ")" ]
Return a `SessionAPI` from a given configuration profile name. :see: `ProfileStore`.
[ "Return", "a", "SessionAPI", "from", "a", "given", "configuration", "profile", "name", "." ]
python
train
35.571429
bbangert/lettuce_webdriver
lettuce_webdriver/util.py
https://github.com/bbangert/lettuce_webdriver/blob/d11f8531c43bb7150c316e0dc4ccd083617becf7/lettuce_webdriver/util.py#L197-L206
def find_field(browser, field, value): """Locate an input field of a given value This first looks for the value as the id of the element, then the name of the element, then a label for the element. """ return find_field_by_id(browser, field, value) + \ find_field_by_name(browser, field, va...
[ "def", "find_field", "(", "browser", ",", "field", ",", "value", ")", ":", "return", "find_field_by_id", "(", "browser", ",", "field", ",", "value", ")", "+", "find_field_by_name", "(", "browser", ",", "field", ",", "value", ")", "+", "find_field_by_label", ...
Locate an input field of a given value This first looks for the value as the id of the element, then the name of the element, then a label for the element.
[ "Locate", "an", "input", "field", "of", "a", "given", "value" ]
python
train
37
log2timeline/plaso
plaso/parsers/bsm.py
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/parsers/bsm.py#L427-L442
def _FormatReturnOrExitToken(self, token_data): """Formats a return or exit token as a dictionary of values. Args: token_data (bsm_token_data_exit|bsm_token_data_return32| bsm_token_data_return64): AUT_EXIT, AUT_RETURN32 or AUT_RETURN64 token data. Returns: dict[str...
[ "def", "_FormatReturnOrExitToken", "(", "self", ",", "token_data", ")", ":", "error_string", "=", "bsmtoken", ".", "BSM_ERRORS", ".", "get", "(", "token_data", ".", "status", ",", "'UNKNOWN'", ")", "return", "{", "'error'", ":", "error_string", ",", "'token_st...
Formats a return or exit token as a dictionary of values. Args: token_data (bsm_token_data_exit|bsm_token_data_return32| bsm_token_data_return64): AUT_EXIT, AUT_RETURN32 or AUT_RETURN64 token data. Returns: dict[str, str]: token values.
[ "Formats", "a", "return", "or", "exit", "token", "as", "a", "dictionary", "of", "values", "." ]
python
train
33.875
inveniosoftware-contrib/record-recommender
record_recommender/storage.py
https://github.com/inveniosoftware-contrib/record-recommender/blob/07f71e783369e6373218b5e6ba0bf15901e9251a/record_recommender/storage.py#L73-L94
def open(self, mode='read'): """Open the file.""" if self.file: self.close() raise 'Close file before opening.' if mode == 'write': self.file = open(self.path, 'w') elif mode == 'overwrite': # Delete file if exist. self.file = ...
[ "def", "open", "(", "self", ",", "mode", "=", "'read'", ")", ":", "if", "self", ".", "file", ":", "self", ".", "close", "(", ")", "raise", "'Close file before opening.'", "if", "mode", "==", "'write'", ":", "self", ".", "file", "=", "open", "(", "sel...
Open the file.
[ "Open", "the", "file", "." ]
python
train
35.090909
tsroten/dragonmapper
dragonmapper/transcriptions.py
https://github.com/tsroten/dragonmapper/blob/68eaf43c32725f4b4923c01284cfc0112079e8ab/dragonmapper/transcriptions.py#L379-L390
def zhuyin_to_pinyin(s, accented=True): """Convert all Zhuyin syllables in *s* to Pinyin. If *accented* is ``True``, diacritics are added to the Pinyin syllables. If it's ``False``, numbers are used to indicate tone. """ if accented: function = _zhuyin_syllable_to_accented else: ...
[ "def", "zhuyin_to_pinyin", "(", "s", ",", "accented", "=", "True", ")", ":", "if", "accented", ":", "function", "=", "_zhuyin_syllable_to_accented", "else", ":", "function", "=", "_zhuyin_syllable_to_numbered", "return", "_convert", "(", "s", ",", "zhon", ".", ...
Convert all Zhuyin syllables in *s* to Pinyin. If *accented* is ``True``, diacritics are added to the Pinyin syllables. If it's ``False``, numbers are used to indicate tone.
[ "Convert", "all", "Zhuyin", "syllables", "in", "*", "s", "*", "to", "Pinyin", "." ]
python
train
33.75
log2timeline/plaso
plaso/multi_processing/engine.py
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/multi_processing/engine.py#L417-L432
def _TerminateProcess(self, process): """Terminate a process. Args: process (MultiProcessBaseProcess): process to terminate. """ pid = process.pid logger.warning('Terminating process: (PID: {0:d}).'.format(pid)) process.terminate() # Wait for the process to exit. process.join(tim...
[ "def", "_TerminateProcess", "(", "self", ",", "process", ")", ":", "pid", "=", "process", ".", "pid", "logger", ".", "warning", "(", "'Terminating process: (PID: {0:d}).'", ".", "format", "(", "pid", ")", ")", "process", ".", "terminate", "(", ")", "# Wait f...
Terminate a process. Args: process (MultiProcessBaseProcess): process to terminate.
[ "Terminate", "a", "process", "." ]
python
train
28.8125
reingart/gui2py
gui/menu.py
https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/menu.py#L187-L193
def IsEnabled(self, *args, **kwargs): "check if all menu items are enabled" for i in range(self.GetMenuItemCount()): it = self.FindItemByPosition(i) if not it.IsEnabled(): return False return True
[ "def", "IsEnabled", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "for", "i", "in", "range", "(", "self", ".", "GetMenuItemCount", "(", ")", ")", ":", "it", "=", "self", ".", "FindItemByPosition", "(", "i", ")", "if", "not", "...
check if all menu items are enabled
[ "check", "if", "all", "menu", "items", "are", "enabled" ]
python
test
37.285714
JamesGardiner/chwrapper
chwrapper/services/search.py
https://github.com/JamesGardiner/chwrapper/blob/50f9cb2f5264c59505e8cc4e45ee6dc5d5669134/chwrapper/services/search.py#L226-L265
def significant_control(self, num, entity_id, entity_type='individual', **kwargs): """Get details of a specific entity with significant control. Args: num (str, int): Company numb...
[ "def", "significant_control", "(", "self", ",", "num", ",", "entity_id", ",", "entity_type", "=", "'individual'", ",", "*", "*", "kwargs", ")", ":", "# Dict mapping entity_type strings to url strings", "entities", "=", "{", "'individual'", ":", "'individual'", ",", ...
Get details of a specific entity with significant control. Args: num (str, int): Company number to search on. entity_id (str, int): Entity id to request details for entity_type (str, int): What type of entity to search for. Defaults to 'individual'. Other pos...
[ "Get", "details", "of", "a", "specific", "entity", "with", "significant", "control", "." ]
python
train
45.8
opencobra/memote
memote/support/basic.py
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/basic.py#L482-L526
def find_reactions_with_identical_genes(model): """ Return reactions that have identical genes. Identify duplicate reactions globally by checking if any two reactions have the same genes. This can be useful to curate merged models or to clean-up bulk model modifications, but also to identify pr...
[ "def", "find_reactions_with_identical_genes", "(", "model", ")", ":", "duplicates", "=", "dict", "(", ")", "for", "rxn_a", ",", "rxn_b", "in", "combinations", "(", "model", ".", "reactions", ",", "2", ")", ":", "if", "not", "(", "rxn_a", ".", "genes", "a...
Return reactions that have identical genes. Identify duplicate reactions globally by checking if any two reactions have the same genes. This can be useful to curate merged models or to clean-up bulk model modifications, but also to identify promiscuous enzymes. The heuristic compares reactions in a...
[ "Return", "reactions", "that", "have", "identical", "genes", "." ]
python
train
35.155556
AmesCornish/buttersink
buttersink/Store.py
https://github.com/AmesCornish/buttersink/blob/5cc37e30d9f8071fcf3497dca8b8a91b910321ea/buttersink/Store.py#L148-L167
def _relativePath(self, fullPath): """ Return fullPath relative to Store directory. Return fullPath if fullPath is not inside directory. Return None if fullPath is outside our scope. """ if fullPath is None: return None assert fullPath.startswith("/"), full...
[ "def", "_relativePath", "(", "self", ",", "fullPath", ")", ":", "if", "fullPath", "is", "None", ":", "return", "None", "assert", "fullPath", ".", "startswith", "(", "\"/\"", ")", ",", "fullPath", "path", "=", "os", ".", "path", ".", "relpath", "(", "fu...
Return fullPath relative to Store directory. Return fullPath if fullPath is not inside directory. Return None if fullPath is outside our scope.
[ "Return", "fullPath", "relative", "to", "Store", "directory", "." ]
python
train
26.5
singularityhub/sregistry-cli
sregistry/main/gitlab/__init__.py
https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/gitlab/__init__.py#L76-L104
def _parse_image_name(self, image, retry=True): '''starting with an image string in either of the following formats: job_id|collection job_id|collection|job_name Parse the job_name, job_id, and collection uri from it. If the user provides the first option, we use th...
[ "def", "_parse_image_name", "(", "self", ",", "image", ",", "retry", "=", "True", ")", ":", "try", ":", "job_id", ",", "collection", ",", "job_name", "=", "image", ".", "split", "(", "','", ")", "except", ":", "# Retry and add job_name", "if", "retry", "...
starting with an image string in either of the following formats: job_id|collection job_id|collection|job_name Parse the job_name, job_id, and collection uri from it. If the user provides the first option, we use the job_name set by the client (default is build)....
[ "starting", "with", "an", "image", "string", "in", "either", "of", "the", "following", "formats", ":", "job_id|collection", "job_id|collection|job_name", "Parse", "the", "job_name", "job_id", "and", "collection", "uri", "from", "it", ".", "If", "the", "user", "p...
python
test
39.068966
pantsbuild/pants
src/python/pants/cache/resolver.py
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/cache/resolver.py#L77-L89
def parse(self, content): """Parse raw response content for a list of remote artifact cache URLs. :API: public """ if self.format == 'json_map': try: return assert_list(json.loads(content.decode(self.encoding))[self.index]) except (KeyError, UnicodeDecodeError, ValueError) as e: ...
[ "def", "parse", "(", "self", ",", "content", ")", ":", "if", "self", ".", "format", "==", "'json_map'", ":", "try", ":", "return", "assert_list", "(", "json", ".", "loads", "(", "content", ".", "decode", "(", "self", ".", "encoding", ")", ")", "[", ...
Parse raw response content for a list of remote artifact cache URLs. :API: public
[ "Parse", "raw", "response", "content", "for", "a", "list", "of", "remote", "artifact", "cache", "URLs", "." ]
python
train
38.923077
aerogear/digger-build-cli
digger/builds/ant.py
https://github.com/aerogear/digger-build-cli/blob/8b88a31063526ec7222dbea6a87309686ad21320/digger/builds/ant.py#L27-L44
def sign(self, storepass=None, keypass=None, keystore=None, apk=None, alias=None, name='app'): """ Signs (jarsign and zipalign) a target apk file based on keystore information, uses default debug keystore file by default. :param storepass(str): keystore file storepass :param keypass(str): keystore file...
[ "def", "sign", "(", "self", ",", "storepass", "=", "None", ",", "keypass", "=", "None", ",", "keystore", "=", "None", ",", "apk", "=", "None", ",", "alias", "=", "None", ",", "name", "=", "'app'", ")", ":", "target", "=", "self", ".", "get_target",...
Signs (jarsign and zipalign) a target apk file based on keystore information, uses default debug keystore file by default. :param storepass(str): keystore file storepass :param keypass(str): keystore file keypass :param keystore(str): keystore file path :param apk(str): apk file path to be signed :...
[ "Signs", "(", "jarsign", "and", "zipalign", ")", "a", "target", "apk", "file", "based", "on", "keystore", "information", "uses", "default", "debug", "keystore", "file", "by", "default", "." ]
python
train
53.277778
kennydo/nyaalib
nyaalib/__init__.py
https://github.com/kennydo/nyaalib/blob/ab787b7ba141ed53d2ad978bf13eb7b8bcdd4b0d/nyaalib/__init__.py#L124-L139
def get_torrent(self, torrent_id): """Gets the `.torrent` data for the given `torrent_id`. :param torrent_id: the ID of the torrent to download :raises TorrentNotFoundError: if the torrent does not exist :returns: :class:`Torrent` of the associated torrent """ params = {...
[ "def", "get_torrent", "(", "self", ",", "torrent_id", ")", ":", "params", "=", "{", "'page'", ":", "'download'", ",", "'tid'", ":", "torrent_id", ",", "}", "r", "=", "requests", ".", "get", "(", "self", ".", "base_url", ",", "params", "=", "params", ...
Gets the `.torrent` data for the given `torrent_id`. :param torrent_id: the ID of the torrent to download :raises TorrentNotFoundError: if the torrent does not exist :returns: :class:`Torrent` of the associated torrent
[ "Gets", "the", ".", "torrent", "data", "for", "the", "given", "torrent_id", "." ]
python
train
40.625
aamalev/aiohttp_apiset
aiohttp_apiset/compat.py
https://github.com/aamalev/aiohttp_apiset/blob/ba3492ce929e39be1325d506b727a8bfb34e7b33/aiohttp_apiset/compat.py#L358-L362
def add_post(self, *args, **kwargs): """ Shortcut for add_route with method POST """ return self.add_route(hdrs.METH_POST, *args, **kwargs)
[ "def", "add_post", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "add_route", "(", "hdrs", ".", "METH_POST", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
Shortcut for add_route with method POST
[ "Shortcut", "for", "add_route", "with", "method", "POST" ]
python
train
33.4
nerdvegas/rez
src/rez/resolved_context.py
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolved_context.py#L922-L933
def get_environ(self, parent_environ=None): """Get the environ dict resulting from interpreting this context. @param parent_environ Environment to interpret the context within, defaults to os.environ if None. @returns The environment dict generated by this context, when ...
[ "def", "get_environ", "(", "self", ",", "parent_environ", "=", "None", ")", ":", "interp", "=", "Python", "(", "target_environ", "=", "{", "}", ",", "passive", "=", "True", ")", "executor", "=", "self", ".", "_create_executor", "(", "interp", ",", "paren...
Get the environ dict resulting from interpreting this context. @param parent_environ Environment to interpret the context within, defaults to os.environ if None. @returns The environment dict generated by this context, when interpreted in a python rex interpreter.
[ "Get", "the", "environ", "dict", "resulting", "from", "interpreting", "this", "context", "." ]
python
train
46
rodluger/everest
everest/missions/k2/pipelines.py
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/missions/k2/pipelines.py#L196-L308
def get_outliers(campaign, pipeline='everest2', sigma=5): ''' Computes the number of outliers for a given `campaign` and a given `pipeline`. Stores the results in a file under "/missions/k2/tables/". :param int sigma: The sigma level at which to clip outliers. Default 5 ''' # Imports ...
[ "def", "get_outliers", "(", "campaign", ",", "pipeline", "=", "'everest2'", ",", "sigma", "=", "5", ")", ":", "# Imports", "from", ".", "utils", "import", "GetK2Campaign", "client", "=", "k2plr", ".", "API", "(", ")", "# Check pipeline", "assert", "pipeline"...
Computes the number of outliers for a given `campaign` and a given `pipeline`. Stores the results in a file under "/missions/k2/tables/". :param int sigma: The sigma level at which to clip outliers. Default 5
[ "Computes", "the", "number", "of", "outliers", "for", "a", "given", "campaign", "and", "a", "given", "pipeline", ".", "Stores", "the", "results", "in", "a", "file", "under", "/", "missions", "/", "k2", "/", "tables", "/", "." ]
python
train
37.00885
MechanicalSoup/MechanicalSoup
mechanicalsoup/browser.py
https://github.com/MechanicalSoup/MechanicalSoup/blob/027a270febf5bcda6a75db60ea9838d631370f4b/mechanicalsoup/browser.py#L89-L97
def set_user_agent(self, user_agent): """Replaces the current user agent in the requests session headers.""" # set a default user_agent if not specified if user_agent is None: requests_ua = requests.utils.default_user_agent() user_agent = '%s (%s/%s)' % (requests_ua, __ti...
[ "def", "set_user_agent", "(", "self", ",", "user_agent", ")", ":", "# set a default user_agent if not specified", "if", "user_agent", "is", "None", ":", "requests_ua", "=", "requests", ".", "utils", ".", "default_user_agent", "(", ")", "user_agent", "=", "'%s (%s/%s...
Replaces the current user agent in the requests session headers.
[ "Replaces", "the", "current", "user", "agent", "in", "the", "requests", "session", "headers", "." ]
python
train
51.888889
cltk/cltk
cltk/prosody/latin/syllabifier.py
https://github.com/cltk/cltk/blob/ed9c025b7ec43c949481173251b70e05e4dffd27/cltk/prosody/latin/syllabifier.py#L317-L351
def _move_consonant(self, letters: list, positions: List[int]) -> List[str]: """ Given a list of consonant positions, move the consonants according to certain consonant syllable behavioral rules for gathering and grouping. :param letters: :param positions: :return: ...
[ "def", "_move_consonant", "(", "self", ",", "letters", ":", "list", ",", "positions", ":", "List", "[", "int", "]", ")", "->", "List", "[", "str", "]", ":", "for", "pos", "in", "positions", ":", "previous_letter", "=", "letters", "[", "pos", "-", "1"...
Given a list of consonant positions, move the consonants according to certain consonant syllable behavioral rules for gathering and grouping. :param letters: :param positions: :return:
[ "Given", "a", "list", "of", "consonant", "positions", "move", "the", "consonants", "according", "to", "certain", "consonant", "syllable", "behavioral", "rules", "for", "gathering", "and", "grouping", "." ]
python
train
55.314286
IRC-SPHERE/HyperStream
hyperstream/node/node.py
https://github.com/IRC-SPHERE/HyperStream/blob/98478f4d31ed938f4aa7c958ed0d4c3ffcb2e780/hyperstream/node/node.py#L129-L169
def print_head(self, parent_plate_value, plate_values, interval, n=10, print_func=logging.info): """ Print the first n values from the streams in the given time interval. The parent plate value is the value of the parent plate, and then the plate values are the values for the plate that ...
[ "def", "print_head", "(", "self", ",", "parent_plate_value", ",", "plate_values", ",", "interval", ",", "n", "=", "10", ",", "print_func", "=", "logging", ".", "info", ")", ":", "if", "isinstance", "(", "plate_values", ",", "Plate", ")", ":", "self", "."...
Print the first n values from the streams in the given time interval. The parent plate value is the value of the parent plate, and then the plate values are the values for the plate that are to be printed. e.g. print_head(None, ("house", "1")) :param parent_plate_value: The (fixed) pare...
[ "Print", "the", "first", "n", "values", "from", "the", "streams", "in", "the", "given", "time", "interval", ".", "The", "parent", "plate", "value", "is", "the", "value", "of", "the", "parent", "plate", "and", "then", "the", "plate", "values", "are", "the...
python
train
46.073171
Duke-GCB/DukeDSClient
ddsc/core/download.py
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/download.py#L83-L89
def run_preprocessor(self, files_to_download): """ Run file_download_pre_processor for each file we are about to download. :param files_to_download: [ProjectFile]: files that will be downloaded """ for project_file in files_to_download: self.file_download_pre_processo...
[ "def", "run_preprocessor", "(", "self", ",", "files_to_download", ")", ":", "for", "project_file", "in", "files_to_download", ":", "self", ".", "file_download_pre_processor", ".", "run", "(", "self", ".", "remote_store", ".", "data_service", ",", "project_file", "...
Run file_download_pre_processor for each file we are about to download. :param files_to_download: [ProjectFile]: files that will be downloaded
[ "Run", "file_download_pre_processor", "for", "each", "file", "we", "are", "about", "to", "download", ".", ":", "param", "files_to_download", ":", "[", "ProjectFile", "]", ":", "files", "that", "will", "be", "downloaded" ]
python
train
52.142857
Spinmob/spinmob
_data.py
https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_data.py#L918-L945
def insert_header(self, hkey, value, index=None): """ This will insert/overwrite a value to the header and hkeys. Parameters ---------- hkey Header key. Will be appended to self.hkeys if non existent, or inserted at the specified index. If h...
[ "def", "insert_header", "(", "self", ",", "hkey", ",", "value", ",", "index", "=", "None", ")", ":", "#if hkey is '': return", "# if it's an integer, use the hkey from the list", "if", "type", "(", "hkey", ")", "in", "[", "int", ",", "int", "]", ":", "hkey", ...
This will insert/overwrite a value to the header and hkeys. Parameters ---------- hkey Header key. Will be appended to self.hkeys if non existent, or inserted at the specified index. If hkey is an integer, uses self.hkeys[hkey]. value Va...
[ "This", "will", "insert", "/", "overwrite", "a", "value", "to", "the", "header", "and", "hkeys", "." ]
python
train
32.928571
galaxy-genome-annotation/python-apollo
apollo/users/__init__.py
https://github.com/galaxy-genome-annotation/python-apollo/blob/2bc9991302abe4402ec2885dcaac35915475b387/apollo/users/__init__.py#L169-L203
def create_user(self, email, first_name, last_name, password, role="user", metadata={}): """ Create a new user :type email: str :param email: User's email :type first_name: str :param first_name: User's first name :type last_name: str :param last_name: ...
[ "def", "create_user", "(", "self", ",", "email", ",", "first_name", ",", "last_name", ",", "password", ",", "role", "=", "\"user\"", ",", "metadata", "=", "{", "}", ")", ":", "data", "=", "{", "'firstName'", ":", "first_name", ",", "'lastName'", ":", "...
Create a new user :type email: str :param email: User's email :type first_name: str :param first_name: User's first name :type last_name: str :param last_name: User's last name :type password: str :param password: User's password :type role: s...
[ "Create", "a", "new", "user" ]
python
train
27.257143
OpenTreeOfLife/peyotl
peyotl/phylesystem/phylesystem_shard.py
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/phylesystem/phylesystem_shard.py#L332-L338
def create_git_action_for_new_study(self, new_study_id=None): """Checks out master branch as a side effect""" ga = self.create_git_action() if new_study_id is None: new_study_id = self._mint_new_study_id() self.register_doc_id(ga, new_study_id) return ga, new_study_id
[ "def", "create_git_action_for_new_study", "(", "self", ",", "new_study_id", "=", "None", ")", ":", "ga", "=", "self", ".", "create_git_action", "(", ")", "if", "new_study_id", "is", "None", ":", "new_study_id", "=", "self", ".", "_mint_new_study_id", "(", ")",...
Checks out master branch as a side effect
[ "Checks", "out", "master", "branch", "as", "a", "side", "effect" ]
python
train
44.857143
log2timeline/plaso
plaso/engine/knowledge_base.py
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/engine/knowledge_base.py#L269-L311
def ReadSystemConfigurationArtifact( self, system_configuration, session_identifier=CURRENT_SESSION): """Reads the knowledge base values from a system configuration artifact. Note that this overwrites existing values in the knowledge base. Args: system_configuration (SystemConfigurationArtifac...
[ "def", "ReadSystemConfigurationArtifact", "(", "self", ",", "system_configuration", ",", "session_identifier", "=", "CURRENT_SESSION", ")", ":", "if", "system_configuration", ".", "code_page", ":", "try", ":", "self", ".", "SetCodepage", "(", "system_configuration", "...
Reads the knowledge base values from a system configuration artifact. Note that this overwrites existing values in the knowledge base. Args: system_configuration (SystemConfigurationArtifact): system configuration artifact. session_identifier (Optional[str])): session identifier, where ...
[ "Reads", "the", "knowledge", "base", "values", "from", "a", "system", "configuration", "artifact", "." ]
python
train
38.372093
jotacor/ComunioPy
ComunioPy/__init__.py
https://github.com/jotacor/ComunioPy/blob/2dd71e3e197b497980ea7b9cfbec1da64dca3ed0/ComunioPy/__init__.py#L111-L132
def info_user(self,userid): '''Get user info using a ID''' headers = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/plain",'Referer': 'http://'+self.domain+'/standings.phtml',"User-Agent": user_agent} req = self.session.get('http://'+self.domain+'/playerInfo.phtml?pid='+use...
[ "def", "info_user", "(", "self", ",", "userid", ")", ":", "headers", "=", "{", "\"Content-type\"", ":", "\"application/x-www-form-urlencoded\"", ",", "\"Accept\"", ":", "\"text/plain\"", ",", "'Referer'", ":", "'http://'", "+", "self", ".", "domain", "+", "'/sta...
Get user info using a ID
[ "Get", "user", "info", "using", "a", "ID" ]
python
train
47.954545
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/ietf_netconf_acm.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/ietf_netconf_acm.py#L263-L278
def nacm_rule_list_rule_comment(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") nacm = ET.SubElement(config, "nacm", xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-acm") rule_list = ET.SubElement(nacm, "rule-list") name_key = ET.SubElement(rule_...
[ "def", "nacm_rule_list_rule_comment", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "nacm", "=", "ET", ".", "SubElement", "(", "config", ",", "\"nacm\"", ",", "xmlns", "=", "\"urn:ietf:params:x...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
42.75
pantsbuild/pants
src/python/pants/pantsd/service/pailgun_service.py
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/pantsd/service/pailgun_service.py#L88-L94
def terminate(self): """Override of PantsService.terminate() that cleans up when the Pailgun server is terminated.""" # Tear down the Pailgun TCPServer. if self.pailgun: self.pailgun.server_close() super(PailgunService, self).terminate()
[ "def", "terminate", "(", "self", ")", ":", "# Tear down the Pailgun TCPServer.", "if", "self", ".", "pailgun", ":", "self", ".", "pailgun", ".", "server_close", "(", ")", "super", "(", "PailgunService", ",", "self", ")", ".", "terminate", "(", ")" ]
Override of PantsService.terminate() that cleans up when the Pailgun server is terminated.
[ "Override", "of", "PantsService", ".", "terminate", "()", "that", "cleans", "up", "when", "the", "Pailgun", "server", "is", "terminated", "." ]
python
train
36.285714
AkihikoITOH/capybara
capybara/virtualenv/lib/python2.7/site-packages/setuptools/depends.py
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/depends.py#L79-L109
def _iter_code(code): """Yield '(op,arg)' pair for each operation in code object 'code'""" from array import array from dis import HAVE_ARGUMENT, EXTENDED_ARG bytes = array('b',code.co_code) eof = len(code.co_code) ptr = 0 extended_arg = 0 while ptr<eof: op = bytes[ptr] ...
[ "def", "_iter_code", "(", "code", ")", ":", "from", "array", "import", "array", "from", "dis", "import", "HAVE_ARGUMENT", ",", "EXTENDED_ARG", "bytes", "=", "array", "(", "'b'", ",", "code", ".", "co_code", ")", "eof", "=", "len", "(", "code", ".", "co...
Yield '(op,arg)' pair for each operation in code object 'code
[ "Yield", "(", "op", "arg", ")", "pair", "for", "each", "operation", "in", "code", "object", "code" ]
python
test
19.516129
oceanprotocol/osmosis-azure-driver
osmosis_azure_driver/computing_plugin.py
https://github.com/oceanprotocol/osmosis-azure-driver/blob/36bcfa96547fb6117346b02b0ac6a74345c59695/osmosis_azure_driver/computing_plugin.py#L42-L56
def _login_azure_app_token(client_id=None, client_secret=None, tenant_id=None): """ Authenticate APP using token credentials: https://docs.microsoft.com/en-us/python/azure/python-sdk-azure-authenticate?view=azure-python :return: ~ServicePrincipalCredentials credentials """ ...
[ "def", "_login_azure_app_token", "(", "client_id", "=", "None", ",", "client_secret", "=", "None", ",", "tenant_id", "=", "None", ")", ":", "client_id", "=", "os", ".", "getenv", "(", "'AZURE_CLIENT_ID'", ")", "if", "not", "client_id", "else", "client_id", "...
Authenticate APP using token credentials: https://docs.microsoft.com/en-us/python/azure/python-sdk-azure-authenticate?view=azure-python :return: ~ServicePrincipalCredentials credentials
[ "Authenticate", "APP", "using", "token", "credentials", ":", "https", ":", "//", "docs", ".", "microsoft", ".", "com", "/", "en", "-", "us", "/", "python", "/", "azure", "/", "python", "-", "sdk", "-", "azure", "-", "authenticate?view", "=", "azure", "...
python
train
49.533333
robinandeer/puzzle
puzzle/utils/ped.py
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/utils/ped.py#L20-L80
def get_cases(variant_source, case_lines=None, case_type='ped', variant_type='snv', variant_mode='vcf'): """Create a cases and populate it with individuals Args: variant_source (str): Path to vcf files case_lines (Iterable): Ped like lines ...
[ "def", "get_cases", "(", "variant_source", ",", "case_lines", "=", "None", ",", "case_type", "=", "'ped'", ",", "variant_type", "=", "'snv'", ",", "variant_mode", "=", "'vcf'", ")", ":", "individuals", "=", "get_individuals", "(", "variant_source", "=", "varia...
Create a cases and populate it with individuals Args: variant_source (str): Path to vcf files case_lines (Iterable): Ped like lines case_type (str): Format of case lines Returns: case_objs (list(puzzle.models.Case))
[ "Create", "a", "cases", "and", "populate", "it", "with", "individuals" ]
python
train
34.245902
FlaskGuys/Flask-Imagine
flask_imagine/filters/watermark.py
https://github.com/FlaskGuys/Flask-Imagine/blob/f79c6517ecb5480b63a2b3b8554edb6e2ac8be8c/flask_imagine/filters/watermark.py#L195-L208
def _get_image(self): """ Prepare watermark image :return: Image.Image """ if self.image is None: image_path = '%s/%s' % (current_app.static_folder, os.path.normpath(self.image_path)) try: self.image = Image.open(image_path) ...
[ "def", "_get_image", "(", "self", ")", ":", "if", "self", ".", "image", "is", "None", ":", "image_path", "=", "'%s/%s'", "%", "(", "current_app", ".", "static_folder", ",", "os", ".", "path", ".", "normpath", "(", "self", ".", "image_path", ")", ")", ...
Prepare watermark image :return: Image.Image
[ "Prepare", "watermark", "image", ":", "return", ":", "Image", ".", "Image" ]
python
train
33.857143
pypa/pipenv
pipenv/patched/notpip/_internal/cli/parser.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/cli/parser.py#L123-L129
def option_list_all(self): """Get a list of all options, including those in option groups.""" res = self.option_list[:] for i in self.option_groups: res.extend(i.option_list) return res
[ "def", "option_list_all", "(", "self", ")", ":", "res", "=", "self", ".", "option_list", "[", ":", "]", "for", "i", "in", "self", ".", "option_groups", ":", "res", ".", "extend", "(", "i", ".", "option_list", ")", "return", "res" ]
Get a list of all options, including those in option groups.
[ "Get", "a", "list", "of", "all", "options", "including", "those", "in", "option", "groups", "." ]
python
train
32
shalabhms/reliable-collections-cli
rcctl/rcctl/config.py
https://github.com/shalabhms/reliable-collections-cli/blob/195d69816fb5a6e1e9ab0ab66b606b1248b4780d/rcctl/rcctl/config.py#L33-L37
def set_config_value(name, value): """Set a config by name to a value.""" cli_config = CLIConfig(SF_CLI_CONFIG_DIR, SF_CLI_ENV_VAR_PREFIX) cli_config.set_value('servicefabric', name, value)
[ "def", "set_config_value", "(", "name", ",", "value", ")", ":", "cli_config", "=", "CLIConfig", "(", "SF_CLI_CONFIG_DIR", ",", "SF_CLI_ENV_VAR_PREFIX", ")", "cli_config", ".", "set_value", "(", "'servicefabric'", ",", "name", ",", "value", ")" ]
Set a config by name to a value.
[ "Set", "a", "config", "by", "name", "to", "a", "value", "." ]
python
valid
39.6
ethereum/py-evm
eth/tools/builder/chain/builders.py
https://github.com/ethereum/py-evm/blob/58346848f076116381d3274bbcea96b9e2cfcbdf/eth/tools/builder/chain/builders.py#L453-L486
def chain_split(*splits: Iterable[Callable[..., Any]]) -> Callable[[BaseChain], Iterable[BaseChain]]: # noqa: E501 """ Construct and execute multiple concurrent forks of the chain. Any number of forks may be executed. For each fork, provide an iterable of commands. Returns the resulting chain o...
[ "def", "chain_split", "(", "*", "splits", ":", "Iterable", "[", "Callable", "[", "...", ",", "Any", "]", "]", ")", "->", "Callable", "[", "[", "BaseChain", "]", ",", "Iterable", "[", "BaseChain", "]", "]", ":", "# noqa: E501", "if", "not", "splits", ...
Construct and execute multiple concurrent forks of the chain. Any number of forks may be executed. For each fork, provide an iterable of commands. Returns the resulting chain objects for each fork. .. code-block:: python chain_a, chain_b = build( mining_chain, chain...
[ "Construct", "and", "execute", "multiple", "concurrent", "forks", "of", "the", "chain", "." ]
python
train
29.588235
kensho-technologies/graphql-compiler
graphql_compiler/compiler/filters.py
https://github.com/kensho-technologies/graphql-compiler/blob/f6079c6d10f64932f6b3af309b79bcea2123ca8f/graphql_compiler/compiler/filters.py#L607-L663
def process_filter_directive(filter_operation_info, location, context): """Return a Filter basic block that corresponds to the filter operation in the directive. Args: filter_operation_info: FilterOperationInfo object, containing the directive and field info of the field ...
[ "def", "process_filter_directive", "(", "filter_operation_info", ",", "location", ",", "context", ")", ":", "op_name", ",", "operator_params", "=", "_get_filter_op_name_and_values", "(", "filter_operation_info", ".", "directive", ")", "non_comparison_filters", "=", "{", ...
Return a Filter basic block that corresponds to the filter operation in the directive. Args: filter_operation_info: FilterOperationInfo object, containing the directive and field info of the field where the filter is to be applied. location: Location where this filter...
[ "Return", "a", "Filter", "basic", "block", "that", "corresponds", "to", "the", "filter", "operation", "in", "the", "directive", "." ]
python
train
52.929825
tchellomello/raincloudy
raincloudy/core.py
https://github.com/tchellomello/raincloudy/blob/1847fa913e5ba79645d51bf23637860d68c67dbf/raincloudy/core.py#L123-L130
def controller(self): """Show current linked controllers.""" if hasattr(self, 'controllers'): if len(self.controllers) > 1: # in the future, we should support more controllers raise TypeError("Only one controller per account.") return self.controll...
[ "def", "controller", "(", "self", ")", ":", "if", "hasattr", "(", "self", ",", "'controllers'", ")", ":", "if", "len", "(", "self", ".", "controllers", ")", ">", "1", ":", "# in the future, we should support more controllers", "raise", "TypeError", "(", "\"Onl...
Show current linked controllers.
[ "Show", "current", "linked", "controllers", "." ]
python
train
48
SmokinCaterpillar/pypet
pypet/environment.py
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/environment.py#L190-L207
def _scoop_single_run(kwargs): """Wrapper function for scoop, that does not configure logging""" try: try: is_origin = scoop.IS_ORIGIN except AttributeError: # scoop is not properly started, i.e. with `python -m scoop...` # in this case scoop uses default `map...
[ "def", "_scoop_single_run", "(", "kwargs", ")", ":", "try", ":", "try", ":", "is_origin", "=", "scoop", ".", "IS_ORIGIN", "except", "AttributeError", ":", "# scoop is not properly started, i.e. with `python -m scoop...`", "# in this case scoop uses default `map` function, i.e."...
Wrapper function for scoop, that does not configure logging
[ "Wrapper", "function", "for", "scoop", "that", "does", "not", "configure", "logging" ]
python
test
38.611111
StackStorm/pybind
pybind/nos/v6_0_2f/brocade_entity_rpc/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/nos/v6_0_2f/brocade_entity_rpc/__init__.py#L100-L126
def _set_get_contained_in_ID(self, v, load=False): """ Setter method for get_contained_in_ID, mapped from YANG variable /brocade_entity_rpc/get_contained_in_ID (rpc) If this variable is read-only (config: false) in the source YANG file, then _set_get_contained_in_ID is considered as a private method...
[ "def", "_set_get_contained_in_ID", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ",...
Setter method for get_contained_in_ID, mapped from YANG variable /brocade_entity_rpc/get_contained_in_ID (rpc) If this variable is read-only (config: false) in the source YANG file, then _set_get_contained_in_ID is considered as a private method. Backends looking to populate this variable should do so v...
[ "Setter", "method", "for", "get_contained_in_ID", "mapped", "from", "YANG", "variable", "/", "brocade_entity_rpc", "/", "get_contained_in_ID", "(", "rpc", ")", "If", "this", "variable", "is", "read", "-", "only", "(", "config", ":", "false", ")", "in", "the", ...
python
train
70.703704
tknapen/FIRDeconvolution
src/FIRDeconvolution.py
https://github.com/tknapen/FIRDeconvolution/blob/6263496a356c449062fe4c216fef56541f6dc151/src/FIRDeconvolution.py#L262-L270
def betas_for_cov(self, covariate = '0'): """betas_for_cov returns the beta values (i.e. IRF) associated with a specific covariate. :param covariate: name of covariate. :type covariate: string """ # find the index in the designmatrix of the current covariate this...
[ "def", "betas_for_cov", "(", "self", ",", "covariate", "=", "'0'", ")", ":", "# find the index in the designmatrix of the current covariate", "this_covariate_index", "=", "list", "(", "self", ".", "covariates", ".", "keys", "(", ")", ")", ".", "index", "(", "covar...
betas_for_cov returns the beta values (i.e. IRF) associated with a specific covariate. :param covariate: name of covariate. :type covariate: string
[ "betas_for_cov", "returns", "the", "beta", "values", "(", "i", ".", "e", ".", "IRF", ")", "associated", "with", "a", "specific", "covariate", "." ]
python
train
58.333333
scidash/sciunit
sciunit/utils.py
https://github.com/scidash/sciunit/blob/41b2e38c45c0776727ab1f281a572b65be19cea1/sciunit/utils.py#L143-L157
def fix_display(self): """If this is being run on a headless system the Matplotlib backend must be changed to one that doesn't need a display. """ try: tkinter.Tk() except (tkinter.TclError, NameError): # If there is no display. try: impor...
[ "def", "fix_display", "(", "self", ")", ":", "try", ":", "tkinter", ".", "Tk", "(", ")", "except", "(", "tkinter", ".", "TclError", ",", "NameError", ")", ":", "# If there is no display.", "try", ":", "import", "matplotlib", "as", "mpl", "except", "ImportE...
If this is being run on a headless system the Matplotlib backend must be changed to one that doesn't need a display.
[ "If", "this", "is", "being", "run", "on", "a", "headless", "system", "the", "Matplotlib", "backend", "must", "be", "changed", "to", "one", "that", "doesn", "t", "need", "a", "display", "." ]
python
train
32.4
StackStorm/pybind
pybind/nos/v6_0_2f/logging/raslog/module/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/nos/v6_0_2f/logging/raslog/module/__init__.py#L92-L113
def _set_modId(self, v, load=False): """ Setter method for modId, mapped from YANG variable /logging/raslog/module/modId (list) If this variable is read-only (config: false) in the source YANG file, then _set_modId is considered as a private method. Backends looking to populate this variable should ...
[ "def", "_set_modId", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ",", "base", ...
Setter method for modId, mapped from YANG variable /logging/raslog/module/modId (list) If this variable is read-only (config: false) in the source YANG file, then _set_modId is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_modId() direct...
[ "Setter", "method", "for", "modId", "mapped", "from", "YANG", "variable", "/", "logging", "/", "raslog", "/", "module", "/", "modId", "(", "list", ")", "If", "this", "variable", "is", "read", "-", "only", "(", "config", ":", "false", ")", "in", "the", ...
python
train
102.090909
fumitoh/modelx
modelx/core/formula.py
https://github.com/fumitoh/modelx/blob/0180da34d052c44fb94dab9e115e218bbebfc9c3/modelx/core/formula.py#L27-L80
def fix_lamdaline(source): """Remove the last redundant token from lambda expression lambda x: return x) ^ Return string without irrelevant tokens returned from inspect.getsource on lamda expr returns """ # Using undocumented generate_tokens due to a tokenize.tokenize bug...
[ "def", "fix_lamdaline", "(", "source", ")", ":", "# Using undocumented generate_tokens due to a tokenize.tokenize bug", "# See https://bugs.python.org/issue23297", "strio", "=", "io", ".", "StringIO", "(", "source", ")", "gen", "=", "tokenize", ".", "generate_tokens", "(", ...
Remove the last redundant token from lambda expression lambda x: return x) ^ Return string without irrelevant tokens returned from inspect.getsource on lamda expr returns
[ "Remove", "the", "last", "redundant", "token", "from", "lambda", "expression" ]
python
valid
25.722222
RPi-Distro/python-sense-hat
sense_hat/sense_hat.py
https://github.com/RPi-Distro/python-sense-hat/blob/9a37f0923ce8dbde69514c3b8d58d30de01c9ee7/sense_hat/sense_hat.py#L206-L219
def set_rotation(self, r=0, redraw=True): """ Sets the LED matrix rotation for viewing, adjust if the Pi is upside down or sideways. 0 is with the Pi HDMI port facing downwards """ if r in self._pix_map.keys(): if redraw: pixel_list = self.get_pixels(...
[ "def", "set_rotation", "(", "self", ",", "r", "=", "0", ",", "redraw", "=", "True", ")", ":", "if", "r", "in", "self", ".", "_pix_map", ".", "keys", "(", ")", ":", "if", "redraw", ":", "pixel_list", "=", "self", ".", "get_pixels", "(", ")", "self...
Sets the LED matrix rotation for viewing, adjust if the Pi is upside down or sideways. 0 is with the Pi HDMI port facing downwards
[ "Sets", "the", "LED", "matrix", "rotation", "for", "viewing", "adjust", "if", "the", "Pi", "is", "upside", "down", "or", "sideways", ".", "0", "is", "with", "the", "Pi", "HDMI", "port", "facing", "downwards" ]
python
train
35.357143
pybel/pybel
src/pybel/manager/query_manager.py
https://github.com/pybel/pybel/blob/c8a7a1bdae4c475fa2a8c77f3a9a5f6d79556ca0/src/pybel/manager/query_manager.py#L22-L29
def graph_from_edges(edges: Iterable[Edge], **kwargs) -> BELGraph: """Build a BEL graph from edges.""" graph = BELGraph(**kwargs) for edge in edges: edge.insert_into_graph(graph) return graph
[ "def", "graph_from_edges", "(", "edges", ":", "Iterable", "[", "Edge", "]", ",", "*", "*", "kwargs", ")", "->", "BELGraph", ":", "graph", "=", "BELGraph", "(", "*", "*", "kwargs", ")", "for", "edge", "in", "edges", ":", "edge", ".", "insert_into_graph"...
Build a BEL graph from edges.
[ "Build", "a", "BEL", "graph", "from", "edges", "." ]
python
train
26.25
PmagPy/PmagPy
pmagpy/convert_2_magic.py
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/convert_2_magic.py#L4830-L5092
def jr6_jr6(mag_file, dir_path=".", input_dir_path="", meas_file="measurements.txt", spec_file="specimens.txt", samp_file="samples.txt", site_file="sites.txt", loc_file="locations.txt", specnum=1, samp_con='1', location='unknown', lat='', lon='', noave=False, meth_code="L...
[ "def", "jr6_jr6", "(", "mag_file", ",", "dir_path", "=", "\".\"", ",", "input_dir_path", "=", "\"\"", ",", "meas_file", "=", "\"measurements.txt\"", ",", "spec_file", "=", "\"specimens.txt\"", ",", "samp_file", "=", "\"samples.txt\"", ",", "site_file", "=", "\"s...
Convert JR6 .jr6 files to MagIC file(s) Parameters ---------- mag_file : str input file name dir_path : str working directory, default "." input_dir_path : str input file directory IF different from dir_path, default "" meas_file : str output measurement file nam...
[ "Convert", "JR6", ".", "jr6", "files", "to", "MagIC", "file", "(", "s", ")" ]
python
train
42.581749
NLeSC/scriptcwl
scriptcwl/workflow.py
https://github.com/NLeSC/scriptcwl/blob/33bb847a875379da3a5702c7a98dfa585306b960/scriptcwl/workflow.py#L652-L671
def validate(self): """Validate workflow object. This method currently validates the workflow object with the use of cwltool. It writes the workflow to a tmp CWL file, reads it, validates it and removes the tmp file again. By default, the workflow is written to file using absolu...
[ "def", "validate", "(", "self", ")", ":", "# define tmpfile", "(", "fd", ",", "tmpfile", ")", "=", "tempfile", ".", "mkstemp", "(", ")", "os", ".", "close", "(", "fd", ")", "try", ":", "# save workflow object to tmpfile,", "# do not recursively call validate fun...
Validate workflow object. This method currently validates the workflow object with the use of cwltool. It writes the workflow to a tmp CWL file, reads it, validates it and removes the tmp file again. By default, the workflow is written to file using absolute paths to the steps.
[ "Validate", "workflow", "object", "." ]
python
train
39.65
apache/airflow
airflow/jobs.py
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/jobs.py#L1669-L1787
def process_file(self, file_path, zombies, pickle_dags=False, session=None): """ Process a Python file containing Airflow DAGs. This includes: 1. Execute the file and look for DAG objects in the namespace. 2. Pickle the DAG and save it to the DB (if necessary). 3. For e...
[ "def", "process_file", "(", "self", ",", "file_path", ",", "zombies", ",", "pickle_dags", "=", "False", ",", "session", "=", "None", ")", ":", "self", ".", "log", ".", "info", "(", "\"Processing file %s for tasks to queue\"", ",", "file_path", ")", "# As DAGs ...
Process a Python file containing Airflow DAGs. This includes: 1. Execute the file and look for DAG objects in the namespace. 2. Pickle the DAG and save it to the DB (if necessary). 3. For each DAG, see what tasks should run and create appropriate task instances in the DB. ...
[ "Process", "a", "Python", "file", "containing", "Airflow", "DAGs", "." ]
python
test
42.647059
batiste/django-page-cms
pages/models.py
https://github.com/batiste/django-page-cms/blob/3c72111eb7c3997a63c462c1776ffd8ce8c50a5d/pages/models.py#L456-L463
def slug_with_level(self, language=None): """Display the slug of the page prepended with insecable spaces to simluate the level of page in the hierarchy.""" level = '' if self.level: for n in range(0, self.level): level += '&nbsp;&nbsp;&nbsp;' return m...
[ "def", "slug_with_level", "(", "self", ",", "language", "=", "None", ")", ":", "level", "=", "''", "if", "self", ".", "level", ":", "for", "n", "in", "range", "(", "0", ",", "self", ".", "level", ")", ":", "level", "+=", "'&nbsp;&nbsp;&nbsp;'", "retu...
Display the slug of the page prepended with insecable spaces to simluate the level of page in the hierarchy.
[ "Display", "the", "slug", "of", "the", "page", "prepended", "with", "insecable", "spaces", "to", "simluate", "the", "level", "of", "page", "in", "the", "hierarchy", "." ]
python
train
43.75
lsst-sqre/documenteer
documenteer/stackdocs/stackcli.py
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/stackdocs/stackcli.py#L38-L77
def main(ctx, root_project_dir, verbose): """stack-docs is a CLI for building LSST Stack documentation, such as pipelines.lsst.io. This command should be run on the "main" documentation repository, namely https://github.com/lsst/pipelines_lsst_io. The stack-docs command replaces the usual Makefile...
[ "def", "main", "(", "ctx", ",", "root_project_dir", ",", "verbose", ")", ":", "root_project_dir", "=", "discover_conf_py_directory", "(", "root_project_dir", ")", "# Subcommands should use the click.pass_obj decorator to get this", "# ctx.obj object as the first argument.", "ctx"...
stack-docs is a CLI for building LSST Stack documentation, such as pipelines.lsst.io. This command should be run on the "main" documentation repository, namely https://github.com/lsst/pipelines_lsst_io. The stack-docs command replaces the usual Makefile and sphinx-build system for Sphinx projects....
[ "stack", "-", "docs", "is", "a", "CLI", "for", "building", "LSST", "Stack", "documentation", "such", "as", "pipelines", ".", "lsst", ".", "io", "." ]
python
train
38.75
pyinvoke/invocations
invocations/packaging/release.py
https://github.com/pyinvoke/invocations/blob/bbf1b319bd1536817d5301ceb9eeb2f31830e5dc/invocations/packaging/release.py#L395-L427
def _release_and_issues(changelog, branch, release_type): """ Return most recent branch-appropriate release, if any, and its contents. :param dict changelog: Changelog contents, as returned by ``releases.util.parse_changelog``. :param str branch: Branch name. :param release_type: ...
[ "def", "_release_and_issues", "(", "changelog", ",", "branch", ",", "release_type", ")", ":", "# Bugfix lines just use the branch to find issues", "bucket", "=", "branch", "# Features need a bit more logic", "if", "release_type", "is", "Release", ".", "FEATURE", ":", "buc...
Return most recent branch-appropriate release, if any, and its contents. :param dict changelog: Changelog contents, as returned by ``releases.util.parse_changelog``. :param str branch: Branch name. :param release_type: Member of `Release`, e.g. `Release.FEATURE`. :returns: ...
[ "Return", "most", "recent", "branch", "-", "appropriate", "release", "if", "any", "and", "its", "contents", "." ]
python
train
36.090909
inveniosoftware/invenio-pidstore
invenio_pidstore/models.py
https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/models.py#L392-L413
def register(self): """Register the persistent identifier with the provider. :raises invenio_pidstore.errors.PIDInvalidAction: If the PID is not already registered or is deleted or is a redirection to another PID. :returns: `True` if the PID is successfully register. ...
[ "def", "register", "(", "self", ")", ":", "if", "self", ".", "is_registered", "(", ")", "or", "self", ".", "is_deleted", "(", ")", "or", "self", ".", "is_redirected", "(", ")", ":", "raise", "PIDInvalidAction", "(", "\"Persistent identifier has already been re...
Register the persistent identifier with the provider. :raises invenio_pidstore.errors.PIDInvalidAction: If the PID is not already registered or is deleted or is a redirection to another PID. :returns: `True` if the PID is successfully register.
[ "Register", "the", "persistent", "identifier", "with", "the", "provider", "." ]
python
train
39.954545
kgori/treeCl
treeCl/tree.py
https://github.com/kgori/treeCl/blob/fed624b3db1c19cc07175ca04e3eda6905a8d305/treeCl/tree.py#L1054-L1089
def reversible_deroot(self): """ Stores info required to restore rootedness to derooted Tree. Returns the edge that was originally rooted, the length of e1, and the length of e2. Dendropy Derooting Process: In a rooted tree the root node is bifurcating. Derooting makes it ...
[ "def", "reversible_deroot", "(", "self", ")", ":", "root_edge", "=", "self", ".", "_tree", ".", "seed_node", ".", "edge", "lengths", "=", "dict", "(", "[", "(", "edge", ",", "edge", ".", "length", ")", "for", "edge", "in", "self", ".", "_tree", ".", ...
Stores info required to restore rootedness to derooted Tree. Returns the edge that was originally rooted, the length of e1, and the length of e2. Dendropy Derooting Process: In a rooted tree the root node is bifurcating. Derooting makes it trifurcating. Call the two edg...
[ "Stores", "info", "required", "to", "restore", "rootedness", "to", "derooted", "Tree", ".", "Returns", "the", "edge", "that", "was", "originally", "rooted", "the", "length", "of", "e1", "and", "the", "length", "of", "e2", "." ]
python
train
44.861111
bjodah/pycodeexport
pycodeexport/codeexport.py
https://github.com/bjodah/pycodeexport/blob/7d1d733745ea4e54fdcee8f16fea313794a4c11b/pycodeexport/codeexport.py#L336-L342
def clean(self): """ Delete temp dir if not save_temp set at __init__ """ if not self._save_temp: if hasattr(self, '_written_files'): map(os.unlink, self._written_files) if getattr(self, '_remove_tempdir_on_clean', False): shutil.rmtree(self._tempd...
[ "def", "clean", "(", "self", ")", ":", "if", "not", "self", ".", "_save_temp", ":", "if", "hasattr", "(", "self", ",", "'_written_files'", ")", ":", "map", "(", "os", ".", "unlink", ",", "self", ".", "_written_files", ")", "if", "getattr", "(", "self...
Delete temp dir if not save_temp set at __init__
[ "Delete", "temp", "dir", "if", "not", "save_temp", "set", "at", "__init__" ]
python
train
45.285714
basho/riak-python-client
riak/mapreduce.py
https://github.com/basho/riak-python-client/blob/91de13a16607cdf553d1a194e762734e3bec4231/riak/mapreduce.py#L242-L269
def map(self, function, options=None): """ Add a map phase to the map/reduce operation. :param function: Either a named Javascript function (ie: 'Riak.mapValues'), or an anonymous javascript function (ie: 'function(...) ... ' or an array ['erlang_module', 'function...
[ "def", "map", "(", "self", ",", "function", ",", "options", "=", "None", ")", ":", "if", "options", "is", "None", ":", "options", "=", "dict", "(", ")", "if", "isinstance", "(", "function", ",", "list", ")", ":", "language", "=", "'erlang'", "else", ...
Add a map phase to the map/reduce operation. :param function: Either a named Javascript function (ie: 'Riak.mapValues'), or an anonymous javascript function (ie: 'function(...) ... ' or an array ['erlang_module', 'function']. :type function: string, list :param opt...
[ "Add", "a", "map", "phase", "to", "the", "map", "/", "reduce", "operation", "." ]
python
train
36
pypyr/pypyr-cli
pypyr/dsl.py
https://github.com/pypyr/pypyr-cli/blob/4003f999cd5eb030b4c7407317de728f5115a80f/pypyr/dsl.py#L107-L115
def get_value(self, context): """Run python eval on the input string.""" if self.value: return expressions.eval_string(self.value, context) else: # Empty input raises cryptic EOF syntax err, this more human # friendly raise ValueError('!py string e...
[ "def", "get_value", "(", "self", ",", "context", ")", ":", "if", "self", ".", "value", ":", "return", "expressions", ".", "eval_string", "(", "self", ".", "value", ",", "context", ")", "else", ":", "# Empty input raises cryptic EOF syntax err, this more human", ...
Run python eval on the input string.
[ "Run", "python", "eval", "on", "the", "input", "string", "." ]
python
train
45.666667
Microsoft/nni
examples/trials/mnist-batch-tune-keras/mnist-keras.py
https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/examples/trials/mnist-batch-tune-keras/mnist-keras.py#L82-L87
def on_epoch_end(self, epoch, logs={}): ''' Run on end of each epoch ''' LOG.debug(logs) nni.report_intermediate_result(logs["val_acc"])
[ "def", "on_epoch_end", "(", "self", ",", "epoch", ",", "logs", "=", "{", "}", ")", ":", "LOG", ".", "debug", "(", "logs", ")", "nni", ".", "report_intermediate_result", "(", "logs", "[", "\"val_acc\"", "]", ")" ]
Run on end of each epoch
[ "Run", "on", "end", "of", "each", "epoch" ]
python
train
28.5
openai/retro
retro/examples/brute.py
https://github.com/openai/retro/blob/29dc84fef6d7076fd11a3847d2877fe59e705d36/retro/examples/brute.py#L76-L124
def select_actions(root, action_space, max_episode_steps): """ Select actions from the tree Normally we select the greedy action that has the highest reward associated with that subtree. We have a small chance to select a random action based on the exploration param and visit count of the curr...
[ "def", "select_actions", "(", "root", ",", "action_space", ",", "max_episode_steps", ")", ":", "node", "=", "root", "acts", "=", "[", "]", "steps", "=", "0", "while", "steps", "<", "max_episode_steps", ":", "if", "node", "is", "None", ":", "# we've fallen ...
Select actions from the tree Normally we select the greedy action that has the highest reward associated with that subtree. We have a small chance to select a random action based on the exploration param and visit count of the current node at each step. We select actions for the longest possible ...
[ "Select", "actions", "from", "the", "tree" ]
python
train
34.714286
Microsoft/botbuilder-python
libraries/botbuilder-applicationinsights/botbuilder/applicationinsights/application_insights_telemetry_client.py
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-applicationinsights/botbuilder/applicationinsights/application_insights_telemetry_client.py#L72-L86
def track_metric(self, name: str, value: float, type: TelemetryDataPointType =None, count: int =None, min: float=None, max: float=None, std_dev: float=None, properties: Dict[str, object]=None) -> NotImplemented: """ Send information about a single metric data poi...
[ "def", "track_metric", "(", "self", ",", "name", ":", "str", ",", "value", ":", "float", ",", "type", ":", "TelemetryDataPointType", "=", "None", ",", "count", ":", "int", "=", "None", ",", "min", ":", "float", "=", "None", ",", "max", ":", "float", ...
Send information about a single metric data point that was captured for the application. :param name: The name of the metric that was captured. :param value: The value of the metric that was captured. :param type: The type of the metric. (defaults to: TelemetryDataPointType.aggregation`) ...
[ "Send", "information", "about", "a", "single", "metric", "data", "point", "that", "was", "captured", "for", "the", "application", ".", ":", "param", "name", ":", "The", "name", "of", "the", "metric", "that", "was", "captured", ".", ":", "param", "value", ...
python
test
85.133333
postlund/pyatv
pyatv/mrp/protocol.py
https://github.com/postlund/pyatv/blob/655dfcda4e2f9d1c501540e18da4f480d8bf0e70/pyatv/mrp/protocol.py#L134-L153
async def send_and_receive(self, message, generate_identifier=True, timeout=5): """Send a message and wait for a response.""" await self._connect_and_encrypt() # Some messages will respond with the same identifier as used in the # corresponding request. Ot...
[ "async", "def", "send_and_receive", "(", "self", ",", "message", ",", "generate_identifier", "=", "True", ",", "timeout", "=", "5", ")", ":", "await", "self", ".", "_connect_and_encrypt", "(", ")", "# Some messages will respond with the same identifier as used in the", ...
Send a message and wait for a response.
[ "Send", "a", "message", "and", "wait", "for", "a", "response", "." ]
python
train
47.9
sendgrid/sendgrid-python
sendgrid/helpers/mail/mail.py
https://github.com/sendgrid/sendgrid-python/blob/266c2abde7a35dfcce263e06bedc6a0bbdebeac9/sendgrid/helpers/mail/mail.py#L274-L299
def cc(self, cc_emails, global_substitutions=None, is_multiple=False, p=0): """Adds Cc objects to the Personalization object :param cc_emails: An Cc or list of Cc objects :type cc_emails: Cc, list(Cc), tuple :param global_substitutions: A dict of substitutions for all recipients ...
[ "def", "cc", "(", "self", ",", "cc_emails", ",", "global_substitutions", "=", "None", ",", "is_multiple", "=", "False", ",", "p", "=", "0", ")", ":", "if", "isinstance", "(", "cc_emails", ",", "list", ")", ":", "for", "email", "in", "cc_emails", ":", ...
Adds Cc objects to the Personalization object :param cc_emails: An Cc or list of Cc objects :type cc_emails: Cc, list(Cc), tuple :param global_substitutions: A dict of substitutions for all recipients :type global_substitutions: dict :param is_multiple: Create a new personilizat...
[ "Adds", "Cc", "objects", "to", "the", "Personalization", "object" ]
python
train
46.692308
ets-labs/python-domain-models
domain_models/models.py
https://github.com/ets-labs/python-domain-models/blob/7de1816ba0338f20fdb3e0f57fad0ffd5bea13f9/domain_models/models.py#L64-L67
def bind_fields_to_model_cls(cls, model_fields): """Bind fields to model class.""" return dict( (field.name, field.bind_model_cls(cls)) for field in model_fields)
[ "def", "bind_fields_to_model_cls", "(", "cls", ",", "model_fields", ")", ":", "return", "dict", "(", "(", "field", ".", "name", ",", "field", ".", "bind_model_cls", "(", "cls", ")", ")", "for", "field", "in", "model_fields", ")" ]
Bind fields to model class.
[ "Bind", "fields", "to", "model", "class", "." ]
python
train
46.75
sdispater/orator
orator/dbal/index.py
https://github.com/sdispater/orator/blob/bd90bf198ee897751848f9a92e49d18e60a74136/orator/dbal/index.py#L65-L84
def get_quoted_columns(self, platform): """ Returns the quoted representation of the column names the constraint is associated with. But only if they were defined with one or a column name is a keyword reserved by the platform. Otherwise the plain unquoted value as inser...
[ "def", "get_quoted_columns", "(", "self", ",", "platform", ")", ":", "columns", "=", "[", "]", "for", "column", "in", "self", ".", "_columns", ".", "values", "(", ")", ":", "columns", ".", "append", "(", "column", ".", "get_quoted_name", "(", "platform",...
Returns the quoted representation of the column names the constraint is associated with. But only if they were defined with one or a column name is a keyword reserved by the platform. Otherwise the plain unquoted value as inserted is returned. :param platform: The platform to u...
[ "Returns", "the", "quoted", "representation", "of", "the", "column", "names", "the", "constraint", "is", "associated", "with", "." ]
python
train
29.9
JoseAntFer/pyny3d
pyny3d/geoms.py
https://github.com/JoseAntFer/pyny3d/blob/fb81684935a24f7e50c975cb4383c81a63ab56df/pyny3d/geoms.py#L1589-L1596
def get_plotable3d(self): """ :returns: matplotlib Poly3DCollection :rtype: list of mpl_toolkits.mplot3d """ polyhedra = sum([polyhedron.get_plotable3d() for polyhedron in self.polyhedra], []) return polyhedra + self.surface.get_plotable3d...
[ "def", "get_plotable3d", "(", "self", ")", ":", "polyhedra", "=", "sum", "(", "[", "polyhedron", ".", "get_plotable3d", "(", ")", "for", "polyhedron", "in", "self", ".", "polyhedra", "]", ",", "[", "]", ")", "return", "polyhedra", "+", "self", ".", "su...
:returns: matplotlib Poly3DCollection :rtype: list of mpl_toolkits.mplot3d
[ ":", "returns", ":", "matplotlib", "Poly3DCollection", ":", "rtype", ":", "list", "of", "mpl_toolkits", ".", "mplot3d" ]
python
train
39.375
serkanyersen/underscore.py
src/underscore.py
https://github.com/serkanyersen/underscore.py/blob/07c25c3f0f789536e4ad47aa315faccc0da9602f/src/underscore.py#L251-L254
def reject(self, func): """ Return all the elements for which a truth test fails. """ return self._wrap(list(filter(lambda val: not func(val), self.obj)))
[ "def", "reject", "(", "self", ",", "func", ")", ":", "return", "self", ".", "_wrap", "(", "list", "(", "filter", "(", "lambda", "val", ":", "not", "func", "(", "val", ")", ",", "self", ".", "obj", ")", ")", ")" ]
Return all the elements for which a truth test fails.
[ "Return", "all", "the", "elements", "for", "which", "a", "truth", "test", "fails", "." ]
python
train
43.75
spacetelescope/stsci.tools
lib/stsci/tools/configobj.py
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/configobj.py#L952-L993
def as_bool(self, key): """ Accepts a key as input. The corresponding value must be a string or the objects (``True`` or 1) or (``False`` or 0). We allow 0 and 1 to retain compatibility with Python 2.2. If the string is one of ``True``, ``On``, ``Yes``, or ``1`` it returns ...
[ "def", "as_bool", "(", "self", ",", "key", ")", ":", "val", "=", "self", "[", "key", "]", "if", "val", "==", "True", ":", "return", "True", "elif", "val", "==", "False", ":", "return", "False", "else", ":", "try", ":", "if", "not", "isinstance", ...
Accepts a key as input. The corresponding value must be a string or the objects (``True`` or 1) or (``False`` or 0). We allow 0 and 1 to retain compatibility with Python 2.2. If the string is one of ``True``, ``On``, ``Yes``, or ``1`` it returns ``True``. If the string is one ...
[ "Accepts", "a", "key", "as", "input", ".", "The", "corresponding", "value", "must", "be", "a", "string", "or", "the", "objects", "(", "True", "or", "1", ")", "or", "(", "False", "or", "0", ")", ".", "We", "allow", "0", "and", "1", "to", "retain", ...
python
train
31.238095
juju/charm-helpers
charmhelpers/core/host.py
https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/core/host.py#L689-L721
def restart_on_change(restart_map, stopstart=False, restart_functions=None): """Restart services based on configuration files changing This function is used a decorator, for example:: @restart_on_change({ '/etc/ceph/ceph.conf': [ 'cinder-api', 'cinder-volume' ] '/etc/apache/sit...
[ "def", "restart_on_change", "(", "restart_map", ",", "stopstart", "=", "False", ",", "restart_functions", "=", "None", ")", ":", "def", "wrap", "(", "f", ")", ":", "@", "functools", ".", "wraps", "(", "f", ")", "def", "wrapped_f", "(", "*", "args", ","...
Restart services based on configuration files changing This function is used a decorator, for example:: @restart_on_change({ '/etc/ceph/ceph.conf': [ 'cinder-api', 'cinder-volume' ] '/etc/apache/sites-enabled/*': [ 'apache2' ] }) def config_changed(): ...
[ "Restart", "services", "based", "on", "configuration", "files", "changing" ]
python
train
41.151515
oasis-open/cti-stix-validator
stix2validator/v20/musts.py
https://github.com/oasis-open/cti-stix-validator/blob/a607014e3fa500a7678f8b61b278456ca581f9d0/stix2validator/v20/musts.py#L244-L265
def artifact_mime_type(instance): """Ensure the 'mime_type' property of artifact objects comes from the Template column in the IANA media type registry. """ for key, obj in instance['objects'].items(): if ('type' in obj and obj['type'] == 'artifact' and 'mime_type' in obj): if enums....
[ "def", "artifact_mime_type", "(", "instance", ")", ":", "for", "key", ",", "obj", "in", "instance", "[", "'objects'", "]", ".", "items", "(", ")", ":", "if", "(", "'type'", "in", "obj", "and", "obj", "[", "'type'", "]", "==", "'artifact'", "and", "'m...
Ensure the 'mime_type' property of artifact objects comes from the Template column in the IANA media type registry.
[ "Ensure", "the", "mime_type", "property", "of", "artifact", "objects", "comes", "from", "the", "Template", "column", "in", "the", "IANA", "media", "type", "registry", "." ]
python
train
59.090909
persephone-tools/persephone
persephone/model.py
https://github.com/persephone-tools/persephone/blob/f94c63e4d5fe719fb1deba449b177bb299d225fb/persephone/model.py#L36-L46
def dense_to_human_readable(dense_repr: Sequence[Sequence[int]], index_to_label: Dict[int, str]) -> List[List[str]]: """ Converts a dense representation of model decoded output into human readable, using a mapping from indices to labels. """ transcripts = [] for dense_r in dense_repr: non_empty...
[ "def", "dense_to_human_readable", "(", "dense_repr", ":", "Sequence", "[", "Sequence", "[", "int", "]", "]", ",", "index_to_label", ":", "Dict", "[", "int", ",", "str", "]", ")", "->", "List", "[", "List", "[", "str", "]", "]", ":", "transcripts", "=",...
Converts a dense representation of model decoded output into human readable, using a mapping from indices to labels.
[ "Converts", "a", "dense", "representation", "of", "model", "decoded", "output", "into", "human", "readable", "using", "a", "mapping", "from", "indices", "to", "labels", "." ]
python
train
45.818182
KE-works/pykechain
pykechain/models/part.py
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/part.py#L398-L410
def add_property(self, *args, **kwargs): # type: (*Any, **Any) -> Property """Add a new property to this model. See :class:`pykechain.Client.create_property` for available parameters. :return: :class:`Property` :raises APIError: in case an Error occurs """ if se...
[ "def", "add_property", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# type: (*Any, **Any) -> Property", "if", "self", ".", "category", "!=", "Category", ".", "MODEL", ":", "raise", "APIError", "(", "\"Part should be of category MODEL\"", ")...
Add a new property to this model. See :class:`pykechain.Client.create_property` for available parameters. :return: :class:`Property` :raises APIError: in case an Error occurs
[ "Add", "a", "new", "property", "to", "this", "model", "." ]
python
train
36.076923
gitpython-developers/GitPython
git/index/fun.py
https://github.com/gitpython-developers/GitPython/blob/1f66e25c25cde2423917ee18c4704fff83b837d1/git/index/fun.py#L111-L156
def write_cache(entries, stream, extension_data=None, ShaStreamCls=IndexFileSHA1Writer): """Write the cache represented by entries to a stream :param entries: **sorted** list of entries :param stream: stream to wrap into the AdapterStreamCls - it is used for final output. :param ShaStreamCls: ...
[ "def", "write_cache", "(", "entries", ",", "stream", ",", "extension_data", "=", "None", ",", "ShaStreamCls", "=", "IndexFileSHA1Writer", ")", ":", "# wrap the stream into a compatible writer", "stream", "=", "ShaStreamCls", "(", "stream", ")", "tell", "=", "stream"...
Write the cache represented by entries to a stream :param entries: **sorted** list of entries :param stream: stream to wrap into the AdapterStreamCls - it is used for final output. :param ShaStreamCls: Type to use when writing to the stream. It produces a sha while writing to it, before th...
[ "Write", "the", "cache", "represented", "by", "entries", "to", "a", "stream" ]
python
train
37.065217
emilydolson/avida-spatial-tools
avidaspatial/utils.py
https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/utils.py#L288-L301
def n_tasks(dec_num): """ Takes a decimal number as input and returns the number of ones in the binary representation. This translates to the number of tasks being done by an organism with a phenotype represented as a decimal number. """ bitstring = "" try: bitstring = dec_num[2:...
[ "def", "n_tasks", "(", "dec_num", ")", ":", "bitstring", "=", "\"\"", "try", ":", "bitstring", "=", "dec_num", "[", "2", ":", "]", "except", ":", "bitstring", "=", "bin", "(", "int", "(", "dec_num", ")", ")", "[", "2", ":", "]", "# cut off 0b", "# ...
Takes a decimal number as input and returns the number of ones in the binary representation. This translates to the number of tasks being done by an organism with a phenotype represented as a decimal number.
[ "Takes", "a", "decimal", "number", "as", "input", "and", "returns", "the", "number", "of", "ones", "in", "the", "binary", "representation", ".", "This", "translates", "to", "the", "number", "of", "tasks", "being", "done", "by", "an", "organism", "with", "a...
python
train
32.071429
sentinel-hub/eo-learn
coregistration/eolearn/coregistration/coregistration.py
https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/coregistration/eolearn/coregistration/coregistration.py#L321-L365
def register(self, src, trg, trg_mask=None, src_mask=None): """ Implementation of pair-wise registration and warping using point-based matching This function estimates a number of transforms (Euler, PartialAffine and Homography) using point-based matching. Features descriptor are first extracte...
[ "def", "register", "(", "self", ",", "src", ",", "trg", ",", "trg_mask", "=", "None", ",", "src_mask", "=", "None", ")", ":", "# Initialise matrix and failed registrations flag", "warp_matrix", "=", "None", "# Initiate point detector", "ptdt", "=", "cv2", ".", "...
Implementation of pair-wise registration and warping using point-based matching This function estimates a number of transforms (Euler, PartialAffine and Homography) using point-based matching. Features descriptor are first extracted from the pair of images using either SIFT or SURF descriptors. A ...
[ "Implementation", "of", "pair", "-", "wise", "registration", "and", "warping", "using", "point", "-", "based", "matching" ]
python
train
65.311111
macbre/sql-metadata
sql_metadata.py
https://github.com/macbre/sql-metadata/blob/4b7b4ae0a961d568075aefe78535cf5aee74583c/sql_metadata.py#L131-L193
def get_query_tables(query): """ :type query str :rtype: list[str] """ tables = [] last_keyword = None last_token = None table_syntax_keywords = [ # SELECT queries 'FROM', 'WHERE', 'JOIN', 'INNER JOIN', 'LEFT JOIN', 'RIGHT JOIN', 'ON', # INSERT queries 'I...
[ "def", "get_query_tables", "(", "query", ")", ":", "tables", "=", "[", "]", "last_keyword", "=", "None", "last_token", "=", "None", "table_syntax_keywords", "=", "[", "# SELECT queries", "'FROM'", ",", "'WHERE'", ",", "'JOIN'", ",", "'INNER JOIN'", ",", "'LEFT...
:type query str :rtype: list[str]
[ ":", "type", "query", "str", ":", "rtype", ":", "list", "[", "str", "]" ]
python
train
41.904762
pantsbuild/pants
src/python/pants/backend/jvm/tasks/jvm_binary_task.py
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/backend/jvm/tasks/jvm_binary_task.py#L34-L41
def add_main_manifest_entry(jar, binary): """Creates a jar manifest for the given binary. If the binary declares a main then a 'Main-Class' manifest entry will be included. """ main = binary.main if main is not None: jar.main(main)
[ "def", "add_main_manifest_entry", "(", "jar", ",", "binary", ")", ":", "main", "=", "binary", ".", "main", "if", "main", "is", "not", "None", ":", "jar", ".", "main", "(", "main", ")" ]
Creates a jar manifest for the given binary. If the binary declares a main then a 'Main-Class' manifest entry will be included.
[ "Creates", "a", "jar", "manifest", "for", "the", "given", "binary", "." ]
python
train
31.375
Azure/azure-cosmos-python
azure/cosmos/execution_context/document_producer.py
https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/execution_context/document_producer.py#L76-L88
def next(self): """ :return: The next result item. :rtype: dict :raises StopIteration: If there is no more result. """ if self._cur_item is not None: res = self._cur_item self._cur_item = None return res r...
[ "def", "next", "(", "self", ")", ":", "if", "self", ".", "_cur_item", "is", "not", "None", ":", "res", "=", "self", ".", "_cur_item", "self", ".", "_cur_item", "=", "None", "return", "res", "return", "next", "(", "self", ".", "_ex_context", ")" ]
:return: The next result item. :rtype: dict :raises StopIteration: If there is no more result.
[ ":", "return", ":", "The", "next", "result", "item", ".", ":", "rtype", ":", "dict", ":", "raises", "StopIteration", ":", "If", "there", "is", "no", "more", "result", "." ]
python
train
25.846154
dj-stripe/dj-stripe
djstripe/models/billing.py
https://github.com/dj-stripe/dj-stripe/blob/a5308a3808cd6e2baba49482f7a699f3a8992518/djstripe/models/billing.py#L993-L1054
def update( self, plan=None, application_fee_percent=None, billing_cycle_anchor=None, coupon=None, prorate=djstripe_settings.PRORATION_POLICY, proration_date=None, metadata=None, quantity=None, tax_percent=None, trial_end=None, ): """ See `Customer.subscribe() <#djstripe.models.Customer.subsc...
[ "def", "update", "(", "self", ",", "plan", "=", "None", ",", "application_fee_percent", "=", "None", ",", "billing_cycle_anchor", "=", "None", ",", "coupon", "=", "None", ",", "prorate", "=", "djstripe_settings", ".", "PRORATION_POLICY", ",", "proration_date", ...
See `Customer.subscribe() <#djstripe.models.Customer.subscribe>`__ :param plan: The plan to which to subscribe the customer. :type plan: Plan or string (plan ID) :param application_fee_percent: :type application_fee_percent: :param billing_cycle_anchor: :type billing_cycle_anchor: :param coupon: :type ...
[ "See", "Customer", ".", "subscribe", "()", "<#djstripe", ".", "models", ".", "Customer", ".", "subscribe", ">", "__" ]
python
train
29.919355
merll/docker-fabric
dockerfabric/actions.py
https://github.com/merll/docker-fabric/blob/785d84e40e17265b667d8b11a6e30d8e6b2bf8d4/dockerfabric/actions.py#L172-L195
def single_cmd(container, command, fail_nonzero=False, download_result=None, **kwargs): """ Runs a script inside a container, which is created with all its dependencies. The container is removed after it has been run, whereas the dependencies are not destroyed. The output is printed to the console. :pa...
[ "def", "single_cmd", "(", "container", ",", "command", ",", "fail_nonzero", "=", "False", ",", "download_result", "=", "None", ",", "*", "*", "kwargs", ")", ":", "with", "temp_dir", "(", ")", "as", "remote_tmp", ":", "kwargs", ".", "setdefault", "(", "'c...
Runs a script inside a container, which is created with all its dependencies. The container is removed after it has been run, whereas the dependencies are not destroyed. The output is printed to the console. :param container: Container configuration name. :param command: Command line to run. :param fai...
[ "Runs", "a", "script", "inside", "a", "container", "which", "is", "created", "with", "all", "its", "dependencies", ".", "The", "container", "is", "removed", "after", "it", "has", "been", "run", "whereas", "the", "dependencies", "are", "not", "destroyed", "."...
python
train
52.791667