repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
ska-sa/purr
Purr/Plugins/local_pychart/arrow.py
https://github.com/ska-sa/purr/blob/4c848768d0485d0f88b30850d0d5372221b21b66/Purr/Plugins/local_pychart/arrow.py#L111-L146
def draw(self, points, can=None): """Parameter <points> specifies the list of points the arrow traverses through. It should contain at least two points, i.e., the tail and tip. Parameter <can> is an optional parameter that specifies the output. <<canvas>> """ ...
[ "def", "draw", "(", "self", ",", "points", ",", "can", "=", "None", ")", ":", "if", "can", "==", "None", ":", "can", "=", "canvas", ".", "default_canvas", "(", ")", "assert", "self", ".", "check_integrity", "(", ")", "xtip", "=", "points", "[", "-"...
Parameter <points> specifies the list of points the arrow traverses through. It should contain at least two points, i.e., the tail and tip. Parameter <can> is an optional parameter that specifies the output. <<canvas>>
[ "Parameter", "<points", ">", "specifies", "the", "list", "of", "points", "the", "arrow", "traverses", "through", ".", "It", "should", "contain", "at", "least", "two", "points", "i", ".", "e", ".", "the", "tail", "and", "tip", ".", "Parameter", "<can", ">...
python
train
nosedjango/nosedjango
nosedjango/nosedjango.py
https://github.com/nosedjango/nosedjango/blob/cd4d06857c88291769bc38e5c9573f43b7ffcd6a/nosedjango/nosedjango.py#L232-L317
def begin(self): """ Create the test database and schema, if needed, and switch the connection over to that database. Then call install() to install all apps listed in the loaded settings module. """ for plugin in self.nose_config.plugins.plugins: if getattr(p...
[ "def", "begin", "(", "self", ")", ":", "for", "plugin", "in", "self", ".", "nose_config", ".", "plugins", ".", "plugins", ":", "if", "getattr", "(", "plugin", ",", "'django_plugin'", ",", "False", ")", ":", "self", ".", "django_plugins", ".", "append", ...
Create the test database and schema, if needed, and switch the connection over to that database. Then call install() to install all apps listed in the loaded settings module.
[ "Create", "the", "test", "database", "and", "schema", "if", "needed", "and", "switch", "the", "connection", "over", "to", "that", "database", ".", "Then", "call", "install", "()", "to", "install", "all", "apps", "listed", "in", "the", "loaded", "settings", ...
python
valid
mwgielen/jackal
jackal/scripts/eternalblue.py
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/eternalblue.py#L123-L134
def detect_os(self, ip): """ Runs the checker.py scripts to detect the os. """ process = subprocess.run(['python2', os.path.join(self.datadir, 'MS17-010', 'checker.py'), str(ip)], stdout=subprocess.PIPE) out = process.stdout.decode('utf-8').split('\n') system_os = '' ...
[ "def", "detect_os", "(", "self", ",", "ip", ")", ":", "process", "=", "subprocess", ".", "run", "(", "[", "'python2'", ",", "os", ".", "path", ".", "join", "(", "self", ".", "datadir", ",", "'MS17-010'", ",", "'checker.py'", ")", ",", "str", "(", "...
Runs the checker.py scripts to detect the os.
[ "Runs", "the", "checker", ".", "py", "scripts", "to", "detect", "the", "os", "." ]
python
valid
Capitains/MyCapytain
MyCapytain/resolvers/cts/api.py
https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resolvers/cts/api.py#L44-L65
def getTextualNode(self, textId, subreference=None, prevnext=False, metadata=False): """ Retrieve a text node from the API :param textId: CtsTextMetadata Identifier :type textId: str :param subreference: CapitainsCtsPassage Reference :type subreference: str :param prevne...
[ "def", "getTextualNode", "(", "self", ",", "textId", ",", "subreference", "=", "None", ",", "prevnext", "=", "False", ",", "metadata", "=", "False", ")", ":", "text", "=", "CtsText", "(", "urn", "=", "textId", ",", "retriever", "=", "self", ".", "endpo...
Retrieve a text node from the API :param textId: CtsTextMetadata Identifier :type textId: str :param subreference: CapitainsCtsPassage Reference :type subreference: str :param prevnext: Retrieve graph representing previous and next passage :type prevnext: boolean ...
[ "Retrieve", "a", "text", "node", "from", "the", "API" ]
python
train
HewlettPackard/python-hpOneView
hpOneView/oneview_client.py
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/oneview_client.py#L1117-L1126
def appliance_device_snmp_v1_trap_destinations(self): """ Gets the ApplianceDeviceSNMPv1TrapDestinations API client. Returns: ApplianceDeviceSNMPv1TrapDestinations: """ if not self.__appliance_device_snmp_v1_trap_destinations: self.__appliance_device_snmp...
[ "def", "appliance_device_snmp_v1_trap_destinations", "(", "self", ")", ":", "if", "not", "self", ".", "__appliance_device_snmp_v1_trap_destinations", ":", "self", ".", "__appliance_device_snmp_v1_trap_destinations", "=", "ApplianceDeviceSNMPv1TrapDestinations", "(", "self", "."...
Gets the ApplianceDeviceSNMPv1TrapDestinations API client. Returns: ApplianceDeviceSNMPv1TrapDestinations:
[ "Gets", "the", "ApplianceDeviceSNMPv1TrapDestinations", "API", "client", "." ]
python
train
apple/turicreate
deps/src/libxml2-2.9.1/python/libxml2.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/libxml2-2.9.1/python/libxml2.py#L6628-L6639
def GetRemainder(self): """Method to get the remainder of the buffered XML. this method stops the parser, set its state to End Of File and return the input stream with what is left that the parser did not use. The implementation is not good, the parser certainly procgres...
[ "def", "GetRemainder", "(", "self", ")", ":", "ret", "=", "libxml2mod", ".", "xmlTextReaderGetRemainder", "(", "self", ".", "_o", ")", "if", "ret", "is", "None", ":", "raise", "treeError", "(", "'xmlTextReaderGetRemainder() failed'", ")", "__tmp", "=", "inputB...
Method to get the remainder of the buffered XML. this method stops the parser, set its state to End Of File and return the input stream with what is left that the parser did not use. The implementation is not good, the parser certainly procgressed past what's left in reader->inp...
[ "Method", "to", "get", "the", "remainder", "of", "the", "buffered", "XML", ".", "this", "method", "stops", "the", "parser", "set", "its", "state", "to", "End", "Of", "File", "and", "return", "the", "input", "stream", "with", "what", "is", "left", "that",...
python
train
projecthamster/hamster
src/hamster/lib/graphics.py
https://github.com/projecthamster/hamster/blob/ca5254eff53172796ddafc72226c394ed1858245/src/hamster/lib/graphics.py#L58-L89
def parse(self, color): """parse string or a color tuple into color usable for cairo (all values in the normalized (0..1) range""" assert color is not None #parse color into rgb values if isinstance(color, str): match = self.hex_color_long.match(color) if...
[ "def", "parse", "(", "self", ",", "color", ")", ":", "assert", "color", "is", "not", "None", "#parse color into rgb values", "if", "isinstance", "(", "color", ",", "str", ")", ":", "match", "=", "self", ".", "hex_color_long", ".", "match", "(", "color", ...
parse string or a color tuple into color usable for cairo (all values in the normalized (0..1) range
[ "parse", "string", "or", "a", "color", "tuple", "into", "color", "usable", "for", "cairo", "(", "all", "values", "in", "the", "normalized", "(", "0", "..", "1", ")", "range" ]
python
train
bioidiap/bob.ip.facedetect
bob/ip/facedetect/script/plot_froc.py
https://github.com/bioidiap/bob.ip.facedetect/blob/601da5141ca7302ad36424d1421b33190ba46779/bob/ip/facedetect/script/plot_froc.py#L168-L225
def main(command_line_arguments=None): """Reads score files, computes error measures and plots curves.""" args = command_line_options(command_line_arguments) # get some colors for plotting cmap = mpl.cm.get_cmap(name='hsv') count = len(args.files) + (len(args.baselines) if args.baselines else 0) colors = ...
[ "def", "main", "(", "command_line_arguments", "=", "None", ")", ":", "args", "=", "command_line_options", "(", "command_line_arguments", ")", "# get some colors for plotting", "cmap", "=", "mpl", ".", "cm", ".", "get_cmap", "(", "name", "=", "'hsv'", ")", "count...
Reads score files, computes error measures and plots curves.
[ "Reads", "score", "files", "computes", "error", "measures", "and", "plots", "curves", "." ]
python
train
TankerHQ/python-cli-ui
cli_ui/__init__.py
https://github.com/TankerHQ/python-cli-ui/blob/4c9928827cea06cf80e6a1f5bd86478d8566863f/cli_ui/__init__.py#L608-L621
def did_you_mean(message: str, user_input: str, choices: Sequence[str]) -> str: """ Given a list of choices and an invalid user input, display the closest items in the list that match the input. """ if not choices: return message else: result = { difflib.SequenceMatcher(...
[ "def", "did_you_mean", "(", "message", ":", "str", ",", "user_input", ":", "str", ",", "choices", ":", "Sequence", "[", "str", "]", ")", "->", "str", ":", "if", "not", "choices", ":", "return", "message", "else", ":", "result", "=", "{", "difflib", "...
Given a list of choices and an invalid user input, display the closest items in the list that match the input.
[ "Given", "a", "list", "of", "choices", "and", "an", "invalid", "user", "input", "display", "the", "closest", "items", "in", "the", "list", "that", "match", "the", "input", "." ]
python
train
spotify/gordon-gcp
src/gordon_gcp/clients/http.py
https://github.com/spotify/gordon-gcp/blob/5ab19e3c2fe6ace72ee91e2ef1a1326f90b805da/src/gordon_gcp/clients/http.py#L72-L82
async def valid_token_set(self): """Check for validity of token, and refresh if none or expired.""" is_valid = False if self._auth_client.token: # Account for a token near expiration now = datetime.datetime.utcnow() skew = datetime.timedelta(seconds=60) ...
[ "async", "def", "valid_token_set", "(", "self", ")", ":", "is_valid", "=", "False", "if", "self", ".", "_auth_client", ".", "token", ":", "# Account for a token near expiration", "now", "=", "datetime", ".", "datetime", ".", "utcnow", "(", ")", "skew", "=", ...
Check for validity of token, and refresh if none or expired.
[ "Check", "for", "validity", "of", "token", "and", "refresh", "if", "none", "or", "expired", "." ]
python
train
WZBSocialScienceCenter/tmtoolkit
tmtoolkit/topicmod/visualize.py
https://github.com/WZBSocialScienceCenter/tmtoolkit/blob/ca8b9d072e37ccc82b533f47d48bd9755722305b/tmtoolkit/topicmod/visualize.py#L124-L179
def plot_doc_topic_heatmap(fig, ax, doc_topic_distrib, doc_labels, topic_labels=None, which_documents=None, which_document_indices=None, which_topics=None, which_topic_indices=None, xaxislabel=None, yaxislabel=None, ...
[ "def", "plot_doc_topic_heatmap", "(", "fig", ",", "ax", ",", "doc_topic_distrib", ",", "doc_labels", ",", "topic_labels", "=", "None", ",", "which_documents", "=", "None", ",", "which_document_indices", "=", "None", ",", "which_topics", "=", "None", ",", "which_...
Plot a heatmap for a document-topic distribution `doc_topic_distrib` to a matplotlib Figure `fig` and Axes `ax` using `doc_labels` as document labels on the y-axis and topics from 1 to `n_topics=doc_topic_distrib.shape[1]` on the x-axis. Custom topic labels can be passed as `topic_labels`. A subset of d...
[ "Plot", "a", "heatmap", "for", "a", "document", "-", "topic", "distribution", "doc_topic_distrib", "to", "a", "matplotlib", "Figure", "fig", "and", "Axes", "ax", "using", "doc_labels", "as", "document", "labels", "on", "the", "y", "-", "axis", "and", "topics...
python
train
TheGhouls/oct
oct/results/output.py
https://github.com/TheGhouls/oct/blob/7e9bddeb3b8495a26442b1c86744e9fb187fe88f/oct/results/output.py#L24-L33
def print_infos(results): """Print informations in standard output :param ReportResults results: the report result containing all compiled informations """ print('transactions: %i' % results.total_transactions) print('timers: %i' % results.total_timers) print('errors: %i' % results.total_errors...
[ "def", "print_infos", "(", "results", ")", ":", "print", "(", "'transactions: %i'", "%", "results", ".", "total_transactions", ")", "print", "(", "'timers: %i'", "%", "results", ".", "total_timers", ")", "print", "(", "'errors: %i'", "%", "results", ".", "tota...
Print informations in standard output :param ReportResults results: the report result containing all compiled informations
[ "Print", "informations", "in", "standard", "output" ]
python
train
sixty-north/cosmic-ray
src/cosmic_ray/modules.py
https://github.com/sixty-north/cosmic-ray/blob/c654e074afbb7b7fcbc23359083c1287c0d3e991/src/cosmic_ray/modules.py#L7-L20
def find_modules(module_path): """Find all modules in the module (possibly package) represented by `module_path`. Args: module_path: A pathlib.Path to a Python package or module. Returns: An iterable of paths Python modules (i.e. *py files). """ if module_path.is_file(): if module_...
[ "def", "find_modules", "(", "module_path", ")", ":", "if", "module_path", ".", "is_file", "(", ")", ":", "if", "module_path", ".", "suffix", "==", "'.py'", ":", "yield", "module_path", "elif", "module_path", ".", "is_dir", "(", ")", ":", "pyfiles", "=", ...
Find all modules in the module (possibly package) represented by `module_path`. Args: module_path: A pathlib.Path to a Python package or module. Returns: An iterable of paths Python modules (i.e. *py files).
[ "Find", "all", "modules", "in", "the", "module", "(", "possibly", "package", ")", "represented", "by", "module_path", "." ]
python
train
treycucco/pyebnf
pyebnf/_hand_written_parser.py
https://github.com/treycucco/pyebnf/blob/3634ddabbe5d73508bcc20f4a591f86a46634e1d/pyebnf/_hand_written_parser.py#L226-L234
def operator(self, text): """operator = "|" | "." | "," | "-";""" self._attempting(text) return alternation([ "|", ".", ",", "-" ])(text).retyped(TokenType.operator)
[ "def", "operator", "(", "self", ",", "text", ")", ":", "self", ".", "_attempting", "(", "text", ")", "return", "alternation", "(", "[", "\"|\"", ",", "\".\"", ",", "\",\"", ",", "\"-\"", "]", ")", "(", "text", ")", ".", "retyped", "(", "TokenType", ...
operator = "|" | "." | "," | "-";
[ "operator", "=", "|", "|", ".", "|", "|", "-", ";" ]
python
test
mlperf/training
reinforcement/tensorflow/minigo/validate.py
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/validate.py#L47-L65
def validate(*tf_records): """Validate a model's performance on a set of holdout data.""" if FLAGS.use_tpu: def _input_fn(params): return preprocessing.get_tpu_input_tensors( params['batch_size'], tf_records, filter_amount=1.0) else: def _input_fn(): r...
[ "def", "validate", "(", "*", "tf_records", ")", ":", "if", "FLAGS", ".", "use_tpu", ":", "def", "_input_fn", "(", "params", ")", ":", "return", "preprocessing", ".", "get_tpu_input_tensors", "(", "params", "[", "'batch_size'", "]", ",", "tf_records", ",", ...
Validate a model's performance on a set of holdout data.
[ "Validate", "a", "model", "s", "performance", "on", "a", "set", "of", "holdout", "data", "." ]
python
train
charlesthomas/proauth2
proauth2/async_proauth2.py
https://github.com/charlesthomas/proauth2/blob/f88c8df966a1802414047ed304d02df1dd520097/proauth2/async_proauth2.py#L109-L120
def authenticate_token(self, token, callback): ''' authenticate_token checks the passed token and returns the user_id it is associated with. it is assumed that this method won't be directly exposed to the oauth client, but some kind of framework or wrapper. this allows the framew...
[ "def", "authenticate_token", "(", "self", ",", "token", ",", "callback", ")", ":", "token_data", "=", "yield", "Task", "(", "self", ".", "data_store", ".", "fetch", ",", "'tokens'", ",", "token", "=", "token", ")", "if", "not", "token_data", ":", "raise"...
authenticate_token checks the passed token and returns the user_id it is associated with. it is assumed that this method won't be directly exposed to the oauth client, but some kind of framework or wrapper. this allows the framework to have the user_id without doing additional DB calls.
[ "authenticate_token", "checks", "the", "passed", "token", "and", "returns", "the", "user_id", "it", "is", "associated", "with", ".", "it", "is", "assumed", "that", "this", "method", "won", "t", "be", "directly", "exposed", "to", "the", "oauth", "client", "bu...
python
valid
johnwheeler/flask-ask
flask_ask/cache.py
https://github.com/johnwheeler/flask-ask/blob/fe407646ae404a8c90b363c86d5c4c201b6a5580/flask_ask/cache.py#L65-L80
def top_stream(cache, user_id): """ Peek at the top of the stack in the cache. :param cache: werkzeug BasicCache-like object :param user_id: id of user, used as key in cache :return: top item in user's cached stack, otherwise None """ if not user_id: return None stack = ca...
[ "def", "top_stream", "(", "cache", ",", "user_id", ")", ":", "if", "not", "user_id", ":", "return", "None", "stack", "=", "cache", ".", "get", "(", "user_id", ")", "if", "stack", "is", "None", ":", "return", "None", "return", "stack", ".", "pop", "("...
Peek at the top of the stack in the cache. :param cache: werkzeug BasicCache-like object :param user_id: id of user, used as key in cache :return: top item in user's cached stack, otherwise None
[ "Peek", "at", "the", "top", "of", "the", "stack", "in", "the", "cache", "." ]
python
train
latchset/jwcrypto
jwcrypto/jwk.py
https://github.com/latchset/jwcrypto/blob/961df898dc08f63fe3d900f2002618740bc66b4a/jwcrypto/jwk.py#L490-L501
def from_json(cls, key): """Creates a RFC 7517 JWK from the standard JSON format. :param key: The RFC 7517 representation of a JWK. """ obj = cls() try: jkey = json_decode(key) except Exception as e: # pylint: disable=broad-except raise InvalidJW...
[ "def", "from_json", "(", "cls", ",", "key", ")", ":", "obj", "=", "cls", "(", ")", "try", ":", "jkey", "=", "json_decode", "(", "key", ")", "except", "Exception", "as", "e", ":", "# pylint: disable=broad-except", "raise", "InvalidJWKValue", "(", "e", ")"...
Creates a RFC 7517 JWK from the standard JSON format. :param key: The RFC 7517 representation of a JWK.
[ "Creates", "a", "RFC", "7517", "JWK", "from", "the", "standard", "JSON", "format", "." ]
python
train
twisted/mantissa
xmantissa/people.py
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/people.py#L798-L819
def _gatherPluginMethods(self, methodName): """ Walk through each L{IOrganizerPlugin} powerup, yielding the bound method if the powerup implements C{methodName}. Upon encountering a plugin which fails to implement it, issue a L{PendingDeprecationWarning}. @param methodN...
[ "def", "_gatherPluginMethods", "(", "self", ",", "methodName", ")", ":", "for", "plugin", "in", "self", ".", "getOrganizerPlugins", "(", ")", ":", "implementation", "=", "getattr", "(", "plugin", ",", "methodName", ",", "None", ")", "if", "implementation", "...
Walk through each L{IOrganizerPlugin} powerup, yielding the bound method if the powerup implements C{methodName}. Upon encountering a plugin which fails to implement it, issue a L{PendingDeprecationWarning}. @param methodName: The name of a L{IOrganizerPlugin} method. @type met...
[ "Walk", "through", "each", "L", "{", "IOrganizerPlugin", "}", "powerup", "yielding", "the", "bound", "method", "if", "the", "powerup", "implements", "C", "{", "methodName", "}", ".", "Upon", "encountering", "a", "plugin", "which", "fails", "to", "implement", ...
python
train
huggingface/pytorch-pretrained-BERT
examples/run_squad.py
https://github.com/huggingface/pytorch-pretrained-BERT/blob/b832d5bb8a6dfc5965015b828e577677eace601e/examples/run_squad.py#L741-L761
def _compute_softmax(scores): """Compute softmax probability over raw logits.""" if not scores: return [] max_score = None for score in scores: if max_score is None or score > max_score: max_score = score exp_scores = [] total_sum = 0.0 for score in scores: ...
[ "def", "_compute_softmax", "(", "scores", ")", ":", "if", "not", "scores", ":", "return", "[", "]", "max_score", "=", "None", "for", "score", "in", "scores", ":", "if", "max_score", "is", "None", "or", "score", ">", "max_score", ":", "max_score", "=", ...
Compute softmax probability over raw logits.
[ "Compute", "softmax", "probability", "over", "raw", "logits", "." ]
python
train
iotile/coretools
transport_plugins/bled112/iotile_transport_bled112/bgapi_structures.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/bled112/iotile_transport_bled112/bgapi_structures.py#L27-L41
def process_gatt_service(services, event): """Process a BGAPI event containing a GATT service description and add it to a dictionary Args: services (dict): A dictionary of discovered services that is updated with this event event (BGAPIPacket): An event containing a GATT service """ l...
[ "def", "process_gatt_service", "(", "services", ",", "event", ")", ":", "length", "=", "len", "(", "event", ".", "payload", ")", "-", "5", "handle", ",", "start", ",", "end", ",", "uuid", "=", "unpack", "(", "'<BHH%ds'", "%", "length", ",", "event", ...
Process a BGAPI event containing a GATT service description and add it to a dictionary Args: services (dict): A dictionary of discovered services that is updated with this event event (BGAPIPacket): An event containing a GATT service
[ "Process", "a", "BGAPI", "event", "containing", "a", "GATT", "service", "description", "and", "add", "it", "to", "a", "dictionary" ]
python
train
bokeh/bokeh
bokeh/models/transforms.py
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/models/transforms.py#L170-L206
def from_coffeescript(cls, func, v_func, args={}): ''' Create a ``CustomJSTransform`` instance from a pair of CoffeeScript snippets. The function bodies are translated to JavaScript functions using node and therefore require return statements. The ``func`` snippet namespace will contain...
[ "def", "from_coffeescript", "(", "cls", ",", "func", ",", "v_func", ",", "args", "=", "{", "}", ")", ":", "compiled", "=", "nodejs_compile", "(", "func", ",", "lang", "=", "\"coffeescript\"", ",", "file", "=", "\"???\"", ")", "if", "\"error\"", "in", "...
Create a ``CustomJSTransform`` instance from a pair of CoffeeScript snippets. The function bodies are translated to JavaScript functions using node and therefore require return statements. The ``func`` snippet namespace will contain the variable ``x`` (the untransformed value) at render...
[ "Create", "a", "CustomJSTransform", "instance", "from", "a", "pair", "of", "CoffeeScript", "snippets", ".", "The", "function", "bodies", "are", "translated", "to", "JavaScript", "functions", "using", "node", "and", "therefore", "require", "return", "statements", "...
python
train
JoelBender/bacpypes
sandbox/io.py
https://github.com/JoelBender/bacpypes/blob/4111b8604a16fa2b7f80d8104a43b9f3e28dfc78/sandbox/io.py#L1287-L1297
def abort(err): """Abort everything, everywhere.""" if _debug: abort._debug("abort %r", err) # start with the server if IOServer._highlander: IOServer._highlander.abort(err) # now do everything local for controller in _local_controllers.values(): controller.abort(err)
[ "def", "abort", "(", "err", ")", ":", "if", "_debug", ":", "abort", ".", "_debug", "(", "\"abort %r\"", ",", "err", ")", "# start with the server", "if", "IOServer", ".", "_highlander", ":", "IOServer", ".", "_highlander", ".", "abort", "(", "err", ")", ...
Abort everything, everywhere.
[ "Abort", "everything", "everywhere", "." ]
python
train
dwavesystems/dimod
dimod/binary_quadratic_model.py
https://github.com/dwavesystems/dimod/blob/beff1b7f86b559d923ac653c1de6d593876d6d38/dimod/binary_quadratic_model.py#L459-L504
def add_variables_from(self, linear, vartype=None): """Add variables and/or linear biases to a binary quadratic model. Args: linear (dict[variable, bias]/iterable[(variable, bias)]): A collection of variables and their linear biases to add to the model. If a ...
[ "def", "add_variables_from", "(", "self", ",", "linear", ",", "vartype", "=", "None", ")", ":", "if", "isinstance", "(", "linear", ",", "abc", ".", "Mapping", ")", ":", "for", "v", ",", "bias", "in", "iteritems", "(", "linear", ")", ":", "self", ".",...
Add variables and/or linear biases to a binary quadratic model. Args: linear (dict[variable, bias]/iterable[(variable, bias)]): A collection of variables and their linear biases to add to the model. If a dict, keys are variables in the binary quadratic model and ...
[ "Add", "variables", "and", "/", "or", "linear", "biases", "to", "a", "binary", "quadratic", "model", "." ]
python
train
dyve/django-bootstrap3
bootstrap3/forms.py
https://github.com/dyve/django-bootstrap3/blob/1d4095ba113a1faff228f9592bdad4f0b3aed653/bootstrap3/forms.py#L73-L78
def render_field(field, **kwargs): """ Render a field to a Bootstrap layout """ renderer_cls = get_field_renderer(**kwargs) return renderer_cls(field, **kwargs).render()
[ "def", "render_field", "(", "field", ",", "*", "*", "kwargs", ")", ":", "renderer_cls", "=", "get_field_renderer", "(", "*", "*", "kwargs", ")", "return", "renderer_cls", "(", "field", ",", "*", "*", "kwargs", ")", ".", "render", "(", ")" ]
Render a field to a Bootstrap layout
[ "Render", "a", "field", "to", "a", "Bootstrap", "layout" ]
python
train
bcbio/bcbio-nextgen
bcbio/variation/strelka2.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/strelka2.py#L20-L34
def run(align_bams, items, ref_file, assoc_files, region, out_file): """Run strelka2 variant calling, either paired tumor/normal or germline calling. region can be a single region or list of multiple regions for multicore calling. """ call_file = "%s-raw.vcf.gz" % utils.splitext_plus(out_file)[0] s...
[ "def", "run", "(", "align_bams", ",", "items", ",", "ref_file", ",", "assoc_files", ",", "region", ",", "out_file", ")", ":", "call_file", "=", "\"%s-raw.vcf.gz\"", "%", "utils", ".", "splitext_plus", "(", "out_file", ")", "[", "0", "]", "strelka_work_dir", ...
Run strelka2 variant calling, either paired tumor/normal or germline calling. region can be a single region or list of multiple regions for multicore calling.
[ "Run", "strelka2", "variant", "calling", "either", "paired", "tumor", "/", "normal", "or", "germline", "calling", "." ]
python
train
spookylukey/django-paypal
paypal/pro/creditcard.py
https://github.com/spookylukey/django-paypal/blob/b07d0a3ad91b5c5fe7bb27be3e5d70aabcdef76f/paypal/pro/creditcard.py#L68-L72
def verify(self): """Returns the card type if valid else None.""" if self.is_number() and not self.is_test() and self.is_mod10(): return self.get_type() return None
[ "def", "verify", "(", "self", ")", ":", "if", "self", ".", "is_number", "(", ")", "and", "not", "self", ".", "is_test", "(", ")", "and", "self", ".", "is_mod10", "(", ")", ":", "return", "self", ".", "get_type", "(", ")", "return", "None" ]
Returns the card type if valid else None.
[ "Returns", "the", "card", "type", "if", "valid", "else", "None", "." ]
python
train
Microsoft/azure-devops-python-api
azure-devops/azure/devops/v5_0/work_item_tracking_process/work_item_tracking_process_client.py
https://github.com/Microsoft/azure-devops-python-api/blob/4777ffda2f5052fabbaddb2abe9cb434e0cf1aa8/azure-devops/azure/devops/v5_0/work_item_tracking_process/work_item_tracking_process_client.py#L489-L505
def get_form_layout(self, process_id, wit_ref_name): """GetFormLayout. [Preview API] Gets the form layout. :param str process_id: The ID of the process. :param str wit_ref_name: The reference name of the work item type. :rtype: :class:`<FormLayout> <azure.devops.v5_0.work_item_tr...
[ "def", "get_form_layout", "(", "self", ",", "process_id", ",", "wit_ref_name", ")", ":", "route_values", "=", "{", "}", "if", "process_id", "is", "not", "None", ":", "route_values", "[", "'processId'", "]", "=", "self", ".", "_serialize", ".", "url", "(", ...
GetFormLayout. [Preview API] Gets the form layout. :param str process_id: The ID of the process. :param str wit_ref_name: The reference name of the work item type. :rtype: :class:`<FormLayout> <azure.devops.v5_0.work_item_tracking_process.models.FormLayout>`
[ "GetFormLayout", ".", "[", "Preview", "API", "]", "Gets", "the", "form", "layout", ".", ":", "param", "str", "process_id", ":", "The", "ID", "of", "the", "process", ".", ":", "param", "str", "wit_ref_name", ":", "The", "reference", "name", "of", "the", ...
python
train
ejeschke/ginga
ginga/trcalc.py
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/trcalc.py#L556-L617
def calc_image_merge_clip(p1, p2, dst, q1, q2): """ p1 (x1, y1, z1) and p2 (x2, y2, z2) define the extent of the (non-scaled) data shown. The image, defined by region q1, q2 is to be placed at dst in the image (destination may be outside of the actual data array). Refines the modified points (q1',...
[ "def", "calc_image_merge_clip", "(", "p1", ",", "p2", ",", "dst", ",", "q1", ",", "q2", ")", ":", "x1", ",", "y1", "=", "p1", "[", ":", "2", "]", "x2", ",", "y2", "=", "p2", "[", ":", "2", "]", "dst_x", ",", "dst_y", "=", "dst", "[", ":", ...
p1 (x1, y1, z1) and p2 (x2, y2, z2) define the extent of the (non-scaled) data shown. The image, defined by region q1, q2 is to be placed at dst in the image (destination may be outside of the actual data array). Refines the modified points (q1', q2') defining the clipped rectangle needed to be cut fr...
[ "p1", "(", "x1", "y1", "z1", ")", "and", "p2", "(", "x2", "y2", "z2", ")", "define", "the", "extent", "of", "the", "(", "non", "-", "scaled", ")", "data", "shown", ".", "The", "image", "defined", "by", "region", "q1", "q2", "is", "to", "be", "p...
python
train
adafruit/Adafruit_Python_GPIO
Adafruit_GPIO/PWM.py
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/PWM.py#L55-L63
def set_duty_cycle(self, pin, dutycycle): """Set percent duty cycle of PWM output on specified pin. Duty cycle must be a value 0.0 to 100.0 (inclusive). """ if dutycycle < 0.0 or dutycycle > 100.0: raise ValueError('Invalid duty cycle value, must be between 0.0 to 100.0 (inc...
[ "def", "set_duty_cycle", "(", "self", ",", "pin", ",", "dutycycle", ")", ":", "if", "dutycycle", "<", "0.0", "or", "dutycycle", ">", "100.0", ":", "raise", "ValueError", "(", "'Invalid duty cycle value, must be between 0.0 to 100.0 (inclusive).'", ")", "if", "pin", ...
Set percent duty cycle of PWM output on specified pin. Duty cycle must be a value 0.0 to 100.0 (inclusive).
[ "Set", "percent", "duty", "cycle", "of", "PWM", "output", "on", "specified", "pin", ".", "Duty", "cycle", "must", "be", "a", "value", "0", ".", "0", "to", "100", ".", "0", "(", "inclusive", ")", "." ]
python
valid
PyCQA/pylint
pylint/pyreverse/diagrams.py
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/pyreverse/diagrams.py#L241-L247
def add_from_depend(self, node, from_module): """add dependencies created by from-imports """ mod_name = node.root().name obj = self.module(mod_name) if from_module not in obj.node.depends: obj.node.depends.append(from_module)
[ "def", "add_from_depend", "(", "self", ",", "node", ",", "from_module", ")", ":", "mod_name", "=", "node", ".", "root", "(", ")", ".", "name", "obj", "=", "self", ".", "module", "(", "mod_name", ")", "if", "from_module", "not", "in", "obj", ".", "nod...
add dependencies created by from-imports
[ "add", "dependencies", "created", "by", "from", "-", "imports" ]
python
test
uw-it-aca/uw-restclients-canvas
uw_canvas/sections.py
https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/sections.py#L9-L16
def get_section(self, section_id, params={}): """ Return section resource for given canvas section id. https://canvas.instructure.com/doc/api/sections.html#method.sections.show """ url = SECTIONS_API.format(section_id) return CanvasSection(data=self._get_resource(url, pa...
[ "def", "get_section", "(", "self", ",", "section_id", ",", "params", "=", "{", "}", ")", ":", "url", "=", "SECTIONS_API", ".", "format", "(", "section_id", ")", "return", "CanvasSection", "(", "data", "=", "self", ".", "_get_resource", "(", "url", ",", ...
Return section resource for given canvas section id. https://canvas.instructure.com/doc/api/sections.html#method.sections.show
[ "Return", "section", "resource", "for", "given", "canvas", "section", "id", "." ]
python
test
Yelp/kafka-utils
kafka_utils/kafka_cluster_manager/cmds/command.py
https://github.com/Yelp/kafka-utils/blob/cdb4d64308f3079ee0873250bf7b34d0d94eca50/kafka_utils/kafka_cluster_manager/cmds/command.py#L107-L119
def execute_plan(self, plan, allow_rf_change=False): """Save proposed-plan and execute the same if requested.""" if self.should_execute(): result = self.zk.execute_plan(plan, allow_rf_change=allow_rf_change) if not result: self.log.error('Plan execution unsuccessf...
[ "def", "execute_plan", "(", "self", ",", "plan", ",", "allow_rf_change", "=", "False", ")", ":", "if", "self", ".", "should_execute", "(", ")", ":", "result", "=", "self", ".", "zk", ".", "execute_plan", "(", "plan", ",", "allow_rf_change", "=", "allow_r...
Save proposed-plan and execute the same if requested.
[ "Save", "proposed", "-", "plan", "and", "execute", "the", "same", "if", "requested", "." ]
python
train
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/core/fakemodule.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/fakemodule.py#L18-L46
def init_fakemod_dict(fm,adict=None): """Initialize a FakeModule instance __dict__. Kept as a standalone function and not a method so the FakeModule API can remain basically empty. This should be considered for private IPython use, used in managing namespaces for %run. Parameters --------...
[ "def", "init_fakemod_dict", "(", "fm", ",", "adict", "=", "None", ")", ":", "dct", "=", "{", "}", "# It seems pydoc (and perhaps others) needs any module instance to", "# implement a __nonzero__ method, so we add it if missing:", "dct", ".", "setdefault", "(", "'__nonzero__'"...
Initialize a FakeModule instance __dict__. Kept as a standalone function and not a method so the FakeModule API can remain basically empty. This should be considered for private IPython use, used in managing namespaces for %run. Parameters ---------- fm : FakeModule instance adict :...
[ "Initialize", "a", "FakeModule", "instance", "__dict__", "." ]
python
test
rosenbrockc/fortpy
fortpy/config.py
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/config.py#L85-L89
def getenvar(self, envar): from os import getenv """Retrieves the value of an environment variable if it exists.""" if getenv(envar) is not None: self._vardict[envar] = getenv(envar)
[ "def", "getenvar", "(", "self", ",", "envar", ")", ":", "from", "os", "import", "getenv", "if", "getenv", "(", "envar", ")", "is", "not", "None", ":", "self", ".", "_vardict", "[", "envar", "]", "=", "getenv", "(", "envar", ")" ]
Retrieves the value of an environment variable if it exists.
[ "Retrieves", "the", "value", "of", "an", "environment", "variable", "if", "it", "exists", "." ]
python
train
theolind/pymysensors
mysensors/gateway_tcp.py
https://github.com/theolind/pymysensors/blob/a139ab6e2f6b71ebaf37282f69bfd0f7fe6193b6/mysensors/gateway_tcp.py#L76-L108
def _connect(self): """Connect to socket. This should be run in a new thread.""" while self.protocol: _LOGGER.info('Trying to connect to %s', self.server_address) try: sock = socket.create_connection( self.server_address, self.reconnect_timeout...
[ "def", "_connect", "(", "self", ")", ":", "while", "self", ".", "protocol", ":", "_LOGGER", ".", "info", "(", "'Trying to connect to %s'", ",", "self", ".", "server_address", ")", "try", ":", "sock", "=", "socket", ".", "create_connection", "(", "self", "....
Connect to socket. This should be run in a new thread.
[ "Connect", "to", "socket", ".", "This", "should", "be", "run", "in", "a", "new", "thread", "." ]
python
train
Robpol86/libnl
libnl/socket_.py
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/socket_.py#L276-L308
def nl_socket_set_buffer_size(sk, rxbuf, txbuf): """Set socket buffer size of Netlink socket. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/socket.c#L675 Sets the socket buffer size of a Netlink socket to the specified values `rxbuf` and `txbuf`. Providing a value of 0 assumes a good default v...
[ "def", "nl_socket_set_buffer_size", "(", "sk", ",", "rxbuf", ",", "txbuf", ")", ":", "rxbuf", "=", "32768", "if", "rxbuf", "<=", "0", "else", "rxbuf", "txbuf", "=", "32768", "if", "txbuf", "<=", "0", "else", "txbuf", "if", "sk", ".", "s_fd", "==", "-...
Set socket buffer size of Netlink socket. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/socket.c#L675 Sets the socket buffer size of a Netlink socket to the specified values `rxbuf` and `txbuf`. Providing a value of 0 assumes a good default value. Positional arguments: sk -- Netlink socke...
[ "Set", "socket", "buffer", "size", "of", "Netlink", "socket", "." ]
python
train
libyal/dtfabric
dtfabric/runtime/data_maps.py
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L1055-L1088
def _LinearMapByteStream( self, byte_stream, byte_offset=0, context=None, **unused_kwargs): """Maps a data type sequence on a byte stream. Args: byte_stream (bytes): byte stream. byte_offset (Optional[int]): offset into the byte stream where to start. context (Optional[DataTypeMapContex...
[ "def", "_LinearMapByteStream", "(", "self", ",", "byte_stream", ",", "byte_offset", "=", "0", ",", "context", "=", "None", ",", "*", "*", "unused_kwargs", ")", ":", "elements_data_size", "=", "self", ".", "_data_type_definition", ".", "GetByteSize", "(", ")", ...
Maps a data type sequence on a byte stream. Args: byte_stream (bytes): byte stream. byte_offset (Optional[int]): offset into the byte stream where to start. context (Optional[DataTypeMapContext]): data type map context. Returns: tuple[object, ...]: mapped values. Raises: Map...
[ "Maps", "a", "data", "type", "sequence", "on", "a", "byte", "stream", "." ]
python
train
saltstack/salt
salt/utils/win_update.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_update.py#L101-L167
def list(self): ''' Create a dictionary with the details for the updates in the collection. Returns: dict: Details about each update .. code-block:: cfg List of Updates: {'<GUID>': {'Title': <title>, 'KB': <KB>, ...
[ "def", "list", "(", "self", ")", ":", "# https://msdn.microsoft.com/en-us/library/windows/desktop/aa386099(v=vs.85).aspx", "if", "self", ".", "count", "(", ")", "==", "0", ":", "return", "'Nothing to return'", "log", ".", "debug", "(", "'Building a detailed report of the ...
Create a dictionary with the details for the updates in the collection. Returns: dict: Details about each update .. code-block:: cfg List of Updates: {'<GUID>': {'Title': <title>, 'KB': <KB>, 'GUID': <the globally uni...
[ "Create", "a", "dictionary", "with", "the", "details", "for", "the", "updates", "in", "the", "collection", "." ]
python
train
RudolfCardinal/pythonlib
cardinal_pythonlib/dicts.py
https://github.com/RudolfCardinal/pythonlib/blob/0b84cb35f38bd7d8723958dae51b480a829b7227/cardinal_pythonlib/dicts.py#L152-L167
def set_null_values_in_dict(d: Dict[str, Any], null_literals: List[Any]) -> None: """ Within ``d`` (in place), replace any values found in ``null_literals`` with ``None``. """ if not null_literals: return # DO NOT add/delete values to/from a dictionary during ...
[ "def", "set_null_values_in_dict", "(", "d", ":", "Dict", "[", "str", ",", "Any", "]", ",", "null_literals", ":", "List", "[", "Any", "]", ")", "->", "None", ":", "if", "not", "null_literals", ":", "return", "# DO NOT add/delete values to/from a dictionary during...
Within ``d`` (in place), replace any values found in ``null_literals`` with ``None``.
[ "Within", "d", "(", "in", "place", ")", "replace", "any", "values", "found", "in", "null_literals", "with", "None", "." ]
python
train
Rapptz/discord.py
discord/ext/commands/cog.py
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/cog.py#L223-L225
def get_listeners(self): """Returns a :class:`list` of (name, function) listener pairs that are defined in this cog.""" return [(name, getattr(self, method_name)) for name, method_name in self.__cog_listeners__]
[ "def", "get_listeners", "(", "self", ")", ":", "return", "[", "(", "name", ",", "getattr", "(", "self", ",", "method_name", ")", ")", "for", "name", ",", "method_name", "in", "self", ".", "__cog_listeners__", "]" ]
Returns a :class:`list` of (name, function) listener pairs that are defined in this cog.
[ "Returns", "a", ":", "class", ":", "list", "of", "(", "name", "function", ")", "listener", "pairs", "that", "are", "defined", "in", "this", "cog", "." ]
python
train
staugur/Flask-PluginKit
flask_pluginkit/flask_pluginkit.py
https://github.com/staugur/Flask-PluginKit/blob/512aabf87fa13f4dc1082abd08d1d1dcf3b03f16/flask_pluginkit/flask_pluginkit.py#L411-L467
def __getPluginInfo(self, plugin, package_abspath, package_name): """ Organize plugin information. :returns: dict: plugin info """ if not isValidSemver(plugin.__version__): raise VersionError("The plugin version does not conform to the standard named %s" % package_name) ...
[ "def", "__getPluginInfo", "(", "self", ",", "plugin", ",", "package_abspath", ",", "package_name", ")", ":", "if", "not", "isValidSemver", "(", "plugin", ".", "__version__", ")", ":", "raise", "VersionError", "(", "\"The plugin version does not conform to the standard...
Organize plugin information. :returns: dict: plugin info
[ "Organize", "plugin", "information", "." ]
python
train
Microsoft/azure-devops-python-api
azure-devops/azure/devops/v5_1/git/git_client_base.py
https://github.com/Microsoft/azure-devops-python-api/blob/4777ffda2f5052fabbaddb2abe9cb434e0cf1aa8/azure-devops/azure/devops/v5_1/git/git_client_base.py#L2314-L2339
def create_comment(self, comment, repository_id, pull_request_id, thread_id, project=None): """CreateComment. [Preview API] Create a comment on a specific thread in a pull request (up to 500 comments can be created per thread). :param :class:`<Comment> <azure.devops.v5_1.git.models.Comment>` com...
[ "def", "create_comment", "(", "self", ",", "comment", ",", "repository_id", ",", "pull_request_id", ",", "thread_id", ",", "project", "=", "None", ")", ":", "route_values", "=", "{", "}", "if", "project", "is", "not", "None", ":", "route_values", "[", "'pr...
CreateComment. [Preview API] Create a comment on a specific thread in a pull request (up to 500 comments can be created per thread). :param :class:`<Comment> <azure.devops.v5_1.git.models.Comment>` comment: The comment to create. Comments can be up to 150,000 characters. :param str repository_id...
[ "CreateComment", ".", "[", "Preview", "API", "]", "Create", "a", "comment", "on", "a", "specific", "thread", "in", "a", "pull", "request", "(", "up", "to", "500", "comments", "can", "be", "created", "per", "thread", ")", ".", ":", "param", ":", "class"...
python
train
richardcornish/django-pygmentify
pygmentify/utils/pygmentify.py
https://github.com/richardcornish/django-pygmentify/blob/a2d3f6b3c3019d810d46f6ff6beb4e9f53190e7b/pygmentify/utils/pygmentify.py#L12-L33
def bits_to_dict(bits): """Convert a Django template tag's kwargs into a dictionary of Python types. The only necessary types are number, boolean, list, and string. http://pygments.org/docs/formatters/#HtmlFormatter from: ["style='monokai'", "cssclass='cssclass',", "boolean='true',", 'num=0,', "list='...
[ "def", "bits_to_dict", "(", "bits", ")", ":", "# Strip any trailing commas", "cleaned_bits", "=", "[", "bit", "[", ":", "-", "1", "]", "if", "bit", ".", "endswith", "(", "','", ")", "else", "bit", "for", "bit", "in", "bits", "]", "# Create dictionary by sp...
Convert a Django template tag's kwargs into a dictionary of Python types. The only necessary types are number, boolean, list, and string. http://pygments.org/docs/formatters/#HtmlFormatter from: ["style='monokai'", "cssclass='cssclass',", "boolean='true',", 'num=0,', "list='[]'"] to: {'style': 'mono...
[ "Convert", "a", "Django", "template", "tag", "s", "kwargs", "into", "a", "dictionary", "of", "Python", "types", "." ]
python
train
tmux-python/libtmux
libtmux/common.py
https://github.com/tmux-python/libtmux/blob/8eb2f8bbea3a025c1567b1516653414dbc24e1fc/libtmux/common.py#L324-L351
def where(self, attrs, first=False): """ Return objects matching child objects properties. Parameters ---------- attrs : dict tmux properties to match values of Returns ------- list """ # from https://github.com/serkanyersen/...
[ "def", "where", "(", "self", ",", "attrs", ",", "first", "=", "False", ")", ":", "# from https://github.com/serkanyersen/underscore.py", "def", "by", "(", "val", ",", "*", "args", ")", ":", "for", "key", ",", "value", "in", "attrs", ".", "items", "(", ")...
Return objects matching child objects properties. Parameters ---------- attrs : dict tmux properties to match values of Returns ------- list
[ "Return", "objects", "matching", "child", "objects", "properties", "." ]
python
train
lordmauve/lepton
lepton/texturizer.py
https://github.com/lordmauve/lepton/blob/bf03f2c20ea8c51ade632f692d0a21e520fbba7c/lepton/texturizer.py#L52-L67
def from_images(cls, images, weights=None, filter=None, wrap=None, aspect_adjust_width=False, aspect_adjust_height=False): """Create a SpriteTexturizer from a sequence of Pyglet images. Note all the images must be able to fit into a single OpenGL texture, so their combined size should typically be less than 10...
[ "def", "from_images", "(", "cls", ",", "images", ",", "weights", "=", "None", ",", "filter", "=", "None", ",", "wrap", "=", "None", ",", "aspect_adjust_width", "=", "False", ",", "aspect_adjust_height", "=", "False", ")", ":", "import", "pyglet", "atlas", ...
Create a SpriteTexturizer from a sequence of Pyglet images. Note all the images must be able to fit into a single OpenGL texture, so their combined size should typically be less than 1024x1024
[ "Create", "a", "SpriteTexturizer", "from", "a", "sequence", "of", "Pyglet", "images", "." ]
python
train
Alignak-monitoring/alignak
alignak/external_command.py
https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/external_command.py#L1701-L1714
def delay_svc_notification(self, service, notification_time): """Modify service first notification delay Format of the line that triggers function call:: DELAY_SVC_NOTIFICATION;<host_name>;<service_description>;<notification_time> :param service: service to edit :type service: ...
[ "def", "delay_svc_notification", "(", "self", ",", "service", ",", "notification_time", ")", ":", "service", ".", "first_notification_delay", "=", "notification_time", "self", ".", "send_an_element", "(", "service", ".", "get_update_status_brok", "(", ")", ")" ]
Modify service first notification delay Format of the line that triggers function call:: DELAY_SVC_NOTIFICATION;<host_name>;<service_description>;<notification_time> :param service: service to edit :type service: alignak.objects.service.Service :param notification_time: new val...
[ "Modify", "service", "first", "notification", "delay", "Format", "of", "the", "line", "that", "triggers", "function", "call", "::" ]
python
train
Dentosal/python-sc2
sc2/unit.py
https://github.com/Dentosal/python-sc2/blob/608bd25f04e89d39cef68b40101d8e9a8a7f1634/sc2/unit.py#L133-L141
def can_attack_air(self) -> bool: """ Does not include upgrades """ if self._weapons: weapon = next( (weapon for weapon in self._weapons if weapon.type in {TargetType.Air.value, TargetType.Any.value}), None, ) return weapon is not None ...
[ "def", "can_attack_air", "(", "self", ")", "->", "bool", ":", "if", "self", ".", "_weapons", ":", "weapon", "=", "next", "(", "(", "weapon", "for", "weapon", "in", "self", ".", "_weapons", "if", "weapon", ".", "type", "in", "{", "TargetType", ".", "A...
Does not include upgrades
[ "Does", "not", "include", "upgrades" ]
python
train
jobovy/galpy
galpy/df/evolveddiskdf.py
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/df/evolveddiskdf.py#L2282-L2286
def _vmomentsurfaceIntegrand(vR,vT,R,az,df,n,m,sigmaR1,sigmaT1,t,initvmoment): """Internal function that is the integrand for the velocity moment times surface mass integration""" o= Orbit([R,vR*sigmaR1,vT*sigmaT1,az]) return vR**n*vT**m*df(o,t)/initvmoment
[ "def", "_vmomentsurfaceIntegrand", "(", "vR", ",", "vT", ",", "R", ",", "az", ",", "df", ",", "n", ",", "m", ",", "sigmaR1", ",", "sigmaT1", ",", "t", ",", "initvmoment", ")", ":", "o", "=", "Orbit", "(", "[", "R", ",", "vR", "*", "sigmaR1", ",...
Internal function that is the integrand for the velocity moment times surface mass integration
[ "Internal", "function", "that", "is", "the", "integrand", "for", "the", "velocity", "moment", "times", "surface", "mass", "integration" ]
python
train
blockstack/virtualchain
virtualchain/lib/blockchain/bitcoin_blockchain/blocks.py
https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/blockchain/bitcoin_blockchain/blocks.py#L450-L492
def parse_tx( self, txn, block_header, block_hash, txindex ): """ Given a transaction message and its index in the block, go and create a "verbose" transaction structure containing all the information in a nice, easy-to-read dict (i.e. like what bitcoind would give us). ...
[ "def", "parse_tx", "(", "self", ",", "txn", ",", "block_header", ",", "block_hash", ",", "txindex", ")", ":", "txn_serializer", "=", "TxSerializer", "(", ")", "tx_bin", "=", "txn_serializer", ".", "serialize", "(", "txn", ")", "txdata", "=", "{", "\"versio...
Given a transaction message and its index in the block, go and create a "verbose" transaction structure containing all the information in a nice, easy-to-read dict (i.e. like what bitcoind would give us). Does not work on coinbase transactions. Does not include segwit witnesses
[ "Given", "a", "transaction", "message", "and", "its", "index", "in", "the", "block", "go", "and", "create", "a", "verbose", "transaction", "structure", "containing", "all", "the", "information", "in", "a", "nice", "easy", "-", "to", "-", "read", "dict", "(...
python
train
SuperCowPowers/workbench
workbench/workers/view_memory_deep.py
https://github.com/SuperCowPowers/workbench/blob/710232756dd717f734253315e3d0b33c9628dafb/workbench/workers/view_memory_deep.py#L11-L20
def execute(self, input_data): ''' Execute the ViewMemoryDeep worker ''' # Aggregate the output from all the memory workers, clearly this could be kewler output = input_data['view_memory'] output['tables'] = {} for data in [input_data[key] for key in ViewMemoryDeep.dependencies]...
[ "def", "execute", "(", "self", ",", "input_data", ")", ":", "# Aggregate the output from all the memory workers, clearly this could be kewler", "output", "=", "input_data", "[", "'view_memory'", "]", "output", "[", "'tables'", "]", "=", "{", "}", "for", "data", "in", ...
Execute the ViewMemoryDeep worker
[ "Execute", "the", "ViewMemoryDeep", "worker" ]
python
train
google/grr
grr/core/grr_response_core/stats/default_stats_collector.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/stats/default_stats_collector.py#L108-L115
def Record(self, value, fields=None): """Records the given observation in a distribution.""" key = _FieldsToKey(fields) metric_value = self._metric_values.get(key) if metric_value is None: metric_value = self._DefaultValue() self._metric_values[key] = metric_value metric_value.Record(val...
[ "def", "Record", "(", "self", ",", "value", ",", "fields", "=", "None", ")", ":", "key", "=", "_FieldsToKey", "(", "fields", ")", "metric_value", "=", "self", ".", "_metric_values", ".", "get", "(", "key", ")", "if", "metric_value", "is", "None", ":", ...
Records the given observation in a distribution.
[ "Records", "the", "given", "observation", "in", "a", "distribution", "." ]
python
train
JnyJny/Geometry
Geometry/triangle.py
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/triangle.py#L335-L345
def CB(self): ''' Vertices C and B, list. ''' try: return self._CB except AttributeError: pass self._CB = [self.C, self.B] return self._CB
[ "def", "CB", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_CB", "except", "AttributeError", ":", "pass", "self", ".", "_CB", "=", "[", "self", ".", "C", ",", "self", ".", "B", "]", "return", "self", ".", "_CB" ]
Vertices C and B, list.
[ "Vertices", "C", "and", "B", "list", "." ]
python
train
decryptus/sonicprobe
sonicprobe/libs/threading_tcp_server.py
https://github.com/decryptus/sonicprobe/blob/72f73f3a40d2982d79ad68686e36aa31d94b76f8/sonicprobe/libs/threading_tcp_server.py#L123-L145
def process_request_thread(self, mainthread): """obtain request from queue instead of directly from server socket""" life_time = time.time() nb_requests = 0 while not mainthread.killed(): if self.max_life_time > 0: if (time.time() - life_time) >= self.max_l...
[ "def", "process_request_thread", "(", "self", ",", "mainthread", ")", ":", "life_time", "=", "time", ".", "time", "(", ")", "nb_requests", "=", "0", "while", "not", "mainthread", ".", "killed", "(", ")", ":", "if", "self", ".", "max_life_time", ">", "0",...
obtain request from queue instead of directly from server socket
[ "obtain", "request", "from", "queue", "instead", "of", "directly", "from", "server", "socket" ]
python
train
spyder-ide/spyder
spyder/api/plugins.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/api/plugins.py#L102-L119
def initialize_plugin(self): """ Initialize plugin: connect signals, setup actions, etc. It must be run at the end of __init__ """ self.create_toggle_view_action() self.plugin_actions = self.get_plugin_actions() + [MENU_SEPARATOR, ...
[ "def", "initialize_plugin", "(", "self", ")", ":", "self", ".", "create_toggle_view_action", "(", ")", "self", ".", "plugin_actions", "=", "self", ".", "get_plugin_actions", "(", ")", "+", "[", "MENU_SEPARATOR", ",", "self", ".", "undock_action", "]", "add_act...
Initialize plugin: connect signals, setup actions, etc. It must be run at the end of __init__
[ "Initialize", "plugin", ":", "connect", "signals", "setup", "actions", "etc", "." ]
python
train
cykl/infoqscraper
infoqscraper/client.py
https://github.com/cykl/infoqscraper/blob/4fc026b994f98a0a7fe8578e0c9a3a9664982b2e/infoqscraper/client.py#L92-L105
def fetch_no_cache(self, url): """ Fetch the resource specified and return its content. DownloadError is raised if the resource cannot be fetched. """ try: with contextlib.closing(self.opener.open(url)) as response: # InfoQ does not send a 404 but a 302 ...
[ "def", "fetch_no_cache", "(", "self", ",", "url", ")", ":", "try", ":", "with", "contextlib", ".", "closing", "(", "self", ".", "opener", ".", "open", "(", "url", ")", ")", "as", "response", ":", "# InfoQ does not send a 404 but a 302 redirecting to a valid URL....
Fetch the resource specified and return its content. DownloadError is raised if the resource cannot be fetched.
[ "Fetch", "the", "resource", "specified", "and", "return", "its", "content", "." ]
python
train
genialis/resolwe
resolwe/flow/views/entity.py
https://github.com/genialis/resolwe/blob/f7bb54932c81ec0cfc5b5e80d238fceaeaa48d86/resolwe/flow/views/entity.py#L163-L175
def move_to_collection(self, request, *args, **kwargs): """Move samples from source to destination collection.""" ids = self.get_ids(request.data) src_collection_id = self.get_id(request.data, 'source_collection') dst_collection_id = self.get_id(request.data, 'destination_collection') ...
[ "def", "move_to_collection", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "ids", "=", "self", ".", "get_ids", "(", "request", ".", "data", ")", "src_collection_id", "=", "self", ".", "get_id", "(", "request", ".", ...
Move samples from source to destination collection.
[ "Move", "samples", "from", "source", "to", "destination", "collection", "." ]
python
train
pygalle-io/pygalle.core.base.klass
src/pygalle/core/base/klass/__init__.py
https://github.com/pygalle-io/pygalle.core.base.klass/blob/fa683f7f88b63ca46a0970af81a558c9efbbe942/src/pygalle/core/base/klass/__init__.py#L245-L258
def instance_of(self, kls: Any) -> bool: """ Return true if the current object is an instance of passed type. # Arguments kls: The class. # Returns: bool: * Return true if the current object is an instance of passed type. * False else. ...
[ "def", "instance_of", "(", "self", ",", "kls", ":", "Any", ")", "->", "bool", ":", "if", "not", "kls", ":", "raise", "ValueError", "return", "isinstance", "(", "self", ",", "kls", ")" ]
Return true if the current object is an instance of passed type. # Arguments kls: The class. # Returns: bool: * Return true if the current object is an instance of passed type. * False else.
[ "Return", "true", "if", "the", "current", "object", "is", "an", "instance", "of", "passed", "type", "." ]
python
train
googleapis/google-cloud-python
datastore/google/cloud/datastore/client.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/client.py#L542-L624
def query(self, **kwargs): """Proxy to :class:`google.cloud.datastore.query.Query`. Passes our ``project``. Using query to search a datastore: .. testsetup:: query import os import uuid from google.cloud import datastore unique = os.g...
[ "def", "query", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "\"client\"", "in", "kwargs", ":", "raise", "TypeError", "(", "\"Cannot pass client\"", ")", "if", "\"project\"", "in", "kwargs", ":", "raise", "TypeError", "(", "\"Cannot pass project\"", ...
Proxy to :class:`google.cloud.datastore.query.Query`. Passes our ``project``. Using query to search a datastore: .. testsetup:: query import os import uuid from google.cloud import datastore unique = os.getenv('CIRCLE_BUILD_NUM', str(uuid.uui...
[ "Proxy", "to", ":", "class", ":", "google", ".", "cloud", ".", "datastore", ".", "query", ".", "Query", "." ]
python
train
saltstack/salt
salt/cloud/clouds/msazure.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/msazure.py#L2253-L2286
def show_deployment(kwargs=None, conn=None, call=None): ''' .. versionadded:: 2015.8.0 Return information about a deployment CLI Example: .. code-block:: bash salt-cloud -f show_deployment my-azure name=my_deployment ''' if call != 'function': raise SaltCloudSystemExit( ...
[ "def", "show_deployment", "(", "kwargs", "=", "None", ",", "conn", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The get_deployment function must be called with -f or --function.'", ")"...
.. versionadded:: 2015.8.0 Return information about a deployment CLI Example: .. code-block:: bash salt-cloud -f show_deployment my-azure name=my_deployment
[ "..", "versionadded", "::", "2015", ".", "8", ".", "0" ]
python
train
bitesofcode/projexui
projexui/widgets/xorbcolumnnavigator.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbcolumnnavigator.py#L155-L168
def currentSchemaPath(self): """ Returns the column path for the current item. This will be a '.' joined path based on the root schema to the given column. :return <str> """ item = self.currentItem() path = [] while item: ...
[ "def", "currentSchemaPath", "(", "self", ")", ":", "item", "=", "self", ".", "currentItem", "(", ")", "path", "=", "[", "]", "while", "item", ":", "path", ".", "append", "(", "nativestring", "(", "item", ".", "text", "(", "0", ")", ")", ")", "item"...
Returns the column path for the current item. This will be a '.' joined path based on the root schema to the given column. :return <str>
[ "Returns", "the", "column", "path", "for", "the", "current", "item", ".", "This", "will", "be", "a", ".", "joined", "path", "based", "on", "the", "root", "schema", "to", "the", "given", "column", ".", ":", "return", "<str", ">" ]
python
train
sorgerlab/indra
indra/tools/gene_network.py
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/gene_network.py#L177-L198
def get_statements(self, filter=False): """Return the combined list of statements from BEL and Pathway Commons. Internally calls :py:meth:`get_biopax_stmts` and :py:meth:`get_bel_stmts`. Parameters ---------- filter : bool If True, includes only those statem...
[ "def", "get_statements", "(", "self", ",", "filter", "=", "False", ")", ":", "bp_stmts", "=", "self", ".", "get_biopax_stmts", "(", "filter", "=", "filter", ")", "bel_stmts", "=", "self", ".", "get_bel_stmts", "(", "filter", "=", "filter", ")", "return", ...
Return the combined list of statements from BEL and Pathway Commons. Internally calls :py:meth:`get_biopax_stmts` and :py:meth:`get_bel_stmts`. Parameters ---------- filter : bool If True, includes only those statements that exclusively mention genes in ...
[ "Return", "the", "combined", "list", "of", "statements", "from", "BEL", "and", "Pathway", "Commons", "." ]
python
train
tensorflow/probability
tensorflow_probability/python/mcmc/sample.py
https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/mcmc/sample.py#L81-L372
def sample_chain( num_results, current_state, previous_kernel_results=None, kernel=None, num_burnin_steps=0, num_steps_between_results=0, trace_fn=lambda current_state, kernel_results: kernel_results, return_final_kernel_results=False, parallel_iterations=10, name=None, ): """I...
[ "def", "sample_chain", "(", "num_results", ",", "current_state", ",", "previous_kernel_results", "=", "None", ",", "kernel", "=", "None", ",", "num_burnin_steps", "=", "0", ",", "num_steps_between_results", "=", "0", ",", "trace_fn", "=", "lambda", "current_state"...
Implements Markov chain Monte Carlo via repeated `TransitionKernel` steps. This function samples from an Markov chain at `current_state` and whose stationary distribution is governed by the supplied `TransitionKernel` instance (`kernel`). This function can sample from multiple chains, in parallel. (Whether or...
[ "Implements", "Markov", "chain", "Monte", "Carlo", "via", "repeated", "TransitionKernel", "steps", "." ]
python
test
prompt-toolkit/pymux
pymux/commands/commands.py
https://github.com/prompt-toolkit/pymux/blob/3f66e62b9de4b2251c7f9afad6c516dc5a30ec67/pymux/commands/commands.py#L466-L474
def send_prefix(pymux, variables): """ Send prefix to active pane. """ process = pymux.arrangement.get_active_pane().process for k in pymux.key_bindings_manager.prefix: vt100_data = prompt_toolkit_key_to_vt100_key(k) process.write_input(vt100_data)
[ "def", "send_prefix", "(", "pymux", ",", "variables", ")", ":", "process", "=", "pymux", ".", "arrangement", ".", "get_active_pane", "(", ")", ".", "process", "for", "k", "in", "pymux", ".", "key_bindings_manager", ".", "prefix", ":", "vt100_data", "=", "p...
Send prefix to active pane.
[ "Send", "prefix", "to", "active", "pane", "." ]
python
train
6809/MC6809
MC6809/components/cpu_utils/MC6809_registers.py
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/cpu_utils/MC6809_registers.py#L122-L150
def convert_differend_width(src_reg, dst_reg): """ e.g.: 8bit $cd TFR into 16bit, results in: $ffcd 16bit $1234 TFR into 8bit, results in: $34 >>> reg8 = ValueStorage8Bit(name="bar", initial_value=0xcd) >>> reg16 = ValueStorage16Bit(name="foo", initial_value=0x0000) >>> hex(convert_di...
[ "def", "convert_differend_width", "(", "src_reg", ",", "dst_reg", ")", ":", "src_value", "=", "src_reg", ".", "value", "if", "src_reg", ".", "WIDTH", "==", "8", "and", "dst_reg", ".", "WIDTH", "==", "16", ":", "# e.g.: $cd -> $ffcd", "src_value", "+=", "0xff...
e.g.: 8bit $cd TFR into 16bit, results in: $ffcd 16bit $1234 TFR into 8bit, results in: $34 >>> reg8 = ValueStorage8Bit(name="bar", initial_value=0xcd) >>> reg16 = ValueStorage16Bit(name="foo", initial_value=0x0000) >>> hex(convert_differend_width(src_reg=reg8, dst_reg=reg16)) '0xffcd' ...
[ "e", ".", "g", ".", ":", "8bit", "$cd", "TFR", "into", "16bit", "results", "in", ":", "$ffcd", "16bit", "$1234", "TFR", "into", "8bit", "results", "in", ":", "$34" ]
python
train
ulule/django-badgify
badgify/utils.py
https://github.com/ulule/django-badgify/blob/1bf233ffeb6293ee659454de7b3794682128b6ca/badgify/utils.py#L115-L120
def chunks(l, n): """ Yields successive n-sized chunks from l. """ for i in _range(0, len(l), n): yield l[i:i + n]
[ "def", "chunks", "(", "l", ",", "n", ")", ":", "for", "i", "in", "_range", "(", "0", ",", "len", "(", "l", ")", ",", "n", ")", ":", "yield", "l", "[", "i", ":", "i", "+", "n", "]" ]
Yields successive n-sized chunks from l.
[ "Yields", "successive", "n", "-", "sized", "chunks", "from", "l", "." ]
python
train
achedeuzot/django-timestampable
django_timestampable/models.py
https://github.com/achedeuzot/django-timestampable/blob/44d774655c383e43d931e64ac5e1d41dd737873d/django_timestampable/models.py#L31-L41
def update_timestampable_model(sender, instance, *args, **kwargs): ''' Using signals guarantees that timestamps are set no matter what: loading fixtures, bulk inserts, bulk updates, etc. Indeed, the `save()` method is *not* called when using fixtures. ''' if not isinstance(instance, Timestampabl...
[ "def", "update_timestampable_model", "(", "sender", ",", "instance", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "isinstance", "(", "instance", ",", "TimestampableModel", ")", ":", "return", "if", "not", "instance", ".", "pk", ":", ...
Using signals guarantees that timestamps are set no matter what: loading fixtures, bulk inserts, bulk updates, etc. Indeed, the `save()` method is *not* called when using fixtures.
[ "Using", "signals", "guarantees", "that", "timestamps", "are", "set", "no", "matter", "what", ":", "loading", "fixtures", "bulk", "inserts", "bulk", "updates", "etc", ".", "Indeed", "the", "save", "()", "method", "is", "*", "not", "*", "called", "when", "u...
python
train
persandstrom/python-verisure
verisure/session.py
https://github.com/persandstrom/python-verisure/blob/babd25e7f8fb2b24f12e4109dfa8a04041e8dcb8/verisure/session.py#L127-L150
def _get_installations(self): """ Get information about installations """ response = None for base_url in urls.BASE_URLS: urls.BASE_URL = base_url try: response = requests.get( urls.get_installations(self._username), ...
[ "def", "_get_installations", "(", "self", ")", ":", "response", "=", "None", "for", "base_url", "in", "urls", ".", "BASE_URLS", ":", "urls", ".", "BASE_URL", "=", "base_url", "try", ":", "response", "=", "requests", ".", "get", "(", "urls", ".", "get_ins...
Get information about installations
[ "Get", "information", "about", "installations" ]
python
train
stphivos/django-mock-queries
django_mock_queries/mocks.py
https://github.com/stphivos/django-mock-queries/blob/1522a0debfa78f4a986818d92eef826410becc85/django_mock_queries/mocks.py#L174-L181
def find_all_models(models): """ Yield all models and their parents. """ for model in models: yield model # noinspection PyProtectedMember for parent in model._meta.parents.keys(): for parent_model in find_all_models((parent,)): yield parent_model
[ "def", "find_all_models", "(", "models", ")", ":", "for", "model", "in", "models", ":", "yield", "model", "# noinspection PyProtectedMember", "for", "parent", "in", "model", ".", "_meta", ".", "parents", ".", "keys", "(", ")", ":", "for", "parent_model", "in...
Yield all models and their parents.
[ "Yield", "all", "models", "and", "their", "parents", "." ]
python
train
tanghaibao/goatools
goatools/cli/wr_hierarchy.py
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/cli/wr_hierarchy.py#L129-L137
def prt_hier(self, prt=sys.stdout): """Write hierarchy below specfied GO IDs.""" objwr = WrHierGO(self.gosubdag, **self.kws) assert self.goids, "NO VALID GO IDs WERE PROVIDED" if 'up' not in objwr.usrset: for goid in self.goids: objwr.prt_hier_down(goid, prt) ...
[ "def", "prt_hier", "(", "self", ",", "prt", "=", "sys", ".", "stdout", ")", ":", "objwr", "=", "WrHierGO", "(", "self", ".", "gosubdag", ",", "*", "*", "self", ".", "kws", ")", "assert", "self", ".", "goids", ",", "\"NO VALID GO IDs WERE PROVIDED\"", "...
Write hierarchy below specfied GO IDs.
[ "Write", "hierarchy", "below", "specfied", "GO", "IDs", "." ]
python
train
SheffieldML/GPy
GPy/util/mocap.py
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/mocap.py#L634-L643
def set_rotation_matrices(self): """Set the meta information at each vertex to contain the correct matrices C and Cinv as prescribed by the rotations and rotation orders.""" for i in range(len(self.vertices)): self.vertices[i].meta['C'] = rotation_matrix(self.vertices[i].meta['axis'][0], ...
[ "def", "set_rotation_matrices", "(", "self", ")", ":", "for", "i", "in", "range", "(", "len", "(", "self", ".", "vertices", ")", ")", ":", "self", ".", "vertices", "[", "i", "]", ".", "meta", "[", "'C'", "]", "=", "rotation_matrix", "(", "self", "....
Set the meta information at each vertex to contain the correct matrices C and Cinv as prescribed by the rotations and rotation orders.
[ "Set", "the", "meta", "information", "at", "each", "vertex", "to", "contain", "the", "correct", "matrices", "C", "and", "Cinv", "as", "prescribed", "by", "the", "rotations", "and", "rotation", "orders", "." ]
python
train
pyBookshelf/bookshelf
bookshelf/api_v2/pkg.py
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L124-L130
def install_gem(gem): """ install a particular gem """ with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=False, capture=True): # convert 0 into True, any errors will always raise an exception return not bool( run("gem install %s --no-rdoc --no...
[ "def", "install_gem", "(", "gem", ")", ":", "with", "settings", "(", "hide", "(", "'warnings'", ",", "'running'", ",", "'stdout'", ",", "'stderr'", ")", ",", "warn_only", "=", "False", ",", "capture", "=", "True", ")", ":", "# convert 0 into True, any errors...
install a particular gem
[ "install", "a", "particular", "gem" ]
python
train
unt-libraries/pyuntl
pyuntl/highwire_structure.py
https://github.com/unt-libraries/pyuntl/blob/f92413302897dab948aac18ee9e482ace0187bd4/pyuntl/highwire_structure.py#L52-L68
def get_author(self, **kwargs): """Determine the authors from the creator field.""" qualifier = kwargs.get('qualifier', '') children = kwargs.get('children', []) creator_type_per = False author_name = None # Find the creator type in children. for child in children...
[ "def", "get_author", "(", "self", ",", "*", "*", "kwargs", ")", ":", "qualifier", "=", "kwargs", ".", "get", "(", "'qualifier'", ",", "''", ")", "children", "=", "kwargs", ".", "get", "(", "'children'", ",", "[", "]", ")", "creator_type_per", "=", "F...
Determine the authors from the creator field.
[ "Determine", "the", "authors", "from", "the", "creator", "field", "." ]
python
train
bwohlberg/sporco
sporco/admm/parcbpdn.py
https://github.com/bwohlberg/sporco/blob/8946a04331106f4e39904fbdf2dc7351900baa04/sporco/admm/parcbpdn.py#L250-L262
def par_u1step(i): r"""Dual variable update for :math:`\mathbf{u}_{1,G_i}`, one of the disjoint problems for updating :math:`\mathbf{u}_1`. Parameters ---------- i : int Index of grouping to update """ global mp_U1 grpind = slice(mp_grp[i], mp_grp[i+1]) mp_U1[grpind] += mp_al...
[ "def", "par_u1step", "(", "i", ")", ":", "global", "mp_U1", "grpind", "=", "slice", "(", "mp_grp", "[", "i", "]", ",", "mp_grp", "[", "i", "+", "1", "]", ")", "mp_U1", "[", "grpind", "]", "+=", "mp_alpha", "*", "(", "mp_X", "[", "grpind", "]", ...
r"""Dual variable update for :math:`\mathbf{u}_{1,G_i}`, one of the disjoint problems for updating :math:`\mathbf{u}_1`. Parameters ---------- i : int Index of grouping to update
[ "r", "Dual", "variable", "update", "for", ":", "math", ":", "\\", "mathbf", "{", "u", "}", "_", "{", "1", "G_i", "}", "one", "of", "the", "disjoint", "problems", "for", "updating", ":", "math", ":", "\\", "mathbf", "{", "u", "}", "_1", "." ]
python
train
dourvaris/nano-python
src/nano/rpc.py
https://github.com/dourvaris/nano-python/blob/f26b8bc895b997067780f925049a70e82c0c2479/src/nano/rpc.py#L1194-L1228
def delegators(self, account): """ Returns a list of pairs of delegator names given **account** a representative and its balance .. version 8.0 required :param account: Account to return delegators for :type account: str :raises: :py:exc:`nano.rpc.RPCException`...
[ "def", "delegators", "(", "self", ",", "account", ")", ":", "account", "=", "self", ".", "_process_value", "(", "account", ",", "'account'", ")", "payload", "=", "{", "\"account\"", ":", "account", "}", "resp", "=", "self", ".", "call", "(", "'delegators...
Returns a list of pairs of delegator names given **account** a representative and its balance .. version 8.0 required :param account: Account to return delegators for :type account: str :raises: :py:exc:`nano.rpc.RPCException` >>> rpc.delegators( ... accou...
[ "Returns", "a", "list", "of", "pairs", "of", "delegator", "names", "given", "**", "account", "**", "a", "representative", "and", "its", "balance" ]
python
train
zalando/patroni
patroni/ha.py
https://github.com/zalando/patroni/blob/f6d29081c90af52064b981cdd877a07338d86038/patroni/ha.py#L1153-L1190
def handle_starting_instance(self): """Starting up PostgreSQL may take a long time. In case we are the leader we may want to fail over to.""" # Check if we are in startup, when paused defer to main loop for manual failovers. if not self.state_handler.check_for_startup() or self.is_pause...
[ "def", "handle_starting_instance", "(", "self", ")", ":", "# Check if we are in startup, when paused defer to main loop for manual failovers.", "if", "not", "self", ".", "state_handler", ".", "check_for_startup", "(", ")", "or", "self", ".", "is_paused", "(", ")", ":", ...
Starting up PostgreSQL may take a long time. In case we are the leader we may want to fail over to.
[ "Starting", "up", "PostgreSQL", "may", "take", "a", "long", "time", ".", "In", "case", "we", "are", "the", "leader", "we", "may", "want", "to", "fail", "over", "to", "." ]
python
train
sigmaris/python-gssapi
gssapi/creds.py
https://github.com/sigmaris/python-gssapi/blob/a8ca577b3ccf9d9fa48f16f4954a1eddd5896236/gssapi/creds.py#L218-L226
def mechs(self): """ The set of mechanisms supported by the credential. :type: :class:`~gssapi.oids.OIDSet` """ if not self._mechs: self._mechs = self._inquire(False, False, False, True)[3] return self._mechs
[ "def", "mechs", "(", "self", ")", ":", "if", "not", "self", ".", "_mechs", ":", "self", ".", "_mechs", "=", "self", ".", "_inquire", "(", "False", ",", "False", ",", "False", ",", "True", ")", "[", "3", "]", "return", "self", ".", "_mechs" ]
The set of mechanisms supported by the credential. :type: :class:`~gssapi.oids.OIDSet`
[ "The", "set", "of", "mechanisms", "supported", "by", "the", "credential", "." ]
python
test
quantopian/zipline
zipline/data/hdf5_daily_bars.py
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/data/hdf5_daily_bars.py#L424-L443
def from_file(cls, h5_file, country_code): """ Construct from an h5py.File and a country code. Parameters ---------- h5_file : h5py.File An HDF5 daily pricing file. country_code : str The ISO 3166 alpha-2 country code for the country to read. ...
[ "def", "from_file", "(", "cls", ",", "h5_file", ",", "country_code", ")", ":", "if", "h5_file", ".", "attrs", "[", "'version'", "]", "!=", "VERSION", ":", "raise", "ValueError", "(", "'mismatched version: file is of version %s, expected %s'", "%", "(", "h5_file", ...
Construct from an h5py.File and a country code. Parameters ---------- h5_file : h5py.File An HDF5 daily pricing file. country_code : str The ISO 3166 alpha-2 country code for the country to read.
[ "Construct", "from", "an", "h5py", ".", "File", "and", "a", "country", "code", "." ]
python
train
twilio/twilio-python
twilio/rest/autopilot/v1/assistant/task/sample.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/autopilot/v1/assistant/task/sample.py#L63-L80
def list(self, language=values.unset, limit=None, page_size=None): """ Lists SampleInstance records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. :param unicode language: The ISO language-country stri...
[ "def", "list", "(", "self", ",", "language", "=", "values", ".", "unset", ",", "limit", "=", "None", ",", "page_size", "=", "None", ")", ":", "return", "list", "(", "self", ".", "stream", "(", "language", "=", "language", ",", "limit", "=", "limit", ...
Lists SampleInstance records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. :param unicode language: The ISO language-country string that specifies the language used for the sample :param int limit: Upper limi...
[ "Lists", "SampleInstance", "records", "from", "the", "API", "as", "a", "list", ".", "Unlike", "stream", "()", "this", "operation", "is", "eager", "and", "will", "load", "limit", "records", "into", "memory", "before", "returning", "." ]
python
train
Azure/azure-storage-python
azure-storage-queue/azure/storage/queue/queueservice.py
https://github.com/Azure/azure-storage-python/blob/52327354b192cbcf6b7905118ec6b5d57fa46275/azure-storage-queue/azure/storage/queue/queueservice.py#L586-L611
def get_queue_metadata(self, queue_name, timeout=None): ''' Retrieves user-defined metadata and queue properties on the specified queue. Metadata is associated with the queue as name-value pairs. :param str queue_name: The name of an existing queue. :param int timeou...
[ "def", "get_queue_metadata", "(", "self", ",", "queue_name", ",", "timeout", "=", "None", ")", ":", "_validate_not_none", "(", "'queue_name'", ",", "queue_name", ")", "request", "=", "HTTPRequest", "(", ")", "request", ".", "method", "=", "'GET'", "request", ...
Retrieves user-defined metadata and queue properties on the specified queue. Metadata is associated with the queue as name-value pairs. :param str queue_name: The name of an existing queue. :param int timeout: The server timeout, expressed in seconds. :return: ...
[ "Retrieves", "user", "-", "defined", "metadata", "and", "queue", "properties", "on", "the", "specified", "queue", ".", "Metadata", "is", "associated", "with", "the", "queue", "as", "name", "-", "value", "pairs", "." ]
python
train
lowandrew/OLCTools
spadespipeline/legacy_vtyper.py
https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/legacy_vtyper.py#L399-L419
def filer(args): """ Create metadata objects with necessary attributes for each FASTA file found in the sequence path :param args: Argument parser object with necessary variables :return: samples: List of metadata objects """ # List to store all the metadata objects ...
[ "def", "filer", "(", "args", ")", ":", "# List to store all the metadata objects", "samples", "=", "list", "(", ")", "# Find all the sequence files in the path", "fastas", "=", "sorted", "(", "glob", "(", "os", ".", "path", ".", "join", "(", "args", ".", "sequen...
Create metadata objects with necessary attributes for each FASTA file found in the sequence path :param args: Argument parser object with necessary variables :return: samples: List of metadata objects
[ "Create", "metadata", "objects", "with", "necessary", "attributes", "for", "each", "FASTA", "file", "found", "in", "the", "sequence", "path", ":", "param", "args", ":", "Argument", "parser", "object", "with", "necessary", "variables", ":", "return", ":", "samp...
python
train
mojaie/chorus
chorus/rdkit.py
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/rdkit.py#L20-L39
def to_rdmol(mol): """Convert molecule to RDMol""" rwmol = Chem.RWMol(Chem.MolFromSmiles('')) key_to_idx = {} bond_type = {1: Chem.BondType.SINGLE, 2: Chem.BondType.DOUBLE, 3: Chem.BondType.TRIPLE} conf = Chem.Conformer(rwmol.GetNumAtoms()) for k, a in mol.atoms...
[ "def", "to_rdmol", "(", "mol", ")", ":", "rwmol", "=", "Chem", ".", "RWMol", "(", "Chem", ".", "MolFromSmiles", "(", "''", ")", ")", "key_to_idx", "=", "{", "}", "bond_type", "=", "{", "1", ":", "Chem", ".", "BondType", ".", "SINGLE", ",", "2", "...
Convert molecule to RDMol
[ "Convert", "molecule", "to", "RDMol" ]
python
train
moonso/extract_vcf
extract_vcf/config_parser.py
https://github.com/moonso/extract_vcf/blob/c8381b362fa6734cd2ee65ef260738868d981aaf/extract_vcf/config_parser.py#L196-L290
def check_plugin(self, plugin): """ Check if the section is in the proper format vcf format. Args: vcf_section (dict): The information from a vcf section Returns: True is it is in the proper format """ vcf_section = self[plugin] ...
[ "def", "check_plugin", "(", "self", ",", "plugin", ")", ":", "vcf_section", "=", "self", "[", "plugin", "]", "try", ":", "vcf_field", "=", "vcf_section", "[", "'field'", "]", "if", "not", "vcf_field", "in", "self", ".", "vcf_columns", ":", "raise", "Vali...
Check if the section is in the proper format vcf format. Args: vcf_section (dict): The information from a vcf section Returns: True is it is in the proper format
[ "Check", "if", "the", "section", "is", "in", "the", "proper", "format", "vcf", "format", "." ]
python
train
OCHA-DAP/hdx-python-api
src/hdx/data/dataset.py
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/dataset.py#L753-L767
def get_all_resources(datasets): # type: (List['Dataset']) -> List[hdx.data.resource.Resource] """Get all resources from a list of datasets (such as returned by search) Args: datasets (List[Dataset]): list of datasets Returns: List[hdx.data.resource.Resource]: l...
[ "def", "get_all_resources", "(", "datasets", ")", ":", "# type: (List['Dataset']) -> List[hdx.data.resource.Resource]", "resources", "=", "[", "]", "for", "dataset", "in", "datasets", ":", "for", "resource", "in", "dataset", ".", "get_resources", "(", ")", ":", "res...
Get all resources from a list of datasets (such as returned by search) Args: datasets (List[Dataset]): list of datasets Returns: List[hdx.data.resource.Resource]: list of resources within those datasets
[ "Get", "all", "resources", "from", "a", "list", "of", "datasets", "(", "such", "as", "returned", "by", "search", ")" ]
python
train
bitesofcode/projexui
projexui/widgets/xorbrecordbox.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbrecordbox.py#L125-L142
def addRecord(self, record): """ Adds the given record to the system. :param record | <str> """ label_mapper = self.labelMapper() icon_mapper = self.iconMapper() self.addItem(label_mapper(record)) self.setItemData(se...
[ "def", "addRecord", "(", "self", ",", "record", ")", ":", "label_mapper", "=", "self", ".", "labelMapper", "(", ")", "icon_mapper", "=", "self", ".", "iconMapper", "(", ")", "self", ".", "addItem", "(", "label_mapper", "(", "record", ")", ")", "self", ...
Adds the given record to the system. :param record | <str>
[ "Adds", "the", "given", "record", "to", "the", "system", ".", ":", "param", "record", "|", "<str", ">" ]
python
train
ansible/tower-cli
tower_cli/resources/host.py
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/host.py#L69-L86
def list_facts(self, pk=None, **kwargs): """Return a JSON object of all available facts of the given host. Note global option --format is not available here, as the output would always be JSON-formatted. =====API DOCS===== List all available facts of the given host. :param pk:...
[ "def", "list_facts", "(", "self", ",", "pk", "=", "None", ",", "*", "*", "kwargs", ")", ":", "res", "=", "self", ".", "get", "(", "pk", "=", "pk", ",", "*", "*", "kwargs", ")", "url", "=", "self", ".", "endpoint", "+", "'%d/%s/'", "%", "(", "...
Return a JSON object of all available facts of the given host. Note global option --format is not available here, as the output would always be JSON-formatted. =====API DOCS===== List all available facts of the given host. :param pk: Primary key of the target host. :type pk: i...
[ "Return", "a", "JSON", "object", "of", "all", "available", "facts", "of", "the", "given", "host", "." ]
python
valid
pyviz/holoviews
holoviews/core/boundingregion.py
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/boundingregion.py#L303-L308
def centroid(self): """ Return the centroid of the rectangle. """ left, bottom, right, top = self.lbrt() return (right + left) / 2.0, (top + bottom) / 2.0
[ "def", "centroid", "(", "self", ")", ":", "left", ",", "bottom", ",", "right", ",", "top", "=", "self", ".", "lbrt", "(", ")", "return", "(", "right", "+", "left", ")", "/", "2.0", ",", "(", "top", "+", "bottom", ")", "/", "2.0" ]
Return the centroid of the rectangle.
[ "Return", "the", "centroid", "of", "the", "rectangle", "." ]
python
train
adamrehn/ue4cli
ue4cli/UnrealManagerBase.py
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UnrealManagerBase.py#L228-L244
def getThirdPartyLibCmakeFlags(self, libs): """ Retrieves the CMake invocation flags for building against the Unreal-bundled versions of the specified third-party libraries """ fmt = PrintingFormat.singleLine() if libs[0] == '--multiline': fmt = PrintingFormat.multiLine() libs = libs[1:] platformDe...
[ "def", "getThirdPartyLibCmakeFlags", "(", "self", ",", "libs", ")", ":", "fmt", "=", "PrintingFormat", ".", "singleLine", "(", ")", "if", "libs", "[", "0", "]", "==", "'--multiline'", ":", "fmt", "=", "PrintingFormat", ".", "multiLine", "(", ")", "libs", ...
Retrieves the CMake invocation flags for building against the Unreal-bundled versions of the specified third-party libraries
[ "Retrieves", "the", "CMake", "invocation", "flags", "for", "building", "against", "the", "Unreal", "-", "bundled", "versions", "of", "the", "specified", "third", "-", "party", "libraries" ]
python
train
arviz-devs/arviz
arviz/plots/forestplot.py
https://github.com/arviz-devs/arviz/blob/d04d8da07f029fd2931f48d2f7f324cf393e5277/arviz/plots/forestplot.py#L270-L283
def make_plotters(self): """Initialize an object for each variable to be plotted.""" plotters, y = {}, 0 for var_name in self.var_names: plotters[var_name] = VarHandler( var_name, self.data, y, model_names=self.model_nam...
[ "def", "make_plotters", "(", "self", ")", ":", "plotters", ",", "y", "=", "{", "}", ",", "0", "for", "var_name", "in", "self", ".", "var_names", ":", "plotters", "[", "var_name", "]", "=", "VarHandler", "(", "var_name", ",", "self", ".", "data", ",",...
Initialize an object for each variable to be plotted.
[ "Initialize", "an", "object", "for", "each", "variable", "to", "be", "plotted", "." ]
python
train
gem/oq-engine
openquake/hazardlib/sourceconverter.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/sourceconverter.py#L548-L595
def convert_mfdist(self, node): """ Convert the given node into a Magnitude-Frequency Distribution object. :param node: a node of kind incrementalMFD or truncGutenbergRichterMFD :returns: a :class:`openquake.hazardlib.mfd.EvenlyDiscretizedMFD.` or :class:`openq...
[ "def", "convert_mfdist", "(", "self", ",", "node", ")", ":", "with", "context", "(", "self", ".", "fname", ",", "node", ")", ":", "[", "mfd_node", "]", "=", "[", "subnode", "for", "subnode", "in", "node", "if", "subnode", ".", "tag", ".", "endswith",...
Convert the given node into a Magnitude-Frequency Distribution object. :param node: a node of kind incrementalMFD or truncGutenbergRichterMFD :returns: a :class:`openquake.hazardlib.mfd.EvenlyDiscretizedMFD.` or :class:`openquake.hazardlib.mfd.TruncatedGRMFD` instance
[ "Convert", "the", "given", "node", "into", "a", "Magnitude", "-", "Frequency", "Distribution", "object", "." ]
python
train
heuer/segno
segno/utils.py
https://github.com/heuer/segno/blob/64d912a2bd17d0b5ff3e8b5d37098edfc663c2b3/segno/utils.py#L123-L149
def matrix_iter(matrix, version, scale=1, border=None): """\ Returns an iterator / generator over the provided matrix which includes the border and the scaling factor. If either the `scale` or `border` value is invalid, a :py:exc:`ValueError` is raised. :param matrix: An iterable of bytearrays...
[ "def", "matrix_iter", "(", "matrix", ",", "version", ",", "scale", "=", "1", ",", "border", "=", "None", ")", ":", "check_valid_border", "(", "border", ")", "scale", "=", "int", "(", "scale", ")", "check_valid_scale", "(", "scale", ")", "border", "=", ...
\ Returns an iterator / generator over the provided matrix which includes the border and the scaling factor. If either the `scale` or `border` value is invalid, a :py:exc:`ValueError` is raised. :param matrix: An iterable of bytearrays. :param int version: A version constant. :param int sc...
[ "\\", "Returns", "an", "iterator", "/", "generator", "over", "the", "provided", "matrix", "which", "includes", "the", "border", "and", "the", "scaling", "factor", "." ]
python
train
peterbrittain/asciimatics
asciimatics/renderers.py
https://github.com/peterbrittain/asciimatics/blob/f471427d7786ce2d5f1eeb2dae0e67d19e46e085/asciimatics/renderers.py#L226-L232
def _clear(self): """ Clear the current image. """ self._plain_image = [" " * self._width for _ in range(self._height)] self._colour_map = [[(None, 0, 0) for _ in range(self._width)] for _ in range(self._height)]
[ "def", "_clear", "(", "self", ")", ":", "self", ".", "_plain_image", "=", "[", "\" \"", "*", "self", ".", "_width", "for", "_", "in", "range", "(", "self", ".", "_height", ")", "]", "self", ".", "_colour_map", "=", "[", "[", "(", "None", ",", "0"...
Clear the current image.
[ "Clear", "the", "current", "image", "." ]
python
train
adamfast/faadata
faadata/airports/load.py
https://github.com/adamfast/faadata/blob/3c7d651b28160b7cb24724f67ebffd6bd0b490b9/faadata/airports/load.py#L9-L18
def clean_chars(value): "Hack to remove non-ASCII data. Should convert to Unicode: code page 437?" value = value.replace('\xb9', ' ') value = value.replace('\xf8', ' ') value = value.replace('\xab', ' ') value = value.replace('\xa7', ' ') value = value.replace('\xa8', ' ') value = value.repl...
[ "def", "clean_chars", "(", "value", ")", ":", "value", "=", "value", ".", "replace", "(", "'\\xb9'", ",", "' '", ")", "value", "=", "value", ".", "replace", "(", "'\\xf8'", ",", "' '", ")", "value", "=", "value", ".", "replace", "(", "'\\xab'", ",", ...
Hack to remove non-ASCII data. Should convert to Unicode: code page 437?
[ "Hack", "to", "remove", "non", "-", "ASCII", "data", ".", "Should", "convert", "to", "Unicode", ":", "code", "page", "437?" ]
python
train
inspirehep/harvesting-kit
harvestingkit/elsevier_package.py
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/elsevier_package.py#L194-L219
def _crawl_elsevier_and_find_issue_xml(self): """ Information about the current volume, issue, etc. is available in a file called issue.xml that is available in a higher directory. """ self._found_issues = [] if not self.path and not self.package_name: for iss...
[ "def", "_crawl_elsevier_and_find_issue_xml", "(", "self", ")", ":", "self", ".", "_found_issues", "=", "[", "]", "if", "not", "self", ".", "path", "and", "not", "self", ".", "package_name", ":", "for", "issue", "in", "self", ".", "conn", ".", "_get_issues"...
Information about the current volume, issue, etc. is available in a file called issue.xml that is available in a higher directory.
[ "Information", "about", "the", "current", "volume", "issue", "etc", ".", "is", "available", "in", "a", "file", "called", "issue", ".", "xml", "that", "is", "available", "in", "a", "higher", "directory", "." ]
python
valid
ibelie/typy
typy/google/protobuf/json_format.py
https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/json_format.py#L80-L94
def MessageToJson(message, including_default_value_fields=False): """Converts protobuf message to JSON format. Args: message: The protocol buffers message instance to serialize. including_default_value_fields: If True, singular primitive fields, repeated fields, and map fields will always be serial...
[ "def", "MessageToJson", "(", "message", ",", "including_default_value_fields", "=", "False", ")", ":", "js", "=", "_MessageToJsonObject", "(", "message", ",", "including_default_value_fields", ")", "return", "json", ".", "dumps", "(", "js", ",", "indent", "=", "...
Converts protobuf message to JSON format. Args: message: The protocol buffers message instance to serialize. including_default_value_fields: If True, singular primitive fields, repeated fields, and map fields will always be serialized. If False, only serialize non-empty fields. Singular mes...
[ "Converts", "protobuf", "message", "to", "JSON", "format", "." ]
python
valid
google/grr
grr/proto/setup.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/proto/setup.py#L53-L63
def compile_protos(): """Builds necessary assets from sources.""" # If there's no makefile, we're likely installing from an sdist, # so there's no need to compile the protos (they should be already # compiled). if not os.path.exists(os.path.join(THIS_DIRECTORY, "makefile.py")): return # Only compile pr...
[ "def", "compile_protos", "(", ")", ":", "# If there's no makefile, we're likely installing from an sdist,", "# so there's no need to compile the protos (they should be already", "# compiled).", "if", "not", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ".", "join"...
Builds necessary assets from sources.
[ "Builds", "necessary", "assets", "from", "sources", "." ]
python
train
pyslackers/slack-sansio
slack/events.py
https://github.com/pyslackers/slack-sansio/blob/068ddd6480c6d2f9bf14fa4db498c9fe1017f4ab/slack/events.py#L278-L303
def dispatch(self, message: Message) -> Iterator[Any]: """ Yields handlers matching the routing of the incoming :class:`slack.events.Message` Args: message: :class:`slack.events.Message` Yields: handler """ if "text" in message: text ...
[ "def", "dispatch", "(", "self", ",", "message", ":", "Message", ")", "->", "Iterator", "[", "Any", "]", ":", "if", "\"text\"", "in", "message", ":", "text", "=", "message", "[", "\"text\"", "]", "or", "\"\"", "elif", "\"message\"", "in", "message", ":"...
Yields handlers matching the routing of the incoming :class:`slack.events.Message` Args: message: :class:`slack.events.Message` Yields: handler
[ "Yields", "handlers", "matching", "the", "routing", "of", "the", "incoming", ":", "class", ":", "slack", ".", "events", ".", "Message" ]
python
train
chemlab/chemlab
chemlab/utils/__init__.py
https://github.com/chemlab/chemlab/blob/c8730966316d101e24f39ac3b96b51282aba0abe/chemlab/utils/__init__.py#L16-L23
def periodic_distance(a, b, periodic): '''Periodic distance between two arrays. Periodic is a 3 dimensional array containing the 3 box sizes. ''' delta = np.abs(a - b) delta = np.where(delta > 0.5 * periodic, periodic - delta, delta) return np.sqrt((delta ** 2).sum(axis=-1))
[ "def", "periodic_distance", "(", "a", ",", "b", ",", "periodic", ")", ":", "delta", "=", "np", ".", "abs", "(", "a", "-", "b", ")", "delta", "=", "np", ".", "where", "(", "delta", ">", "0.5", "*", "periodic", ",", "periodic", "-", "delta", ",", ...
Periodic distance between two arrays. Periodic is a 3 dimensional array containing the 3 box sizes.
[ "Periodic", "distance", "between", "two", "arrays", ".", "Periodic", "is", "a", "3", "dimensional", "array", "containing", "the", "3", "box", "sizes", "." ]
python
train
Esri/ArcREST
src/arcrest/webmap/symbols.py
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/webmap/symbols.py#L229-L235
def outlineColor(self, value): """ sets the outline color """ if isinstance(value, (list, Color)): if value is list: self._outlineColor = value else: self._outlineColor = value.asList
[ "def", "outlineColor", "(", "self", ",", "value", ")", ":", "if", "isinstance", "(", "value", ",", "(", "list", ",", "Color", ")", ")", ":", "if", "value", "is", "list", ":", "self", ".", "_outlineColor", "=", "value", "else", ":", "self", ".", "_o...
sets the outline color
[ "sets", "the", "outline", "color" ]
python
train
ubc/ubcpi
ubcpi/answer_pool.py
https://github.com/ubc/ubcpi/blob/7b6de03f93f3a4a8af4b92dfde7c69eeaf21f46e/ubcpi/answer_pool.py#L21-L40
def get_max_size(pool, num_option, item_length): """ Calculate the max number of item that an option can stored in the pool at give time. This is to limit the pool size to POOL_SIZE Args: option_index (int): the index of the option to calculate the size for pool (dict): answer pool ...
[ "def", "get_max_size", "(", "pool", ",", "num_option", ",", "item_length", ")", ":", "max_items", "=", "POOL_SIZE", "/", "item_length", "# existing items plus the reserved for min size. If there is an option has 1 item, POOL_OPTION_MIN_SIZE - 1 space", "# is reserved.", "existing",...
Calculate the max number of item that an option can stored in the pool at give time. This is to limit the pool size to POOL_SIZE Args: option_index (int): the index of the option to calculate the size for pool (dict): answer pool num_option (int): total number of options available for ...
[ "Calculate", "the", "max", "number", "of", "item", "that", "an", "option", "can", "stored", "in", "the", "pool", "at", "give", "time", "." ]
python
train