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
HiPERCAM/hcam_widgets
hcam_widgets/gtc/headers.py
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/gtc/headers.py#L46-L72
def create_header_from_telpars(telpars): """ Create a list of fits header items from GTC telescope pars. The GTC telescope server gives a list of string describing FITS header items such as RA, DEC, etc. Arguments --------- telpars : list list returned by server call to getTelescop...
[ "def", "create_header_from_telpars", "(", "telpars", ")", ":", "# pars is a list of strings describing tel info in FITS", "# style, each entry in the list is a different class of", "# thing (weather, telescope, instrument etc).", "# first, we munge it into a single list of strings, each one", "#...
Create a list of fits header items from GTC telescope pars. The GTC telescope server gives a list of string describing FITS header items such as RA, DEC, etc. Arguments --------- telpars : list list returned by server call to getTelescopeParams
[ "Create", "a", "list", "of", "fits", "header", "items", "from", "GTC", "telescope", "pars", "." ]
python
train
androguard/androguard
androguard/core/bytecodes/dvm.py
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/bytecodes/dvm.py#L7550-L7559
def show(self): """ Print with a pretty display the MapList object """ bytecode._Print("MAP_LIST SIZE", self.size) for i in self.map_item: if i.item != self: # FIXME this does not work for CodeItems! # as we do not have the method analy...
[ "def", "show", "(", "self", ")", ":", "bytecode", ".", "_Print", "(", "\"MAP_LIST SIZE\"", ",", "self", ".", "size", ")", "for", "i", "in", "self", ".", "map_item", ":", "if", "i", ".", "item", "!=", "self", ":", "# FIXME this does not work for CodeItems!"...
Print with a pretty display the MapList object
[ "Print", "with", "a", "pretty", "display", "the", "MapList", "object" ]
python
train
Microsoft/azure-devops-python-api
azure-devops/azure/devops/v5_1/gallery/gallery_client.py
https://github.com/Microsoft/azure-devops-python-api/blob/4777ffda2f5052fabbaddb2abe9cb434e0cf1aa8/azure-devops/azure/devops/v5_1/gallery/gallery_client.py#L740-L757
def query_extensions(self, extension_query, account_token=None, account_token_header=None): """QueryExtensions. [Preview API] :param :class:`<ExtensionQuery> <azure.devops.v5_1.gallery.models.ExtensionQuery>` extension_query: :param str account_token: :param String account_token_...
[ "def", "query_extensions", "(", "self", ",", "extension_query", ",", "account_token", "=", "None", ",", "account_token_header", "=", "None", ")", ":", "query_parameters", "=", "{", "}", "if", "account_token", "is", "not", "None", ":", "query_parameters", "[", ...
QueryExtensions. [Preview API] :param :class:`<ExtensionQuery> <azure.devops.v5_1.gallery.models.ExtensionQuery>` extension_query: :param str account_token: :param String account_token_header: Header to pass the account token :rtype: :class:`<ExtensionQueryResult> <azure.devops.v...
[ "QueryExtensions", ".", "[", "Preview", "API", "]", ":", "param", ":", "class", ":", "<ExtensionQuery", ">", "<azure", ".", "devops", ".", "v5_1", ".", "gallery", ".", "models", ".", "ExtensionQuery", ">", "extension_query", ":", ":", "param", "str", "acco...
python
train
bitly/asyncmongo
asyncmongo/message.py
https://github.com/bitly/asyncmongo/blob/3da47c96d4592ec9e8b3ef5cf1b7d5b439ab3a5b/asyncmongo/message.py#L60-L74
def insert(collection_name, docs, check_keys, safe, last_error_args): """Get an **insert** message. """ data = __ZERO data += bson._make_c_string(collection_name) bson_data = "".join([bson.BSON.encode(doc, check_keys) for doc in docs]) if not bson_data: raise InvalidOperation("cannot do ...
[ "def", "insert", "(", "collection_name", ",", "docs", ",", "check_keys", ",", "safe", ",", "last_error_args", ")", ":", "data", "=", "__ZERO", "data", "+=", "bson", ".", "_make_c_string", "(", "collection_name", ")", "bson_data", "=", "\"\"", ".", "join", ...
Get an **insert** message.
[ "Get", "an", "**", "insert", "**", "message", "." ]
python
train
neherlab/treetime
treetime/treetime.py
https://github.com/neherlab/treetime/blob/f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0/treetime/treetime.py#L655-L684
def print_lh(self, joint=True): """ Print the total likelihood of the tree given the constrained leaves Parameters ---------- joint : bool If true, print joint LH, else print marginal LH """ try: u_lh = self.tree.unconstrained_sequence_...
[ "def", "print_lh", "(", "self", ",", "joint", "=", "True", ")", ":", "try", ":", "u_lh", "=", "self", ".", "tree", ".", "unconstrained_sequence_LH", "if", "joint", ":", "s_lh", "=", "self", ".", "tree", ".", "sequence_joint_LH", "t_lh", "=", "self", "....
Print the total likelihood of the tree given the constrained leaves Parameters ---------- joint : bool If true, print joint LH, else print marginal LH
[ "Print", "the", "total", "likelihood", "of", "the", "tree", "given", "the", "constrained", "leaves" ]
python
test
lablup/backend.ai-client-py
src/ai/backend/client/cli/vfolder.py
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/vfolder.py#L156-L171
def download(name, filenames): ''' Download a file from the virtual folder to the current working directory. The files with the same names will be overwirtten. \b NAME: Name of a virtual folder. FILENAMES: Paths of the files to be uploaded. ''' with Session() as session: try: ...
[ "def", "download", "(", "name", ",", "filenames", ")", ":", "with", "Session", "(", ")", "as", "session", ":", "try", ":", "session", ".", "VFolder", "(", "name", ")", ".", "download", "(", "filenames", ",", "show_progress", "=", "True", ")", "print_do...
Download a file from the virtual folder to the current working directory. The files with the same names will be overwirtten. \b NAME: Name of a virtual folder. FILENAMES: Paths of the files to be uploaded.
[ "Download", "a", "file", "from", "the", "virtual", "folder", "to", "the", "current", "working", "directory", ".", "The", "files", "with", "the", "same", "names", "will", "be", "overwirtten", "." ]
python
train
robotools/fontParts
Lib/fontParts/base/normalizers.py
https://github.com/robotools/fontParts/blob/d2ff106fe95f9d566161d936a645157626568712/Lib/fontParts/base/normalizers.py#L927-L937
def normalizeGlyphNote(value): """ Normalizes Glyph Note. * **value** must be a :ref:`type-string`. * Returned value is an unencoded ``unicode`` string """ if not isinstance(value, basestring): raise TypeError("Note must be a string, not %s." % type(value).__name...
[ "def", "normalizeGlyphNote", "(", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "basestring", ")", ":", "raise", "TypeError", "(", "\"Note must be a string, not %s.\"", "%", "type", "(", "value", ")", ".", "__name__", ")", "return", "unicode...
Normalizes Glyph Note. * **value** must be a :ref:`type-string`. * Returned value is an unencoded ``unicode`` string
[ "Normalizes", "Glyph", "Note", "." ]
python
train
reanahub/reana-commons
reana_commons/publisher.py
https://github.com/reanahub/reana-commons/blob/abf31d9f495e0d93171c43fc4a414cd292091b11/reana_commons/publisher.py#L100-L118
def publish_workflow_status(self, workflow_uuid, status, logs='', message=None): """Publish workflow status using the configured. :param workflow_uudid: String which represents the workflow UUID. :param status: Integer which represents the status of the workflow,...
[ "def", "publish_workflow_status", "(", "self", ",", "workflow_uuid", ",", "status", ",", "logs", "=", "''", ",", "message", "=", "None", ")", ":", "msg", "=", "{", "\"workflow_uuid\"", ":", "workflow_uuid", ",", "\"logs\"", ":", "logs", ",", "\"status\"", ...
Publish workflow status using the configured. :param workflow_uudid: String which represents the workflow UUID. :param status: Integer which represents the status of the workflow, this is defined in the `reana-db` `Workflow` models. :param logs: String which represents the logs whic...
[ "Publish", "workflow", "status", "using", "the", "configured", "." ]
python
train
Jaymon/prom
prom/interface/base.py
https://github.com/Jaymon/prom/blob/b7ad2c259eca198da03e1e4bc7d95014c168c361/prom/interface/base.py#L217-L227
def query(self, query_str, *query_args, **query_options): """ run a raw query on the db query_str -- string -- the query to run *query_args -- if the query_str is a formatting string, pass the values in this **query_options -- any query options can be passed in by using key=val ...
[ "def", "query", "(", "self", ",", "query_str", ",", "*", "query_args", ",", "*", "*", "query_options", ")", ":", "with", "self", ".", "connection", "(", "*", "*", "query_options", ")", "as", "connection", ":", "query_options", "[", "'connection'", "]", "...
run a raw query on the db query_str -- string -- the query to run *query_args -- if the query_str is a formatting string, pass the values in this **query_options -- any query options can be passed in by using key=val syntax
[ "run", "a", "raw", "query", "on", "the", "db" ]
python
train
twilio/twilio-python
twilio/rest/verify/v2/service/verification.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/verify/v2/service/verification.py#L168-L190
def update(self, status): """ Update the VerificationInstance :param VerificationInstance.Status status: The new status of the resource :returns: Updated VerificationInstance :rtype: twilio.rest.verify.v2.service.verification.VerificationInstance """ data = valu...
[ "def", "update", "(", "self", ",", "status", ")", ":", "data", "=", "values", ".", "of", "(", "{", "'Status'", ":", "status", ",", "}", ")", "payload", "=", "self", ".", "_version", ".", "update", "(", "'POST'", ",", "self", ".", "_uri", ",", "da...
Update the VerificationInstance :param VerificationInstance.Status status: The new status of the resource :returns: Updated VerificationInstance :rtype: twilio.rest.verify.v2.service.verification.VerificationInstance
[ "Update", "the", "VerificationInstance" ]
python
train
cloud-custodian/cloud-custodian
tools/c7n_gcp/c7n_gcp/mu.py
https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/tools/c7n_gcp/c7n_gcp/mu.py#L142-L151
def get(self, func_name, qualifier=None): """Get the details on a given function.""" project = self.session.get_default_project() func_name = "projects/{}/locations/{}/functions/{}".format( project, self.region, func_name) try: return self.client.execute_query('ge...
[ "def", "get", "(", "self", ",", "func_name", ",", "qualifier", "=", "None", ")", ":", "project", "=", "self", ".", "session", ".", "get_default_project", "(", ")", "func_name", "=", "\"projects/{}/locations/{}/functions/{}\"", ".", "format", "(", "project", ",...
Get the details on a given function.
[ "Get", "the", "details", "on", "a", "given", "function", "." ]
python
train
droope/droopescan
dscan/common/functions.py
https://github.com/droope/droopescan/blob/424c48a0f9d12b4536dbef5a786f0fbd4ce9519a/dscan/common/functions.py#L303-L331
def instances_get(opts, plugins, url_file_input, out): """ Creates and returns an ordered dictionary containing instances for all available scanning plugins, sort of ordered by popularity. @param opts: options as returned by self._options. @param plugins: plugins as returned by plugins_util.plugins_...
[ "def", "instances_get", "(", "opts", ",", "plugins", ",", "url_file_input", ",", "out", ")", ":", "instances", "=", "OrderedDict", "(", ")", "preferred_order", "=", "[", "'wordpress'", ",", "'joomla'", ",", "'drupal'", "]", "for", "cms_name", "in", "preferre...
Creates and returns an ordered dictionary containing instances for all available scanning plugins, sort of ordered by popularity. @param opts: options as returned by self._options. @param plugins: plugins as returned by plugins_util.plugins_base_get. @param url_file_input: boolean value which indicates ...
[ "Creates", "and", "returns", "an", "ordered", "dictionary", "containing", "instances", "for", "all", "available", "scanning", "plugins", "sort", "of", "ordered", "by", "popularity", "." ]
python
train
dead-beef/markovchain
markovchain/image/traversal.py
https://github.com/dead-beef/markovchain/blob/9bd10b2f01089341c4a875a0fa569d50caba22c7/markovchain/image/traversal.py#L70-L81
def save(self): """Convert to JSON. Returns ------- `dict` JSON data. """ data = super().save() data['reverse'] = self.reverse data['line_sentences'] = self.line_sentences return data
[ "def", "save", "(", "self", ")", ":", "data", "=", "super", "(", ")", ".", "save", "(", ")", "data", "[", "'reverse'", "]", "=", "self", ".", "reverse", "data", "[", "'line_sentences'", "]", "=", "self", ".", "line_sentences", "return", "data" ]
Convert to JSON. Returns ------- `dict` JSON data.
[ "Convert", "to", "JSON", "." ]
python
train
swharden/PyOriginTools
PyOriginTools/workbook.py
https://github.com/swharden/PyOriginTools/blob/536fb8e11234ffdc27e26b1800e0358179ca7d26/PyOriginTools/workbook.py#L49-L68
def colAdd(self,name="",desc="",unit="",comment="",coltype=0,data=[],pos=None): """ column types: 0: Y 1: Disregard 2: Y Error 3: X 4: Label 5: Z 6: X Error """ if pos is None: pos=len(self.co...
[ "def", "colAdd", "(", "self", ",", "name", "=", "\"\"", ",", "desc", "=", "\"\"", ",", "unit", "=", "\"\"", ",", "comment", "=", "\"\"", ",", "coltype", "=", "0", ",", "data", "=", "[", "]", ",", "pos", "=", "None", ")", ":", "if", "pos", "is...
column types: 0: Y 1: Disregard 2: Y Error 3: X 4: Label 5: Z 6: X Error
[ "column", "types", ":", "0", ":", "Y", "1", ":", "Disregard", "2", ":", "Y", "Error", "3", ":", "X", "4", ":", "Label", "5", ":", "Z", "6", ":", "X", "Error" ]
python
train
christophertbrown/bioscripts
ctbBio/rRNA_copies.py
https://github.com/christophertbrown/bioscripts/blob/83b2566b3a5745437ec651cd6cafddd056846240/ctbBio/rRNA_copies.py#L31-L52
def parse_s2bins(s2bins): """ parse ggKbase scaffold-to-bin mapping - scaffolds-to-bins and bins-to-scaffolds """ s2b = {} b2s = {} for line in s2bins: line = line.strip().split() s, b = line[0], line[1] if 'UNK' in b: continue if len(line) > 2...
[ "def", "parse_s2bins", "(", "s2bins", ")", ":", "s2b", "=", "{", "}", "b2s", "=", "{", "}", "for", "line", "in", "s2bins", ":", "line", "=", "line", ".", "strip", "(", ")", ".", "split", "(", ")", "s", ",", "b", "=", "line", "[", "0", "]", ...
parse ggKbase scaffold-to-bin mapping - scaffolds-to-bins and bins-to-scaffolds
[ "parse", "ggKbase", "scaffold", "-", "to", "-", "bin", "mapping", "-", "scaffolds", "-", "to", "-", "bins", "and", "bins", "-", "to", "-", "scaffolds" ]
python
train
csirtgadgets/csirtgsdk-py
csirtgsdk/__init__.py
https://github.com/csirtgadgets/csirtgsdk-py/blob/5a7ed9c5e6fa27170366ecbdef710dc80d537dc2/csirtgsdk/__init__.py#L39-L61
def indicator_create(f, i): """ Create an indicator in a feed :param f: feed name (eg: wes/test) :param i: indicator dict (eg: {'indicator': 'example.com', 'tags': ['ssh'], 'description': 'this is a test'}) :return: dict of indicator """ if '/' not in f: raise ValueError('feed na...
[ "def", "indicator_create", "(", "f", ",", "i", ")", ":", "if", "'/'", "not", "in", "f", ":", "raise", "ValueError", "(", "'feed name must be formatted like: '", "'csirtgadgets/scanners'", ")", "if", "not", "i", ":", "raise", "ValueError", "(", "'missing indicato...
Create an indicator in a feed :param f: feed name (eg: wes/test) :param i: indicator dict (eg: {'indicator': 'example.com', 'tags': ['ssh'], 'description': 'this is a test'}) :return: dict of indicator
[ "Create", "an", "indicator", "in", "a", "feed", ":", "param", "f", ":", "feed", "name", "(", "eg", ":", "wes", "/", "test", ")", ":", "param", "i", ":", "indicator", "dict", "(", "eg", ":", "{", "indicator", ":", "example", ".", "com", "tags", ":...
python
train
jwkvam/plotlywrapper
plotlywrapper.py
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L551-L577
def horizontal(y, xmin=0, xmax=1, color=None, width=None, dash=None, opacity=None): """Draws a horizontal line from `xmin` to `xmax`. Parameters ---------- xmin : int, optional xmax : int, optional color : str, optional width : number, optional Returns ------- Chart """ ...
[ "def", "horizontal", "(", "y", ",", "xmin", "=", "0", ",", "xmax", "=", "1", ",", "color", "=", "None", ",", "width", "=", "None", ",", "dash", "=", "None", ",", "opacity", "=", "None", ")", ":", "lineattr", "=", "{", "}", "if", "color", ":", ...
Draws a horizontal line from `xmin` to `xmax`. Parameters ---------- xmin : int, optional xmax : int, optional color : str, optional width : number, optional Returns ------- Chart
[ "Draws", "a", "horizontal", "line", "from", "xmin", "to", "xmax", "." ]
python
train
apache/spark
python/pyspark/sql/functions.py
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/functions.py#L1525-L1531
def decode(col, charset): """ Computes the first argument into a string from a binary using the provided character set (one of 'US-ASCII', 'ISO-8859-1', 'UTF-8', 'UTF-16BE', 'UTF-16LE', 'UTF-16'). """ sc = SparkContext._active_spark_context return Column(sc._jvm.functions.decode(_to_java_column(...
[ "def", "decode", "(", "col", ",", "charset", ")", ":", "sc", "=", "SparkContext", ".", "_active_spark_context", "return", "Column", "(", "sc", ".", "_jvm", ".", "functions", ".", "decode", "(", "_to_java_column", "(", "col", ")", ",", "charset", ")", ")"...
Computes the first argument into a string from a binary using the provided character set (one of 'US-ASCII', 'ISO-8859-1', 'UTF-8', 'UTF-16BE', 'UTF-16LE', 'UTF-16').
[ "Computes", "the", "first", "argument", "into", "a", "string", "from", "a", "binary", "using", "the", "provided", "character", "set", "(", "one", "of", "US", "-", "ASCII", "ISO", "-", "8859", "-", "1", "UTF", "-", "8", "UTF", "-", "16BE", "UTF", "-",...
python
train
ioos/compliance-checker
compliance_checker/acdd.py
https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/acdd.py#L505-L564
def check_time_extents(self, ds): """ Check that the values of time_coverage_start/time_coverage_end approximately match the data. """ if not (hasattr(ds, 'time_coverage_start') and hasattr(ds, 'time_coverage_end')): return # Parse the ISO 8601 formatted dates ...
[ "def", "check_time_extents", "(", "self", ",", "ds", ")", ":", "if", "not", "(", "hasattr", "(", "ds", ",", "'time_coverage_start'", ")", "and", "hasattr", "(", "ds", ",", "'time_coverage_end'", ")", ")", ":", "return", "# Parse the ISO 8601 formatted dates", ...
Check that the values of time_coverage_start/time_coverage_end approximately match the data.
[ "Check", "that", "the", "values", "of", "time_coverage_start", "/", "time_coverage_end", "approximately", "match", "the", "data", "." ]
python
train
rmohr/static3
static.py
https://github.com/rmohr/static3/blob/e5f88c5e91789bd4db7fde0cf59e4a15c3326f11/static.py#L302-L312
def _full_path(self, path_info): """Return the full path from which to read.""" full_path = self.root + path_info if path.exists(full_path): return full_path else: for magic in self.magics: if path.exists(magic.new_path(full_path)): ...
[ "def", "_full_path", "(", "self", ",", "path_info", ")", ":", "full_path", "=", "self", ".", "root", "+", "path_info", "if", "path", ".", "exists", "(", "full_path", ")", ":", "return", "full_path", "else", ":", "for", "magic", "in", "self", ".", "magi...
Return the full path from which to read.
[ "Return", "the", "full", "path", "from", "which", "to", "read", "." ]
python
train
inveniosoftware-contrib/invenio-classifier
invenio_classifier/engine.py
https://github.com/inveniosoftware-contrib/invenio-classifier/blob/3c758cf34dca6bf0548e7da5de34e5f72e3b255e/invenio_classifier/engine.py#L381-L391
def _get_acronyms(acronyms): """Return a formatted list of acronyms.""" acronyms_str = {} if acronyms: for acronym, expansions in iteritems(acronyms): expansions_str = ", ".join(["%s (%d)" % expansion for expansion in expansions]) acron...
[ "def", "_get_acronyms", "(", "acronyms", ")", ":", "acronyms_str", "=", "{", "}", "if", "acronyms", ":", "for", "acronym", ",", "expansions", "in", "iteritems", "(", "acronyms", ")", ":", "expansions_str", "=", "\", \"", ".", "join", "(", "[", "\"%s (%d)\"...
Return a formatted list of acronyms.
[ "Return", "a", "formatted", "list", "of", "acronyms", "." ]
python
train
PyCQA/pylint
pylint/checkers/python3.py
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/python3.py#L1001-L1014
def visit_name(self, node): """Detect when a "bad" built-in is referenced.""" found_node, _ = node.lookup(node.name) if not _is_builtin(found_node): return if node.name not in self._bad_builtins: return if node_ignores_exception(node) or isinstance( ...
[ "def", "visit_name", "(", "self", ",", "node", ")", ":", "found_node", ",", "_", "=", "node", ".", "lookup", "(", "node", ".", "name", ")", "if", "not", "_is_builtin", "(", "found_node", ")", ":", "return", "if", "node", ".", "name", "not", "in", "...
Detect when a "bad" built-in is referenced.
[ "Detect", "when", "a", "bad", "built", "-", "in", "is", "referenced", "." ]
python
test
wummel/linkchecker
linkcheck/director/status.py
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/director/status.py#L40-L51
def run_checked (self): """Print periodic status messages.""" self.start_time = time.time() self.setName("Status") # the first status should be after a second wait_seconds = 1 first_wait = True while not self.stopped(wait_seconds): self.log_status() ...
[ "def", "run_checked", "(", "self", ")", ":", "self", ".", "start_time", "=", "time", ".", "time", "(", ")", "self", ".", "setName", "(", "\"Status\"", ")", "# the first status should be after a second", "wait_seconds", "=", "1", "first_wait", "=", "True", "whi...
Print periodic status messages.
[ "Print", "periodic", "status", "messages", "." ]
python
train
riga/scinum
scinum.py
https://github.com/riga/scinum/blob/55eb6d8aa77beacee5a07443392954b8a0aad8cb/scinum.py#L1480-L1534
def round_uncertainty(unc, method="publication"): """ Rounds an uncertainty *unc* following a specific *method* and returns a 2-tuple containing the significant digits as a string, and the decimal magnitude that is required to recover the uncertainty. *unc* might also be a numpy array. Rounding methods:...
[ "def", "round_uncertainty", "(", "unc", ",", "method", "=", "\"publication\"", ")", ":", "# validate the method", "meth", "=", "method", ".", "lower", "(", ")", "if", "meth", "not", "in", "(", "\"pub\"", ",", "\"publication\"", ",", "\"pdg\"", ",", "\"one\""...
Rounds an uncertainty *unc* following a specific *method* and returns a 2-tuple containing the significant digits as a string, and the decimal magnitude that is required to recover the uncertainty. *unc* might also be a numpy array. Rounding methods: - ``"pdg"``: Rounding rules as defined by the `PDG ...
[ "Rounds", "an", "uncertainty", "*", "unc", "*", "following", "a", "specific", "*", "method", "*", "and", "returns", "a", "2", "-", "tuple", "containing", "the", "significant", "digits", "as", "a", "string", "and", "the", "decimal", "magnitude", "that", "is...
python
train
OCHA-DAP/hdx-python-country
src/hdx/location/country.py
https://github.com/OCHA-DAP/hdx-python-country/blob/e86a0b5f182a5d010c4cd7faa36a213cfbcc01f6/src/hdx/location/country.py#L170-L183
def set_ocha_url(cls, url=None): # type: (str) -> None """ Set World Bank url from which to retrieve countries data Args: url (str): World Bank url from which to retrieve countries data. Defaults to internal value. Returns: None """ if ur...
[ "def", "set_ocha_url", "(", "cls", ",", "url", "=", "None", ")", ":", "# type: (str) -> None", "if", "url", "is", "None", ":", "url", "=", "cls", ".", "_ochaurl_int", "cls", ".", "_ochaurl", "=", "url" ]
Set World Bank url from which to retrieve countries data Args: url (str): World Bank url from which to retrieve countries data. Defaults to internal value. Returns: None
[ "Set", "World", "Bank", "url", "from", "which", "to", "retrieve", "countries", "data" ]
python
train
projectatomic/atomic-reactor
atomic_reactor/core.py
https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/core.py#L128-L179
def build_image_dockerhost(self, build_image, json_args_path): """ Build docker image inside privileged container using docker from host (mount docker socket inside container). There are possible races here. Use wisely. This operation is asynchronous and you should wait for cont...
[ "def", "build_image_dockerhost", "(", "self", ",", "build_image", ",", "json_args_path", ")", ":", "logger", ".", "info", "(", "\"building image '%s' in container using docker from host\"", ",", "build_image", ")", "self", ".", "_check_build_input", "(", "build_image", ...
Build docker image inside privileged container using docker from host (mount docker socket inside container). There are possible races here. Use wisely. This operation is asynchronous and you should wait for container to finish. :param build_image: str, name of image where build is per...
[ "Build", "docker", "image", "inside", "privileged", "container", "using", "docker", "from", "host", "(", "mount", "docker", "socket", "inside", "container", ")", ".", "There", "are", "possible", "races", "here", ".", "Use", "wisely", "." ]
python
train
openego/eTraGo
etrago/tools/utilities.py
https://github.com/openego/eTraGo/blob/2a8fc6d4368d0e9abe6fe0d0c39baf66ea0126b9/etrago/tools/utilities.py#L557-L604
def data_manipulation_sh(network): """ Adds missing components to run calculations with SH scenarios. Parameters ---------- network : :class:`pypsa.Network Overall container of PyPSA """ from shapely.geometry import Point, LineString, MultiLineString from geoalchemy2.shap...
[ "def", "data_manipulation_sh", "(", "network", ")", ":", "from", "shapely", ".", "geometry", "import", "Point", ",", "LineString", ",", "MultiLineString", "from", "geoalchemy2", ".", "shape", "import", "from_shape", ",", "to_shape", "# add connection from Luebeck to S...
Adds missing components to run calculations with SH scenarios. Parameters ---------- network : :class:`pypsa.Network Overall container of PyPSA
[ "Adds", "missing", "components", "to", "run", "calculations", "with", "SH", "scenarios", "." ]
python
train
bitesofcode/projexui
projexui/xsettings.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/xsettings.py#L497-L506
def allKeys(self): """ Returns a list of all the keys for this settings instance. :return [<str>, ..] """ if self._customFormat: return self._customFormat.allKeys() else: return super(XSettings, self).allKeys()
[ "def", "allKeys", "(", "self", ")", ":", "if", "self", ".", "_customFormat", ":", "return", "self", ".", "_customFormat", ".", "allKeys", "(", ")", "else", ":", "return", "super", "(", "XSettings", ",", "self", ")", ".", "allKeys", "(", ")" ]
Returns a list of all the keys for this settings instance. :return [<str>, ..]
[ "Returns", "a", "list", "of", "all", "the", "keys", "for", "this", "settings", "instance", ".", ":", "return", "[", "<str", ">", "..", "]" ]
python
train
neo4j/neo4j-python-driver
neo4j/__init__.py
https://github.com/neo4j/neo4j-python-driver/blob/0c641e826765e86ff5454dae57c99521db8ca45c/neo4j/__init__.py#L102-L113
def _check_uri(cls, uri): """ Check whether a URI is compatible with a :class:`.Driver` subclass. When called from a subclass, execution simply passes through if the URI scheme is valid for that class. If invalid, a `ValueError` is raised. :param uri: URI to check for compatibil...
[ "def", "_check_uri", "(", "cls", ",", "uri", ")", ":", "parsed", "=", "urlparse", "(", "uri", ")", "if", "parsed", ".", "scheme", "!=", "cls", ".", "uri_scheme", ":", "raise", "ValueError", "(", "\"%s objects require the %r URI scheme\"", "%", "(", "cls", ...
Check whether a URI is compatible with a :class:`.Driver` subclass. When called from a subclass, execution simply passes through if the URI scheme is valid for that class. If invalid, a `ValueError` is raised. :param uri: URI to check for compatibility :raise: `ValueError` if UR...
[ "Check", "whether", "a", "URI", "is", "compatible", "with", "a", ":", "class", ":", ".", "Driver", "subclass", ".", "When", "called", "from", "a", "subclass", "execution", "simply", "passes", "through", "if", "the", "URI", "scheme", "is", "valid", "for", ...
python
train
jameslyons/pycipher
pycipher/delastelle.py
https://github.com/jameslyons/pycipher/blob/8f1d7cf3cba4e12171e27d9ce723ad890194de19/pycipher/delastelle.py#L42-L57
def decipher(self,string): """Decipher string using Delastelle cipher according to initialised key. Example:: plaintext = Delastelle('APCZ WRLFBDKOTYUQGENHXMIVS').decipher(ciphertext) :param string: The string to decipher. :returns: The deciphered string. The plaintex...
[ "def", "decipher", "(", "self", ",", "string", ")", ":", "string", "=", "self", ".", "remove_punctuation", "(", "string", ",", "filter", "=", "'[^'", "+", "self", ".", "chars", "+", "']'", ")", "ret", "=", "''", "for", "i", "in", "range", "(", "0",...
Decipher string using Delastelle cipher according to initialised key. Example:: plaintext = Delastelle('APCZ WRLFBDKOTYUQGENHXMIVS').decipher(ciphertext) :param string: The string to decipher. :returns: The deciphered string. The plaintext will be 1/3 the length of the cipher...
[ "Decipher", "string", "using", "Delastelle", "cipher", "according", "to", "initialised", "key", "." ]
python
train
googledatalab/pydatalab
google/datalab/storage/_api.py
https://github.com/googledatalab/pydatalab/blob/d9031901d5bca22fe0d5925d204e6698df9852e1/google/datalab/storage/_api.py#L124-L146
def object_download(self, bucket, key, start_offset=0, byte_count=None): """Reads the contents of an object as text. Args: bucket: the name of the bucket containing the object. key: the key of the object to be read. start_offset: the start offset of bytes to read. byte_count: the number...
[ "def", "object_download", "(", "self", ",", "bucket", ",", "key", ",", "start_offset", "=", "0", ",", "byte_count", "=", "None", ")", ":", "args", "=", "{", "'alt'", ":", "'media'", "}", "headers", "=", "{", "}", "if", "start_offset", ">", "0", "or",...
Reads the contents of an object as text. Args: bucket: the name of the bucket containing the object. key: the key of the object to be read. start_offset: the start offset of bytes to read. byte_count: the number of bytes to read. If None, it reads to the end. Returns: The text con...
[ "Reads", "the", "contents", "of", "an", "object", "as", "text", "." ]
python
train
madeindjs/Super-Markdown
SuperMarkdown/SuperMarkdown.py
https://github.com/madeindjs/Super-Markdown/blob/fe2da746afa6a27aaaad27a2db1dca234f802eb0/SuperMarkdown/SuperMarkdown.py#L86-L93
def _text_file(self, url): """return the content of a file""" try: with open(url, 'r', encoding='utf-8') as file: return file.read() except FileNotFoundError: print('File `{}` not found'.format(url)) sys.exit(0)
[ "def", "_text_file", "(", "self", ",", "url", ")", ":", "try", ":", "with", "open", "(", "url", ",", "'r'", ",", "encoding", "=", "'utf-8'", ")", "as", "file", ":", "return", "file", ".", "read", "(", ")", "except", "FileNotFoundError", ":", "print",...
return the content of a file
[ "return", "the", "content", "of", "a", "file" ]
python
train
pydata/xarray
xarray/core/dataset.py
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L676-L690
def _construct_direct(cls, variables, coord_names, dims, attrs=None, indexes=None, encoding=None, file_obj=None): """Shortcut around __init__ for internal use when we want to skip costly validation """ obj = object.__new__(cls) obj._variables = variables...
[ "def", "_construct_direct", "(", "cls", ",", "variables", ",", "coord_names", ",", "dims", ",", "attrs", "=", "None", ",", "indexes", "=", "None", ",", "encoding", "=", "None", ",", "file_obj", "=", "None", ")", ":", "obj", "=", "object", ".", "__new__...
Shortcut around __init__ for internal use when we want to skip costly validation
[ "Shortcut", "around", "__init__", "for", "internal", "use", "when", "we", "want", "to", "skip", "costly", "validation" ]
python
train
mitodl/django-server-status
server_status/views.py
https://github.com/mitodl/django-server-status/blob/99bd29343138f94a08718fdbd9285e551751777b/server_status/views.py#L64-L102
def get_redis_info(): """Check Redis connection.""" from kombu.utils.url import _parse_url as parse_redis_url from redis import ( StrictRedis, ConnectionError as RedisConnectionError, ResponseError as RedisResponseError, ) for conf_name in ('REDIS_URL', 'BROKER_URL', 'CELERY_...
[ "def", "get_redis_info", "(", ")", ":", "from", "kombu", ".", "utils", ".", "url", "import", "_parse_url", "as", "parse_redis_url", "from", "redis", "import", "(", "StrictRedis", ",", "ConnectionError", "as", "RedisConnectionError", ",", "ResponseError", "as", "...
Check Redis connection.
[ "Check", "Redis", "connection", "." ]
python
train
mbedmicro/pyOCD
pyocd/probe/stlink_probe.py
https://github.com/mbedmicro/pyOCD/blob/41a174718a9739f3cbe785c2ba21cb7fd1310c6f/pyocd/probe/stlink_probe.py#L112-L115
def connect(self, protocol=None): """! @brief Initialize DAP IO pins for JTAG or SWD""" self._link.enter_debug(STLink.Protocol.SWD) self._is_connected = True
[ "def", "connect", "(", "self", ",", "protocol", "=", "None", ")", ":", "self", ".", "_link", ".", "enter_debug", "(", "STLink", ".", "Protocol", ".", "SWD", ")", "self", ".", "_is_connected", "=", "True" ]
! @brief Initialize DAP IO pins for JTAG or SWD
[ "!" ]
python
train
PMEAL/porespy
porespy/filters/__funcs__.py
https://github.com/PMEAL/porespy/blob/1e13875b56787d8f5b7ffdabce8c4342c33ba9f8/porespy/filters/__funcs__.py#L19-L80
def distance_transform_lin(im, axis=0, mode='both'): r""" Replaces each void voxel with the linear distance to the nearest solid voxel along the specified axis. Parameters ---------- im : ND-array The image of the porous material with ``True`` values indicating the void phase (o...
[ "def", "distance_transform_lin", "(", "im", ",", "axis", "=", "0", ",", "mode", "=", "'both'", ")", ":", "if", "im", ".", "ndim", "!=", "im", ".", "squeeze", "(", ")", ".", "ndim", ":", "warnings", ".", "warn", "(", "'Input image conains a singleton axis...
r""" Replaces each void voxel with the linear distance to the nearest solid voxel along the specified axis. Parameters ---------- im : ND-array The image of the porous material with ``True`` values indicating the void phase (or phase of interest) axis : int The directio...
[ "r", "Replaces", "each", "void", "voxel", "with", "the", "linear", "distance", "to", "the", "nearest", "solid", "voxel", "along", "the", "specified", "axis", "." ]
python
train
pypa/pipenv
pipenv/vendor/urllib3/response.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/response.py#L500-L526
def from_httplib(ResponseCls, r, **response_kw): """ Given an :class:`httplib.HTTPResponse` instance ``r``, return a corresponding :class:`urllib3.response.HTTPResponse` object. Remaining parameters are passed to the HTTPResponse constructor, along with ``original_response=r``. ...
[ "def", "from_httplib", "(", "ResponseCls", ",", "r", ",", "*", "*", "response_kw", ")", ":", "headers", "=", "r", ".", "msg", "if", "not", "isinstance", "(", "headers", ",", "HTTPHeaderDict", ")", ":", "if", "PY3", ":", "# Python 3", "headers", "=", "H...
Given an :class:`httplib.HTTPResponse` instance ``r``, return a corresponding :class:`urllib3.response.HTTPResponse` object. Remaining parameters are passed to the HTTPResponse constructor, along with ``original_response=r``.
[ "Given", "an", ":", "class", ":", "httplib", ".", "HTTPResponse", "instance", "r", "return", "a", "corresponding", ":", "class", ":", "urllib3", ".", "response", ".", "HTTPResponse", "object", "." ]
python
train
BlackEarth/bxml
bxml/docx.py
https://github.com/BlackEarth/bxml/blob/8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77/bxml/docx.py#L149-L162
def footnotemap(self, cache=True): """return the footnotes from the docx, keyed to string id.""" if self.__footnotemap is not None and cache==True: return self.__footnotemap else: x = self.xml(src='word/footnotes.xml') d = Dict() if x is None: retu...
[ "def", "footnotemap", "(", "self", ",", "cache", "=", "True", ")", ":", "if", "self", ".", "__footnotemap", "is", "not", "None", "and", "cache", "==", "True", ":", "return", "self", ".", "__footnotemap", "else", ":", "x", "=", "self", ".", "xml", "("...
return the footnotes from the docx, keyed to string id.
[ "return", "the", "footnotes", "from", "the", "docx", "keyed", "to", "string", "id", "." ]
python
train
BlueBrain/NeuroM
examples/end_to_end_distance.py
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/examples/end_to_end_distance.py#L38-L42
def path_end_to_end_distance(neurite): '''Calculate and return end-to-end-distance of a given neurite.''' trunk = neurite.root_node.points[0] return max(morphmath.point_dist(l.points[-1], trunk) for l in neurite.root_node.ileaf())
[ "def", "path_end_to_end_distance", "(", "neurite", ")", ":", "trunk", "=", "neurite", ".", "root_node", ".", "points", "[", "0", "]", "return", "max", "(", "morphmath", ".", "point_dist", "(", "l", ".", "points", "[", "-", "1", "]", ",", "trunk", ")", ...
Calculate and return end-to-end-distance of a given neurite.
[ "Calculate", "and", "return", "end", "-", "to", "-", "end", "-", "distance", "of", "a", "given", "neurite", "." ]
python
train
olitheolix/qtmacs
qtmacs/base_applet.py
https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/base_applet.py#L641-L698
def qteMakeWidgetActive(self, widgetObj: QtGui.QWidget): """ Give keyboard focus to ``widgetObj``. If ``widgetObj`` is **None** then the internal focus state is reset, but the focus manger will automatically activate the first available widget again. |Args| * `...
[ "def", "qteMakeWidgetActive", "(", "self", ",", "widgetObj", ":", "QtGui", ".", "QWidget", ")", ":", "# Void the active widget information.", "if", "widgetObj", "is", "None", ":", "self", ".", "_qteActiveWidget", "=", "None", "return", "# Ensure that this applet is an...
Give keyboard focus to ``widgetObj``. If ``widgetObj`` is **None** then the internal focus state is reset, but the focus manger will automatically activate the first available widget again. |Args| * ``widgetObj`` (**QWidget**): the widget to focus on. |Returns| ...
[ "Give", "keyboard", "focus", "to", "widgetObj", "." ]
python
train
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/slugs.py
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/slugs.py#L8120-L8129
def slugs_configuration_camera_send(self, target, idOrder, order, force_mavlink1=False): ''' Control for camara. target : The system setting the commands (uint8_t) idOrder : ID 0: brightness 1: aperture 2: iris 3: ICR ...
[ "def", "slugs_configuration_camera_send", "(", "self", ",", "target", ",", "idOrder", ",", "order", ",", "force_mavlink1", "=", "False", ")", ":", "return", "self", ".", "send", "(", "self", ".", "slugs_configuration_camera_encode", "(", "target", ",", "idOrder"...
Control for camara. target : The system setting the commands (uint8_t) idOrder : ID 0: brightness 1: aperture 2: iris 3: ICR 4: backlight (uint8_t) order : 1: up/on 2: down/off 3: auto/reset/no action (uint8_t)
[ "Control", "for", "camara", "." ]
python
train
econ-ark/HARK
HARK/ConsumptionSaving/ConsMarkovModel.py
https://github.com/econ-ark/HARK/blob/3d184153a189e618a87c9540df1cd12044039cc5/HARK/ConsumptionSaving/ConsMarkovModel.py#L902-L920
def getControls(self): ''' Calculates consumption for each consumer of this type using the consumption functions. Parameters ---------- None Returns ------- None ''' cNrmNow = np.zeros(self.AgentCount) + np.nan for t in range(self...
[ "def", "getControls", "(", "self", ")", ":", "cNrmNow", "=", "np", ".", "zeros", "(", "self", ".", "AgentCount", ")", "+", "np", ".", "nan", "for", "t", "in", "range", "(", "self", ".", "T_cycle", ")", ":", "for", "j", "in", "range", "(", "self",...
Calculates consumption for each consumer of this type using the consumption functions. Parameters ---------- None Returns ------- None
[ "Calculates", "consumption", "for", "each", "consumer", "of", "this", "type", "using", "the", "consumption", "functions", "." ]
python
train
bitesofcode/projexui
projexui/widgets/xnodewidget/xnode.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnode.py#L667-L679
def drawHotspots(self, painter): """ Draws all the hotspots for the renderer. :param painter | <QPaint> """ # draw hotspots for hotspot in (self._hotspots + self._dropzones): hstyle = hotspot.style() if hstyle == XNode.HotspotStyle.In...
[ "def", "drawHotspots", "(", "self", ",", "painter", ")", ":", "# draw hotspots", "for", "hotspot", "in", "(", "self", ".", "_hotspots", "+", "self", ".", "_dropzones", ")", ":", "hstyle", "=", "hotspot", ".", "style", "(", ")", "if", "hstyle", "==", "X...
Draws all the hotspots for the renderer. :param painter | <QPaint>
[ "Draws", "all", "the", "hotspots", "for", "the", "renderer", ".", ":", "param", "painter", "|", "<QPaint", ">" ]
python
train
influxdata/influxdb-python
influxdb/influxdb08/dataframe_client.py
https://github.com/influxdata/influxdb-python/blob/d5d12499f3755199d5eedd8b363450f1cf4073bd/influxdb/influxdb08/dataframe_client.py#L85-L108
def query(self, query, time_precision='s', chunked=False): """Query data into DataFrames. Returns a DataFrame for a single time series and a map for multiple time series with the time series as value and its name as key. :param time_precision: [Optional, default 's'] Either 's', 'm', '...
[ "def", "query", "(", "self", ",", "query", ",", "time_precision", "=", "'s'", ",", "chunked", "=", "False", ")", ":", "result", "=", "InfluxDBClient", ".", "query", "(", "self", ",", "query", "=", "query", ",", "time_precision", "=", "time_precision", ",...
Query data into DataFrames. Returns a DataFrame for a single time series and a map for multiple time series with the time series as value and its name as key. :param time_precision: [Optional, default 's'] Either 's', 'm', 'ms' or 'u'. :param chunked: [Optional, default=Fal...
[ "Query", "data", "into", "DataFrames", "." ]
python
train
androguard/androguard
androguard/core/bytecode.py
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/bytecode.py#L795-L809
def read(self, size): """ Read from the current offset a total number of `size` bytes and increment the offset by `size` :param int size: length of bytes to read :rtype: bytearray """ if isinstance(size, SV): size = size.value buff = self.__b...
[ "def", "read", "(", "self", ",", "size", ")", ":", "if", "isinstance", "(", "size", ",", "SV", ")", ":", "size", "=", "size", ".", "value", "buff", "=", "self", ".", "__buff", "[", "self", ".", "__idx", ":", "self", ".", "__idx", "+", "size", "...
Read from the current offset a total number of `size` bytes and increment the offset by `size` :param int size: length of bytes to read :rtype: bytearray
[ "Read", "from", "the", "current", "offset", "a", "total", "number", "of", "size", "bytes", "and", "increment", "the", "offset", "by", "size" ]
python
train
MIT-LCP/wfdb-python
wfdb/io/_header.py
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/io/_header.py#L675-L730
def _read_header_lines(base_record_name, dir_name, pb_dir): """ Read the lines in a local or remote header file. Parameters ---------- base_record_name : str The base name of the WFDB record to be read, without any file extensions. dir_name : str The local directory loca...
[ "def", "_read_header_lines", "(", "base_record_name", ",", "dir_name", ",", "pb_dir", ")", ":", "file_name", "=", "base_record_name", "+", "'.hea'", "# Read local file", "if", "pb_dir", "is", "None", ":", "with", "open", "(", "os", ".", "path", ".", "join", ...
Read the lines in a local or remote header file. Parameters ---------- base_record_name : str The base name of the WFDB record to be read, without any file extensions. dir_name : str The local directory location of the header file. This parameter is ignored if `pb_dir` i...
[ "Read", "the", "lines", "in", "a", "local", "or", "remote", "header", "file", "." ]
python
train
nya3jp/end
end.py
https://github.com/nya3jp/end/blob/c001590604e50ab78402420eba4f26ba3d0ed406/end.py#L235-L245
def install_import_hook(): """Installs __import__ hook.""" saved_import = builtins.__import__ @functools.wraps(saved_import) def import_hook(name, *args, **kwargs): if name == 'end': process_import() end return saved_import(name, *args, **kwargs) end builtins....
[ "def", "install_import_hook", "(", ")", ":", "saved_import", "=", "builtins", ".", "__import__", "@", "functools", ".", "wraps", "(", "saved_import", ")", "def", "import_hook", "(", "name", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "name...
Installs __import__ hook.
[ "Installs", "__import__", "hook", "." ]
python
train
openstack/networking-cisco
networking_cisco/plugins/cisco/db/l3/ha_db.py
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/db/l3/ha_db.py#L1020-L1062
def get_router_for_floatingip(self, context, internal_port, internal_subnet, external_network_id): """We need to over-load this function so that we only return the user visible router and never its redundancy routers (as they never have floatingips associated wi...
[ "def", "get_router_for_floatingip", "(", "self", ",", "context", ",", "internal_port", ",", "internal_subnet", ",", "external_network_id", ")", ":", "gw_port", "=", "orm", ".", "aliased", "(", "models_v2", ".", "Port", ",", "name", "=", "\"gw_port\"", ")", "ro...
We need to over-load this function so that we only return the user visible router and never its redundancy routers (as they never have floatingips associated with them).
[ "We", "need", "to", "over", "-", "load", "this", "function", "so", "that", "we", "only", "return", "the", "user", "visible", "router", "and", "never", "its", "redundancy", "routers", "(", "as", "they", "never", "have", "floatingips", "associated", "with", ...
python
train
pybel/pybel
src/pybel/struct/summary/node_summary.py
https://github.com/pybel/pybel/blob/c8a7a1bdae4c475fa2a8c77f3a9a5f6d79556ca0/src/pybel/struct/summary/node_summary.py#L101-L110
def get_names(graph): """Get all names for each namespace. :type graph: pybel.BELGraph :rtype: dict[str,set[str]] """ rv = defaultdict(set) for namespace, name in _identifier_filtered_iterator(graph): rv[namespace].add(name) return dict(rv)
[ "def", "get_names", "(", "graph", ")", ":", "rv", "=", "defaultdict", "(", "set", ")", "for", "namespace", ",", "name", "in", "_identifier_filtered_iterator", "(", "graph", ")", ":", "rv", "[", "namespace", "]", ".", "add", "(", "name", ")", "return", ...
Get all names for each namespace. :type graph: pybel.BELGraph :rtype: dict[str,set[str]]
[ "Get", "all", "names", "for", "each", "namespace", "." ]
python
train
Azure/blobxfer
blobxfer/operations/synccopy.py
https://github.com/Azure/blobxfer/blob/3eccbe7530cc6a20ab2d30f9e034b6f021817f34/blobxfer/operations/synccopy.py#L406-L472
def _process_synccopy_descriptor(self, sd): # type: (SyncCopy, blobxfer.models.synccopy.Descriptor) -> None """Process synccopy descriptor :param SyncCopy self: this :param blobxfer.models.synccopy.Descriptor sd: synccopy descriptor """ # update progress bar self....
[ "def", "_process_synccopy_descriptor", "(", "self", ",", "sd", ")", ":", "# type: (SyncCopy, blobxfer.models.synccopy.Descriptor) -> None", "# update progress bar", "self", ".", "_update_progress_bar", "(", ")", "# get download offsets", "offsets", ",", "resume_bytes", "=", "...
Process synccopy descriptor :param SyncCopy self: this :param blobxfer.models.synccopy.Descriptor sd: synccopy descriptor
[ "Process", "synccopy", "descriptor", ":", "param", "SyncCopy", "self", ":", "this", ":", "param", "blobxfer", ".", "models", ".", "synccopy", ".", "Descriptor", "sd", ":", "synccopy", "descriptor" ]
python
train
ethereum/py-trie
trie/smt.py
https://github.com/ethereum/py-trie/blob/d33108d21b54d59ee311f61d978496c84a6f1f8b/trie/smt.py#L271-L297
def _get(self, key: bytes) -> Tuple[bytes, Tuple[Hash32]]: """ Returns db value and branch in root->leaf order """ validate_is_bytes(key) validate_length(key, self._key_size) branch = [] target_bit = 1 << (self.depth - 1) path = to_int(key) node_h...
[ "def", "_get", "(", "self", ",", "key", ":", "bytes", ")", "->", "Tuple", "[", "bytes", ",", "Tuple", "[", "Hash32", "]", "]", ":", "validate_is_bytes", "(", "key", ")", "validate_length", "(", "key", ",", "self", ".", "_key_size", ")", "branch", "="...
Returns db value and branch in root->leaf order
[ "Returns", "db", "value", "and", "branch", "in", "root", "-", ">", "leaf", "order" ]
python
train
gabstopper/smc-python
smc/elements/netlink.py
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/netlink.py#L152-L176
def update_or_create(cls, with_status=False, **kwargs): """ Update or create static netlink. DNS entry differences are not resolved, instead any entries provided will be the final state for this netlink. If the intent is to add/remove DNS entries you can use the :meth:`~domain_se...
[ "def", "update_or_create", "(", "cls", ",", "with_status", "=", "False", ",", "*", "*", "kwargs", ")", ":", "dns_address", "=", "kwargs", ".", "pop", "(", "'domain_server_address'", ",", "[", "]", ")", "element", ",", "updated", ",", "created", "=", "sup...
Update or create static netlink. DNS entry differences are not resolved, instead any entries provided will be the final state for this netlink. If the intent is to add/remove DNS entries you can use the :meth:`~domain_server_address` method to add or remove. :raises Crea...
[ "Update", "or", "create", "static", "netlink", ".", "DNS", "entry", "differences", "are", "not", "resolved", "instead", "any", "entries", "provided", "will", "be", "the", "final", "state", "for", "this", "netlink", ".", "If", "the", "intent", "is", "to", "...
python
train
google/grr
grr/server/grr_response_server/gui/http_api.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/http_api.py#L106-L117
def _SetField(self, args, type_info, value): """Sets fields on the arg rdfvalue object.""" if hasattr(type_info, "enum"): try: coerced_obj = type_info.enum[value.upper()] except KeyError: # A bool is an enum but serializes to "1" / "0" which are both not in # enum or reverse_...
[ "def", "_SetField", "(", "self", ",", "args", ",", "type_info", ",", "value", ")", ":", "if", "hasattr", "(", "type_info", ",", "\"enum\"", ")", ":", "try", ":", "coerced_obj", "=", "type_info", ".", "enum", "[", "value", ".", "upper", "(", ")", "]",...
Sets fields on the arg rdfvalue object.
[ "Sets", "fields", "on", "the", "arg", "rdfvalue", "object", "." ]
python
train
bschollnick/semantic_url
semantic_url/__init__.py
https://github.com/bschollnick/semantic_url/blob/3c9b9e24354c0d4c5a2ce82006e610c5980395ad/semantic_url/__init__.py#L416-L431
def return_current_uri_subpage(self): """ Args: * None Returns: String - Returns the full postpath & semantic components *NOTE* may not contain the server & port numbers. That depends on what was provided to the parser. """ uri = post_s...
[ "def", "return_current_uri_subpage", "(", "self", ")", ":", "uri", "=", "post_slash", "(", "\"%s%s/%s/%s\"", "%", "(", "post_slash", "(", "self", ".", "current_dir", "(", ")", ")", ",", "self", ".", "slots", "[", "'page'", "]", ",", "self", ".", "slots",...
Args: * None Returns: String - Returns the full postpath & semantic components *NOTE* may not contain the server & port numbers. That depends on what was provided to the parser.
[ "Args", ":", "*", "None" ]
python
train
nkmathew/yasi-sexp-indenter
yasi.py
https://github.com/nkmathew/yasi-sexp-indenter/blob/6ec2a4675e79606c555bcb67494a0ba994b05805/yasi.py#L150-L164
def read_file(fname): """ read_file(fname : str) -> str >>> read_file(r'C:\\mine\\test.lisp') r'(print "No, no, there\'s \\r\\nlife in him!. ")\\r\\n\\r\\n' The file is read in binary mode in order to preserve original line endings. Line ending Binary mode Text mode CRLF ...
[ "def", "read_file", "(", "fname", ")", ":", "assert", "os", ".", "path", ".", "exists", "(", "fname", ")", ",", "\"\\n--%s-- Warning: File `%s' does not exist. . .\"", "%", "(", "current_time", "(", ")", ",", "fname", ")", "with", "open", "(", "fname", ",", ...
read_file(fname : str) -> str >>> read_file(r'C:\\mine\\test.lisp') r'(print "No, no, there\'s \\r\\nlife in him!. ")\\r\\n\\r\\n' The file is read in binary mode in order to preserve original line endings. Line ending Binary mode Text mode CRLF CRLF LF CR ...
[ "read_file", "(", "fname", ":", "str", ")", "-", ">", "str" ]
python
train
google/grr
grr/server/grr_response_server/flow_base.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/flow_base.py#L139-L165
def CallState(self, next_state="", start_time=None): """This method is used to schedule a new state on a different worker. This is basically the same as CallFlow() except we are calling ourselves. The state will be invoked at a later time. Args: next_state: The state in this flow to be invoked....
[ "def", "CallState", "(", "self", ",", "next_state", "=", "\"\"", ",", "start_time", "=", "None", ")", ":", "if", "not", "getattr", "(", "self", ",", "next_state", ")", ":", "raise", "ValueError", "(", "\"Next state %s is invalid.\"", "%", "next_state", ")", ...
This method is used to schedule a new state on a different worker. This is basically the same as CallFlow() except we are calling ourselves. The state will be invoked at a later time. Args: next_state: The state in this flow to be invoked. start_time: Start the flow at this time. This delays...
[ "This", "method", "is", "used", "to", "schedule", "a", "new", "state", "on", "a", "different", "worker", "." ]
python
train
tomplus/kubernetes_asyncio
kubernetes_asyncio/client/api/core_v1_api.py
https://github.com/tomplus/kubernetes_asyncio/blob/f9ab15317ec921409714c7afef11aeb0f579985d/kubernetes_asyncio/client/api/core_v1_api.py#L7823-L7852
def delete_collection_namespaced_limit_range(self, namespace, **kwargs): # noqa: E501 """delete_collection_namespaced_limit_range # noqa: E501 delete collection of LimitRange # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, p...
[ "def", "delete_collection_namespaced_limit_range", "(", "self", ",", "namespace", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'", ")", ":", "return", ...
delete_collection_namespaced_limit_range # noqa: E501 delete collection of LimitRange # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.delete_collection_namespaced_limit_range(namesp...
[ "delete_collection_namespaced_limit_range", "#", "noqa", ":", "E501" ]
python
train
erikrose/conway
bin/conway.py
https://github.com/erikrose/conway/blob/4c185d5f2d4b942a0710d7593926e7b749b16015/bin/conway.py#L98-L102
def draw(board, term, cells): """Draw a board to the terminal.""" for (x, y), state in board.iteritems(): with term.location(x, y): print cells[state],
[ "def", "draw", "(", "board", ",", "term", ",", "cells", ")", ":", "for", "(", "x", ",", "y", ")", ",", "state", "in", "board", ".", "iteritems", "(", ")", ":", "with", "term", ".", "location", "(", "x", ",", "y", ")", ":", "print", "cells", "...
Draw a board to the terminal.
[ "Draw", "a", "board", "to", "the", "terminal", "." ]
python
train
sentinel-hub/sentinelhub-py
sentinelhub/aws.py
https://github.com/sentinel-hub/sentinelhub-py/blob/08a83b7f1e289187159a643336995d8369860fea/sentinelhub/aws.py#L163-L175
def url_to_tile(url): """ Extracts tile name, date and AWS index from tile url on AWS. :param url: class input parameter 'metafiles' :type url: str :return: Name of tile, date and AWS index which uniquely identifies tile on AWS :rtype: (str, str, int) """ ...
[ "def", "url_to_tile", "(", "url", ")", ":", "info", "=", "url", ".", "strip", "(", "'/'", ")", ".", "split", "(", "'/'", ")", "name", "=", "''", ".", "join", "(", "info", "[", "-", "7", ":", "-", "4", "]", ")", "date", "=", "'-'", ".", "joi...
Extracts tile name, date and AWS index from tile url on AWS. :param url: class input parameter 'metafiles' :type url: str :return: Name of tile, date and AWS index which uniquely identifies tile on AWS :rtype: (str, str, int)
[ "Extracts", "tile", "name", "date", "and", "AWS", "index", "from", "tile", "url", "on", "AWS", "." ]
python
train
Kaggle/kaggle-api
kaggle/api/kaggle_api.py
https://github.com/Kaggle/kaggle-api/blob/65f14b1386470c5784d4753e491478e7537660d9/kaggle/api/kaggle_api.py#L2245-L2264
def kernel_push(self, kernel_push_request, **kwargs): # noqa: E501 """Push a new kernel version. Can be used to create a new kernel and update an existing one. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=Tr...
[ "def", "kernel_push", "(", "self", ",", "kernel_push_request", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'", ")", ":", "return", "self", ".", ...
Push a new kernel version. Can be used to create a new kernel and update an existing one. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.kernel_push(kernel_push_request, async_req=True) ...
[ "Push", "a", "new", "kernel", "version", ".", "Can", "be", "used", "to", "create", "a", "new", "kernel", "and", "update", "an", "existing", "one", ".", "#", "noqa", ":", "E501" ]
python
train
wglass/lighthouse
lighthouse/configs/handler.py
https://github.com/wglass/lighthouse/blob/f4ce6550895acc31e433ede0c05d366718a3ffe5/lighthouse/configs/handler.py#L45-L74
def on_created(self, event): """ Newly created config file handler. Parses the file's yaml contents and creates a new instance of the target_class with the results. Fires the on_add callback with the new instance. """ if os.path.isdir(event.src_path): ...
[ "def", "on_created", "(", "self", ",", "event", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "event", ".", "src_path", ")", ":", "return", "logger", ".", "debug", "(", "\"File created: %s\"", ",", "event", ".", "src_path", ")", "name", "=", ...
Newly created config file handler. Parses the file's yaml contents and creates a new instance of the target_class with the results. Fires the on_add callback with the new instance.
[ "Newly", "created", "config", "file", "handler", "." ]
python
train
ArchiveTeam/wpull
wpull/processor/coprocessor/youtubedl.py
https://github.com/ArchiveTeam/wpull/blob/ddf051aa3322479325ba20aa778cb2cb97606bf5/wpull/processor/coprocessor/youtubedl.py#L124-L134
def _get_output_template(self): '''Return the path prefix and output template.''' path = self._file_writer_session.extra_resource_path('.youtube-dl') if not path: self._temp_dir = tempfile.TemporaryDirectory( dir=self._root_path, prefix='tmp-wpull-youtubedl' ...
[ "def", "_get_output_template", "(", "self", ")", ":", "path", "=", "self", ".", "_file_writer_session", ".", "extra_resource_path", "(", "'.youtube-dl'", ")", "if", "not", "path", ":", "self", ".", "_temp_dir", "=", "tempfile", ".", "TemporaryDirectory", "(", ...
Return the path prefix and output template.
[ "Return", "the", "path", "prefix", "and", "output", "template", "." ]
python
train
aws/sagemaker-python-sdk
src/sagemaker/model.py
https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/model.py#L162-L209
def compile(self, target_instance_family, input_shape, output_path, role, tags=None, job_name=None, compile_max_run=5 * 60, framework=None, framework_version=None): """Compile this ``Model`` with SageMaker Neo. Args: target_instance_family (str): Identifies the device that y...
[ "def", "compile", "(", "self", ",", "target_instance_family", ",", "input_shape", ",", "output_path", ",", "role", ",", "tags", "=", "None", ",", "job_name", "=", "None", ",", "compile_max_run", "=", "5", "*", "60", ",", "framework", "=", "None", ",", "f...
Compile this ``Model`` with SageMaker Neo. Args: target_instance_family (str): Identifies the device that you want to run your model after compilation, for example: ml_c5. Allowed strings are: ml_c5, ml_m5, ml_c4, ml_m4, jetsontx1, jetsontx2, ml_p2, ml_p3, deeplens, ...
[ "Compile", "this", "Model", "with", "SageMaker", "Neo", "." ]
python
train
ioam/lancet
lancet/core.py
https://github.com/ioam/lancet/blob/1fbbf88fa0e8974ff9ed462e3cb11722ddebdd6e/lancet/core.py#L391-L404
def show(self, exclude=[]): """ Convenience method to inspect the available argument values in human-readable format. The ordering of keys is determined by how quickly they vary. The exclude list allows specific keys to be excluded for readability (e.g. to hide long, abs...
[ "def", "show", "(", "self", ",", "exclude", "=", "[", "]", ")", ":", "ordering", "=", "self", ".", "constant_keys", "+", "self", ".", "varying_keys", "spec_lines", "=", "[", "', '", ".", "join", "(", "[", "'%s=%s'", "%", "(", "k", ",", "s", "[", ...
Convenience method to inspect the available argument values in human-readable format. The ordering of keys is determined by how quickly they vary. The exclude list allows specific keys to be excluded for readability (e.g. to hide long, absolute filenames).
[ "Convenience", "method", "to", "inspect", "the", "available", "argument", "values", "in", "human", "-", "readable", "format", ".", "The", "ordering", "of", "keys", "is", "determined", "by", "how", "quickly", "they", "vary", "." ]
python
valid
materialsproject/pymatgen
pymatgen/io/abinit/tasks.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/tasks.py#L1890-L2052
def check_status(self): """ This function checks the status of the task by inspecting the output and the error files produced by the application and by the queue manager. """ # 1) see it the job is blocked # 2) see if an error occured at submitting the job the job was sub...
[ "def", "check_status", "(", "self", ")", ":", "# 1) see it the job is blocked", "# 2) see if an error occured at submitting the job the job was submitted, TODO these problems can be solved", "# 3) see if there is output", "# 4) see if abinit reports problems", "# 5) see if both err files exist a...
This function checks the status of the task by inspecting the output and the error files produced by the application and by the queue manager.
[ "This", "function", "checks", "the", "status", "of", "the", "task", "by", "inspecting", "the", "output", "and", "the", "error", "files", "produced", "by", "the", "application", "and", "by", "the", "queue", "manager", "." ]
python
train
summa-tx/riemann
riemann/tx/tx_builder.py
https://github.com/summa-tx/riemann/blob/04ae336dfd4007ceaed748daadc91cc32fa278ec/riemann/tx/tx_builder.py#L78-L87
def _make_output(value, output_script, version=None): ''' byte-like, byte-like -> TxOut ''' if 'decred' in riemann.get_current_network_name(): return tx.DecredTxOut( value=value, version=version, output_script=output_script) return tx.TxOut(value=value, ou...
[ "def", "_make_output", "(", "value", ",", "output_script", ",", "version", "=", "None", ")", ":", "if", "'decred'", "in", "riemann", ".", "get_current_network_name", "(", ")", ":", "return", "tx", ".", "DecredTxOut", "(", "value", "=", "value", ",", "versi...
byte-like, byte-like -> TxOut
[ "byte", "-", "like", "byte", "-", "like", "-", ">", "TxOut" ]
python
train
edwards-lab/libGWAS
libgwas/pedigree_parser.py
https://github.com/edwards-lab/libGWAS/blob/d68c9a083d443dfa5d7c5112de29010909cfe23f/libgwas/pedigree_parser.py#L83-L90
def ReportConfiguration(self, file): """ Report configuration for logging purposes. :param file: Destination for report details :return: None """ print >> file, BuildReportLine("PED FILE", self.datasource) print >> file, BuildReportLine("MAP FILE", self.mapfile)
[ "def", "ReportConfiguration", "(", "self", ",", "file", ")", ":", "print", ">>", "file", ",", "BuildReportLine", "(", "\"PED FILE\"", ",", "self", ".", "datasource", ")", "print", ">>", "file", ",", "BuildReportLine", "(", "\"MAP FILE\"", ",", "self", ".", ...
Report configuration for logging purposes. :param file: Destination for report details :return: None
[ "Report", "configuration", "for", "logging", "purposes", "." ]
python
train
tus/tus-py-client
tusclient/uploader.py
https://github.com/tus/tus-py-client/blob/0e5856efcfae6fc281171359ce38488a70468993/tusclient/uploader.py#L243-L251
def verify_upload(self): """ Confirm that the last upload was sucessful. Raises TusUploadFailed exception if the upload was not sucessful. """ if self.request.status_code == 204: return True else: raise TusUploadFailed('', self.request.status_code,...
[ "def", "verify_upload", "(", "self", ")", ":", "if", "self", ".", "request", ".", "status_code", "==", "204", ":", "return", "True", "else", ":", "raise", "TusUploadFailed", "(", "''", ",", "self", ".", "request", ".", "status_code", ",", "self", ".", ...
Confirm that the last upload was sucessful. Raises TusUploadFailed exception if the upload was not sucessful.
[ "Confirm", "that", "the", "last", "upload", "was", "sucessful", ".", "Raises", "TusUploadFailed", "exception", "if", "the", "upload", "was", "not", "sucessful", "." ]
python
train
lsst-sqre/lander
lander/config.py
https://github.com/lsst-sqre/lander/blob/5e4f6123e48b451ba21963724ace0dc59798618e/lander/config.py#L246-L296
def _get_docushare_url(handle, validate=True): """Get a docushare URL given document's handle. Parameters ---------- handle : `str` Handle name, such as ``'LDM-151'``. validate : `bool`, optional Set to `True` to request that the link resolves by performi...
[ "def", "_get_docushare_url", "(", "handle", ",", "validate", "=", "True", ")", ":", "logger", "=", "structlog", ".", "get_logger", "(", "__name__", ")", "logger", ".", "debug", "(", "'Using Configuration._get_docushare_url'", ")", "# Make a short link to the DocuShare...
Get a docushare URL given document's handle. Parameters ---------- handle : `str` Handle name, such as ``'LDM-151'``. validate : `bool`, optional Set to `True` to request that the link resolves by performing a HEAD request over the network. `False` di...
[ "Get", "a", "docushare", "URL", "given", "document", "s", "handle", "." ]
python
train
graphite-project/carbonate
carbonate/config.py
https://github.com/graphite-project/carbonate/blob/b876a85b321fbd7c18a6721bed2e7807b79b4929/carbonate/config.py#L21-L27
def destinations(self, cluster='main'): """Return a list of destinations for a cluster.""" if not self.config.has_section(cluster): raise SystemExit("Cluster '%s' not defined in %s" % (cluster, self.config_file)) destinations = self.config.get(cluster, 'd...
[ "def", "destinations", "(", "self", ",", "cluster", "=", "'main'", ")", ":", "if", "not", "self", ".", "config", ".", "has_section", "(", "cluster", ")", ":", "raise", "SystemExit", "(", "\"Cluster '%s' not defined in %s\"", "%", "(", "cluster", ",", "self",...
Return a list of destinations for a cluster.
[ "Return", "a", "list", "of", "destinations", "for", "a", "cluster", "." ]
python
train
ellmetha/django-machina
machina/apps/forum_member/views.py
https://github.com/ellmetha/django-machina/blob/89ac083c1eaf1cfdeae6686ee094cc86362e8c69/machina/apps/forum_member/views.py#L120-L123
def get_object(self, queryset=None): """ Returns the considered object. """ profile, dummy = ForumProfile.objects.get_or_create(user=self.request.user) return profile
[ "def", "get_object", "(", "self", ",", "queryset", "=", "None", ")", ":", "profile", ",", "dummy", "=", "ForumProfile", ".", "objects", ".", "get_or_create", "(", "user", "=", "self", ".", "request", ".", "user", ")", "return", "profile" ]
Returns the considered object.
[ "Returns", "the", "considered", "object", "." ]
python
train
pantsbuild/pants
src/python/pants/help/build_dictionary_info_extracter.py
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/help/build_dictionary_info_extracter.py#L111-L133
def get_arg_descriptions_from_docstring(cls, obj): """Returns an ordered map of arg name -> arg description found in :param: stanzas.""" ret = OrderedDict() name = '' doc = obj.__doc__ or '' lines = [s.strip() for s in doc.split('\n')] stanza_first_line_re = cls._get_stanza_first_line_re() ...
[ "def", "get_arg_descriptions_from_docstring", "(", "cls", ",", "obj", ")", ":", "ret", "=", "OrderedDict", "(", ")", "name", "=", "''", "doc", "=", "obj", ".", "__doc__", "or", "''", "lines", "=", "[", "s", ".", "strip", "(", ")", "for", "s", "in", ...
Returns an ordered map of arg name -> arg description found in :param: stanzas.
[ "Returns", "an", "ordered", "map", "of", "arg", "name", "-", ">", "arg", "description", "found", "in", ":", "param", ":", "stanzas", "." ]
python
train
ckan/deadoralive
deadoralive/deadoralive.py
https://github.com/ckan/deadoralive/blob/82eed6c73e17b9884476311a7a8fae9d2b379600/deadoralive/deadoralive.py#L124-L131
def upsert_result(client_site_url, apikey, resource_id, result): """Post the given link check result to the client site.""" # TODO: Handle exceptions and unexpected results. url = client_site_url + u"deadoralive/upsert" params = result.copy() params["resource_id"] = resource_id requests.post(ur...
[ "def", "upsert_result", "(", "client_site_url", ",", "apikey", ",", "resource_id", ",", "result", ")", ":", "# TODO: Handle exceptions and unexpected results.", "url", "=", "client_site_url", "+", "u\"deadoralive/upsert\"", "params", "=", "result", ".", "copy", "(", "...
Post the given link check result to the client site.
[ "Post", "the", "given", "link", "check", "result", "to", "the", "client", "site", "." ]
python
train
istommao/django-simditor
simditor/utils.py
https://github.com/istommao/django-simditor/blob/1d9fe00481f463c67f88d73ec6593a721f5fb469/simditor/utils.py#L42-L46
def is_valid_image_extension(file_path): """is_valid_image_extension.""" valid_extensions = ['.jpeg', '.jpg', '.gif', '.png'] _, extension = os.path.splitext(file_path) return extension.lower() in valid_extensions
[ "def", "is_valid_image_extension", "(", "file_path", ")", ":", "valid_extensions", "=", "[", "'.jpeg'", ",", "'.jpg'", ",", "'.gif'", ",", "'.png'", "]", "_", ",", "extension", "=", "os", ".", "path", ".", "splitext", "(", "file_path", ")", "return", "exte...
is_valid_image_extension.
[ "is_valid_image_extension", "." ]
python
train
Sheeprider/BitBucket-api
bitbucket/issue_comment.py
https://github.com/Sheeprider/BitBucket-api/blob/be45515d506d87f14807a676f3c2f20d79674b75/bitbucket/issue_comment.py#L44-L55
def create(self, issue_id=None, repo_slug=None, **kwargs): """ Add an issue comment to one of your repositories. Each issue comment require only the content data field the system autopopulate the rest. """ issue_id = issue_id or self.issue_id repo_slug = repo_slug...
[ "def", "create", "(", "self", ",", "issue_id", "=", "None", ",", "repo_slug", "=", "None", ",", "*", "*", "kwargs", ")", ":", "issue_id", "=", "issue_id", "or", "self", ".", "issue_id", "repo_slug", "=", "repo_slug", "or", "self", ".", "bitbucket", "."...
Add an issue comment to one of your repositories. Each issue comment require only the content data field the system autopopulate the rest.
[ "Add", "an", "issue", "comment", "to", "one", "of", "your", "repositories", ".", "Each", "issue", "comment", "require", "only", "the", "content", "data", "field", "the", "system", "autopopulate", "the", "rest", "." ]
python
train
Qiskit/qiskit-terra
qiskit/quantum_info/operators/pauli.py
https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/operators/pauli.py#L82-L110
def from_label(cls, label): r"""Take pauli string to construct pauli. The qubit index of pauli label is q_{n-1} ... q_0. E.g., a pauli is $P_{n-1} \otimes ... \otimes P_0$ Args: label (str): pauli label Returns: Pauli: the constructed pauli Rai...
[ "def", "from_label", "(", "cls", ",", "label", ")", ":", "z", "=", "np", ".", "zeros", "(", "len", "(", "label", ")", ",", "dtype", "=", "np", ".", "bool", ")", "x", "=", "np", ".", "zeros", "(", "len", "(", "label", ")", ",", "dtype", "=", ...
r"""Take pauli string to construct pauli. The qubit index of pauli label is q_{n-1} ... q_0. E.g., a pauli is $P_{n-1} \otimes ... \otimes P_0$ Args: label (str): pauli label Returns: Pauli: the constructed pauli Raises: QiskitError: invali...
[ "r", "Take", "pauli", "string", "to", "construct", "pauli", "." ]
python
test
sci-bots/dmf-device-ui
dmf_device_ui/view.py
https://github.com/sci-bots/dmf-device-ui/blob/05b480683c9fa43f91ce5a58de2fa90cdf363fc8/dmf_device_ui/view.py#L288-L308
def on_canvas_slave__route_electrode_added(self, slave, electrode_id): ''' .. versionchanged:: 0.11 Draw temporary route currently being formed. .. versionchanged:: 0.11.3 Update routes table by setting ``df_routes`` property of :attr:`canvas_slave`. ...
[ "def", "on_canvas_slave__route_electrode_added", "(", "self", ",", "slave", ",", "electrode_id", ")", ":", "logger", ".", "debug", "(", "'Route electrode added: %s'", ",", "electrode_id", ")", "if", "slave", ".", "_route", ".", "electrode_ids", "is", "None", ":", ...
.. versionchanged:: 0.11 Draw temporary route currently being formed. .. versionchanged:: 0.11.3 Update routes table by setting ``df_routes`` property of :attr:`canvas_slave`.
[ "..", "versionchanged", "::", "0", ".", "11", "Draw", "temporary", "route", "currently", "being", "formed", "." ]
python
train
devassistant/devassistant
devassistant/gui/gui_helper.py
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/gui_helper.py#L418-L431
def create_textview(self, wrap_mode=Gtk.WrapMode.WORD_CHAR, justify=Gtk.Justification.LEFT, visible=True, editable=True): """ Function creates a text view with wrap_mode and justification """ text_view = Gtk.TextView() text_view.set_wrap_mode(wrap_mode) text_view....
[ "def", "create_textview", "(", "self", ",", "wrap_mode", "=", "Gtk", ".", "WrapMode", ".", "WORD_CHAR", ",", "justify", "=", "Gtk", ".", "Justification", ".", "LEFT", ",", "visible", "=", "True", ",", "editable", "=", "True", ")", ":", "text_view", "=", ...
Function creates a text view with wrap_mode and justification
[ "Function", "creates", "a", "text", "view", "with", "wrap_mode", "and", "justification" ]
python
train
apache/incubator-mxnet
example/ctc/captcha_generator.py
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/example/ctc/captcha_generator.py#L126-L134
def _gen_sample(self): """Generate a random captcha image sample Returns ------- (numpy.ndarray, str) Tuple of image (numpy ndarray) and character string of digits used to generate the image """ num_str = self.get_rand(self.num_digit_min, self.num_digit_max) ...
[ "def", "_gen_sample", "(", "self", ")", ":", "num_str", "=", "self", ".", "get_rand", "(", "self", ".", "num_digit_min", ",", "self", ".", "num_digit_max", ")", "return", "self", ".", "captcha", ".", "image", "(", "num_str", ")", ",", "num_str" ]
Generate a random captcha image sample Returns ------- (numpy.ndarray, str) Tuple of image (numpy ndarray) and character string of digits used to generate the image
[ "Generate", "a", "random", "captcha", "image", "sample", "Returns", "-------", "(", "numpy", ".", "ndarray", "str", ")", "Tuple", "of", "image", "(", "numpy", "ndarray", ")", "and", "character", "string", "of", "digits", "used", "to", "generate", "the", "i...
python
train
mikicz/arca
arca/utils.py
https://github.com/mikicz/arca/blob/e67fdc00be473ecf8ec16d024e1a3f2c47ca882c/arca/utils.py#L96-L139
def get(self, *keys: str, default: Any = NOT_SET) -> Any: """ Returns values from the settings in the order of keys, the first value encountered is used. Example: >>> settings = Settings({"ARCA_ONE": 1, "ARCA_TWO": 2}) >>> settings.get("one") 1 >>> settings.get("one", "...
[ "def", "get", "(", "self", ",", "*", "keys", ":", "str", ",", "default", ":", "Any", "=", "NOT_SET", ")", "->", "Any", ":", "if", "not", "len", "(", "keys", ")", ":", "raise", "ValueError", "(", "\"At least one key must be provided.\"", ")", "for", "op...
Returns values from the settings in the order of keys, the first value encountered is used. Example: >>> settings = Settings({"ARCA_ONE": 1, "ARCA_TWO": 2}) >>> settings.get("one") 1 >>> settings.get("one", "two") 1 >>> settings.get("two", "one") 2 ...
[ "Returns", "values", "from", "the", "settings", "in", "the", "order", "of", "keys", "the", "first", "value", "encountered", "is", "used", "." ]
python
train
IndicoDataSolutions/IndicoIo-python
indicoio/custom/custom.py
https://github.com/IndicoDataSolutions/IndicoIo-python/blob/6f262a23f09d76fede63d1ccb87f9f7cf2cfc8aa/indicoio/custom/custom.py#L262-L267
def info(self, cloud=None, api_key=None, version=None, **kwargs): """ Return the current state of the model associated with a given collection """ url_params = {"batch": False, "api_key": api_key, "version": version, "method": "info"} return self._api_handler(None, cloud=cloud, a...
[ "def", "info", "(", "self", ",", "cloud", "=", "None", ",", "api_key", "=", "None", ",", "version", "=", "None", ",", "*", "*", "kwargs", ")", ":", "url_params", "=", "{", "\"batch\"", ":", "False", ",", "\"api_key\"", ":", "api_key", ",", "\"version...
Return the current state of the model associated with a given collection
[ "Return", "the", "current", "state", "of", "the", "model", "associated", "with", "a", "given", "collection" ]
python
train
jadolg/rocketchat_API
rocketchat_API/rocketchat.py
https://github.com/jadolg/rocketchat_API/blob/f220d094434991cb9892418245f054ea06f28aad/rocketchat_API/rocketchat.py#L372-L374
def channels_set_type(self, room_id, a_type, **kwargs): """Sets the type of room this channel should be. The type of room this channel should be, either c or p.""" return self.__call_api_post('channels.setType', roomId=room_id, type=a_type, kwargs=kwargs)
[ "def", "channels_set_type", "(", "self", ",", "room_id", ",", "a_type", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "__call_api_post", "(", "'channels.setType'", ",", "roomId", "=", "room_id", ",", "type", "=", "a_type", ",", "kwargs", "=", ...
Sets the type of room this channel should be. The type of room this channel should be, either c or p.
[ "Sets", "the", "type", "of", "room", "this", "channel", "should", "be", ".", "The", "type", "of", "room", "this", "channel", "should", "be", "either", "c", "or", "p", "." ]
python
train
jwhitlock/drf-cached-instances
sample_poll_app/cache.py
https://github.com/jwhitlock/drf-cached-instances/blob/ec4e8a6e1e83eeea6ec0b924b2eaa40a38d5963a/sample_poll_app/cache.py#L106-L114
def choice_default_loader(self, pk): """Load a Choice from the database.""" try: obj = Choice.objects.get(pk=pk) except Choice.DoesNotExist: return None else: self.choice_default_add_related_pks(obj) return obj
[ "def", "choice_default_loader", "(", "self", ",", "pk", ")", ":", "try", ":", "obj", "=", "Choice", ".", "objects", ".", "get", "(", "pk", "=", "pk", ")", "except", "Choice", ".", "DoesNotExist", ":", "return", "None", "else", ":", "self", ".", "choi...
Load a Choice from the database.
[ "Load", "a", "Choice", "from", "the", "database", "." ]
python
train
blubberdiblub/eztemplate
eztemplate/__main__.py
https://github.com/blubberdiblub/eztemplate/blob/ab5b2b4987c045116d130fd83e216704b8edfb5d/eztemplate/__main__.py#L220-L227
def dump_engines(target=sys.stderr): """Print successfully imported templating engines.""" print("Available templating engines:", file=target) width = max(len(engine) for engine in engines.engines) for handle, engine in sorted(engines.engines.items()): description = engine.__doc__.split('\n', 0...
[ "def", "dump_engines", "(", "target", "=", "sys", ".", "stderr", ")", ":", "print", "(", "\"Available templating engines:\"", ",", "file", "=", "target", ")", "width", "=", "max", "(", "len", "(", "engine", ")", "for", "engine", "in", "engines", ".", "en...
Print successfully imported templating engines.
[ "Print", "successfully", "imported", "templating", "engines", "." ]
python
train
lokhman/pydbal
pydbal/connection.py
https://github.com/lokhman/pydbal/blob/53f396a2a18826e9fff178cd2c0636c1656cbaea/pydbal/connection.py#L504-L514
def release_savepoint(self, savepoint): """Releases the given savepoint. :param savepoint: the name of the savepoint to release :raise: pydbal.exception.DBALConnectionError """ if not self._platform.is_savepoints_supported(): raise DBALConnectionError.savepoints_not_...
[ "def", "release_savepoint", "(", "self", ",", "savepoint", ")", ":", "if", "not", "self", ".", "_platform", ".", "is_savepoints_supported", "(", ")", ":", "raise", "DBALConnectionError", ".", "savepoints_not_supported", "(", ")", "if", "self", ".", "_platform", ...
Releases the given savepoint. :param savepoint: the name of the savepoint to release :raise: pydbal.exception.DBALConnectionError
[ "Releases", "the", "given", "savepoint", "." ]
python
train
Archived-Object/ligament
ligament/helpers.py
https://github.com/Archived-Object/ligament/blob/ff3d78130522676a20dc64086dc8a27b197cc20f/ligament/helpers.py#L65-L67
def compose(*funcs): """compose a list of functions""" return lambda x: reduce(lambda v, f: f(v), reversed(funcs), x)
[ "def", "compose", "(", "*", "funcs", ")", ":", "return", "lambda", "x", ":", "reduce", "(", "lambda", "v", ",", "f", ":", "f", "(", "v", ")", ",", "reversed", "(", "funcs", ")", ",", "x", ")" ]
compose a list of functions
[ "compose", "a", "list", "of", "functions" ]
python
train
timothydmorton/VESPA
vespa/stars/utils.py
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/utils.py#L176-L183
def fluxfrac(*mags): """Returns fraction of total flux in first argument, assuming all are magnitudes. """ Ftot = 0 for mag in mags: Ftot += 10**(-0.4*mag) F1 = 10**(-0.4*mags[0]) return F1/Ftot
[ "def", "fluxfrac", "(", "*", "mags", ")", ":", "Ftot", "=", "0", "for", "mag", "in", "mags", ":", "Ftot", "+=", "10", "**", "(", "-", "0.4", "*", "mag", ")", "F1", "=", "10", "**", "(", "-", "0.4", "*", "mags", "[", "0", "]", ")", "return",...
Returns fraction of total flux in first argument, assuming all are magnitudes.
[ "Returns", "fraction", "of", "total", "flux", "in", "first", "argument", "assuming", "all", "are", "magnitudes", "." ]
python
train
rsgalloway/grit
grit/repo/local.py
https://github.com/rsgalloway/grit/blob/e6434ad8a1f4ac5d0903ebad630c81f8a5164d78/grit/repo/local.py#L159-L169
def setVersion(self, version): """ Checkout a version of the repo. :param version: Version number. """ try: sha = self.versions(version).commit.sha self.git.reset("--hard", sha) except Exception, e: raise RepoError(e)
[ "def", "setVersion", "(", "self", ",", "version", ")", ":", "try", ":", "sha", "=", "self", ".", "versions", "(", "version", ")", ".", "commit", ".", "sha", "self", ".", "git", ".", "reset", "(", "\"--hard\"", ",", "sha", ")", "except", "Exception", ...
Checkout a version of the repo. :param version: Version number.
[ "Checkout", "a", "version", "of", "the", "repo", "." ]
python
train
iancmcc/ouimeaux
ouimeaux/pysignals/dispatcher.py
https://github.com/iancmcc/ouimeaux/blob/89f3d05e7ae0a356690f898a4e1801ea3c104200/ouimeaux/pysignals/dispatcher.py#L257-L294
def _live_receivers(self, sender): """ Filter sequence of receivers to get resolved, live receivers. This checks for weak references and resolves them, then returning only live receivers. """ receivers = None if self.use_caching and not self._dead_receivers: ...
[ "def", "_live_receivers", "(", "self", ",", "sender", ")", ":", "receivers", "=", "None", "if", "self", ".", "use_caching", "and", "not", "self", ".", "_dead_receivers", ":", "receivers", "=", "self", ".", "sender_receivers_cache", ".", "get", "(", "sender",...
Filter sequence of receivers to get resolved, live receivers. This checks for weak references and resolves them, then returning only live receivers.
[ "Filter", "sequence", "of", "receivers", "to", "get", "resolved", "live", "receivers", "." ]
python
train
CalebBell/ht
ht/conv_plate.py
https://github.com/CalebBell/ht/blob/3097ef9524c4cf0068ad453c17b10ec9ce551eee/ht/conv_plate.py#L51-L147
def Nu_plate_Kumar(Re, Pr, chevron_angle, mu=None, mu_wall=None): r'''Calculates Nusselt number for single-phase flow in a **well-designed** Chevron-style plate heat exchanger according to [1]_. The data is believed to have been developed by APV International Limited, since acquired by SPX Corporation....
[ "def", "Nu_plate_Kumar", "(", "Re", ",", "Pr", ",", "chevron_angle", ",", "mu", "=", "None", ",", "mu_wall", "=", "None", ")", ":", "# Uses the standard diameter as characteristic diameter", "beta_list_len", "=", "len", "(", "Kumar_beta_list", ")", "for", "i", "...
r'''Calculates Nusselt number for single-phase flow in a **well-designed** Chevron-style plate heat exchanger according to [1]_. The data is believed to have been developed by APV International Limited, since acquired by SPX Corporation. This uses a curve fit of that data published in [2]_. .....
[ "r", "Calculates", "Nusselt", "number", "for", "single", "-", "phase", "flow", "in", "a", "**", "well", "-", "designed", "**", "Chevron", "-", "style", "plate", "heat", "exchanger", "according", "to", "[", "1", "]", "_", ".", "The", "data", "is", "beli...
python
train
saltstack/salt
salt/modules/vsphere.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vsphere.py#L1189-L1283
def reset_syslog_config(host, username, password, protocol=None, port=None, syslog_config=None, esxi_hosts=None, credstore=None): ''' Reset the ...
[ "def", "reset_syslog_config", "(", "host", ",", "username", ",", "password", ",", "protocol", "=", "None", ",", "port", "=", "None", ",", "syslog_config", "=", "None", ",", "esxi_hosts", "=", "None", ",", "credstore", "=", "None", ")", ":", "if", "not", ...
Reset the syslog service to its default settings. Valid syslog_config values are ``logdir``, ``loghost``, ``logdir-unique``, ``default-rotate``, ``default-size``, ``default-timeout``, or ``all`` for all of these. host The location of the host. username The username used to login t...
[ "Reset", "the", "syslog", "service", "to", "its", "default", "settings", "." ]
python
train
MagicStack/asyncpg
asyncpg/connect_utils.py
https://github.com/MagicStack/asyncpg/blob/92c2d81256a1efd8cab12c0118d74ccd1c18131b/asyncpg/connect_utils.py#L105-L139
def _read_password_from_pgpass( *, passfile: typing.Optional[pathlib.Path], hosts: typing.List[str], ports: typing.List[int], database: str, user: str): """Parse the pgpass file and return the matching password. :return: Password string, if found, ``None`` otherw...
[ "def", "_read_password_from_pgpass", "(", "*", ",", "passfile", ":", "typing", ".", "Optional", "[", "pathlib", ".", "Path", "]", ",", "hosts", ":", "typing", ".", "List", "[", "str", "]", ",", "ports", ":", "typing", ".", "List", "[", "int", "]", ",...
Parse the pgpass file and return the matching password. :return: Password string, if found, ``None`` otherwise.
[ "Parse", "the", "pgpass", "file", "and", "return", "the", "matching", "password", "." ]
python
train
treycucco/pyebnf
pyebnf/primitive.py
https://github.com/treycucco/pyebnf/blob/3634ddabbe5d73508bcc20f4a591f86a46634e1d/pyebnf/primitive.py#L162-L174
def merged(self, other): """Returns a new ParseNode whose type is this node's type, and whose children are all the children from this node and the other whose length is not 0. """ children = [c for c in itertools.chain(self.children, other.children) if len(c) > 0] # NOTE: Only terminals should have ...
[ "def", "merged", "(", "self", ",", "other", ")", ":", "children", "=", "[", "c", "for", "c", "in", "itertools", ".", "chain", "(", "self", ".", "children", ",", "other", ".", "children", ")", "if", "len", "(", "c", ")", ">", "0", "]", "# NOTE: On...
Returns a new ParseNode whose type is this node's type, and whose children are all the children from this node and the other whose length is not 0.
[ "Returns", "a", "new", "ParseNode", "whose", "type", "is", "this", "node", "s", "type", "and", "whose", "children", "are", "all", "the", "children", "from", "this", "node", "and", "the", "other", "whose", "length", "is", "not", "0", "." ]
python
test
CI-WATER/mapkit
mapkit/RasterLoader.py
https://github.com/CI-WATER/mapkit/blob/ce5fbded6af7adabdf1eec85631c6811ef8ecc34/mapkit/RasterLoader.py#L35-L80
def load(self, tableName='rasters', rasters=[]): ''' Accepts a list of paths to raster files to load into the database. Returns the ids of the rasters loaded successfully in the same order as the list passed in. ''' # Create table if necessary Base.metadata.create...
[ "def", "load", "(", "self", ",", "tableName", "=", "'rasters'", ",", "rasters", "=", "[", "]", ")", ":", "# Create table if necessary", "Base", ".", "metadata", ".", "create_all", "(", "self", ".", "_engine", ")", "# Create a session", "Session", "=", "sessi...
Accepts a list of paths to raster files to load into the database. Returns the ids of the rasters loaded successfully in the same order as the list passed in.
[ "Accepts", "a", "list", "of", "paths", "to", "raster", "files", "to", "load", "into", "the", "database", ".", "Returns", "the", "ids", "of", "the", "rasters", "loaded", "successfully", "in", "the", "same", "order", "as", "the", "list", "passed", "in", "....
python
train
mongolab/dex
dex/analyzer.py
https://github.com/mongolab/dex/blob/f6dc27321028ef1ffdb3d4b1165fdcce7c8f20aa/dex/analyzer.py#L91-L112
def _ensure_index_cache(self, db_uri, db_name, collection_name): """Adds a collections index entries to the cache if not present""" if not self._check_indexes or db_uri is None: return {'indexes': None} if db_name not in self.get_cache(): self._internal_map[db_name] = {} ...
[ "def", "_ensure_index_cache", "(", "self", ",", "db_uri", ",", "db_name", ",", "collection_name", ")", ":", "if", "not", "self", ".", "_check_indexes", "or", "db_uri", "is", "None", ":", "return", "{", "'indexes'", ":", "None", "}", "if", "db_name", "not",...
Adds a collections index entries to the cache if not present
[ "Adds", "a", "collections", "index", "entries", "to", "the", "cache", "if", "not", "present" ]
python
train
nion-software/nionswift
nion/swift/model/DocumentModel.py
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/DocumentModel.py#L2072-L2113
def __construct_data_item_reference(self, hardware_source: HardwareSource.HardwareSource, data_channel: HardwareSource.DataChannel): """Construct a data item reference. Construct a data item reference and assign a data item to it. Update data item session id and session metadata. Also connect t...
[ "def", "__construct_data_item_reference", "(", "self", ",", "hardware_source", ":", "HardwareSource", ".", "HardwareSource", ",", "data_channel", ":", "HardwareSource", ".", "DataChannel", ")", ":", "session_id", "=", "self", ".", "session_id", "key", "=", "self", ...
Construct a data item reference. Construct a data item reference and assign a data item to it. Update data item session id and session metadata. Also connect the data channel processor. This method is thread safe.
[ "Construct", "a", "data", "item", "reference", "." ]
python
train
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/nbformat/v3/nbbase.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/nbformat/v3/nbbase.py#L194-L205
def new_author(name=None, email=None, affiliation=None, url=None): """Create a new author.""" author = NotebookNode() if name is not None: author.name = unicode(name) if email is not None: author.email = unicode(email) if affiliation is not None: author.affiliation = unicode(...
[ "def", "new_author", "(", "name", "=", "None", ",", "email", "=", "None", ",", "affiliation", "=", "None", ",", "url", "=", "None", ")", ":", "author", "=", "NotebookNode", "(", ")", "if", "name", "is", "not", "None", ":", "author", ".", "name", "=...
Create a new author.
[ "Create", "a", "new", "author", "." ]
python
test
nesaro/pydsl
pydsl/parser/LR0.py
https://github.com/nesaro/pydsl/blob/00b4fffd72036b80335e1a44a888fac57917ab41/pydsl/parser/LR0.py#L97-L134
def _slr_build_parser_table(productionset): """SLR method to build parser table""" result = ParserTable() statesset = build_states_sets(productionset) for itemindex, itemset in enumerate(statesset): LOG.debug("_slr_build_parser_table: Evaluating itemset:" + str(itemset)) for symbol in pr...
[ "def", "_slr_build_parser_table", "(", "productionset", ")", ":", "result", "=", "ParserTable", "(", ")", "statesset", "=", "build_states_sets", "(", "productionset", ")", "for", "itemindex", ",", "itemset", "in", "enumerate", "(", "statesset", ")", ":", "LOG", ...
SLR method to build parser table
[ "SLR", "method", "to", "build", "parser", "table" ]
python
train
bloomberg/bqplot
bqplot/pyplot.py
https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/pyplot.py#L1268-L1278
def clear(): """Clears the current context figure of all marks axes and grid lines.""" fig = _context['figure'] if fig is not None: fig.marks = [] fig.axes = [] setattr(fig, 'axis_registry', {}) _context['scales'] = {} key = _context['current_key'] if key is n...
[ "def", "clear", "(", ")", ":", "fig", "=", "_context", "[", "'figure'", "]", "if", "fig", "is", "not", "None", ":", "fig", ".", "marks", "=", "[", "]", "fig", ".", "axes", "=", "[", "]", "setattr", "(", "fig", ",", "'axis_registry'", ",", "{", ...
Clears the current context figure of all marks axes and grid lines.
[ "Clears", "the", "current", "context", "figure", "of", "all", "marks", "axes", "and", "grid", "lines", "." ]
python
train
inonit/drf-haystack
drf_haystack/serializers.py
https://github.com/inonit/drf-haystack/blob/ceabd0f6318f129758341ab08292a20205d6f4cd/drf_haystack/serializers.py#L283-L318
def get_paginate_by_param(self): """ Returns the ``paginate_by_param`` for the (root) view paginator class. This is needed in order to remove the query parameter from faceted narrow urls. If using a custom pagination class, this class attribute needs to be set manually. ...
[ "def", "get_paginate_by_param", "(", "self", ")", ":", "if", "hasattr", "(", "self", ".", "root", ",", "\"paginate_by_param\"", ")", "and", "self", ".", "root", ".", "paginate_by_param", ":", "return", "self", ".", "root", ".", "paginate_by_param", "pagination...
Returns the ``paginate_by_param`` for the (root) view paginator class. This is needed in order to remove the query parameter from faceted narrow urls. If using a custom pagination class, this class attribute needs to be set manually.
[ "Returns", "the", "paginate_by_param", "for", "the", "(", "root", ")", "view", "paginator", "class", ".", "This", "is", "needed", "in", "order", "to", "remove", "the", "query", "parameter", "from", "faceted", "narrow", "urls", "." ]
python
train