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
Cymmetria/honeycomb
honeycomb/commands/integration/configure.py
https://github.com/Cymmetria/honeycomb/blob/33ea91b5cf675000e4e85dd02efe580ea6e95c86/honeycomb/commands/integration/configure.py#L24-L51
def configure(ctx, integration, args, show_args, editable): """Configure an integration with default parameters. You can still provide one-off integration arguments to :func:`honeycomb.commands.service.run` if required. """ home = ctx.obj["HOME"] integration_path = plugin_utils.get_plugin_path(home...
[ "def", "configure", "(", "ctx", ",", "integration", ",", "args", ",", "show_args", ",", "editable", ")", ":", "home", "=", "ctx", ".", "obj", "[", "\"HOME\"", "]", "integration_path", "=", "plugin_utils", ".", "get_plugin_path", "(", "home", ",", "defs", ...
Configure an integration with default parameters. You can still provide one-off integration arguments to :func:`honeycomb.commands.service.run` if required.
[ "Configure", "an", "integration", "with", "default", "parameters", "." ]
python
train
44.857143
learningequality/iceqube
src/iceqube/scheduler/classes.py
https://github.com/learningequality/iceqube/blob/97ac9e0f65bfedb0efa9f94638bcb57c7926dea2/src/iceqube/scheduler/classes.py#L123-L145
def handle_single_message(self, msg): """ Handle one message and modify the job storage appropriately. :param msg: the message to handle :return: None """ job_id = msg.message['job_id'] actual_msg = msg.message if msg.type == MessageType.JOB_UPDATED: ...
[ "def", "handle_single_message", "(", "self", ",", "msg", ")", ":", "job_id", "=", "msg", ".", "message", "[", "'job_id'", "]", "actual_msg", "=", "msg", ".", "message", "if", "msg", ".", "type", "==", "MessageType", ".", "JOB_UPDATED", ":", "progress", "...
Handle one message and modify the job storage appropriately. :param msg: the message to handle :return: None
[ "Handle", "one", "message", "and", "modify", "the", "job", "storage", "appropriately", ".", ":", "param", "msg", ":", "the", "message", "to", "handle", ":", "return", ":", "None" ]
python
train
45.695652
google/transitfeed
feedvalidator.py
https://github.com/google/transitfeed/blob/eb2991a3747ba541b2cb66502b305b6304a1f85f/feedvalidator.py#L542-L548
def RunValidationOutputToConsole(feed, options): """Validate feed, print reports and return an exit code.""" accumulator = CountingConsoleProblemAccumulator( options.error_types_ignore_list) problems = transitfeed.ProblemReporter(accumulator) _, exit_code = RunValidation(feed, options, problems) return ...
[ "def", "RunValidationOutputToConsole", "(", "feed", ",", "options", ")", ":", "accumulator", "=", "CountingConsoleProblemAccumulator", "(", "options", ".", "error_types_ignore_list", ")", "problems", "=", "transitfeed", ".", "ProblemReporter", "(", "accumulator", ")", ...
Validate feed, print reports and return an exit code.
[ "Validate", "feed", "print", "reports", "and", "return", "an", "exit", "code", "." ]
python
train
46.142857
kennethreitz/requests-html
requests_html.py
https://github.com/kennethreitz/requests-html/blob/b59a9f2fb9333d7d467154a0fd82978efdb9d23b/requests_html.py#L282-L288
def search_all(self, template: str) -> _Result: """Search the :class:`Element <Element>` (multiple times) for the given parse template. :param template: The Parse template to use. """ return [r for r in findall(template, self.html)]
[ "def", "search_all", "(", "self", ",", "template", ":", "str", ")", "->", "_Result", ":", "return", "[", "r", "for", "r", "in", "findall", "(", "template", ",", "self", ".", "html", ")", "]" ]
Search the :class:`Element <Element>` (multiple times) for the given parse template. :param template: The Parse template to use.
[ "Search", "the", ":", "class", ":", "Element", "<Element", ">", "(", "multiple", "times", ")", "for", "the", "given", "parse", "template", "." ]
python
train
38.142857
DMSC-Instrument-Data/lewis
src/lewis/adapters/epics.py
https://github.com/DMSC-Instrument-Data/lewis/blob/931d96b8c761550a6a58f6e61e202690db04233a/src/lewis/adapters/epics.py#L383-L394
def _function_has_n_args(self, func, n): """ Returns true if func has n arguments. Arguments with default and self for methods are not considered. """ if inspect.ismethod(func): n += 1 argspec = inspect.getargspec(func) defaults = argspec.defaults or ...
[ "def", "_function_has_n_args", "(", "self", ",", "func", ",", "n", ")", ":", "if", "inspect", ".", "ismethod", "(", "func", ")", ":", "n", "+=", "1", "argspec", "=", "inspect", ".", "getargspec", "(", "func", ")", "defaults", "=", "argspec", ".", "de...
Returns true if func has n arguments. Arguments with default and self for methods are not considered.
[ "Returns", "true", "if", "func", "has", "n", "arguments", ".", "Arguments", "with", "default", "and", "self", "for", "methods", "are", "not", "considered", "." ]
python
train
30.5
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/cyglink.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/cyglink.py#L128-L140
def _versioned_lib_suffix(env, suffix, version): """Generate versioned shared library suffix from a unversioned one. If suffix='.dll', and version='0.1.2', then it returns '-0-1-2.dll'""" Verbose = False if Verbose: print("_versioned_lib_suffix: suffix= ", suffix) print("_versioned_li...
[ "def", "_versioned_lib_suffix", "(", "env", ",", "suffix", ",", "version", ")", ":", "Verbose", "=", "False", "if", "Verbose", ":", "print", "(", "\"_versioned_lib_suffix: suffix= \"", ",", "suffix", ")", "print", "(", "\"_versioned_lib_suffix: version= \"", ",", ...
Generate versioned shared library suffix from a unversioned one. If suffix='.dll', and version='0.1.2', then it returns '-0-1-2.dll
[ "Generate", "versioned", "shared", "library", "suffix", "from", "a", "unversioned", "one", ".", "If", "suffix", "=", ".", "dll", "and", "version", "=", "0", ".", "1", ".", "2", "then", "it", "returns", "-", "0", "-", "1", "-", "2", ".", "dll" ]
python
train
43.923077
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L931-L936
def _create_out_partition(self, tenant_id, tenant_name): """Function to create a service partition. """ vrf_prof_str = self.serv_part_vrf_prof self.dcnm_obj.create_partition(tenant_name, fw_const.SERV_PART_NAME, None, vrf_prof_str, ...
[ "def", "_create_out_partition", "(", "self", ",", "tenant_id", ",", "tenant_name", ")", ":", "vrf_prof_str", "=", "self", ".", "serv_part_vrf_prof", "self", ".", "dcnm_obj", ".", "create_partition", "(", "tenant_name", ",", "fw_const", ".", "SERV_PART_NAME", ",", ...
Function to create a service partition.
[ "Function", "to", "create", "a", "service", "partition", "." ]
python
train
59
tensorflow/tensorboard
tensorboard/plugins/interactive_inference/utils/inference_utils.py
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/interactive_inference/utils/inference_utils.py#L254-L270
def wrap_inference_results(inference_result_proto): """Returns packaged inference results from the provided proto. Args: inference_result_proto: The classification or regression response proto. Returns: An InferenceResult proto with the result from the response. """ inference_proto = inference_pb2.I...
[ "def", "wrap_inference_results", "(", "inference_result_proto", ")", ":", "inference_proto", "=", "inference_pb2", ".", "InferenceResult", "(", ")", "if", "isinstance", "(", "inference_result_proto", ",", "classification_pb2", ".", "ClassificationResponse", ")", ":", "i...
Returns packaged inference results from the provided proto. Args: inference_result_proto: The classification or regression response proto. Returns: An InferenceResult proto with the result from the response.
[ "Returns", "packaged", "inference", "results", "from", "the", "provided", "proto", "." ]
python
train
40.705882
vertexproject/synapse
synapse/lib/certdir.py
https://github.com/vertexproject/synapse/blob/22e67c5a8f6d7caddbcf34b39ab1bd2d6c4a6e0b/synapse/lib/certdir.py#L463-L481
def getHostCertPath(self, name): ''' Gets the path to a host certificate. Args: name (str): The name of the host keypair. Examples: Get the path to the host certificate for the host "myhost": mypath = cdir.getHostCertPath('myhost') Retu...
[ "def", "getHostCertPath", "(", "self", ",", "name", ")", ":", "path", "=", "s_common", ".", "genpath", "(", "self", ".", "certdir", ",", "'hosts'", ",", "'%s.crt'", "%", "name", ")", "if", "not", "os", ".", "path", ".", "isfile", "(", "path", ")", ...
Gets the path to a host certificate. Args: name (str): The name of the host keypair. Examples: Get the path to the host certificate for the host "myhost": mypath = cdir.getHostCertPath('myhost') Returns: str: The path if exists.
[ "Gets", "the", "path", "to", "a", "host", "certificate", "." ]
python
train
26.736842
apple/turicreate
src/unity/python/turicreate/util/_cloudpickle.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_cloudpickle.py#L847-L886
def save_file(self, obj): """Save a file""" try: import StringIO as pystringIO #we can't use cStringIO as it lacks the name attribute except ImportError: import io as pystringIO if not hasattr(obj, 'name') or not hasattr(obj, 'mode'): raise pickle.Pi...
[ "def", "save_file", "(", "self", ",", "obj", ")", ":", "try", ":", "import", "StringIO", "as", "pystringIO", "#we can't use cStringIO as it lacks the name attribute", "except", "ImportError", ":", "import", "io", "as", "pystringIO", "if", "not", "hasattr", "(", "o...
Save a file
[ "Save", "a", "file" ]
python
train
38.275
wandb/client
wandb/util.py
https://github.com/wandb/client/blob/7d08954ed5674fee223cd85ed0d8518fe47266b2/wandb/util.py#L222-L240
def ensure_matplotlib_figure(obj): """Extract the current figure from a matplotlib object or return the object if it's a figure. raises ValueError if the object can't be converted. """ import matplotlib from matplotlib.figure import Figure if obj == matplotlib.pyplot: obj = obj.gcf() ...
[ "def", "ensure_matplotlib_figure", "(", "obj", ")", ":", "import", "matplotlib", "from", "matplotlib", ".", "figure", "import", "Figure", "if", "obj", "==", "matplotlib", ".", "pyplot", ":", "obj", "=", "obj", ".", "gcf", "(", ")", "elif", "not", "isinstan...
Extract the current figure from a matplotlib object or return the object if it's a figure. raises ValueError if the object can't be converted.
[ "Extract", "the", "current", "figure", "from", "a", "matplotlib", "object", "or", "return", "the", "object", "if", "it", "s", "a", "figure", ".", "raises", "ValueError", "if", "the", "object", "can", "t", "be", "converted", "." ]
python
train
43.315789
exosite-labs/pyonep
pyonep/onep.py
https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/onep.py#L346-L355
def info(self, auth, resource, options={}, defer=False): """ Request creation and usage information of specified resource according to the specified options. Args: auth: <cik> resource: Alias or ID of resource options: Options to define what info you would li...
[ "def", "info", "(", "self", ",", "auth", ",", "resource", ",", "options", "=", "{", "}", ",", "defer", "=", "False", ")", ":", "return", "self", ".", "_call", "(", "'info'", ",", "auth", ",", "[", "resource", ",", "options", "]", ",", "defer", ")...
Request creation and usage information of specified resource according to the specified options. Args: auth: <cik> resource: Alias or ID of resource options: Options to define what info you would like returned.
[ "Request", "creation", "and", "usage", "information", "of", "specified", "resource", "according", "to", "the", "specified", "options", "." ]
python
train
40.4
sanger-pathogens/circlator
circlator/clean.py
https://github.com/sanger-pathogens/circlator/blob/a4befb8c9dbbcd4b3ad1899a95aa3e689d58b638/circlator/clean.py#L112-L115
def _containing_contigs(self, hits): '''Given a list of hits, all with same query, returns a set of the contigs containing that query''' return {hit.ref_name for hit in hits if self._contains(hit)}
[ "def", "_containing_contigs", "(", "self", ",", "hits", ")", ":", "return", "{", "hit", ".", "ref_name", "for", "hit", "in", "hits", "if", "self", ".", "_contains", "(", "hit", ")", "}" ]
Given a list of hits, all with same query, returns a set of the contigs containing that query
[ "Given", "a", "list", "of", "hits", "all", "with", "same", "query", "returns", "a", "set", "of", "the", "contigs", "containing", "that", "query" ]
python
train
55.25
riccardocagnasso/useless
src/useless/PE/__init__.py
https://github.com/riccardocagnasso/useless/blob/5167aab82958f653148e3689c9a7e548d4fa2cba/src/useless/PE/__init__.py#L109-L125
def resolve_rva(self, rva): """ RVAs are supposed to be used with the image of the file in memory. There's no direct algorithm to calculate the offset of an RVA in the file. What we do here is to find the section that contains the RVA and then we calc...
[ "def", "resolve_rva", "(", "self", ",", "rva", ")", ":", "containing_section", "=", "self", ".", "get_section_of_rva", "(", "rva", ")", "in_section_offset", "=", "containing_section", ".", "PointerToRawData", "-", "containing_section", ".", "VirtualAddress", "return...
RVAs are supposed to be used with the image of the file in memory. There's no direct algorithm to calculate the offset of an RVA in the file. What we do here is to find the section that contains the RVA and then we calculate the offset between the RVA of the section ...
[ "RVAs", "are", "supposed", "to", "be", "used", "with", "the", "image", "of", "the", "file", "in", "memory", ".", "There", "s", "no", "direct", "algorithm", "to", "calculate", "the", "offset", "of", "an", "RVA", "in", "the", "file", "." ]
python
train
41.823529
billy-yoyo/RainbowSixSiege-Python-API
r6sapi/r6sapi.py
https://github.com/billy-yoyo/RainbowSixSiege-Python-API/blob/9860fdfd9a78aabd977eaa71b0a4ab4ed69e94d0/r6sapi/r6sapi.py#L1380-L1418
def load_general(self): """|coro| Loads the players general stats""" stats = yield from self._fetch_statistics("generalpvp_timeplayed", "generalpvp_matchplayed", "generalpvp_matchwon", "generalpvp_matchlost", "generalpvp_kills", "generalpvp_dea...
[ "def", "load_general", "(", "self", ")", ":", "stats", "=", "yield", "from", "self", ".", "_fetch_statistics", "(", "\"generalpvp_timeplayed\"", ",", "\"generalpvp_matchplayed\"", ",", "\"generalpvp_matchwon\"", ",", "\"generalpvp_matchlost\"", ",", "\"generalpvp_kills\""...
|coro| Loads the players general stats
[ "|coro|" ]
python
train
68.717949
openai/baselines
baselines/acktr/kfac.py
https://github.com/openai/baselines/blob/3301089b48c42b87b396e246ea3f56fa4bfc9678/baselines/acktr/kfac.py#L440-L474
def apply_stats(self, statsUpdates): """ compute stats and update/apply the new stats to the running average """ def updateAccumStats(): if self._full_stats_init: return tf.cond(tf.greater(self.sgd_step, self._cold_iter), lambda: tf.group(*self._apply_stats(statsUpda...
[ "def", "apply_stats", "(", "self", ",", "statsUpdates", ")", ":", "def", "updateAccumStats", "(", ")", ":", "if", "self", ".", "_full_stats_init", ":", "return", "tf", ".", "cond", "(", "tf", ".", "greater", "(", "self", ".", "sgd_step", ",", "self", "...
compute stats and update/apply the new stats to the running average
[ "compute", "stats", "and", "update", "/", "apply", "the", "new", "stats", "to", "the", "running", "average" ]
python
valid
51
payplug/payplug-python
payplug/__init__.py
https://github.com/payplug/payplug-python/blob/42dec9d6bff420dd0c26e51a84dd000adff04331/payplug/__init__.py#L84-L104
def list(per_page=None, page=None): """ List of payments. You have to handle pagination manually :param page: the page number :type page: int|None :param per_page: number of payment per page. It's a good practice to increase this number if you know that you will need a l...
[ "def", "list", "(", "per_page", "=", "None", ",", "page", "=", "None", ")", ":", "# Comprehension dict are not supported in Python 2.6-. You can use this commented line instead of the current", "# line when you drop support for Python 2.6.", "# pagination = {key: value for (key, value) i...
List of payments. You have to handle pagination manually :param page: the page number :type page: int|None :param per_page: number of payment per page. It's a good practice to increase this number if you know that you will need a lot of payments. :type per_page: int|None ...
[ "List", "of", "payments", ".", "You", "have", "to", "handle", "pagination", "manually" ]
python
train
49.857143
saltstack/salt
salt/fileserver/svnfs.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/svnfs.py#L415-L488
def update(): ''' Execute an svn update on all of the repos ''' # data for the fileserver event data = {'changed': False, 'backend': 'svnfs'} # _clear_old_remotes runs init(), so use the value from there to avoid a # second init() data['changed'], repos = _clear_old_remotes()...
[ "def", "update", "(", ")", ":", "# data for the fileserver event", "data", "=", "{", "'changed'", ":", "False", ",", "'backend'", ":", "'svnfs'", "}", "# _clear_old_remotes runs init(), so use the value from there to avoid a", "# second init()", "data", "[", "'changed'", ...
Execute an svn update on all of the repos
[ "Execute", "an", "svn", "update", "on", "all", "of", "the", "repos" ]
python
train
37.216216
istresearch/scrapy-cluster
crawler/crawling/distributed_scheduler.py
https://github.com/istresearch/scrapy-cluster/blob/13aaed2349af5d792d6bcbfcadc5563158aeb599/crawler/crawling/distributed_scheduler.py#L484-L548
def next_request(self): ''' Logic to handle getting a new url request, from a bunch of different queues ''' t = time.time() # update the redis queues every so often if t - self.update_time > self.update_interval: self.update_time = t self.c...
[ "def", "next_request", "(", "self", ")", ":", "t", "=", "time", ".", "time", "(", ")", "# update the redis queues every so often", "if", "t", "-", "self", ".", "update_time", ">", "self", ".", "update_interval", ":", "self", ".", "update_time", "=", "t", "...
Logic to handle getting a new url request, from a bunch of different queues
[ "Logic", "to", "handle", "getting", "a", "new", "url", "request", "from", "a", "bunch", "of", "different", "queues" ]
python
train
35.415385
Esri/ArcREST
tools/src/deleteUser.py
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/tools/src/deleteUser.py#L38-L78
def main(*argv): """ main driver of program """ try: adminUsername = argv[0] adminPassword = argv[1] siteURL = argv[2] deleteUser = argv[3] # Logic # sh = arcrest.AGOLTokenSecurityHandler(adminUsername, adminPassword) admin = arcrest.manageorg.Ad...
[ "def", "main", "(", "*", "argv", ")", ":", "try", ":", "adminUsername", "=", "argv", "[", "0", "]", "adminPassword", "=", "argv", "[", "1", "]", "siteURL", "=", "argv", "[", "2", "]", "deleteUser", "=", "argv", "[", "3", "]", "# Logic", "#", "s...
main driver of program
[ "main", "driver", "of", "program" ]
python
train
40.097561
tensorflow/lucid
lucid/misc/io/showing.py
https://github.com/tensorflow/lucid/blob/d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e/lucid/misc/io/showing.py#L272-L287
def _strip_consts(graph_def, max_const_size=32): """Strip large constant values from graph_def. This is mostly a utility function for graph(), and also originates here: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/tutorials/deepdream/deepdream.ipynb """ strip_def = tf.Gr...
[ "def", "_strip_consts", "(", "graph_def", ",", "max_const_size", "=", "32", ")", ":", "strip_def", "=", "tf", ".", "GraphDef", "(", ")", "for", "n0", "in", "graph_def", ".", "node", ":", "n", "=", "strip_def", ".", "node", ".", "add", "(", ")", "n", ...
Strip large constant values from graph_def. This is mostly a utility function for graph(), and also originates here: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/tutorials/deepdream/deepdream.ipynb
[ "Strip", "large", "constant", "values", "from", "graph_def", "." ]
python
train
41.5
quantmind/pulsar
pulsar/utils/pylib/events.py
https://github.com/quantmind/pulsar/blob/fee44e871954aa6ca36d00bb5a3739abfdb89b26/pulsar/utils/pylib/events.py#L41-L50
def bind(self, callback): """Bind a ``callback`` to this event. """ handlers = self._handlers if self._self is None: raise RuntimeError('%s already fired, cannot add callbacks' % self) if handlers is None: handlers = [] self._handlers = handler...
[ "def", "bind", "(", "self", ",", "callback", ")", ":", "handlers", "=", "self", ".", "_handlers", "if", "self", ".", "_self", "is", "None", ":", "raise", "RuntimeError", "(", "'%s already fired, cannot add callbacks'", "%", "self", ")", "if", "handlers", "is...
Bind a ``callback`` to this event.
[ "Bind", "a", "callback", "to", "this", "event", "." ]
python
train
34.6
BlockHub/blockhubdpostools
dpostools/api.py
https://github.com/BlockHub/blockhubdpostools/blob/27712cd97cd3658ee54a4330ff3135b51a01d7d1/dpostools/api.py#L103-L114
def broadcast_tx(self, address, amount, secret, secondsecret=None, vendorfield=''): """broadcasts a transaction to the peerslist using ark-js library""" peer = random.choice(self.PEERS) park = Park( peer, 4001, constants.ARK_NETHASH, '1.1.1' ...
[ "def", "broadcast_tx", "(", "self", ",", "address", ",", "amount", ",", "secret", ",", "secondsecret", "=", "None", ",", "vendorfield", "=", "''", ")", ":", "peer", "=", "random", ".", "choice", "(", "self", ".", "PEERS", ")", "park", "=", "Park", "(...
broadcasts a transaction to the peerslist using ark-js library
[ "broadcasts", "a", "transaction", "to", "the", "peerslist", "using", "ark", "-", "js", "library" ]
python
valid
34.416667
pydata/xarray
xarray/core/nanops.py
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/nanops.py#L134-L149
def _nanmean_ddof_object(ddof, value, axis=None, **kwargs): """ In house nanmean. ddof argument will be used in _nanvar method """ from .duck_array_ops import (count, fillna, _dask_or_eager_func, where_method) valid_count = count(value, axis=axis) value = fillna(value, ...
[ "def", "_nanmean_ddof_object", "(", "ddof", ",", "value", ",", "axis", "=", "None", ",", "*", "*", "kwargs", ")", ":", "from", ".", "duck_array_ops", "import", "(", "count", ",", "fillna", ",", "_dask_or_eager_func", ",", "where_method", ")", "valid_count", ...
In house nanmean. ddof argument will be used in _nanvar method
[ "In", "house", "nanmean", ".", "ddof", "argument", "will", "be", "used", "in", "_nanvar", "method" ]
python
train
46.9375
dagster-io/dagster
python_modules/dagster/dagster/core/types/field_utils.py
https://github.com/dagster-io/dagster/blob/4119f8c773089de64831b1dfb9e168e353d401dc/python_modules/dagster/dagster/core/types/field_utils.py#L284-L308
def PermissiveDict(fields=None): '''A permissive dict will permit the user to partially specify the permitted fields. Any fields that are specified and passed in will be type checked. Other fields will be allowed, but will be ignored by the type checker. ''' if fields: check_user_facing_fie...
[ "def", "PermissiveDict", "(", "fields", "=", "None", ")", ":", "if", "fields", ":", "check_user_facing_fields_dict", "(", "fields", ",", "'PermissiveDict'", ")", "class", "_PermissiveDict", "(", "_ConfigComposite", ")", ":", "def", "__init__", "(", "self", ")", ...
A permissive dict will permit the user to partially specify the permitted fields. Any fields that are specified and passed in will be type checked. Other fields will be allowed, but will be ignored by the type checker.
[ "A", "permissive", "dict", "will", "permit", "the", "user", "to", "partially", "specify", "the", "permitted", "fields", ".", "Any", "fields", "that", "are", "specified", "and", "passed", "in", "will", "be", "type", "checked", ".", "Other", "fields", "will", ...
python
test
35.8
thombashi/SimpleSQLite
simplesqlite/sqlquery.py
https://github.com/thombashi/SimpleSQLite/blob/b16f212132b9b98773e68bf7395abc2f60f56fe5/simplesqlite/sqlquery.py#L22-L44
def make_insert(cls, table, insert_tuple): """ [Deprecated] Make INSERT query. :param str table: Table name of executing the query. :param list/tuple insert_tuple: Insertion data. :return: Query of SQLite. :rtype: str :raises ValueError: If ``insert_tuple`` is em...
[ "def", "make_insert", "(", "cls", ",", "table", ",", "insert_tuple", ")", ":", "validate_table_name", "(", "table", ")", "table", "=", "Table", "(", "table", ")", "if", "typepy", ".", "is_empty_sequence", "(", "insert_tuple", ")", ":", "raise", "ValueError",...
[Deprecated] Make INSERT query. :param str table: Table name of executing the query. :param list/tuple insert_tuple: Insertion data. :return: Query of SQLite. :rtype: str :raises ValueError: If ``insert_tuple`` is empty |list|/|tuple|. :raises simplesqlite.NameValidation...
[ "[", "Deprecated", "]", "Make", "INSERT", "query", "." ]
python
train
31.26087
VasilyStepanov/pywidl
pywidl/grammar.py
https://github.com/VasilyStepanov/pywidl/blob/8d84b2e53157bfe276bf16301c19e8b6b32e861e/pywidl/grammar.py#L72-L75
def p_Interface(p): """Interface : interface IDENTIFIER Inheritance "{" InterfaceMembers "}" ";" """ p[0] = model.Interface(name=p[2], parent=p[3], members=p[5])
[ "def", "p_Interface", "(", "p", ")", ":", "p", "[", "0", "]", "=", "model", ".", "Interface", "(", "name", "=", "p", "[", "2", "]", ",", "parent", "=", "p", "[", "3", "]", ",", "members", "=", "p", "[", "5", "]", ")" ]
Interface : interface IDENTIFIER Inheritance "{" InterfaceMembers "}" ";"
[ "Interface", ":", "interface", "IDENTIFIER", "Inheritance", "{", "InterfaceMembers", "}", ";" ]
python
train
41
dbcli/cli_helpers
cli_helpers/tabular_output/preprocessors.py
https://github.com/dbcli/cli_helpers/blob/3ebd891ac0c02bad061182dbcb54a47fb21980ae/cli_helpers/tabular_output/preprocessors.py#L233-L266
def format_numbers(data, headers, column_types=(), integer_format=None, float_format=None, **_): """Format numbers according to a format specification. This uses Python's format specification to format numbers of the following types: :class:`int`, :class:`py2:long` (Python 2), :class:`fl...
[ "def", "format_numbers", "(", "data", ",", "headers", ",", "column_types", "=", "(", ")", ",", "integer_format", "=", "None", ",", "float_format", "=", "None", ",", "*", "*", "_", ")", ":", "if", "(", "integer_format", "is", "None", "and", "float_format"...
Format numbers according to a format specification. This uses Python's format specification to format numbers of the following types: :class:`int`, :class:`py2:long` (Python 2), :class:`float`, and :class:`~decimal.Decimal`. See the :ref:`python:formatspec` for more information about the format strings...
[ "Format", "numbers", "according", "to", "a", "format", "specification", "." ]
python
test
44.382353
TriOptima/tri.table
lib/tri/table/__init__.py
https://github.com/TriOptima/tri.table/blob/fc38c02098a80a3fb336ac4cf502954d74e31484/lib/tri/table/__init__.py#L1450-L1521
def django_pre_2_0_table_context( request, table, links=None, paginate_by=None, page=None, extra_context=None, paginator=None, show_hits=False, hit_label='Items'): """ :type table: Table """ if extra_context is None: # pragma: no c...
[ "def", "django_pre_2_0_table_context", "(", "request", ",", "table", ",", "links", "=", "None", ",", "paginate_by", "=", "None", ",", "page", "=", "None", ",", "extra_context", "=", "None", ",", "paginator", "=", "None", ",", "show_hits", "=", "False", ","...
:type table: Table
[ ":", "type", "table", ":", "Table" ]
python
train
29.277778
fastai/fastai
fastai/data_block.py
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/data_block.py#L717-L727
def transform_y(self, tfms:TfmList=None, **kwargs): "Set `tfms` to be applied to the targets only." _check_kwargs(self.y, tfms, **kwargs) self.tfm_y=True if tfms is None: self.tfms_y = list(filter(lambda t: t.use_on_y, listify(self.tfms))) self.tfmargs_y = {**self...
[ "def", "transform_y", "(", "self", ",", "tfms", ":", "TfmList", "=", "None", ",", "*", "*", "kwargs", ")", ":", "_check_kwargs", "(", "self", ".", "y", ",", "tfms", ",", "*", "*", "kwargs", ")", "self", ".", "tfm_y", "=", "True", "if", "tfms", "i...
Set `tfms` to be applied to the targets only.
[ "Set", "tfms", "to", "be", "applied", "to", "the", "targets", "only", "." ]
python
train
43.272727
gijzelaerr/python-snap7
snap7/client.py
https://github.com/gijzelaerr/python-snap7/blob/a6db134c7a3a2ef187b9eca04669221d6fc634c3/snap7/client.py#L329-L346
def get_block_info(self, blocktype, db_number): """Returns the block information for the specified block.""" blocktype = snap7.snap7types.block_types.get(blocktype) if not blocktype: raise Snap7Exception("The blocktype parameter was invalid") logger.debug("retrieving block...
[ "def", "get_block_info", "(", "self", ",", "blocktype", ",", "db_number", ")", ":", "blocktype", "=", "snap7", ".", "snap7types", ".", "block_types", ".", "get", "(", "blocktype", ")", "if", "not", "blocktype", ":", "raise", "Snap7Exception", "(", "\"The blo...
Returns the block information for the specified block.
[ "Returns", "the", "block", "information", "for", "the", "specified", "block", "." ]
python
train
33.444444
google/grr
grr/server/grr_response_server/blob_stores/memory_stream_bs.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/blob_stores/memory_stream_bs.py#L63-L75
def CheckBlobsExist(self, blob_ids): """Check if blobs for the given digests already exist.""" res = {blob_id: False for blob_id in blob_ids} urns = {self._BlobUrn(blob_id): blob_id for blob_id in blob_ids} existing = aff4.FACTORY.MultiOpen( urns, aff4_type=aff4.AFF4MemoryStreamBase, mode="r")...
[ "def", "CheckBlobsExist", "(", "self", ",", "blob_ids", ")", ":", "res", "=", "{", "blob_id", ":", "False", "for", "blob_id", "in", "blob_ids", "}", "urns", "=", "{", "self", ".", "_BlobUrn", "(", "blob_id", ")", ":", "blob_id", "for", "blob_id", "in",...
Check if blobs for the given digests already exist.
[ "Check", "if", "blobs", "for", "the", "given", "digests", "already", "exist", "." ]
python
train
29.538462
twisted/mantissa
xmantissa/liveform.py
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/liveform.py#L491-L508
def _extractCreations(self, dataSets): """ Find the elements of C{dataSets} which represent the creation of new objects. @param dataSets: C{list} of C{dict} mapping C{unicode} form submission keys to form submission values. @return: iterator of C{tuple}s with the fi...
[ "def", "_extractCreations", "(", "self", ",", "dataSets", ")", ":", "for", "dataSet", "in", "dataSets", ":", "modelObject", "=", "self", ".", "_objectFromID", "(", "dataSet", "[", "self", ".", "_IDENTIFIER_KEY", "]", ")", "if", "modelObject", "is", "self", ...
Find the elements of C{dataSets} which represent the creation of new objects. @param dataSets: C{list} of C{dict} mapping C{unicode} form submission keys to form submission values. @return: iterator of C{tuple}s with the first element giving the opaque identifier of an ...
[ "Find", "the", "elements", "of", "C", "{", "dataSets", "}", "which", "represent", "the", "creation", "of", "new", "objects", "." ]
python
train
44.666667
saltstack/salt
salt/modules/postgres.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L2677-L2685
def _mod_defpriv_opts(object_type, defprivileges): ''' Format options ''' object_type = object_type.lower() defprivileges = '' if defprivileges is None else defprivileges _defprivs = re.split(r'\s?,\s?', defprivileges.upper()) return object_type, defprivileges, _defprivs
[ "def", "_mod_defpriv_opts", "(", "object_type", ",", "defprivileges", ")", ":", "object_type", "=", "object_type", ".", "lower", "(", ")", "defprivileges", "=", "''", "if", "defprivileges", "is", "None", "else", "defprivileges", "_defprivs", "=", "re", ".", "s...
Format options
[ "Format", "options" ]
python
train
32.444444
brean/python-pathfinding
pathfinding/core/grid.py
https://github.com/brean/python-pathfinding/blob/b857bf85e514a1712b40e29ccb5a473cd7fd5c80/pathfinding/core/grid.py#L70-L74
def walkable(self, x, y): """ check, if the tile is inside grid and if it is set as walkable """ return self.inside(x, y) and self.nodes[y][x].walkable
[ "def", "walkable", "(", "self", ",", "x", ",", "y", ")", ":", "return", "self", ".", "inside", "(", "x", ",", "y", ")", "and", "self", ".", "nodes", "[", "y", "]", "[", "x", "]", ".", "walkable" ]
check, if the tile is inside grid and if it is set as walkable
[ "check", "if", "the", "tile", "is", "inside", "grid", "and", "if", "it", "is", "set", "as", "walkable" ]
python
train
35.8
crocs-muni/roca
roca/detect.py
https://github.com/crocs-muni/roca/blob/74ad6ce63c428d83dcffce9c5e26ef7b9e30faa5/roca/detect.py#L1246-L1280
def process_pem(self, data, name): """ PEM processing - splitting further by the type of the records :param data: :param name: :return: """ try: ret = [] data = to_string(data) parts = re.split(r'-----BEGIN', data) i...
[ "def", "process_pem", "(", "self", ",", "data", ",", "name", ")", ":", "try", ":", "ret", "=", "[", "]", "data", "=", "to_string", "(", "data", ")", "parts", "=", "re", ".", "split", "(", "r'-----BEGIN'", ",", "data", ")", "if", "len", "(", "part...
PEM processing - splitting further by the type of the records :param data: :param name: :return:
[ "PEM", "processing", "-", "splitting", "further", "by", "the", "type", "of", "the", "records", ":", "param", "data", ":", ":", "param", "name", ":", ":", "return", ":" ]
python
train
34.857143
RedHatInsights/insights-core
insights/parsers/mdstat.py
https://github.com/RedHatInsights/insights-core/blob/b57cbf8ed7c089672426ede0441e0a4f789ef4a1/insights/parsers/mdstat.py#L344-L377
def apply_upstring(upstring, component_list): """Update the dictionaries resulting from ``parse_array_start`` with the "up" key based on the upstring returned from ``parse_upstring``. The function assumes that the upstring and component_list parameters passed in are from the same device array stanza of...
[ "def", "apply_upstring", "(", "upstring", ",", "component_list", ")", ":", "assert", "len", "(", "upstring", ")", "==", "len", "(", "component_list", ")", "def", "add_up_key", "(", "comp_dict", ",", "up_indicator", ")", ":", "assert", "up_indicator", "==", "...
Update the dictionaries resulting from ``parse_array_start`` with the "up" key based on the upstring returned from ``parse_upstring``. The function assumes that the upstring and component_list parameters passed in are from the same device array stanza of a ``/proc/mdstat`` file. The function modif...
[ "Update", "the", "dictionaries", "resulting", "from", "parse_array_start", "with", "the", "up", "key", "based", "on", "the", "upstring", "returned", "from", "parse_upstring", "." ]
python
train
36.735294
TkTech/Jawa
jawa/util/bytecode.py
https://github.com/TkTech/Jawa/blob/94c8424e699029ac33fbc0e866fff0ecb2742289/jawa/util/bytecode.py#L262-L293
def load_bytecode_definitions(*, path=None) -> dict: """Load bytecode definitions from JSON file. If no path is provided the default bytecode.json will be loaded. :param path: Either None or a path to a JSON file to load containing bytecode definitions. """ if path is not None: ...
[ "def", "load_bytecode_definitions", "(", "*", ",", "path", "=", "None", ")", "->", "dict", ":", "if", "path", "is", "not", "None", ":", "with", "open", "(", "path", ",", "'rb'", ")", "as", "file_in", ":", "j", "=", "json", ".", "load", "(", "file_i...
Load bytecode definitions from JSON file. If no path is provided the default bytecode.json will be loaded. :param path: Either None or a path to a JSON file to load containing bytecode definitions.
[ "Load", "bytecode", "definitions", "from", "JSON", "file", "." ]
python
train
37.9375
materialsproject/pymatgen
pymatgen/io/abinit/pseudos.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/pseudos.py#L1826-L1828
def sort_by_z(self): """Return a new :class:`PseudoTable` with pseudos sorted by Z""" return self.__class__(sorted(self, key=lambda p: p.Z))
[ "def", "sort_by_z", "(", "self", ")", ":", "return", "self", ".", "__class__", "(", "sorted", "(", "self", ",", "key", "=", "lambda", "p", ":", "p", ".", "Z", ")", ")" ]
Return a new :class:`PseudoTable` with pseudos sorted by Z
[ "Return", "a", "new", ":", "class", ":", "PseudoTable", "with", "pseudos", "sorted", "by", "Z" ]
python
train
51.333333
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L472-L478
def scroll_to_beginning_vertically(self, steps=10, *args,**selectors): """ Scroll the object which has *selectors* attributes to *beginning* vertically. See `Scroll Forward Vertically` for more details. """ return self.device(**selectors).scroll.vert.toBeginning(steps=steps)
[ "def", "scroll_to_beginning_vertically", "(", "self", ",", "steps", "=", "10", ",", "*", "args", ",", "*", "*", "selectors", ")", ":", "return", "self", ".", "device", "(", "*", "*", "selectors", ")", ".", "scroll", ".", "vert", ".", "toBeginning", "("...
Scroll the object which has *selectors* attributes to *beginning* vertically. See `Scroll Forward Vertically` for more details.
[ "Scroll", "the", "object", "which", "has", "*", "selectors", "*", "attributes", "to", "*", "beginning", "*", "vertically", "." ]
python
train
44.285714
dmwm/DBS
Server/Python/src/dbs/business/DBSPrimaryDataset.py
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/business/DBSPrimaryDataset.py#L29-L40
def listPrimaryDatasets(self, primary_ds_name="", primary_ds_type=""): """ Returns all primary dataset if primary_ds_name or primary_ds_type are not passed. """ conn = self.dbi.connection() try: result = self.primdslist.execute(conn, primary_ds_name, primary_ds_type) ...
[ "def", "listPrimaryDatasets", "(", "self", ",", "primary_ds_name", "=", "\"\"", ",", "primary_ds_type", "=", "\"\"", ")", ":", "conn", "=", "self", ".", "dbi", ".", "connection", "(", ")", "try", ":", "result", "=", "self", ".", "primdslist", ".", "execu...
Returns all primary dataset if primary_ds_name or primary_ds_type are not passed.
[ "Returns", "all", "primary", "dataset", "if", "primary_ds_name", "or", "primary_ds_type", "are", "not", "passed", "." ]
python
train
36.25
QInfer/python-qinfer
src/qinfer/utils.py
https://github.com/QInfer/python-qinfer/blob/8170c84a0be1723f8c6b09e0d3c7a40a886f1fe3/src/qinfer/utils.py#L683-L688
def binom_est_error(p, N, hedge = float(0)): r""" """ # asymptotic np.sqrt(p * (1 - p) / N) return np.sqrt(p*(1-p)/(N+2*hedge+1))
[ "def", "binom_est_error", "(", "p", ",", "N", ",", "hedge", "=", "float", "(", "0", ")", ")", ":", "# asymptotic np.sqrt(p * (1 - p) / N)", "return", "np", ".", "sqrt", "(", "p", "*", "(", "1", "-", "p", ")", "/", "(", "N", "+", "2", "*", "hedge", ...
r"""
[ "r" ]
python
train
23.5
ranaroussi/ezibpy
ezibpy/ezibpy.py
https://github.com/ranaroussi/ezibpy/blob/1a9d4bf52018abd2a01af7c991d7cf00cda53e0c/ezibpy/ezibpy.py#L1944-L1951
def requestPositionUpdates(self, subscribe=True): """ Request/cancel request real-time position data for all accounts. """ if self.subscribePositions != subscribe: self.subscribePositions = subscribe if subscribe == True: self.ibConn.reqPositions() els...
[ "def", "requestPositionUpdates", "(", "self", ",", "subscribe", "=", "True", ")", ":", "if", "self", ".", "subscribePositions", "!=", "subscribe", ":", "self", ".", "subscribePositions", "=", "subscribe", "if", "subscribe", "==", "True", ":", "self", ".", "i...
Request/cancel request real-time position data for all accounts.
[ "Request", "/", "cancel", "request", "real", "-", "time", "position", "data", "for", "all", "accounts", "." ]
python
train
45.125
turicas/rows
rows/operations.py
https://github.com/turicas/rows/blob/c74da41ae9ed091356b803a64f8a30c641c5fc45/rows/operations.py#L56-L65
def transform(fields, function, *tables): "Return a new table based on other tables and a transformation function" new_table = Table(fields=fields) for table in tables: for row in filter(bool, map(lambda row: function(row, table), table)): new_table.append(row) return new_table
[ "def", "transform", "(", "fields", ",", "function", ",", "*", "tables", ")", ":", "new_table", "=", "Table", "(", "fields", "=", "fields", ")", "for", "table", "in", "tables", ":", "for", "row", "in", "filter", "(", "bool", ",", "map", "(", "lambda",...
Return a new table based on other tables and a transformation function
[ "Return", "a", "new", "table", "based", "on", "other", "tables", "and", "a", "transformation", "function" ]
python
train
30.8
openego/eDisGo
edisgo/flex_opt/check_tech_constraints.py
https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/flex_opt/check_tech_constraints.py#L156-L190
def hv_mv_station_load(network): """ Checks for over-loading of HV/MV station. Parameters ---------- network : :class:`~.grid.network.Network` Returns ------- :pandas:`pandas.DataFrame<dataframe>` Dataframe containing over-loaded HV/MV stations, their apparent power at ...
[ "def", "hv_mv_station_load", "(", "network", ")", ":", "crit_stations", "=", "pd", ".", "DataFrame", "(", ")", "crit_stations", "=", "_station_load", "(", "network", ",", "network", ".", "mv_grid", ".", "station", ",", "crit_stations", ")", "if", "not", "cri...
Checks for over-loading of HV/MV station. Parameters ---------- network : :class:`~.grid.network.Network` Returns ------- :pandas:`pandas.DataFrame<dataframe>` Dataframe containing over-loaded HV/MV stations, their apparent power at maximal over-loading and the corresponding ti...
[ "Checks", "for", "over", "-", "loading", "of", "HV", "/", "MV", "station", "." ]
python
train
35.657143
myyang/django-unixtimestampfield
unixtimestampfield/fields.py
https://github.com/myyang/django-unixtimestampfield/blob/d647681cd628d1a5cdde8dcbb025bcb9612e9b24/unixtimestampfield/fields.py#L153-L163
def to_utc_datetime(self, value): """ from value to datetime with tzinfo format (datetime.datetime instance) """ value = self.to_naive_datetime(value) if timezone.is_naive(value): value = timezone.make_aware(value, timezone.utc) else: value = time...
[ "def", "to_utc_datetime", "(", "self", ",", "value", ")", ":", "value", "=", "self", ".", "to_naive_datetime", "(", "value", ")", "if", "timezone", ".", "is_naive", "(", "value", ")", ":", "value", "=", "timezone", ".", "make_aware", "(", "value", ",", ...
from value to datetime with tzinfo format (datetime.datetime instance)
[ "from", "value", "to", "datetime", "with", "tzinfo", "format", "(", "datetime", ".", "datetime", "instance", ")" ]
python
train
33.272727
mojaie/chorus
chorus/util/geometry.py
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/util/geometry.py#L163-L190
def is_clockwise(vertices): """ Evaluate whether vertices are in clockwise order. Args: vertices: list of vertices (x, y) in polygon. Returns: True: clockwise, False: counter-clockwise Raises: ValueError: the polygon is complex or overlapped. """ it = iterator.consecutive(cycle...
[ "def", "is_clockwise", "(", "vertices", ")", ":", "it", "=", "iterator", ".", "consecutive", "(", "cycle", "(", "vertices", ")", ",", "3", ")", "clockwise", "=", "0", "counter", "=", "0", "for", "_", "in", "range", "(", "len", "(", "vertices", ")", ...
Evaluate whether vertices are in clockwise order. Args: vertices: list of vertices (x, y) in polygon. Returns: True: clockwise, False: counter-clockwise Raises: ValueError: the polygon is complex or overlapped.
[ "Evaluate", "whether", "vertices", "are", "in", "clockwise", "order", ".", "Args", ":", "vertices", ":", "list", "of", "vertices", "(", "x", "y", ")", "in", "polygon", ".", "Returns", ":", "True", ":", "clockwise", "False", ":", "counter", "-", "clockwis...
python
train
33
Chilipp/psyplot
psyplot/data.py
https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L3384-L3398
def copy(self, deep=False): """Returns a copy of the list Parameters ---------- deep: bool If False (default), only the list is copied and not the contained arrays, otherwise the contained arrays are deep copied""" if not deep: return self.__c...
[ "def", "copy", "(", "self", ",", "deep", "=", "False", ")", ":", "if", "not", "deep", ":", "return", "self", ".", "__class__", "(", "self", "[", ":", "]", ",", "attrs", "=", "self", ".", "attrs", ".", "copy", "(", ")", ",", "auto_update", "=", ...
Returns a copy of the list Parameters ---------- deep: bool If False (default), only the list is copied and not the contained arrays, otherwise the contained arrays are deep copied
[ "Returns", "a", "copy", "of", "the", "list" ]
python
train
40.466667
ncclient/ncclient
ncclient/operations/third_party/hpcomware/rpc.py
https://github.com/ncclient/ncclient/blob/2b75f2c6a06bd2a5d1be67b01bb65c5ffd2e2d7a/ncclient/operations/third_party/hpcomware/rpc.py#L7-L22
def request(self, cmds): """ Single Execution element is permitted. cmds can be a list or single command """ if isinstance(cmds, list): cmd = '\n'.join(cmds) elif isinstance(cmds, str) or isinstance(cmds, unicode): cmd = cmds node = etree....
[ "def", "request", "(", "self", ",", "cmds", ")", ":", "if", "isinstance", "(", "cmds", ",", "list", ")", ":", "cmd", "=", "'\\n'", ".", "join", "(", "cmds", ")", "elif", "isinstance", "(", "cmds", ",", "str", ")", "or", "isinstance", "(", "cmds", ...
Single Execution element is permitted. cmds can be a list or single command
[ "Single", "Execution", "element", "is", "permitted", ".", "cmds", "can", "be", "a", "list", "or", "single", "command" ]
python
train
30.875
robotools/fontParts
Lib/fontParts/base/glyph.py
https://github.com/robotools/fontParts/blob/d2ff106fe95f9d566161d936a645157626568712/Lib/fontParts/base/glyph.py#L1717-L1758
def interpolate(self, factor, minGlyph, maxGlyph, round=True, suppressError=True): """ Interpolate the contents of this glyph at location ``factor`` in a linear interpolation between ``minGlyph`` and ``maxGlyph``. >>> glyph.interpolate(0.5, otherGlyph1, otherGlyp...
[ "def", "interpolate", "(", "self", ",", "factor", ",", "minGlyph", ",", "maxGlyph", ",", "round", "=", "True", ",", "suppressError", "=", "True", ")", ":", "factor", "=", "normalizers", ".", "normalizeInterpolationFactor", "(", "factor", ")", "if", "not", ...
Interpolate the contents of this glyph at location ``factor`` in a linear interpolation between ``minGlyph`` and ``maxGlyph``. >>> glyph.interpolate(0.5, otherGlyph1, otherGlyph2) ``factor`` may be a :ref:`type-int-float` or a tuple containing two :ref:`type-int-float` values repre...
[ "Interpolate", "the", "contents", "of", "this", "glyph", "at", "location", "factor", "in", "a", "linear", "interpolation", "between", "minGlyph", "and", "maxGlyph", "." ]
python
train
52.214286
Opentrons/opentrons
api/src/opentrons/server/rpc.py
https://github.com/Opentrons/opentrons/blob/a7c15cc2636ecb64ab56c7edc1d8a57163aaeadf/api/src/opentrons/server/rpc.py#L71-L80
async def on_shutdown(self, app): """ Graceful shutdown handler See https://docs.aiohttp.org/en/stable/web.html#graceful-shutdown """ for ws in self.clients.copy(): await ws.close(code=WSCloseCode.GOING_AWAY, message='Server shutdown') ...
[ "async", "def", "on_shutdown", "(", "self", ",", "app", ")", ":", "for", "ws", "in", "self", ".", "clients", ".", "copy", "(", ")", ":", "await", "ws", ".", "close", "(", "code", "=", "WSCloseCode", ".", "GOING_AWAY", ",", "message", "=", "'Server sh...
Graceful shutdown handler See https://docs.aiohttp.org/en/stable/web.html#graceful-shutdown
[ "Graceful", "shutdown", "handler" ]
python
train
33
soimort/you-get
src/you_get/extractors/youtube.py
https://github.com/soimort/you-get/blob/b746ac01c9f39de94cac2d56f665285b0523b974/src/you_get/extractors/youtube.py#L135-L143
def get_vid_from_url(url): """Extracts video ID from URL. """ return match1(url, r'youtu\.be/([^?/]+)') or \ match1(url, r'youtube\.com/embed/([^/?]+)') or \ match1(url, r'youtube\.com/v/([^/?]+)') or \ match1(url, r'youtube\.com/watch/([^/?]+)') or \ pars...
[ "def", "get_vid_from_url", "(", "url", ")", ":", "return", "match1", "(", "url", ",", "r'youtu\\.be/([^?/]+)'", ")", "or", "match1", "(", "url", ",", "r'youtube\\.com/embed/([^/?]+)'", ")", "or", "match1", "(", "url", ",", "r'youtube\\.com/v/([^/?]+)'", ")", "or...
Extracts video ID from URL.
[ "Extracts", "video", "ID", "from", "URL", "." ]
python
test
44.666667
rootpy/rootpy
rootpy/stats/histfactory/histfactory.py
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/stats/histfactory/histfactory.py#L249-L258
def sys_names(self): """ Return a list of unique systematic names from OverallSys and HistoSys """ names = {} for osys in self.overall_sys: names[osys.name] = None for hsys in self.histo_sys: names[hsys.name] = None return names.keys()
[ "def", "sys_names", "(", "self", ")", ":", "names", "=", "{", "}", "for", "osys", "in", "self", ".", "overall_sys", ":", "names", "[", "osys", ".", "name", "]", "=", "None", "for", "hsys", "in", "self", ".", "histo_sys", ":", "names", "[", "hsys", ...
Return a list of unique systematic names from OverallSys and HistoSys
[ "Return", "a", "list", "of", "unique", "systematic", "names", "from", "OverallSys", "and", "HistoSys" ]
python
train
30.6
apache/airflow
airflow/contrib/hooks/gcp_container_hook.py
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_container_hook.py#L221-L247
def get_cluster(self, name, project_id=None, retry=DEFAULT, timeout=DEFAULT): """ Gets details of specified cluster :param name: The name of the cluster to retrieve :type name: str :param project_id: Google Cloud Platform project ID :type project_id: str :param r...
[ "def", "get_cluster", "(", "self", ",", "name", ",", "project_id", "=", "None", ",", "retry", "=", "DEFAULT", ",", "timeout", "=", "DEFAULT", ")", ":", "self", ".", "log", ".", "info", "(", "\"Fetching cluster (project_id=%s, zone=%s, cluster_name=%s)\"", ",", ...
Gets details of specified cluster :param name: The name of the cluster to retrieve :type name: str :param project_id: Google Cloud Platform project ID :type project_id: str :param retry: A retry object used to retry requests. If None is specified, requests will not b...
[ "Gets", "details", "of", "specified", "cluster" ]
python
test
46.740741
pre-commit/pre-commit
pre_commit/store.py
https://github.com/pre-commit/pre-commit/blob/72f98d26e690da11dc2e41861d14c58eb21930cb/pre_commit/store.py#L145-L154
def _shallow_clone(self, ref, git_cmd): # pragma: windows no cover """Perform a shallow clone of a repository and its submodules """ git_config = 'protocol.version=2' git_cmd('-c', git_config, 'fetch', 'origin', ref, '--depth=1') git_cmd('checkout', ref) git_cmd( '-...
[ "def", "_shallow_clone", "(", "self", ",", "ref", ",", "git_cmd", ")", ":", "# pragma: windows no cover", "git_config", "=", "'protocol.version=2'", "git_cmd", "(", "'-c'", ",", "git_config", ",", "'fetch'", ",", "'origin'", ",", "ref", ",", "'--depth=1'", ")", ...
Perform a shallow clone of a repository and its submodules
[ "Perform", "a", "shallow", "clone", "of", "a", "repository", "and", "its", "submodules" ]
python
train
40.9
ThreatConnect-Inc/tcex
tcex/tcex_args.py
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_args.py#L195-L237
def inject_params(self, params): """Inject params into sys.argv from secureParams API, AOT, or user provided. Args: params (dict): A dictionary containing all parameters that need to be injected as args. """ for arg, value in params.items(): cli_arg = '--{}'.for...
[ "def", "inject_params", "(", "self", ",", "params", ")", ":", "for", "arg", ",", "value", "in", "params", ".", "items", "(", ")", ":", "cli_arg", "=", "'--{}'", ".", "format", "(", "arg", ")", "if", "cli_arg", "in", "sys", ".", "argv", ":", "# arg ...
Inject params into sys.argv from secureParams API, AOT, or user provided. Args: params (dict): A dictionary containing all parameters that need to be injected as args.
[ "Inject", "params", "into", "sys", ".", "argv", "from", "secureParams", "API", "AOT", "or", "user", "provided", "." ]
python
train
47.046512
ThreatConnect-Inc/tcex
tcex/tcex_request.py
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_request.py#L256-L289
def send(self, stream=False): """Send the HTTP request via Python Requests modules. This method will send the request to the remote endpoint. It will try to handle temporary communications issues by retrying the request automatically. Args: stream (bool): Boolean to enable...
[ "def", "send", "(", "self", ",", "stream", "=", "False", ")", ":", "#", "# api request (gracefully handle temporary communications issues with the API)", "#", "try", ":", "response", "=", "self", ".", "session", ".", "request", "(", "self", ".", "_http_method", ",...
Send the HTTP request via Python Requests modules. This method will send the request to the remote endpoint. It will try to handle temporary communications issues by retrying the request automatically. Args: stream (bool): Boolean to enable stream download. Returns: ...
[ "Send", "the", "HTTP", "request", "via", "Python", "Requests", "modules", "." ]
python
train
35.235294
cloudnull/cloudlib
cloudlib/package_installer.py
https://github.com/cloudnull/cloudlib/blob/5038111ce02521caa2558117e3bae9e1e806d315/cloudlib/package_installer.py#L41-L55
def distro_check(): """Return a string containing the distro package manager.""" distro_data = platform.linux_distribution() distro = [d.lower() for d in distro_data if d.isalpha()] if any(['ubuntu' in distro, 'debian' in distro]) is True: return 'apt' elif any(['centos' in distro, 'redhat'...
[ "def", "distro_check", "(", ")", ":", "distro_data", "=", "platform", ".", "linux_distribution", "(", ")", "distro", "=", "[", "d", ".", "lower", "(", ")", "for", "d", "in", "distro_data", "if", "d", ".", "isalpha", "(", ")", "]", "if", "any", "(", ...
Return a string containing the distro package manager.
[ "Return", "a", "string", "containing", "the", "distro", "package", "manager", "." ]
python
train
34.466667
ajyoon/blur
blur/markov/node.py
https://github.com/ajyoon/blur/blob/25fcf083af112bb003956a7a7e1c6ff7d8fef279/blur/markov/node.py#L173-L198
def add_link_to_self(self, source, weight): """ Create and add a ``Link`` from a source node to ``self``. Args: source (Node): The node that will own the new ``Link`` pointing to ``self`` weight (int or float): The weight of the newly created ``Link`` ...
[ "def", "add_link_to_self", "(", "self", ",", "source", ",", "weight", ")", ":", "# Generalize source to a list to simplify code", "if", "not", "isinstance", "(", "source", ",", "list", ")", ":", "source", "=", "[", "source", "]", "for", "source_node", "in", "s...
Create and add a ``Link`` from a source node to ``self``. Args: source (Node): The node that will own the new ``Link`` pointing to ``self`` weight (int or float): The weight of the newly created ``Link`` Returns: None Example: >>> node_1 = N...
[ "Create", "and", "add", "a", "Link", "from", "a", "source", "node", "to", "self", "." ]
python
train
36.076923
getnikola/coil
coil/web.py
https://github.com/getnikola/coil/blob/80ef1827460b0691cf2c98351a14d88e235c9899/coil/web.py#L318-L326
def _author_uid_get(post): """Get the UID of the post author. :param Post post: The post object to determine authorship of :return: Author UID :rtype: str """ u = post.meta('author.uid') return u if u else str(current_user.uid)
[ "def", "_author_uid_get", "(", "post", ")", ":", "u", "=", "post", ".", "meta", "(", "'author.uid'", ")", "return", "u", "if", "u", "else", "str", "(", "current_user", ".", "uid", ")" ]
Get the UID of the post author. :param Post post: The post object to determine authorship of :return: Author UID :rtype: str
[ "Get", "the", "UID", "of", "the", "post", "author", "." ]
python
train
27.555556
jazzband/django-pipeline
pipeline/compressors/__init__.py
https://github.com/jazzband/django-pipeline/blob/3cd2f93bb47bf8d34447e13ff691f7027e7b07a2/pipeline/compressors/__init__.py#L73-L84
def compress_css(self, paths, output_filename, variant=None, **kwargs): """Concatenate and compress CSS files""" css = self.concatenate_and_rewrite(paths, output_filename, variant) compressor = self.css_compressor if compressor: css = getattr(compressor(verbose=self.verbose),...
[ "def", "compress_css", "(", "self", ",", "paths", ",", "output_filename", ",", "variant", "=", "None", ",", "*", "*", "kwargs", ")", ":", "css", "=", "self", ".", "concatenate_and_rewrite", "(", "paths", ",", "output_filename", ",", "variant", ")", "compre...
Concatenate and compress CSS files
[ "Concatenate", "and", "compress", "CSS", "files" ]
python
train
45.5
Arkq/flake8-requirements
src/flake8_requirements/checker.py
https://github.com/Arkq/flake8-requirements/blob/d7cb84af2429a63635528b531111a5da527bf2d1/src/flake8_requirements/checker.py#L34-L40
def memoize(f): """Cache value returned by the function.""" @wraps(f) def w(*args, **kw): memoize.mem[f] = v = f(*args, **kw) return v return w
[ "def", "memoize", "(", "f", ")", ":", "@", "wraps", "(", "f", ")", "def", "w", "(", "*", "args", ",", "*", "*", "kw", ")", ":", "memoize", ".", "mem", "[", "f", "]", "=", "v", "=", "f", "(", "*", "args", ",", "*", "*", "kw", ")", "retur...
Cache value returned by the function.
[ "Cache", "value", "returned", "by", "the", "function", "." ]
python
train
24.142857
nion-software/nionswift-io
nionswift_plugin/TIFF_IO/tifffile.py
https://github.com/nion-software/nionswift-io/blob/e9ae37f01faa9332c48b647f93afd5ef2166b155/nionswift_plugin/TIFF_IO/tifffile.py#L2435-L2446
def _series_fluoview(self): """Return image series in FluoView file.""" pages = self.pages._getlist(validate=False) mm = self.fluoview_metadata mmhd = list(reversed(mm['Dimensions'])) axes = ''.join(TIFF.MM_DIMENSIONS.get(i[0].upper(), 'Q') for i in mmhd i...
[ "def", "_series_fluoview", "(", "self", ")", ":", "pages", "=", "self", ".", "pages", ".", "_getlist", "(", "validate", "=", "False", ")", "mm", "=", "self", ".", "fluoview_metadata", "mmhd", "=", "list", "(", "reversed", "(", "mm", "[", "'Dimensions'", ...
Return image series in FluoView file.
[ "Return", "image", "series", "in", "FluoView", "file", "." ]
python
train
45.666667
hugapi/hug
hug/introspect.py
https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/introspect.py#L43-L48
def arguments(function, extra_arguments=0): """Returns the name of all arguments a function takes""" if not hasattr(function, '__code__'): return () return function.__code__.co_varnames[:function.__code__.co_argcount + extra_arguments]
[ "def", "arguments", "(", "function", ",", "extra_arguments", "=", "0", ")", ":", "if", "not", "hasattr", "(", "function", ",", "'__code__'", ")", ":", "return", "(", ")", "return", "function", ".", "__code__", ".", "co_varnames", "[", ":", "function", "....
Returns the name of all arguments a function takes
[ "Returns", "the", "name", "of", "all", "arguments", "a", "function", "takes" ]
python
train
41.833333
opennode/waldur-core
waldur_core/core/admin.py
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/core/admin.py#L325-L342
def changelist_view(self, request, extra_context=None): """ Inject extra links into template context. """ links = [] for action in self.get_extra_actions(): links.append({ 'label': self._get_action_label(action), 'href': self._get_acti...
[ "def", "changelist_view", "(", "self", ",", "request", ",", "extra_context", "=", "None", ")", ":", "links", "=", "[", "]", "for", "action", "in", "self", ".", "get_extra_actions", "(", ")", ":", "links", ".", "append", "(", "{", "'label'", ":", "self"...
Inject extra links into template context.
[ "Inject", "extra", "links", "into", "template", "context", "." ]
python
train
30.388889
offu/WeRoBot
werobot/client.py
https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L713-L726
def get_followers(self, first_user_id=None): """ 获取关注者列表 详情请参考 http://mp.weixin.qq.com/wiki/index.php?title=获取关注者列表 :param first_user_id: 可选。第一个拉取的OPENID,不填默认从头开始拉取 :return: 返回的 JSON 数据包 """ params = {"access_token": self.token} if first_user_id: ...
[ "def", "get_followers", "(", "self", ",", "first_user_id", "=", "None", ")", ":", "params", "=", "{", "\"access_token\"", ":", "self", ".", "token", "}", "if", "first_user_id", ":", "params", "[", "\"next_openid\"", "]", "=", "first_user_id", "return", "self...
获取关注者列表 详情请参考 http://mp.weixin.qq.com/wiki/index.php?title=获取关注者列表 :param first_user_id: 可选。第一个拉取的OPENID,不填默认从头开始拉取 :return: 返回的 JSON 数据包
[ "获取关注者列表", "详情请参考", "http", ":", "//", "mp", ".", "weixin", ".", "qq", ".", "com", "/", "wiki", "/", "index", ".", "php?title", "=", "获取关注者列表" ]
python
train
32.5
non-Jedi/gyr
gyr/matrix_objects.py
https://github.com/non-Jedi/gyr/blob/9f7bfe033b9d3bbfd3a9e8aea02e35526b53125e/gyr/matrix_objects.py#L274-L277
def refresh_rooms(self): """Calls GET /joined_rooms to refresh rooms list.""" for room_id in self.user_api.get_joined_rooms()["joined_rooms"]: self._rooms[room_id] = MatrixRoom(room_id, self.user_api)
[ "def", "refresh_rooms", "(", "self", ")", ":", "for", "room_id", "in", "self", ".", "user_api", ".", "get_joined_rooms", "(", ")", "[", "\"joined_rooms\"", "]", ":", "self", ".", "_rooms", "[", "room_id", "]", "=", "MatrixRoom", "(", "room_id", ",", "sel...
Calls GET /joined_rooms to refresh rooms list.
[ "Calls", "GET", "/", "joined_rooms", "to", "refresh", "rooms", "list", "." ]
python
train
56.25
junzis/pyModeS
pyModeS/decoder/bds/__init__.py
https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/decoder/bds/__init__.py#L92-L154
def infer(msg, mrar=False): """Estimate the most likely BDS code of an message. Args: msg (String): 28 bytes hexadecimal message string mrar (bool): Also infer MRAR (BDS 44) and MHR (BDS 45). Defaults to False. Returns: String or None: BDS version, or possible versions, or None if ...
[ "def", "infer", "(", "msg", ",", "mrar", "=", "False", ")", ":", "df", "=", "common", ".", "df", "(", "msg", ")", "if", "common", ".", "allzeros", "(", "msg", ")", ":", "return", "'EMPTY'", "# For ADS-B / Mode-S extended squitter", "if", "df", "==", "1...
Estimate the most likely BDS code of an message. Args: msg (String): 28 bytes hexadecimal message string mrar (bool): Also infer MRAR (BDS 44) and MHR (BDS 45). Defaults to False. Returns: String or None: BDS version, or possible versions, or None if nothing matches.
[ "Estimate", "the", "most", "likely", "BDS", "code", "of", "an", "message", "." ]
python
train
29.380952
saltstack/salt
salt/modules/smartos_vmadm.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L752-L790
def update(vm, from_file=None, key='uuid', **kwargs): ''' Update a new vm vm : string vm to be updated from_file : string json file to update the vm with -- if present, all other options will be ignored key : string [uuid|alias|hostname] value type of 'vm' parameter kwar...
[ "def", "update", "(", "vm", ",", "from_file", "=", "None", ",", "key", "=", "'uuid'", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "}", "# prepare vmcfg", "vmcfg", "=", "{", "}", "kwargs", "=", "salt", ".", "utils", ".", "args", ".", "clea...
Update a new vm vm : string vm to be updated from_file : string json file to update the vm with -- if present, all other options will be ignored key : string [uuid|alias|hostname] value type of 'vm' parameter kwargs : string|int|... options to update for the vm CLI ...
[ "Update", "a", "new", "vm" ]
python
train
31.358974
getnikola/coil
coil/tasks.py
https://github.com/getnikola/coil/blob/80ef1827460b0691cf2c98351a14d88e235c9899/coil/tasks.py#L100-L119
def build_single(mode): """Build, in the single-user mode.""" if mode == 'force': amode = ['-a'] else: amode = [] if executable.endswith('uwsgi'): # hack, might fail in some environments! _executable = executable[:-5] + 'python' else: _executable = executable ...
[ "def", "build_single", "(", "mode", ")", ":", "if", "mode", "==", "'force'", ":", "amode", "=", "[", "'-a'", "]", "else", ":", "amode", "=", "[", "]", "if", "executable", ".", "endswith", "(", "'uwsgi'", ")", ":", "# hack, might fail in some environments!"...
Build, in the single-user mode.
[ "Build", "in", "the", "single", "-", "user", "mode", "." ]
python
train
30.55
ahopkins/sanic-jwt
sanic_jwt/authentication.py
https://github.com/ahopkins/sanic-jwt/blob/fca7750499c8cedde823d778512f613777fb5282/sanic_jwt/authentication.py#L422-L431
def extract_scopes(self, request): """ Extract scopes from a request object. """ payload = self.extract_payload(request) if not payload: return None scopes_attribute = self.config.scopes_name() return payload.get(scopes_attribute, None)
[ "def", "extract_scopes", "(", "self", ",", "request", ")", ":", "payload", "=", "self", ".", "extract_payload", "(", "request", ")", "if", "not", "payload", ":", "return", "None", "scopes_attribute", "=", "self", ".", "config", ".", "scopes_name", "(", ")"...
Extract scopes from a request object.
[ "Extract", "scopes", "from", "a", "request", "object", "." ]
python
train
29.6
UCL-INGI/INGInious
inginious/frontend/plugin_manager.py
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/plugin_manager.py#L52-L65
def register_auth_method(self, auth_method): """ Register a new authentication method name the name of the authentication method, typically displayed by the webapp input_to_display Only available after that the Plugin Manager is loaded "...
[ "def", "register_auth_method", "(", "self", ",", "auth_method", ")", ":", "if", "not", "self", ".", "_loaded", ":", "raise", "PluginManagerNotLoadedException", "(", ")", "self", ".", "_user_manager", ".", "register_auth_method", "(", "auth_method", ")" ]
Register a new authentication method name the name of the authentication method, typically displayed by the webapp input_to_display Only available after that the Plugin Manager is loaded
[ "Register", "a", "new", "authentication", "method" ]
python
train
32.214286
pydata/xarray
xarray/backends/api.py
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/backends/api.py#L404-L529
def open_dataarray(filename_or_obj, group=None, decode_cf=True, mask_and_scale=None, decode_times=True, autoclose=None, concat_characters=True, decode_coords=True, engine=None, chunks=None, lock=None, cache=None, drop_variables=None, backend_kw...
[ "def", "open_dataarray", "(", "filename_or_obj", ",", "group", "=", "None", ",", "decode_cf", "=", "True", ",", "mask_and_scale", "=", "None", ",", "decode_times", "=", "True", ",", "autoclose", "=", "None", ",", "concat_characters", "=", "True", ",", "decod...
Open an DataArray from a netCDF file containing a single data variable. This is designed to read netCDF files with only one data variable. If multiple variables are present then a ValueError is raised. Parameters ---------- filename_or_obj : str, Path, file or xarray.backends.*DataStore St...
[ "Open", "an", "DataArray", "from", "a", "netCDF", "file", "containing", "a", "single", "data", "variable", "." ]
python
train
50.555556
molmod/molmod
molmod/ic.py
https://github.com/molmod/molmod/blob/a7b5b4364ed514ad4c465856c05b5eda1cb561e0/molmod/ic.py#L651-L657
def _bend_cos_low(a, b, deriv): """Similar to bend_cos, but with relative vectors""" a = Vector3(6, deriv, a, (0, 1, 2)) b = Vector3(6, deriv, b, (3, 4, 5)) a /= a.norm() b /= b.norm() return dot(a, b).results()
[ "def", "_bend_cos_low", "(", "a", ",", "b", ",", "deriv", ")", ":", "a", "=", "Vector3", "(", "6", ",", "deriv", ",", "a", ",", "(", "0", ",", "1", ",", "2", ")", ")", "b", "=", "Vector3", "(", "6", ",", "deriv", ",", "b", ",", "(", "3", ...
Similar to bend_cos, but with relative vectors
[ "Similar", "to", "bend_cos", "but", "with", "relative", "vectors" ]
python
train
32.714286
mikicz/arca
arca/_arca.py
https://github.com/mikicz/arca/blob/e67fdc00be473ecf8ec16d024e1a3f2c47ca882c/arca/_arca.py#L168-L174
def get_path_to_repo(self, repo: str) -> Path: """ Returns a :class:`Path <pathlib.Path>` to the location where all the branches from this repo are stored. :param repo: Repo URL :return: Path to where branches from this repository are cloned. """ return Path(self.base_dir) / "re...
[ "def", "get_path_to_repo", "(", "self", ",", "repo", ":", "str", ")", "->", "Path", ":", "return", "Path", "(", "self", ".", "base_dir", ")", "/", "\"repos\"", "/", "self", ".", "repo_id", "(", "repo", ")" ]
Returns a :class:`Path <pathlib.Path>` to the location where all the branches from this repo are stored. :param repo: Repo URL :return: Path to where branches from this repository are cloned.
[ "Returns", "a", ":", "class", ":", "Path", "<pathlib", ".", "Path", ">", "to", "the", "location", "where", "all", "the", "branches", "from", "this", "repo", "are", "stored", "." ]
python
train
48.428571
gwpy/gwpy
gwpy/timeseries/io/hdf5.py
https://github.com/gwpy/gwpy/blob/7a92b917e7dd2d99b15895293a1fa1d66cdb210a/gwpy/timeseries/io/hdf5.py#L56-L75
def read_hdf5_dict(h5f, names=None, group=None, **kwargs): """Read a `TimeSeriesDict` from HDF5 """ # find group from which to read if group: h5g = h5f[group] else: h5g = h5f # find list of names to read if names is None: names = [key for key in h5g if _is_timeseries...
[ "def", "read_hdf5_dict", "(", "h5f", ",", "names", "=", "None", ",", "group", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# find group from which to read", "if", "group", ":", "h5g", "=", "h5f", "[", "group", "]", "else", ":", "h5g", "=", "h5f", ...
Read a `TimeSeriesDict` from HDF5
[ "Read", "a", "TimeSeriesDict", "from", "HDF5" ]
python
train
27.15
darkfeline/animanager
animanager/animecmd.py
https://github.com/darkfeline/animanager/blob/55d92e4cbdc12aac8ebe302420d2cff3fa9fa148/animanager/animecmd.py#L127-L132
def _connect(dbfile: 'PathLike') -> apsw.Connection: """Connect to SQLite database file.""" conn = apsw.Connection(os.fspath(dbfile)) _set_foreign_keys(conn, 1) assert _get_foreign_keys(conn) == 1 return conn
[ "def", "_connect", "(", "dbfile", ":", "'PathLike'", ")", "->", "apsw", ".", "Connection", ":", "conn", "=", "apsw", ".", "Connection", "(", "os", ".", "fspath", "(", "dbfile", ")", ")", "_set_foreign_keys", "(", "conn", ",", "1", ")", "assert", "_get_...
Connect to SQLite database file.
[ "Connect", "to", "SQLite", "database", "file", "." ]
python
train
37.166667
mdickinson/bigfloat
bigfloat/core.py
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L2210-L2223
def agm(x, y, context=None): """ Return the arithmetic geometric mean of x and y. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_agm, ( BigFloat._implicit_convert(x), BigFloat._implicit_convert(y), ), context, )
[ "def", "agm", "(", "x", ",", "y", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_agm", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", "BigFloat", ".", "...
Return the arithmetic geometric mean of x and y.
[ "Return", "the", "arithmetic", "geometric", "mean", "of", "x", "and", "y", "." ]
python
train
21.642857
Nic30/hwt
hwt/serializer/resourceAnalyzer/analyzer.py
https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/serializer/resourceAnalyzer/analyzer.py#L113-L163
def HWProcess(cls, proc: HWProcess, ctx: ResourceContext) -> None: """ Gues resource usage by HWProcess """ seen = ctx.seen for stm in proc.statements: encl = stm._enclosed_for full_ev_dep = stm._is_completly_event_dependent now_ev_dep = stm._n...
[ "def", "HWProcess", "(", "cls", ",", "proc", ":", "HWProcess", ",", "ctx", ":", "ResourceContext", ")", "->", "None", ":", "seen", "=", "ctx", ".", "seen", "for", "stm", "in", "proc", ".", "statements", ":", "encl", "=", "stm", ".", "_enclosed_for", ...
Gues resource usage by HWProcess
[ "Gues", "resource", "usage", "by", "HWProcess" ]
python
test
37.882353
pyviz/holoviews
holoviews/plotting/util.py
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/util.py#L485-L496
def save_frames(obj, filename, fmt=None, backend=None, options=None): """ Utility to export object to files frame by frame, numbered individually. Will use default backend and figure format by default. """ backend = Store.current_backend if backend is None else backend renderer = Store.renderers...
[ "def", "save_frames", "(", "obj", ",", "filename", ",", "fmt", "=", "None", ",", "backend", "=", "None", ",", "options", "=", "None", ")", ":", "backend", "=", "Store", ".", "current_backend", "if", "backend", "is", "None", "else", "backend", "renderer",...
Utility to export object to files frame by frame, numbered individually. Will use default backend and figure format by default.
[ "Utility", "to", "export", "object", "to", "files", "frame", "by", "frame", "numbered", "individually", ".", "Will", "use", "default", "backend", "and", "figure", "format", "by", "default", "." ]
python
train
46.083333
F5Networks/f5-common-python
f5/multi_device/device_group.py
https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/multi_device/device_group.py#L161-L172
def create(self, **kwargs): '''Create the device service cluster group and add devices to it.''' self._set_attributes(**kwargs) self._check_type() pollster(self._check_all_devices_in_sync)() dg = self.devices[0].tm.cm.device_groups.device_group dg.create(name=self.name, ...
[ "def", "create", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_set_attributes", "(", "*", "*", "kwargs", ")", "self", ".", "_check_type", "(", ")", "pollster", "(", "self", ".", "_check_all_devices_in_sync", ")", "(", ")", "dg", "=", ...
Create the device service cluster group and add devices to it.
[ "Create", "the", "device", "service", "cluster", "group", "and", "add", "devices", "to", "it", "." ]
python
train
44.25
Music-Moo/music2storage
music2storage/connection.py
https://github.com/Music-Moo/music2storage/blob/de12b9046dd227fc8c1512b5060e7f5fcd8b0ee2/music2storage/connection.py#L16-L34
def use_music_service(self, service_name, api_key): """ Sets the current music service to service_name. :param str service_name: Name of the music service :param str api_key: Optional API key if necessary """ try: self.current_music = self.music_services[ser...
[ "def", "use_music_service", "(", "self", ",", "service_name", ",", "api_key", ")", ":", "try", ":", "self", ".", "current_music", "=", "self", ".", "music_services", "[", "service_name", "]", "except", "KeyError", ":", "if", "service_name", "==", "'youtube'", ...
Sets the current music service to service_name. :param str service_name: Name of the music service :param str api_key: Optional API key if necessary
[ "Sets", "the", "current", "music", "service", "to", "service_name", "." ]
python
test
41.526316
rsgalloway/grit
grit/server/cherrypy/ssl_builtin.py
https://github.com/rsgalloway/grit/blob/e6434ad8a1f4ac5d0903ebad630c81f8a5164d78/grit/server/cherrypy/ssl_builtin.py#L57-L68
def get_environ(self, sock): """Create WSGI environ entries to be merged into each request.""" cipher = sock.cipher() ssl_environ = { "wsgi.url_scheme": "https", "HTTPS": "on", 'SSL_PROTOCOL': cipher[1], 'SSL_CIPHER': cipher[0] ## SSL_VE...
[ "def", "get_environ", "(", "self", ",", "sock", ")", ":", "cipher", "=", "sock", ".", "cipher", "(", ")", "ssl_environ", "=", "{", "\"wsgi.url_scheme\"", ":", "\"https\"", ",", "\"HTTPS\"", ":", "\"on\"", ",", "'SSL_PROTOCOL'", ":", "cipher", "[", "1", "...
Create WSGI environ entries to be merged into each request.
[ "Create", "WSGI", "environ", "entries", "to", "be", "merged", "into", "each", "request", "." ]
python
train
39.416667
expfactory/expfactory
expfactory/database/filesystem.py
https://github.com/expfactory/expfactory/blob/27ce6cc93e17231df8a8024f18e631336afd3501/expfactory/database/filesystem.py#L77-L99
def print_user(self, user): '''print a filesystem database user. A "database" folder that might end with the participant status (e.g. _finished) is extracted to print in format [folder] [identifier][studyid] /scif/data/expfactory/xxxx-xxxx xxxx-xxxx[studyid] ...
[ "def", "print_user", "(", "self", ",", "user", ")", ":", "status", "=", "\"active\"", "if", "user", ".", "endswith", "(", "'_finished'", ")", ":", "status", "=", "\"finished\"", "elif", "user", ".", "endswith", "(", "'_revoked'", ")", ":", "status", "=",...
print a filesystem database user. A "database" folder that might end with the participant status (e.g. _finished) is extracted to print in format [folder] [identifier][studyid] /scif/data/expfactory/xxxx-xxxx xxxx-xxxx[studyid]
[ "print", "a", "filesystem", "database", "user", ".", "A", "database", "folder", "that", "might", "end", "with", "the", "participant", "status", "(", "e", ".", "g", ".", "_finished", ")", "is", "extracted", "to", "print", "in", "format", "[", "folder", "]...
python
train
28.521739
asphalt-framework/asphalt
asphalt/core/event.py
https://github.com/asphalt-framework/asphalt/blob/4114b3ac9743cbd9facb374a3f53e19d3afef22d/asphalt/core/event.py#L127-L143
def disconnect(self, callback: Callable) -> None: """ Disconnects the given callback. The callback will no longer receive events from this signal. No action is taken if the callback is not on the list of listener callbacks. :param callback: the callable to remove """ ...
[ "def", "disconnect", "(", "self", ",", "callback", ":", "Callable", ")", "->", "None", ":", "assert", "check_argument_types", "(", ")", "try", ":", "if", "self", ".", "listeners", "is", "not", "None", ":", "self", ".", "listeners", ".", "remove", "(", ...
Disconnects the given callback. The callback will no longer receive events from this signal. No action is taken if the callback is not on the list of listener callbacks. :param callback: the callable to remove
[ "Disconnects", "the", "given", "callback", "." ]
python
train
28.764706
sphinx-gallery/sphinx-gallery
sphinx_gallery/downloads.py
https://github.com/sphinx-gallery/sphinx-gallery/blob/b0c1f6701bf3f4cef238757e1105cf3686b5e674/sphinx_gallery/downloads.py#L49-L78
def python_zip(file_list, gallery_path, extension='.py'): """Stores all files in file_list into an zip file Parameters ---------- file_list : list Holds all the file names to be included in zip file gallery_path : str path to where the zipfile is stored extension : str '...
[ "def", "python_zip", "(", "file_list", ",", "gallery_path", ",", "extension", "=", "'.py'", ")", ":", "zipname", "=", "os", ".", "path", ".", "basename", "(", "os", ".", "path", ".", "normpath", "(", "gallery_path", ")", ")", "zipname", "+=", "'_python'"...
Stores all files in file_list into an zip file Parameters ---------- file_list : list Holds all the file names to be included in zip file gallery_path : str path to where the zipfile is stored extension : str '.py' or '.ipynb' In order to deal with downloads of python ...
[ "Stores", "all", "files", "in", "file_list", "into", "an", "zip", "file" ]
python
train
39.433333
readbeyond/aeneas
aeneas/tools/read_text.py
https://github.com/readbeyond/aeneas/blob/9d95535ad63eef4a98530cfdff033b8c35315ee1/aeneas/tools/read_text.py#L82-L137
def perform_command(self): """ Perform command and return the appropriate exit code. :rtype: int """ if len(self.actual_arguments) < 2: return self.print_help() text_format = gf.safe_unicode(self.actual_arguments[0]) if text_format == u"list": ...
[ "def", "perform_command", "(", "self", ")", ":", "if", "len", "(", "self", ".", "actual_arguments", ")", "<", "2", ":", "return", "self", ".", "print_help", "(", ")", "text_format", "=", "gf", ".", "safe_unicode", "(", "self", ".", "actual_arguments", "[...
Perform command and return the appropriate exit code. :rtype: int
[ "Perform", "command", "and", "return", "the", "appropriate", "exit", "code", "." ]
python
train
49.946429
brunato/lograptor
lograptor/tui.py
https://github.com/brunato/lograptor/blob/b1f09fe1b429ed15110610092704ef12d253f3c9/lograptor/tui.py#L76-L91
def get_unix_tput_terminal_size(): """ Get the terminal size of a UNIX terminal using the tput UNIX command. Ref: http://stackoverflow.com/questions/263890/how-do-i-find-the-width-height-of-a-terminal-window """ import subprocess try: proc = subprocess.Popen(["tput", "cols"], stdin=subpr...
[ "def", "get_unix_tput_terminal_size", "(", ")", ":", "import", "subprocess", "try", ":", "proc", "=", "subprocess", ".", "Popen", "(", "[", "\"tput\"", ",", "\"cols\"", "]", ",", "stdin", "=", "subprocess", ".", "PIPE", ",", "stdout", "=", "subprocess", "....
Get the terminal size of a UNIX terminal using the tput UNIX command. Ref: http://stackoverflow.com/questions/263890/how-do-i-find-the-width-height-of-a-terminal-window
[ "Get", "the", "terminal", "size", "of", "a", "UNIX", "terminal", "using", "the", "tput", "UNIX", "command", ".", "Ref", ":", "http", ":", "//", "stackoverflow", ".", "com", "/", "questions", "/", "263890", "/", "how", "-", "do", "-", "i", "-", "find"...
python
train
41.6875
openstack/monasca-common
monasca_common/kafka_lib/consumer/kafka.py
https://github.com/openstack/monasca-common/blob/61e2e00454734e2881611abec8df0d85bf7655ac/monasca_common/kafka_lib/consumer/kafka.py#L317-L420
def fetch_messages(self): """Sends FetchRequests for all topic/partitions set for consumption Returns: Generator that yields KafkaMessage structs after deserializing with the configured `deserializer_class` Note: Refreshes metadata on errors, and resets fetc...
[ "def", "fetch_messages", "(", "self", ")", ":", "max_bytes", "=", "self", ".", "_config", "[", "'fetch_message_max_bytes'", "]", "max_wait_time", "=", "self", ".", "_config", "[", "'fetch_wait_max_ms'", "]", "min_bytes", "=", "self", ".", "_config", "[", "'fet...
Sends FetchRequests for all topic/partitions set for consumption Returns: Generator that yields KafkaMessage structs after deserializing with the configured `deserializer_class` Note: Refreshes metadata on errors, and resets fetch offset on OffsetOutOfRa...
[ "Sends", "FetchRequests", "for", "all", "topic", "/", "partitions", "set", "for", "consumption" ]
python
train
39.365385
foremast/foremast
src/foremast/iam/create_iam.py
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/iam/create_iam.py#L29-L87
def create_iam_resources(env='dev', app='', **_): """Create the IAM Resources for the application. Args: env (str): Deployment environment/account, i.e. dev, stage, prod. app (str): Spinnaker Application name. Returns: True upon successful completion. """ session = boto3.se...
[ "def", "create_iam_resources", "(", "env", "=", "'dev'", ",", "app", "=", "''", ",", "*", "*", "_", ")", ":", "session", "=", "boto3", ".", "session", ".", "Session", "(", "profile_name", "=", "env", ")", "client", "=", "session", ".", "client", "(",...
Create the IAM Resources for the application. Args: env (str): Deployment environment/account, i.e. dev, stage, prod. app (str): Spinnaker Application name. Returns: True upon successful completion.
[ "Create", "the", "IAM", "Resources", "for", "the", "application", "." ]
python
train
36.389831
ARMmbed/mbed-cloud-sdk-python
src/mbed_cloud/update/update.py
https://github.com/ARMmbed/mbed-cloud-sdk-python/blob/c0af86fb2cdd4dc7ed26f236139241067d293509/src/mbed_cloud/update/update.py#L83-L125
def add_campaign(self, name, device_filter, **kwargs): """Add new update campaign. Add an update campaign with a name and device filtering. Example: .. code-block:: python device_api, update_api = DeviceDirectoryAPI(), UpdateAPI() # Get a filter to use for update camp...
[ "def", "add_campaign", "(", "self", ",", "name", ",", "device_filter", ",", "*", "*", "kwargs", ")", ":", "device_filter", "=", "filters", ".", "legacy_filter_formatter", "(", "dict", "(", "filter", "=", "device_filter", ")", ",", "Device", ".", "_get_attrib...
Add new update campaign. Add an update campaign with a name and device filtering. Example: .. code-block:: python device_api, update_api = DeviceDirectoryAPI(), UpdateAPI() # Get a filter to use for update campaign query_obj = device_api.get_query(query_id="MYID")...
[ "Add", "new", "update", "campaign", "." ]
python
train
42.465116
quantopian/zipline
zipline/assets/assets.py
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/assets/assets.py#L193-L209
def _filter_kwargs(names, dict_): """Filter out kwargs from a dictionary. Parameters ---------- names : set[str] The names to select from ``dict_``. dict_ : dict[str, any] The dictionary to select from. Returns ------- kwargs : dict[str, any] ``dict_`` where the...
[ "def", "_filter_kwargs", "(", "names", ",", "dict_", ")", ":", "return", "{", "k", ":", "v", "for", "k", ",", "v", "in", "dict_", ".", "items", "(", ")", "if", "k", "in", "names", "and", "v", "is", "not", "None", "}" ]
Filter out kwargs from a dictionary. Parameters ---------- names : set[str] The names to select from ``dict_``. dict_ : dict[str, any] The dictionary to select from. Returns ------- kwargs : dict[str, any] ``dict_`` where the keys intersect with ``names`` and the va...
[ "Filter", "out", "kwargs", "from", "a", "dictionary", "." ]
python
train
26.764706
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/mslib.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/mslib.py#L44-L55
def generate(env): """Add Builders and construction variables for lib to an Environment.""" SCons.Tool.createStaticLibBuilder(env) # Set-up ms tools paths msvc_setup_env_once(env) env['AR'] = 'lib' env['ARFLAGS'] = SCons.Util.CLVar('/nologo') env['ARCOM'] = "${TEMPFILE('...
[ "def", "generate", "(", "env", ")", ":", "SCons", ".", "Tool", ".", "createStaticLibBuilder", "(", "env", ")", "# Set-up ms tools paths", "msvc_setup_env_once", "(", "env", ")", "env", "[", "'AR'", "]", "=", "'lib'", "env", "[", "'ARFLAGS'", "]", "=", "SCo...
Add Builders and construction variables for lib to an Environment.
[ "Add", "Builders", "and", "construction", "variables", "for", "lib", "to", "an", "Environment", "." ]
python
train
34.916667
idlesign/uwsgiconf
uwsgiconf/runtime/environ.py
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/runtime/environ.py#L81-L91
def get_version(self, as_tuple=False): """Returns uWSGI version string or tuple. :param bool as_tuple: :rtype: str|tuple """ if as_tuple: return uwsgi.version_info return decode(uwsgi.version)
[ "def", "get_version", "(", "self", ",", "as_tuple", "=", "False", ")", ":", "if", "as_tuple", ":", "return", "uwsgi", ".", "version_info", "return", "decode", "(", "uwsgi", ".", "version", ")" ]
Returns uWSGI version string or tuple. :param bool as_tuple: :rtype: str|tuple
[ "Returns", "uWSGI", "version", "string", "or", "tuple", "." ]
python
train
22.272727
yyuu/botornado
boto/storage_uri.py
https://github.com/yyuu/botornado/blob/fffb056f5ff2324d1d5c1304014cfb1d899f602e/boto/storage_uri.py#L484-L491
def names_container(self): """Returns True if this URI is not representing input/output stream and names a directory. """ if not self.stream: return os.path.isdir(self.object_name) else: return False
[ "def", "names_container", "(", "self", ")", ":", "if", "not", "self", ".", "stream", ":", "return", "os", ".", "path", ".", "isdir", "(", "self", ".", "object_name", ")", "else", ":", "return", "False" ]
Returns True if this URI is not representing input/output stream and names a directory.
[ "Returns", "True", "if", "this", "URI", "is", "not", "representing", "input", "/", "output", "stream", "and", "names", "a", "directory", "." ]
python
train
32
Datary/scrapbag
scrapbag/dates.py
https://github.com/Datary/scrapbag/blob/3a4f9824ab6fe21121214ba9963690618da2c9de/scrapbag/dates.py#L51-L59
def localize_date(date, city): """ Localize date into city Date: datetime City: timezone city definitio. Example: 'Asia/Qatar', 'America/New York'.. """ local = pytz.timezone(city) local_dt = local.localize(date, is_dst=None) return local_dt
[ "def", "localize_date", "(", "date", ",", "city", ")", ":", "local", "=", "pytz", ".", "timezone", "(", "city", ")", "local_dt", "=", "local", ".", "localize", "(", "date", ",", "is_dst", "=", "None", ")", "return", "local_dt" ]
Localize date into city Date: datetime City: timezone city definitio. Example: 'Asia/Qatar', 'America/New York'..
[ "Localize", "date", "into", "city" ]
python
train
29.111111
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_xstp_ext.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_xstp_ext.py#L4236-L4249
def get_stp_mst_detail_output_cist_port_port_hello_time(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_stp_mst_detail = ET.Element("get_stp_mst_detail") config = get_stp_mst_detail output = ET.SubElement(get_stp_mst_detail, "output") ...
[ "def", "get_stp_mst_detail_output_cist_port_port_hello_time", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "get_stp_mst_detail", "=", "ET", ".", "Element", "(", "\"get_stp_mst_detail\"", ")", "config"...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
43.142857
casacore/python-casacore
casacore/tables/table.py
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L1285-L1305
def colfieldnames(self, columnname, keyword=''): """Get the names of the fields in a column keyword value. The value of a keyword can be a struct (python dict). This method returns the names of the fields in that struct. Each field in a struct can be a struct in itself. Names of fields ...
[ "def", "colfieldnames", "(", "self", ",", "columnname", ",", "keyword", "=", "''", ")", ":", "if", "isinstance", "(", "keyword", ",", "str", ")", ":", "return", "self", ".", "_getfieldnames", "(", "columnname", ",", "keyword", ",", "-", "1", ")", "else...
Get the names of the fields in a column keyword value. The value of a keyword can be a struct (python dict). This method returns the names of the fields in that struct. Each field in a struct can be a struct in itself. Names of fields in a sub-struct can be obtained by giving a keyword ...
[ "Get", "the", "names", "of", "the", "fields", "in", "a", "column", "keyword", "value", "." ]
python
train
45.190476
pgmpy/pgmpy
pgmpy/sampling/NUTS.py
https://github.com/pgmpy/pgmpy/blob/9381a66aba3c3871d3ccd00672b148d17d63239e/pgmpy/sampling/NUTS.py#L66-L81
def _initalize_tree(self, position, momentum, slice_var, stepsize): """ Initalizes root node of the tree, i.e depth = 0 """ position_bar, momentum_bar, _ = self.simulate_dynamics(self.model, position, momentum, stepsize, sel...
[ "def", "_initalize_tree", "(", "self", ",", "position", ",", "momentum", ",", "slice_var", ",", "stepsize", ")", ":", "position_bar", ",", "momentum_bar", ",", "_", "=", "self", ".", "simulate_dynamics", "(", "self", ".", "model", ",", "position", ",", "mo...
Initalizes root node of the tree, i.e depth = 0
[ "Initalizes", "root", "node", "of", "the", "tree", "i", ".", "e", "depth", "=", "0" ]
python
train
46
neithere/argh
argh/assembling.py
https://github.com/neithere/argh/blob/dcd3253f2994400a6a58a700c118c53765bc50a4/argh/assembling.py#L484-L502
def add_subcommands(parser, namespace, functions, **namespace_kwargs): """ A wrapper for :func:`add_commands`. These examples are equivalent:: add_commands(parser, [get, put], namespace='db', namespace_kwargs={ 'title': 'database commands', ...
[ "def", "add_subcommands", "(", "parser", ",", "namespace", ",", "functions", ",", "*", "*", "namespace_kwargs", ")", ":", "add_commands", "(", "parser", ",", "functions", ",", "namespace", "=", "namespace", ",", "namespace_kwargs", "=", "namespace_kwargs", ")" ]
A wrapper for :func:`add_commands`. These examples are equivalent:: add_commands(parser, [get, put], namespace='db', namespace_kwargs={ 'title': 'database commands', 'help': 'CRUD for our silly database' }) ...
[ "A", "wrapper", "for", ":", "func", ":", "add_commands", "." ]
python
test
34.578947