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
tanghaibao/jcvi
jcvi/formats/bed.py
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/formats/bed.py#L1274-L1375
def bins(args): """ %prog bins bedfile fastafile Bin bed lengths into each consecutive window. Use --subtract to remove bases from window, e.g. --subtract gaps.bed ignores the gap sequences. """ from jcvi.formats.sizes import Sizes p = OptionParser(bins.__doc__) p.add_option("--binsize...
[ "def", "bins", "(", "args", ")", ":", "from", "jcvi", ".", "formats", ".", "sizes", "import", "Sizes", "p", "=", "OptionParser", "(", "bins", ".", "__doc__", ")", "p", ".", "add_option", "(", "\"--binsize\"", ",", "default", "=", "100000", ",", "type",...
%prog bins bedfile fastafile Bin bed lengths into each consecutive window. Use --subtract to remove bases from window, e.g. --subtract gaps.bed ignores the gap sequences.
[ "%prog", "bins", "bedfile", "fastafile" ]
python
train
fedora-infra/fedmsg
fedmsg/crypto/utils.py
https://github.com/fedora-infra/fedmsg/blob/c21d6b3ce023fc3c0e881c704f5b55fb6e6392d7/fedmsg/crypto/utils.py#L11-L54
def fix_datagrepper_message(message): """ See if a message is (probably) a datagrepper message and attempt to mutate it to pass signature validation. Datagrepper adds the 'source_name' and 'source_version' keys. If messages happen to use those keys, they will fail message validation. Additionally, ...
[ "def", "fix_datagrepper_message", "(", "message", ")", ":", "if", "not", "(", "'source_name'", "in", "message", "and", "'source_version'", "in", "message", ")", ":", "return", "message", "# Don't mutate the original message", "message", "=", "message", ".", "copy", ...
See if a message is (probably) a datagrepper message and attempt to mutate it to pass signature validation. Datagrepper adds the 'source_name' and 'source_version' keys. If messages happen to use those keys, they will fail message validation. Additionally, a 'headers' dictionary is present on all respo...
[ "See", "if", "a", "message", "is", "(", "probably", ")", "a", "datagrepper", "message", "and", "attempt", "to", "mutate", "it", "to", "pass", "signature", "validation", "." ]
python
train
wakatime/wakatime
wakatime/packages/pygments/regexopt.py
https://github.com/wakatime/wakatime/blob/74519ace04e8472f3a3993269963732b9946a01d/wakatime/packages/pygments/regexopt.py#L27-L80
def regex_opt_inner(strings, open_paren): """Return a regex that matches any string in the sorted list of strings.""" close_paren = open_paren and ')' or '' # print strings, repr(open_paren) if not strings: # print '-> nothing left' return '' first = strings[0] if len(strings) ==...
[ "def", "regex_opt_inner", "(", "strings", ",", "open_paren", ")", ":", "close_paren", "=", "open_paren", "and", "')'", "or", "''", "# print strings, repr(open_paren)", "if", "not", "strings", ":", "# print '-> nothing left'", "return", "''", "first", "=", "strings",...
Return a regex that matches any string in the sorted list of strings.
[ "Return", "a", "regex", "that", "matches", "any", "string", "in", "the", "sorted", "list", "of", "strings", "." ]
python
train
saltstack/salt
salt/version.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/version.py#L627-L704
def system_information(): ''' Report system versions. ''' def system_version(): ''' Return host system version. ''' lin_ver = linux_distribution() mac_ver = platform.mac_ver() win_ver = platform.win32_ver() if lin_ver[0]: return ' '.jo...
[ "def", "system_information", "(", ")", ":", "def", "system_version", "(", ")", ":", "'''\n Return host system version.\n '''", "lin_ver", "=", "linux_distribution", "(", ")", "mac_ver", "=", "platform", ".", "mac_ver", "(", ")", "win_ver", "=", "platfo...
Report system versions.
[ "Report", "system", "versions", "." ]
python
train
jadolg/rocketchat_API
rocketchat_API/rocketchat.py
https://github.com/jadolg/rocketchat_API/blob/f220d094434991cb9892418245f054ea06f28aad/rocketchat_API/rocketchat.py#L147-L154
def users_get_presence(self, user_id=None, username=None, **kwargs): """Gets the online presence of the a user.""" if user_id: return self.__call_api_get('users.getPresence', userId=user_id, kwargs=kwargs) elif username: return self.__call_api_get('users.getPresence', use...
[ "def", "users_get_presence", "(", "self", ",", "user_id", "=", "None", ",", "username", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "user_id", ":", "return", "self", ".", "__call_api_get", "(", "'users.getPresence'", ",", "userId", "=", "user_id"...
Gets the online presence of the a user.
[ "Gets", "the", "online", "presence", "of", "the", "a", "user", "." ]
python
train
cloudsigma/cgroupspy
cgroupspy/utils.py
https://github.com/cloudsigma/cgroupspy/blob/e705ac4ccdfe33d8ecc700e9a35a9556084449ca/cgroupspy/utils.py#L41-L47
def walk_up_tree(root): """Post-order depth-first""" for child in root.children: for el in walk_up_tree(child): yield el yield root
[ "def", "walk_up_tree", "(", "root", ")", ":", "for", "child", "in", "root", ".", "children", ":", "for", "el", "in", "walk_up_tree", "(", "child", ")", ":", "yield", "el", "yield", "root" ]
Post-order depth-first
[ "Post", "-", "order", "depth", "-", "first" ]
python
train
cwacek/python-jsonschema-objects
python_jsonschema_objects/classbuilder.py
https://github.com/cwacek/python-jsonschema-objects/blob/54c82bfaec9c099c472663742abfc7de373a5e49/python_jsonschema_objects/classbuilder.py#L293-L327
def missing_property_names(self): """ Returns a list of properties which are required and missing. Properties are excluded from this list if they are allowed to be null. :return: list of missing properties. """ propname = lambda x: self.__prop_names__[x] missin...
[ "def", "missing_property_names", "(", "self", ")", ":", "propname", "=", "lambda", "x", ":", "self", ".", "__prop_names__", "[", "x", "]", "missing", "=", "[", "]", "for", "x", "in", "self", ".", "__required__", ":", "# Allow the null type", "propinfo", "=...
Returns a list of properties which are required and missing. Properties are excluded from this list if they are allowed to be null. :return: list of missing properties.
[ "Returns", "a", "list", "of", "properties", "which", "are", "required", "and", "missing", "." ]
python
train
svartalf/python-opus
opus/api/decoder.py
https://github.com/svartalf/python-opus/blob/a3c1d556d2772b5be659ddd08c033ddd4d566b3a/opus/api/decoder.py#L32-L41
def create(fs, channels): """Allocates and initializes a decoder state""" result_code = ctypes.c_int() result = _create(fs, channels, ctypes.byref(result_code)) if result_code.value is not 0: raise OpusError(result_code.value) return result
[ "def", "create", "(", "fs", ",", "channels", ")", ":", "result_code", "=", "ctypes", ".", "c_int", "(", ")", "result", "=", "_create", "(", "fs", ",", "channels", ",", "ctypes", ".", "byref", "(", "result_code", ")", ")", "if", "result_code", ".", "v...
Allocates and initializes a decoder state
[ "Allocates", "and", "initializes", "a", "decoder", "state" ]
python
train
shoebot/shoebot
shoebot/grammar/nodebox.py
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/grammar/nodebox.py#L157-L165
def circle(self, x, y, diameter, draw=True, **kwargs): '''Draw a circle :param x: x-coordinate of the top left corner :param y: y-coordinate of the top left corner :param diameter: Diameter of circle. :param draw: Draw immediately (defaults to True, set to False to inhibit drawin...
[ "def", "circle", "(", "self", ",", "x", ",", "y", ",", "diameter", ",", "draw", "=", "True", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "ellipse", "(", "x", ",", "y", ",", "diameter", ",", "diameter", ",", "draw", ",", "*", "*", ...
Draw a circle :param x: x-coordinate of the top left corner :param y: y-coordinate of the top left corner :param diameter: Diameter of circle. :param draw: Draw immediately (defaults to True, set to False to inhibit drawing) :return: Path object representing circle
[ "Draw", "a", "circle", ":", "param", "x", ":", "x", "-", "coordinate", "of", "the", "top", "left", "corner", ":", "param", "y", ":", "y", "-", "coordinate", "of", "the", "top", "left", "corner", ":", "param", "diameter", ":", "Diameter", "of", "circl...
python
valid
guaix-ucm/pyemir
emirdrp/processing/wavecal/rectwv_coeff_to_ds9.py
https://github.com/guaix-ucm/pyemir/blob/fef6bbabcb13f80123cafd1800a0f508a3c21702/emirdrp/processing/wavecal/rectwv_coeff_to_ds9.py#L59-L84
def save_four_ds9(rectwv_coeff, debugplot=0): """Save the 4 possible ds9 region files. Parameters ---------- rectwv_coeff : RectWaveCoeff instance Rectification and wavelength calibration coefficients for the particular CSU configuration. debugplot : int Debugging level ...
[ "def", "save_four_ds9", "(", "rectwv_coeff", ",", "debugplot", "=", "0", ")", ":", "for", "limits", ",", "rectified", ",", "suffix", "in", "zip", "(", "[", "'frontiers'", ",", "'frontiers'", ",", "'boundaries'", ",", "'boundaries'", "]", ",", "[", "False",...
Save the 4 possible ds9 region files. Parameters ---------- rectwv_coeff : RectWaveCoeff instance Rectification and wavelength calibration coefficients for the particular CSU configuration. debugplot : int Debugging level for messages and plots. For details see '...
[ "Save", "the", "4", "possible", "ds9", "region", "files", "." ]
python
train
jtwhite79/pyemu
pyemu/utils/gw_utils.py
https://github.com/jtwhite79/pyemu/blob/c504d8e7a4097cec07655a6318d275739bd8148a/pyemu/utils/gw_utils.py#L1813-L1852
def apply_sfr_obs(): """apply the sfr observation process - pairs with setup_sfr_obs(). requires sfr_obs.config. Writes <sfr_out_file>.processed, where <sfr_out_file> is defined in "sfr_obs.config" Parameters ---------- None Returns ------- df : pd.DataFrame a dataframe o...
[ "def", "apply_sfr_obs", "(", ")", ":", "assert", "os", ".", "path", ".", "exists", "(", "\"sfr_obs.config\"", ")", "df_key", "=", "pd", ".", "read_csv", "(", "\"sfr_obs.config\"", ",", "index_col", "=", "0", ")", "assert", "df_key", ".", "iloc", "[", "0"...
apply the sfr observation process - pairs with setup_sfr_obs(). requires sfr_obs.config. Writes <sfr_out_file>.processed, where <sfr_out_file> is defined in "sfr_obs.config" Parameters ---------- None Returns ------- df : pd.DataFrame a dataframe of aggregrated sfr segment aq...
[ "apply", "the", "sfr", "observation", "process", "-", "pairs", "with", "setup_sfr_obs", "()", ".", "requires", "sfr_obs", ".", "config", ".", "Writes", "<sfr_out_file", ">", ".", "processed", "where", "<sfr_out_file", ">", "is", "defined", "in", "sfr_obs", "."...
python
train
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/core/prefilter.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/prefilter.py#L174-L178
def register_transformer(self, transformer): """Register a transformer instance.""" if transformer not in self._transformers: self._transformers.append(transformer) self.sort_transformers()
[ "def", "register_transformer", "(", "self", ",", "transformer", ")", ":", "if", "transformer", "not", "in", "self", ".", "_transformers", ":", "self", ".", "_transformers", ".", "append", "(", "transformer", ")", "self", ".", "sort_transformers", "(", ")" ]
Register a transformer instance.
[ "Register", "a", "transformer", "instance", "." ]
python
test
scour-project/scour
scour/scour.py
https://github.com/scour-project/scour/blob/049264eba6b1a54ae5ba1d6a5077d8e7b80e8835/scour/scour.py#L2061-L2555
def cleanPath(element, options): """ Cleans the path string (d attribute) of the element """ global _num_bytes_saved_in_path_data global _num_path_segments_removed # this gets the parser object from svg_regex.py oldPathStr = element.getAttribute('d') path = svg_parser.parse(oldPathSt...
[ "def", "cleanPath", "(", "element", ",", "options", ")", ":", "global", "_num_bytes_saved_in_path_data", "global", "_num_path_segments_removed", "# this gets the parser object from svg_regex.py", "oldPathStr", "=", "element", ".", "getAttribute", "(", "'d'", ")", "path", ...
Cleans the path string (d attribute) of the element
[ "Cleans", "the", "path", "string", "(", "d", "attribute", ")", "of", "the", "element" ]
python
train
ryanleland/Akispy
akispy/__init__.py
https://github.com/ryanleland/Akispy/blob/dbbb85a1d1b027051e11179289cc9067cb90baf6/akispy/__init__.py#L29-L44
def verify_key(self, url): """For verifying your API key. Provide the URL of your site or blog you will be checking spam from. """ response = self._request('verify-key', { 'blog': url, 'key': self._key }) if response.stat...
[ "def", "verify_key", "(", "self", ",", "url", ")", ":", "response", "=", "self", ".", "_request", "(", "'verify-key'", ",", "{", "'blog'", ":", "url", ",", "'key'", ":", "self", ".", "_key", "}", ")", "if", "response", ".", "status", "is", "200", "...
For verifying your API key. Provide the URL of your site or blog you will be checking spam from.
[ "For", "verifying", "your", "API", "key", ".", "Provide", "the", "URL", "of", "your", "site", "or", "blog", "you", "will", "be", "checking", "spam", "from", "." ]
python
train
jaredLunde/redis_structures
redis_structures/__init__.py
https://github.com/jaredLunde/redis_structures/blob/b9cce5f5c85db5e12c292633ff8d04e3ae053294/redis_structures/__init__.py#L1689-L1704
def update(self, members): """ Adds @members to the set @members: a :class:RedisSet object or #set -> #int the number of @members that were added to the set, excluding pre-existing members """ if isinstance(members, RedisSet): size = self.size...
[ "def", "update", "(", "self", ",", "members", ")", ":", "if", "isinstance", "(", "members", ",", "RedisSet", ")", ":", "size", "=", "self", ".", "size", "return", "(", "self", ".", "unionstore", "(", "self", ".", "key_prefix", ",", "members", ".", "k...
Adds @members to the set @members: a :class:RedisSet object or #set -> #int the number of @members that were added to the set, excluding pre-existing members
[ "Adds", "@members", "to", "the", "set", "@members", ":", "a", ":", "class", ":", "RedisSet", "object", "or", "#set" ]
python
train
LCAV/pylocus
pylocus/simulation.py
https://github.com/LCAV/pylocus/blob/c56a38c251d8a435caf4641a8ae6027ecba2c8c6/pylocus/simulation.py#L67-L99
def create_mask(N, method='all', nmissing=0): """ Create weight mask according to method. :param N: Dimension of square weight matrix. :param method: Method to use (default: 'all'). - none: no missing entries (only diagonal is set to 0 for dwMDS) - first: only randomly delete measurements to first ...
[ "def", "create_mask", "(", "N", ",", "method", "=", "'all'", ",", "nmissing", "=", "0", ")", ":", "weights", "=", "np", ".", "ones", "(", "(", "N", ",", "N", ")", ")", "weights", "[", "range", "(", "N", ")", ",", "range", "(", "N", ")", "]", ...
Create weight mask according to method. :param N: Dimension of square weight matrix. :param method: Method to use (default: 'all'). - none: no missing entries (only diagonal is set to 0 for dwMDS) - first: only randomly delete measurements to first point (zeros in first row/column of matrix) - all:...
[ "Create", "weight", "mask", "according", "to", "method", "." ]
python
train
flowersteam/explauto
explauto/models/dataset.py
https://github.com/flowersteam/explauto/blob/cf0f81ecb9f6412f7276a95bd27359000e1e26b6/explauto/models/dataset.py#L39-L54
def nn(self, x, k = 1, radius = np.inf, eps = 0.0, p = 2): """Find the k nearest neighbors of x in the observed input data :arg x: center :arg k: the number of nearest neighbors to return (default: 1) :arg eps: approximate nearest neighbors. the k-th ret...
[ "def", "nn", "(", "self", ",", "x", ",", "k", "=", "1", ",", "radius", "=", "np", ".", "inf", ",", "eps", "=", "0.0", ",", "p", "=", "2", ")", ":", "assert", "len", "(", "x", ")", "==", "self", ".", "dim", ",", "'dimension of input {} does not ...
Find the k nearest neighbors of x in the observed input data :arg x: center :arg k: the number of nearest neighbors to return (default: 1) :arg eps: approximate nearest neighbors. the k-th returned value is guaranteed to be no further than (...
[ "Find", "the", "k", "nearest", "neighbors", "of", "x", "in", "the", "observed", "input", "data", ":", "arg", "x", ":", "center", ":", "arg", "k", ":", "the", "number", "of", "nearest", "neighbors", "to", "return", "(", "default", ":", "1", ")", ":", ...
python
train
MillionIntegrals/vel
vel/rl/models/deterministic_policy_model.py
https://github.com/MillionIntegrals/vel/blob/e0726e1f63742b728966ccae0c8b825ea0ba491a/vel/rl/models/deterministic_policy_model.py#L156-L164
def create(policy_backbone: ModelFactory, value_backbone: ModelFactory, input_block: typing.Optional[ModelFactory]=None): """ Vel factory function """ if input_block is None: input_block = IdentityFactory() return DeterministicPolicyModelFactory( input_block=input_block, policy_b...
[ "def", "create", "(", "policy_backbone", ":", "ModelFactory", ",", "value_backbone", ":", "ModelFactory", ",", "input_block", ":", "typing", ".", "Optional", "[", "ModelFactory", "]", "=", "None", ")", ":", "if", "input_block", "is", "None", ":", "input_block"...
Vel factory function
[ "Vel", "factory", "function" ]
python
train
mozilla/python-zeppelin
zeppelin/converters/markdown.py
https://github.com/mozilla/python-zeppelin/blob/76ce6b7608ef6cf7b807bd5d850a58ea6a59ef07/zeppelin/converters/markdown.py#L147-L174
def build_markdown_body(self, text): """Generate the body for the Markdown file. - processes each json block one by one - for each block, process: - the creator of the notebook (user) - the date the notebook was created - the date the notebook was last update...
[ "def", "build_markdown_body", "(", "self", ",", "text", ")", ":", "key_options", "=", "{", "'dateCreated'", ":", "self", ".", "process_date_created", ",", "'dateUpdated'", ":", "self", ".", "process_date_updated", ",", "'title'", ":", "self", ".", "process_title...
Generate the body for the Markdown file. - processes each json block one by one - for each block, process: - the creator of the notebook (user) - the date the notebook was created - the date the notebook was last updated - the input by detecting the edito...
[ "Generate", "the", "body", "for", "the", "Markdown", "file", "." ]
python
train
googleapis/google-cloud-python
logging/google/cloud/logging/_gapic.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/_gapic.py#L518-L534
def _item_to_metric(iterator, log_metric_pb): """Convert a metric protobuf to the native object. :type iterator: :class:`~google.api_core.page_iterator.Iterator` :param iterator: The iterator that is currently in use. :type log_metric_pb: :class:`.logging_metrics_pb2.LogMetric` :param log_...
[ "def", "_item_to_metric", "(", "iterator", ",", "log_metric_pb", ")", ":", "# NOTE: LogMetric message type does not have an ``Any`` field", "# so `MessageToDict`` can safely be used.", "resource", "=", "MessageToDict", "(", "log_metric_pb", ")", "return", "Metric", ".", "...
Convert a metric protobuf to the native object. :type iterator: :class:`~google.api_core.page_iterator.Iterator` :param iterator: The iterator that is currently in use. :type log_metric_pb: :class:`.logging_metrics_pb2.LogMetric` :param log_metric_pb: Metric protobuf returned from the API. ...
[ "Convert", "a", "metric", "protobuf", "to", "the", "native", "object", "." ]
python
train
django-fluent/django-fluent-blogs
fluent_blogs/models/query.py
https://github.com/django-fluent/django-fluent-blogs/blob/86b148549a010eaca9a2ea987fe43be250e06c50/fluent_blogs/models/query.py#L72-L144
def query_entries( queryset=None, year=None, month=None, day=None, category=None, category_slug=None, tag=None, tag_slug=None, author=None, author_slug=None, future=False, order=None, orderby=None, limit=None, ): """ Query the entries using a set of predefined filters. Th...
[ "def", "query_entries", "(", "queryset", "=", "None", ",", "year", "=", "None", ",", "month", "=", "None", ",", "day", "=", "None", ",", "category", "=", "None", ",", "category_slug", "=", "None", ",", "tag", "=", "None", ",", "tag_slug", "=", "None"...
Query the entries using a set of predefined filters. This interface is mainly used by the ``get_entries`` template tag.
[ "Query", "the", "entries", "using", "a", "set", "of", "predefined", "filters", ".", "This", "interface", "is", "mainly", "used", "by", "the", "get_entries", "template", "tag", "." ]
python
train
sibson/vncdotool
vncdotool/rfb.py
https://github.com/sibson/vncdotool/blob/e133a8916efaa0f5ed421e0aa737196624635b0c/vncdotool/rfb.py#L586-L590
def clientCutText(self, message): """The client has new ASCII text in its cut buffer. (aka clipboard) """ self.transport.write(pack("!BxxxI", 6, len(message)) + message)
[ "def", "clientCutText", "(", "self", ",", "message", ")", ":", "self", ".", "transport", ".", "write", "(", "pack", "(", "\"!BxxxI\"", ",", "6", ",", "len", "(", "message", ")", ")", "+", "message", ")" ]
The client has new ASCII text in its cut buffer. (aka clipboard)
[ "The", "client", "has", "new", "ASCII", "text", "in", "its", "cut", "buffer", ".", "(", "aka", "clipboard", ")" ]
python
train
jay-johnson/spylunking
spylunking/scripts/search_splunk.py
https://github.com/jay-johnson/spylunking/blob/95cc86776f04ec5935cf04e291cf18798345d6cb/spylunking/scripts/search_splunk.py#L254-L285
def show_non_search_results( log_rec, code_view=True, json_view=False, show_message_details=False): """show_non_search_results Show non-search results for search jobs like: ``index="antinex" | stats count`` :param log_rec: log record from splunk :param code_view: sh...
[ "def", "show_non_search_results", "(", "log_rec", ",", "code_view", "=", "True", ",", "json_view", "=", "False", ",", "show_message_details", "=", "False", ")", ":", "log_dict", "=", "None", "try", ":", "log_dict", "=", "json", ".", "loads", "(", "log_rec", ...
show_non_search_results Show non-search results for search jobs like: ``index="antinex" | stats count`` :param log_rec: log record from splunk :param code_view: show as a normal tail -f <log file> view :param json_view: pretty print each log's dictionary :param show_message_details
[ "show_non_search_results" ]
python
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/SConf.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/SConf.py#L478-L529
def BuildNodes(self, nodes): """ Tries to build the given nodes immediately. Returns 1 on success, 0 on error. """ if self.logstream is not None: # override stdout / stderr to write in log file oldStdout = sys.stdout sys.stdout = self.logstream...
[ "def", "BuildNodes", "(", "self", ",", "nodes", ")", ":", "if", "self", ".", "logstream", "is", "not", "None", ":", "# override stdout / stderr to write in log file", "oldStdout", "=", "sys", ".", "stdout", "sys", ".", "stdout", "=", "self", ".", "logstream", ...
Tries to build the given nodes immediately. Returns 1 on success, 0 on error.
[ "Tries", "to", "build", "the", "given", "nodes", "immediately", ".", "Returns", "1", "on", "success", "0", "on", "error", "." ]
python
train
jaraco/wolframalpha
wolframalpha/__init__.py
https://github.com/jaraco/wolframalpha/blob/50bf2e047b698e308a9a88770a23e7e210aa5bcb/wolframalpha/__init__.py#L181-L185
def info(self): """ The pods, assumptions, and warnings of this result. """ return itertools.chain(self.pods, self.assumptions, self.warnings)
[ "def", "info", "(", "self", ")", ":", "return", "itertools", ".", "chain", "(", "self", ".", "pods", ",", "self", ".", "assumptions", ",", "self", ".", "warnings", ")" ]
The pods, assumptions, and warnings of this result.
[ "The", "pods", "assumptions", "and", "warnings", "of", "this", "result", "." ]
python
test
opencobra/cobrapy
cobra/io/sbml.py
https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/io/sbml.py#L1106-L1146
def _create_bound(model, reaction, bound_type, f_replace, units=None, flux_udef=None): """Creates bound in model for given reaction. Adds the parameters for the bounds to the SBML model. Parameters ---------- model : libsbml.Model SBML model instance reaction : cobra....
[ "def", "_create_bound", "(", "model", ",", "reaction", ",", "bound_type", ",", "f_replace", ",", "units", "=", "None", ",", "flux_udef", "=", "None", ")", ":", "value", "=", "getattr", "(", "reaction", ",", "bound_type", ")", "if", "value", "==", "config...
Creates bound in model for given reaction. Adds the parameters for the bounds to the SBML model. Parameters ---------- model : libsbml.Model SBML model instance reaction : cobra.core.Reaction Cobra reaction instance from which the bounds are read. bound_type : {LOWER_BOUND, UPP...
[ "Creates", "bound", "in", "model", "for", "given", "reaction", "." ]
python
valid
openstack/networking-cisco
networking_cisco/apps/saf/agent/iptables_driver.py
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/iptables_driver.py#L155-L192
def update_iptables(self): """Update iptables based on information in the rule_info.""" # Read the iptables iptables_cmds = ['iptables-save', '-c'] all_rules = dsl.execute(iptables_cmds, root_helper=self._root_helper, log_output=False) # For each...
[ "def", "update_iptables", "(", "self", ")", ":", "# Read the iptables", "iptables_cmds", "=", "[", "'iptables-save'", ",", "'-c'", "]", "all_rules", "=", "dsl", ".", "execute", "(", "iptables_cmds", ",", "root_helper", "=", "self", ".", "_root_helper", ",", "l...
Update iptables based on information in the rule_info.
[ "Update", "iptables", "based", "on", "information", "in", "the", "rule_info", "." ]
python
train
SmileyChris/easy-thumbnails
easy_thumbnails/management/__init__.py
https://github.com/SmileyChris/easy-thumbnails/blob/b08ab44883bf7b221a98dadb9b589cb95d35b0bf/easy_thumbnails/management/__init__.py#L94-L101
def delete_thumbnails(relative_source_path, root=None, basedir=None, subdir=None, prefix=None): """ Delete all thumbnails for a source image. """ thumbs = thumbnails_for_file(relative_source_path, root, basedir, subdir, prefix) return _delete_us...
[ "def", "delete_thumbnails", "(", "relative_source_path", ",", "root", "=", "None", ",", "basedir", "=", "None", ",", "subdir", "=", "None", ",", "prefix", "=", "None", ")", ":", "thumbs", "=", "thumbnails_for_file", "(", "relative_source_path", ",", "root", ...
Delete all thumbnails for a source image.
[ "Delete", "all", "thumbnails", "for", "a", "source", "image", "." ]
python
train
soravux/scoop
scoop/discovery/minusconf.py
https://github.com/soravux/scoop/blob/d391dfa62f47e49d48328ee9cf08aa114256fd33/scoop/discovery/minusconf.py#L243-L248
def start_blocking(self): """ Start the advertiser in the background, but wait until it is ready """ self._cav_started.clear() self.start() self._cav_started.wait()
[ "def", "start_blocking", "(", "self", ")", ":", "self", ".", "_cav_started", ".", "clear", "(", ")", "self", ".", "start", "(", ")", "self", ".", "_cav_started", ".", "wait", "(", ")" ]
Start the advertiser in the background, but wait until it is ready
[ "Start", "the", "advertiser", "in", "the", "background", "but", "wait", "until", "it", "is", "ready" ]
python
train
Ex-Mente/auxi.0
auxi/core/helpers.py
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/core/helpers.py#L23-L34
def get_date(date): """ Get the date from a value that could be a date object or a string. :param date: The date object or string. :returns: The date object. """ if type(date) is str: return datetime.strptime(date, '%Y-%m-%d').date() else: return date
[ "def", "get_date", "(", "date", ")", ":", "if", "type", "(", "date", ")", "is", "str", ":", "return", "datetime", ".", "strptime", "(", "date", ",", "'%Y-%m-%d'", ")", ".", "date", "(", ")", "else", ":", "return", "date" ]
Get the date from a value that could be a date object or a string. :param date: The date object or string. :returns: The date object.
[ "Get", "the", "date", "from", "a", "value", "that", "could", "be", "a", "date", "object", "or", "a", "string", "." ]
python
valid
pandas-dev/pandas
pandas/core/arrays/datetimes.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/datetimes.py#L2114-L2140
def _maybe_localize_point(ts, is_none, is_not_none, freq, tz): """ Localize a start or end Timestamp to the timezone of the corresponding start or end Timestamp Parameters ---------- ts : start or end Timestamp to potentially localize is_none : argument that should be None is_not_none :...
[ "def", "_maybe_localize_point", "(", "ts", ",", "is_none", ",", "is_not_none", ",", "freq", ",", "tz", ")", ":", "# Make sure start and end are timezone localized if:", "# 1) freq = a Timedelta-like frequency (Tick)", "# 2) freq = None i.e. generating a linspaced range", "if", "i...
Localize a start or end Timestamp to the timezone of the corresponding start or end Timestamp Parameters ---------- ts : start or end Timestamp to potentially localize is_none : argument that should be None is_not_none : argument that should not be None freq : Tick, DateOffset, or None ...
[ "Localize", "a", "start", "or", "end", "Timestamp", "to", "the", "timezone", "of", "the", "corresponding", "start", "or", "end", "Timestamp" ]
python
train
Nike-Inc/cerberus-python-client
cerberus/client.py
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/client.py#L242-L253
def get_sdb_by_id(self, sdb_id): """ Return the details for the given safe deposit box id Keyword arguments: sdb_id -- this is the id of the safe deposit box, not the path. """ sdb_resp = get_with_retry(self.cerberus_url + '/v2/safe-deposit-box/' + sdb_id, ...
[ "def", "get_sdb_by_id", "(", "self", ",", "sdb_id", ")", ":", "sdb_resp", "=", "get_with_retry", "(", "self", ".", "cerberus_url", "+", "'/v2/safe-deposit-box/'", "+", "sdb_id", ",", "headers", "=", "self", ".", "HEADERS", ")", "throw_if_bad_response", "(", "s...
Return the details for the given safe deposit box id Keyword arguments: sdb_id -- this is the id of the safe deposit box, not the path.
[ "Return", "the", "details", "for", "the", "given", "safe", "deposit", "box", "id" ]
python
train
stevearc/dql
dql/util.py
https://github.com/stevearc/dql/blob/e9d3aa22873076dae5ebd02e35318aa996b1e56a/dql/util.py#L56-L88
def resolve(val): """ Convert a pyparsing value to the python type """ name = val.getName() if name == "number": try: return int(val.number) except ValueError: return Decimal(val.number) elif name == "str": return unwrap(val.str) elif name == "null": ...
[ "def", "resolve", "(", "val", ")", ":", "name", "=", "val", ".", "getName", "(", ")", "if", "name", "==", "\"number\"", ":", "try", ":", "return", "int", "(", "val", ".", "number", ")", "except", "ValueError", ":", "return", "Decimal", "(", "val", ...
Convert a pyparsing value to the python type
[ "Convert", "a", "pyparsing", "value", "to", "the", "python", "type" ]
python
train
rodynnz/xccdf
src/xccdf/models/description.py
https://github.com/rodynnz/xccdf/blob/1b9dc2f06b5cce8db2a54c5f95a8f6bcf5cb6981/src/xccdf/models/description.py#L51-L67
def update_xml_element(self): """ Updates the xml element contents to matches the instance contents. :returns: Updated XML element. :rtype: lxml.etree._Element """ super(Description, self).update_xml_element() if hasattr(self, 'lang'): self.xml_elem...
[ "def", "update_xml_element", "(", "self", ")", ":", "super", "(", "Description", ",", "self", ")", ".", "update_xml_element", "(", ")", "if", "hasattr", "(", "self", ",", "'lang'", ")", ":", "self", ".", "xml_element", ".", "set", "(", "'{http://www.w3.org...
Updates the xml element contents to matches the instance contents. :returns: Updated XML element. :rtype: lxml.etree._Element
[ "Updates", "the", "xml", "element", "contents", "to", "matches", "the", "instance", "contents", "." ]
python
train
dustinmm80/healthy
checks.py
https://github.com/dustinmm80/healthy/blob/b59016c3f578ca45b6ce857a2d5c4584b8542288/checks.py#L94-L107
def check_python_classifiers(package_info, *args): """ Does the package have Python classifiers? :param package_info: package_info dictionary :return: Tuple (is the condition True or False?, reason if it is False else None, score to be applied) """ classifiers = package_info.get('classifiers') ...
[ "def", "check_python_classifiers", "(", "package_info", ",", "*", "args", ")", ":", "classifiers", "=", "package_info", ".", "get", "(", "'classifiers'", ")", "reason", "=", "\"Python classifiers missing\"", "result", "=", "False", "if", "len", "(", "[", "c", ...
Does the package have Python classifiers? :param package_info: package_info dictionary :return: Tuple (is the condition True or False?, reason if it is False else None, score to be applied)
[ "Does", "the", "package", "have", "Python", "classifiers?", ":", "param", "package_info", ":", "package_info", "dictionary", ":", "return", ":", "Tuple", "(", "is", "the", "condition", "True", "or", "False?", "reason", "if", "it", "is", "False", "else", "Non...
python
train
shakefu/pyconfig
pyconfig/__init__.py
https://github.com/shakefu/pyconfig/blob/000cb127db51e03cb4070aae6943e956193cbad5/pyconfig/__init__.py#L414-L472
def load(self, prefix=None, depth=None): """ Return a dictionary of settings loaded from etcd. """ prefix = prefix or self.prefix prefix = '/' + prefix.strip('/') + '/' if depth is None: depth = self.inherit_depth if not self.configured: ...
[ "def", "load", "(", "self", ",", "prefix", "=", "None", ",", "depth", "=", "None", ")", ":", "prefix", "=", "prefix", "or", "self", ".", "prefix", "prefix", "=", "'/'", "+", "prefix", ".", "strip", "(", "'/'", ")", "+", "'/'", "if", "depth", "is"...
Return a dictionary of settings loaded from etcd.
[ "Return", "a", "dictionary", "of", "settings", "loaded", "from", "etcd", "." ]
python
valid
ralphbean/taskw
taskw/utils.py
https://github.com/ralphbean/taskw/blob/11e2f9132eaedd157f514538de9b5f3b69c30a52/taskw/utils.py#L125-L140
def encode_task_experimental(task): """ Convert a dict-like task to its string representation Used for adding a task via `task add` """ # First, clean the task: task = task.copy() if 'tags' in task: task['tags'] = ','.join(task['tags']) for k in task: task[k] = encode_tas...
[ "def", "encode_task_experimental", "(", "task", ")", ":", "# First, clean the task:", "task", "=", "task", ".", "copy", "(", ")", "if", "'tags'", "in", "task", ":", "task", "[", "'tags'", "]", "=", "','", ".", "join", "(", "task", "[", "'tags'", "]", "...
Convert a dict-like task to its string representation Used for adding a task via `task add`
[ "Convert", "a", "dict", "-", "like", "task", "to", "its", "string", "representation", "Used", "for", "adding", "a", "task", "via", "task", "add" ]
python
train
IdentityPython/SATOSA
src/satosa/frontends/saml2.py
https://github.com/IdentityPython/SATOSA/blob/49da5d4c0ac1a5ebf1a71b4f7aaf04f0e52d8fdb/src/satosa/frontends/saml2.py#L522-L544
def _build_idp_config_endpoints(self, config, providers): """ Builds the final frontend module config :type config: dict[str, Any] :type providers: list[str] :rtype: dict[str, Any] :param config: The module config :param providers: A list of backend names ...
[ "def", "_build_idp_config_endpoints", "(", "self", ",", "config", ",", "providers", ")", ":", "# Add an endpoint to each provider", "idp_endpoints", "=", "[", "]", "for", "endp_category", "in", "self", ".", "endpoints", ":", "for", "func", ",", "endpoint", "in", ...
Builds the final frontend module config :type config: dict[str, Any] :type providers: list[str] :rtype: dict[str, Any] :param config: The module config :param providers: A list of backend names :return: The final config
[ "Builds", "the", "final", "frontend", "module", "config" ]
python
train
saltstack/salt
salt/master.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L1794-L1818
def revoke_auth(self, load): ''' Allow a minion to request revocation of its own key :param dict load: The minion payload :rtype: dict :return: If the load is invalid, it may be returned. No key operation is performed. :rtype: bool :return: True if key was revo...
[ "def", "revoke_auth", "(", "self", ",", "load", ")", ":", "load", "=", "self", ".", "__verify_load", "(", "load", ",", "(", "'id'", ",", "'tok'", ")", ")", "if", "not", "self", ".", "opts", ".", "get", "(", "'allow_minion_key_revoke'", ",", "False", ...
Allow a minion to request revocation of its own key :param dict load: The minion payload :rtype: dict :return: If the load is invalid, it may be returned. No key operation is performed. :rtype: bool :return: True if key was revoked, False if not
[ "Allow", "a", "minion", "to", "request", "revocation", "of", "its", "own", "key" ]
python
train
fulfilio/python-magento
magento/catalog.py
https://github.com/fulfilio/python-magento/blob/720ec136a6e438a9ee4ee92848a9820b91732750/magento/catalog.py#L272-L286
def create(self, product_type, attribute_set_id, sku, data): """ Create Product and return ID :param product_type: String type of product :param attribute_set_id: ID of attribute set :param sku: SKU of the product :param data: Dictionary of data :return: INT id o...
[ "def", "create", "(", "self", ",", "product_type", ",", "attribute_set_id", ",", "sku", ",", "data", ")", ":", "return", "int", "(", "self", ".", "call", "(", "'catalog_product.create'", ",", "[", "product_type", ",", "attribute_set_id", ",", "sku", ",", "...
Create Product and return ID :param product_type: String type of product :param attribute_set_id: ID of attribute set :param sku: SKU of the product :param data: Dictionary of data :return: INT id of product created
[ "Create", "Product", "and", "return", "ID" ]
python
train
Ex-Mente/auxi.0
auxi/modelling/business/models.py
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/business/models.py#L65-L78
def create_entity(self, name, gl_structure, description=None): """ Create an entity and add it to the model. :param name: The entity name. :param gl_structure: The entity's general ledger structure. :param description: The entity description. :returns: The created entit...
[ "def", "create_entity", "(", "self", ",", "name", ",", "gl_structure", ",", "description", "=", "None", ")", ":", "new_entity", "=", "Entity", "(", "name", ",", "gl_structure", ",", "description", "=", "description", ")", "self", ".", "entities", ".", "app...
Create an entity and add it to the model. :param name: The entity name. :param gl_structure: The entity's general ledger structure. :param description: The entity description. :returns: The created entity.
[ "Create", "an", "entity", "and", "add", "it", "to", "the", "model", "." ]
python
valid
fermiPy/fermipy
fermipy/fits_utils.py
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/fits_utils.py#L125-L176
def read_projection_from_fits(fitsfile, extname=None): """ Load a WCS or HPX projection. """ f = fits.open(fitsfile) nhdu = len(f) # Try and get the energy bounds try: ebins = find_and_read_ebins(f) except: ebins = None if extname is None: # If there is an im...
[ "def", "read_projection_from_fits", "(", "fitsfile", ",", "extname", "=", "None", ")", ":", "f", "=", "fits", ".", "open", "(", "fitsfile", ")", "nhdu", "=", "len", "(", "f", ")", "# Try and get the energy bounds", "try", ":", "ebins", "=", "find_and_read_eb...
Load a WCS or HPX projection.
[ "Load", "a", "WCS", "or", "HPX", "projection", "." ]
python
train
nerdvegas/rez
src/rez/vendor/amqp/connection.py
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/connection.py#L532-L536
def _blocked(self, args): """RabbitMQ Extension.""" reason = args.read_shortstr() if self.on_blocked: return self.on_blocked(reason)
[ "def", "_blocked", "(", "self", ",", "args", ")", ":", "reason", "=", "args", ".", "read_shortstr", "(", ")", "if", "self", ".", "on_blocked", ":", "return", "self", ".", "on_blocked", "(", "reason", ")" ]
RabbitMQ Extension.
[ "RabbitMQ", "Extension", "." ]
python
train
a1ezzz/wasp-general
wasp_general/network/messenger/coders.py
https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/network/messenger/coders.py#L128-L157
def decode(self, envelope, session, target=None, modification_code=None, **kwargs): """ Methods checks envelope for 'modification_code' existence and removes it. :param envelope: original envelope :param session: original session :param target: flag, that specifies whether code must be searched and removed at ...
[ "def", "decode", "(", "self", ",", "envelope", ",", "session", ",", "target", "=", "None", ",", "modification_code", "=", "None", ",", "*", "*", "kwargs", ")", ":", "self", ".", "__args_check", "(", "envelope", ",", "target", ",", "modification_code", ")...
Methods checks envelope for 'modification_code' existence and removes it. :param envelope: original envelope :param session: original session :param target: flag, that specifies whether code must be searched and removed at the start or at the end :param modification_code: code to search/remove :param kwargs:...
[ "Methods", "checks", "envelope", "for", "modification_code", "existence", "and", "removes", "it", "." ]
python
train
oasiswork/zimsoap
zimsoap/zobjects.py
https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/zobjects.py#L364-L380
def to_selector(self): """ For some reason, the selector for <identity> is <identity id="1234" /> rather than <identity by="id"></identity> """ for i in self.SELECTORS: if hasattr(self, i): val = getattr(self, i) sel...
[ "def", "to_selector", "(", "self", ")", ":", "for", "i", "in", "self", ".", "SELECTORS", ":", "if", "hasattr", "(", "self", ",", "i", ")", ":", "val", "=", "getattr", "(", "self", ",", "i", ")", "selector", "=", "i", "break", "return", "{", "sele...
For some reason, the selector for <identity> is <identity id="1234" /> rather than <identity by="id"></identity>
[ "For", "some", "reason", "the", "selector", "for", "<identity", ">", "is" ]
python
train
fracpete/python-weka-wrapper3
python/weka/classifiers.py
https://github.com/fracpete/python-weka-wrapper3/blob/d850ab1bdb25fbd5a8d86e99f34a397975425838/python/weka/classifiers.py#L2027-L2040
def print_classification(self, cls, inst, index): """ Prints the classification to the buffer. :param cls: the classifier :type cls: Classifier :param inst: the test instance :type inst: Instance :param index: the 0-based index of the test instance :type ...
[ "def", "print_classification", "(", "self", ",", "cls", ",", "inst", ",", "index", ")", ":", "javabridge", ".", "call", "(", "self", ".", "jobject", ",", "\"printClassification\"", ",", "\"(Lweka/classifiers/Classifier;Lweka/core/Instance;I)V\"", ",", "cls", ".", ...
Prints the classification to the buffer. :param cls: the classifier :type cls: Classifier :param inst: the test instance :type inst: Instance :param index: the 0-based index of the test instance :type index: int
[ "Prints", "the", "classification", "to", "the", "buffer", "." ]
python
train
snare/voltron
voltron/api.py
https://github.com/snare/voltron/blob/4ee3cbe6f7c1e38303f5dc6114c48b60217253c3/voltron/api.py#L236-L244
def from_json(self, data): """ Initialise an API message from a JSON representation. """ try: d = json.loads(data) except ValueError: raise InvalidMessageException() self.from_dict(d)
[ "def", "from_json", "(", "self", ",", "data", ")", ":", "try", ":", "d", "=", "json", ".", "loads", "(", "data", ")", "except", "ValueError", ":", "raise", "InvalidMessageException", "(", ")", "self", ".", "from_dict", "(", "d", ")" ]
Initialise an API message from a JSON representation.
[ "Initialise", "an", "API", "message", "from", "a", "JSON", "representation", "." ]
python
train
gwastro/pycbc
pycbc/workflow/core.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/workflow/core.py#L800-L825
def save_config(self, fname, output_dir, cp=None): """ Writes configuration file to disk and returns a pycbc.workflow.File instance for the configuration file. Parameters ----------- fname : string The filename of the configuration file written to disk. outpu...
[ "def", "save_config", "(", "self", ",", "fname", ",", "output_dir", ",", "cp", "=", "None", ")", ":", "cp", "=", "self", ".", "cp", "if", "cp", "is", "None", "else", "cp", "ini_file_path", "=", "os", ".", "path", ".", "join", "(", "output_dir", ","...
Writes configuration file to disk and returns a pycbc.workflow.File instance for the configuration file. Parameters ----------- fname : string The filename of the configuration file written to disk. output_dir : string The directory where the file is writ...
[ "Writes", "configuration", "file", "to", "disk", "and", "returns", "a", "pycbc", ".", "workflow", ".", "File", "instance", "for", "the", "configuration", "file", "." ]
python
train
yhat/pandasql
pandasql/sqldf.py
https://github.com/yhat/pandasql/blob/e799c6f53be9653e8998a25adb5e2f1643442699/pandasql/sqldf.py#L110-L117
def extract_table_names(query): """ Extract table names from an SQL query. """ # a good old fashioned regex. turns out this worked better than actually parsing the code tables_blocks = re.findall(r'(?:FROM|JOIN)\s+(\w+(?:\s*,\s*\w+)*)', query, re.IGNORECASE) tables = [tbl for block in tabl...
[ "def", "extract_table_names", "(", "query", ")", ":", "# a good old fashioned regex. turns out this worked better than actually parsing the code", "tables_blocks", "=", "re", ".", "findall", "(", "r'(?:FROM|JOIN)\\s+(\\w+(?:\\s*,\\s*\\w+)*)'", ",", "query", ",", "re", ".", "IGN...
Extract table names from an SQL query.
[ "Extract", "table", "names", "from", "an", "SQL", "query", "." ]
python
train
Microsoft/azure-devops-python-api
azure-devops/azure/devops/v5_0/security/security_client.py
https://github.com/Microsoft/azure-devops-python-api/blob/4777ffda2f5052fabbaddb2abe9cb434e0cf1aa8/azure-devops/azure/devops/v5_0/security/security_client.py#L98-L119
def remove_access_control_lists(self, security_namespace_id, tokens=None, recurse=None): """RemoveAccessControlLists. Remove access control lists under the specfied security namespace. :param str security_namespace_id: Security namespace identifier. :param str tokens: One or more comma-s...
[ "def", "remove_access_control_lists", "(", "self", ",", "security_namespace_id", ",", "tokens", "=", "None", ",", "recurse", "=", "None", ")", ":", "route_values", "=", "{", "}", "if", "security_namespace_id", "is", "not", "None", ":", "route_values", "[", "'s...
RemoveAccessControlLists. Remove access control lists under the specfied security namespace. :param str security_namespace_id: Security namespace identifier. :param str tokens: One or more comma-separated security tokens :param bool recurse: If true and this is a hierarchical namespace, ...
[ "RemoveAccessControlLists", ".", "Remove", "access", "control", "lists", "under", "the", "specfied", "security", "namespace", ".", ":", "param", "str", "security_namespace_id", ":", "Security", "namespace", "identifier", ".", ":", "param", "str", "tokens", ":", "O...
python
train
boriel/zxbasic
zxbparser.py
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbparser.py#L1948-L1960
def p_return(p): """ statement : RETURN """ if not FUNCTION_LEVEL: # At less one level, otherwise, this return is from a GOSUB p[0] = make_sentence('RETURN') return if FUNCTION_LEVEL[-1].kind != KIND.sub: syntax_error(p.lineno(1), 'Syntax Error: Functions must RETURN a value, o...
[ "def", "p_return", "(", "p", ")", ":", "if", "not", "FUNCTION_LEVEL", ":", "# At less one level, otherwise, this return is from a GOSUB", "p", "[", "0", "]", "=", "make_sentence", "(", "'RETURN'", ")", "return", "if", "FUNCTION_LEVEL", "[", "-", "1", "]", ".", ...
statement : RETURN
[ "statement", ":", "RETURN" ]
python
train
jstitch/MambuPy
MambuPy/mambuutil.py
https://github.com/jstitch/MambuPy/blob/2af98cc12e7ed5ec183b3e97644e880e70b79ee8/MambuPy/mambuutil.py#L831-L959
def backup_db(callback, bool_func, output_fname, *args, **kwargs): """Backup Mambu Database via REST API. Makes two calls to Mambu API: - a POST to request a backup to be made - a GET, once the backup is ready, to download the latest backup * callback is a string to a callback URL Mambu will int...
[ "def", "backup_db", "(", "callback", ",", "bool_func", ",", "output_fname", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "from", "datetime", "import", "datetime", "try", ":", "verbose", "=", "kwargs", "[", "'verbose'", "]", "except", "KeyError", ...
Backup Mambu Database via REST API. Makes two calls to Mambu API: - a POST to request a backup to be made - a GET, once the backup is ready, to download the latest backup * callback is a string to a callback URL Mambu will internally call when the backup is ready to download. You should have a...
[ "Backup", "Mambu", "Database", "via", "REST", "API", "." ]
python
train
petrjasek/eve-elastic
eve_elastic/elastic.py
https://github.com/petrjasek/eve-elastic/blob/f146f31b348d22ac5559cf78717b3bb02efcb2d7/eve_elastic/elastic.py#L418-L429
def get_index_by_alias(self, alias): """Get index name for given alias. If there is no alias assume it's an index. :param alias: alias name """ try: info = self.es.indices.get_alias(name=alias) return next(iter(info.keys())) except elasticsearch....
[ "def", "get_index_by_alias", "(", "self", ",", "alias", ")", ":", "try", ":", "info", "=", "self", ".", "es", ".", "indices", ".", "get_alias", "(", "name", "=", "alias", ")", "return", "next", "(", "iter", "(", "info", ".", "keys", "(", ")", ")", ...
Get index name for given alias. If there is no alias assume it's an index. :param alias: alias name
[ "Get", "index", "name", "for", "given", "alias", "." ]
python
train
klahnakoski/pyLibrary
jx_base/query.py
https://github.com/klahnakoski/pyLibrary/blob/fa2dcbc48fda8d26999baef400e9a98149e0b982/jx_base/query.py#L373-L421
def _normalize_select_no_context(select, schema=None): """ SAME NORMALIZE, BUT NO SOURCE OF COLUMNS """ if not _Column: _late_import() if is_text(select): select = Data(value=select) else: select = wrap(select) output = select.copy() if not select.value: ...
[ "def", "_normalize_select_no_context", "(", "select", ",", "schema", "=", "None", ")", ":", "if", "not", "_Column", ":", "_late_import", "(", ")", "if", "is_text", "(", "select", ")", ":", "select", "=", "Data", "(", "value", "=", "select", ")", "else", ...
SAME NORMALIZE, BUT NO SOURCE OF COLUMNS
[ "SAME", "NORMALIZE", "BUT", "NO", "SOURCE", "OF", "COLUMNS" ]
python
train
Capitains/MyCapytain
MyCapytain/resources/texts/local/capitains/cts.py
https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/texts/local/capitains/cts.py#L349-L361
def childIds(self): """ Children of the passage :rtype: None, CtsReference :returns: Dictionary of chidren, where key are subreferences """ if self.depth >= len(self.citation.root): return [] elif self._children is not None: return self._children ...
[ "def", "childIds", "(", "self", ")", ":", "if", "self", ".", "depth", ">=", "len", "(", "self", ".", "citation", ".", "root", ")", ":", "return", "[", "]", "elif", "self", ".", "_children", "is", "not", "None", ":", "return", "self", ".", "_childre...
Children of the passage :rtype: None, CtsReference :returns: Dictionary of chidren, where key are subreferences
[ "Children", "of", "the", "passage" ]
python
train
openthread/openthread
tools/harness-thci/OpenThread_WpanCtl.py
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L995-L1027
def setNetworkKey(self, key): """set Thread Network master key Args: key: Thread Network master key used in secure the MLE/802.15.4 packet Returns: True: successful to set the Thread Network master key False: fail to set the Thread Network master key ...
[ "def", "setNetworkKey", "(", "self", ",", "key", ")", ":", "masterKey", "=", "''", "print", "'%s call setNetworkKey'", "%", "self", ".", "port", "try", ":", "if", "not", "isinstance", "(", "key", ",", "str", ")", ":", "masterKey", "=", "self", ".", "__...
set Thread Network master key Args: key: Thread Network master key used in secure the MLE/802.15.4 packet Returns: True: successful to set the Thread Network master key False: fail to set the Thread Network master key
[ "set", "Thread", "Network", "master", "key" ]
python
train
mozilla-b2g/fxos-certsuite
mcts/securitysuite/ssl.py
https://github.com/mozilla-b2g/fxos-certsuite/blob/152a76c7c4c9d908524cf6e6fc25a498058f363d/mcts/securitysuite/ssl.py#L308-L353
def run(cls, version=None): """ Test runner method; is called by parent class defined in suite.py. :param version: B2G version string to test against :return: bool PASS/FAIL status """ try: dumper = certdump() versions = dumper.nssversion_via_mari...
[ "def", "run", "(", "cls", ",", "version", "=", "None", ")", ":", "try", ":", "dumper", "=", "certdump", "(", ")", "versions", "=", "dumper", ".", "nssversion_via_marionette", "(", ")", "except", "Exception", "as", "e", ":", "# TODO: too broad exception", "...
Test runner method; is called by parent class defined in suite.py. :param version: B2G version string to test against :return: bool PASS/FAIL status
[ "Test", "runner", "method", ";", "is", "called", "by", "parent", "class", "defined", "in", "suite", ".", "py", ".", ":", "param", "version", ":", "B2G", "version", "string", "to", "test", "against", ":", "return", ":", "bool", "PASS", "/", "FAIL", "sta...
python
train
elastic/elasticsearch-py
elasticsearch/client/cluster.py
https://github.com/elastic/elasticsearch-py/blob/2aab285c8f506f3863cbdaba3c90a685c510ba00/elasticsearch/client/cluster.py#L53-L77
def state(self, metric=None, index=None, params=None): """ Get a comprehensive state information of the whole cluster. `<http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-state.html>`_ :arg metric: Limit the information returned to the specified metrics :arg...
[ "def", "state", "(", "self", ",", "metric", "=", "None", ",", "index", "=", "None", ",", "params", "=", "None", ")", ":", "if", "index", "and", "not", "metric", ":", "metric", "=", "'_all'", "return", "self", ".", "transport", ".", "perform_request", ...
Get a comprehensive state information of the whole cluster. `<http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-state.html>`_ :arg metric: Limit the information returned to the specified metrics :arg index: A comma-separated list of index names; use `_all` or empty ...
[ "Get", "a", "comprehensive", "state", "information", "of", "the", "whole", "cluster", ".", "<http", ":", "//", "www", ".", "elastic", ".", "co", "/", "guide", "/", "en", "/", "elasticsearch", "/", "reference", "/", "current", "/", "cluster", "-", "state"...
python
train
scikit-umfpack/scikit-umfpack
scikits/umfpack/umfpack.py
https://github.com/scikit-umfpack/scikit-umfpack/blob/a2102ef92f4dd060138e72bb5d7c444f8ec49cbc/scikits/umfpack/umfpack.py#L532-L577
def numeric(self, mtx): """ Perform numeric object (LU decomposition) computation using the symbolic decomposition. The symbolic decomposition is (re)computed if necessary. """ self.free_numeric() if self._symbolic is None: self.symbolic(mtx) ...
[ "def", "numeric", "(", "self", ",", "mtx", ")", ":", "self", ".", "free_numeric", "(", ")", "if", "self", ".", "_symbolic", "is", "None", ":", "self", ".", "symbolic", "(", "mtx", ")", "indx", "=", "self", ".", "_getIndx", "(", "mtx", ")", "failCou...
Perform numeric object (LU decomposition) computation using the symbolic decomposition. The symbolic decomposition is (re)computed if necessary.
[ "Perform", "numeric", "object", "(", "LU", "decomposition", ")", "computation", "using", "the", "symbolic", "decomposition", ".", "The", "symbolic", "decomposition", "is", "(", "re", ")", "computed", "if", "necessary", "." ]
python
train
pivotal-energy-solutions/django-datatable-view
datatableview/columns.py
https://github.com/pivotal-energy-solutions/django-datatable-view/blob/00b77a9b5051c34e258c51b06c020e92edf15034/datatableview/columns.py#L562-L570
def _get_flat_db_sources(self, model): """ Return a flattened representation of the individual ``sources`` lists. """ sources = [] for source in self.sources: for sub_source in self.expand_source(source): target_field = self.resolve_source(model, sub_source) ...
[ "def", "_get_flat_db_sources", "(", "self", ",", "model", ")", ":", "sources", "=", "[", "]", "for", "source", "in", "self", ".", "sources", ":", "for", "sub_source", "in", "self", ".", "expand_source", "(", "source", ")", ":", "target_field", "=", "self...
Return a flattened representation of the individual ``sources`` lists.
[ "Return", "a", "flattened", "representation", "of", "the", "individual", "sources", "lists", "." ]
python
train
openvax/mhctools
mhctools/base_predictor.py
https://github.com/openvax/mhctools/blob/b329b4dccd60fae41296816b8cbfe15d6ca07e67/mhctools/base_predictor.py#L151-L176
def _check_peptide_inputs(self, peptides): """ Check peptide sequences to make sure they are valid for this predictor. """ require_iterable_of(peptides, string_types) check_X = not self.allow_X_in_peptides check_lower = not self.allow_lowercase_in_peptides check_m...
[ "def", "_check_peptide_inputs", "(", "self", ",", "peptides", ")", ":", "require_iterable_of", "(", "peptides", ",", "string_types", ")", "check_X", "=", "not", "self", ".", "allow_X_in_peptides", "check_lower", "=", "not", "self", ".", "allow_lowercase_in_peptides"...
Check peptide sequences to make sure they are valid for this predictor.
[ "Check", "peptide", "sequences", "to", "make", "sure", "they", "are", "valid", "for", "this", "predictor", "." ]
python
valid
juicer/juicer
juicer/utils/__init__.py
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/__init__.py#L436-L449
def save_url_as(url, save_as): """ Download the file `url` and save it to the local disk as `save_as`. """ remote = requests.get(url, verify=False) if not remote.status_code == Constants.PULP_GET_OK: raise JuicerPulpError("A %s error occurred trying to get %s" % ...
[ "def", "save_url_as", "(", "url", ",", "save_as", ")", ":", "remote", "=", "requests", ".", "get", "(", "url", ",", "verify", "=", "False", ")", "if", "not", "remote", ".", "status_code", "==", "Constants", ".", "PULP_GET_OK", ":", "raise", "JuicerPulpEr...
Download the file `url` and save it to the local disk as `save_as`.
[ "Download", "the", "file", "url", "and", "save", "it", "to", "the", "local", "disk", "as", "save_as", "." ]
python
train
blockstack/blockstack-core
blockstack/lib/operations/__init__.py
https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/operations/__init__.py#L212-L223
def op_decanonicalize(op_name, canonical_op): """ Get the current representation of a parsed operation's data, given the canonical representation Meant for backwards-compatibility """ global DECANONICALIZE_METHODS if op_name not in DECANONICALIZE_METHODS: # no decanonicalization needed ...
[ "def", "op_decanonicalize", "(", "op_name", ",", "canonical_op", ")", ":", "global", "DECANONICALIZE_METHODS", "if", "op_name", "not", "in", "DECANONICALIZE_METHODS", ":", "# no decanonicalization needed", "return", "canonical_op", "else", ":", "return", "DECANONICALIZE_M...
Get the current representation of a parsed operation's data, given the canonical representation Meant for backwards-compatibility
[ "Get", "the", "current", "representation", "of", "a", "parsed", "operation", "s", "data", "given", "the", "canonical", "representation", "Meant", "for", "backwards", "-", "compatibility" ]
python
train
sony/nnabla
python/src/nnabla/utils/image_utils/pypng_utils.py
https://github.com/sony/nnabla/blob/aaf3d33b7cbb38f2a03aa754178ba8f7c8481320/python/src/nnabla/utils/image_utils/pypng_utils.py#L79-L122
def imread(path, grayscale=False, size=None, interpolate="bilinear", channel_first=False, as_uint16=False, num_channels=-1): """ Read image by pypng module. Args: path (str or 'file object'): File path or object to read. grayscale (bool): size (tupple of int): ...
[ "def", "imread", "(", "path", ",", "grayscale", "=", "False", ",", "size", "=", "None", ",", "interpolate", "=", "\"bilinear\"", ",", "channel_first", "=", "False", ",", "as_uint16", "=", "False", ",", "num_channels", "=", "-", "1", ")", ":", "_imread_be...
Read image by pypng module. Args: path (str or 'file object'): File path or object to read. grayscale (bool): size (tupple of int): (width, height). If None, output img shape depends on the files to read. channel_first (bool): This argument specif...
[ "Read", "image", "by", "pypng", "module", "." ]
python
train
ninuxorg/nodeshot
nodeshot/networking/connectors/models/device_connector.py
https://github.com/ninuxorg/nodeshot/blob/2466f0a55f522b2696026f196436ce7ba3f1e5c6/nodeshot/networking/connectors/models/device_connector.py#L131-L156
def _validate_config(self): """ ensure REQUIRED_CONFIG_KEYS are filled """ # exit if no backend specified if not self.backend: return # exit if no required config keys if len(self.REQUIRED_CONFIG_KEYS) < 1: return self.config = self.config or {} ...
[ "def", "_validate_config", "(", "self", ")", ":", "# exit if no backend specified", "if", "not", "self", ".", "backend", ":", "return", "# exit if no required config keys", "if", "len", "(", "self", ".", "REQUIRED_CONFIG_KEYS", ")", "<", "1", ":", "return", "self"...
ensure REQUIRED_CONFIG_KEYS are filled
[ "ensure", "REQUIRED_CONFIG_KEYS", "are", "filled" ]
python
train
frasertweedale/ledgertools
ltlib/ui.py
https://github.com/frasertweedale/ledgertools/blob/a695f8667d72253e5448693c12f0282d09902aaa/ltlib/ui.py#L102-L148
def filter_pastdate(string, default=None): """Coerce to a date not beyond the current date If only a day is given, assumes the current month if that day has passed or is the current day, otherwise assumes the previous month. If a day and month are given, but no year, assumes the current year if the...
[ "def", "filter_pastdate", "(", "string", ",", "default", "=", "None", ")", ":", "if", "not", "string", "and", "default", "is", "not", "None", ":", "return", "default", "today", "=", "datetime", ".", "date", ".", "today", "(", ")", "# split the string", "...
Coerce to a date not beyond the current date If only a day is given, assumes the current month if that day has passed or is the current day, otherwise assumes the previous month. If a day and month are given, but no year, assumes the current year if the given date has passed (or is today), otherwise th...
[ "Coerce", "to", "a", "date", "not", "beyond", "the", "current", "date" ]
python
train
pypa/pipenv
pipenv/patched/pipfile/api.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/pipfile/api.py#L176-L181
def lock(self): """Returns a JSON representation of the Pipfile.""" data = self.data data['_meta']['hash'] = {"sha256": self.hash} data['_meta']['pipfile-spec'] = 6 return json.dumps(data, indent=4, separators=(',', ': '))
[ "def", "lock", "(", "self", ")", ":", "data", "=", "self", ".", "data", "data", "[", "'_meta'", "]", "[", "'hash'", "]", "=", "{", "\"sha256\"", ":", "self", ".", "hash", "}", "data", "[", "'_meta'", "]", "[", "'pipfile-spec'", "]", "=", "6", "re...
Returns a JSON representation of the Pipfile.
[ "Returns", "a", "JSON", "representation", "of", "the", "Pipfile", "." ]
python
train
DLR-RM/RAFCON
source/rafcon/core/states/container_state.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/container_state.py#L1503-L1533
def get_inputs_for_state(self, state): """Retrieves all input data of a state. If several data flows are connected to an input port the most current data is used for the specific input port. :param state: the state of which the input data is determined :return: the input data of the tar...
[ "def", "get_inputs_for_state", "(", "self", ",", "state", ")", ":", "result_dict", "=", "{", "}", "tmp_dict", "=", "self", ".", "get_default_input_values_for_state", "(", "state", ")", "result_dict", ".", "update", "(", "tmp_dict", ")", "for", "input_port_key", ...
Retrieves all input data of a state. If several data flows are connected to an input port the most current data is used for the specific input port. :param state: the state of which the input data is determined :return: the input data of the target state
[ "Retrieves", "all", "input", "data", "of", "a", "state", ".", "If", "several", "data", "flows", "are", "connected", "to", "an", "input", "port", "the", "most", "current", "data", "is", "used", "for", "the", "specific", "input", "port", "." ]
python
train
cloud-custodian/cloud-custodian
c7n/policy.py
https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/c7n/policy.py#L426-L481
def run(self, event, lambda_context): """Run policy in push mode against given event. Lambda automatically generates cloud watch logs, and metrics for us, albeit with some deficienies, metrics no longer count against valid resources matches, but against execution. If metrics ex...
[ "def", "run", "(", "self", ",", "event", ",", "lambda_context", ")", ":", "from", "c7n", ".", "actions", "import", "EventAction", "mode", "=", "self", ".", "policy", ".", "data", ".", "get", "(", "'mode'", ",", "{", "}", ")", "if", "not", "bool", "...
Run policy in push mode against given event. Lambda automatically generates cloud watch logs, and metrics for us, albeit with some deficienies, metrics no longer count against valid resources matches, but against execution. If metrics execution option is enabled, custodian will generat...
[ "Run", "policy", "in", "push", "mode", "against", "given", "event", "." ]
python
train
Rapptz/discord.py
discord/ext/tasks/__init__.py
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/tasks/__init__.py#L218-L236
def after_loop(self, coro): """A function that also acts as a decorator to register a coroutine to be called after the loop finished running. Parameters ------------ coro: :term:`py:awaitable` The coroutine to register after the loop finishes. Raises ...
[ "def", "after_loop", "(", "self", ",", "coro", ")", ":", "if", "not", "(", "inspect", ".", "iscoroutinefunction", "(", "coro", ")", "or", "inspect", ".", "isawaitable", "(", "coro", ")", ")", ":", "raise", "TypeError", "(", "'Expected coroutine or awaitable,...
A function that also acts as a decorator to register a coroutine to be called after the loop finished running. Parameters ------------ coro: :term:`py:awaitable` The coroutine to register after the loop finishes. Raises ------- TypeError ...
[ "A", "function", "that", "also", "acts", "as", "a", "decorator", "to", "register", "a", "coroutine", "to", "be", "called", "after", "the", "loop", "finished", "running", "." ]
python
train
dacut/python-aws-sig
awssig/sigv4.py
https://github.com/dacut/python-aws-sig/blob/7f6054dca4b32e67ca3d39db31c1b4be5efe54bd/awssig/sigv4.py#L496-L532
def normalize_query_parameters(query_string): """ normalize_query_parameters(query_string) -> dict Converts a query string into a dictionary mapping parameter names to a list of the sorted values. This ensurses that the query string follows % encoding rules according to RFC 3986 and checks for dup...
[ "def", "normalize_query_parameters", "(", "query_string", ")", ":", "if", "query_string", "==", "\"\"", ":", "return", "{", "}", "components", "=", "query_string", ".", "split", "(", "\"&\"", ")", "result", "=", "{", "}", "for", "component", "in", "component...
normalize_query_parameters(query_string) -> dict Converts a query string into a dictionary mapping parameter names to a list of the sorted values. This ensurses that the query string follows % encoding rules according to RFC 3986 and checks for duplicate keys. A ValueError exception is raised if a pe...
[ "normalize_query_parameters", "(", "query_string", ")", "-", ">", "dict" ]
python
train
bpannier/simpletr64
simpletr64/actions/fritz.py
https://github.com/bpannier/simpletr64/blob/31081139f4e6c85084a56de1617df73927135466/simpletr64/actions/fritz.py#L161-L221
def getCallList(self, timeout=1): """Get the list of phone calls made Example of a phone call result: :: [{'Count': None, 'Name': None, 'CalledNumber': '030868709971', 'Numbertype': 'sip', 'Duration': '0:01', 'Caller': '015155255399', 'Called': 'SIP: 030868729971', 'Da...
[ "def", "getCallList", "(", "self", ",", "timeout", "=", "1", ")", ":", "namespace", "=", "Fritz", ".", "getServiceType", "(", "\"getCallList\"", ")", "uri", "=", "self", ".", "getControlURL", "(", "namespace", ")", "results", "=", "self", ".", "execute", ...
Get the list of phone calls made Example of a phone call result: :: [{'Count': None, 'Name': None, 'CalledNumber': '030868709971', 'Numbertype': 'sip', 'Duration': '0:01', 'Caller': '015155255399', 'Called': 'SIP: 030868729971', 'Date': '02.01.14 13:14', 'Device': ...
[ "Get", "the", "list", "of", "phone", "calls", "made" ]
python
train
markokr/rarfile
dumprar.py
https://github.com/markokr/rarfile/blob/2704344e8d7a1658c96c8ed8f449d7ba01bedea3/dumprar.py#L223-L266
def show_item_v3(h): """Show any RAR3 record. """ st = rar3_type(h.type) xprint("%s: hdrlen=%d datlen=%d", st, h.header_size, h.add_size) if h.type in (rf.RAR_BLOCK_FILE, rf.RAR_BLOCK_SUB): if h.host_os == rf.RAR_OS_UNIX: s_mode = "0%o" % h.mode else: s_mode =...
[ "def", "show_item_v3", "(", "h", ")", ":", "st", "=", "rar3_type", "(", "h", ".", "type", ")", "xprint", "(", "\"%s: hdrlen=%d datlen=%d\"", ",", "st", ",", "h", ".", "header_size", ",", "h", ".", "add_size", ")", "if", "h", ".", "type", "in", "(", ...
Show any RAR3 record.
[ "Show", "any", "RAR3", "record", "." ]
python
train
avelino/bottle-auth
bottle_auth/core/escape.py
https://github.com/avelino/bottle-auth/blob/db07e526864aeac05ee68444b47e5db29540ce18/bottle_auth/core/escape.py#L188-L200
def to_basestring(value): """Converts a string argument to a subclass of basestring. In python2, byte and unicode strings are mostly interchangeable, so functions that deal with a user-supplied argument in combination with ascii string constants can use either and should return the type the user su...
[ "def", "to_basestring", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "_BASESTRING_TYPES", ")", ":", "return", "value", "assert", "isinstance", "(", "value", ",", "bytes", ")", "return", "value", ".", "decode", "(", "\"utf-8\"", ")" ]
Converts a string argument to a subclass of basestring. In python2, byte and unicode strings are mostly interchangeable, so functions that deal with a user-supplied argument in combination with ascii string constants can use either and should return the type the user supplied. In python3, the two type...
[ "Converts", "a", "string", "argument", "to", "a", "subclass", "of", "basestring", "." ]
python
test
ofa/django-bouncy
django_bouncy/utils.py
https://github.com/ofa/django-bouncy/blob/a386dfa8c4ce59bd18978a3537c03cd6ad07bf06/django_bouncy/utils.py#L117-L150
def approve_subscription(data): """ Function to approve a SNS subscription with Amazon We don't do a ton of verification here, past making sure that the endpoint we're told to go to to verify the subscription is on the correct host """ url = data['SubscribeURL'] domain = urlparse(url).netl...
[ "def", "approve_subscription", "(", "data", ")", ":", "url", "=", "data", "[", "'SubscribeURL'", "]", "domain", "=", "urlparse", "(", "url", ")", ".", "netloc", "pattern", "=", "getattr", "(", "settings", ",", "'BOUNCY_SUBSCRIBE_DOMAIN_REGEX'", ",", "r\"sns.[a...
Function to approve a SNS subscription with Amazon We don't do a ton of verification here, past making sure that the endpoint we're told to go to to verify the subscription is on the correct host
[ "Function", "to", "approve", "a", "SNS", "subscription", "with", "Amazon" ]
python
train
jasonrbriggs/stomp.py
stomp/adapter/multicast.py
https://github.com/jasonrbriggs/stomp.py/blob/643843c5fbf25fd24339dd0e69a9411c3d8b94c7/stomp/adapter/multicast.py#L62-L86
def process_frame(self, f, frame_str): """ :param Frame f: Frame object :param bytes frame_str: Raw frame content """ frame_type = f.cmd.lower() if frame_type in ['disconnect']: return if frame_type == 'send': frame_type = 'message' ...
[ "def", "process_frame", "(", "self", ",", "f", ",", "frame_str", ")", ":", "frame_type", "=", "f", ".", "cmd", ".", "lower", "(", ")", "if", "frame_type", "in", "[", "'disconnect'", "]", ":", "return", "if", "frame_type", "==", "'send'", ":", "frame_ty...
:param Frame f: Frame object :param bytes frame_str: Raw frame content
[ ":", "param", "Frame", "f", ":", "Frame", "object", ":", "param", "bytes", "frame_str", ":", "Raw", "frame", "content" ]
python
train
h2oai/h2o-3
h2o-py/h2o/estimators/estimator_base.py
https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/estimators/estimator_base.py#L79-L86
def join(self): """Wait until job's completion.""" self._future = False self._job.poll() model_key = self._job.dest_key self._job = None model_json = h2o.api("GET /%d/Models/%s" % (self._rest_version, model_key))["models"][0] self._resolve_model(model_key, model_j...
[ "def", "join", "(", "self", ")", ":", "self", ".", "_future", "=", "False", "self", ".", "_job", ".", "poll", "(", ")", "model_key", "=", "self", ".", "_job", ".", "dest_key", "self", ".", "_job", "=", "None", "model_json", "=", "h2o", ".", "api", ...
Wait until job's completion.
[ "Wait", "until", "job", "s", "completion", "." ]
python
test
CZ-NIC/yangson
yangson/schemadata.py
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemadata.py#L449-L457
def derived_from(self, identity: QualName) -> MutableSet[QualName]: """Return list of identities transitively derived from `identity`.""" try: res = self.identity_adjs[identity].derivs except KeyError: return set() for id in res.copy(): res |= self.der...
[ "def", "derived_from", "(", "self", ",", "identity", ":", "QualName", ")", "->", "MutableSet", "[", "QualName", "]", ":", "try", ":", "res", "=", "self", ".", "identity_adjs", "[", "identity", "]", ".", "derivs", "except", "KeyError", ":", "return", "set...
Return list of identities transitively derived from `identity`.
[ "Return", "list", "of", "identities", "transitively", "derived", "from", "identity", "." ]
python
train
mitsei/dlkit
dlkit/runtime/impls/proxy/managers.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/runtime/impls/proxy/managers.py#L93-L114
def get_proxy_session(self): """Gets a ``ProxySession`` which is responsible for acquiring authentication credentials on behalf of a service client. :return: a proxy session for this service :rtype: ``osid.proxy.ProxySession`` :raise: ``OperationFailed`` -- unable to complete request ...
[ "def", "get_proxy_session", "(", "self", ")", ":", "if", "not", "self", ".", "supports_proxy", "(", ")", ":", "raise", "Unimplemented", "(", ")", "try", ":", "from", ".", "import", "sessions", "except", "ImportError", ":", "raise", "# OperationFailed()", "tr...
Gets a ``ProxySession`` which is responsible for acquiring authentication credentials on behalf of a service client. :return: a proxy session for this service :rtype: ``osid.proxy.ProxySession`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``Unimplemented`` -- ``sup...
[ "Gets", "a", "ProxySession", "which", "is", "responsible", "for", "acquiring", "authentication", "credentials", "on", "behalf", "of", "a", "service", "client", "." ]
python
train
roycoding/slots
slots/slots.py
https://github.com/roycoding/slots/blob/1ed9b203fa02002c09b9dad73e2a97c04a45ef20/slots/slots.py#L345-L358
def regret(self): ''' Calculate expected regret, where expected regret is maximum optimal reward - sum of collected rewards, i.e. expected regret = T*max_k(mean_k) - sum_(t=1-->T) (reward_t) Returns ------- float ''' return (sum(self.pulls)*np.m...
[ "def", "regret", "(", "self", ")", ":", "return", "(", "sum", "(", "self", ".", "pulls", ")", "*", "np", ".", "max", "(", "np", ".", "nan_to_num", "(", "self", ".", "wins", "/", "self", ".", "pulls", ")", ")", "-", "sum", "(", "self", ".", "w...
Calculate expected regret, where expected regret is maximum optimal reward - sum of collected rewards, i.e. expected regret = T*max_k(mean_k) - sum_(t=1-->T) (reward_t) Returns ------- float
[ "Calculate", "expected", "regret", "where", "expected", "regret", "is", "maximum", "optimal", "reward", "-", "sum", "of", "collected", "rewards", "i", ".", "e", "." ]
python
train
spulec/moto
moto/kms/responses.py
https://github.com/spulec/moto/blob/4a286c4bc288933bb023396e2784a6fdbb966bc9/moto/kms/responses.py#L225-L233
def encrypt(self): """ We perform no encryption, we just encode the value as base64 and then decode it in decrypt(). """ value = self.parameters.get("Plaintext") if isinstance(value, six.text_type): value = value.encode('utf-8') return json.dumps({"Cip...
[ "def", "encrypt", "(", "self", ")", ":", "value", "=", "self", ".", "parameters", ".", "get", "(", "\"Plaintext\"", ")", "if", "isinstance", "(", "value", ",", "six", ".", "text_type", ")", ":", "value", "=", "value", ".", "encode", "(", "'utf-8'", "...
We perform no encryption, we just encode the value as base64 and then decode it in decrypt().
[ "We", "perform", "no", "encryption", "we", "just", "encode", "the", "value", "as", "base64", "and", "then", "decode", "it", "in", "decrypt", "()", "." ]
python
train
rwl/godot
godot/dot_data_parser.py
https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/dot_data_parser.py#L51-L66
def _proc_node_stmt(self, toks): """ Return (ADD_NODE, node_name, options) """ opts = toks[1] dummy_node = Node("dummy") # Coerce attribute types. for key, value in opts.iteritems(): trait = dummy_node.trait(key) if trait is not None: ...
[ "def", "_proc_node_stmt", "(", "self", ",", "toks", ")", ":", "opts", "=", "toks", "[", "1", "]", "dummy_node", "=", "Node", "(", "\"dummy\"", ")", "# Coerce attribute types.", "for", "key", ",", "value", "in", "opts", ".", "iteritems", "(", ")", ":", ...
Return (ADD_NODE, node_name, options)
[ "Return", "(", "ADD_NODE", "node_name", "options", ")" ]
python
test
cariad/py-wpconfigr
wpconfigr/__main__.py
https://github.com/cariad/py-wpconfigr/blob/8f25bb849b72ce95957566544a2be8445316c818/wpconfigr/__main__.py#L12-L76
def run_from_cli(): """ Perform an update instigated from a CLI. """ arg_parser = argparse.ArgumentParser( description='Read and write properties in a wp-config.php file. ' 'Include a --value argument to set the value, omit it to ' 'read the value of the ...
[ "def", "run_from_cli", "(", ")", ":", "arg_parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Read and write properties in a wp-config.php file. '", "'Include a --value argument to set the value, omit it to '", "'read the value of the specified key.'", ",", ...
Perform an update instigated from a CLI.
[ "Perform", "an", "update", "instigated", "from", "a", "CLI", "." ]
python
train
ArchiveTeam/wpull
wpull/util.py
https://github.com/ArchiveTeam/wpull/blob/ddf051aa3322479325ba20aa778cb2cb97606bf5/wpull/util.py#L64-L73
def seek_file_end(file): '''Seek to the end of the file.''' try: file.seek(0, 2) except ValueError: # gzip files don't support seek from end while True: data = file.read(4096) if not data: break
[ "def", "seek_file_end", "(", "file", ")", ":", "try", ":", "file", ".", "seek", "(", "0", ",", "2", ")", "except", "ValueError", ":", "# gzip files don't support seek from end", "while", "True", ":", "data", "=", "file", ".", "read", "(", "4096", ")", "i...
Seek to the end of the file.
[ "Seek", "to", "the", "end", "of", "the", "file", "." ]
python
train
DataDog/integrations-core
sqlserver/datadog_checks/sqlserver/sqlserver.py
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/sqlserver/datadog_checks/sqlserver/sqlserver.py#L566-L584
def proc_check_guard(self, instance, sql): """ check to see if the guard SQL returns a single column containing 0 or 1 We return true if 1, else False """ self.open_db_connections(instance, self.PROC_GUARD_DB_KEY) cursor = self.get_cursor(instance, self.PROC_GUARD_DB_KEY)...
[ "def", "proc_check_guard", "(", "self", ",", "instance", ",", "sql", ")", ":", "self", ".", "open_db_connections", "(", "instance", ",", "self", ".", "PROC_GUARD_DB_KEY", ")", "cursor", "=", "self", ".", "get_cursor", "(", "instance", ",", "self", ".", "PR...
check to see if the guard SQL returns a single column containing 0 or 1 We return true if 1, else False
[ "check", "to", "see", "if", "the", "guard", "SQL", "returns", "a", "single", "column", "containing", "0", "or", "1", "We", "return", "true", "if", "1", "else", "False" ]
python
train
cgarciae/dataget
dataget/__coconut__.py
https://github.com/cgarciae/dataget/blob/04d3d9c68ebdcbed103605731a1be0f26e1c36fa/dataget/__coconut__.py#L244-L246
def index(self, elem): """Find the index of elem in the reversed iterator.""" return _coconut.len(self._iter) - self._iter.index(elem) - 1
[ "def", "index", "(", "self", ",", "elem", ")", ":", "return", "_coconut", ".", "len", "(", "self", ".", "_iter", ")", "-", "self", ".", "_iter", ".", "index", "(", "elem", ")", "-", "1" ]
Find the index of elem in the reversed iterator.
[ "Find", "the", "index", "of", "elem", "in", "the", "reversed", "iterator", "." ]
python
train
zblz/naima
naima/radiative.py
https://github.com/zblz/naima/blob/d6a6781d73bf58fd8269e8b0e3b70be22723cd5b/naima/radiative.py#L945-L958
def _F(x, gam): """ Eqs. A6, A7 of Baring et al. (1999) """ beta = np.sqrt(1 - gam ** -2) B = 1 + 0.5 * (gam ** 2 - 1) C = 10 * x * gam * beta * (2 + gam * beta) C /= 1 + x ** 2 * (gam ** 2 - 1) F_1 = (17 - 3 * x ** 2 / (2 - x) ** 2 - C) * np.sqrt(1 - x) ...
[ "def", "_F", "(", "x", ",", "gam", ")", ":", "beta", "=", "np", ".", "sqrt", "(", "1", "-", "gam", "**", "-", "2", ")", "B", "=", "1", "+", "0.5", "*", "(", "gam", "**", "2", "-", "1", ")", "C", "=", "10", "*", "x", "*", "gam", "*", ...
Eqs. A6, A7 of Baring et al. (1999)
[ "Eqs", ".", "A6", "A7", "of", "Baring", "et", "al", ".", "(", "1999", ")" ]
python
train
ThreatConnect-Inc/tcex
tcex/tcex_bin_package.py
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_package.py#L110-L132
def bundle_apps(self, bundle_name, bundle_apps): """Bundle multiple Job or Playbook Apps (.tcx files) into a single zip file. Args: bundle_name (str): The output name of the bundle zip file. bundle_apps (list): A list of Apps to include in the bundle. """ bundle_...
[ "def", "bundle_apps", "(", "self", ",", "bundle_name", ",", "bundle_apps", ")", ":", "bundle_file", "=", "os", ".", "path", ".", "join", "(", "self", ".", "app_path", ",", "self", ".", "args", ".", "outdir", ",", "'{}-bundle.zip'", ".", "format", "(", ...
Bundle multiple Job or Playbook Apps (.tcx files) into a single zip file. Args: bundle_name (str): The output name of the bundle zip file. bundle_apps (list): A list of Apps to include in the bundle.
[ "Bundle", "multiple", "Job", "or", "Playbook", "Apps", "(", ".", "tcx", "files", ")", "into", "a", "single", "zip", "file", "." ]
python
train
DistrictDataLabs/yellowbrick
yellowbrick/utils/types.py
https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/utils/types.py#L202-L214
def is_structured_array(obj): """ Returns True if the given object is a Numpy Structured Array. Parameters ---------- obj: instance The object to test whether or not is a Numpy Structured Array. """ if isinstance(obj, np.ndarray) and hasattr(obj, 'dtype'): if obj.dtype.names...
[ "def", "is_structured_array", "(", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "np", ".", "ndarray", ")", "and", "hasattr", "(", "obj", ",", "'dtype'", ")", ":", "if", "obj", ".", "dtype", ".", "names", "is", "not", "None", ":", "return", ...
Returns True if the given object is a Numpy Structured Array. Parameters ---------- obj: instance The object to test whether or not is a Numpy Structured Array.
[ "Returns", "True", "if", "the", "given", "object", "is", "a", "Numpy", "Structured", "Array", "." ]
python
train
NikolayDachev/jadm
lib/paramiko-1.14.1/paramiko/channel.py
https://github.com/NikolayDachev/jadm/blob/12bb550445edfcd87506f7cba7a6a35d413c5511/lib/paramiko-1.14.1/paramiko/channel.py#L700-L734
def send_stderr(self, s): """ Send data to the channel on the "stderr" stream. This is normally only used by servers to send output from shell commands -- clients won't use this. Returns the number of bytes sent, or 0 if the channel stream is closed. Applications are responsib...
[ "def", "send_stderr", "(", "self", ",", "s", ")", ":", "size", "=", "len", "(", "s", ")", "self", ".", "lock", ".", "acquire", "(", ")", "try", ":", "size", "=", "self", ".", "_wait_for_send_window", "(", "size", ")", "if", "size", "==", "0", ":"...
Send data to the channel on the "stderr" stream. This is normally only used by servers to send output from shell commands -- clients won't use this. Returns the number of bytes sent, or 0 if the channel stream is closed. Applications are responsible for checking that all data has been...
[ "Send", "data", "to", "the", "channel", "on", "the", "stderr", "stream", ".", "This", "is", "normally", "only", "used", "by", "servers", "to", "send", "output", "from", "shell", "commands", "--", "clients", "won", "t", "use", "this", ".", "Returns", "the...
python
train
20tab/twentytab-treeeditor
treeeditor/admin.py
https://github.com/20tab/twentytab-treeeditor/blob/f89d459b1348961880cd488df95690e68529f96b/treeeditor/admin.py#L96-L115
def ajax_editable_boolean(attr, short_description): """ Convenience function: Assign the return value of this method to a variable of your ModelAdmin class and put the variable name into list_display. Example:: class MyTreeEditor(TreeEditor): list_display = ('__unicode__', 'active_...
[ "def", "ajax_editable_boolean", "(", "attr", ",", "short_description", ")", ":", "def", "_fn", "(", "self", ",", "item", ")", ":", "return", "ajax_editable_boolean_cell", "(", "item", ",", "attr", ")", "_fn", ".", "allow_tags", "=", "True", "_fn", ".", "sh...
Convenience function: Assign the return value of this method to a variable of your ModelAdmin class and put the variable name into list_display. Example:: class MyTreeEditor(TreeEditor): list_display = ('__unicode__', 'active_toggle') active_toggle = ajax_editable_boolean('act...
[ "Convenience", "function", ":", "Assign", "the", "return", "value", "of", "this", "method", "to", "a", "variable", "of", "your", "ModelAdmin", "class", "and", "put", "the", "variable", "name", "into", "list_display", "." ]
python
test
Kitware/tangelo
tangelo/tangelo/pkgdata/plugin/watch/python/__init__.py
https://github.com/Kitware/tangelo/blob/470034ee9b3d7a01becc1ce5fddc7adc1d5263ef/tangelo/tangelo/pkgdata/plugin/watch/python/__init__.py#L237-L282
def watch_module_cache_get(cache, module): """ When we ask to fetch a module with optional config file, check time stamps and dependencies to determine if it should be reloaded or not. :param cache: the cache object that stores whether to check for config files and which files have be...
[ "def", "watch_module_cache_get", "(", "cache", ",", "module", ")", ":", "imp", ".", "acquire_lock", "(", ")", "try", ":", "if", "not", "hasattr", "(", "cache", ",", "\"timestamps\"", ")", ":", "cache", ".", "timestamps", "=", "{", "}", "mtime", "=", "o...
When we ask to fetch a module with optional config file, check time stamps and dependencies to determine if it should be reloaded or not. :param cache: the cache object that stores whether to check for config files and which files have been loaded. :param module: the path of the module to...
[ "When", "we", "ask", "to", "fetch", "a", "module", "with", "optional", "config", "file", "check", "time", "stamps", "and", "dependencies", "to", "determine", "if", "it", "should", "be", "reloaded", "or", "not", "." ]
python
train
gwastro/pycbc
pycbc/inference/models/gaussian_noise.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/inference/models/gaussian_noise.py#L557-L587
def low_frequency_cutoff_from_config(cp): """Gets the low frequency cutoff from the given config file. This looks for ``low-frequency-cutoff`` in the ``[model]`` section and casts it to float. If none is found, or the casting to float fails, an error is raised. Parameters ---------- cp : W...
[ "def", "low_frequency_cutoff_from_config", "(", "cp", ")", ":", "try", ":", "low_frequency_cutoff", "=", "float", "(", "cp", ".", "get", "(", "'model'", ",", "'low-frequency-cutoff'", ")", ")", "except", "(", "NoOptionError", ",", "NoSectionError", ")", "as", ...
Gets the low frequency cutoff from the given config file. This looks for ``low-frequency-cutoff`` in the ``[model]`` section and casts it to float. If none is found, or the casting to float fails, an error is raised. Parameters ---------- cp : WorkflowConfigParser Config file parser to...
[ "Gets", "the", "low", "frequency", "cutoff", "from", "the", "given", "config", "file", "." ]
python
train
Erotemic/utool
utool/experimental/euler_tour_tree_avl.py
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/experimental/euler_tour_tree_avl.py#L382-L393
def _traverse_nodes(self): """ Debugging function (exposes cython nodes as dummy nodes) """ node = self.root stack = [] while stack or node is not None: if node is not None: stack.append(node) node = node.left else: ...
[ "def", "_traverse_nodes", "(", "self", ")", ":", "node", "=", "self", ".", "root", "stack", "=", "[", "]", "while", "stack", "or", "node", "is", "not", "None", ":", "if", "node", "is", "not", "None", ":", "stack", ".", "append", "(", "node", ")", ...
Debugging function (exposes cython nodes as dummy nodes)
[ "Debugging", "function", "(", "exposes", "cython", "nodes", "as", "dummy", "nodes", ")" ]
python
train
HewlettPackard/python-hpOneView
hpOneView/resources/task_monitor.py
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/task_monitor.py#L70-L90
def wait_for_task(self, task, timeout=-1): """ Wait for task execution and return associated resource. Args: task: task dict timeout: timeout in seconds Returns: Associated resource when creating or updating; True when deleting. """ s...
[ "def", "wait_for_task", "(", "self", ",", "task", ",", "timeout", "=", "-", "1", ")", ":", "self", ".", "__wait_task_completion", "(", "task", ",", "timeout", ")", "task", "=", "self", ".", "get", "(", "task", ")", "logger", ".", "debug", "(", "\"Wai...
Wait for task execution and return associated resource. Args: task: task dict timeout: timeout in seconds Returns: Associated resource when creating or updating; True when deleting.
[ "Wait", "for", "task", "execution", "and", "return", "associated", "resource", "." ]
python
train
ldo/dbussy
dbussy.py
https://github.com/ldo/dbussy/blob/59e4fbe8b8111ceead884e50d1973901a0a2d240/dbussy.py#L1481-L1488
def get_version() : "returns the libdbus library version as a tuple of integers (major, minor, micro)." major = ct.c_int() minor = ct.c_int() micro = ct.c_int() dbus.dbus_get_version(ct.byref(major), ct.byref(minor), ct.byref(micro)) return \ (major.value, minor.value, micro.value)
[ "def", "get_version", "(", ")", ":", "major", "=", "ct", ".", "c_int", "(", ")", "minor", "=", "ct", ".", "c_int", "(", ")", "micro", "=", "ct", ".", "c_int", "(", ")", "dbus", ".", "dbus_get_version", "(", "ct", ".", "byref", "(", "major", ")", ...
returns the libdbus library version as a tuple of integers (major, minor, micro).
[ "returns", "the", "libdbus", "library", "version", "as", "a", "tuple", "of", "integers", "(", "major", "minor", "micro", ")", "." ]
python
train
westurner/pyrpo
pyrpo/pyrpo.py
https://github.com/westurner/pyrpo/blob/2a910af055dc405b761571a52ef87842397ddadf/pyrpo/pyrpo.py#L1905-L1933
def do_repo_report(repos, report='full', output=sys.stdout, *args, **kwargs): """ Do a repository report: call the report function for each Repository Args: repos (iterable): iterable of Repository instances report (string): report name output (writeable): output stream to print to ...
[ "def", "do_repo_report", "(", "repos", ",", "report", "=", "'full'", ",", "output", "=", "sys", ".", "stdout", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "for", "i", ",", "repo", "in", "enumerate", "(", "repos", ")", ":", "log", ".", "d...
Do a repository report: call the report function for each Repository Args: repos (iterable): iterable of Repository instances report (string): report name output (writeable): output stream to print to Yields: Repository subclass
[ "Do", "a", "repository", "report", ":", "call", "the", "report", "function", "for", "each", "Repository" ]
python
train
jbittel/django-mama-cas
mama_cas/models.py
https://github.com/jbittel/django-mama-cas/blob/03935d97442b46d8127ab9e1cd8deb96953fe156/mama_cas/models.py#L58-L66
def create_ticket_str(self, prefix=None): """ Generate a sufficiently opaque ticket string to ensure the ticket is not guessable. If a prefix is provided, prepend it to the string. """ if not prefix: prefix = self.model.TICKET_PREFIX return "%s-%d-%s" % (prefi...
[ "def", "create_ticket_str", "(", "self", ",", "prefix", "=", "None", ")", ":", "if", "not", "prefix", ":", "prefix", "=", "self", ".", "model", ".", "TICKET_PREFIX", "return", "\"%s-%d-%s\"", "%", "(", "prefix", ",", "int", "(", "time", ".", "time", "(...
Generate a sufficiently opaque ticket string to ensure the ticket is not guessable. If a prefix is provided, prepend it to the string.
[ "Generate", "a", "sufficiently", "opaque", "ticket", "string", "to", "ensure", "the", "ticket", "is", "not", "guessable", ".", "If", "a", "prefix", "is", "provided", "prepend", "it", "to", "the", "string", "." ]
python
train
ascribe/pyspool
spool/spoolverb.py
https://github.com/ascribe/pyspool/blob/f8b10df1e7d2ea7950dde433c1cb6d5225112f4f/spool/spoolverb.py#L72-L117
def from_verb(cls, verb): """ Constructs a :class:`Spoolverb` instance from the string representation of the given verb. Args: verb (str): representation of the verb e.g.: ``'ASCRIBESPOOL01LOAN12/150526150528'``. Can also be in binary format (...
[ "def", "from_verb", "(", "cls", ",", "verb", ")", ":", "pattern", "=", "r'^(?P<meta>[A-Z]+)(?P<version>\\d+)(?P<action>[A-Z]+)(?P<arg1>\\d+)?(\\/(?P<arg2>\\d+))?$'", "try", ":", "verb", "=", "verb", ".", "decode", "(", ")", "except", "AttributeError", ":", "pass", "ma...
Constructs a :class:`Spoolverb` instance from the string representation of the given verb. Args: verb (str): representation of the verb e.g.: ``'ASCRIBESPOOL01LOAN12/150526150528'``. Can also be in binary format (:obj:`bytes`): ``b'ASCRIBESPOOL01PIECE'``. ...
[ "Constructs", "a", ":", "class", ":", "Spoolverb", "instance", "from", "the", "string", "representation", "of", "the", "given", "verb", "." ]
python
train
python-xlib/python-xlib
Xlib/protocol/rq.py
https://github.com/python-xlib/python-xlib/blob/8901e831737e79fe5645f48089d70e1d1046d2f2/Xlib/protocol/rq.py#L1092-L1133
def parse_value(self, val, display, rawdict = 0): """This function is used by List and Object fields to convert Struct objects with no var_fields into Python values. """ ret = {} vno = 0 for f in self.static_fields: # Fields without names should be ignored, ...
[ "def", "parse_value", "(", "self", ",", "val", ",", "display", ",", "rawdict", "=", "0", ")", ":", "ret", "=", "{", "}", "vno", "=", "0", "for", "f", "in", "self", ".", "static_fields", ":", "# Fields without names should be ignored, and there should", "# no...
This function is used by List and Object fields to convert Struct objects with no var_fields into Python values.
[ "This", "function", "is", "used", "by", "List", "and", "Object", "fields", "to", "convert", "Struct", "objects", "with", "no", "var_fields", "into", "Python", "values", "." ]
python
train