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
ihmeuw/vivarium
src/vivarium/framework/values.py
https://github.com/ihmeuw/vivarium/blob/c5f5d50f775c8bf337d3aae1ff7c57c025a8e258/src/vivarium/framework/values.py#L183-L211
def register_value_producer(self, value_name: str, source: Callable[..., pd.DataFrame]=None, preferred_combiner: Callable=replace_combiner, preferred_post_processor: Callable[..., pd.DataFrame]=None) -> Pipeline: """Marks a ``Callable`` as the prod...
[ "def", "register_value_producer", "(", "self", ",", "value_name", ":", "str", ",", "source", ":", "Callable", "[", "...", ",", "pd", ".", "DataFrame", "]", "=", "None", ",", "preferred_combiner", ":", "Callable", "=", "replace_combiner", ",", "preferred_post_p...
Marks a ``Callable`` as the producer of a named value. Parameters ---------- value_name : The name of the new dynamic value pipeline. source : A callable source for the dynamic value pipeline. preferred_combiner : A strategy for combining the ...
[ "Marks", "a", "Callable", "as", "the", "producer", "of", "a", "named", "value", "." ]
python
train
56.275862
jorgeecardona/dynect
dynect/__init__.py
https://github.com/jorgeecardona/dynect/blob/d2cd85bc510f00108a3a5bfe515f45daae15a482/dynect/__init__.py#L264-L275
def list_address(self, domain): " Get the list of addresses of a single domain." try: response = self.get('/REST/ARecord/%s/%s' % ( self.zone, domain)) except self.NotFoundError: return [] # Return a generator with the addresses. addresse...
[ "def", "list_address", "(", "self", ",", "domain", ")", ":", "try", ":", "response", "=", "self", ".", "get", "(", "'/REST/ARecord/%s/%s'", "%", "(", "self", ".", "zone", ",", "domain", ")", ")", "except", "self", ".", "NotFoundError", ":", "return", "...
Get the list of addresses of a single domain.
[ "Get", "the", "list", "of", "addresses", "of", "a", "single", "domain", "." ]
python
train
33.583333
koalalorenzo/python-digitalocean
digitalocean/Manager.py
https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L214-L221
def get_all_tags(self): """ This method returns a list of all tags. """ data = self.get_data("tags") return [ Tag(token=self.token, **tag) for tag in data['tags'] ]
[ "def", "get_all_tags", "(", "self", ")", ":", "data", "=", "self", ".", "get_data", "(", "\"tags\"", ")", "return", "[", "Tag", "(", "token", "=", "self", ".", "token", ",", "*", "*", "tag", ")", "for", "tag", "in", "data", "[", "'tags'", "]", "]...
This method returns a list of all tags.
[ "This", "method", "returns", "a", "list", "of", "all", "tags", "." ]
python
valid
27.625
jkitzes/macroeco
macroeco/compare/_compare.py
https://github.com/jkitzes/macroeco/blob/ee5fac5560a2d64de3a64738b5bc6833e2d7ff2e/macroeco/compare/_compare.py#L143-L221
def AIC(data, model, params=None, corrected=True): """ Akaike Information Criteria given data and a model Parameters ---------- {0} {1} params : int Number of parameters in the model. If None, calculated from model object. corrected : bool If True, calculates the...
[ "def", "AIC", "(", "data", ",", "model", ",", "params", "=", "None", ",", "corrected", "=", "True", ")", ":", "n", "=", "len", "(", "data", ")", "# Number of observations", "L", "=", "nll", "(", "data", ",", "model", ")", "if", "not", "params", ":"...
Akaike Information Criteria given data and a model Parameters ---------- {0} {1} params : int Number of parameters in the model. If None, calculated from model object. corrected : bool If True, calculates the small-sample size correct AICC. Default True. Returns ...
[ "Akaike", "Information", "Criteria", "given", "data", "and", "a", "model" ]
python
train
25.873418
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1768-L1770
def update_bgp_peer(self, bgp_peer_id, body=None): """Update a BGP peer.""" return self.put(self.bgp_peer_path % bgp_peer_id, body=body)
[ "def", "update_bgp_peer", "(", "self", ",", "bgp_peer_id", ",", "body", "=", "None", ")", ":", "return", "self", ".", "put", "(", "self", ".", "bgp_peer_path", "%", "bgp_peer_id", ",", "body", "=", "body", ")" ]
Update a BGP peer.
[ "Update", "a", "BGP", "peer", "." ]
python
train
50
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_fence.py
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_fence.py#L51-L55
def fenceloader(self): '''fence loader by sysid''' if not self.target_system in self.fenceloader_by_sysid: self.fenceloader_by_sysid[self.target_system] = mavwp.MAVFenceLoader() return self.fenceloader_by_sysid[self.target_system]
[ "def", "fenceloader", "(", "self", ")", ":", "if", "not", "self", ".", "target_system", "in", "self", ".", "fenceloader_by_sysid", ":", "self", ".", "fenceloader_by_sysid", "[", "self", ".", "target_system", "]", "=", "mavwp", ".", "MAVFenceLoader", "(", ")"...
fence loader by sysid
[ "fence", "loader", "by", "sysid" ]
python
train
52.4
rfarley3/Kibana
kibana/mapping.py
https://github.com/rfarley3/Kibana/blob/3df1e13be18edfb39ec173d8d2bbe9e90be61022/kibana/mapping.py#L356-L400
def compare_field_caches(self, replica, original): """Verify original is subset of replica""" if original is None: original = [] if replica is None: replica = [] self.pr_dbg("Comparing orig with %s fields to replica with %s fields" % (len(origi...
[ "def", "compare_field_caches", "(", "self", ",", "replica", ",", "original", ")", ":", "if", "original", "is", "None", ":", "original", "=", "[", "]", "if", "replica", "is", "None", ":", "replica", "=", "[", "]", "self", ".", "pr_dbg", "(", "\"Comparin...
Verify original is subset of replica
[ "Verify", "original", "is", "subset", "of", "replica" ]
python
train
44.022222
gem/oq-engine
openquake/hazardlib/gsim/campbell_2003.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/campbell_2003.py#L126-L133
def _compute_term2(self, C, mag, rrup): """ This computes the term f2 in equation 32, page 1021 """ c78_factor = (C['c7'] * np.exp(C['c8'] * mag)) ** 2 R = np.sqrt(rrup ** 2 + c78_factor) return C['c4'] * np.log(R) + (C['c5'] + C['c6'] * mag) * rrup
[ "def", "_compute_term2", "(", "self", ",", "C", ",", "mag", ",", "rrup", ")", ":", "c78_factor", "=", "(", "C", "[", "'c7'", "]", "*", "np", ".", "exp", "(", "C", "[", "'c8'", "]", "*", "mag", ")", ")", "**", "2", "R", "=", "np", ".", "sqrt...
This computes the term f2 in equation 32, page 1021
[ "This", "computes", "the", "term", "f2", "in", "equation", "32", "page", "1021" ]
python
train
36.375
ARMmbed/icetea
icetea_lib/ResourceProvider/ResourceConfig.py
https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/ResourceProvider/ResourceConfig.py#L160-L190
def _solve_location(self, req, dut_req_len, idx): """ Helper function for resolving the location for a resource. :param req: Requirements dictionary :param dut_req_len: Amount of required resources :param idx: index, integer :return: Nothing, modifies req object ...
[ "def", "_solve_location", "(", "self", ",", "req", ",", "dut_req_len", ",", "idx", ")", ":", "if", "not", "req", ".", "get", "(", "\"location\"", ")", ":", "return", "if", "len", "(", "req", ".", "get", "(", "\"location\"", ")", ")", "==", "2", ":"...
Helper function for resolving the location for a resource. :param req: Requirements dictionary :param dut_req_len: Amount of required resources :param idx: index, integer :return: Nothing, modifies req object
[ "Helper", "function", "for", "resolving", "the", "location", "for", "a", "resource", "." ]
python
train
44.451613
planetlabs/planet-client-python
planet/api/client.py
https://github.com/planetlabs/planet-client-python/blob/1c62ce7d416819951dddee0c22068fef6d40b027/planet/api/client.py#L312-L321
def get_quad_by_id(self, mosaic, quad_id): '''Get a quad response for a specific mosaic and quad. :param mosaic dict: A mosaic representation from the API :param quad_id str: A quad id (typically <xcoord>-<ycoord>) :returns: :py:Class:`planet.api.models.JSON` :raises planet.api....
[ "def", "get_quad_by_id", "(", "self", ",", "mosaic", ",", "quad_id", ")", ":", "path", "=", "'basemaps/v1/mosaics/{}/quads/{}'", ".", "format", "(", "mosaic", "[", "'id'", "]", ",", "quad_id", ")", "return", "self", ".", "_get", "(", "self", ".", "_url", ...
Get a quad response for a specific mosaic and quad. :param mosaic dict: A mosaic representation from the API :param quad_id str: A quad id (typically <xcoord>-<ycoord>) :returns: :py:Class:`planet.api.models.JSON` :raises planet.api.exceptions.APIException: On API error.
[ "Get", "a", "quad", "response", "for", "a", "specific", "mosaic", "and", "quad", "." ]
python
train
49.3
sci-bots/dmf-device-ui
dmf_device_ui/view.py
https://github.com/sci-bots/dmf-device-ui/blob/05b480683c9fa43f91ce5a58de2fa90cdf363fc8/dmf_device_ui/view.py#L139-L171
def register_shortcuts(self): ''' .. versionchanged:: 0.14 Add keyboard shortcuts to set neighbouring electrode states based on directional input using ``<Control>`` key plus the corresponding direction (e.g., ``<Control>Up``) ''' def control_protocol(...
[ "def", "register_shortcuts", "(", "self", ")", ":", "def", "control_protocol", "(", "command", ")", ":", "if", "self", ".", "plugin", "is", "not", "None", ":", "self", ".", "plugin", ".", "execute_async", "(", "'microdrop.gui.protocol_controller'", ",", "comma...
.. versionchanged:: 0.14 Add keyboard shortcuts to set neighbouring electrode states based on directional input using ``<Control>`` key plus the corresponding direction (e.g., ``<Control>Up``)
[ "..", "versionchanged", "::", "0", ".", "14", "Add", "keyboard", "shortcuts", "to", "set", "neighbouring", "electrode", "states", "based", "on", "directional", "input", "using", "<Control", ">", "key", "plus", "the", "corresponding", "direction", "(", "e", "."...
python
train
53.272727
portfoliome/postpy
postpy/sql.py
https://github.com/portfoliome/postpy/blob/fe26199131b15295fc5f669a0ad2a7f47bf490ee/postpy/sql.py#L91-L105
def query_columns(conn, query, name=None): """Lightweight query to retrieve column list of select query. Notes ----- Strongly urged to specify a cursor name for performance. """ with conn.cursor(name) as cursor: cursor.itersize = 1 cursor.execute(query) cursor.fetchmany...
[ "def", "query_columns", "(", "conn", ",", "query", ",", "name", "=", "None", ")", ":", "with", "conn", ".", "cursor", "(", "name", ")", "as", "cursor", ":", "cursor", ".", "itersize", "=", "1", "cursor", ".", "execute", "(", "query", ")", "cursor", ...
Lightweight query to retrieve column list of select query. Notes ----- Strongly urged to specify a cursor name for performance.
[ "Lightweight", "query", "to", "retrieve", "column", "list", "of", "select", "query", "." ]
python
train
26.933333
shmuelamar/cbox
cbox/utils.py
https://github.com/shmuelamar/cbox/blob/2d0cda5b3f61a55e530251430bf3d460dcd3732e/cbox/utils.py#L7-L16
def error2str(e): """returns the formatted stacktrace of the exception `e`. :param BaseException e: an exception to format into str :rtype: str """ out = StringIO() traceback.print_exception(None, e, e.__traceback__, file=out) out.seek(0) return out.read()
[ "def", "error2str", "(", "e", ")", ":", "out", "=", "StringIO", "(", ")", "traceback", ".", "print_exception", "(", "None", ",", "e", ",", "e", ".", "__traceback__", ",", "file", "=", "out", ")", "out", ".", "seek", "(", "0", ")", "return", "out", ...
returns the formatted stacktrace of the exception `e`. :param BaseException e: an exception to format into str :rtype: str
[ "returns", "the", "formatted", "stacktrace", "of", "the", "exception", "e", "." ]
python
train
28
paramono/duration
duration/__init__.py
https://github.com/paramono/duration/blob/e0ef5bfa0eba4d9ea031695bb0e9a9fa4fa24d9a/duration/__init__.py#L139-L169
def to_seconds(value, strict=True, force_int=True): """ converts duration value to integer seconds strict=True (by default) raises StrictnessError if either hours, minutes or seconds in duration value exceed allowed values """ if isinstance(value, int): return value # assuming it's sec...
[ "def", "to_seconds", "(", "value", ",", "strict", "=", "True", ",", "force_int", "=", "True", ")", ":", "if", "isinstance", "(", "value", ",", "int", ")", ":", "return", "value", "# assuming it's seconds", "elif", "isinstance", "(", "value", ",", "timedelt...
converts duration value to integer seconds strict=True (by default) raises StrictnessError if either hours, minutes or seconds in duration value exceed allowed values
[ "converts", "duration", "value", "to", "integer", "seconds" ]
python
train
31.774194
inveniosoftware/invenio-oauthclient
invenio_oauthclient/views/client.py
https://github.com/inveniosoftware/invenio-oauthclient/blob/2500dc6935738107617aeade79e050d7608004bb/invenio_oauthclient/views/client.py#L43-L61
def post_ext_init(state): """Setup blueprint.""" app = state.app app.config.setdefault( 'OAUTHCLIENT_SITENAME', app.config.get('THEME_SITENAME', 'Invenio')) app.config.setdefault( 'OAUTHCLIENT_BASE_TEMPLATE', app.config.get('BASE_TEMPLATE', 'inveni...
[ "def", "post_ext_init", "(", "state", ")", ":", "app", "=", "state", ".", "app", "app", ".", "config", ".", "setdefault", "(", "'OAUTHCLIENT_SITENAME'", ",", "app", ".", "config", ".", "get", "(", "'THEME_SITENAME'", ",", "'Invenio'", ")", ")", "app", "....
Setup blueprint.
[ "Setup", "blueprint", "." ]
python
train
35.526316
jazzband/django-analytical
analytical/templatetags/google_analytics.py
https://github.com/jazzband/django-analytical/blob/5487fd677bd47bc63fc2cf39597a0adc5d6c9ab3/analytical/templatetags/google_analytics.py#L68-L79
def google_analytics(parser, token): """ Google Analytics tracking template tag. Renders Javascript code to track page visits. You must supply your website property ID (as a string) in the ``GOOGLE_ANALYTICS_PROPERTY_ID`` setting. """ bits = token.split_contents() if len(bits) > 1: ...
[ "def", "google_analytics", "(", "parser", ",", "token", ")", ":", "bits", "=", "token", ".", "split_contents", "(", ")", "if", "len", "(", "bits", ")", ">", "1", ":", "raise", "TemplateSyntaxError", "(", "\"'%s' takes no arguments\"", "%", "bits", "[", "0"...
Google Analytics tracking template tag. Renders Javascript code to track page visits. You must supply your website property ID (as a string) in the ``GOOGLE_ANALYTICS_PROPERTY_ID`` setting.
[ "Google", "Analytics", "tracking", "template", "tag", "." ]
python
valid
34.083333
chrisrink10/basilisp
src/basilisp/lang/reader.py
https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/reader.py#L665-L708
def _read_function(ctx: ReaderContext) -> llist.List: """Read a function reader macro from the input stream.""" if ctx.is_in_anon_fn: raise SyntaxError(f"Nested #() definitions not allowed") with ctx.in_anon_fn(): form = _read_list(ctx) arg_set = set() def arg_suffix(arg_num): ...
[ "def", "_read_function", "(", "ctx", ":", "ReaderContext", ")", "->", "llist", ".", "List", ":", "if", "ctx", ".", "is_in_anon_fn", ":", "raise", "SyntaxError", "(", "f\"Nested #() definitions not allowed\"", ")", "with", "ctx", ".", "in_anon_fn", "(", ")", ":...
Read a function reader macro from the input stream.
[ "Read", "a", "function", "reader", "macro", "from", "the", "input", "stream", "." ]
python
test
33.068182
FSX/misaka
misaka/api.py
https://github.com/FSX/misaka/blob/c13aff82d370d606ff61361db79c166a897641cf/misaka/api.py#L128-L156
def smartypants(text): """ Transforms sequences of characters into HTML entities. =================================== ===================== ========= Markdown HTML Result =================================== ===================== ========= ``'s``...
[ "def", "smartypants", "(", "text", ")", ":", "byte_str", "=", "text", ".", "encode", "(", "'utf-8'", ")", "ob", "=", "lib", ".", "hoedown_buffer_new", "(", "OUNIT", ")", "lib", ".", "hoedown_html_smartypants", "(", "ob", ",", "byte_str", ",", "len", "(",...
Transforms sequences of characters into HTML entities. =================================== ===================== ========= Markdown HTML Result =================================== ===================== ========= ``'s`` (s, t, m, d, re, ll, ve) &rsq...
[ "Transforms", "sequences", "of", "characters", "into", "HTML", "entities", "." ]
python
train
47.896552
mitsei/dlkit
dlkit/records/repository/basic/media_accessibility.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/repository/basic/media_accessibility.py#L85-L97
def add_alt_text(self, alt_text): """Adds an alt_text. arg: alt_text (displayText): the new alt_text raise: InvalidArgument - ``alt_text`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``alt_text`` is ``null`` *compliance:...
[ "def", "add_alt_text", "(", "self", ",", "alt_text", ")", ":", "if", "self", ".", "get_alt_texts_metadata", "(", ")", ".", "is_read_only", "(", ")", ":", "raise", "NoAccess", "(", ")", "self", ".", "add_or_replace_value", "(", "'altTexts'", ",", "alt_text", ...
Adds an alt_text. arg: alt_text (displayText): the new alt_text raise: InvalidArgument - ``alt_text`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``alt_text`` is ``null`` *compliance: mandatory -- This method must be implemented...
[ "Adds", "an", "alt_text", "." ]
python
train
39.230769
theno/utlz
utlz/__init__.py
https://github.com/theno/utlz/blob/bf7d2b53f3e0d35c6f8ded81f3f774a74fcd3389/utlz/__init__.py#L468-L481
def text_with_newlines(text, line_length=78, newline='\n'): '''Return text with a `newline` inserted after each `line_length` char. Return `text` unchanged if line_length == 0. ''' if line_length > 0: if len(text) <= line_length: return text else: return newline....
[ "def", "text_with_newlines", "(", "text", ",", "line_length", "=", "78", ",", "newline", "=", "'\\n'", ")", ":", "if", "line_length", ">", "0", ":", "if", "len", "(", "text", ")", "<=", "line_length", ":", "return", "text", "else", ":", "return", "newl...
Return text with a `newline` inserted after each `line_length` char. Return `text` unchanged if line_length == 0.
[ "Return", "text", "with", "a", "newline", "inserted", "after", "each", "line_length", "char", "." ]
python
train
34.285714
adamheins/r12
r12/shell.py
https://github.com/adamheins/r12/blob/ff78178332140930bf46a94a0b15ee082bb92491/r12/shell.py#L191-L201
def do_connect(self, arg): ''' Connect to the arm. ''' if self.arm.is_connected(): print(self.style.error('Error: ', 'Arm is already connected.')) else: try: port = self.arm.connect() print(self.style.success('Success: ', ...
[ "def", "do_connect", "(", "self", ",", "arg", ")", ":", "if", "self", ".", "arm", ".", "is_connected", "(", ")", ":", "print", "(", "self", ".", "style", ".", "error", "(", "'Error: '", ",", "'Arm is already connected.'", ")", ")", "else", ":", "try", ...
Connect to the arm.
[ "Connect", "to", "the", "arm", "." ]
python
train
42.818182
ShenggaoZhu/midict
midict/__init__.py
https://github.com/ShenggaoZhu/midict/blob/2fad2edcfb753035b443a70fe15852affae1b5bb/midict/__init__.py#L1412-L1444
def update(self, *args, **kw): ''' Update the dictionary with items and names:: (items, names, **kw) (dict, names, **kw) (MIDict, names, **kw) Optional positional argument ``names`` is only allowed when ``self.indices`` is empty (no indices are set y...
[ "def", "update", "(", "self", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "if", "len", "(", "args", ")", ">", "1", "and", "self", ".", "indices", ":", "raise", "ValueError", "(", "'Only one positional argument is allowed when the'", "'index names are al...
Update the dictionary with items and names:: (items, names, **kw) (dict, names, **kw) (MIDict, names, **kw) Optional positional argument ``names`` is only allowed when ``self.indices`` is empty (no indices are set yet).
[ "Update", "the", "dictionary", "with", "items", "and", "names", "::" ]
python
train
32.515152
saltstack/salt
salt/modules/redismod.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L495-L506
def key_type(key, host=None, port=None, db=None, password=None): ''' Get redis key type CLI Example: .. code-block:: bash salt '*' redis.type foo ''' server = _connect(host, port, db, password) return server.type(key)
[ "def", "key_type", "(", "key", ",", "host", "=", "None", ",", "port", "=", "None", ",", "db", "=", "None", ",", "password", "=", "None", ")", ":", "server", "=", "_connect", "(", "host", ",", "port", ",", "db", ",", "password", ")", "return", "se...
Get redis key type CLI Example: .. code-block:: bash salt '*' redis.type foo
[ "Get", "redis", "key", "type" ]
python
train
20.416667
pantsbuild/pants
src/python/pants/backend/native/tasks/conan_fetch.py
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/backend/native/tasks/conan_fetch.py#L71-L120
def _conan_user_home(self, conan, in_workdir=False): """Create the CONAN_USER_HOME for this task fingerprint and initialize the Conan remotes. See https://docs.conan.io/en/latest/reference/commands/consumer/config.html#conan-config-install for docs on configuring remotes. """ # This argument is exp...
[ "def", "_conan_user_home", "(", "self", ",", "conan", ",", "in_workdir", "=", "False", ")", ":", "# This argument is exposed so tests don't leak out of the workdir.", "if", "in_workdir", ":", "base_cache_dir", "=", "self", ".", "workdir", "else", ":", "base_cache_dir", ...
Create the CONAN_USER_HOME for this task fingerprint and initialize the Conan remotes. See https://docs.conan.io/en/latest/reference/commands/consumer/config.html#conan-config-install for docs on configuring remotes.
[ "Create", "the", "CONAN_USER_HOME", "for", "this", "task", "fingerprint", "and", "initialize", "the", "Conan", "remotes", "." ]
python
train
55.54
jtwhite79/pyemu
pyemu/la.py
https://github.com/jtwhite79/pyemu/blob/c504d8e7a4097cec07655a6318d275739bd8148a/pyemu/la.py#L813-L835
def prior_prediction(self): """get a dict of prior prediction variances Returns ------- prior_prediction : dict dictionary of prediction name, prior variance pairs """ if self.__prior_prediction is not None: return self.__prior_prediction ...
[ "def", "prior_prediction", "(", "self", ")", ":", "if", "self", ".", "__prior_prediction", "is", "not", "None", ":", "return", "self", ".", "__prior_prediction", "else", ":", "if", "self", ".", "predictions", "is", "not", "None", ":", "self", ".", "log", ...
get a dict of prior prediction variances Returns ------- prior_prediction : dict dictionary of prediction name, prior variance pairs
[ "get", "a", "dict", "of", "prior", "prediction", "variances" ]
python
train
38.434783
gwastro/pycbc
pycbc/events/coinc.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/events/coinc.py#L865-L869
def ifar(self, coinc_stat): """Return the far that would be associated with the coincident given. """ n = self.coincs.num_greater(coinc_stat) return self.background_time / lal.YRJUL_SI / (n + 1)
[ "def", "ifar", "(", "self", ",", "coinc_stat", ")", ":", "n", "=", "self", ".", "coincs", ".", "num_greater", "(", "coinc_stat", ")", "return", "self", ".", "background_time", "/", "lal", ".", "YRJUL_SI", "/", "(", "n", "+", "1", ")" ]
Return the far that would be associated with the coincident given.
[ "Return", "the", "far", "that", "would", "be", "associated", "with", "the", "coincident", "given", "." ]
python
train
44.4
python-diamond/Diamond
src/collectors/filestat/filestat.py
https://github.com/python-diamond/Diamond/blob/0f3eb04327d6d3ed5e53a9967d6c9d2c09714a47/src/collectors/filestat/filestat.py#L202-L229
def get_typelist(self): """ This collects all avaliable types and applies include/exclude filters """ typelist = [] # convert type list into arrays if strings if isinstance(self.config['type_include'], basestring): self.config['type_include'] = self.config['t...
[ "def", "get_typelist", "(", "self", ")", ":", "typelist", "=", "[", "]", "# convert type list into arrays if strings", "if", "isinstance", "(", "self", ".", "config", "[", "'type_include'", "]", ",", "basestring", ")", ":", "self", ".", "config", "[", "'type_i...
This collects all avaliable types and applies include/exclude filters
[ "This", "collects", "all", "avaliable", "types", "and", "applies", "include", "/", "exclude", "filters" ]
python
train
39.107143
gwastro/pycbc
pycbc/workflow/pegasus_workflow.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/workflow/pegasus_workflow.py#L231-L241
def add_profile(self, namespace, key, value, force=False): """ Add profile information to this node at the DAX level """ try: entry = dax.Profile(namespace, key, value) self._dax_node.addProfile(entry) except dax.DuplicateError: if force: ...
[ "def", "add_profile", "(", "self", ",", "namespace", ",", "key", ",", "value", ",", "force", "=", "False", ")", ":", "try", ":", "entry", "=", "dax", ".", "Profile", "(", "namespace", ",", "key", ",", "value", ")", "self", ".", "_dax_node", ".", "a...
Add profile information to this node at the DAX level
[ "Add", "profile", "information", "to", "this", "node", "at", "the", "DAX", "level" ]
python
train
40
BerkeleyAutomation/autolab_core
autolab_core/transformations.py
https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/transformations.py#L1681-L1705
def _import_module(module_name, warn=True, prefix='_py_', ignore='_'): """Try import all public attributes from module into global namespace. Existing attributes with name clashes are renamed with prefix. Attributes starting with underscore are ignored by default. Return True on successful import. ...
[ "def", "_import_module", "(", "module_name", ",", "warn", "=", "True", ",", "prefix", "=", "'_py_'", ",", "ignore", "=", "'_'", ")", ":", "try", ":", "module", "=", "__import__", "(", "module_name", ")", "except", "ImportError", ":", "if", "warn", ":", ...
Try import all public attributes from module into global namespace. Existing attributes with name clashes are renamed with prefix. Attributes starting with underscore are ignored by default. Return True on successful import.
[ "Try", "import", "all", "public", "attributes", "from", "module", "into", "global", "namespace", "." ]
python
train
35
wtolson/gnsq
gnsq/nsqd.py
https://github.com/wtolson/gnsq/blob/0fd02578b2c9c5fa30626d78579db2a46c10edac/gnsq/nsqd.py#L704-L709
def multipublish_tcp(self, topic, messages, **kwargs): """Use :meth:`NsqdTCPClient.multipublish` instead. .. deprecated:: 1.0.0 """ return self.__tcp_client.multipublish(topic, messages, **kwargs)
[ "def", "multipublish_tcp", "(", "self", ",", "topic", ",", "messages", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "__tcp_client", ".", "multipublish", "(", "topic", ",", "messages", ",", "*", "*", "kwargs", ")" ]
Use :meth:`NsqdTCPClient.multipublish` instead. .. deprecated:: 1.0.0
[ "Use", ":", "meth", ":", "NsqdTCPClient", ".", "multipublish", "instead", "." ]
python
train
37.333333
davenquinn/Attitude
attitude/orientation/pca.py
https://github.com/davenquinn/Attitude/blob/2ce97b9aba0aa5deedc6617c2315e07e6396d240/attitude/orientation/pca.py#L288-L295
def angular_error(self, axis_length): """ The angular error for an in-plane axis of given length (either a PCA major axis or an intermediate direction). """ hyp_axes = self.method(self) return N.arctan2(hyp_axes[-1],axis_length)
[ "def", "angular_error", "(", "self", ",", "axis_length", ")", ":", "hyp_axes", "=", "self", ".", "method", "(", "self", ")", "return", "N", ".", "arctan2", "(", "hyp_axes", "[", "-", "1", "]", ",", "axis_length", ")" ]
The angular error for an in-plane axis of given length (either a PCA major axis or an intermediate direction).
[ "The", "angular", "error", "for", "an", "in", "-", "plane", "axis", "of", "given", "length", "(", "either", "a", "PCA", "major", "axis", "or", "an", "intermediate", "direction", ")", "." ]
python
train
34.625
moluwole/Bast
bast/controller.py
https://github.com/moluwole/Bast/blob/eecf55ae72e6f24af7c101549be0422cd2c1c95a/bast/controller.py#L245-L255
def get_argument(self, name, default=None, strip=True): """ Returns the value of the argument with the given name. If default is not provided, returns ``None`` If the argument appears in the url more than once, we return the last value. The returned value is always unicode ...
[ "def", "get_argument", "(", "self", ",", "name", ",", "default", "=", "None", ",", "strip", "=", "True", ")", ":", "return", "self", ".", "_get_argument", "(", "name", ",", "default", ",", "self", ".", "request", ".", "arguments", ",", "strip", ")", ...
Returns the value of the argument with the given name. If default is not provided, returns ``None`` If the argument appears in the url more than once, we return the last value. The returned value is always unicode
[ "Returns", "the", "value", "of", "the", "argument", "with", "the", "given", "name", "." ]
python
train
36.727273
pyviz/holoviews
holoviews/plotting/bokeh/element.py
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/element.py#L212-L257
def _init_tools(self, element, callbacks=[]): """ Processes the list of tools to be supplied to the plot. """ tooltips, hover_opts = self._hover_opts(element) tooltips = [(ttp.pprint_label, '@{%s}' % util.dimension_sanitizer(ttp.name)) if isinstance(ttp, Dimen...
[ "def", "_init_tools", "(", "self", ",", "element", ",", "callbacks", "=", "[", "]", ")", ":", "tooltips", ",", "hover_opts", "=", "self", ".", "_hover_opts", "(", "element", ")", "tooltips", "=", "[", "(", "ttp", ".", "pprint_label", ",", "'@{%s}'", "%...
Processes the list of tools to be supplied to the plot.
[ "Processes", "the", "list", "of", "tools", "to", "be", "supplied", "to", "the", "plot", "." ]
python
train
40.521739
Fantomas42/django-blog-zinnia
zinnia/admin/entry.py
https://github.com/Fantomas42/django-blog-zinnia/blob/b4949304b104a8e1a7a7a0773cbfd024313c3a15/zinnia/admin/entry.py#L175-L183
def get_queryset(self, request): """ Make special filtering by user's permissions. """ if not request.user.has_perm('zinnia.can_view_all'): queryset = self.model.objects.filter(authors__pk=request.user.pk) else: queryset = super(EntryAdmin, self).get_query...
[ "def", "get_queryset", "(", "self", ",", "request", ")", ":", "if", "not", "request", ".", "user", ".", "has_perm", "(", "'zinnia.can_view_all'", ")", ":", "queryset", "=", "self", ".", "model", ".", "objects", ".", "filter", "(", "authors__pk", "=", "re...
Make special filtering by user's permissions.
[ "Make", "special", "filtering", "by", "user", "s", "permissions", "." ]
python
train
44.333333
edx/ecommerce-worker
ecommerce_worker/sailthru/v1/tasks.py
https://github.com/edx/ecommerce-worker/blob/55246961d805b1f64d661a5c0bae0a216589401f/ecommerce_worker/sailthru/v1/tasks.py#L22-L25
def schedule_retry(self, config): """Schedule a retry""" raise self.retry(countdown=config.get('SAILTHRU_RETRY_SECONDS'), max_retries=config.get('SAILTHRU_RETRY_ATTEMPTS'))
[ "def", "schedule_retry", "(", "self", ",", "config", ")", ":", "raise", "self", ".", "retry", "(", "countdown", "=", "config", ".", "get", "(", "'SAILTHRU_RETRY_SECONDS'", ")", ",", "max_retries", "=", "config", ".", "get", "(", "'SAILTHRU_RETRY_ATTEMPTS'", ...
Schedule a retry
[ "Schedule", "a", "retry" ]
python
test
49.5
tensorflow/tensor2tensor
tensor2tensor/data_generators/wikisum/validate_data.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/wikisum/validate_data.py#L94-L107
def filename_to_task_id(fname): """Map filename to the task id that created it assuming 1k tasks.""" # This matches the order and size in WikisumBase.out_filepaths fname = os.path.basename(fname) shard_id_increment = { "train": 0, "dev": 800, "test": 900, } parts = fname.split("-") split...
[ "def", "filename_to_task_id", "(", "fname", ")", ":", "# This matches the order and size in WikisumBase.out_filepaths", "fname", "=", "os", ".", "path", ".", "basename", "(", "fname", ")", "shard_id_increment", "=", "{", "\"train\"", ":", "0", ",", "\"dev\"", ":", ...
Map filename to the task id that created it assuming 1k tasks.
[ "Map", "filename", "to", "the", "task", "id", "that", "created", "it", "assuming", "1k", "tasks", "." ]
python
train
29.357143
gboeing/osmnx
osmnx/pois.py
https://github.com/gboeing/osmnx/blob/be59fd313bcb68af8fc79242c56194f1247e26e2/osmnx/pois.py#L389-L413
def pois_from_address(address, distance, amenities=None): """ Get OSM points of Interests within some distance north, south, east, and west of an address. Parameters ---------- address : string the address to geocode to a lat-long point distance : numeric distance in meters ...
[ "def", "pois_from_address", "(", "address", ",", "distance", ",", "amenities", "=", "None", ")", ":", "# geocode the address string to a (lat, lon) point", "point", "=", "geocode", "(", "query", "=", "address", ")", "# get POIs within distance of this point", "return", ...
Get OSM points of Interests within some distance north, south, east, and west of an address. Parameters ---------- address : string the address to geocode to a lat-long point distance : numeric distance in meters amenities : list List of amenities that will be used for f...
[ "Get", "OSM", "points", "of", "Interests", "within", "some", "distance", "north", "south", "east", "and", "west", "of", "an", "address", "." ]
python
train
30.32
divio/python-mautic
mautic/contacts.py
https://github.com/divio/python-mautic/blob/1fbff629070200002373c5e94c75e01561df418a/mautic/contacts.py#L195-L224
def add_dnc( self, obj_id, channel='email', reason=MANUAL, channel_id=None, comments='via API' ): """ Adds Do Not Contact :param obj_id: int :param channel: str :param reason: str :param channel_id: int :param c...
[ "def", "add_dnc", "(", "self", ",", "obj_id", ",", "channel", "=", "'email'", ",", "reason", "=", "MANUAL", ",", "channel_id", "=", "None", ",", "comments", "=", "'via API'", ")", ":", "data", "=", "{", "'reason'", ":", "reason", ",", "'channelId'", ":...
Adds Do Not Contact :param obj_id: int :param channel: str :param reason: str :param channel_id: int :param comments: str :return: dict|str
[ "Adds", "Do", "Not", "Contact" ]
python
train
24.166667
miyuchina/mistletoe
contrib/toc_renderer.py
https://github.com/miyuchina/mistletoe/blob/846a419bcb83afab02f3f19d151ab0166fab68f6/contrib/toc_renderer.py#L47-L58
def render_heading(self, token): """ Overrides super().render_heading; stores rendered heading first, then returns it. """ rendered = super().render_heading(token) content = self.parse_rendered_heading(rendered) if not (self.omit_title and token.level == 1 ...
[ "def", "render_heading", "(", "self", ",", "token", ")", ":", "rendered", "=", "super", "(", ")", ".", "render_heading", "(", "token", ")", "content", "=", "self", ".", "parse_rendered_heading", "(", "rendered", ")", "if", "not", "(", "self", ".", "omit_...
Overrides super().render_heading; stores rendered heading first, then returns it.
[ "Overrides", "super", "()", ".", "render_heading", ";", "stores", "rendered", "heading", "first", "then", "returns", "it", "." ]
python
train
41.416667
ajenhl/tacl
tacl/results.py
https://github.com/ajenhl/tacl/blob/b8a343248e77f1c07a5a4ac133a9ad6e0b4781c2/tacl/results.py#L166-L189
def bifurcated_extend(self, corpus, max_size): """Replaces the results with those n-grams that contain any of the original n-grams, and that represent points at which an n-gram is a constituent of multiple larger n-grams with a lower label count. :param corpus: corpus of works t...
[ "def", "bifurcated_extend", "(", "self", ",", "corpus", ",", "max_size", ")", ":", "temp_fd", ",", "temp_path", "=", "tempfile", ".", "mkstemp", "(", "text", "=", "True", ")", "try", ":", "self", ".", "_prepare_bifurcated_extend_data", "(", "corpus", ",", ...
Replaces the results with those n-grams that contain any of the original n-grams, and that represent points at which an n-gram is a constituent of multiple larger n-grams with a lower label count. :param corpus: corpus of works to which results belong :type corpus: `Corpus` ...
[ "Replaces", "the", "results", "with", "those", "n", "-", "grams", "that", "contain", "any", "of", "the", "original", "n", "-", "grams", "and", "that", "represent", "points", "at", "which", "an", "n", "-", "gram", "is", "a", "constituent", "of", "multiple...
python
train
40.458333
striglia/pyramid_swagger
pyramid_swagger/load_schema.py
https://github.com/striglia/pyramid_swagger/blob/1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45/pyramid_swagger/load_schema.py#L269-L279
def load_schema(schema_path): """Prepare the api specification for request and response validation. :returns: a mapping from :class:`RequestMatcher` to :class:`ValidatorMap` for every operation in the api specification. :rtype: dict """ with open(schema_path, 'r') as schema_file: sc...
[ "def", "load_schema", "(", "schema_path", ")", ":", "with", "open", "(", "schema_path", ",", "'r'", ")", "as", "schema_file", ":", "schema", "=", "simplejson", ".", "load", "(", "schema_file", ")", "resolver", "=", "RefResolver", "(", "''", ",", "''", ",...
Prepare the api specification for request and response validation. :returns: a mapping from :class:`RequestMatcher` to :class:`ValidatorMap` for every operation in the api specification. :rtype: dict
[ "Prepare", "the", "api", "specification", "for", "request", "and", "response", "validation", "." ]
python
train
42.363636
project-rig/rig
rig/routing_table/ordered_covering.py
https://github.com/project-rig/rig/blob/3a3e053d3214899b6d68758685835de0afd5542b/rig/routing_table/ordered_covering.py#L134-L185
def minimise(routing_table, target_length): """Reduce the size of a routing table by merging together entries where possible and by removing any remaining default routes. .. warning:: The input routing table *must* also include entries which could be removed and replaced by default routing...
[ "def", "minimise", "(", "routing_table", ",", "target_length", ")", ":", "table", ",", "_", "=", "ordered_covering", "(", "routing_table", ",", "target_length", ",", "no_raise", "=", "True", ")", "return", "remove_default_routes", "(", "table", ",", "target_leng...
Reduce the size of a routing table by merging together entries where possible and by removing any remaining default routes. .. warning:: The input routing table *must* also include entries which could be removed and replaced by default routing. .. warning:: It is assumed that the...
[ "Reduce", "the", "size", "of", "a", "routing", "table", "by", "merging", "together", "entries", "where", "possible", "and", "by", "removing", "any", "remaining", "default", "routes", "." ]
python
train
37.307692
KelSolaar/Foundations
foundations/trace.py
https://github.com/KelSolaar/Foundations/blob/5c141330faf09dad70a12bc321f4c564917d0a91/foundations/trace.py#L485-L507
def trace_function(module, function, tracer=tracer): """ Traces given module function using given tracer. :param module: Module of the function. :type module: object :param function: Function to trace. :type function: object :param tracer: Tracer. :type tracer: object :return: Defin...
[ "def", "trace_function", "(", "module", ",", "function", ",", "tracer", "=", "tracer", ")", ":", "if", "is_traced", "(", "function", ")", ":", "return", "False", "name", "=", "get_object_name", "(", "function", ")", "if", "is_untracable", "(", "function", ...
Traces given module function using given tracer. :param module: Module of the function. :type module: object :param function: Function to trace. :type function: object :param tracer: Tracer. :type tracer: object :return: Definition success. :rtype: bool
[ "Traces", "given", "module", "function", "using", "given", "tracer", "." ]
python
train
24.652174
COLORFULBOARD/revision
revision/client.py
https://github.com/COLORFULBOARD/revision/blob/2f22e72cce5b60032a80c002ac45c2ecef0ed987/revision/client.py#L225-L233
def tmp_file_path(self): """ :return: :rtype: str """ return os.path.normpath(os.path.join( TMP_DIR, self.filename ))
[ "def", "tmp_file_path", "(", "self", ")", ":", "return", "os", ".", "path", ".", "normpath", "(", "os", ".", "path", ".", "join", "(", "TMP_DIR", ",", "self", ".", "filename", ")", ")" ]
:return: :rtype: str
[ ":", "return", ":", ":", "rtype", ":", "str" ]
python
train
20.111111
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_system_monitor_ext.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_system_monitor_ext.py#L39-L51
def show_system_monitor_output_switch_status_switch_name(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") show_system_monitor = ET.Element("show_system_monitor") config = show_system_monitor output = ET.SubElement(show_system_monitor, "output") ...
[ "def", "show_system_monitor_output_switch_status_switch_name", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "show_system_monitor", "=", "ET", ".", "Element", "(", "\"show_system_monitor\"", ")", "conf...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
44.461538
SeabornGames/Table
seaborn_table/table.py
https://github.com/SeabornGames/Table/blob/0c474ef2fb00db0e7cf47e8af91e3556c2e7485a/seaborn_table/table.py#L337-L365
def str_to_obj(cls, file_path=None, text='', columns=None, remove_empty_rows=True, key_on=None, row_columns=None, deliminator='\t', eval_cells=True): """ This will convert text file or text to a seaborn table and return it :param file_path: str of th...
[ "def", "str_to_obj", "(", "cls", ",", "file_path", "=", "None", ",", "text", "=", "''", ",", "columns", "=", "None", ",", "remove_empty_rows", "=", "True", ",", "key_on", "=", "None", ",", "row_columns", "=", "None", ",", "deliminator", "=", "'\\t'", "...
This will convert text file or text to a seaborn table and return it :param file_path: str of the path to the file :param text: str of the csv text :param columns: list of str of columns to use :param row_columns: list of str of columns in data but not to use :param remov...
[ "This", "will", "convert", "text", "file", "or", "text", "to", "a", "seaborn", "table", "and", "return", "it", ":", "param", "file_path", ":", "str", "of", "the", "path", "to", "the", "file", ":", "param", "text", ":", "str", "of", "the", "csv", "tex...
python
train
48.241379
alimanfoo/csvvalidator
csvvalidator.py
https://github.com/alimanfoo/csvvalidator/blob/50a86eefdc549c48f65a91a5c0a66099010ee65d/csvvalidator.py#L974-L984
def number_range_inclusive(min, max, type=float): """ Return a value check function which raises a ValueError if the supplied value when cast as `type` is less than `min` or greater than `max`. """ def checker(v): if type(v) < min or type(v) > max: raise ValueError(v) retur...
[ "def", "number_range_inclusive", "(", "min", ",", "max", ",", "type", "=", "float", ")", ":", "def", "checker", "(", "v", ")", ":", "if", "type", "(", "v", ")", "<", "min", "or", "type", "(", "v", ")", ">", "max", ":", "raise", "ValueError", "(",...
Return a value check function which raises a ValueError if the supplied value when cast as `type` is less than `min` or greater than `max`.
[ "Return", "a", "value", "check", "function", "which", "raises", "a", "ValueError", "if", "the", "supplied", "value", "when", "cast", "as", "type", "is", "less", "than", "min", "or", "greater", "than", "max", "." ]
python
valid
29
mitsei/dlkit
dlkit/handcar/learning/managers.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/handcar/learning/managers.py#L693-L715
def get_objective_lookup_session(self): """Gets the OsidSession associated with the objective lookup service. return: (osid.learning.ObjectiveLookupSession) - an ObjectiveLookupSession raise: OperationFailed - unable to complete request raise: Unimplemented - s...
[ "def", "get_objective_lookup_session", "(", "self", ")", ":", "if", "not", "self", ".", "supports_objective_lookup", "(", ")", ":", "raise", "Unimplemented", "(", ")", "try", ":", "from", ".", "import", "sessions", "except", "ImportError", ":", "raise", "# Ope...
Gets the OsidSession associated with the objective lookup service. return: (osid.learning.ObjectiveLookupSession) - an ObjectiveLookupSession raise: OperationFailed - unable to complete request raise: Unimplemented - supports_objective_lookup() is false complia...
[ "Gets", "the", "OsidSession", "associated", "with", "the", "objective", "lookup", "service", "." ]
python
train
36.956522
Apitax/Apitax
apitax/api/controllers/scriptax_controller.py
https://github.com/Apitax/Apitax/blob/3883e45f17e01eba4edac9d1bba42f0e7a748682/apitax/api/controllers/scriptax_controller.py#L152-L176
def save_driver_script(driver, script_save=None): # noqa: E501 """Save a script Save a script # noqa: E501 :param driver: The driver to use for the request. ie. github :type driver: str :param script_save: The data needed to save this script :type script_save: dict | bytes :rtype: Respon...
[ "def", "save_driver_script", "(", "driver", ",", "script_save", "=", "None", ")", ":", "# noqa: E501", "if", "connexion", ".", "request", ".", "is_json", ":", "script_save", "=", "ScriptSave", ".", "from_dict", "(", "connexion", ".", "request", ".", "get_json"...
Save a script Save a script # noqa: E501 :param driver: The driver to use for the request. ie. github :type driver: str :param script_save: The data needed to save this script :type script_save: dict | bytes :rtype: Response
[ "Save", "a", "script" ]
python
train
30.76
juju/python-libjuju
juju/client/connector.py
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/client/connector.py#L103-L143
async def connect_model(self, model_name=None): """Connect to a model by name. If either controller or model parts of the name are empty, the current controller and/or model will be used. :param str model: <controller>:<model> """ try: controller_name, model...
[ "async", "def", "connect_model", "(", "self", ",", "model_name", "=", "None", ")", ":", "try", ":", "controller_name", ",", "model_name", "=", "self", ".", "jujudata", ".", "parse_model", "(", "model_name", ")", "controller", "=", "self", ".", "jujudata", ...
Connect to a model by name. If either controller or model parts of the name are empty, the current controller and/or model will be used. :param str model: <controller>:<model>
[ "Connect", "to", "a", "model", "by", "name", ".", "If", "either", "controller", "or", "model", "parts", "of", "the", "name", "are", "empty", "the", "current", "controller", "and", "/", "or", "model", "will", "be", "used", "." ]
python
train
46.707317
saltstack/salt
salt/modules/virt.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4339-L4402
def _parse_domain_caps(caps): ''' Parse the XML document of domain capabilities into a structure. Return the domain capabilities given an emulator, architecture, machine or virtualization type. .. versionadded:: 2019.2.0 :param emulator: return the capabilities for the given emulator binary :p...
[ "def", "_parse_domain_caps", "(", "caps", ")", ":", "result", "=", "{", "'emulator'", ":", "caps", ".", "find", "(", "'path'", ")", ".", "text", "if", "caps", ".", "find", "(", "'path'", ")", "is", "not", "None", "else", "None", ",", "'domain'", ":",...
Parse the XML document of domain capabilities into a structure. Return the domain capabilities given an emulator, architecture, machine or virtualization type. .. versionadded:: 2019.2.0 :param emulator: return the capabilities for the given emulator binary :param arch: return the capabilities for the...
[ "Parse", "the", "XML", "document", "of", "domain", "capabilities", "into", "a", "structure", ".", "Return", "the", "domain", "capabilities", "given", "an", "emulator", "architecture", "machine", "or", "virtualization", "type", "." ]
python
train
37.703125
JukeboxPipeline/jukeboxmaya
src/jukeboxmaya/main.py
https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/main.py#L43-L68
def init(): """Initialize the pipeline in maya so everything works Init environment and load plugins. This also creates the initial Jukebox Menu entry. :returns: None :rtype: None :raises: None """ main.init_environment() pluginpath = os.pathsep.join((os.environ.get('JUKEBOX_PLUGIN...
[ "def", "init", "(", ")", ":", "main", ".", "init_environment", "(", ")", "pluginpath", "=", "os", ".", "pathsep", ".", "join", "(", "(", "os", ".", "environ", ".", "get", "(", "'JUKEBOX_PLUGIN_PATH'", ",", "''", ")", ",", "BUILTIN_PLUGIN_PATH", ")", ")...
Initialize the pipeline in maya so everything works Init environment and load plugins. This also creates the initial Jukebox Menu entry. :returns: None :rtype: None :raises: None
[ "Initialize", "the", "pipeline", "in", "maya", "so", "everything", "works" ]
python
train
35.692308
Fantomas42/mots-vides
mots_vides/scripts/rebaser.py
https://github.com/Fantomas42/mots-vides/blob/eaeccf73bdb415d0c5559ccd74de360b37a2bbac/mots_vides/scripts/rebaser.py#L11-L25
def cmdline(argv=sys.argv[1:]): """ Script for rebasing a text file """ parser = ArgumentParser( description='Rebase a text from his stop words') parser.add_argument('language', help='The language used to rebase') parser.add_argument('source', help='Text file to rebase') options = pa...
[ "def", "cmdline", "(", "argv", "=", "sys", ".", "argv", "[", "1", ":", "]", ")", ":", "parser", "=", "ArgumentParser", "(", "description", "=", "'Rebase a text from his stop words'", ")", "parser", ".", "add_argument", "(", "'language'", ",", "help", "=", ...
Script for rebasing a text file
[ "Script", "for", "rebasing", "a", "text", "file" ]
python
train
37.333333
satellogic/telluric
telluric/georaster.py
https://github.com/satellogic/telluric/blob/e752cd3ee71e339f79717e526fde362e80055d9e/telluric/georaster.py#L120-L161
def merge_all(rasters, roi=None, dest_resolution=None, merge_strategy=MergeStrategy.UNION, shape=None, ul_corner=None, crs=None, pixel_strategy=PixelStrategy.FIRST, resampling=Resampling.nearest): """Merge a list of rasters, cropping by a region of interest. There are cases that t...
[ "def", "merge_all", "(", "rasters", ",", "roi", "=", "None", ",", "dest_resolution", "=", "None", ",", "merge_strategy", "=", "MergeStrategy", ".", "UNION", ",", "shape", "=", "None", ",", "ul_corner", "=", "None", ",", "crs", "=", "None", ",", "pixel_st...
Merge a list of rasters, cropping by a region of interest. There are cases that the roi is not precise enough for this cases one can use, the upper left corner the shape and crs to precisely define the roi. When roi is provided the ul_corner, shape and crs are ignored
[ "Merge", "a", "list", "of", "rasters", "cropping", "by", "a", "region", "of", "interest", ".", "There", "are", "cases", "that", "the", "roi", "is", "not", "precise", "enough", "for", "this", "cases", "one", "can", "use", "the", "upper", "left", "corner",...
python
train
41.166667
PmagPy/PmagPy
pmagpy/data_model3.py
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/data_model3.py#L162-L180
def parse_response(self, raw): """ Format the requested data model into a dictionary of DataFrames and a criteria map DataFrame. Take data returned by a requests.get call to Earthref. Parameters ---------- raw: 'requests.models.Response' Returns ...
[ "def", "parse_response", "(", "self", ",", "raw", ")", ":", "tables", "=", "raw", ".", "json", "(", ")", "[", "'tables'", "]", "crit", "=", "raw", ".", "json", "(", ")", "[", "'criteria_map'", "]", "return", "self", ".", "parse", "(", "tables", ","...
Format the requested data model into a dictionary of DataFrames and a criteria map DataFrame. Take data returned by a requests.get call to Earthref. Parameters ---------- raw: 'requests.models.Response' Returns --------- data_model : dictionary of DataFr...
[ "Format", "the", "requested", "data", "model", "into", "a", "dictionary", "of", "DataFrames", "and", "a", "criteria", "map", "DataFrame", ".", "Take", "data", "returned", "by", "a", "requests", ".", "get", "call", "to", "Earthref", "." ]
python
train
27.315789
google/grr
grr/server/grr_response_server/bin/fleetspeak_frontend.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/bin/fleetspeak_frontend.py#L50-L69
def Process(self, fs_msg, context): """Processes a single fleetspeak message.""" try: if fs_msg.message_type == "GrrMessage": grr_message = rdf_flows.GrrMessage.FromSerializedString( fs_msg.data.value) self._ProcessGRRMessages(fs_msg.source.client_id, [grr_message]) elif ...
[ "def", "Process", "(", "self", ",", "fs_msg", ",", "context", ")", ":", "try", ":", "if", "fs_msg", ".", "message_type", "==", "\"GrrMessage\"", ":", "grr_message", "=", "rdf_flows", ".", "GrrMessage", ".", "FromSerializedString", "(", "fs_msg", ".", "data",...
Processes a single fleetspeak message.
[ "Processes", "a", "single", "fleetspeak", "message", "." ]
python
train
45.8
GNS3/gns3-server
gns3server/compute/dynamips/nodes/router.py
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L894-L907
def set_disk0(self, disk0): """ Sets the size (MB) for PCMCIA disk0. :param disk0: disk0 size (integer) """ yield from self._hypervisor.send('vm set_disk0 "{name}" {disk0}'.format(name=self._name, disk0=disk0)) log.info('Router "{name}" [{id}]: disk0 updated from {old_...
[ "def", "set_disk0", "(", "self", ",", "disk0", ")", ":", "yield", "from", "self", ".", "_hypervisor", ".", "send", "(", "'vm set_disk0 \"{name}\" {disk0}'", ".", "format", "(", "name", "=", "self", ".", "_name", ",", "disk0", "=", "disk0", ")", ")", "log...
Sets the size (MB) for PCMCIA disk0. :param disk0: disk0 size (integer)
[ "Sets", "the", "size", "(", "MB", ")", "for", "PCMCIA", "disk0", "." ]
python
train
52.785714
scanny/python-pptx
lab/cust-elm-classes/main.py
https://github.com/scanny/python-pptx/blob/d6ab8234f8b03953d2f831ff9394b1852db34130/lab/cust-elm-classes/main.py#L85-L90
def _required_attribute(element, name, default): """ Add attribute with default value to element if it doesn't already exist. """ if element.get(name) is None: element.set(name, default)
[ "def", "_required_attribute", "(", "element", ",", "name", ",", "default", ")", ":", "if", "element", ".", "get", "(", "name", ")", "is", "None", ":", "element", ".", "set", "(", "name", ",", "default", ")" ]
Add attribute with default value to element if it doesn't already exist.
[ "Add", "attribute", "with", "default", "value", "to", "element", "if", "it", "doesn", "t", "already", "exist", "." ]
python
train
34.166667
angr/angr
angr/state_plugins/solver.py
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/solver.py#L690-L710
def eval_upto(self, e, n, cast_to=None, **kwargs): """ Evaluate an expression, using the solver if necessary. Returns primitives as specified by the `cast_to` parameter. Only certain primitives are supported, check the implementation of `_cast_to` to see which ones. :param e: the expres...
[ "def", "eval_upto", "(", "self", ",", "e", ",", "n", ",", "cast_to", "=", "None", ",", "*", "*", "kwargs", ")", ":", "concrete_val", "=", "_concrete_value", "(", "e", ")", "if", "concrete_val", "is", "not", "None", ":", "return", "[", "self", ".", ...
Evaluate an expression, using the solver if necessary. Returns primitives as specified by the `cast_to` parameter. Only certain primitives are supported, check the implementation of `_cast_to` to see which ones. :param e: the expression :param n: the number of desired solutions :param e...
[ "Evaluate", "an", "expression", "using", "the", "solver", "if", "necessary", ".", "Returns", "primitives", "as", "specified", "by", "the", "cast_to", "parameter", ".", "Only", "certain", "primitives", "are", "supported", "check", "the", "implementation", "of", "...
python
train
50.333333
MIT-LCP/wfdb-python
wfdb/io/_signal.py
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/io/_signal.py#L1531-L1565
def _wfdb_fmt(bit_res, single_fmt=True): """ Return the most suitable wfdb format(s) to use given signal resolutions. Parameters ---------- bit_res : int, or list The resolution of the signal, or a list of resolutions, in bits. single_fmt : bool, optional Whether to return t...
[ "def", "_wfdb_fmt", "(", "bit_res", ",", "single_fmt", "=", "True", ")", ":", "if", "isinstance", "(", "bit_res", ",", "list", ")", ":", "# Return a single format", "if", "single_fmt", ":", "bit_res", "=", "[", "max", "(", "bit_res", ")", "]", "*", "len"...
Return the most suitable wfdb format(s) to use given signal resolutions. Parameters ---------- bit_res : int, or list The resolution of the signal, or a list of resolutions, in bits. single_fmt : bool, optional Whether to return the format for the maximum resolution signal. Ret...
[ "Return", "the", "most", "suitable", "wfdb", "format", "(", "s", ")", "to", "use", "given", "signal", "resolutions", "." ]
python
train
24.314286
StackStorm/pybind
pybind/slxos/v17s_1_02/brocade_mpls_rpc/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17s_1_02/brocade_mpls_rpc/__init__.py#L2538-L2559
def _set_mpls_reopt_lsp(self, v, load=False): """ Setter method for mpls_reopt_lsp, mapped from YANG variable /brocade_mpls_rpc/mpls_reopt_lsp (rpc) If this variable is read-only (config: false) in the source YANG file, then _set_mpls_reopt_lsp is considered as a private method. Backends looking to ...
[ "def", "_set_mpls_reopt_lsp", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ",", ...
Setter method for mpls_reopt_lsp, mapped from YANG variable /brocade_mpls_rpc/mpls_reopt_lsp (rpc) If this variable is read-only (config: false) in the source YANG file, then _set_mpls_reopt_lsp is considered as a private method. Backends looking to populate this variable should do so via calling thisOb...
[ "Setter", "method", "for", "mpls_reopt_lsp", "mapped", "from", "YANG", "variable", "/", "brocade_mpls_rpc", "/", "mpls_reopt_lsp", "(", "rpc", ")", "If", "this", "variable", "is", "read", "-", "only", "(", "config", ":", "false", ")", "in", "the", "source", ...
python
train
72.954545
econ-ark/HARK
HARK/interpolation.py
https://github.com/econ-ark/HARK/blob/3d184153a189e618a87c9540df1cd12044039cc5/HARK/interpolation.py#L1663-L1676
def _evaluate(self,x): ''' Returns the level of the function at each value in x as the minimum among all of the functions. Only called internally by HARKinterpolator1D.__call__. ''' if _isscalar(x): y = np.nanmin([f(x) for f in self.functions]) else: ...
[ "def", "_evaluate", "(", "self", ",", "x", ")", ":", "if", "_isscalar", "(", "x", ")", ":", "y", "=", "np", ".", "nanmin", "(", "[", "f", "(", "x", ")", "for", "f", "in", "self", ".", "functions", "]", ")", "else", ":", "m", "=", "len", "("...
Returns the level of the function at each value in x as the minimum among all of the functions. Only called internally by HARKinterpolator1D.__call__.
[ "Returns", "the", "level", "of", "the", "function", "at", "each", "value", "in", "x", "as", "the", "minimum", "among", "all", "of", "the", "functions", ".", "Only", "called", "internally", "by", "HARKinterpolator1D", ".", "__call__", "." ]
python
train
36.571429
mitsei/dlkit
dlkit/records/osid/base_records.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L431-L440
def get_creation_time(self): """stub""" ct = self.my_osid_object._my_map['creationTime'] return DateTime(ct.year, ct.month, ct.day, ct.hour, ct.minute, ct.second, ...
[ "def", "get_creation_time", "(", "self", ")", ":", "ct", "=", "self", ".", "my_osid_object", ".", "_my_map", "[", "'creationTime'", "]", "return", "DateTime", "(", "ct", ".", "year", ",", "ct", ".", "month", ",", "ct", ".", "day", ",", "ct", ".", "ho...
stub
[ "stub" ]
python
train
33.7
galactics/beyond
beyond/orbits/forms.py
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/orbits/forms.py#L251-L265
def _cartesian_to_spherical(cls, coord, center): """Cartesian to Spherical conversion .. warning:: The spherical form is equatorial, not zenithal """ x, y, z, vx, vy, vz = coord r = np.linalg.norm(coord[:3]) phi = arcsin(z / r) theta = arctan2(y, x) r_do...
[ "def", "_cartesian_to_spherical", "(", "cls", ",", "coord", ",", "center", ")", ":", "x", ",", "y", ",", "z", ",", "vx", ",", "vy", ",", "vz", "=", "coord", "r", "=", "np", ".", "linalg", ".", "norm", "(", "coord", "[", ":", "3", "]", ")", "p...
Cartesian to Spherical conversion .. warning:: The spherical form is equatorial, not zenithal
[ "Cartesian", "to", "Spherical", "conversion" ]
python
train
38.8
thiagopbueno/pyrddl
pyrddl/parser.py
https://github.com/thiagopbueno/pyrddl/blob/3bcfa850b1a7532c7744358f3c6b9e0f8ab978c9/pyrddl/parser.py#L401-L408
def p_cpf_list(self, p): '''cpf_list : cpf_list cpf_def | empty''' if p[1] is None: p[0] = [] else: p[1].append(p[2]) p[0] = p[1]
[ "def", "p_cpf_list", "(", "self", ",", "p", ")", ":", "if", "p", "[", "1", "]", "is", "None", ":", "p", "[", "0", "]", "=", "[", "]", "else", ":", "p", "[", "1", "]", ".", "append", "(", "p", "[", "2", "]", ")", "p", "[", "0", "]", "=...
cpf_list : cpf_list cpf_def | empty
[ "cpf_list", ":", "cpf_list", "cpf_def", "|", "empty" ]
python
train
25.25
numenta/nupic
src/nupic/regions/sp_region.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/sp_region.py#L506-L555
def _compute(self, inputs, outputs): """ Run one iteration of SPRegion's compute """ #if self.topDownMode and (not 'topDownIn' in inputs): # raise RuntimeError("The input topDownIn must be linked in if " # "topDownMode is True") if self._sfdr is None: raise Runti...
[ "def", "_compute", "(", "self", ",", "inputs", ",", "outputs", ")", ":", "#if self.topDownMode and (not 'topDownIn' in inputs):", "# raise RuntimeError(\"The input topDownIn must be linked in if \"", "# \"topDownMode is True\")", "if", "self", ".", "_sfdr", "is...
Run one iteration of SPRegion's compute
[ "Run", "one", "iteration", "of", "SPRegion", "s", "compute" ]
python
valid
25.84
twisted/epsilon
epsilon/amprouter.py
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/amprouter.py#L54-L63
def connectTo(self, remoteRouteName): """ Set the name of the route which will be added to outgoing boxes. """ self.remoteRouteName = remoteRouteName # This route must not be started before its router is started. If # sender is None, then the router is not started. When...
[ "def", "connectTo", "(", "self", ",", "remoteRouteName", ")", ":", "self", ".", "remoteRouteName", "=", "remoteRouteName", "# This route must not be started before its router is started. If", "# sender is None, then the router is not started. When the router is", "# started, it will ...
Set the name of the route which will be added to outgoing boxes.
[ "Set", "the", "name", "of", "the", "route", "which", "will", "be", "added", "to", "outgoing", "boxes", "." ]
python
train
43.9
DBuildService/dockerfile-parse
dockerfile_parse/parser.py
https://github.com/DBuildService/dockerfile-parse/blob/3d7b514d8b8eded1b33529cf0f6a0770a573aee0/dockerfile_parse/parser.py#L342-L354
def cmd(self): """ Determine the final CMD instruction, if any, in the final build stage. CMDs from earlier stages are ignored. :return: value of final stage CMD instruction """ value = None for insndesc in self.structure: if insndesc['instruction'] ==...
[ "def", "cmd", "(", "self", ")", ":", "value", "=", "None", "for", "insndesc", "in", "self", ".", "structure", ":", "if", "insndesc", "[", "'instruction'", "]", "==", "'FROM'", ":", "# new stage, reset", "value", "=", "None", "elif", "insndesc", "[", "'in...
Determine the final CMD instruction, if any, in the final build stage. CMDs from earlier stages are ignored. :return: value of final stage CMD instruction
[ "Determine", "the", "final", "CMD", "instruction", "if", "any", "in", "the", "final", "build", "stage", ".", "CMDs", "from", "earlier", "stages", "are", "ignored", ".", ":", "return", ":", "value", "of", "final", "stage", "CMD", "instruction" ]
python
train
36.846154
tk0miya/tk.phpautodoc
src/phply/phplex.py
https://github.com/tk0miya/tk.phpautodoc/blob/cf789f64abaf76351485cee231a075227e665fb6/src/phply/phplex.py#L359-L363
def t_quotedvar_ENCAPSED_AND_WHITESPACE(t): r'( [^"\\${] | \\(.|\n) | \$(?![A-Za-z_{]) | \{(?!\$) )+' t.lexer.lineno += t.value.count("\n") t.lexer.pop_state() return t
[ "def", "t_quotedvar_ENCAPSED_AND_WHITESPACE", "(", "t", ")", ":", "t", ".", "lexer", ".", "lineno", "+=", "t", ".", "value", ".", "count", "(", "\"\\n\"", ")", "t", ".", "lexer", ".", "pop_state", "(", ")", "return", "t" ]
r'( [^"\\${] | \\(.|\n) | \$(?![A-Za-z_{]) | \{(?!\$) )+
[ "r", "(", "[", "^", "\\\\", "$", "{", "]", "|", "\\\\", "(", ".", "|", "\\", "n", ")", "|", "\\", "$", "(", "?!", "[", "A", "-", "Za", "-", "z_", "{", "]", ")", "|", "\\", "{", "(", "?!", "\\", "$", ")", ")", "+" ]
python
train
36
RIPE-NCC/ripe.atlas.sagan
ripe/atlas/sagan/ssl.py
https://github.com/RIPE-NCC/ripe.atlas.sagan/blob/f0e57221cf0ba3504baddd3ea460fc955bc41cc6/ripe/atlas/sagan/ssl.py#L280-L289
def checksum_chain(self): """ Returns a list of checksums joined with "::". """ checksums = [] for certificate in self.certificates: checksums.append(certificate.checksum) return "::".join(checksums)
[ "def", "checksum_chain", "(", "self", ")", ":", "checksums", "=", "[", "]", "for", "certificate", "in", "self", ".", "certificates", ":", "checksums", ".", "append", "(", "certificate", ".", "checksum", ")", "return", "\"::\"", ".", "join", "(", "checksums...
Returns a list of checksums joined with "::".
[ "Returns", "a", "list", "of", "checksums", "joined", "with", "::", "." ]
python
train
25.2
Calysto/calysto
calysto/ai/conx.py
https://github.com/Calysto/calysto/blob/20813c0f48096317aa775d03a5c6b20f12fafc93/calysto/ai/conx.py#L507-L515
def setActivations(self, value): """ Sets all activations to the value of the argument. Value should be in the range [0,1]. """ #if self.verify and not self.activationSet == 0: # raise LayerError, \ # ('Activation flag not reset. Activations may have been set ...
[ "def", "setActivations", "(", "self", ",", "value", ")", ":", "#if self.verify and not self.activationSet == 0:", "# raise LayerError, \\", "# ('Activation flag not reset. Activations may have been set multiple times without any intervening call to propagate().', self.activationSet)"...
Sets all activations to the value of the argument. Value should be in the range [0,1].
[ "Sets", "all", "activations", "to", "the", "value", "of", "the", "argument", ".", "Value", "should", "be", "in", "the", "range", "[", "0", "1", "]", "." ]
python
train
56.222222
gem/oq-engine
openquake/server/db/actions.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/server/db/actions.py#L370-L388
def log(db, job_id, timestamp, level, process, message): """ Write a log record in the database. :param db: a :class:`openquake.server.dbapi.Db` instance :param job_id: a job ID :param timestamp: timestamp to store in the log record :param level: logging level to...
[ "def", "log", "(", "db", ",", "job_id", ",", "timestamp", ",", "level", ",", "process", ",", "message", ")", ":", "db", "(", "'INSERT INTO log (job_id, timestamp, level, process, message) '", "'VALUES (?X)'", ",", "(", "job_id", ",", "timestamp", ",", "level", "...
Write a log record in the database. :param db: a :class:`openquake.server.dbapi.Db` instance :param job_id: a job ID :param timestamp: timestamp to store in the log record :param level: logging level to store in the log record :param process: process ID to st...
[ "Write", "a", "log", "record", "in", "the", "database", "." ]
python
train
31.684211
PmagPy/PmagPy
pmagpy/pmagplotlib.py
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmagplotlib.py#L1358-L1410
def plot_slnp(fignum, SiteRec, datablock, key): """ plots lines and planes on a great circle with alpha 95 and mean deprecated (used in pmagplotlib) """ # make the stereonet plt.figure(num=fignum) plot_net(fignum) s = SiteRec['er_site_name'] # # plot on the data # coord = SiteRec['sit...
[ "def", "plot_slnp", "(", "fignum", ",", "SiteRec", ",", "datablock", ",", "key", ")", ":", "# make the stereonet", "plt", ".", "figure", "(", "num", "=", "fignum", ")", "plot_net", "(", "fignum", ")", "s", "=", "SiteRec", "[", "'er_site_name'", "]", "#",...
plots lines and planes on a great circle with alpha 95 and mean deprecated (used in pmagplotlib)
[ "plots", "lines", "and", "planes", "on", "a", "great", "circle", "with", "alpha", "95", "and", "mean", "deprecated", "(", "used", "in", "pmagplotlib", ")" ]
python
train
31.867925
oauthlib/oauthlib
oauthlib/oauth2/rfc6749/utils.py
https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/utils.py#L52-L68
def host_from_uri(uri): """Extract hostname and port from URI. Will use default port for HTTP and HTTPS if none is present in the URI. """ default_ports = { 'HTTP': '80', 'HTTPS': '443', } sch, netloc, path, par, query, fra = urlparse(uri) if ':' in netloc: netloc, ...
[ "def", "host_from_uri", "(", "uri", ")", ":", "default_ports", "=", "{", "'HTTP'", ":", "'80'", ",", "'HTTPS'", ":", "'443'", ",", "}", "sch", ",", "netloc", ",", "path", ",", "par", ",", "query", ",", "fra", "=", "urlparse", "(", "uri", ")", "if",...
Extract hostname and port from URI. Will use default port for HTTP and HTTPS if none is present in the URI.
[ "Extract", "hostname", "and", "port", "from", "URI", "." ]
python
train
24.235294
openai/universe
universe/wrappers/experimental/observation.py
https://github.com/openai/universe/blob/cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c/universe/wrappers/experimental/observation.py#L9-L21
def CropObservations(env): """" Crops the visual observations of an environment so that they only contain the game screen. Removes anything outside the game that usually belongs to universe (browser borders and so on). """ if env.spec.tags.get('flashgames', False): spec = runtime_spec('flash...
[ "def", "CropObservations", "(", "env", ")", ":", "if", "env", ".", "spec", ".", "tags", ".", "get", "(", "'flashgames'", ",", "False", ")", ":", "spec", "=", "runtime_spec", "(", "'flashgames'", ")", ".", "server_registry", "[", "env", ".", "spec", "."...
Crops the visual observations of an environment so that they only contain the game screen. Removes anything outside the game that usually belongs to universe (browser borders and so on).
[ "Crops", "the", "visual", "observations", "of", "an", "environment", "so", "that", "they", "only", "contain", "the", "game", "screen", ".", "Removes", "anything", "outside", "the", "game", "that", "usually", "belongs", "to", "universe", "(", "browser", "border...
python
train
51.692308
adrianliaw/PyCuber
pycuber/solver/cfop/f2l.py
https://github.com/adrianliaw/PyCuber/blob/e44b5ba48c831b964ce73d046fb813222771853f/pycuber/solver/cfop/f2l.py#L78-L95
def combining_goal(state): """ Check if two Cubies are combined on the U face. """ ((corner, edge), (L, U, F, D, R, B)) = state if "U" not in corner or "U" not in edge: return False if set(edge).issubset(set(corner)): return True elif set(edge.facings.keys()).issu...
[ "def", "combining_goal", "(", "state", ")", ":", "(", "(", "corner", ",", "edge", ")", ",", "(", "L", ",", "U", ",", "F", ",", "D", ",", "R", ",", "B", ")", ")", "=", "state", "if", "\"U\"", "not", "in", "corner", "or", "\"U\"", "not", "in", ...
Check if two Cubies are combined on the U face.
[ "Check", "if", "two", "Cubies", "are", "combined", "on", "the", "U", "face", "." ]
python
train
41.333333
mickbad/mblibs
mblibs/fast.py
https://github.com/mickbad/mblibs/blob/c1f423ef107c94e2ab6bd253e9148f6056e0ef75/mblibs/fast.py#L104-L257
def get(self, name, default="", parent_search=False, multikeys_search=False, __settings_temp=None, __rank_recursion=0): """ Récupération d'une configuration le paramètre ```name``` peut être soit un nom ou un chemin vers la valeur (séparateur /) ```parent_search``` est le boolean qui indique si on doi...
[ "def", "get", "(", "self", ",", "name", ",", "default", "=", "\"\"", ",", "parent_search", "=", "False", ",", "multikeys_search", "=", "False", ",", "__settings_temp", "=", "None", ",", "__rank_recursion", "=", "0", ")", ":", "# configuration des settings temp...
Récupération d'une configuration le paramètre ```name``` peut être soit un nom ou un chemin vers la valeur (séparateur /) ```parent_search``` est le boolean qui indique si on doit chercher la valeur dans la hiérarchie plus haute. Si la chaîne "/document/host/val" retourne None, on recherche dans "/doc...
[ "Récupération", "d", "une", "configuration", "le", "paramètre", "name", "peut", "être", "soit", "un", "nom", "ou", "un", "chemin", "vers", "la", "valeur", "(", "séparateur", "/", ")" ]
python
train
32.62987
hvac/hvac
hvac/v1/__init__.py
https://github.com/hvac/hvac/blob/cce5b86889193f622c2a72a4a1b7e1c9c8aff1ce/hvac/v1/__init__.py#L1543-L1553
def list_kubernetes_roles(self, mount_point='kubernetes'): """GET /auth/<mount_point>/role?list=true :param mount_point: The "path" the k8s auth backend was mounted on. Vault currently defaults to "kubernetes". :type mount_point: str. :return: Parsed JSON response from the list roles GE...
[ "def", "list_kubernetes_roles", "(", "self", ",", "mount_point", "=", "'kubernetes'", ")", ":", "url", "=", "'v1/auth/{0}/role?list=true'", ".", "format", "(", "mount_point", ")", "return", "self", ".", "_adapter", ".", "get", "(", "url", ")", ".", "json", "...
GET /auth/<mount_point>/role?list=true :param mount_point: The "path" the k8s auth backend was mounted on. Vault currently defaults to "kubernetes". :type mount_point: str. :return: Parsed JSON response from the list roles GET request. :rtype: dict.
[ "GET", "/", "auth", "/", "<mount_point", ">", "/", "role?list", "=", "true" ]
python
train
42.090909
adafruit/Adafruit_Python_GPIO
Adafruit_GPIO/FT232H.py
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L680-L685
def _i2c_idle(self): """Set I2C signals to idle state with SCL and SDA at a high value. Must be called within a transaction start/end. """ self._ft232h.output_pins({0: GPIO.HIGH, 1: GPIO.HIGH}, write=False) self._command.append(self._ft232h.mpsse_gpio() * _REPEAT_DELAY)
[ "def", "_i2c_idle", "(", "self", ")", ":", "self", ".", "_ft232h", ".", "output_pins", "(", "{", "0", ":", "GPIO", ".", "HIGH", ",", "1", ":", "GPIO", ".", "HIGH", "}", ",", "write", "=", "False", ")", "self", ".", "_command", ".", "append", "(",...
Set I2C signals to idle state with SCL and SDA at a high value. Must be called within a transaction start/end.
[ "Set", "I2C", "signals", "to", "idle", "state", "with", "SCL", "and", "SDA", "at", "a", "high", "value", ".", "Must", "be", "called", "within", "a", "transaction", "start", "/", "end", "." ]
python
valid
50.833333
robertpeteuil/multi-cloud-control
mcc/tables.py
https://github.com/robertpeteuil/multi-cloud-control/blob/f1565af1c0b6ed465ff312d3ccc592ba0609f4a2/mcc/tables.py#L30-L60
def indx_table(node_dict, tbl_mode=False): """Print Table for dict=formatted list conditionally include numbers.""" nt = PrettyTable() nt.header = False nt.padding_width = 2 nt.border = False clr_num = C_TI + "NUM" clr_name = C_TI + "NAME" clr_state = "STATE" + C_NORM t_lu = {True: [...
[ "def", "indx_table", "(", "node_dict", ",", "tbl_mode", "=", "False", ")", ":", "nt", "=", "PrettyTable", "(", ")", "nt", ".", "header", "=", "False", "nt", ".", "padding_width", "=", "2", "nt", ".", "border", "=", "False", "clr_num", "=", "C_TI", "+...
Print Table for dict=formatted list conditionally include numbers.
[ "Print", "Table", "for", "dict", "=", "formatted", "list", "conditionally", "include", "numbers", "." ]
python
train
35.612903
rackerlabs/fastfood
fastfood/shell.py
https://github.com/rackerlabs/fastfood/blob/543970c4cedbb3956e84a7986469fdd7e4ee8fc8/fastfood/shell.py#L78-L89
def _fastfood_show(args): """Run on `fastfood show`.""" template_pack = pack.TemplatePack(args.template_pack) if args.stencil_set: stencil_set = template_pack.load_stencil_set(args.stencil_set) print("Stencil Set %s:" % args.stencil_set) print(' Stencils:') for stencil in st...
[ "def", "_fastfood_show", "(", "args", ")", ":", "template_pack", "=", "pack", ".", "TemplatePack", "(", "args", ".", "template_pack", ")", "if", "args", ".", "stencil_set", ":", "stencil_set", "=", "template_pack", ".", "load_stencil_set", "(", "args", ".", ...
Run on `fastfood show`.
[ "Run", "on", "fastfood", "show", "." ]
python
train
42.916667
ToucanToco/toucan-data-sdk
toucan_data_sdk/utils/postprocess/pivot.py
https://github.com/ToucanToco/toucan-data-sdk/blob/c3ca874e1b64f4bdcc2edda750a72d45d1561d8a/toucan_data_sdk/utils/postprocess/pivot.py#L61-L136
def pivot_by_group( df, variable, value, new_columns, groups, id_cols=None ): """ Pivot a dataframe by group of variables --- ### Parameters *mandatory :* * `variable` (*str*): name of the column used to create the groups. * `value` (*str*):...
[ "def", "pivot_by_group", "(", "df", ",", "variable", ",", "value", ",", "new_columns", ",", "groups", ",", "id_cols", "=", "None", ")", ":", "if", "id_cols", "is", "None", ":", "index", "=", "[", "variable", "]", "else", ":", "index", "=", "[", "vari...
Pivot a dataframe by group of variables --- ### Parameters *mandatory :* * `variable` (*str*): name of the column used to create the groups. * `value` (*str*): name of the column containing the value to fill the pivoted df. * `new_columns` (*list of str*): names of the new columns. * `gro...
[ "Pivot", "a", "dataframe", "by", "group", "of", "variables" ]
python
test
25.013158
UCL-INGI/INGInious
inginious/frontend/pages/course_admin/task_edit.py
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/pages/course_admin/task_edit.py#L132-L331
def POST_AUTH(self, courseid, taskid): # pylint: disable=arguments-differ """ Edit a task """ if not id_checker(taskid) or not id_checker(courseid): raise Exception("Invalid course/task id") course, __ = self.get_course_and_check_rights(courseid, allow_all_staff=False) data...
[ "def", "POST_AUTH", "(", "self", ",", "courseid", ",", "taskid", ")", ":", "# pylint: disable=arguments-differ", "if", "not", "id_checker", "(", "taskid", ")", "or", "not", "id_checker", "(", "courseid", ")", ":", "raise", "Exception", "(", "\"Invalid course/tas...
Edit a task
[ "Edit", "a", "task" ]
python
train
45.345
ewels/MultiQC
multiqc/modules/vcftools/tstv_summary.py
https://github.com/ewels/MultiQC/blob/2037d6322b2554146a74efbf869156ad20d4c4ec/multiqc/modules/vcftools/tstv_summary.py#L14-L49
def parse_tstv_summary(self): """ Create the HTML for the TsTv summary plot. """ self.vcftools_tstv_summary = dict() for f in self.find_log_files('vcftools/tstv_summary', filehandles=True): d = {} for line in f['f'].readlines()[1:]: # don't add the header line (first row...
[ "def", "parse_tstv_summary", "(", "self", ")", ":", "self", ".", "vcftools_tstv_summary", "=", "dict", "(", ")", "for", "f", "in", "self", ".", "find_log_files", "(", "'vcftools/tstv_summary'", ",", "filehandles", "=", "True", ")", ":", "d", "=", "{", "}",...
Create the HTML for the TsTv summary plot.
[ "Create", "the", "HTML", "for", "the", "TsTv", "summary", "plot", "." ]
python
train
38.583333
hugapi/hug
hug/output_format.py
https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/output_format.py#L298-L307
def accept_quality(accept, default=1): """Separates out the quality score from the accepted content_type""" quality = default if accept and ";" in accept: accept, rest = accept.split(";", 1) accept_quality = RE_ACCEPT_QUALITY.search(rest) if accept_quality: quality = floa...
[ "def", "accept_quality", "(", "accept", ",", "default", "=", "1", ")", ":", "quality", "=", "default", "if", "accept", "and", "\";\"", "in", "accept", ":", "accept", ",", "rest", "=", "accept", ".", "split", "(", "\";\"", ",", "1", ")", "accept_quality...
Separates out the quality score from the accepted content_type
[ "Separates", "out", "the", "quality", "score", "from", "the", "accepted", "content_type" ]
python
train
41
TeamHG-Memex/eli5
eli5/sklearn/_span_analyzers.py
https://github.com/TeamHG-Memex/eli5/blob/371b402a0676295c05e582a2dd591f7af476b86b/eli5/sklearn/_span_analyzers.py#L7-L28
def build_span_analyzer(document, vec): """ Return an analyzer and the preprocessed doc. Analyzer will yield pairs of spans and feature, where spans are pairs of indices into the preprocessed doc. The idea here is to do minimal preprocessing so that we can still recover the same features as sklearn ...
[ "def", "build_span_analyzer", "(", "document", ",", "vec", ")", ":", "preprocessed_doc", "=", "vec", ".", "build_preprocessor", "(", ")", "(", "vec", ".", "decode", "(", "document", ")", ")", "analyzer", "=", "None", "if", "vec", ".", "analyzer", "==", "...
Return an analyzer and the preprocessed doc. Analyzer will yield pairs of spans and feature, where spans are pairs of indices into the preprocessed doc. The idea here is to do minimal preprocessing so that we can still recover the same features as sklearn vectorizers, but with spans, that will allow us ...
[ "Return", "an", "analyzer", "and", "the", "preprocessed", "doc", ".", "Analyzer", "will", "yield", "pairs", "of", "spans", "and", "feature", "where", "spans", "are", "pairs", "of", "indices", "into", "the", "preprocessed", "doc", ".", "The", "idea", "here", ...
python
train
51.636364
sdispater/cachy
cachy/stores/file_store.py
https://github.com/sdispater/cachy/blob/ee4b044d6aafa80125730a00b1f679a7bd852b8a/cachy/stores/file_store.py#L84-L103
def put(self, key, value, minutes): """ Store an item in the cache for a given number of minutes. :param key: The cache key :type key: str :param value: The cache value :type value: mixed :param minutes: The lifetime in minutes of the cached value :type...
[ "def", "put", "(", "self", ",", "key", ",", "value", ",", "minutes", ")", ":", "value", "=", "encode", "(", "str", "(", "self", ".", "_expiration", "(", "minutes", ")", ")", ")", "+", "encode", "(", "self", ".", "serialize", "(", "value", ")", ")...
Store an item in the cache for a given number of minutes. :param key: The cache key :type key: str :param value: The cache value :type value: mixed :param minutes: The lifetime in minutes of the cached value :type minutes: int
[ "Store", "an", "item", "in", "the", "cache", "for", "a", "given", "number", "of", "minutes", "." ]
python
train
27.7
mitsei/dlkit
dlkit/json_/learning/sessions.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L5624-L5649
def can_create_objective_bank_with_record_types(self, objective_bank_record_types): """Tests if this user can create a single ``ObjectiveBank`` using the desired record types. While ``LearningManager.getObjectiveBankRecordTypes()`` can be used to examine which records are supported, this method...
[ "def", "can_create_objective_bank_with_record_types", "(", "self", ",", "objective_bank_record_types", ")", ":", "# Implemented from template for", "# osid.resource.BinAdminSession.can_create_bin_with_record_types", "# NOTE: It is expected that real authentication hints will be", "# handled in...
Tests if this user can create a single ``ObjectiveBank`` using the desired record types. While ``LearningManager.getObjectiveBankRecordTypes()`` can be used to examine which records are supported, this method tests which record(s) are required for creating a specific ``ObjectiveBank``. ...
[ "Tests", "if", "this", "user", "can", "create", "a", "single", "ObjectiveBank", "using", "the", "desired", "record", "types", "." ]
python
train
53.346154
shoebot/shoebot
shoebot/grammar/bot.py
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/grammar/bot.py#L362-L390
def show(self, format='png', as_data=False): '''Returns an Image object of the current surface. Used for displaying output in Jupyter notebooks. Adapted from the cairo-jupyter project.''' from io import BytesIO b = BytesIO() if format == 'png': from IPython.display...
[ "def", "show", "(", "self", ",", "format", "=", "'png'", ",", "as_data", "=", "False", ")", ":", "from", "io", "import", "BytesIO", "b", "=", "BytesIO", "(", ")", "if", "format", "==", "'png'", ":", "from", "IPython", ".", "display", "import", "Image...
Returns an Image object of the current surface. Used for displaying output in Jupyter notebooks. Adapted from the cairo-jupyter project.
[ "Returns", "an", "Image", "object", "of", "the", "current", "surface", ".", "Used", "for", "displaying", "output", "in", "Jupyter", "notebooks", ".", "Adapted", "from", "the", "cairo", "-", "jupyter", "project", "." ]
python
valid
32.448276
KnowledgeLinks/rdfframework
rdfframework/rdfclass/esconversion.py
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/rdfclass/esconversion.py#L118-L135
def range_is_obj(rng, rdfclass): """ Test to see if range for the class should be an object or a litteral """ if rng == 'rdfs_Literal': return False if hasattr(rdfclass, rng): mod_class = getattr(rdfclass, rng) for item in mod_class.cls_defs['rdf_type']: try: ...
[ "def", "range_is_obj", "(", "rng", ",", "rdfclass", ")", ":", "if", "rng", "==", "'rdfs_Literal'", ":", "return", "False", "if", "hasattr", "(", "rdfclass", ",", "rng", ")", ":", "mod_class", "=", "getattr", "(", "rdfclass", ",", "rng", ")", "for", "it...
Test to see if range for the class should be an object or a litteral
[ "Test", "to", "see", "if", "range", "for", "the", "class", "should", "be", "an", "object", "or", "a", "litteral" ]
python
train
33
programa-stic/barf-project
barf/core/smt/smttranslator.py
https://github.com/programa-stic/barf-project/blob/18ed9e5eace55f7bf6015ec57f037c364099021c/barf/core/smt/smttranslator.py#L616-L631
def _translate_sext(self, oprnd1, oprnd2, oprnd3): """Return a formula representation of a SEXT instruction. """ assert oprnd1.size and oprnd3.size op1_var = self._translate_src_oprnd(oprnd1) op3_var, op3_var_constrs = self._translate_dst_oprnd(oprnd3) if oprnd3.size > ...
[ "def", "_translate_sext", "(", "self", ",", "oprnd1", ",", "oprnd2", ",", "oprnd3", ")", ":", "assert", "oprnd1", ".", "size", "and", "oprnd3", ".", "size", "op1_var", "=", "self", ".", "_translate_src_oprnd", "(", "oprnd1", ")", "op3_var", ",", "op3_var_c...
Return a formula representation of a SEXT instruction.
[ "Return", "a", "formula", "representation", "of", "a", "SEXT", "instruction", "." ]
python
train
36.0625
tanghaibao/jcvi
jcvi/assembly/hic.py
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/assembly/hic.py#L348-L389
def prune_tour(self, tour, cpus): """ Test deleting each contig and check the delta_score; tour here must be an array of ints. """ while True: tour_score, = self.evaluate_tour_M(tour) logging.debug("Starting score: {}".format(tour_score)) active_sizes ...
[ "def", "prune_tour", "(", "self", ",", "tour", ",", "cpus", ")", ":", "while", "True", ":", "tour_score", ",", "=", "self", ".", "evaluate_tour_M", "(", "tour", ")", "logging", ".", "debug", "(", "\"Starting score: {}\"", ".", "format", "(", "tour_score", ...
Test deleting each contig and check the delta_score; tour here must be an array of ints.
[ "Test", "deleting", "each", "contig", "and", "check", "the", "delta_score", ";", "tour", "here", "must", "be", "an", "array", "of", "ints", "." ]
python
train
36.261905
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/parallel/util.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/util.py#L115-L124
def log_errors(f, self, *args, **kwargs): """decorator to log unhandled exceptions raised in a method. For use wrapping on_recv callbacks, so that exceptions do not cause the stream to be closed. """ try: return f(self, *args, **kwargs) except Exception: self.log.error("Unca...
[ "def", "log_errors", "(", "f", ",", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "return", "f", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "except", "Exception", ":", "self", ".", "log", ".", "error...
decorator to log unhandled exceptions raised in a method. For use wrapping on_recv callbacks, so that exceptions do not cause the stream to be closed.
[ "decorator", "to", "log", "unhandled", "exceptions", "raised", "in", "a", "method", ".", "For", "use", "wrapping", "on_recv", "callbacks", "so", "that", "exceptions", "do", "not", "cause", "the", "stream", "to", "be", "closed", "." ]
python
test
35.2
sentinel-hub/eo-learn
core/eolearn/core/eoworkflow.py
https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/eoworkflow.py#L70-L87
def _set_task_uuid(self, dependencies): """Adds universally unique user ids (UUID) to each task of the workflow. :param dependencies: The list of dependencies between tasks defining the computational graph :type dependencies: list(Dependency) :return: A dictionary mapping UUID to d...
[ "def", "_set_task_uuid", "(", "self", ",", "dependencies", ")", ":", "uuid_dict", "=", "{", "}", "for", "dep", "in", "dependencies", ":", "task", "=", "dep", ".", "task", "if", "task", ".", "private_task_config", ".", "uuid", "in", "uuid_dict", ":", "rai...
Adds universally unique user ids (UUID) to each task of the workflow. :param dependencies: The list of dependencies between tasks defining the computational graph :type dependencies: list(Dependency) :return: A dictionary mapping UUID to dependencies :rtype: dict(str: Dependency)
[ "Adds", "universally", "unique", "user", "ids", "(", "UUID", ")", "to", "each", "task", "of", "the", "workflow", ".", ":", "param", "dependencies", ":", "The", "list", "of", "dependencies", "between", "tasks", "defining", "the", "computational", "graph", ":"...
python
train
42.944444
acutesoftware/AIKIF
aikif/toolbox/interface_windows_tools.py
https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/toolbox/interface_windows_tools.py#L90-L103
def send_keys(key_string): """ sends the text or keys to the active application using shell Note, that the imp module shows deprecation warning. Examples: shell.SendKeys("^a") # CTRL+A shell.SendKeys("{DELETE}") # Delete key shell.SendKeys("hello this is a lot of text with a //"...
[ "def", "send_keys", "(", "key_string", ")", ":", "try", ":", "shell", "=", "win32com", ".", "client", ".", "Dispatch", "(", "\"WScript.Shell\"", ")", "shell", ".", "SendKeys", "(", "key_string", ")", "except", "Exception", "as", "ex", ":", "print", "(", ...
sends the text or keys to the active application using shell Note, that the imp module shows deprecation warning. Examples: shell.SendKeys("^a") # CTRL+A shell.SendKeys("{DELETE}") # Delete key shell.SendKeys("hello this is a lot of text with a //")
[ "sends", "the", "text", "or", "keys", "to", "the", "active", "application", "using", "shell", "Note", "that", "the", "imp", "module", "shows", "deprecation", "warning", ".", "Examples", ":", "shell", ".", "SendKeys", "(", "^a", ")", "#", "CTRL", "+", "A"...
python
train
36.714286
ThreatConnect-Inc/tcex
tcex/tcex_resources.py
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_resources.py#L1852-L1859
def download(self, resource_id): """Update the request URI to download the document for this resource. Args: resource_id (integer): The group id. """ self.resource_id(str(resource_id)) self._request_uri = '{}/download'.format(self._request_uri)
[ "def", "download", "(", "self", ",", "resource_id", ")", ":", "self", ".", "resource_id", "(", "str", "(", "resource_id", ")", ")", "self", ".", "_request_uri", "=", "'{}/download'", ".", "format", "(", "self", ".", "_request_uri", ")" ]
Update the request URI to download the document for this resource. Args: resource_id (integer): The group id.
[ "Update", "the", "request", "URI", "to", "download", "the", "document", "for", "this", "resource", "." ]
python
train
36.25
couchbase/couchbase-python-client
txcouchbase/bucket.py
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/txcouchbase/bucket.py#L263-L289
def queryAll(self, *args, **kwargs): """ Returns a :class:`Deferred` object which will have its callback invoked with a :class:`BatchedView` when the results are complete. Parameters follow conventions of :meth:`~couchbase.bucket.Bucket.query`. Example:: d = ...
[ "def", "queryAll", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "connected", ":", "cb", "=", "lambda", "x", ":", "self", ".", "queryAll", "(", "*", "args", ",", "*", "*", "kwargs", ")", "return", "...
Returns a :class:`Deferred` object which will have its callback invoked with a :class:`BatchedView` when the results are complete. Parameters follow conventions of :meth:`~couchbase.bucket.Bucket.query`. Example:: d = cb.queryAll("beer", "brewery_beers") def on_all...
[ "Returns", "a", ":", "class", ":", "Deferred", "object", "which", "will", "have", "its", "callback", "invoked", "with", "a", ":", "class", ":", "BatchedView", "when", "the", "results", "are", "complete", "." ]
python
train
29.037037
fermiPy/fermipy
fermipy/castro.py
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/castro.py#L283-L293
def getInterval(self, alpha): """ Evaluate the interval corresponding to a C.L. of (1-alpha)%. Parameters ---------- alpha : limit confidence level. """ dlnl = twosided_cl_to_dlnl(1.0 - alpha) lo_lim = self.getDeltaLogLike(dlnl, upper=False) hi_lim = self...
[ "def", "getInterval", "(", "self", ",", "alpha", ")", ":", "dlnl", "=", "twosided_cl_to_dlnl", "(", "1.0", "-", "alpha", ")", "lo_lim", "=", "self", ".", "getDeltaLogLike", "(", "dlnl", ",", "upper", "=", "False", ")", "hi_lim", "=", "self", ".", "getD...
Evaluate the interval corresponding to a C.L. of (1-alpha)%. Parameters ---------- alpha : limit confidence level.
[ "Evaluate", "the", "interval", "corresponding", "to", "a", "C", ".", "L", ".", "of", "(", "1", "-", "alpha", ")", "%", "." ]
python
train
34.181818
The-Politico/politico-civic-demography
demography/management/commands/bootstrap/fetch/_series.py
https://github.com/The-Politico/politico-civic-demography/blob/080bb964b64b06db7fd04386530e893ceed1cf98/demography/management/commands/bootstrap/fetch/_series.py#L2-L15
def get_series(self, series): """ Returns a census series API handler. """ if series == "acs1": return self.census.acs1dp elif series == "acs5": return self.census.acs5 elif series == "sf1": return self.census.sf1 elif series ==...
[ "def", "get_series", "(", "self", ",", "series", ")", ":", "if", "series", "==", "\"acs1\"", ":", "return", "self", ".", "census", ".", "acs1dp", "elif", "series", "==", "\"acs5\"", ":", "return", "self", ".", "census", ".", "acs5", "elif", "series", "...
Returns a census series API handler.
[ "Returns", "a", "census", "series", "API", "handler", "." ]
python
train
27.642857
data-8/datascience
datascience/tables.py
https://github.com/data-8/datascience/blob/4cee38266903ca169cea4a53b8cc39502d85c464/datascience/tables.py#L1827-L1840
def as_text(self, max_rows=0, sep=" | "): """Format table as text.""" if not max_rows or max_rows > self.num_rows: max_rows = self.num_rows omitted = max(0, self.num_rows - max_rows) labels = self._columns.keys() fmts = self._get_column_formatters(max_rows, False) ...
[ "def", "as_text", "(", "self", ",", "max_rows", "=", "0", ",", "sep", "=", "\" | \"", ")", ":", "if", "not", "max_rows", "or", "max_rows", ">", "self", ".", "num_rows", ":", "max_rows", "=", "self", ".", "num_rows", "omitted", "=", "max", "(", "0", ...
Format table as text.
[ "Format", "table", "as", "text", "." ]
python
train
50.357143