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
ArchiveTeam/wpull
wpull/util.py
https://github.com/ArchiveTeam/wpull/blob/ddf051aa3322479325ba20aa778cb2cb97606bf5/wpull/util.py#L101-L131
def filter_pem(data): '''Processes the bytes for PEM certificates. Returns: ``set`` containing each certificate ''' assert isinstance(data, bytes), 'Expect bytes. Got {}.'.format(type(data)) certs = set() new_list = [] in_pem_block = False for line in re.split(br'[\r\n]+', data...
[ "def", "filter_pem", "(", "data", ")", ":", "assert", "isinstance", "(", "data", ",", "bytes", ")", ",", "'Expect bytes. Got {}.'", ".", "format", "(", "type", "(", "data", ")", ")", "certs", "=", "set", "(", ")", "new_list", "=", "[", "]", "in_pem_blo...
Processes the bytes for PEM certificates. Returns: ``set`` containing each certificate
[ "Processes", "the", "bytes", "for", "PEM", "certificates", "." ]
python
train
27.903226
OSSOS/MOP
src/ossos/core/ossos/storage.py
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/storage.py#L1261-L1280
def vlink(s_expnum, s_ccd, s_version, s_ext, l_expnum, l_ccd, l_version, l_ext, s_prefix=None, l_prefix=None): """make a link between two version of a file. @param s_expnum: @param s_ccd: @param s_version: @param s_ext: @param l_expnum: @param l_ccd: @param l_version: @par...
[ "def", "vlink", "(", "s_expnum", ",", "s_ccd", ",", "s_version", ",", "s_ext", ",", "l_expnum", ",", "l_ccd", ",", "l_version", ",", "l_ext", ",", "s_prefix", "=", "None", ",", "l_prefix", "=", "None", ")", ":", "source_uri", "=", "get_uri", "(", "s_ex...
make a link between two version of a file. @param s_expnum: @param s_ccd: @param s_version: @param s_ext: @param l_expnum: @param l_ccd: @param l_version: @param l_ext: @param s_prefix: @param l_prefix: @return:
[ "make", "a", "link", "between", "two", "version", "of", "a", "file", "." ]
python
train
30.15
pywbem/pywbem
attic/twisted_client.py
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/attic/twisted_client.py#L101-L106
def handleStatus(self, version, status, message): """Save the status code for processing when we get to the end of the headers.""" self.status = status self.message = message
[ "def", "handleStatus", "(", "self", ",", "version", ",", "status", ",", "message", ")", ":", "self", ".", "status", "=", "status", "self", ".", "message", "=", "message" ]
Save the status code for processing when we get to the end of the headers.
[ "Save", "the", "status", "code", "for", "processing", "when", "we", "get", "to", "the", "end", "of", "the", "headers", "." ]
python
train
33.666667
buriburisuri/sugartensor
sugartensor/sg_layer.py
https://github.com/buriburisuri/sugartensor/blob/d2c039954777c7fbe3eb0c2ae40c45c9854deb40/sugartensor/sg_layer.py#L179-L227
def sg_aconv1d(tensor, opt): r"""Applies 1-D atrous (or dilated) convolution. Args: tensor: A 3-D `Tensor` (automatically passed by decorator). opt: causal: Boolean. If True, zeros are padded before the time axis such that each activation unit doesn't have receptive neurons be...
[ "def", "sg_aconv1d", "(", "tensor", ",", "opt", ")", ":", "# default options", "opt", "+=", "tf", ".", "sg_opt", "(", "size", "=", "(", "2", "if", "opt", ".", "causal", "else", "3", ")", ",", "rate", "=", "1", ",", "pad", "=", "'SAME'", ")", "# p...
r"""Applies 1-D atrous (or dilated) convolution. Args: tensor: A 3-D `Tensor` (automatically passed by decorator). opt: causal: Boolean. If True, zeros are padded before the time axis such that each activation unit doesn't have receptive neurons beyond the equivalent time step. ...
[ "r", "Applies", "1", "-", "D", "atrous", "(", "or", "dilated", ")", "convolution", ".", "Args", ":", "tensor", ":", "A", "3", "-", "D", "Tensor", "(", "automatically", "passed", "by", "decorator", ")", ".", "opt", ":", "causal", ":", "Boolean", ".", ...
python
train
46.204082
cloudmesh-cmd3/cmd3
cmd3/plugins/shell_scope.py
https://github.com/cloudmesh-cmd3/cmd3/blob/92e33c96032fd3921f159198a0e57917c4dc34ed/cmd3/plugins/shell_scope.py#L260-L276
def do_debug(self, args, arguments): """ :: Usage: debug on debug off Turns the debug log level on and off. """ filename = path_expand("~/.cloudmesh/cmd3.yaml") config = ConfigDict(filename=filename) if arguments['on']:...
[ "def", "do_debug", "(", "self", ",", "args", ",", "arguments", ")", ":", "filename", "=", "path_expand", "(", "\"~/.cloudmesh/cmd3.yaml\"", ")", "config", "=", "ConfigDict", "(", "filename", "=", "filename", ")", "if", "arguments", "[", "'on'", "]", ":", "...
:: Usage: debug on debug off Turns the debug log level on and off.
[ "::" ]
python
train
23.647059
edoburu/django-tag-parser
tag_parser/parser.py
https://github.com/edoburu/django-tag-parser/blob/c24256cfdd0248434f2e3df3444ed9f945d4181f/tag_parser/parser.py#L36-L87
def parse_token_kwargs(parser, token, allowed_kwargs=None, compile_args=True, compile_kwargs=True): """ Allow the template tag arguments to be like a normal Python function, with *args and **kwargs. :param parser: The "parser" object that ``@register.tag`` provides. :type parser: :class:`~django.templa...
[ "def", "parse_token_kwargs", "(", "parser", ",", "token", ",", "allowed_kwargs", "=", "None", ",", "compile_args", "=", "True", ",", "compile_kwargs", "=", "True", ")", ":", "if", "isinstance", "(", "token", ",", "Token", ")", ":", "bits", "=", "token", ...
Allow the template tag arguments to be like a normal Python function, with *args and **kwargs. :param parser: The "parser" object that ``@register.tag`` provides. :type parser: :class:`~django.template.Parser` :param token: The "token" object that ``@register.tag`` provides. :type token: :class:`~djang...
[ "Allow", "the", "template", "tag", "arguments", "to", "be", "like", "a", "normal", "Python", "function", "with", "*", "args", "and", "**", "kwargs", "." ]
python
test
44.923077
fstab50/metal
metal/logd.py
https://github.com/fstab50/metal/blob/0488bbdd516a508909267cc44191f632e21156ba/metal/logd.py#L15-L27
def mode_assignment(arg): """ Translates arg to enforce proper assignment """ arg = arg.upper() stream_args = ('STREAM', 'CONSOLE', 'STDOUT') try: if arg in stream_args: return 'STREAM' else: return arg except Exception: return None
[ "def", "mode_assignment", "(", "arg", ")", ":", "arg", "=", "arg", ".", "upper", "(", ")", "stream_args", "=", "(", "'STREAM'", ",", "'CONSOLE'", ",", "'STDOUT'", ")", "try", ":", "if", "arg", "in", "stream_args", ":", "return", "'STREAM'", "else", ":"...
Translates arg to enforce proper assignment
[ "Translates", "arg", "to", "enforce", "proper", "assignment" ]
python
train
22.769231
Chilipp/psyplot
psyplot/sphinxext/extended_napoleon.py
https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/sphinxext/extended_napoleon.py#L84-L133
def process_docstring(app, what, name, obj, options, lines): """Process the docstring for a given python object. Called when autodoc has read and processed a docstring. `lines` is a list of docstring lines that `_process_docstring` modifies in place to change what Sphinx outputs. The following set...
[ "def", "process_docstring", "(", "app", ",", "what", ",", "name", ",", "obj", ",", "options", ",", "lines", ")", ":", "result_lines", "=", "lines", "if", "app", ".", "config", ".", "napoleon_numpy_docstring", ":", "docstring", "=", "ExtendedNumpyDocstring", ...
Process the docstring for a given python object. Called when autodoc has read and processed a docstring. `lines` is a list of docstring lines that `_process_docstring` modifies in place to change what Sphinx outputs. The following settings in conf.py control what styles of docstrings will be parse...
[ "Process", "the", "docstring", "for", "a", "given", "python", "object", "." ]
python
train
40.22
federico123579/Trading212-API
tradingAPI/saver.py
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/saver.py#L55-L61
def add_val(self, val): """add value in form of dict""" if not isinstance(val, type({})): raise ValueError(type({})) self.read() self.config.update(val) self.save()
[ "def", "add_val", "(", "self", ",", "val", ")", ":", "if", "not", "isinstance", "(", "val", ",", "type", "(", "{", "}", ")", ")", ":", "raise", "ValueError", "(", "type", "(", "{", "}", ")", ")", "self", ".", "read", "(", ")", "self", ".", "c...
add value in form of dict
[ "add", "value", "in", "form", "of", "dict" ]
python
train
30
RudolfCardinal/pythonlib
cardinal_pythonlib/source_reformatting.py
https://github.com/RudolfCardinal/pythonlib/blob/0b84cb35f38bd7d8723958dae51b480a829b7227/cardinal_pythonlib/source_reformatting.py#L95-L110
def _read_source(self) -> None: """ Reads the source file. """ with open(self.full_path, "rt") as f: for linenum, line_with_nl in enumerate(f.readlines(), start=1): line_without_newline = ( line_with_nl[:-1] if line_with_nl.endswith(NL) ...
[ "def", "_read_source", "(", "self", ")", "->", "None", ":", "with", "open", "(", "self", ".", "full_path", ",", "\"rt\"", ")", "as", "f", ":", "for", "linenum", ",", "line_with_nl", "in", "enumerate", "(", "f", ".", "readlines", "(", ")", ",", "start...
Reads the source file.
[ "Reads", "the", "source", "file", "." ]
python
train
46
mfcloud/python-zvm-sdk
zvmsdk/dist.py
https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/dist.py#L865-L916
def _get_udev_rules(self, channel_read, channel_write, channel_data): """construct udev rules info.""" sub_str = '%(read)s %%k %(read)s %(write)s %(data)s qeth' % { 'read': channel_read, 'read': channel_read, ...
[ "def", "_get_udev_rules", "(", "self", ",", "channel_read", ",", "channel_write", ",", "channel_data", ")", ":", "sub_str", "=", "'%(read)s %%k %(read)s %(write)s %(data)s qeth'", "%", "{", "'read'", ":", "channel_read", ",", "'read'", ":", "channel_read", ",", "'wr...
construct udev rules info.
[ "construct", "udev", "rules", "info", "." ]
python
train
65.288462
shoebot/shoebot
shoebot/kgp.py
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/kgp.py#L162-L174
def randomChildElement(self, node): """choose a random child element of a node This is a utility method used by do_xref and do_choice. """ choices = [e for e in node.childNodes if e.nodeType == e.ELEMENT_NODE] chosen = random.choice(choices) ...
[ "def", "randomChildElement", "(", "self", ",", "node", ")", ":", "choices", "=", "[", "e", "for", "e", "in", "node", ".", "childNodes", "if", "e", ".", "nodeType", "==", "e", ".", "ELEMENT_NODE", "]", "chosen", "=", "random", ".", "choice", "(", "cho...
choose a random child element of a node This is a utility method used by do_xref and do_choice.
[ "choose", "a", "random", "child", "element", "of", "a", "node", "This", "is", "a", "utility", "method", "used", "by", "do_xref", "and", "do_choice", "." ]
python
valid
41.230769
tensorflow/probability
tensorflow_probability/python/stats/quantiles.py
https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/stats/quantiles.py#L403-L623
def percentile(x, q, axis=None, interpolation=None, keep_dims=False, validate_args=False, preserve_gradients=True, name=None): """Compute the `q`-th percentile(s) of `x`. Given a vector `x`, the `q`-th percenti...
[ "def", "percentile", "(", "x", ",", "q", ",", "axis", "=", "None", ",", "interpolation", "=", "None", ",", "keep_dims", "=", "False", ",", "validate_args", "=", "False", ",", "preserve_gradients", "=", "True", ",", "name", "=", "None", ")", ":", "name"...
Compute the `q`-th percentile(s) of `x`. Given a vector `x`, the `q`-th percentile of `x` is the value `q / 100` of the way from the minimum to the maximum in a sorted copy of `x`. The values and distances of the two nearest neighbors as well as the `interpolation` parameter will determine the percentile if t...
[ "Compute", "the", "q", "-", "th", "percentile", "(", "s", ")", "of", "x", "." ]
python
test
41.095023
mitsei/dlkit
dlkit/json_/assessment/mixins.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/mixins.py#L575-L608
def get_next_question(self, question_id, answered=None, reverse=False, honor_sequential=True): """Inspects question map to return the next available question. if answered == False: only return next unanswered question if answered == True: only return next answered question if answered i...
[ "def", "get_next_question", "(", "self", ",", "question_id", ",", "answered", "=", "None", ",", "reverse", "=", "False", ",", "honor_sequential", "=", "True", ")", ":", "self", ".", "_update_questions", "(", ")", "# Make sure questions list is current", "question_...
Inspects question map to return the next available question. if answered == False: only return next unanswered question if answered == True: only return next answered question if answered in None: return next question whether answered or not if reverse == True: go backwards - effectivel...
[ "Inspects", "question", "map", "to", "return", "the", "next", "available", "question", "." ]
python
train
55.941176
daler/gffutils
gffutils/helpers.py
https://github.com/daler/gffutils/blob/6f7f547cad898738a1bd0a999fd68ba68db2c524/gffutils/helpers.py#L271-L282
def _feature_to_fields(f, jsonify=True): """ Convert feature to tuple, for faster sqlite3 import """ x = [] for k in constants._keys: v = getattr(f, k) if jsonify and (k in ('attributes', 'extra')): x.append(_jsonify(v)) else: x.append(v) return tu...
[ "def", "_feature_to_fields", "(", "f", ",", "jsonify", "=", "True", ")", ":", "x", "=", "[", "]", "for", "k", "in", "constants", ".", "_keys", ":", "v", "=", "getattr", "(", "f", ",", "k", ")", "if", "jsonify", "and", "(", "k", "in", "(", "'att...
Convert feature to tuple, for faster sqlite3 import
[ "Convert", "feature", "to", "tuple", "for", "faster", "sqlite3", "import" ]
python
train
26.25
Koed00/django-rq-jobs
django_rq_jobs/management/commands/rqjobs.py
https://github.com/Koed00/django-rq-jobs/blob/b25ffd15c91858406494ae0c29babf00c268db18/django_rq_jobs/management/commands/rqjobs.py#L59-L74
def fix_module(job): """ Fix for tasks without a module. Provides backwards compatibility with < 0.1.5 """ modules = settings.RQ_JOBS_MODULE if not type(modules) == tuple: modules = [modules] for module in modules: try: module_match = importlib.import_module(module) ...
[ "def", "fix_module", "(", "job", ")", ":", "modules", "=", "settings", ".", "RQ_JOBS_MODULE", "if", "not", "type", "(", "modules", ")", "==", "tuple", ":", "modules", "=", "[", "modules", "]", "for", "module", "in", "modules", ":", "try", ":", "module_...
Fix for tasks without a module. Provides backwards compatibility with < 0.1.5
[ "Fix", "for", "tasks", "without", "a", "module", ".", "Provides", "backwards", "compatibility", "with", "<", "0", ".", "1", ".", "5" ]
python
train
31.0625
intuition-io/intuition
intuition/api/algorithm.py
https://github.com/intuition-io/intuition/blob/cd517e6b3b315a743eb4d0d0dc294e264ab913ce/intuition/api/algorithm.py#L130-L139
def _call_one_middleware(self, middleware): ''' Evaluate arguments and execute the middleware function ''' args = {} for arg in middleware['args']: if hasattr(self, arg): # same as eval() but safer for arbitrary code execution args[arg] = reduce(getatt...
[ "def", "_call_one_middleware", "(", "self", ",", "middleware", ")", ":", "args", "=", "{", "}", "for", "arg", "in", "middleware", "[", "'args'", "]", ":", "if", "hasattr", "(", "self", ",", "arg", ")", ":", "# same as eval() but safer for arbitrary code execut...
Evaluate arguments and execute the middleware function
[ "Evaluate", "arguments", "and", "execute", "the", "middleware", "function" ]
python
train
48.1
Syndace/python-omemo
omemo/sessionmanager.py
https://github.com/Syndace/python-omemo/blob/f99be4715a3fad4d3082f5093aceb2c42385b8bd/omemo/sessionmanager.py#L998-L1026
def getTrustForJID(self, bare_jid): """ All-in-one trust information for all devices of a bare jid. The result is structured like this: { "active" : { device: int => trust_info } "inactive" : { device: int => trust_info } } where trust_info is ...
[ "def", "getTrustForJID", "(", "self", ",", "bare_jid", ")", ":", "result", "=", "{", "\"active\"", ":", "{", "}", ",", "\"inactive\"", ":", "{", "}", "}", "devices", "=", "yield", "self", ".", "__loadActiveDevices", "(", "bare_jid", ")", "for", "device",...
All-in-one trust information for all devices of a bare jid. The result is structured like this: { "active" : { device: int => trust_info } "inactive" : { device: int => trust_info } } where trust_info is the structure returned by getTrustForDevice.
[ "All", "-", "in", "-", "one", "trust", "information", "for", "all", "devices", "of", "a", "bare", "jid", ".", "The", "result", "is", "structured", "like", "this", ":" ]
python
train
28.689655
klahnakoski/pyLibrary
mo_graphs/algorithms.py
https://github.com/klahnakoski/pyLibrary/blob/fa2dcbc48fda8d26999baef400e9a98149e0b982/mo_graphs/algorithms.py#L26-L55
def dfs(graph, func, head, reverse=None): """ DEPTH FIRST SEARCH IF func RETURNS FALSE, THEN PATH IS NO LONGER TAKEN IT'S EXPECTED func TAKES 3 ARGUMENTS node - THE CURRENT NODE IN THE path - PATH FROM head TO node graph - THE WHOLE GRAPH """ todo = deque() todo.append(head) ...
[ "def", "dfs", "(", "graph", ",", "func", ",", "head", ",", "reverse", "=", "None", ")", ":", "todo", "=", "deque", "(", ")", "todo", ".", "append", "(", "head", ")", "path", "=", "deque", "(", ")", "done", "=", "set", "(", ")", "while", "todo",...
DEPTH FIRST SEARCH IF func RETURNS FALSE, THEN PATH IS NO LONGER TAKEN IT'S EXPECTED func TAKES 3 ARGUMENTS node - THE CURRENT NODE IN THE path - PATH FROM head TO node graph - THE WHOLE GRAPH
[ "DEPTH", "FIRST", "SEARCH" ]
python
train
24.266667
kpdyer/regex2dfa
third_party/re2/re2/make_unicode_groups.py
https://github.com/kpdyer/regex2dfa/blob/109f877e60ef0dfcb430f11516d215930b7b9936/third_party/re2/re2/make_unicode_groups.py#L42-L47
def PrintRanges(type, name, ranges): """Print the ranges as an array of type named name.""" print "static const %s %s[] = {" % (type, name,) for lo, hi in ranges: print "\t{ %d, %d }," % (lo, hi) print "};"
[ "def", "PrintRanges", "(", "type", ",", "name", ",", "ranges", ")", ":", "print", "\"static const %s %s[] = {\"", "%", "(", "type", ",", "name", ",", ")", "for", "lo", ",", "hi", "in", "ranges", ":", "print", "\"\\t{ %d, %d },\"", "%", "(", "lo", ",", ...
Print the ranges as an array of type named name.
[ "Print", "the", "ranges", "as", "an", "array", "of", "type", "named", "name", "." ]
python
train
35.5
Robpol86/libnl
libnl/linux_private/netlink.py
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/linux_private/netlink.py#L162-L164
def nlmsg_type(self, value): """Message content setter.""" self.bytearray[self._get_slicers(1)] = bytearray(c_uint16(value or 0))
[ "def", "nlmsg_type", "(", "self", ",", "value", ")", ":", "self", ".", "bytearray", "[", "self", ".", "_get_slicers", "(", "1", ")", "]", "=", "bytearray", "(", "c_uint16", "(", "value", "or", "0", ")", ")" ]
Message content setter.
[ "Message", "content", "setter", "." ]
python
train
47.666667
mseclab/PyJFuzz
pyjfuzz/core/pjf_factory.py
https://github.com/mseclab/PyJFuzz/blob/f777067076f62c9ab74ffea6e90fd54402b7a1b4/pyjfuzz/core/pjf_factory.py#L129-L171
def fuzz_elements(self, element): """ Fuzz all elements inside the object """ try: if type(element) == dict: tmp_element = {} for key in element: if len(self.config.parameters) > 0: if self.config.exc...
[ "def", "fuzz_elements", "(", "self", ",", "element", ")", ":", "try", ":", "if", "type", "(", "element", ")", "==", "dict", ":", "tmp_element", "=", "{", "}", "for", "key", "in", "element", ":", "if", "len", "(", "self", ".", "config", ".", "parame...
Fuzz all elements inside the object
[ "Fuzz", "all", "elements", "inside", "the", "object" ]
python
test
43.162791
MillionIntegrals/vel
vel/internals/model_config.py
https://github.com/MillionIntegrals/vel/blob/e0726e1f63742b728966ccae0c8b825ea0ba491a/vel/internals/model_config.py#L128-L130
def project_data_dir(self, *args) -> str: """ Directory where to store data """ return os.path.normpath(os.path.join(self.project_dir, 'data', *args))
[ "def", "project_data_dir", "(", "self", ",", "*", "args", ")", "->", "str", ":", "return", "os", ".", "path", ".", "normpath", "(", "os", ".", "path", ".", "join", "(", "self", ".", "project_dir", ",", "'data'", ",", "*", "args", ")", ")" ]
Directory where to store data
[ "Directory", "where", "to", "store", "data" ]
python
train
54.666667
Jajcus/pyxmpp2
pyxmpp2/server/listener.py
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/server/listener.py#L91-L99
def prepare(self): """When connecting start the next connection step and schedule next `prepare` call, when connected return `HandlerReady()` """ with self._lock: if self._socket: self._socket.listen(SOMAXCONN) self._socket.setblocking(False) ...
[ "def", "prepare", "(", "self", ")", ":", "with", "self", ".", "_lock", ":", "if", "self", ".", "_socket", ":", "self", ".", "_socket", ".", "listen", "(", "SOMAXCONN", ")", "self", ".", "_socket", ".", "setblocking", "(", "False", ")", "return", "Han...
When connecting start the next connection step and schedule next `prepare` call, when connected return `HandlerReady()`
[ "When", "connecting", "start", "the", "next", "connection", "step", "and", "schedule", "next", "prepare", "call", "when", "connected", "return", "HandlerReady", "()" ]
python
valid
38.222222
ejeschke/ginga
ginga/mplw/ImageViewMpl.py
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/mplw/ImageViewMpl.py#L155-L187
def render_image1(self, rgbobj, dst_x, dst_y): """Render the image represented by (rgbobj) at dst_x, dst_y in the pixel space. NOTE: this version uses a Figure.FigImage to render the image. """ self.logger.debug("redraw surface") if self.figure is None: retur...
[ "def", "render_image1", "(", "self", ",", "rgbobj", ",", "dst_x", ",", "dst_y", ")", ":", "self", ".", "logger", ".", "debug", "(", "\"redraw surface\"", ")", "if", "self", ".", "figure", "is", "None", ":", "return", "## left, bottom, width, height = self.ax_i...
Render the image represented by (rgbobj) at dst_x, dst_y in the pixel space. NOTE: this version uses a Figure.FigImage to render the image.
[ "Render", "the", "image", "represented", "by", "(", "rgbobj", ")", "at", "dst_x", "dst_y", "in", "the", "pixel", "space", "." ]
python
train
37.030303
mcieslik-mctp/papy
src/papy/core.py
https://github.com/mcieslik-mctp/papy/blob/708e50827b5db46bbea081982cb74b9b0e464064/src/papy/core.py#L444-L457
def add_pipers(self, pipers, *args, **kwargs): """ Adds a sequence of ``Pipers`` instances to the ``Dagger`` in the specified order. Takes optional arguments for ``Dagger.add_piper``. Arguments: - pipers(sequence of valid ``add_piper`` arguments) Sequence of ...
[ "def", "add_pipers", "(", "self", ",", "pipers", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "for", "piper", "in", "pipers", ":", "self", ".", "add_piper", "(", "piper", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
Adds a sequence of ``Pipers`` instances to the ``Dagger`` in the specified order. Takes optional arguments for ``Dagger.add_piper``. Arguments: - pipers(sequence of valid ``add_piper`` arguments) Sequence of ``Pipers`` or valid ``Dagger.add_piper`` arguments to ...
[ "Adds", "a", "sequence", "of", "Pipers", "instances", "to", "the", "Dagger", "in", "the", "specified", "order", ".", "Takes", "optional", "arguments", "for", "Dagger", ".", "add_piper", ".", "Arguments", ":", "-", "pipers", "(", "sequence", "of", "valid", ...
python
train
39
quantumlib/Cirq
cirq/circuits/text_diagram_drawer.py
https://github.com/quantumlib/Cirq/blob/0827da80dd7880e5b923eb69407e980ed9bc0bd2/cirq/circuits/text_diagram_drawer.py#L184-L187
def force_vertical_padding_after( self, index: int, padding: Union[int, float]) -> None: """Change the padding after the given row.""" self.vertical_padding[index] = padding
[ "def", "force_vertical_padding_after", "(", "self", ",", "index", ":", "int", ",", "padding", ":", "Union", "[", "int", ",", "float", "]", ")", "->", "None", ":", "self", ".", "vertical_padding", "[", "index", "]", "=", "padding" ]
Change the padding after the given row.
[ "Change", "the", "padding", "after", "the", "given", "row", "." ]
python
train
49.5
inveniosoftware-contrib/invenio-groups
invenio_groups/views.py
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/views.py#L229-L262
def members(group_id): """List user group members.""" page = request.args.get('page', 1, type=int) per_page = request.args.get('per_page', 5, type=int) q = request.args.get('q', '') s = request.args.get('s', '') group = Group.query.get_or_404(group_id) if group.can_see_members(current_user)...
[ "def", "members", "(", "group_id", ")", ":", "page", "=", "request", ".", "args", ".", "get", "(", "'page'", ",", "1", ",", "type", "=", "int", ")", "per_page", "=", "request", ".", "args", ".", "get", "(", "'per_page'", ",", "5", ",", "type", "=...
List user group members.
[ "List", "user", "group", "members", "." ]
python
valid
29.735294
miLibris/flask-rest-jsonapi
flask_rest_jsonapi/querystring.py
https://github.com/miLibris/flask-rest-jsonapi/blob/ecc8f2cd2b54cc0bfae7acd6cffcda0ba1140c43/flask_rest_jsonapi/querystring.py#L36-L61
def _get_key_values(self, name): """Return a dict containing key / values items for a given key, used for items like filters, page, etc. :param str name: name of the querystring parameter :return dict: a dict of key / values items """ results = {} for key, value in self...
[ "def", "_get_key_values", "(", "self", ",", "name", ")", ":", "results", "=", "{", "}", "for", "key", ",", "value", "in", "self", ".", "qs", ".", "items", "(", ")", ":", "try", ":", "if", "not", "key", ".", "startswith", "(", "name", ")", ":", ...
Return a dict containing key / values items for a given key, used for items like filters, page, etc. :param str name: name of the querystring parameter :return dict: a dict of key / values items
[ "Return", "a", "dict", "containing", "key", "/", "values", "items", "for", "a", "given", "key", "used", "for", "items", "like", "filters", "page", "etc", "." ]
python
train
33.307692
shreyaspotnis/rampage
rampage/daq/daq.py
https://github.com/shreyaspotnis/rampage/blob/e2565aef7ee16ee06523de975e8aa41aca14e3b2/rampage/daq/daq.py#L28-L53
def print_device_info(dev_name): """Prints information about the given device. Usage: print_device_info("Dev1") """ string_buffer = ctypes.create_string_buffer(1024) attributes = [pydaq.DAQmx_Dev_ProductType, pydaq.DAQmx_Dev_SerialNum, pydaq.DAQmx_Dev_AO_PhysicalChans, ...
[ "def", "print_device_info", "(", "dev_name", ")", ":", "string_buffer", "=", "ctypes", ".", "create_string_buffer", "(", "1024", ")", "attributes", "=", "[", "pydaq", ".", "DAQmx_Dev_ProductType", ",", "pydaq", ".", "DAQmx_Dev_SerialNum", ",", "pydaq", ".", "DAQ...
Prints information about the given device. Usage: print_device_info("Dev1")
[ "Prints", "information", "about", "the", "given", "device", "." ]
python
train
39.269231
alecthomas/voluptuous
voluptuous/schema_builder.py
https://github.com/alecthomas/voluptuous/blob/36c8c11e2b7eb402c24866fa558473661ede9403/voluptuous/schema_builder.py#L785-L831
def _compile_scalar(schema): """A scalar value. The schema can either be a value or a type. >>> _compile_scalar(int)([], 1) 1 >>> with raises(er.Invalid, 'expected float'): ... _compile_scalar(float)([], '1') Callables have >>> _compile_scalar(lambda v: float(v))([], '1') 1.0 ...
[ "def", "_compile_scalar", "(", "schema", ")", ":", "if", "inspect", ".", "isclass", "(", "schema", ")", ":", "def", "validate_instance", "(", "path", ",", "data", ")", ":", "if", "isinstance", "(", "data", ",", "schema", ")", ":", "return", "data", "el...
A scalar value. The schema can either be a value or a type. >>> _compile_scalar(int)([], 1) 1 >>> with raises(er.Invalid, 'expected float'): ... _compile_scalar(float)([], '1') Callables have >>> _compile_scalar(lambda v: float(v))([], '1') 1.0 As a convenience, ValueError's ar...
[ "A", "scalar", "value", "." ]
python
train
26.723404
trombastic/PyScada
pyscada/visa/devices/Keithley_DMM2000.py
https://github.com/trombastic/PyScada/blob/c5fc348a25f0df1340336f694ee9bc1aea62516a/pyscada/visa/devices/Keithley_DMM2000.py#L38-L100
def write_data(self, variable_id, value, task): """ write values to the device """ variable = self._variables[variable_id] if task.property_name != '': # write the property to VariableProperty use that for later read vp = VariableProperty.objects.update_or...
[ "def", "write_data", "(", "self", ",", "variable_id", ",", "value", ",", "task", ")", ":", "variable", "=", "self", ".", "_variables", "[", "variable_id", "]", "if", "task", ".", "property_name", "!=", "''", ":", "# write the property to VariableProperty use tha...
write values to the device
[ "write", "values", "to", "the", "device" ]
python
train
47.285714
bunq/sdk_python
bunq/sdk/model/generated/endpoint.py
https://github.com/bunq/sdk_python/blob/da6c9b83e6d83ee8062617f53c6eb7293c0d863d/bunq/sdk/model/generated/endpoint.py#L13390-L13482
def is_all_field_none(self): """ :rtype: bool """ if self._id_ is not None: return False if self._created is not None: return False if self._updated is not None: return False if self._time_responded is not None: ...
[ "def", "is_all_field_none", "(", "self", ")", ":", "if", "self", ".", "_id_", "is", "not", "None", ":", "return", "False", "if", "self", ".", "_created", "is", "not", "None", ":", "return", "False", "if", "self", ".", "_updated", "is", "not", "None", ...
:rtype: bool
[ ":", "rtype", ":", "bool" ]
python
train
22.043011
txomon/abot
abot/slack.py
https://github.com/txomon/abot/blob/3ac23c6d14965d4608ed13c284ae1a886b462252/abot/slack.py#L83-L107
async def call(self, method, **params): """ Call an Slack Web API method :param method: Slack Web API method to call :param params: {str: object} parameters to method :return: dict() """ url = self.SLACK_RPC_PREFIX + method data = FormData() data....
[ "async", "def", "call", "(", "self", ",", "method", ",", "*", "*", "params", ")", ":", "url", "=", "self", ".", "SLACK_RPC_PREFIX", "+", "method", "data", "=", "FormData", "(", ")", "data", ".", "add_fields", "(", "MultiDict", "(", "token", "=", "sel...
Call an Slack Web API method :param method: Slack Web API method to call :param params: {str: object} parameters to method :return: dict()
[ "Call", "an", "Slack", "Web", "API", "method" ]
python
train
43.48
rigetti/grove
grove/simon/utils.py
https://github.com/rigetti/grove/blob/dc6bf6ec63e8c435fe52b1e00f707d5ce4cdb9b3/grove/simon/utils.py#L47-L69
def binary_back_substitute(W: np.ndarray, s: np.ndarray) -> np.ndarray: """ Perform back substitution on a binary system of equations, i.e. it performs Gauss elimination over the field :math:`GF(2)`. It finds an :math:`\\mathbf{x}` such that :math:`\\mathbf{\\mathit{W}}\\mathbf{x}=\\mathbf{s}`, where al...
[ "def", "binary_back_substitute", "(", "W", ":", "np", ".", "ndarray", ",", "s", ":", "np", ".", "ndarray", ")", "->", "np", ".", "ndarray", ":", "# iterate backwards, starting from second to last row for back-substitution", "m", "=", "np", ".", "copy", "(", "s",...
Perform back substitution on a binary system of equations, i.e. it performs Gauss elimination over the field :math:`GF(2)`. It finds an :math:`\\mathbf{x}` such that :math:`\\mathbf{\\mathit{W}}\\mathbf{x}=\\mathbf{s}`, where all arithmetic is taken bitwise and modulo 2. :param W: A square :math:`n\\ti...
[ "Perform", "back", "substitution", "on", "a", "binary", "system", "of", "equations", "i", ".", "e", ".", "it", "performs", "Gauss", "elimination", "over", "the", "field", ":", "math", ":", "GF", "(", "2", ")", ".", "It", "finds", "an", ":", "math", "...
python
train
42.304348
nathankw/pulsarpy
pulsarpy/models.py
https://github.com/nathankw/pulsarpy/blob/359b040c0f2383b88c0b5548715fefd35f5f634c/pulsarpy/models.py#L634-L648
def write_response_html_to_file(response,filename): """ An aid in troubleshooting internal application errors, i.e. <Response [500]>, to be mainly beneficial when developing the server-side API. This method will write the response HTML for viewing the error details in the browesr. ...
[ "def", "write_response_html_to_file", "(", "response", ",", "filename", ")", ":", "fout", "=", "open", "(", "filename", ",", "'w'", ")", "if", "not", "str", "(", "response", ".", "status_code", ")", ".", "startswith", "(", "\"2\"", ")", ":", "Model", "."...
An aid in troubleshooting internal application errors, i.e. <Response [500]>, to be mainly beneficial when developing the server-side API. This method will write the response HTML for viewing the error details in the browesr. Args: response: `requests.models.Response` instance. ...
[ "An", "aid", "in", "troubleshooting", "internal", "application", "errors", "i", ".", "e", ".", "<Response", "[", "500", "]", ">", "to", "be", "mainly", "beneficial", "when", "developing", "the", "server", "-", "side", "API", ".", "This", "method", "will", ...
python
train
42.4
cloudmesh/cloudmesh-common
cloudmesh/common/util.py
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/util.py#L330-L338
def writefile(filename, content): """ writes the content into the file :param filename: the filename :param content: teh content :return: """ with open(path_expand(filename), 'w') as outfile: outfile.write(content)
[ "def", "writefile", "(", "filename", ",", "content", ")", ":", "with", "open", "(", "path_expand", "(", "filename", ")", ",", "'w'", ")", "as", "outfile", ":", "outfile", ".", "write", "(", "content", ")" ]
writes the content into the file :param filename: the filename :param content: teh content :return:
[ "writes", "the", "content", "into", "the", "file", ":", "param", "filename", ":", "the", "filename", ":", "param", "content", ":", "teh", "content", ":", "return", ":" ]
python
train
27
pandas-dev/pandas
pandas/core/groupby/groupby.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/groupby/groupby.py#L1159-L1176
def median(self, **kwargs): """ Compute median of groups, excluding missing values. For multiple groupings, the result index will be a MultiIndex """ try: return self._cython_agg_general('median', **kwargs) except GroupByError: raise excep...
[ "def", "median", "(", "self", ",", "*", "*", "kwargs", ")", ":", "try", ":", "return", "self", ".", "_cython_agg_general", "(", "'median'", ",", "*", "*", "kwargs", ")", "except", "GroupByError", ":", "raise", "except", "Exception", ":", "# pragma: no cove...
Compute median of groups, excluding missing values. For multiple groupings, the result index will be a MultiIndex
[ "Compute", "median", "of", "groups", "excluding", "missing", "values", "." ]
python
train
33.111111
spotify/luigi
luigi/worker.py
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/worker.py#L561-L583
def _add_task(self, *args, **kwargs): """ Call ``self._scheduler.add_task``, but store the values too so we can implement :py:func:`luigi.execution_summary.summary`. """ task_id = kwargs['task_id'] status = kwargs['status'] runnable = kwargs['runnable'] ta...
[ "def", "_add_task", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "task_id", "=", "kwargs", "[", "'task_id'", "]", "status", "=", "kwargs", "[", "'status'", "]", "runnable", "=", "kwargs", "[", "'runnable'", "]", "task", "=", "sel...
Call ``self._scheduler.add_task``, but store the values too so we can implement :py:func:`luigi.execution_summary.summary`.
[ "Call", "self", ".", "_scheduler", ".", "add_task", "but", "store", "the", "values", "too", "so", "we", "can", "implement", ":", "py", ":", "func", ":", "luigi", ".", "execution_summary", ".", "summary", "." ]
python
train
40.304348
Clinical-Genomics/scout
scout/parse/matchmaker.py
https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/matchmaker.py#L39-L56
def omim_terms(case_obj): """Extract all OMIM phenotypes available for the case Args: case_obj(dict): a scout case object Returns: disorders(list): a list of OMIM disorder objects """ LOG.info("Collecting OMIM disorders for case {}".format(case_obj.get('display_name'))) disorders...
[ "def", "omim_terms", "(", "case_obj", ")", ":", "LOG", ".", "info", "(", "\"Collecting OMIM disorders for case {}\"", ".", "format", "(", "case_obj", ".", "get", "(", "'display_name'", ")", ")", ")", "disorders", "=", "[", "]", "case_disorders", "=", "case_obj...
Extract all OMIM phenotypes available for the case Args: case_obj(dict): a scout case object Returns: disorders(list): a list of OMIM disorder objects
[ "Extract", "all", "OMIM", "phenotypes", "available", "for", "the", "case", "Args", ":", "case_obj", "(", "dict", ")", ":", "a", "scout", "case", "object", "Returns", ":", "disorders", "(", "list", ")", ":", "a", "list", "of", "OMIM", "disorder", "objects...
python
test
34.222222
romanz/trezor-agent
libagent/device/keepkey.py
https://github.com/romanz/trezor-agent/blob/513b1259c4d7aca5f88cd958edc11828d0712f1b/libagent/device/keepkey.py#L38-L41
def pubkey(self, identity, ecdh=False): """Return public key.""" _verify_support(identity, ecdh) return trezor.Trezor.pubkey(self, identity=identity, ecdh=ecdh)
[ "def", "pubkey", "(", "self", ",", "identity", ",", "ecdh", "=", "False", ")", ":", "_verify_support", "(", "identity", ",", "ecdh", ")", "return", "trezor", ".", "Trezor", ".", "pubkey", "(", "self", ",", "identity", "=", "identity", ",", "ecdh", "=",...
Return public key.
[ "Return", "public", "key", "." ]
python
train
45.25
etscrivner/nose-perfdump
perfdump/plugin.py
https://github.com/etscrivner/nose-perfdump/blob/a203a68495d30346fab43fb903cb60cd29b17d49/perfdump/plugin.py#L87-L91
def options(self, parser, env=os.environ): """Handle parsing additional command-line options""" super(PerfDumpPlugin, self).options(parser, env=env) parser.add_option("", "--perfdump-html", dest="perfdump_html_file", help="Set destination for HTML report output")
[ "def", "options", "(", "self", ",", "parser", ",", "env", "=", "os", ".", "environ", ")", ":", "super", "(", "PerfDumpPlugin", ",", "self", ")", ".", "options", "(", "parser", ",", "env", "=", "env", ")", "parser", ".", "add_option", "(", "\"\"", "...
Handle parsing additional command-line options
[ "Handle", "parsing", "additional", "command", "-", "line", "options" ]
python
train
61.8
Calysto/calysto
calysto/ai/conx.py
https://github.com/Calysto/calysto/blob/20813c0f48096317aa775d03a5c6b20f12fafc93/calysto/ai/conx.py#L161-L172
def toStringArray(name, a, width = 0): """ Returns an array (any sequence of floats, really) as a string. """ string = name + ": " cnt = 0 for i in a: string += "%4.2f " % i if width > 0 and (cnt + 1) % width == 0: string += '\n' cnt += 1 return string
[ "def", "toStringArray", "(", "name", ",", "a", ",", "width", "=", "0", ")", ":", "string", "=", "name", "+", "\": \"", "cnt", "=", "0", "for", "i", "in", "a", ":", "string", "+=", "\"%4.2f \"", "%", "i", "if", "width", ">", "0", "and", "(", "c...
Returns an array (any sequence of floats, really) as a string.
[ "Returns", "an", "array", "(", "any", "sequence", "of", "floats", "really", ")", "as", "a", "string", "." ]
python
train
25.583333
aliyun/aliyun-odps-python-sdk
odps/tunnel/pb/output_stream.py
https://github.com/aliyun/aliyun-odps-python-sdk/blob/4b0de18f5864386df6068f26f026e62f932c41e4/odps/tunnel/pb/output_stream.py#L65-L72
def append_varint32(self, value): """Appends a signed 32-bit integer to the internal buffer, encoded as a varint. (Note that a negative varint32 will always require 10 bytes of space.) """ if not wire_format.INT32_MIN <= value <= wire_format.INT32_MAX: raise errors.E...
[ "def", "append_varint32", "(", "self", ",", "value", ")", ":", "if", "not", "wire_format", ".", "INT32_MIN", "<=", "value", "<=", "wire_format", ".", "INT32_MAX", ":", "raise", "errors", ".", "EncodeError", "(", "'Value out of range: %d'", "%", "value", ")", ...
Appends a signed 32-bit integer to the internal buffer, encoded as a varint. (Note that a negative varint32 will always require 10 bytes of space.)
[ "Appends", "a", "signed", "32", "-", "bit", "integer", "to", "the", "internal", "buffer", "encoded", "as", "a", "varint", ".", "(", "Note", "that", "a", "negative", "varint32", "will", "always", "require", "10", "bytes", "of", "space", ".", ")" ]
python
train
49.125
pypa/pipenv
pipenv/vendor/passa/internals/traces.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/internals/traces.py#L18-L40
def trace_graph(graph): """Build a collection of "traces" for each package. A trace is a list of names that eventually leads to the package. For example, if A and B are root dependencies, A depends on C and D, B depends on C, and C depends on D, the return value would be like:: { N...
[ "def", "trace_graph", "(", "graph", ")", ":", "result", "=", "{", "None", ":", "[", "]", "}", "for", "vertex", "in", "graph", ":", "result", "[", "vertex", "]", "=", "[", "]", "for", "root", "in", "graph", ".", "iter_children", "(", "None", ")", ...
Build a collection of "traces" for each package. A trace is a list of names that eventually leads to the package. For example, if A and B are root dependencies, A depends on C and D, B depends on C, and C depends on D, the return value would be like:: { None: [], "A": [None...
[ "Build", "a", "collection", "of", "traces", "for", "each", "package", "." ]
python
train
32.652174
ekzhu/datasketch
benchmark/average_precision.py
https://github.com/ekzhu/datasketch/blob/b3e4129987890a2beb04f2c0b6dc618ae35f2e14/benchmark/average_precision.py#L3-L39
def apk(actual, predicted, k=10): """ Computes the average precision at k. This function computes the average prescision at k between two lists of items. Parameters ---------- actual : list A list of elements that are to be predicted (order doesn't matter) predicted : list...
[ "def", "apk", "(", "actual", ",", "predicted", ",", "k", "=", "10", ")", ":", "if", "len", "(", "predicted", ")", ">", "k", ":", "predicted", "=", "predicted", "[", ":", "k", "]", "score", "=", "0.0", "num_hits", "=", "0.0", "for", "i", ",", "p...
Computes the average precision at k. This function computes the average prescision at k between two lists of items. Parameters ---------- actual : list A list of elements that are to be predicted (order doesn't matter) predicted : list A list of predicted elements ...
[ "Computes", "the", "average", "precision", "at", "k", "." ]
python
test
23.513514
pandas-dev/pandas
pandas/core/common.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/common.py#L404-L430
def random_state(state=None): """ Helper function for processing random_state arguments. Parameters ---------- state : int, np.random.RandomState, None. If receives an int, passes to np.random.RandomState() as seed. If receives an np.random.RandomState object, just returns object. ...
[ "def", "random_state", "(", "state", "=", "None", ")", ":", "if", "is_integer", "(", "state", ")", ":", "return", "np", ".", "random", ".", "RandomState", "(", "state", ")", "elif", "isinstance", "(", "state", ",", "np", ".", "random", ".", "RandomStat...
Helper function for processing random_state arguments. Parameters ---------- state : int, np.random.RandomState, None. If receives an int, passes to np.random.RandomState() as seed. If receives an np.random.RandomState object, just returns object. If receives `None`, returns np.rand...
[ "Helper", "function", "for", "processing", "random_state", "arguments", "." ]
python
train
29.962963
briancappello/py-meta-utils
py_meta_utils.py
https://github.com/briancappello/py-meta-utils/blob/8de20be00768b7749dc2207a98331a9f23187918/py_meta_utils.py#L76-L82
def is_abstract(self) -> bool: """ Whether or not the class-under-construction was declared as abstract (**NOTE:** this property is usable even *before* the :class:`MetaOptionsFactory` has run) """ meta_value = getattr(self.clsdict.get('Meta'), 'abstract', False) return s...
[ "def", "is_abstract", "(", "self", ")", "->", "bool", ":", "meta_value", "=", "getattr", "(", "self", ".", "clsdict", ".", "get", "(", "'Meta'", ")", ",", "'abstract'", ",", "False", ")", "return", "self", ".", "clsdict", ".", "get", "(", "ABSTRACT_ATT...
Whether or not the class-under-construction was declared as abstract (**NOTE:** this property is usable even *before* the :class:`MetaOptionsFactory` has run)
[ "Whether", "or", "not", "the", "class", "-", "under", "-", "construction", "was", "declared", "as", "abstract", "(", "**", "NOTE", ":", "**", "this", "property", "is", "usable", "even", "*", "before", "*", "the", ":", "class", ":", "MetaOptionsFactory", ...
python
train
52
redhat-cip/dci-control-server
dci/api/v1/utils.py
https://github.com/redhat-cip/dci-control-server/blob/b416cf935ec93e4fdd5741f61a21cabecf8454d2/dci/api/v1/utils.py#L586-L602
def common_values_dict(): """Build a basic values object used in every create method. All our resources contain a same subset of value. Instead of redoing this code everytime, this method ensures it is done only at one place. """ now = datetime.datetime.utcnow().isoformat() etag = ...
[ "def", "common_values_dict", "(", ")", ":", "now", "=", "datetime", ".", "datetime", ".", "utcnow", "(", ")", ".", "isoformat", "(", ")", "etag", "=", "utils", ".", "gen_etag", "(", ")", "values", "=", "{", "'id'", ":", "utils", ".", "gen_uuid", "(",...
Build a basic values object used in every create method. All our resources contain a same subset of value. Instead of redoing this code everytime, this method ensures it is done only at one place.
[ "Build", "a", "basic", "values", "object", "used", "in", "every", "create", "method", "." ]
python
train
27.470588
saltstack/salt
salt/modules/win_wua.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_wua.py#L99-L236
def available(software=True, drivers=True, summary=False, skip_installed=True, skip_hidden=True, skip_mandatory=False, skip_reboot=False, categories=None, severities=None,): ''' .. versionadded:: 2017...
[ "def", "available", "(", "software", "=", "True", ",", "drivers", "=", "True", ",", "summary", "=", "False", ",", "skip_installed", "=", "True", ",", "skip_hidden", "=", "True", ",", "skip_mandatory", "=", "False", ",", "skip_reboot", "=", "False", ",", ...
.. versionadded:: 2017.7.0 List updates that match the passed criteria. This allows for more filter options than :func:`list`. Good for finding a specific GUID or KB. Args: software (bool): Include software updates in the results (default is True) drivers (bool): ...
[ "..", "versionadded", "::", "2017", ".", "7", ".", "0" ]
python
train
35.181159
kemingy/cnprep
cnprep/extractor.py
https://github.com/kemingy/cnprep/blob/076ea185167adb7e652bea3b81fb6830e162e880/cnprep/extractor.py#L127-L132
def _filter(self): """ delete the punctuation """ pattern = u"[\s+\.\!\-\/_,$%^*(+\"\']+|[+——!】【,。??:、:~@#¥%……&*“”()]+" self.m = re.sub(pattern, "", self.m)
[ "def", "_filter", "(", "self", ")", ":", "pattern", "=", "u\"[\\s+\\.\\!\\-\\/_,$%^*(+\\\"\\']+|[+——!】【,。??:、:~@#¥%……&*“”()]+\"", "self", ".", "m", "=", "re", ".", "sub", "(", "pattern", ",", "\"\"", ",", "self", ".", "m", ")" ]
delete the punctuation
[ "delete", "the", "punctuation" ]
python
train
31.833333
slundberg/shap
shap/benchmark/metrics.py
https://github.com/slundberg/shap/blob/b280cb81d498b9d98565cad8dd16fc88ae52649f/shap/benchmark/metrics.py#L421-L428
def batch_keep_absolute_retrain__roc_auc(X, y, model_generator, method_name, num_fcounts=11): """ Batch Keep Absolute (retrain) xlabel = "Fraction of features kept" ylabel = "ROC AUC" transform = "identity" sort_order = 13 """ return __run_batch_abs_metric(measures.batch_keep_retrain, X, y, ...
[ "def", "batch_keep_absolute_retrain__roc_auc", "(", "X", ",", "y", ",", "model_generator", ",", "method_name", ",", "num_fcounts", "=", "11", ")", ":", "return", "__run_batch_abs_metric", "(", "measures", ".", "batch_keep_retrain", ",", "X", ",", "y", ",", "mode...
Batch Keep Absolute (retrain) xlabel = "Fraction of features kept" ylabel = "ROC AUC" transform = "identity" sort_order = 13
[ "Batch", "Keep", "Absolute", "(", "retrain", ")", "xlabel", "=", "Fraction", "of", "features", "kept", "ylabel", "=", "ROC", "AUC", "transform", "=", "identity", "sort_order", "=", "13" ]
python
train
48.25
CybOXProject/mixbox
mixbox/fields.py
https://github.com/CybOXProject/mixbox/blob/9097dae7a433f5b98c18171c4a5598f69a7d30af/mixbox/fields.py#L260-L276
def transformer(self): """Return the class for this field that transforms non-Entity objects (e.g., dicts or binding objects) into Entity instances. Any non-None value returned from this method should implement a from_obj() and from_dict() method. Returns: None if n...
[ "def", "transformer", "(", "self", ")", ":", "if", "self", ".", "factory", ":", "return", "self", ".", "factory", "elif", "self", ".", "type_", ":", "return", "self", ".", "type_", "else", ":", "return", "None" ]
Return the class for this field that transforms non-Entity objects (e.g., dicts or binding objects) into Entity instances. Any non-None value returned from this method should implement a from_obj() and from_dict() method. Returns: None if no type_ or factory is defined by t...
[ "Return", "the", "class", "for", "this", "field", "that", "transforms", "non", "-", "Entity", "objects", "(", "e", ".", "g", ".", "dicts", "or", "binding", "objects", ")", "into", "Entity", "instances", "." ]
python
train
34.294118
klen/graphite-beacon
graphite_beacon/alerts.py
https://github.com/klen/graphite-beacon/blob/c1f071e9f557693bc90f6acbc314994985dc3b77/graphite_beacon/alerts.py#L144-L149
def convert(self, value): """Convert self value.""" try: return convert_to_format(value, self._format) except (ValueError, TypeError): return value
[ "def", "convert", "(", "self", ",", "value", ")", ":", "try", ":", "return", "convert_to_format", "(", "value", ",", "self", ".", "_format", ")", "except", "(", "ValueError", ",", "TypeError", ")", ":", "return", "value" ]
Convert self value.
[ "Convert", "self", "value", "." ]
python
train
31.666667
scanny/python-pptx
pptx/shapes/group.py
https://github.com/scanny/python-pptx/blob/d6ab8234f8b03953d2f831ff9394b1852db34130/pptx/shapes/group.py#L55-L62
def shapes(self): """|GroupShapes| object for this group. The |GroupShapes| object provides access to the group's member shapes and provides methods for adding new ones. """ from pptx.shapes.shapetree import GroupShapes return GroupShapes(self._element, self)
[ "def", "shapes", "(", "self", ")", ":", "from", "pptx", ".", "shapes", ".", "shapetree", "import", "GroupShapes", "return", "GroupShapes", "(", "self", ".", "_element", ",", "self", ")" ]
|GroupShapes| object for this group. The |GroupShapes| object provides access to the group's member shapes and provides methods for adding new ones.
[ "|GroupShapes|", "object", "for", "this", "group", "." ]
python
train
37.625
fjwCode/cerium
cerium/androiddriver.py
https://github.com/fjwCode/cerium/blob/f6e06e0dcf83a0bc924828e9d6cb81383ed2364f/cerium/androiddriver.py#L227-L229
def tcpip(self, port: int or str = 5555) -> None: '''Restart adb server listening on TCP on PORT.''' self._execute('-s', self.device_sn, 'tcpip', str(port))
[ "def", "tcpip", "(", "self", ",", "port", ":", "int", "or", "str", "=", "5555", ")", "->", "None", ":", "self", ".", "_execute", "(", "'-s'", ",", "self", ".", "device_sn", ",", "'tcpip'", ",", "str", "(", "port", ")", ")" ]
Restart adb server listening on TCP on PORT.
[ "Restart", "adb", "server", "listening", "on", "TCP", "on", "PORT", "." ]
python
train
56.666667
rosenbrockc/fortpy
fortpy/parsers/module.py
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/parsers/module.py#L76-L90
def _rt_parse_types(self, statement, element, mode, lineparser): """As part of parse_line(), checks for new type declarations in the statement.""" if mode == "insert": #Since we got to this point, there is *no* code element that owns the current #line which is being replaced; we ...
[ "def", "_rt_parse_types", "(", "self", ",", "statement", ",", "element", ",", "mode", ",", "lineparser", ")", ":", "if", "mode", "==", "\"insert\"", ":", "#Since we got to this point, there is *no* code element that owns the current", "#line which is being replaced; we are me...
As part of parse_line(), checks for new type declarations in the statement.
[ "As", "part", "of", "parse_line", "()", "checks", "for", "new", "type", "declarations", "in", "the", "statement", "." ]
python
train
68.6
coghost/izen
izen/helper.py
https://github.com/coghost/izen/blob/432db017f99dd2ba809e1ba1792145ab6510263d/izen/helper.py#L382-L402
def unixtime2str(timestamp, fmt='%Y-%m-%d %H:%M:%S'): """ 将 ``秒级别的时间戳`` 转换成字符串 .. warning: 时间戳是以 ``秒`` 为单位的 :param timestamp: unix timestamp :type timestamp: int :param fmt: show format :type fmt: str :return: :rtype: str """ dt = None try: timestamp = t...
[ "def", "unixtime2str", "(", "timestamp", ",", "fmt", "=", "'%Y-%m-%d %H:%M:%S'", ")", ":", "dt", "=", "None", "try", ":", "timestamp", "=", "time", ".", "localtime", "(", "timestamp", ")", "dt", "=", "time", ".", "strftime", "(", "fmt", ",", "timestamp",...
将 ``秒级别的时间戳`` 转换成字符串 .. warning: 时间戳是以 ``秒`` 为单位的 :param timestamp: unix timestamp :type timestamp: int :param fmt: show format :type fmt: str :return: :rtype: str
[ "将", "秒级别的时间戳", "转换成字符串" ]
python
train
20.428571
awslabs/aws-shell
awsshell/app.py
https://github.com/awslabs/aws-shell/blob/8950f03d9d720879890af6c11537b8f9789ce5a9/awsshell/app.py#L258-L270
def load_config(self): """Load the config from the config file or template.""" config = Config() self.config_obj = config.load('awsshellrc') self.config_section = self.config_obj['aws-shell'] self.model_completer.match_fuzzy = self.config_section.as_bool( 'match_fuzzy...
[ "def", "load_config", "(", "self", ")", ":", "config", "=", "Config", "(", ")", "self", ".", "config_obj", "=", "config", ".", "load", "(", "'awsshellrc'", ")", "self", ".", "config_section", "=", "self", ".", "config_obj", "[", "'aws-shell'", "]", "self...
Load the config from the config file or template.
[ "Load", "the", "config", "from", "the", "config", "file", "or", "template", "." ]
python
train
48.461538
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py#L121-L127
def find_path(self, notebook_id): """Return a full path to a notebook given its notebook_id.""" try: name = self.mapping[notebook_id] except KeyError: raise web.HTTPError(404, u'Notebook does not exist: %s' % notebook_id) return self.get_path_by_name(name)
[ "def", "find_path", "(", "self", ",", "notebook_id", ")", ":", "try", ":", "name", "=", "self", ".", "mapping", "[", "notebook_id", "]", "except", "KeyError", ":", "raise", "web", ".", "HTTPError", "(", "404", ",", "u'Notebook does not exist: %s'", "%", "n...
Return a full path to a notebook given its notebook_id.
[ "Return", "a", "full", "path", "to", "a", "notebook", "given", "its", "notebook_id", "." ]
python
test
43.714286
ewels/MultiQC
multiqc/modules/fastqc/fastqc.py
https://github.com/ewels/MultiQC/blob/2037d6322b2554146a74efbf869156ad20d4c4ec/multiqc/modules/fastqc/fastqc.py#L670-L716
def seq_length_dist_plot (self): """ Create the HTML for the Sequence Length Distribution plot """ data = dict() seq_lengths = set() multiple_lenths = False for s_name in self.fastqc_data: try: data[s_name] = {self.avg_bp_from_range(d['length']): d['c...
[ "def", "seq_length_dist_plot", "(", "self", ")", ":", "data", "=", "dict", "(", ")", "seq_lengths", "=", "set", "(", ")", "multiple_lenths", "=", "False", "for", "s_name", "in", "self", ".", "fastqc_data", ":", "try", ":", "data", "[", "s_name", "]", "...
Create the HTML for the Sequence Length Distribution plot
[ "Create", "the", "HTML", "for", "the", "Sequence", "Length", "Distribution", "plot" ]
python
train
47.87234
SheffieldML/GPy
GPy/likelihoods/gamma.py
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/gamma.py#L124-L141
def d3logpdf_dlink3(self, link_f, y, Y_metadata=None): """ Third order derivative log-likelihood function at y given link(f) w.r.t link(f) .. math:: \\frac{d^{3} \\ln p(y_{i}|\lambda(f_{i}))}{d^{3}\\lambda(f)} = -\\beta^{3}\\frac{d^{2}\\Psi(\\alpha_{i})}{d\\alpha_{i}}\\\\ ...
[ "def", "d3logpdf_dlink3", "(", "self", ",", "link_f", ",", "y", ",", "Y_metadata", "=", "None", ")", ":", "d3lik_dlink3", "=", "-", "special", ".", "polygamma", "(", "2", ",", "self", ".", "beta", "*", "link_f", ")", "*", "(", "self", ".", "beta", ...
Third order derivative log-likelihood function at y given link(f) w.r.t link(f) .. math:: \\frac{d^{3} \\ln p(y_{i}|\lambda(f_{i}))}{d^{3}\\lambda(f)} = -\\beta^{3}\\frac{d^{2}\\Psi(\\alpha_{i})}{d\\alpha_{i}}\\\\ \\alpha_{i} = \\beta y_{i} :param link_f: latent variables link(...
[ "Third", "order", "derivative", "log", "-", "likelihood", "function", "at", "y", "given", "link", "(", "f", ")", "w", ".", "r", ".", "t", "link", "(", "f", ")" ]
python
train
41.944444
Julius2342/pyvlx
pyvlx/get_all_nodes_information.py
https://github.com/Julius2342/pyvlx/blob/ee78e1324bcb1be5b8d1a9d05ab5496b72eae848/pyvlx/get_all_nodes_information.py#L21-L34
async def handle_frame(self, frame): """Handle incoming API frame, return True if this was the expected frame.""" if isinstance(frame, FrameGetAllNodesInformationConfirmation): self.number_of_nodes = frame.number_of_nodes # We are still waiting for FrameGetAllNodesInformationNoti...
[ "async", "def", "handle_frame", "(", "self", ",", "frame", ")", ":", "if", "isinstance", "(", "frame", ",", "FrameGetAllNodesInformationConfirmation", ")", ":", "self", ".", "number_of_nodes", "=", "frame", ".", "number_of_nodes", "# We are still waiting for FrameGetA...
Handle incoming API frame, return True if this was the expected frame.
[ "Handle", "incoming", "API", "frame", "return", "True", "if", "this", "was", "the", "expected", "frame", "." ]
python
train
55.785714
openstack/networking-cisco
networking_cisco/plugins/cisco/cfg_agent/device_drivers/asr1k/asr1k_routing_driver.py
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/cfg_agent/device_drivers/asr1k/asr1k_routing_driver.py#L360-L373
def _get_vrf_name(self, ri): """ overloaded method for generating a vrf_name that supports region_id """ router_id = ri.router_name()[:self.DEV_NAME_LEN] is_multi_region_enabled = cfg.CONF.multi_region.enable_multi_region if is_multi_region_enabled: r...
[ "def", "_get_vrf_name", "(", "self", ",", "ri", ")", ":", "router_id", "=", "ri", ".", "router_name", "(", ")", "[", ":", "self", ".", "DEV_NAME_LEN", "]", "is_multi_region_enabled", "=", "cfg", ".", "CONF", ".", "multi_region", ".", "enable_multi_region", ...
overloaded method for generating a vrf_name that supports region_id
[ "overloaded", "method", "for", "generating", "a", "vrf_name", "that", "supports", "region_id" ]
python
train
34
aetros/aetros-cli
aetros/backend.py
https://github.com/aetros/aetros-cli/blob/a2a1f38d6af1660e1e2680c7d413ec2aef45faab/aetros/backend.py#L1168-L1175
def write_log(self, message): """ Proxy method for GeneralLogger. """ if self.stream_log and not self.ended: # points to the Git stream write self.stream_log.write(message) return True
[ "def", "write_log", "(", "self", ",", "message", ")", ":", "if", "self", ".", "stream_log", "and", "not", "self", ".", "ended", ":", "# points to the Git stream write", "self", ".", "stream_log", ".", "write", "(", "message", ")", "return", "True" ]
Proxy method for GeneralLogger.
[ "Proxy", "method", "for", "GeneralLogger", "." ]
python
train
30.625
INM-6/hybridLFPy
examples/example_microcircuit.py
https://github.com/INM-6/hybridLFPy/blob/c38bdf38982c4624c2f70caeb50c40f1d5980abd/examples/example_microcircuit.py#L186-L223
def send_nest_params_to_sli(p): ''' Read parameters and send them to SLI Parameters ---------- p : dict sli parameter name and value as dictionary key and value pairs Returns ------- None ''' for name in p.keys(): value = p[name] if type(value) =...
[ "def", "send_nest_params_to_sli", "(", "p", ")", ":", "for", "name", "in", "p", ".", "keys", "(", ")", ":", "value", "=", "p", "[", "name", "]", "if", "type", "(", "value", ")", "==", "np", ".", "ndarray", ":", "value", "=", "value", ".", "tolist...
Read parameters and send them to SLI Parameters ---------- p : dict sli parameter name and value as dictionary key and value pairs Returns ------- None
[ "Read", "parameters", "and", "send", "them", "to", "SLI", "Parameters", "----------", "p", ":", "dict", "sli", "parameter", "name", "and", "value", "as", "dictionary", "key", "and", "value", "pairs", "Returns", "-------", "None" ]
python
train
29.868421
airspeed-velocity/asv
asv/extern/asizeof.py
https://github.com/airspeed-velocity/asv/blob/d23bb8b74e8adacbfa3cf5724bda55fb39d56ba6/asv/extern/asizeof.py#L189-L197
def _calcsize(fmt): '''struct.calcsize() handling 'z' for Py_ssize_t. ''' # sizeof(long) != sizeof(ssize_t) on LLP64 if _sizeof_Clong < _sizeof_Cvoidp: # pragma: no coverage z = 'P' else: z = 'L' return calcsize(fmt.replace('z', z))
[ "def", "_calcsize", "(", "fmt", ")", ":", "# sizeof(long) != sizeof(ssize_t) on LLP64", "if", "_sizeof_Clong", "<", "_sizeof_Cvoidp", ":", "# pragma: no coverage", "z", "=", "'P'", "else", ":", "z", "=", "'L'", "return", "calcsize", "(", "fmt", ".", "replace", "...
struct.calcsize() handling 'z' for Py_ssize_t.
[ "struct", ".", "calcsize", "()", "handling", "z", "for", "Py_ssize_t", "." ]
python
train
29.444444
CalebBell/fluids
fluids/packed_bed.py
https://github.com/CalebBell/fluids/blob/57f556752e039f1d3e5a822f408c184783db2828/fluids/packed_bed.py#L908-L972
def Guo_Sun(dp, voidage, vs, rho, mu, Dt, L=1): r'''Calculates pressure drop across a packed bed of spheres using a correlation developed in [1]_. This is valid for highly-packed particles at particle/tube diameter ratios between 2 and 3, where a ring packing structure occurs. If a packing ratio is so...
[ "def", "Guo_Sun", "(", "dp", ",", "voidage", ",", "vs", ",", "rho", ",", "mu", ",", "Dt", ",", "L", "=", "1", ")", ":", "# 2 < D/d < 3, particles in contact with the wall tend to form a highly ordered ring structure. ", "Rem", "=", "dp", "*", "rho", "*", "vs", ...
r'''Calculates pressure drop across a packed bed of spheres using a correlation developed in [1]_. This is valid for highly-packed particles at particle/tube diameter ratios between 2 and 3, where a ring packing structure occurs. If a packing ratio is so low, it is important to use this model because ...
[ "r", "Calculates", "pressure", "drop", "across", "a", "packed", "bed", "of", "spheres", "using", "a", "correlation", "developed", "in", "[", "1", "]", "_", ".", "This", "is", "valid", "for", "highly", "-", "packed", "particles", "at", "particle", "/", "t...
python
train
31.815385
theSage21/lanchat
lanchat/chat.py
https://github.com/theSage21/lanchat/blob/66f5dcead67fef815347b956b1d3e149a7e13b29/lanchat/chat.py#L9-L13
def notice(txt, color=False): "print notice" if color: txt = config.Col.WARNING + txt + config.Col.ENDC print(txt)
[ "def", "notice", "(", "txt", ",", "color", "=", "False", ")", ":", "if", "color", ":", "txt", "=", "config", ".", "Col", ".", "WARNING", "+", "txt", "+", "config", ".", "Col", ".", "ENDC", "print", "(", "txt", ")" ]
print notice
[ "print", "notice" ]
python
train
26
splunk/splunk-sdk-python
examples/random_numbers/random_numbers.py
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/random_numbers/random_numbers.py#L30-L71
def get_scheme(self): """When Splunk starts, it looks for all the modular inputs defined by its configuration, and tries to run them with the argument --scheme. Splunkd expects the modular inputs to print a description of the input in XML on stdout. The modular input framework takes care...
[ "def", "get_scheme", "(", "self", ")", ":", "# \"random_numbers\" is the name Splunk will display to users for this input.", "scheme", "=", "Scheme", "(", "\"Random Numbers\"", ")", "scheme", ".", "description", "=", "\"Streams events containing a random number.\"", "# If you set...
When Splunk starts, it looks for all the modular inputs defined by its configuration, and tries to run them with the argument --scheme. Splunkd expects the modular inputs to print a description of the input in XML on stdout. The modular input framework takes care of all the details of fo...
[ "When", "Splunk", "starts", "it", "looks", "for", "all", "the", "modular", "inputs", "defined", "by", "its", "configuration", "and", "tries", "to", "run", "them", "with", "the", "argument", "--", "scheme", ".", "Splunkd", "expects", "the", "modular", "inputs...
python
train
49.928571
marshmallow-code/webargs
src/webargs/aiohttpparser.py
https://github.com/marshmallow-code/webargs/blob/40cc2d25421d15d9630b1a819f1dcefbbf01ed95/src/webargs/aiohttpparser.py#L122-L124
def parse_match_info(self, req: Request, name: str, field: Field) -> typing.Any: """Pull a value from the request's ``match_info``.""" return core.get_value(req.match_info, name, field)
[ "def", "parse_match_info", "(", "self", ",", "req", ":", "Request", ",", "name", ":", "str", ",", "field", ":", "Field", ")", "->", "typing", ".", "Any", ":", "return", "core", ".", "get_value", "(", "req", ".", "match_info", ",", "name", ",", "field...
Pull a value from the request's ``match_info``.
[ "Pull", "a", "value", "from", "the", "request", "s", "match_info", "." ]
python
train
66.333333
timeyyy/apptools
peasoup/uploadlogs.py
https://github.com/timeyyy/apptools/blob/d3c0f324b0c2689c35f5601348276f4efd6cb240/peasoup/uploadlogs.py#L122-L131
def rot13(self, encrypyted): ''' Very secure encryption (ceaser used it), apply it multiple times''' def random(): # guarnteed random from fair dice roll return 4 return codecs.encode( codecs.encode( crypto(encrypyte...
[ "def", "rot13", "(", "self", ",", "encrypyted", ")", ":", "def", "random", "(", ")", ":", "# guarnteed random from fair dice roll", "return", "4", "return", "codecs", ".", "encode", "(", "codecs", ".", "encode", "(", "crypto", "(", "encrypyted", ")", ".", ...
Very secure encryption (ceaser used it), apply it multiple times
[ "Very", "secure", "encryption", "(", "ceaser", "used", "it", ")", "apply", "it", "multiple", "times" ]
python
train
47.2
pyBookshelf/bookshelf
bookshelf/api_v1.py
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L1308-L1312
def install_python_module_locally(name): """ instals a python module using pip """ with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=False, capture=True): local('pip --quiet install %s' % name)
[ "def", "install_python_module_locally", "(", "name", ")", ":", "with", "settings", "(", "hide", "(", "'warnings'", ",", "'running'", ",", "'stdout'", ",", "'stderr'", ")", ",", "warn_only", "=", "False", ",", "capture", "=", "True", ")", ":", "local", "(",...
instals a python module using pip
[ "instals", "a", "python", "module", "using", "pip" ]
python
train
49.2
materialsproject/pymatgen
pymatgen/util/string.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/string.py#L141-L173
def transformation_to_string(matrix, translation_vec=(0, 0, 0), components=('x', 'y', 'z'), c='', delim=','): """ Convenience method. Given matrix returns string, e.g. x+2y+1/4 :param matrix :param translation_vec :param components: either ('x', 'y', 'z') or ('a', 'b', 'c') :param c: optional ad...
[ "def", "transformation_to_string", "(", "matrix", ",", "translation_vec", "=", "(", "0", ",", "0", ",", "0", ")", ",", "components", "=", "(", "'x'", ",", "'y'", ",", "'z'", ")", ",", "c", "=", "''", ",", "delim", "=", "','", ")", ":", "parts", "...
Convenience method. Given matrix returns string, e.g. x+2y+1/4 :param matrix :param translation_vec :param components: either ('x', 'y', 'z') or ('a', 'b', 'c') :param c: optional additional character to print (used for magmoms) :param delim: delimiter :return: xyz string
[ "Convenience", "method", ".", "Given", "matrix", "returns", "string", "e", ".", "g", ".", "x", "+", "2y", "+", "1", "/", "4", ":", "param", "matrix", ":", "param", "translation_vec", ":", "param", "components", ":", "either", "(", "x", "y", "z", ")",...
python
train
35.121212
Alignak-monitoring/alignak
alignak/external_command.py
https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/external_command.py#L2067-L2081
def disable_hostgroup_svc_checks(self, hostgroup): """Disable service checks for a hostgroup Format of the line that triggers function call:: DISABLE_HOSTGROUP_SVC_CHECKS;<hostgroup_name> :param hostgroup: hostgroup to disable :type hostgroup: alignak.objects.hostgroup.Hostgrou...
[ "def", "disable_hostgroup_svc_checks", "(", "self", ",", "hostgroup", ")", ":", "for", "host_id", "in", "hostgroup", ".", "get_hosts", "(", ")", ":", "if", "host_id", "in", "self", ".", "daemon", ".", "hosts", ":", "for", "service_id", "in", "self", ".", ...
Disable service checks for a hostgroup Format of the line that triggers function call:: DISABLE_HOSTGROUP_SVC_CHECKS;<hostgroup_name> :param hostgroup: hostgroup to disable :type hostgroup: alignak.objects.hostgroup.Hostgroup :return: None
[ "Disable", "service", "checks", "for", "a", "hostgroup", "Format", "of", "the", "line", "that", "triggers", "function", "call", "::" ]
python
train
42.866667
bwohlberg/sporco
sporco/dictlrn/cbpdndlmd.py
https://github.com/bwohlberg/sporco/blob/8946a04331106f4e39904fbdf2dc7351900baa04/sporco/dictlrn/cbpdndlmd.py#L33-L41
def cbpdnmsk_class_label_lookup(label): """Get a ConvBPDNMask class from a label string.""" clsmod = {'admm': admm_cbpdn.ConvBPDNMaskDcpl, 'fista': fista_cbpdn.ConvBPDNMask} if label in clsmod: return clsmod[label] else: raise ValueError('Unknown ConvBPDNMask solver method...
[ "def", "cbpdnmsk_class_label_lookup", "(", "label", ")", ":", "clsmod", "=", "{", "'admm'", ":", "admm_cbpdn", ".", "ConvBPDNMaskDcpl", ",", "'fista'", ":", "fista_cbpdn", ".", "ConvBPDNMask", "}", "if", "label", "in", "clsmod", ":", "return", "clsmod", "[", ...
Get a ConvBPDNMask class from a label string.
[ "Get", "a", "ConvBPDNMask", "class", "from", "a", "label", "string", "." ]
python
train
36.111111
scanny/python-pptx
pptx/text/fonts.py
https://github.com/scanny/python-pptx/blob/d6ab8234f8b03953d2f831ff9394b1852db34130/pptx/text/fonts.py#L166-L177
def _iter_table_records(self): """ Generate a (tag, offset, length) 3-tuple for each of the tables in this font file. """ count = self._table_count bufr = self._stream.read(offset=12, length=count*16) tmpl = '>4sLLL' for i in range(count): offs...
[ "def", "_iter_table_records", "(", "self", ")", ":", "count", "=", "self", ".", "_table_count", "bufr", "=", "self", ".", "_stream", ".", "read", "(", "offset", "=", "12", ",", "length", "=", "count", "*", "16", ")", "tmpl", "=", "'>4sLLL'", "for", "...
Generate a (tag, offset, length) 3-tuple for each of the tables in this font file.
[ "Generate", "a", "(", "tag", "offset", "length", ")", "3", "-", "tuple", "for", "each", "of", "the", "tables", "in", "this", "font", "file", "." ]
python
train
36.666667
pgjones/quart
quart/app.py
https://github.com/pgjones/quart/blob/7cb2d3bd98e8746025764f2b933abc12041fa175/quart/app.py#L261-L265
def jinja_env(self) -> Environment: """The jinja environment used to load templates.""" if self._jinja_env is None: self._jinja_env = self.create_jinja_environment() return self._jinja_env
[ "def", "jinja_env", "(", "self", ")", "->", "Environment", ":", "if", "self", ".", "_jinja_env", "is", "None", ":", "self", ".", "_jinja_env", "=", "self", ".", "create_jinja_environment", "(", ")", "return", "self", ".", "_jinja_env" ]
The jinja environment used to load templates.
[ "The", "jinja", "environment", "used", "to", "load", "templates", "." ]
python
train
44
GoogleCloudPlatform/google-cloud-datastore
python/googledatastore/helper.py
https://github.com/GoogleCloudPlatform/google-cloud-datastore/blob/a23940d0634d7f537faf01ad9e60598046bcb40a/python/googledatastore/helper.py#L350-L354
def add_projection(query_proto, *projection): """Add projection properties to the given datatstore.Query proto message.""" for p in projection: proto = query_proto.projection.add() proto.property.name = p
[ "def", "add_projection", "(", "query_proto", ",", "*", "projection", ")", ":", "for", "p", "in", "projection", ":", "proto", "=", "query_proto", ".", "projection", ".", "add", "(", ")", "proto", ".", "property", ".", "name", "=", "p" ]
Add projection properties to the given datatstore.Query proto message.
[ "Add", "projection", "properties", "to", "the", "given", "datatstore", ".", "Query", "proto", "message", "." ]
python
train
42.4
shoebot/shoebot
shoebot/grammar/bot.py
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/grammar/bot.py#L266-L272
def color(self, *args): ''' :param args: color in a supported format. :return: Color object containing the color. ''' return self.Color(mode=self.color_mode, color_range=self.color_range, *args)
[ "def", "color", "(", "self", ",", "*", "args", ")", ":", "return", "self", ".", "Color", "(", "mode", "=", "self", ".", "color_mode", ",", "color_range", "=", "self", ".", "color_range", ",", "*", "args", ")" ]
:param args: color in a supported format. :return: Color object containing the color.
[ ":", "param", "args", ":", "color", "in", "a", "supported", "format", "." ]
python
valid
32.714286
spyder-ide/spyder
spyder/plugins/plots/widgets/figurebrowser.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L284-L291
def show_fig_outline_in_viewer(self, state): """Draw a frame around the figure viewer if state is True.""" if state is True: self.figviewer.figcanvas.setStyleSheet( "FigureCanvas{border: 1px solid lightgrey;}") else: self.figviewer.figcanvas.setStyleSh...
[ "def", "show_fig_outline_in_viewer", "(", "self", ",", "state", ")", ":", "if", "state", "is", "True", ":", "self", ".", "figviewer", ".", "figcanvas", ".", "setStyleSheet", "(", "\"FigureCanvas{border: 1px solid lightgrey;}\"", ")", "else", ":", "self", ".", "f...
Draw a frame around the figure viewer if state is True.
[ "Draw", "a", "frame", "around", "the", "figure", "viewer", "if", "state", "is", "True", "." ]
python
train
48.75
pauleveritt/kaybee
kaybee/utils/rst.py
https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/utils/rst.py#L45-L53
def get_rst_excerpt(rst_doc: document, paragraphs: int = 1) -> str: """ Given rst, parse and return a portion """ texts = [] for count, p in enumerate(rst_doc.traverse(paragraph)): texts.append(p.astext()) if count + 1 == paragraphs: break return ' '.join(texts)
[ "def", "get_rst_excerpt", "(", "rst_doc", ":", "document", ",", "paragraphs", ":", "int", "=", "1", ")", "->", "str", ":", "texts", "=", "[", "]", "for", "count", ",", "p", "in", "enumerate", "(", "rst_doc", ".", "traverse", "(", "paragraph", ")", ")...
Given rst, parse and return a portion
[ "Given", "rst", "parse", "and", "return", "a", "portion" ]
python
train
33.222222
jldantas/libmft
libmft/attribute.py
https://github.com/jldantas/libmft/blob/65a988605fe7663b788bd81dcb52c0a4eaad1549/libmft/attribute.py#L1795-L1812
def _from_binary_ea(cls, binary_stream): """See base class.""" _ea_list = [] offset = 0 #_MOD_LOGGER.debug(f"Creating Ea object from binary stream {binary_stream.tobytes()}...") _MOD_LOGGER.debug("Creating Ea object from binary '%s'...", binary_stream.tobytes()) while True: entry = EaEn...
[ "def", "_from_binary_ea", "(", "cls", ",", "binary_stream", ")", ":", "_ea_list", "=", "[", "]", "offset", "=", "0", "#_MOD_LOGGER.debug(f\"Creating Ea object from binary stream {binary_stream.tobytes()}...\")", "_MOD_LOGGER", ".", "debug", "(", "\"Creating Ea object from bin...
See base class.
[ "See", "base", "class", "." ]
python
train
35
ray-project/ray
examples/parameter_server/model.py
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/examples/parameter_server/model.py#L120-L180
def deepnn(x): """deepnn builds the graph for a deep net for classifying digits. Args: x: an input tensor with the dimensions (N_examples, 784), where 784 is the number of pixels in a standard MNIST image. Returns: A tuple (y, keep_prob). y is a tensor of shape (N_examples, 10)...
[ "def", "deepnn", "(", "x", ")", ":", "# Reshape to use within a convolutional neural net.", "# Last dimension is for \"features\" - there is only one here, since images", "# are grayscale -- it would be 3 for an RGB image, 4 for RGBA, etc.", "with", "tf", ".", "name_scope", "(", "\"resha...
deepnn builds the graph for a deep net for classifying digits. Args: x: an input tensor with the dimensions (N_examples, 784), where 784 is the number of pixels in a standard MNIST image. Returns: A tuple (y, keep_prob). y is a tensor of shape (N_examples, 10), with val...
[ "deepnn", "builds", "the", "graph", "for", "a", "deep", "net", "for", "classifying", "digits", "." ]
python
train
39.032787
tensorflow/tensorboard
tensorboard/plugins/debugger/comm_channel.py
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/debugger/comm_channel.py#L52-L65
def put(self, message): """Put a message into the outgoing message stack. Outgoing message will be stored indefinitely to support multi-users. """ with self._outgoing_lock: self._outgoing.append(message) self._outgoing_counter += 1 # Check to see if there are pending queues waiting f...
[ "def", "put", "(", "self", ",", "message", ")", ":", "with", "self", ".", "_outgoing_lock", ":", "self", ".", "_outgoing", ".", "append", "(", "message", ")", "self", ".", "_outgoing_counter", "+=", "1", "# Check to see if there are pending queues waiting for the ...
Put a message into the outgoing message stack. Outgoing message will be stored indefinitely to support multi-users.
[ "Put", "a", "message", "into", "the", "outgoing", "message", "stack", "." ]
python
train
39.142857
atlassian-api/atlassian-python-api
atlassian/rest_client.py
https://github.com/atlassian-api/atlassian-python-api/blob/540d269905c3e7547b666fe30c647b2d512cf358/atlassian/rest_client.py#L160-L167
def delete(self, path, data=None, headers=None, params=None): """ Deletes resources at given paths. :rtype: dict :return: Empty dictionary to have consistent interface. Some of Atlassian REST resources don't return any content. """ self.request('DELETE', path=path...
[ "def", "delete", "(", "self", ",", "path", ",", "data", "=", "None", ",", "headers", "=", "None", ",", "params", "=", "None", ")", ":", "self", ".", "request", "(", "'DELETE'", ",", "path", "=", "path", ",", "data", "=", "data", ",", "headers", "...
Deletes resources at given paths. :rtype: dict :return: Empty dictionary to have consistent interface. Some of Atlassian REST resources don't return any content.
[ "Deletes", "resources", "at", "given", "paths", ".", ":", "rtype", ":", "dict", ":", "return", ":", "Empty", "dictionary", "to", "have", "consistent", "interface", ".", "Some", "of", "Atlassian", "REST", "resources", "don", "t", "return", "any", "content", ...
python
train
44.625
fedora-python/pyp2rpm
pyp2rpm/module_runners.py
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/module_runners.py#L35-L42
def run(self): """Executes the code of the specified module.""" with utils.ChangeDir(self.dirname): sys.path.insert(0, self.dirname) sys.argv[1:] = self.args runpy.run_module(self.not_suffixed(self.filename), run_name='__main__', ...
[ "def", "run", "(", "self", ")", ":", "with", "utils", ".", "ChangeDir", "(", "self", ".", "dirname", ")", ":", "sys", ".", "path", ".", "insert", "(", "0", ",", "self", ".", "dirname", ")", "sys", ".", "argv", "[", "1", ":", "]", "=", "self", ...
Executes the code of the specified module.
[ "Executes", "the", "code", "of", "the", "specified", "module", "." ]
python
train
43.5
scikit-umfpack/scikit-umfpack
scikits/umfpack/interface.py
https://github.com/scikit-umfpack/scikit-umfpack/blob/a2102ef92f4dd060138e72bb5d7c444f8ec49cbc/scikits/umfpack/interface.py#L44-L68
def spsolve(A, b): """Solve the sparse linear system Ax=b, where b may be a vector or a matrix. Parameters ---------- A : ndarray or sparse matrix The square matrix A will be converted into CSC or CSR form b : ndarray or sparse matrix The matrix or vector representing the right hand...
[ "def", "spsolve", "(", "A", ",", "b", ")", ":", "x", "=", "UmfpackLU", "(", "A", ")", ".", "solve", "(", "b", ")", "if", "b", ".", "ndim", "==", "2", "and", "b", ".", "shape", "[", "1", "]", "==", "1", ":", "# compatibility with scipy.sparse.spso...
Solve the sparse linear system Ax=b, where b may be a vector or a matrix. Parameters ---------- A : ndarray or sparse matrix The square matrix A will be converted into CSC or CSR form b : ndarray or sparse matrix The matrix or vector representing the right hand side of the equation. ...
[ "Solve", "the", "sparse", "linear", "system", "Ax", "=", "b", "where", "b", "may", "be", "a", "vector", "or", "a", "matrix", "." ]
python
train
30.36
fulfilio/python-magento
magento/sales.py
https://github.com/fulfilio/python-magento/blob/720ec136a6e438a9ee4ee92848a9820b91732750/magento/sales.py#L418-L432
def addcomment(self, invoice_increment_id, comment=None, email=False, include_comment=False): """ Add comment to invoice or change its state :param invoice_increment_id: Invoice ID """ if comment is None: comment = "" return bool( self...
[ "def", "addcomment", "(", "self", ",", "invoice_increment_id", ",", "comment", "=", "None", ",", "email", "=", "False", ",", "include_comment", "=", "False", ")", ":", "if", "comment", "is", "None", ":", "comment", "=", "\"\"", "return", "bool", "(", "se...
Add comment to invoice or change its state :param invoice_increment_id: Invoice ID
[ "Add", "comment", "to", "invoice", "or", "change", "its", "state" ]
python
train
30.533333
CamDavidsonPilon/lifelines
lifelines/generate_datasets.py
https://github.com/CamDavidsonPilon/lifelines/blob/bdf6be6f1d10eea4c46365ee0ee6a47d8c30edf8/lifelines/generate_datasets.py#L182-L216
def time_varying_coefficients(d, timelines, constant=False, independent=0, randgen=random.exponential): """ Time vary coefficients d: the dimension of the dataset timelines: the observational times constant: True for constant coefficients independent: the number of coffients to set to 0 (covari...
[ "def", "time_varying_coefficients", "(", "d", ",", "timelines", ",", "constant", "=", "False", ",", "independent", "=", "0", ",", "randgen", "=", "random", ".", "exponential", ")", ":", "t", "=", "timelines", ".", "shape", "[", "0", "]", "try", ":", "a...
Time vary coefficients d: the dimension of the dataset timelines: the observational times constant: True for constant coefficients independent: the number of coffients to set to 0 (covariate is ind of survival), or a list of covariates to make indepent. randgen: how scalar coefficients (betas...
[ "Time", "vary", "coefficients" ]
python
train
33.6
kgori/treeCl
treeCl/distance_matrix.py
https://github.com/kgori/treeCl/blob/fed624b3db1c19cc07175ca04e3eda6905a8d305/treeCl/distance_matrix.py#L358-L368
def _embedding_metric_mds(matrix, dimensions=3): """ Private method to calculate MMDS embedding :param dimensions: (int) :return: coordinate matrix (np.array) """ mds = sklearn.manifold.MDS(n_components=dimensions, dissimilarity='precomputed', ...
[ "def", "_embedding_metric_mds", "(", "matrix", ",", "dimensions", "=", "3", ")", ":", "mds", "=", "sklearn", ".", "manifold", ".", "MDS", "(", "n_components", "=", "dimensions", ",", "dissimilarity", "=", "'precomputed'", ",", "metric", "=", "True", ")", "...
Private method to calculate MMDS embedding :param dimensions: (int) :return: coordinate matrix (np.array)
[ "Private", "method", "to", "calculate", "MMDS", "embedding", ":", "param", "dimensions", ":", "(", "int", ")", ":", "return", ":", "coordinate", "matrix", "(", "np", ".", "array", ")" ]
python
train
34.363636
chimpler/pyhocon
pyhocon/converter.py
https://github.com/chimpler/pyhocon/blob/e5b22a8e74e8f88e43cf9e9140cca5f2cd0ab4a3/pyhocon/converter.py#L20-L64
def to_json(cls, config, compact=False, indent=2, level=0): """Convert HOCON input into a JSON output :return: JSON string representation :type return: basestring """ lines = "" if isinstance(config, ConfigTree): if len(config) == 0: lines += ...
[ "def", "to_json", "(", "cls", ",", "config", ",", "compact", "=", "False", ",", "indent", "=", "2", ",", "level", "=", "0", ")", ":", "lines", "=", "\"\"", "if", "isinstance", "(", "config", ",", "ConfigTree", ")", ":", "if", "len", "(", "config", ...
Convert HOCON input into a JSON output :return: JSON string representation :type return: basestring
[ "Convert", "HOCON", "input", "into", "a", "JSON", "output" ]
python
train
40.644444
robinandeer/puzzle
puzzle/plugins/gemini/mixins/variant.py
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/plugins/gemini/mixins/variant.py#L325-L343
def _is_variant(self, gemini_variant, ind_objs): """Check if the variant is a variation in any of the individuals Args: gemini_variant (GeminiQueryRow): The gemini variant ind_objs (list(puzzle.models.individual)): A list of individuals to check Returns: boo...
[ "def", "_is_variant", "(", "self", ",", "gemini_variant", ",", "ind_objs", ")", ":", "indexes", "=", "(", "ind", ".", "ind_index", "for", "ind", "in", "ind_objs", ")", "#Check if any individual have a heterozygous or homozygous variant call", "for", "index", "in", "...
Check if the variant is a variation in any of the individuals Args: gemini_variant (GeminiQueryRow): The gemini variant ind_objs (list(puzzle.models.individual)): A list of individuals to check Returns: bool : If any of the individuals has the variant
[ "Check", "if", "the", "variant", "is", "a", "variation", "in", "any", "of", "the", "individuals" ]
python
train
35.631579
maaku/python-bitcoin
bitcoin/base58.py
https://github.com/maaku/python-bitcoin/blob/1b80c284170fd3f547cc45f4700ce169f3f99641/bitcoin/base58.py#L45-L68
def b58decode(s, errors='strict'): "Decode a base58-encoding string, returning bytes." if not s: return (b'', 0) # Convert the string to an integer n = 0 for c in s: n *= 58 if c not in b58digits: raise InvalidBase58Error(u"character %r is not a valid base58 " ...
[ "def", "b58decode", "(", "s", ",", "errors", "=", "'strict'", ")", ":", "if", "not", "s", ":", "return", "(", "b''", ",", "0", ")", "# Convert the string to an integer", "n", "=", "0", "for", "c", "in", "s", ":", "n", "*=", "58", "if", "c", "not", ...
Decode a base58-encoding string, returning bytes.
[ "Decode", "a", "base58", "-", "encoding", "string", "returning", "bytes", "." ]
python
train
26.583333
quantumlib/Cirq
examples/bcs_mean_field.py
https://github.com/quantumlib/Cirq/blob/0827da80dd7880e5b923eb69407e980ed9bc0bd2/examples/bcs_mean_field.py#L275-L292
def fermi_fourier_trans_inverse_conjugate_4(qubits): """We will need to map the momentum states in the reversed order for spin-down states to the position picture. This transformation can be simply implemented the complex conjugate of the former one. We only need to change the S gate to S* = S ** 3. ...
[ "def", "fermi_fourier_trans_inverse_conjugate_4", "(", "qubits", ")", ":", "yield", "fswap", "(", "qubits", "[", "1", "]", ",", "qubits", "[", "2", "]", ")", ",", "yield", "fermi_fourier_trans_2", "(", "qubits", "[", "0", "]", ",", "qubits", "[", "1", "]...
We will need to map the momentum states in the reversed order for spin-down states to the position picture. This transformation can be simply implemented the complex conjugate of the former one. We only need to change the S gate to S* = S ** 3. Args: qubits: list of four qubits
[ "We", "will", "need", "to", "map", "the", "momentum", "states", "in", "the", "reversed", "order", "for", "spin", "-", "down", "states", "to", "the", "position", "picture", ".", "This", "transformation", "can", "be", "simply", "implemented", "the", "complex",...
python
train
39.944444
BerkeleyAutomation/perception
perception/image.py
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L1802-L1822
def point_normal_cloud(self, camera_intr): """Computes a PointNormalCloud from the depth image. Parameters ---------- camera_intr : :obj:`CameraIntrinsics` The camera parameters on which this depth image was taken. Returns ------- :obj:`autolab_core....
[ "def", "point_normal_cloud", "(", "self", ",", "camera_intr", ")", ":", "point_cloud_im", "=", "camera_intr", ".", "deproject_to_image", "(", "self", ")", "normal_cloud_im", "=", "point_cloud_im", ".", "normal_cloud_im", "(", ")", "point_cloud", "=", "point_cloud_im...
Computes a PointNormalCloud from the depth image. Parameters ---------- camera_intr : :obj:`CameraIntrinsics` The camera parameters on which this depth image was taken. Returns ------- :obj:`autolab_core.PointNormalCloud` A PointNormalCloud creat...
[ "Computes", "a", "PointNormalCloud", "from", "the", "depth", "image", "." ]
python
train
35.571429
boriel/zxbasic
zxbparser.py
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbparser.py#L1768-L1781
def p_while_sentence(p): """ statement : while_start co_statements_co label_end_while | while_start program_co label_end_while """ gl.LOOPS.pop() q = make_block(p[2], p[3]) if is_number(p[1]) and p[1].value: if q is None: warning(p[1].lineno, "Condition is alwa...
[ "def", "p_while_sentence", "(", "p", ")", ":", "gl", ".", "LOOPS", ".", "pop", "(", ")", "q", "=", "make_block", "(", "p", "[", "2", "]", ",", "p", "[", "3", "]", ")", "if", "is_number", "(", "p", "[", "1", "]", ")", "and", "p", "[", "1", ...
statement : while_start co_statements_co label_end_while | while_start program_co label_end_while
[ "statement", ":", "while_start", "co_statements_co", "label_end_while", "|", "while_start", "program_co", "label_end_while" ]
python
train
35.857143
refenv/cijoe
modules/cij/reporter.py
https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/reporter.py#L34-L62
def tcase_comment(tcase): """ Extract testcase comment section / testcase description @returns the testcase-comment from the tcase["fpath"] as a list of strings """ src = open(tcase["fpath"]).read() if len(src) < 3: cij.err("rprtr::tcase_comment: invalid src, tcase: %r" % tcase["name"]...
[ "def", "tcase_comment", "(", "tcase", ")", ":", "src", "=", "open", "(", "tcase", "[", "\"fpath\"", "]", ")", ".", "read", "(", ")", "if", "len", "(", "src", ")", "<", "3", ":", "cij", ".", "err", "(", "\"rprtr::tcase_comment: invalid src, tcase: %r\"", ...
Extract testcase comment section / testcase description @returns the testcase-comment from the tcase["fpath"] as a list of strings
[ "Extract", "testcase", "comment", "section", "/", "testcase", "description" ]
python
valid
26.655172
dhermes/bezier
src/bezier/surface.py
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/surface.py#L381-L475
def evaluate_barycentric(self, lambda1, lambda2, lambda3, _verify=True): r"""Compute a point on the surface. Evaluates :math:`B\left(\lambda_1, \lambda_2, \lambda_3\right)`. .. image:: ../../images/surface_evaluate_barycentric.png :align: center .. testsetup:: surface-baryc...
[ "def", "evaluate_barycentric", "(", "self", ",", "lambda1", ",", "lambda2", ",", "lambda3", ",", "_verify", "=", "True", ")", ":", "if", "_verify", ":", "self", ".", "_verify_barycentric", "(", "lambda1", ",", "lambda2", ",", "lambda3", ")", "return", "_su...
r"""Compute a point on the surface. Evaluates :math:`B\left(\lambda_1, \lambda_2, \lambda_3\right)`. .. image:: ../../images/surface_evaluate_barycentric.png :align: center .. testsetup:: surface-barycentric, surface-barycentric-fail1, surface-barycentric-fai...
[ "r", "Compute", "a", "point", "on", "the", "surface", "." ]
python
train
37.821053
Vital-Fernandez/dazer
bin/lib/Astro_Libraries/f2n.py
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Astro_Libraries/f2n.py#L375-L388
def irafcrop(self, irafcropstring): """ This is a wrapper around crop(), similar to iraf imcopy, using iraf conventions (100:199 will be 100 pixels, not 99). """ irafcropstring = irafcropstring[1:-1] # removing the [ ] ranges = irafcropstring.split(",") xr = range...
[ "def", "irafcrop", "(", "self", ",", "irafcropstring", ")", ":", "irafcropstring", "=", "irafcropstring", "[", "1", ":", "-", "1", "]", "# removing the [ ]", "ranges", "=", "irafcropstring", ".", "split", "(", "\",\"", ")", "xr", "=", "ranges", "[", "0", ...
This is a wrapper around crop(), similar to iraf imcopy, using iraf conventions (100:199 will be 100 pixels, not 99).
[ "This", "is", "a", "wrapper", "around", "crop", "()", "similar", "to", "iraf", "imcopy", "using", "iraf", "conventions", "(", "100", ":", "199", "will", "be", "100", "pixels", "not", "99", ")", "." ]
python
train
36.142857