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
SUNCAT-Center/CatHub
cathub/reaction_networks.py
https://github.com/SUNCAT-Center/CatHub/blob/324625d1d8e740673f139658b2de4c9e1059739e/cathub/reaction_networks.py#L276-L293
def get_ZPE(viblist): """Returns the zero point energy from a list of frequencies. Parameters ---------- viblist : List of numbers or string of list of numbers. Returns ------- ZPE : Zero point energy in eV. """ if type(viblist) is str: l = ast.literal_eval(viblist) els...
[ "def", "get_ZPE", "(", "viblist", ")", ":", "if", "type", "(", "viblist", ")", "is", "str", ":", "l", "=", "ast", ".", "literal_eval", "(", "viblist", ")", "else", ":", "l", "=", "viblist", "l", "=", "[", "float", "(", "w", ")", "for", "w", "in...
Returns the zero point energy from a list of frequencies. Parameters ---------- viblist : List of numbers or string of list of numbers. Returns ------- ZPE : Zero point energy in eV.
[ "Returns", "the", "zero", "point", "energy", "from", "a", "list", "of", "frequencies", "." ]
python
train
odlgroup/odl
odl/set/sets.py
https://github.com/odlgroup/odl/blob/b8443f6aca90e191ba36c91d32253c5a36249a6c/odl/set/sets.py#L694-L708
def element(self, inp=None): """Create a new element. First tries calling the first set, then the second, etc. For more specific control, use ``set[i].element()`` to pick which subset to use. """ for set in self.sets: try: return set.element(...
[ "def", "element", "(", "self", ",", "inp", "=", "None", ")", ":", "for", "set", "in", "self", ".", "sets", ":", "try", ":", "return", "set", ".", "element", "(", "inp", ")", "except", "NotImplementedError", ":", "pass", "raise", "NotImplementedError", ...
Create a new element. First tries calling the first set, then the second, etc. For more specific control, use ``set[i].element()`` to pick which subset to use.
[ "Create", "a", "new", "element", "." ]
python
train
pmorissette/bt
bt/core.py
https://github.com/pmorissette/bt/blob/0363e6fa100d9392dd18e32e3d8379d5e83c28fa/bt/core.py#L1217-L1223
def name(self): """ Algo name. """ if self._name is None: self._name = self.__class__.__name__ return self._name
[ "def", "name", "(", "self", ")", ":", "if", "self", ".", "_name", "is", "None", ":", "self", ".", "_name", "=", "self", ".", "__class__", ".", "__name__", "return", "self", ".", "_name" ]
Algo name.
[ "Algo", "name", "." ]
python
train
pkgw/pwkit
pwkit/numutil.py
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/numutil.py#L366-L420
def usmooth (window, uncerts, *data, **kwargs): """Smooth data series according to a window, weighting based on uncertainties. Arguments: window The smoothing window. uncerts An array of uncertainties used to weight the smoothing. data One or more data series, of the same size as...
[ "def", "usmooth", "(", "window", ",", "uncerts", ",", "*", "data", ",", "*", "*", "kwargs", ")", ":", "window", "=", "np", ".", "asarray", "(", "window", ")", "uncerts", "=", "np", ".", "asarray", "(", "uncerts", ")", "# Hacky keyword argument handling b...
Smooth data series according to a window, weighting based on uncertainties. Arguments: window The smoothing window. uncerts An array of uncertainties used to weight the smoothing. data One or more data series, of the same size as *uncerts*. k = None If specified, only every...
[ "Smooth", "data", "series", "according", "to", "a", "window", "weighting", "based", "on", "uncertainties", "." ]
python
train
AlecAivazis/graphql-over-kafka
nautilus/network/events/consumers/kafka.py
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/network/events/consumers/kafka.py#L97-L111
def stop(self): """ This method stops the brokers interaction with the kafka stream """ self.loop.run_until_complete(self._consumer.stop()) self.loop.run_until_complete(self._producer.stop()) # attempt try: # to cancel the service self...
[ "def", "stop", "(", "self", ")", ":", "self", ".", "loop", ".", "run_until_complete", "(", "self", ".", "_consumer", ".", "stop", "(", ")", ")", "self", ".", "loop", ".", "run_until_complete", "(", "self", ".", "_producer", ".", "stop", "(", ")", ")"...
This method stops the brokers interaction with the kafka stream
[ "This", "method", "stops", "the", "brokers", "interaction", "with", "the", "kafka", "stream" ]
python
train
Kunstmord/datalib
src/dataset.py
https://github.com/Kunstmord/datalib/blob/9d7db3e7c3a5feeeb5d19eb0dbee858bd2b50886/src/dataset.py#L138-L171
def return_features_base(dbpath, set_object, names): """ Generic function which returns a list of extracted features from the database Parameters ---------- dbpath : string, path to SQLite database file set_object : object (either TestSet or TrainSet) which is stored in the database names :...
[ "def", "return_features_base", "(", "dbpath", ",", "set_object", ",", "names", ")", ":", "engine", "=", "create_engine", "(", "'sqlite:////'", "+", "dbpath", ")", "session_cl", "=", "sessionmaker", "(", "bind", "=", "engine", ")", "session", "=", "session_cl",...
Generic function which returns a list of extracted features from the database Parameters ---------- dbpath : string, path to SQLite database file set_object : object (either TestSet or TrainSet) which is stored in the database names : list of strings, a list of feature names which are to be retriev...
[ "Generic", "function", "which", "returns", "a", "list", "of", "extracted", "features", "from", "the", "database" ]
python
train
mistio/mist.client
src/mistclient/__init__.py
https://github.com/mistio/mist.client/blob/bc190af2cba358fa556a69b205c12a77a34eb2a8/src/mistclient/__init__.py#L394-L412
def keys(self, id=None, search=None): """ Property-like function to call the _list_keys function in order to populate self._keys dict :returns: A list of Key instances """ if self._keys is None: self._keys = {} self._list_keys() if id: ...
[ "def", "keys", "(", "self", ",", "id", "=", "None", ",", "search", "=", "None", ")", ":", "if", "self", ".", "_keys", "is", "None", ":", "self", ".", "_keys", "=", "{", "}", "self", ".", "_list_keys", "(", ")", "if", "id", ":", "return", "[", ...
Property-like function to call the _list_keys function in order to populate self._keys dict :returns: A list of Key instances
[ "Property", "-", "like", "function", "to", "call", "the", "_list_keys", "function", "in", "order", "to", "populate", "self", ".", "_keys", "dict" ]
python
train
iotile/coretools
iotileemulate/iotile/emulate/virtual/state_log.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/virtual/state_log.py#L80-L108
def dump(self, out_path, header=True): """Save this list of changes as a csv file at out_path. The format of the output file will be a CSV with 4 columns: timestamp, tile address, property, string_value There will be a single header row starting the CSV output unless header=Fal...
[ "def", "dump", "(", "self", ",", "out_path", ",", "header", "=", "True", ")", ":", "# See https://stackoverflow.com/a/3348664/9739119 for why this is necessary", "if", "sys", ".", "version_info", "[", "0", "]", "<", "3", ":", "mode", "=", "\"wb\"", "else", ":", ...
Save this list of changes as a csv file at out_path. The format of the output file will be a CSV with 4 columns: timestamp, tile address, property, string_value There will be a single header row starting the CSV output unless header=False is passed. Args: out_path ...
[ "Save", "this", "list", "of", "changes", "as", "a", "csv", "file", "at", "out_path", "." ]
python
train
acorg/dark-matter
bin/write-htcondor-job-spec.py
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/bin/write-htcondor-job-spec.py#L44-L68
def splitFASTA(params): """ Read the FASTA file named params['fastaFile'] and print out its sequences into files named 0.fasta, 1.fasta, etc. with params['seqsPerJob'] sequences per file. """ assert params['fastaFile'][-1] == 'a', ('You must specify a file in ' ...
[ "def", "splitFASTA", "(", "params", ")", ":", "assert", "params", "[", "'fastaFile'", "]", "[", "-", "1", "]", "==", "'a'", ",", "(", "'You must specify a file in '", "'fasta-format that ends in '", "'.fasta'", ")", "fileCount", "=", "count", "=", "seqCount", ...
Read the FASTA file named params['fastaFile'] and print out its sequences into files named 0.fasta, 1.fasta, etc. with params['seqsPerJob'] sequences per file.
[ "Read", "the", "FASTA", "file", "named", "params", "[", "fastaFile", "]", "and", "print", "out", "its", "sequences", "into", "files", "named", "0", ".", "fasta", "1", ".", "fasta", "etc", ".", "with", "params", "[", "seqsPerJob", "]", "sequences", "per",...
python
train
f3at/feat
src/feat/agents/monitor/monitor_agent.py
https://github.com/f3at/feat/blob/15da93fc9d6ec8154f52a9172824e25821195ef8/src/feat/agents/monitor/monitor_agent.py#L810-L822
def _adopt_notifications(self, state): '''Part of the "monitor" restart strategy. The pending notifications from descriptor of dead agent are imported to our pending list.''' def iterator(): it = state.descriptor.pending_notifications.iteritems() for _, nots in it: ...
[ "def", "_adopt_notifications", "(", "self", ",", "state", ")", ":", "def", "iterator", "(", ")", ":", "it", "=", "state", ".", "descriptor", ".", "pending_notifications", ".", "iteritems", "(", ")", "for", "_", ",", "nots", "in", "it", ":", "for", "x",...
Part of the "monitor" restart strategy. The pending notifications from descriptor of dead agent are imported to our pending list.
[ "Part", "of", "the", "monitor", "restart", "strategy", ".", "The", "pending", "notifications", "from", "descriptor", "of", "dead", "agent", "are", "imported", "to", "our", "pending", "list", "." ]
python
train
pysal/mapclassify
mapclassify/classifiers.py
https://github.com/pysal/mapclassify/blob/5b22ec33f5802becf40557614d90cd38efa1676e/mapclassify/classifiers.py#L455-L473
def _update(self, data, *args, **kwargs): """ The only thing that *should* happen in this function is 1. input sanitization for pandas 2. classification/reclassification. Using their __init__ methods, all classifiers can re-classify given different input parameters or ad...
[ "def", "_update", "(", "self", ",", "data", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "data", "is", "not", "None", ":", "data", "=", "np", ".", "asarray", "(", "data", ")", ".", "flatten", "(", ")", "data", "=", "np", ".", "a...
The only thing that *should* happen in this function is 1. input sanitization for pandas 2. classification/reclassification. Using their __init__ methods, all classifiers can re-classify given different input parameters or additional data. If you've got a cleverer updating equa...
[ "The", "only", "thing", "that", "*", "should", "*", "happen", "in", "this", "function", "is", "1", ".", "input", "sanitization", "for", "pandas", "2", ".", "classification", "/", "reclassification", "." ]
python
train
waqasbhatti/astrobase
astrobase/periodbase/kbls.py
https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/periodbase/kbls.py#L76-L143
def _bls_runner(times, mags, nfreq, freqmin, stepsize, nbins, minduration, maxduration): '''This runs the pyeebls.eebls function using the given inputs. Parameters ---------- times,mags : np...
[ "def", "_bls_runner", "(", "times", ",", "mags", ",", "nfreq", ",", "freqmin", ",", "stepsize", ",", "nbins", ",", "minduration", ",", "maxduration", ")", ":", "workarr_u", "=", "npones", "(", "times", ".", "size", ")", "workarr_v", "=", "npones", "(", ...
This runs the pyeebls.eebls function using the given inputs. Parameters ---------- times,mags : np.array The input magnitude time-series to search for transits. nfreq : int The number of frequencies to use when searching for transits. freqmin : float The minimum frequency...
[ "This", "runs", "the", "pyeebls", ".", "eebls", "function", "using", "the", "given", "inputs", "." ]
python
valid
gabrielfalcao/dominic
dominic/xpath/expr.py
https://github.com/gabrielfalcao/dominic/blob/a42f418fc288f3b70cb95847b405eaf7b83bb3a0/dominic/xpath/expr.py#L35-L70
def document_order(node): """Compute a document order value for the node. cmp(document_order(a), document_order(b)) will return -1, 0, or 1 if a is before, identical to, or after b in the document respectively. We represent document order as a list of sibling indexes. That is, the third child of ...
[ "def", "document_order", "(", "node", ")", ":", "# Attributes: parent-order + [-1, attribute-name]", "if", "node", ".", "nodeType", "==", "node", ".", "ATTRIBUTE_NODE", ":", "order", "=", "document_order", "(", "node", ".", "ownerElement", ")", "order", ".", "exte...
Compute a document order value for the node. cmp(document_order(a), document_order(b)) will return -1, 0, or 1 if a is before, identical to, or after b in the document respectively. We represent document order as a list of sibling indexes. That is, the third child of the document node has an order of...
[ "Compute", "a", "document", "order", "value", "for", "the", "node", "." ]
python
train
coagulant/cleanweb
cleanweb.py
https://github.com/coagulant/cleanweb/blob/cc8f368d917037bf77772cd9fb068f898fd63d7e/cleanweb.py#L34-L48
def check_spam(self, ip=None, email=None, name=None, login=None, realname=None, subject=None, body=None, subject_type='plain', body_type='plain'): """ http://api.yandex.ru/cleanweb/doc/dg/concepts/check-spam.xml subject_type = plain|html|bbcode body_type = plain|html|b...
[ "def", "check_spam", "(", "self", ",", "ip", "=", "None", ",", "email", "=", "None", ",", "name", "=", "None", ",", "login", "=", "None", ",", "realname", "=", "None", ",", "subject", "=", "None", ",", "body", "=", "None", ",", "subject_type", "=",...
http://api.yandex.ru/cleanweb/doc/dg/concepts/check-spam.xml subject_type = plain|html|bbcode body_type = plain|html|bbcode
[ "http", ":", "//", "api", ".", "yandex", ".", "ru", "/", "cleanweb", "/", "doc", "/", "dg", "/", "concepts", "/", "check", "-", "spam", ".", "xml", "subject_type", "=", "plain|html|bbcode", "body_type", "=", "plain|html|bbcode" ]
python
train
JukeboxPipeline/jukeboxmaya
src/jukeboxmaya/menu.py
https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/menu.py#L188-L206
def create_menu(self, name, parent=None, **kwargs): """ Creates a maya menu or menu item :param name: Used to access a menu via its parent. Unless the nolabel flag is set to True, the name will also become the label of the menu. :type name: str :param parent: Optional - The parent menu....
[ "def", "create_menu", "(", "self", ",", "name", ",", "parent", "=", "None", ",", "*", "*", "kwargs", ")", ":", "m", "=", "Menu", "(", "name", ",", "parent", ",", "*", "*", "kwargs", ")", "if", "parent", "is", "None", ":", "self", ".", "menus", ...
Creates a maya menu or menu item :param name: Used to access a menu via its parent. Unless the nolabel flag is set to True, the name will also become the label of the menu. :type name: str :param parent: Optional - The parent menu. If None, this will create a toplevel menu. If parent menu is a ...
[ "Creates", "a", "maya", "menu", "or", "menu", "item" ]
python
train
AoiKuiyuyou/AoikImportUtil-Python
src/aoikimportutil/aoikimportutil.py
https://github.com/AoiKuiyuyou/AoikImportUtil-Python/blob/c6711719f5190cec81c8f29b989fc7609175b403/src/aoikimportutil/aoikimportutil.py#L88-L105
def import_path(mod_path, mod_name): """Import a module by module file path. @param mod_path: module file path. @param mod_name: module name. """ mod_code = open(mod_path).read() mod_obj = import_code( mod_code=mod_code, mod_name=mod_name, ) if not hasattr(mod_obj, '_...
[ "def", "import_path", "(", "mod_path", ",", "mod_name", ")", ":", "mod_code", "=", "open", "(", "mod_path", ")", ".", "read", "(", ")", "mod_obj", "=", "import_code", "(", "mod_code", "=", "mod_code", ",", "mod_name", "=", "mod_name", ",", ")", "if", "...
Import a module by module file path. @param mod_path: module file path. @param mod_name: module name.
[ "Import", "a", "module", "by", "module", "file", "path", "." ]
python
train
googleapis/google-cloud-python
firestore/google/cloud/firestore_v1beta1/gapic/firestore_client.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/gapic/firestore_client.py#L117-L124
def document_path_path(cls, project, database, document_path): """Return a fully-qualified document_path string.""" return google.api_core.path_template.expand( "projects/{project}/databases/{database}/documents/{document_path=**}", project=project, database=database,...
[ "def", "document_path_path", "(", "cls", ",", "project", ",", "database", ",", "document_path", ")", ":", "return", "google", ".", "api_core", ".", "path_template", ".", "expand", "(", "\"projects/{project}/databases/{database}/documents/{document_path=**}\"", ",", "pro...
Return a fully-qualified document_path string.
[ "Return", "a", "fully", "-", "qualified", "document_path", "string", "." ]
python
train
bcbio/bcbio-nextgen
bcbio/variation/vcfanno.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfanno.py#L91-L137
def find_annotations(data, retriever=None): """Find annotation configuration files for vcfanno, using pre-installed inputs. Creates absolute paths for user specified inputs and finds locally installed defaults. Default annotations: - gemini for variant pipelines - somatic for variant tumor...
[ "def", "find_annotations", "(", "data", ",", "retriever", "=", "None", ")", ":", "conf_files", "=", "dd", ".", "get_vcfanno", "(", "data", ")", "if", "not", "isinstance", "(", "conf_files", ",", "(", "list", ",", "tuple", ")", ")", ":", "conf_files", "...
Find annotation configuration files for vcfanno, using pre-installed inputs. Creates absolute paths for user specified inputs and finds locally installed defaults. Default annotations: - gemini for variant pipelines - somatic for variant tumor pipelines - rnaedit for RNA-seq variant call...
[ "Find", "annotation", "configuration", "files", "for", "vcfanno", "using", "pre", "-", "installed", "inputs", "." ]
python
train
Esri/ArcREST
src/arcrest/manageorg/administration.py
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/administration.py#L159-L164
def content(self): """returns access into the site's content""" return _content.Content(url=self._url + "/content", securityHandler=self._securityHandler, proxy_url=self._proxy_url, proxy_port=self._proxy_por...
[ "def", "content", "(", "self", ")", ":", "return", "_content", ".", "Content", "(", "url", "=", "self", ".", "_url", "+", "\"/content\"", ",", "securityHandler", "=", "self", ".", "_securityHandler", ",", "proxy_url", "=", "self", ".", "_proxy_url", ",", ...
returns access into the site's content
[ "returns", "access", "into", "the", "site", "s", "content" ]
python
train
limix/limix-core
limix_core/mean/meanKronSum.py
https://github.com/limix/limix-core/blob/5c590b4d351409f83ca320844b4897ce92203814/limix_core/mean/meanKronSum.py#L214-L222
def Fstar(self, value): """ set fixed effect design for predictions """ if value is None: self._use_to_predict = False else: assert value.shape[1] == self._K, 'Dimension mismatch' self._use_to_predict = True self._Fstar = value self.clear_cache...
[ "def", "Fstar", "(", "self", ",", "value", ")", ":", "if", "value", "is", "None", ":", "self", ".", "_use_to_predict", "=", "False", "else", ":", "assert", "value", ".", "shape", "[", "1", "]", "==", "self", ".", "_K", ",", "'Dimension mismatch'", "s...
set fixed effect design for predictions
[ "set", "fixed", "effect", "design", "for", "predictions" ]
python
train
rbarrois/django_xworkflows
django_xworkflows/models.py
https://github.com/rbarrois/django_xworkflows/blob/7f6c3e54e7fd64d39541bffa654c7f2e28685270/django_xworkflows/models.py#L170-L182
def validate(self, value, model_instance): """Validate that a given value is a valid option for a given model instance. Args: value (xworkflows.base.StateWrapper): The base.StateWrapper returned by to_python. model_instance: A WorkflowEnabled instance """ if not ...
[ "def", "validate", "(", "self", ",", "value", ",", "model_instance", ")", ":", "if", "not", "isinstance", "(", "value", ",", "base", ".", "StateWrapper", ")", ":", "raise", "exceptions", ".", "ValidationError", "(", "self", ".", "error_messages", "[", "'wr...
Validate that a given value is a valid option for a given model instance. Args: value (xworkflows.base.StateWrapper): The base.StateWrapper returned by to_python. model_instance: A WorkflowEnabled instance
[ "Validate", "that", "a", "given", "value", "is", "a", "valid", "option", "for", "a", "given", "model", "instance", "." ]
python
train
elemoine/papyrus
papyrus/protocol.py
https://github.com/elemoine/papyrus/blob/764fb2326105df74fbd3dbcd7e58f4cb21956005/papyrus/protocol.py#L248-L256
def _get_order_by(self, request): """ Return an SA order_by """ attr = request.params.get('sort', request.params.get('order_by')) if attr is None or not hasattr(self.mapped_class, attr): return None if request.params.get('dir', '').upper() == 'DESC': return desc(g...
[ "def", "_get_order_by", "(", "self", ",", "request", ")", ":", "attr", "=", "request", ".", "params", ".", "get", "(", "'sort'", ",", "request", ".", "params", ".", "get", "(", "'order_by'", ")", ")", "if", "attr", "is", "None", "or", "not", "hasattr...
Return an SA order_by
[ "Return", "an", "SA", "order_by" ]
python
train
nepalicalendar/nepalicalendar-py
nepalicalendar/nepcal.py
https://github.com/nepalicalendar/nepalicalendar-py/blob/a589c28b8e085049f30a7287753476b59eca6f50/nepalicalendar/nepcal.py#L114-L126
def monthdays2calendar(cls, year, month): """ Return a list of the weeks in the month month of the year as full weeks. Weeks are lists of seven tuples of day numbers and weekday numbers. """ weeks = [] week = [] for day in NepCal.itermonthdays2(year, month): week.appe...
[ "def", "monthdays2calendar", "(", "cls", ",", "year", ",", "month", ")", ":", "weeks", "=", "[", "]", "week", "=", "[", "]", "for", "day", "in", "NepCal", ".", "itermonthdays2", "(", "year", ",", "month", ")", ":", "week", ".", "append", "(", "day"...
Return a list of the weeks in the month month of the year as full weeks. Weeks are lists of seven tuples of day numbers and weekday numbers.
[ "Return", "a", "list", "of", "the", "weeks", "in", "the", "month", "month", "of", "the", "year", "as", "full", "weeks", ".", "Weeks", "are", "lists", "of", "seven", "tuples", "of", "day", "numbers", "and", "weekday", "numbers", "." ]
python
train
minorg/pastpy
py/src/pastpy/gen/database/impl/dummy/dummy_database_configuration.py
https://github.com/minorg/pastpy/blob/7d5d6d511629481850216565e7451b5dcb8027a9/py/src/pastpy/gen/database/impl/dummy/dummy_database_configuration.py#L184-L206
def read(cls, iprot): ''' Read a new object from the given input protocol and return the object. :type iprot: thryft.protocol._input_protocol._InputProtocol :rtype: pastpy.gen.database.impl.dummy.dummy_database_configuration.DummyDatabaseConfiguration ''' init_kwds = {}...
[ "def", "read", "(", "cls", ",", "iprot", ")", ":", "init_kwds", "=", "{", "}", "iprot", ".", "read_struct_begin", "(", ")", "while", "True", ":", "ifield_name", ",", "ifield_type", ",", "_ifield_id", "=", "iprot", ".", "read_field_begin", "(", ")", "if",...
Read a new object from the given input protocol and return the object. :type iprot: thryft.protocol._input_protocol._InputProtocol :rtype: pastpy.gen.database.impl.dummy.dummy_database_configuration.DummyDatabaseConfiguration
[ "Read", "a", "new", "object", "from", "the", "given", "input", "protocol", "and", "return", "the", "object", "." ]
python
train
opentracing/opentracing-python
opentracing/scope_managers/asyncio.py
https://github.com/opentracing/opentracing-python/blob/5ceb76d67b01c1c3316cfed02371d7922830e317/opentracing/scope_managers/asyncio.py#L86-L100
def active(self): """ Return the currently active :class:`~opentracing.Scope` which can be used to access the currently active :attr:`Scope.span`. :return: the :class:`~opentracing.Scope` that is active, or ``None`` if not available. """ task = self....
[ "def", "active", "(", "self", ")", ":", "task", "=", "self", ".", "_get_task", "(", ")", "if", "not", "task", ":", "return", "super", "(", "AsyncioScopeManager", ",", "self", ")", ".", "active", "return", "self", ".", "_get_task_scope", "(", "task", ")...
Return the currently active :class:`~opentracing.Scope` which can be used to access the currently active :attr:`Scope.span`. :return: the :class:`~opentracing.Scope` that is active, or ``None`` if not available.
[ "Return", "the", "currently", "active", ":", "class", ":", "~opentracing", ".", "Scope", "which", "can", "be", "used", "to", "access", "the", "currently", "active", ":", "attr", ":", "Scope", ".", "span", "." ]
python
train
wheerd/multiset
multiset.py
https://github.com/wheerd/multiset/blob/1f002397096edae3da32d004e3159345a476999c/multiset.py#L989-L1048
def discard(self, element, multiplicity=None): """Removes the `element` from the multiset. If multiplicity is ``None``, all occurrences of the element are removed: >>> ms = Multiset('aab') >>> ms.discard('a') 2 >>> sorted(ms) ['b'] Otherwise, the multip...
[ "def", "discard", "(", "self", ",", "element", ",", "multiplicity", "=", "None", ")", ":", "_elements", "=", "self", ".", "_elements", "if", "element", "in", "_elements", ":", "old_multiplicity", "=", "_elements", "[", "element", "]", "if", "multiplicity", ...
Removes the `element` from the multiset. If multiplicity is ``None``, all occurrences of the element are removed: >>> ms = Multiset('aab') >>> ms.discard('a') 2 >>> sorted(ms) ['b'] Otherwise, the multiplicity is subtracted from the one in the multiset and the ...
[ "Removes", "the", "element", "from", "the", "multiset", "." ]
python
train
dls-controls/pymalcolm
malcolm/core/hook.py
https://github.com/dls-controls/pymalcolm/blob/80ea667e4da26365a6cebc0249f52fdc744bd983/malcolm/core/hook.py#L53-L61
def on_hook(self, hook): # type: (Hook) -> None """Takes a hook, and optionally calls hook.run on a function""" try: func, args_gen = self.hooked[type(hook)] except (KeyError, TypeError): return else: hook(func, args_gen())
[ "def", "on_hook", "(", "self", ",", "hook", ")", ":", "# type: (Hook) -> None", "try", ":", "func", ",", "args_gen", "=", "self", ".", "hooked", "[", "type", "(", "hook", ")", "]", "except", "(", "KeyError", ",", "TypeError", ")", ":", "return", "else"...
Takes a hook, and optionally calls hook.run on a function
[ "Takes", "a", "hook", "and", "optionally", "calls", "hook", ".", "run", "on", "a", "function" ]
python
train
senaite/senaite.core
bika/lims/browser/analysisrequest/invoice.py
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/browser/analysisrequest/invoice.py#L62-L76
def to_localized_time(self, date, **kw): """Converts the given date to a localized time string """ if date is None: return "" # default options options = { "long_format": True, "time_only": False, "context": api.get_portal(), ...
[ "def", "to_localized_time", "(", "self", ",", "date", ",", "*", "*", "kw", ")", ":", "if", "date", "is", "None", ":", "return", "\"\"", "# default options", "options", "=", "{", "\"long_format\"", ":", "True", ",", "\"time_only\"", ":", "False", ",", "\"...
Converts the given date to a localized time string
[ "Converts", "the", "given", "date", "to", "a", "localized", "time", "string" ]
python
train
pycontribs/pyrax
pyrax/object_storage.py
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/object_storage.py#L968-L981
def get_metadata(self, container, prefix=None): """ Returns a dictionary containing the metadata for the container. """ headers = self.get_headers(container) if prefix is None: prefix = CONTAINER_META_PREFIX low_prefix = prefix.lower() ret = {} ...
[ "def", "get_metadata", "(", "self", ",", "container", ",", "prefix", "=", "None", ")", ":", "headers", "=", "self", ".", "get_headers", "(", "container", ")", "if", "prefix", "is", "None", ":", "prefix", "=", "CONTAINER_META_PREFIX", "low_prefix", "=", "pr...
Returns a dictionary containing the metadata for the container.
[ "Returns", "a", "dictionary", "containing", "the", "metadata", "for", "the", "container", "." ]
python
train
agoragames/chai
chai/spy.py
https://github.com/agoragames/chai/blob/8148d7b7754226b0d1cabfc2af10cd912612abdc/chai/spy.py#L43-L50
def side_effect(self, func, *args, **kwargs): ''' Wrap side effects for spies. ''' self._spy_side_effect = func self._spy_side_effect_args = args self._spy_side_effect_kwargs = kwargs return self
[ "def", "side_effect", "(", "self", ",", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_spy_side_effect", "=", "func", "self", ".", "_spy_side_effect_args", "=", "args", "self", ".", "_spy_side_effect_kwargs", "=", "kwargs", "re...
Wrap side effects for spies.
[ "Wrap", "side", "effects", "for", "spies", "." ]
python
train
MacHu-GWU/uszipcode-project
uszipcode/pkg/sqlalchemy_mate/orm/extended_declarative_base.py
https://github.com/MacHu-GWU/uszipcode-project/blob/96282b779a3efb422802de83c48ca284598ba952/uszipcode/pkg/sqlalchemy_mate/orm/extended_declarative_base.py#L27-L38
def ensure_session(engine_or_session): """ If it is an engine, then create a session from it. And indicate that this session should be closed after the job done. """ if isinstance(engine_or_session, Engine): ses = sessionmaker(bind=engine_or_session)() auto_close = True elif isin...
[ "def", "ensure_session", "(", "engine_or_session", ")", ":", "if", "isinstance", "(", "engine_or_session", ",", "Engine", ")", ":", "ses", "=", "sessionmaker", "(", "bind", "=", "engine_or_session", ")", "(", ")", "auto_close", "=", "True", "elif", "isinstance...
If it is an engine, then create a session from it. And indicate that this session should be closed after the job done.
[ "If", "it", "is", "an", "engine", "then", "create", "a", "session", "from", "it", ".", "And", "indicate", "that", "this", "session", "should", "be", "closed", "after", "the", "job", "done", "." ]
python
train
PyCQA/pylint
pylint/checkers/utils.py
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/utils.py#L453-L528
def parse_format_string( format_string: str ) -> Tuple[Set[str], int, Dict[str, str], List[str]]: """Parses a format string, returning a tuple of (keys, num_args), where keys is the set of mapping keys in the format string, and num_args is the number of arguments required by the format string. Raises ...
[ "def", "parse_format_string", "(", "format_string", ":", "str", ")", "->", "Tuple", "[", "Set", "[", "str", "]", ",", "int", ",", "Dict", "[", "str", ",", "str", "]", ",", "List", "[", "str", "]", "]", ":", "keys", "=", "set", "(", ")", "key_type...
Parses a format string, returning a tuple of (keys, num_args), where keys is the set of mapping keys in the format string, and num_args is the number of arguments required by the format string. Raises IncompleteFormatString or UnsupportedFormatCharacter if a parse error occurs.
[ "Parses", "a", "format", "string", "returning", "a", "tuple", "of", "(", "keys", "num_args", ")", "where", "keys", "is", "the", "set", "of", "mapping", "keys", "in", "the", "format", "string", "and", "num_args", "is", "the", "number", "of", "arguments", ...
python
test
pypa/pipenv
pipenv/vendor/vistir/path.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/path.py#L261-L274
def ensure_mkdir_p(mode=0o777): """Decorator to ensure `mkdir_p` is called to the function's return value. """ def decorator(f): @functools.wraps(f) def decorated(*args, **kwargs): path = f(*args, **kwargs) mkdir_p(path, mode=mode) return path re...
[ "def", "ensure_mkdir_p", "(", "mode", "=", "0o777", ")", ":", "def", "decorator", "(", "f", ")", ":", "@", "functools", ".", "wraps", "(", "f", ")", "def", "decorated", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "path", "=", "f", "(", ...
Decorator to ensure `mkdir_p` is called to the function's return value.
[ "Decorator", "to", "ensure", "mkdir_p", "is", "called", "to", "the", "function", "s", "return", "value", "." ]
python
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/analysis.py
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/analysis.py#L85-L120
def simulate(self, text, using='default', explain=False, attributes=None): """ Use the Analyze API of elasticsearch to test the outcome of this analyzer. :arg text: Text to be analyzed :arg using: connection alias to use, defaults to ``'default'`` :arg explain: will output all t...
[ "def", "simulate", "(", "self", ",", "text", ",", "using", "=", "'default'", ",", "explain", "=", "False", ",", "attributes", "=", "None", ")", ":", "es", "=", "connections", ".", "get_connection", "(", "using", ")", "body", "=", "{", "'text'", ":", ...
Use the Analyze API of elasticsearch to test the outcome of this analyzer. :arg text: Text to be analyzed :arg using: connection alias to use, defaults to ``'default'`` :arg explain: will output all token attributes for each token. You can filter token attributes you want to output ...
[ "Use", "the", "Analyze", "API", "of", "elasticsearch", "to", "test", "the", "outcome", "of", "this", "analyzer", "." ]
python
train
kejbaly2/metrique
metrique/result.py
https://github.com/kejbaly2/metrique/blob/a10b076097441b7dde687949139f702f5c1e1b35/metrique/result.py#L430-L440
def one_version(self, index=0): ''' Leaves only one version for each object. :param index: List-like index of the version. 0 == first; -1 == last ''' def prep(df): start = sorted(df._start.tolist())[index] return df[df._start == start] return pd...
[ "def", "one_version", "(", "self", ",", "index", "=", "0", ")", ":", "def", "prep", "(", "df", ")", ":", "start", "=", "sorted", "(", "df", ".", "_start", ".", "tolist", "(", ")", ")", "[", "index", "]", "return", "df", "[", "df", ".", "_start"...
Leaves only one version for each object. :param index: List-like index of the version. 0 == first; -1 == last
[ "Leaves", "only", "one", "version", "for", "each", "object", "." ]
python
train
ucsb-cs-education/hairball
hairball/plugins/checks.py
https://github.com/ucsb-cs-education/hairball/blob/c6da8971f8a34e88ce401d36b51431715e1dff5b/hairball/plugins/checks.py#L203-L233
def analyze(self, scratch, **kwargs): """Categorize instances of attempted say and sound synchronization.""" errors = Counter() for script in self.iter_scripts(scratch): prev_name, prev_depth, prev_block = '', 0, script.blocks[0] gen = self.iter_blocks(script.blocks) ...
[ "def", "analyze", "(", "self", ",", "scratch", ",", "*", "*", "kwargs", ")", ":", "errors", "=", "Counter", "(", ")", "for", "script", "in", "self", ".", "iter_scripts", "(", "scratch", ")", ":", "prev_name", ",", "prev_depth", ",", "prev_block", "=", ...
Categorize instances of attempted say and sound synchronization.
[ "Categorize", "instances", "of", "attempted", "say", "and", "sound", "synchronization", "." ]
python
train
shoebot/shoebot
shoebot/data/grob.py
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/grob.py#L60-L70
def _center_transform(self, transform): '''' Works like setupTransform of a version of java nodebox http://dev.nodebox.net/browser/nodebox-java/branches/rewrite/src/java/net/nodebox/graphics/Grob.java ''' dx, dy = self._get_center() t = cairo.Matrix() t.translate(...
[ "def", "_center_transform", "(", "self", ",", "transform", ")", ":", "dx", ",", "dy", "=", "self", ".", "_get_center", "(", ")", "t", "=", "cairo", ".", "Matrix", "(", ")", "t", ".", "translate", "(", "dx", ",", "dy", ")", "t", "=", "transform", ...
Works like setupTransform of a version of java nodebox http://dev.nodebox.net/browser/nodebox-java/branches/rewrite/src/java/net/nodebox/graphics/Grob.java
[ "Works", "like", "setupTransform", "of", "a", "version", "of", "java", "nodebox", "http", ":", "//", "dev", ".", "nodebox", ".", "net", "/", "browser", "/", "nodebox", "-", "java", "/", "branches", "/", "rewrite", "/", "src", "/", "java", "/", "net", ...
python
valid
wavefrontHQ/python-client
wavefront_api_client/api/external_link_api.py
https://github.com/wavefrontHQ/python-client/blob/b0f1046a8f68c2c7d69e395f7167241f224c738a/wavefront_api_client/api/external_link_api.py#L325-L345
def get_external_link(self, id, **kwargs): # noqa: E501 """Get a specific external link # noqa: E501 # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_external_link(id, ...
[ "def", "get_external_link", "(", "self", ",", "id", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'", ")", ":", "return", "self", ".", "get_extern...
Get a specific external link # noqa: E501 # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_external_link(id, async_req=True) >>> result = thread.get() :param as...
[ "Get", "a", "specific", "external", "link", "#", "noqa", ":", "E501" ]
python
train
CitrineInformatics/pypif-sdk
pypif_sdk/func/calculate_funcs.py
https://github.com/CitrineInformatics/pypif-sdk/blob/8b01d10d9a1426d5eef12e4b2f31c4657aa0fe59/pypif_sdk/func/calculate_funcs.py#L251-L261
def _add_ideal_weight_percent_(elemental_array): """ Adds the "weight_percent" property to each of the dictionaries in elemental_array :param elemental_array: an array of dictionaries containing information about the elements in the system :return: the appended elemental_array """ t_mass = _cal...
[ "def", "_add_ideal_weight_percent_", "(", "elemental_array", ")", ":", "t_mass", "=", "_calculate_total_mass_", "(", "elemental_array", ")", "for", "a", "in", "elemental_array", ":", "a", "[", "\"weight_percent\"", "]", "=", "a", "[", "\"weight\"", "]", "/", "t_...
Adds the "weight_percent" property to each of the dictionaries in elemental_array :param elemental_array: an array of dictionaries containing information about the elements in the system :return: the appended elemental_array
[ "Adds", "the", "weight_percent", "property", "to", "each", "of", "the", "dictionaries", "in", "elemental_array" ]
python
train
estnltk/estnltk
estnltk/syntax/parsers.py
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/syntax/parsers.py#L400-L520
def parse_text( self, text, **kwargs ): ''' Parses given text with Maltparser. As a result of parsing, the input Text object will obtain a new layer named LAYER_CONLL, which contains a list of dicts. Each dicts corresponds to analysis of a single word token, ...
[ "def", "parse_text", "(", "self", ",", "text", ",", "*", "*", "kwargs", ")", ":", "# a) get the configuration:", "augment_words", "=", "False", "all_return_types", "=", "[", "\"text\"", ",", "\"conll\"", ",", "\"trees\"", ",", "\"dep_graphs\"", "]", "return_type...
Parses given text with Maltparser. As a result of parsing, the input Text object will obtain a new layer named LAYER_CONLL, which contains a list of dicts. Each dicts corresponds to analysis of a single word token, and has the following attributes (at min...
[ "Parses", "given", "text", "with", "Maltparser", ".", "As", "a", "result", "of", "parsing", "the", "input", "Text", "object", "will", "obtain", "a", "new", "layer", "named", "LAYER_CONLL", "which", "contains", "a", "list", "of", "dicts", ".", "Each", "dict...
python
train
apache/incubator-mxnet
python/mxnet/contrib/onnx/onnx2mx/_op_translations.py
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/python/mxnet/contrib/onnx/onnx2mx/_op_translations.py#L348-L377
def deconv(attrs, inputs, proto_obj): """Computes transposed convolution of the input tensor.""" new_attrs = translation_utils._fix_attribute_names(attrs, {'kernel_shape' : 'kernel', 'strides' : 'stride', ...
[ "def", "deconv", "(", "attrs", ",", "inputs", ",", "proto_obj", ")", ":", "new_attrs", "=", "translation_utils", ".", "_fix_attribute_names", "(", "attrs", ",", "{", "'kernel_shape'", ":", "'kernel'", ",", "'strides'", ":", "'stride'", ",", "'pads'", ":", "'...
Computes transposed convolution of the input tensor.
[ "Computes", "transposed", "convolution", "of", "the", "input", "tensor", "." ]
python
train
wummel/linkchecker
linkcheck/logger/text.py
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/logger/text.py#L224-L267
def write_outro (self, interrupt=False): """Write end of checking message.""" self.writeln() if interrupt: self.writeln(_("The check has been interrupted; results are not complete.")) self.write(_("That's it.") + " ") self.write(_n("%d link", "%d links", ...
[ "def", "write_outro", "(", "self", ",", "interrupt", "=", "False", ")", ":", "self", ".", "writeln", "(", ")", "if", "interrupt", ":", "self", ".", "writeln", "(", "_", "(", "\"The check has been interrupted; results are not complete.\"", ")", ")", "self", "."...
Write end of checking message.
[ "Write", "end", "of", "checking", "message", "." ]
python
train
openeventdata/mordecai
mordecai/utilities.py
https://github.com/openeventdata/mordecai/blob/bd82b8bcc27621345c57cbe9ec7f8c8552620ffc/mordecai/utilities.py#L176-L181
def make_country_nationality_list(cts, ct_file): """Combine list of countries and list of nationalities""" countries = pd.read_csv(ct_file) nationality = dict(zip(countries.nationality,countries.alpha_3_code)) both_codes = {**nationality, **cts} return both_codes
[ "def", "make_country_nationality_list", "(", "cts", ",", "ct_file", ")", ":", "countries", "=", "pd", ".", "read_csv", "(", "ct_file", ")", "nationality", "=", "dict", "(", "zip", "(", "countries", ".", "nationality", ",", "countries", ".", "alpha_3_code", "...
Combine list of countries and list of nationalities
[ "Combine", "list", "of", "countries", "and", "list", "of", "nationalities" ]
python
train
openstax/cnx-archive
cnxarchive/views/content.py
https://github.com/openstax/cnx-archive/blob/d31d34aa8bbc8a9fde6cd4227a0df92726e8daf4/cnxarchive/views/content.py#L140-L148
def get_content_json(request): """Retrieve content as JSON using the ident-hash (uuid@version).""" result = _get_content_json() resp = request.response resp.status = "200 OK" resp.content_type = 'application/json' resp.body = json.dumps(result) return result, resp
[ "def", "get_content_json", "(", "request", ")", ":", "result", "=", "_get_content_json", "(", ")", "resp", "=", "request", ".", "response", "resp", ".", "status", "=", "\"200 OK\"", "resp", ".", "content_type", "=", "'application/json'", "resp", ".", "body", ...
Retrieve content as JSON using the ident-hash (uuid@version).
[ "Retrieve", "content", "as", "JSON", "using", "the", "ident", "-", "hash", "(", "uuid" ]
python
train
Komnomnomnom/swigibpy
swigibpy.py
https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L1647-L1649
def reqAccountSummary(self, reqId, groupName, tags): """reqAccountSummary(EClientSocketBase self, int reqId, IBString const & groupName, IBString const & tags)""" return _swigibpy.EClientSocketBase_reqAccountSummary(self, reqId, groupName, tags)
[ "def", "reqAccountSummary", "(", "self", ",", "reqId", ",", "groupName", ",", "tags", ")", ":", "return", "_swigibpy", ".", "EClientSocketBase_reqAccountSummary", "(", "self", ",", "reqId", ",", "groupName", ",", "tags", ")" ]
reqAccountSummary(EClientSocketBase self, int reqId, IBString const & groupName, IBString const & tags)
[ "reqAccountSummary", "(", "EClientSocketBase", "self", "int", "reqId", "IBString", "const", "&", "groupName", "IBString", "const", "&", "tags", ")" ]
python
train
not-na/peng3d
peng3d/gui/layered.py
https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/layered.py#L66-L80
def addLayer(self,layer,z_index=None): """ Adds the given layer at the given Z Index. If ``z_index`` is not given, the Z Index specified by the layer will be used. """ if z_index is None: z_index = layer.z_index i = 0 for l,z in self.layers: ...
[ "def", "addLayer", "(", "self", ",", "layer", ",", "z_index", "=", "None", ")", ":", "if", "z_index", "is", "None", ":", "z_index", "=", "layer", ".", "z_index", "i", "=", "0", "for", "l", ",", "z", "in", "self", ".", "layers", ":", "if", "z", ...
Adds the given layer at the given Z Index. If ``z_index`` is not given, the Z Index specified by the layer will be used.
[ "Adds", "the", "given", "layer", "at", "the", "given", "Z", "Index", ".", "If", "z_index", "is", "not", "given", "the", "Z", "Index", "specified", "by", "the", "layer", "will", "be", "used", "." ]
python
test
numenta/htmresearch
htmresearch/frameworks/location/location_network_creation.py
https://github.com/numenta/htmresearch/blob/70c096b09a577ea0432c3f3bfff4442d4871b7aa/htmresearch/frameworks/location/location_network_creation.py#L39-L173
def createL4L6aLocationColumn(network, L4Params, L6aParams, inverseReadoutResolution=None, baselineCellsPerAxis=6, suffix=""): """ Create a single column network containing L4 and L6a layers. L4 layer processes sensor inputs while L6a processes motor com...
[ "def", "createL4L6aLocationColumn", "(", "network", ",", "L4Params", ",", "L6aParams", ",", "inverseReadoutResolution", "=", "None", ",", "baselineCellsPerAxis", "=", "6", ",", "suffix", "=", "\"\"", ")", ":", "L6aParams", "=", "copy", ".", "deepcopy", "(", "L...
Create a single column network containing L4 and L6a layers. L4 layer processes sensor inputs while L6a processes motor commands using grid cell modules. Sensory input is represented by the feature's active columns and motor input is represented by the displacement vector [dx, dy]. The grid cell modules used b...
[ "Create", "a", "single", "column", "network", "containing", "L4", "and", "L6a", "layers", ".", "L4", "layer", "processes", "sensor", "inputs", "while", "L6a", "processes", "motor", "commands", "using", "grid", "cell", "modules", ".", "Sensory", "input", "is", ...
python
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/mattermost.py
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/mattermost.py#L219-L228
def __convert_booleans(self, eitem): """ Convert True/False to 1/0 for better kibana processing """ for field in eitem.keys(): if isinstance(eitem[field], bool): if eitem[field]: eitem[field] = 1 else: eitem[field] = 0 ...
[ "def", "__convert_booleans", "(", "self", ",", "eitem", ")", ":", "for", "field", "in", "eitem", ".", "keys", "(", ")", ":", "if", "isinstance", "(", "eitem", "[", "field", "]", ",", "bool", ")", ":", "if", "eitem", "[", "field", "]", ":", "eitem",...
Convert True/False to 1/0 for better kibana processing
[ "Convert", "True", "/", "False", "to", "1", "/", "0", "for", "better", "kibana", "processing" ]
python
train
azogue/i2csense
i2csense/__main__.py
https://github.com/azogue/i2csense/blob/ecc6806dcee9de827a5414a9e836d271fedca9b9/i2csense/__main__.py#L60-L139
def main_cli(): """CLI minimal interface.""" # Get params args = _cli_argument_parser() delta_secs = args.delay i2cbus = args.bus i2c_address = args.address sensor_key = args.sensor sensor_params = args.params params = {} if sensor_params: def _parse_param(str_param): ...
[ "def", "main_cli", "(", ")", ":", "# Get params", "args", "=", "_cli_argument_parser", "(", ")", "delta_secs", "=", "args", ".", "delay", "i2cbus", "=", "args", ".", "bus", "i2c_address", "=", "args", ".", "address", "sensor_key", "=", "args", ".", "sensor...
CLI minimal interface.
[ "CLI", "minimal", "interface", "." ]
python
train
yfpeng/bioc
bioc/encoder.py
https://github.com/yfpeng/bioc/blob/47ddaa010960d9ba673aefe068e7bbaf39f0fff4/bioc/encoder.py#L10-L13
def encode_document(obj): """Encode a single document.""" warnings.warn("deprecated. Please use bioc.biocxml.encoder.encode_document", DeprecationWarning) return bioc.biocxml.encoder.encode_document(obj)
[ "def", "encode_document", "(", "obj", ")", ":", "warnings", ".", "warn", "(", "\"deprecated. Please use bioc.biocxml.encoder.encode_document\"", ",", "DeprecationWarning", ")", "return", "bioc", ".", "biocxml", ".", "encoder", ".", "encode_document", "(", "obj", ")" ]
Encode a single document.
[ "Encode", "a", "single", "document", "." ]
python
train
openego/eDisGo
edisgo/grid/network.py
https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/grid/network.py#L1645-L1668
def _check_timeindex(self, curtailment_timeseries, network): """ Raises an error if time index of curtailment time series does not comply with the time index of load and feed-in time series. Parameters ----------- curtailment_timeseries : :pandas:`pandas.Series<series>` ...
[ "def", "_check_timeindex", "(", "self", ",", "curtailment_timeseries", ",", "network", ")", ":", "if", "curtailment_timeseries", "is", "None", ":", "message", "=", "'No curtailment given.'", "logging", ".", "error", "(", "message", ")", "raise", "KeyError", "(", ...
Raises an error if time index of curtailment time series does not comply with the time index of load and feed-in time series. Parameters ----------- curtailment_timeseries : :pandas:`pandas.Series<series>` or \ :pandas:`pandas.DataFrame<dataframe>` See parameter ...
[ "Raises", "an", "error", "if", "time", "index", "of", "curtailment", "time", "series", "does", "not", "comply", "with", "the", "time", "index", "of", "load", "and", "feed", "-", "in", "time", "series", "." ]
python
train
SpheMakh/Stimela
stimela/utils/__init__.py
https://github.com/SpheMakh/Stimela/blob/292e80461a0c3498da8e7e987e2891d3ae5981ad/stimela/utils/__init__.py#L343-L394
def addcol(msname, colname=None, shape=None, data_desc_type='array', valuetype=None, init_with=0, **kw): """ add column to MS msanme : MS to add colmn to colname : column name shape : shape valuetype : data type data_desc_type : 'scalar' for scalar elements and a...
[ "def", "addcol", "(", "msname", ",", "colname", "=", "None", ",", "shape", "=", "None", ",", "data_desc_type", "=", "'array'", ",", "valuetype", "=", "None", ",", "init_with", "=", "0", ",", "*", "*", "kw", ")", ":", "import", "numpy", "import", "pyr...
add column to MS msanme : MS to add colmn to colname : column name shape : shape valuetype : data type data_desc_type : 'scalar' for scalar elements and array for 'array' elements init_with : value to initialise the column with
[ "add", "column", "to", "MS", "msanme", ":", "MS", "to", "add", "colmn", "to", "colname", ":", "column", "name", "shape", ":", "shape", "valuetype", ":", "data", "type", "data_desc_type", ":", "scalar", "for", "scalar", "elements", "and", "array", "for", ...
python
train
networks-lab/metaknowledge
metaknowledge/mkCollection.py
https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/mkCollection.py#L309-L334
def chunk(self, maxSize): """Splits the `Collection` into _maxSize_ size or smaller `Collections` # Parameters _maxSize_ : `int` > The maximum number of elements in a retuned `Collection` # Returns `list [Collection]` > A list of `Collections` that if all m...
[ "def", "chunk", "(", "self", ",", "maxSize", ")", ":", "chunks", "=", "[", "]", "currentSize", "=", "maxSize", "+", "1", "for", "i", "in", "self", ":", "if", "currentSize", ">=", "maxSize", ":", "currentSize", "=", "0", "chunks", ".", "append", "(", ...
Splits the `Collection` into _maxSize_ size or smaller `Collections` # Parameters _maxSize_ : `int` > The maximum number of elements in a retuned `Collection` # Returns `list [Collection]` > A list of `Collections` that if all merged (`|` operator) would create the...
[ "Splits", "the", "Collection", "into", "_maxSize_", "size", "or", "smaller", "Collections" ]
python
train
inveniosoftware/invenio-files-rest
invenio_files_rest/alembic/8ae99b034410_create_files_objecttags_table.py
https://github.com/inveniosoftware/invenio-files-rest/blob/59a950da61cc8d5882a03c6fde6db2e2ed10befd/invenio_files_rest/alembic/8ae99b034410_create_files_objecttags_table.py#L23-L63
def upgrade(): """Upgrade database.""" # table ObjectVersion: modify primary_key if op.get_context().dialect.name == 'mysql': Fk = 'fk_files_object_bucket_id_files_bucket' op.execute( 'ALTER TABLE files_object ' 'DROP FOREIGN KEY {0}, DROP PRIMARY KEY, ' '...
[ "def", "upgrade", "(", ")", ":", "# table ObjectVersion: modify primary_key", "if", "op", ".", "get_context", "(", ")", ".", "dialect", ".", "name", "==", "'mysql'", ":", "Fk", "=", "'fk_files_object_bucket_id_files_bucket'", "op", ".", "execute", "(", "'ALTER TAB...
Upgrade database.
[ "Upgrade", "database", "." ]
python
train
empymod/empymod
empymod/kernel.py
https://github.com/empymod/empymod/blob/4a78ca4191ed4b4d42d019ce715a9a3889dba1bc/empymod/kernel.py#L625-L793
def fullspace(off, angle, zsrc, zrec, etaH, etaV, zetaH, zetaV, ab, msrc, mrec): r"""Analytical full-space solutions in the frequency domain. .. math:: \hat{G}^{ee}_{\alpha\beta}, \hat{G}^{ee}_{3\alpha}, \hat{G}^{ee}_{33}, \hat{G}^{em}_{\alpha\beta}, \hat{G}^{em}_{\alp...
[ "def", "fullspace", "(", "off", ",", "angle", ",", "zsrc", ",", "zrec", ",", "etaH", ",", "etaV", ",", "zetaH", ",", "zetaV", ",", "ab", ",", "msrc", ",", "mrec", ")", ":", "xco", "=", "np", ".", "cos", "(", "angle", ")", "*", "off", "yco", "...
r"""Analytical full-space solutions in the frequency domain. .. math:: \hat{G}^{ee}_{\alpha\beta}, \hat{G}^{ee}_{3\alpha}, \hat{G}^{ee}_{33}, \hat{G}^{em}_{\alpha\beta}, \hat{G}^{em}_{\alpha 3} This function corresponds to equations 45--50 in [HuTS15]_, and loosely to the corre...
[ "r", "Analytical", "full", "-", "space", "solutions", "in", "the", "frequency", "domain", "." ]
python
train
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/ietf_netconf_acm.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/ietf_netconf_acm.py#L34-L43
def nacm_write_default(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") nacm = ET.SubElement(config, "nacm", xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-acm") write_default = ET.SubElement(nacm, "write-default") write_default.text = kwargs.pop...
[ "def", "nacm_write_default", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "nacm", "=", "ET", ".", "SubElement", "(", "config", ",", "\"nacm\"", ",", "xmlns", "=", "\"urn:ietf:params:xml:ns:yan...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
metagriffin/pysyncml
pysyncml/cli/base.py
https://github.com/metagriffin/pysyncml/blob/a583fe0dbffa8b24e5a3e151524f84868b2382bb/pysyncml/cli/base.py#L781-L803
def run(self, stdout=sys.stdout, stderr=sys.stderr): ''' Runs this SyncEngine by executing one of the following functions (as controlled by command-line options or stored parameters): * Display local pending changes. * Describe local configuration. * Run an HTTP server and engage server-side mo...
[ "def", "run", "(", "self", ",", "stdout", "=", "sys", ".", "stdout", ",", "stderr", "=", "sys", ".", "stderr", ")", ":", "if", "self", ".", "options", ".", "local", "or", "self", ".", "options", ".", "describe", ":", "context", ",", "adapter", "=",...
Runs this SyncEngine by executing one of the following functions (as controlled by command-line options or stored parameters): * Display local pending changes. * Describe local configuration. * Run an HTTP server and engage server-side mode. * Connect to a remote SyncML peer and engage client-side ...
[ "Runs", "this", "SyncEngine", "by", "executing", "one", "of", "the", "following", "functions", "(", "as", "controlled", "by", "command", "-", "line", "options", "or", "stored", "parameters", ")", ":" ]
python
valid
python-diamond/Diamond
src/collectors/memory/memory.py
https://github.com/python-diamond/Diamond/blob/0f3eb04327d6d3ed5e53a9967d6c9d2c09714a47/src/collectors/memory/memory.py#L74-L171
def collect(self): """ Collect memory stats """ if ((os.access(self.PROC, os.R_OK) and self.config.get('force_psutil') != 'True')): file = open(self.PROC) data = file.read() file.close() memory_total = None memory_...
[ "def", "collect", "(", "self", ")", ":", "if", "(", "(", "os", ".", "access", "(", "self", ".", "PROC", ",", "os", ".", "R_OK", ")", "and", "self", ".", "config", ".", "get", "(", "'force_psutil'", ")", "!=", "'True'", ")", ")", ":", "file", "=...
Collect memory stats
[ "Collect", "memory", "stats" ]
python
train
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L8035-L8043
def flexifunction_command_ack_send(self, command_type, result, force_mavlink1=False): ''' Acknowldge sucess or failure of a flexifunction command command_type : Command acknowledged (uint16_t) result : result of acknowledge...
[ "def", "flexifunction_command_ack_send", "(", "self", ",", "command_type", ",", "result", ",", "force_mavlink1", "=", "False", ")", ":", "return", "self", ".", "send", "(", "self", ".", "flexifunction_command_ack_encode", "(", "command_type", ",", "result", ")", ...
Acknowldge sucess or failure of a flexifunction command command_type : Command acknowledged (uint16_t) result : result of acknowledge (uint16_t)
[ "Acknowldge", "sucess", "or", "failure", "of", "a", "flexifunction", "command" ]
python
train
GNS3/gns3-server
gns3server/compute/vmware/__init__.py
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/vmware/__init__.py#L442-L472
def remove_from_vmware_inventory(self, vmx_path): """ Removes a linked clone from the VMware inventory file. :param vmx_path: path of the linked clone VMX file """ with (yield from self._vmware_inventory_lock): inventory_path = self.get_vmware_inventory_path() ...
[ "def", "remove_from_vmware_inventory", "(", "self", ",", "vmx_path", ")", ":", "with", "(", "yield", "from", "self", ".", "_vmware_inventory_lock", ")", ":", "inventory_path", "=", "self", ".", "get_vmware_inventory_path", "(", ")", "if", "os", ".", "path", "....
Removes a linked clone from the VMware inventory file. :param vmx_path: path of the linked clone VMX file
[ "Removes", "a", "linked", "clone", "from", "the", "VMware", "inventory", "file", "." ]
python
train
penguinmenac3/starttf
starttf/layers/tile_2d.py
https://github.com/penguinmenac3/starttf/blob/f4086489d169757c0504e822165db2fea534b944/starttf/layers/tile_2d.py#L102-L128
def feature_passthrough(early_feat, late_feat, filters, name, kernel_size=(1, 1)): """ A feature passthrough layer inspired by yolo9000 and the inverse tiling layer. It can be proven, that this layer does the same as conv(concat(inverse_tile(early_feat), late_feat)). This layer has no activation functi...
[ "def", "feature_passthrough", "(", "early_feat", ",", "late_feat", ",", "filters", ",", "name", ",", "kernel_size", "=", "(", "1", ",", "1", ")", ")", ":", "_", ",", "h_early", ",", "w_early", ",", "c_early", "=", "early_feat", ".", "get_shape", "(", "...
A feature passthrough layer inspired by yolo9000 and the inverse tiling layer. It can be proven, that this layer does the same as conv(concat(inverse_tile(early_feat), late_feat)). This layer has no activation function. :param early_feat: The early feature layer of shape [batch_size, h * s_x, w * s_y, _]....
[ "A", "feature", "passthrough", "layer", "inspired", "by", "yolo9000", "and", "the", "inverse", "tiling", "layer", "." ]
python
train
mathiasertl/django-ca
ca/django_ca/utils.py
https://github.com/mathiasertl/django-ca/blob/976d7ea05276320f20daed2a6d59c8f5660fe976/ca/django_ca/utils.py#L125-L140
def format_name(subject): """Convert a subject into the canonical form for distinguished names. This function does not take care of sorting the subject in any meaningful order. Examples:: >>> format_name([('CN', 'example.com'), ]) '/CN=example.com' >>> format_name([('CN', 'example...
[ "def", "format_name", "(", "subject", ")", ":", "if", "isinstance", "(", "subject", ",", "x509", ".", "Name", ")", ":", "subject", "=", "[", "(", "OID_NAME_MAPPINGS", "[", "s", ".", "oid", "]", ",", "s", ".", "value", ")", "for", "s", "in", "subjec...
Convert a subject into the canonical form for distinguished names. This function does not take care of sorting the subject in any meaningful order. Examples:: >>> format_name([('CN', 'example.com'), ]) '/CN=example.com' >>> format_name([('CN', 'example.com'), ('O', "My Organization"),...
[ "Convert", "a", "subject", "into", "the", "canonical", "form", "for", "distinguished", "names", "." ]
python
train
acutesoftware/AIKIF
aikif/environments/environment.py
https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/environments/environment.py#L40-L46
def create(self, num): """ Creates the environment in your subclassed create function include the line below super().build(arg1, arg2, arg2, ...) """ self.log.record_process('enviroment.py', 'Creating ' + str(num) + ' environments - ' + self.name)
[ "def", "create", "(", "self", ",", "num", ")", ":", "self", ".", "log", ".", "record_process", "(", "'enviroment.py'", ",", "'Creating '", "+", "str", "(", "num", ")", "+", "' environments - '", "+", "self", ".", "name", ")" ]
Creates the environment in your subclassed create function include the line below super().build(arg1, arg2, arg2, ...)
[ "Creates", "the", "environment", "in", "your", "subclassed", "create", "function", "include", "the", "line", "below", "super", "()", ".", "build", "(", "arg1", "arg2", "arg2", "...", ")" ]
python
train
pdkit/pdkit
pdkit/tremor_processor.py
https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/tremor_processor.py#L73-L92
def resample_signal(self, data_frame): """ Convenience method for frequency conversion and resampling of data frame. Object must have a DatetimeIndex. After re-sampling, this methods interpolate the time magnitude sum acceleration values and the x,y,z values of the data fra...
[ "def", "resample_signal", "(", "self", ",", "data_frame", ")", ":", "df_resampled", "=", "data_frame", ".", "resample", "(", "str", "(", "1", "/", "self", ".", "sampling_frequency", ")", "+", "'S'", ")", ".", "mean", "(", ")", "f", "=", "interpolate", ...
Convenience method for frequency conversion and resampling of data frame. Object must have a DatetimeIndex. After re-sampling, this methods interpolate the time magnitude sum acceleration values and the x,y,z values of the data frame acceleration :param data_frame: the data frame ...
[ "Convenience", "method", "for", "frequency", "conversion", "and", "resampling", "of", "data", "frame", ".", "Object", "must", "have", "a", "DatetimeIndex", ".", "After", "re", "-", "sampling", "this", "methods", "interpolate", "the", "time", "magnitude", "sum", ...
python
train
JarryShaw/PyPCAPKit
src/protocols/internet/ipv4.py
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/internet/ipv4.py#L660-L710
def _read_mode_tr(self, size, kind): """Read Traceroute option. Positional arguments: size - int, length of option kind - int, 82 (TR) Returns: * dict -- extracted Traceroute (TR) option Structure of Traceroute (TR) option [RFC 1393][RFC 6814]: ...
[ "def", "_read_mode_tr", "(", "self", ",", "size", ",", "kind", ")", ":", "if", "size", "!=", "12", ":", "raise", "ProtocolError", "(", "f'{self.alias}: [Optno {kind}] invalid format'", ")", "_idnm", "=", "self", ".", "_read_unpack", "(", "2", ")", "_ohcn", "...
Read Traceroute option. Positional arguments: size - int, length of option kind - int, 82 (TR) Returns: * dict -- extracted Traceroute (TR) option Structure of Traceroute (TR) option [RFC 1393][RFC 6814]: 0 8 16 ...
[ "Read", "Traceroute", "option", "." ]
python
train
confluentinc/confluent-kafka-python
examples/adminapi.py
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/examples/adminapi.py#L143-L232
def example_delta_alter_configs(a, args): """ The AlterConfigs Kafka API requires all configuration to be passed, any left out configuration properties will revert to their default settings. This example shows how to just modify the supplied configuration entries by first reading the configuration ...
[ "def", "example_delta_alter_configs", "(", "a", ",", "args", ")", ":", "# Convert supplied config to resources.", "# We can reuse the same resources both for describe_configs and", "# alter_configs.", "resources", "=", "[", "]", "for", "restype", ",", "resname", ",", "configs...
The AlterConfigs Kafka API requires all configuration to be passed, any left out configuration properties will revert to their default settings. This example shows how to just modify the supplied configuration entries by first reading the configuration from the broker, updating the supplied configurati...
[ "The", "AlterConfigs", "Kafka", "API", "requires", "all", "configuration", "to", "be", "passed", "any", "left", "out", "configuration", "properties", "will", "revert", "to", "their", "default", "settings", "." ]
python
train
dmwm/DBS
Server/Python/src/dbs/web/DBSReaderModel.py
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/web/DBSReaderModel.py#L976-L1072
def listFileArray(self): """ API to list files in DBS. Either non-wildcarded logical_file_name, non-wildcarded dataset, non-wildcarded block_name or non-wildcarded lfn list is required. The combination of a non-wildcarded dataset or block_name with an wildcarded logical_file_name is supported....
[ "def", "listFileArray", "(", "self", ")", ":", "ret", "=", "[", "]", "try", ":", "body", "=", "request", ".", "body", ".", "read", "(", ")", "if", "body", ":", "data", "=", "cjson", ".", "decode", "(", "body", ")", "data", "=", "validateJSONInputNo...
API to list files in DBS. Either non-wildcarded logical_file_name, non-wildcarded dataset, non-wildcarded block_name or non-wildcarded lfn list is required. The combination of a non-wildcarded dataset or block_name with an wildcarded logical_file_name is supported. * For lumi_list the followi...
[ "API", "to", "list", "files", "in", "DBS", ".", "Either", "non", "-", "wildcarded", "logical_file_name", "non", "-", "wildcarded", "dataset", "non", "-", "wildcarded", "block_name", "or", "non", "-", "wildcarded", "lfn", "list", "is", "required", ".", "The",...
python
train
Peter-Slump/django-dynamic-fixtures
src/dynamic_fixtures/fixtures/loader.py
https://github.com/Peter-Slump/django-dynamic-fixtures/blob/da99b4b12b11be28ea4b36b6cf2896ca449c73c1/src/dynamic_fixtures/fixtures/loader.py#L117-L134
def resolve_nodes(self, nodes): """ Resolve a given set of nodes. Dependencies of the nodes, even if they are not in the given list will also be resolved! :param list nodes: List of nodes to be resolved :return: A list of resolved nodes """ if not nodes:...
[ "def", "resolve_nodes", "(", "self", ",", "nodes", ")", ":", "if", "not", "nodes", ":", "return", "[", "]", "resolved", "=", "[", "]", "for", "node", "in", "nodes", ":", "if", "node", "in", "resolved", ":", "continue", "self", ".", "resolve_node", "(...
Resolve a given set of nodes. Dependencies of the nodes, even if they are not in the given list will also be resolved! :param list nodes: List of nodes to be resolved :return: A list of resolved nodes
[ "Resolve", "a", "given", "set", "of", "nodes", "." ]
python
train
phoebe-project/phoebe2
phoebe/parameters/constraint.py
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/constraint.py#L195-L199
def t0_ref_to_supconj(t0_ref, period, ecc, per0): """ TODO: add documentation """ return ConstraintParameter(t0_ref._bundle, "t0_ref_to_supconj({}, {}, {}, {})".format(_get_expr(t0_ref), _get_expr(period), _get_expr(ecc), _get_expr(per0)))
[ "def", "t0_ref_to_supconj", "(", "t0_ref", ",", "period", ",", "ecc", ",", "per0", ")", ":", "return", "ConstraintParameter", "(", "t0_ref", ".", "_bundle", ",", "\"t0_ref_to_supconj({}, {}, {}, {})\"", ".", "format", "(", "_get_expr", "(", "t0_ref", ")", ",", ...
TODO: add documentation
[ "TODO", ":", "add", "documentation" ]
python
train
BD2KGenomics/toil-lib
src/toil_lib/abstractPipelineWrapper.py
https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/abstractPipelineWrapper.py#L123-L132
def __get_empty_config(self): """ Returns the config file contents as a string. The config file is generated and then deleted. """ self._generate_config() path = self._get_config_path() with open(path, 'r') as readable: contents = readable.read() os.re...
[ "def", "__get_empty_config", "(", "self", ")", ":", "self", ".", "_generate_config", "(", ")", "path", "=", "self", ".", "_get_config_path", "(", ")", "with", "open", "(", "path", ",", "'r'", ")", "as", "readable", ":", "contents", "=", "readable", ".", ...
Returns the config file contents as a string. The config file is generated and then deleted.
[ "Returns", "the", "config", "file", "contents", "as", "a", "string", ".", "The", "config", "file", "is", "generated", "and", "then", "deleted", "." ]
python
test
coleifer/walrus
walrus/containers.py
https://github.com/coleifer/walrus/blob/82bf15a6613487b5b5fefeb488f186d7e0106547/walrus/containers.py#L186-L193
def update(self, *args, **kwargs): """ Update the hash using the given dictionary or key/value pairs. """ if args: self.database.hmset(self.key, *args) else: self.database.hmset(self.key, kwargs)
[ "def", "update", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "args", ":", "self", ".", "database", ".", "hmset", "(", "self", ".", "key", ",", "*", "args", ")", "else", ":", "self", ".", "database", ".", "hmset", "("...
Update the hash using the given dictionary or key/value pairs.
[ "Update", "the", "hash", "using", "the", "given", "dictionary", "or", "key", "/", "value", "pairs", "." ]
python
train
EasyPost/pystalk
pystalk/client.py
https://github.com/EasyPost/pystalk/blob/96759ad1fda264b9897ee5346eef7926892a3a4c/pystalk/client.py#L344-L363
def watch(self, tube): """Add the given tube to the watchlist. :param tube: Name of the tube to add to the watchlist Note: Initially, all connections are watching a tube named "default". If you manually call :func:`watch()`, we will un-watch the "default" tube. To keep it in yo...
[ "def", "watch", "(", "self", ",", "tube", ")", ":", "with", "self", ".", "_sock_ctx", "(", ")", "as", "socket", ":", "self", ".", "desired_watchlist", ".", "add", "(", "tube", ")", "if", "tube", "not", "in", "self", ".", "_watchlist", ":", "self", ...
Add the given tube to the watchlist. :param tube: Name of the tube to add to the watchlist Note: Initially, all connections are watching a tube named "default". If you manually call :func:`watch()`, we will un-watch the "default" tube. To keep it in your list, first call :func:`watch()...
[ "Add", "the", "given", "tube", "to", "the", "watchlist", "." ]
python
train
facetoe/zenpy
zenpy/lib/api.py
https://github.com/facetoe/zenpy/blob/34c54c7e408b9ed01604ddf8b3422204c8bf31ea/zenpy/lib/api.py#L679-L687
def groups(self, user, include=None): """ Retrieve the groups for this user. :param include: list of objects to sideload. `Side-loading API Docs <https://developer.zendesk.com/rest_api/docs/core/side_loading>`__. :param user: User object or id """ return sel...
[ "def", "groups", "(", "self", ",", "user", ",", "include", "=", "None", ")", ":", "return", "self", ".", "_query_zendesk", "(", "self", ".", "endpoint", ".", "groups", ",", "'group'", ",", "id", "=", "user", ",", "include", "=", "include", ")" ]
Retrieve the groups for this user. :param include: list of objects to sideload. `Side-loading API Docs <https://developer.zendesk.com/rest_api/docs/core/side_loading>`__. :param user: User object or id
[ "Retrieve", "the", "groups", "for", "this", "user", "." ]
python
train
Spinmob/spinmob
_plotting_mess.py
https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_plotting_mess.py#L233-L256
def complex_function(f='1.0/(1+1j*x)', xmin=-1, xmax=1, steps=200, p='x', g=None, erange=False, **kwargs): """ Plots function(s) in the complex plane over the specified range. Parameters ---------- f='1.0/(1+1j*x)' Complex-valued function or list of functions to plot. ...
[ "def", "complex_function", "(", "f", "=", "'1.0/(1+1j*x)'", ",", "xmin", "=", "-", "1", ",", "xmax", "=", "1", ",", "steps", "=", "200", ",", "p", "=", "'x'", ",", "g", "=", "None", ",", "erange", "=", "False", ",", "*", "*", "kwargs", ")", ":"...
Plots function(s) in the complex plane over the specified range. Parameters ---------- f='1.0/(1+1j*x)' Complex-valued function or list of functions to plot. These can be string functions or single-argument python functions; additional globals can be supplied by g....
[ "Plots", "function", "(", "s", ")", "in", "the", "complex", "plane", "over", "the", "specified", "range", "." ]
python
train
openclimatedata/pyhector
pyhector/__init__.py
https://github.com/openclimatedata/pyhector/blob/1649efcc0ed19dc66d8de8dec7a5105fa08df01a/pyhector/__init__.py#L195-L265
def run(scenario, config=None, base_config=None, outputs=None, return_config=False): """ Runs a scenario through the Hector climate model. Parameters ---------- scenario : DataFrame DataFrame with emissions. See ``pyhector.rcp26`` for an example and :mod:`pyhector.units` for units o...
[ "def", "run", "(", "scenario", ",", "config", "=", "None", ",", "base_config", "=", "None", ",", "outputs", "=", "None", ",", "return_config", "=", "False", ")", ":", "if", "outputs", "is", "None", ":", "outputs", "=", "[", "\"temperature.Tgav\"", ",", ...
Runs a scenario through the Hector climate model. Parameters ---------- scenario : DataFrame DataFrame with emissions. See ``pyhector.rcp26`` for an example and :mod:`pyhector.units` for units of emissions values. config : dictionary, default ``None`` Additional config options t...
[ "Runs", "a", "scenario", "through", "the", "Hector", "climate", "model", "." ]
python
train
Hackerfleet/hfos
hfos/ui/objectmanager.py
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/ui/objectmanager.py#L595-L662
def delete(self, event): """Delete an existing object""" try: data, schema, user, client = self._get_args(event) except AttributeError: return try: uuids = data['uuid'] if not isinstance(uuids, list): uuids = [uuids] ...
[ "def", "delete", "(", "self", ",", "event", ")", ":", "try", ":", "data", ",", "schema", ",", "user", ",", "client", "=", "self", ".", "_get_args", "(", "event", ")", "except", "AttributeError", ":", "return", "try", ":", "uuids", "=", "data", "[", ...
Delete an existing object
[ "Delete", "an", "existing", "object" ]
python
train
pyviz/param
param/__init__.py
https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/__init__.py#L142-L161
def param_union(*parameterizeds, **kwargs): """ Given a set of Parameterized objects, returns a dictionary with the union of all param name,value pairs across them. If warn is True (default), warns if the same parameter has been given multiple values; otherwise uses the last value """ warn =...
[ "def", "param_union", "(", "*", "parameterizeds", ",", "*", "*", "kwargs", ")", ":", "warn", "=", "kwargs", ".", "pop", "(", "'warn'", ",", "True", ")", "if", "len", "(", "kwargs", ")", ":", "raise", "TypeError", "(", "\"param_union() got an unexpected key...
Given a set of Parameterized objects, returns a dictionary with the union of all param name,value pairs across them. If warn is True (default), warns if the same parameter has been given multiple values; otherwise uses the last value
[ "Given", "a", "set", "of", "Parameterized", "objects", "returns", "a", "dictionary", "with", "the", "union", "of", "all", "param", "name", "value", "pairs", "across", "them", ".", "If", "warn", "is", "True", "(", "default", ")", "warns", "if", "the", "sa...
python
train
timmahrt/pysle
pysle/isletool.py
https://github.com/timmahrt/pysle/blob/da7c3d9ebdc01647be845f442b6f072a854eba3b/pysle/isletool.py#L66-L86
def _buildDict(self): ''' Builds the isle textfile into a dictionary for fast searching ''' lexDict = {} with io.open(self.islePath, "r", encoding='utf-8') as fd: wordList = [line.rstrip('\n') for line in fd] for row in wordList: word, pro...
[ "def", "_buildDict", "(", "self", ")", ":", "lexDict", "=", "{", "}", "with", "io", ".", "open", "(", "self", ".", "islePath", ",", "\"r\"", ",", "encoding", "=", "'utf-8'", ")", "as", "fd", ":", "wordList", "=", "[", "line", ".", "rstrip", "(", ...
Builds the isle textfile into a dictionary for fast searching
[ "Builds", "the", "isle", "textfile", "into", "a", "dictionary", "for", "fast", "searching" ]
python
train
dmlc/gluon-nlp
src/gluonnlp/metric/masked_accuracy.py
https://github.com/dmlc/gluon-nlp/blob/4b83eb6bcc8881e5f1081a3675adaa19fac5c0ba/src/gluonnlp/metric/masked_accuracy.py#L232-L275
def update(self, labels, preds, masks=None): # pylint: disable=arguments-differ """Updates the internal evaluation result. Parameters ---------- labels : list of `NDArray` The labels of the data with class indices as values, one per sample. preds : list of `N...
[ "def", "update", "(", "self", ",", "labels", ",", "preds", ",", "masks", "=", "None", ")", ":", "# pylint: disable=arguments-differ", "labels", ",", "preds", "=", "check_label_shapes", "(", "labels", ",", "preds", ",", "True", ")", "masks", "=", "[", "None...
Updates the internal evaluation result. Parameters ---------- labels : list of `NDArray` The labels of the data with class indices as values, one per sample. preds : list of `NDArray` Prediction values for samples. Each prediction value can either be the class in...
[ "Updates", "the", "internal", "evaluation", "result", "." ]
python
train
lowandrew/OLCTools
spadespipeline/typingclasses.py
https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/typingclasses.py#L497-L577
def reporter(self): """ Creates a report of the results """ logging.info('Creating {at} report'.format(at=self.analysistype)) resistance_classes = ResistanceNotes.classes(self.targetpath) # Find unique gene names with the highest percent identity for sample in sel...
[ "def", "reporter", "(", "self", ")", ":", "logging", ".", "info", "(", "'Creating {at} report'", ".", "format", "(", "at", "=", "self", ".", "analysistype", ")", ")", "resistance_classes", "=", "ResistanceNotes", ".", "classes", "(", "self", ".", "targetpath...
Creates a report of the results
[ "Creates", "a", "report", "of", "the", "results" ]
python
train
marrow/mongo
marrow/mongo/core/trait/collection.py
https://github.com/marrow/mongo/blob/2066dc73e281b8a46cb5fc965267d6b8e1b18467/marrow/mongo/core/trait/collection.py#L228-L240
def insert_one(self, validate=True): """Insert this document. The `validate` argument translates to the inverse of the `bypass_document_validation` PyMongo option. https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.insert_one """ kw = {} kw['bypass_docu...
[ "def", "insert_one", "(", "self", ",", "validate", "=", "True", ")", ":", "kw", "=", "{", "}", "kw", "[", "'bypass_document_validation'", "]", "=", "not", "validate", "collection", "=", "self", ".", "get_collection", "(", "kw", ".", "pop", "(", "'source'...
Insert this document. The `validate` argument translates to the inverse of the `bypass_document_validation` PyMongo option. https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.insert_one
[ "Insert", "this", "document", ".", "The", "validate", "argument", "translates", "to", "the", "inverse", "of", "the", "bypass_document_validation", "PyMongo", "option", ".", "https", ":", "//", "api", ".", "mongodb", ".", "com", "/", "python", "/", "current", ...
python
train
Erotemic/utool
utool/util_inspect.py
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_inspect.py#L338-L545
def check_module_usage(modpath_patterns): """ FIXME: not fully implmented Desired behavior is --- Given a set of modules specified by a list of patterns, returns how the functions defined in the modules are called: a) with themselves and b) by other files in the project not in the given set. ...
[ "def", "check_module_usage", "(", "modpath_patterns", ")", ":", "import", "utool", "as", "ut", "#dpath = '~/code/ibeis/ibeis/algo/hots'", "modpaths", "=", "ut", ".", "flatten", "(", "[", "ut", ".", "glob_projects", "(", "pat", ")", "for", "pat", "in", "modpath_p...
FIXME: not fully implmented Desired behavior is --- Given a set of modules specified by a list of patterns, returns how the functions defined in the modules are called: a) with themselves and b) by other files in the project not in the given set. Args: modpath_patterns (list): Command...
[ "FIXME", ":", "not", "fully", "implmented" ]
python
train
chrisspen/burlap
burlap/packager.py
https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/packager.py#L143-L155
def refresh(self, *args, **kwargs): """ Updates/upgrades all system packages. """ r = self.local_renderer packager = self.packager if packager == APT: r.sudo('DEBIAN_FRONTEND=noninteractive apt-get -yq update --fix-missing') elif packager == YUM: ...
[ "def", "refresh", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "r", "=", "self", ".", "local_renderer", "packager", "=", "self", ".", "packager", "if", "packager", "==", "APT", ":", "r", ".", "sudo", "(", "'DEBIAN_FRONTEND=noninter...
Updates/upgrades all system packages.
[ "Updates", "/", "upgrades", "all", "system", "packages", "." ]
python
valid
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py#L752-L755
def mix2(servo1, servo2, mixtype=1, gain=0.5): '''de-mix a mixed servo output''' (v1,v2) = mixer(servo1, servo2, mixtype=mixtype, gain=gain) return v2
[ "def", "mix2", "(", "servo1", ",", "servo2", ",", "mixtype", "=", "1", ",", "gain", "=", "0.5", ")", ":", "(", "v1", ",", "v2", ")", "=", "mixer", "(", "servo1", ",", "servo2", ",", "mixtype", "=", "mixtype", ",", "gain", "=", "gain", ")", "ret...
de-mix a mixed servo output
[ "de", "-", "mix", "a", "mixed", "servo", "output" ]
python
train
fabaff/python-mystrom
pymystrom/switch.py
https://github.com/fabaff/python-mystrom/blob/86410f8952104651ef76ad37c84c29740c50551e/pymystrom/switch.py#L23-L33
def set_relay_on(self): """Turn the relay on.""" if not self.get_relay_state(): try: request = requests.get( '{}/relay'.format(self.resource), params={'state': '1'}, timeout=self.timeout) if request.status_code == 200: ...
[ "def", "set_relay_on", "(", "self", ")", ":", "if", "not", "self", ".", "get_relay_state", "(", ")", ":", "try", ":", "request", "=", "requests", ".", "get", "(", "'{}/relay'", ".", "format", "(", "self", ".", "resource", ")", ",", "params", "=", "{"...
Turn the relay on.
[ "Turn", "the", "relay", "on", "." ]
python
train
lambdamusic/Ontospy
ontospy/extras/shell_lib.py
https://github.com/lambdamusic/Ontospy/blob/eb46cb13792b2b87f21babdf976996318eec7571/ontospy/extras/shell_lib.py#L182-L188
def _joinedQnames(self, _list): """util for returning a string joinin names of entities *used only in info command*""" try: s = "; ".join([p.qname for p in _list]) except: s = "; ".join([p for p in _list]) return s
[ "def", "_joinedQnames", "(", "self", ",", "_list", ")", ":", "try", ":", "s", "=", "\"; \"", ".", "join", "(", "[", "p", ".", "qname", "for", "p", "in", "_list", "]", ")", "except", ":", "s", "=", "\"; \"", ".", "join", "(", "[", "p", "for", ...
util for returning a string joinin names of entities *used only in info command*
[ "util", "for", "returning", "a", "string", "joinin", "names", "of", "entities", "*", "used", "only", "in", "info", "command", "*" ]
python
train
SiLab-Bonn/basil
basil/HL/i2c.py
https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/HL/i2c.py#L93-L108
def write(self, addr, data): '''Write access. :param addr: i2c slave address :type addr: char :param data: array/list of bytes :type data: iterable :rtype: None ''' self.set_addr(addr & 0xfe) self.set_data(data) self.set_size(...
[ "def", "write", "(", "self", ",", "addr", ",", "data", ")", ":", "self", ".", "set_addr", "(", "addr", "&", "0xfe", ")", "self", ".", "set_data", "(", "data", ")", "self", ".", "set_size", "(", "len", "(", "data", ")", ")", "self", ".", "start", ...
Write access. :param addr: i2c slave address :type addr: char :param data: array/list of bytes :type data: iterable :rtype: None
[ "Write", "access", ".", ":", "param", "addr", ":", "i2c", "slave", "address", ":", "type", "addr", ":", "char", ":", "param", "data", ":", "array", "/", "list", "of", "bytes", ":", "type", "data", ":", "iterable", ":", "rtype", ":", "None" ]
python
train
blockadeio/analyst_toolbench
blockade/cli/aws_serverless.py
https://github.com/blockadeio/analyst_toolbench/blob/159b6f8cf8a91c5ff050f1579636ea90ab269863/blockade/cli/aws_serverless.py#L530-L549
def generate_s3_bucket(): """Create the blockade bucket if not already there.""" logger.debug("[#] Setting up S3 bucket") client = boto3.client("s3", region_name=PRIMARY_REGION) buckets = client.list_buckets() matches = [x for x in buckets.get('Buckets', list()) if x['Name'].startswit...
[ "def", "generate_s3_bucket", "(", ")", ":", "logger", ".", "debug", "(", "\"[#] Setting up S3 bucket\"", ")", "client", "=", "boto3", ".", "client", "(", "\"s3\"", ",", "region_name", "=", "PRIMARY_REGION", ")", "buckets", "=", "client", ".", "list_buckets", "...
Create the blockade bucket if not already there.
[ "Create", "the", "blockade", "bucket", "if", "not", "already", "there", "." ]
python
train
inveniosoftware/invenio-openaire
invenio_openaire/tasks.py
https://github.com/inveniosoftware/invenio-openaire/blob/71860effff6abe7f658d3a11894e064202ef1c36/invenio_openaire/tasks.py#L63-L71
def harvest_all_openaire_projects(): """Reharvest all grants from OpenAIRE. Harvest all OpenAIRE grants in a chain to prevent OpenAIRE overloading from multiple parallel harvesting. """ setspecs = current_app.config['OPENAIRE_GRANTS_SPECS'] chain(harvest_openaire_projects.s(setspec=setspec) ...
[ "def", "harvest_all_openaire_projects", "(", ")", ":", "setspecs", "=", "current_app", ".", "config", "[", "'OPENAIRE_GRANTS_SPECS'", "]", "chain", "(", "harvest_openaire_projects", ".", "s", "(", "setspec", "=", "setspec", ")", "for", "setspec", "in", "setspecs",...
Reharvest all grants from OpenAIRE. Harvest all OpenAIRE grants in a chain to prevent OpenAIRE overloading from multiple parallel harvesting.
[ "Reharvest", "all", "grants", "from", "OpenAIRE", "." ]
python
train
MacHu-GWU/crawlib-project
crawlib/pipeline/mongodb/query_builder.py
https://github.com/MacHu-GWU/crawlib-project/blob/241516f2a7a0a32c692f7af35a1f44064e8ce1ab/crawlib/pipeline/mongodb/query_builder.py#L52-L77
def unfinished(finished_status, update_interval, status_key, edit_at_key): """ Create dict query for pymongo that getting all unfinished task. :param finished_status: int, status code that less than this will be considered as unfinished. :param updat...
[ "def", "unfinished", "(", "finished_status", ",", "update_interval", ",", "status_key", ",", "edit_at_key", ")", ":", "return", "{", "\"$or\"", ":", "[", "{", "status_key", ":", "{", "\"$lt\"", ":", "finished_status", "}", "}", ",", "{", "edit_at_key", ":", ...
Create dict query for pymongo that getting all unfinished task. :param finished_status: int, status code that less than this will be considered as unfinished. :param update_interval: int, the record will be updated every x seconds. :param status_key: status code field key, support dot notation. ...
[ "Create", "dict", "query", "for", "pymongo", "that", "getting", "all", "unfinished", "task", "." ]
python
train
gem/oq-engine
openquake/hmtk/plotting/mapping.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hmtk/plotting/mapping.py#L298-L335
def _plot_complex_fault(self, source, border='k-', border_width=1.0, min_depth=0., max_depth=None, alpha=1.0): """ Plots the simple fault source as a composite of the fault trace and the surface projection of the fault. :param source: Fault source ...
[ "def", "_plot_complex_fault", "(", "self", ",", "source", ",", "border", "=", "'k-'", ",", "border_width", "=", "1.0", ",", "min_depth", "=", "0.", ",", "max_depth", "=", "None", ",", "alpha", "=", "1.0", ")", ":", "if", "not", "max_depth", ":", "max_d...
Plots the simple fault source as a composite of the fault trace and the surface projection of the fault. :param source: Fault source as instance of :class: mtkSimpleFaultSource :param str border: Line properties of border (see matplotlib documentation for detail) ...
[ "Plots", "the", "simple", "fault", "source", "as", "a", "composite", "of", "the", "fault", "trace", "and", "the", "surface", "projection", "of", "the", "fault", ".", ":", "param", "source", ":", "Fault", "source", "as", "instance", "of", ":", "class", ":...
python
train
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/utils/pickleshare.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/pickleshare.py#L184-L191
def keys(self, globpat = None): """ All keys in DB, or all keys matching a glob""" if globpat is None: files = self.root.walkfiles() else: files = [Path(p) for p in glob.glob(self.root/globpat)] return [self._normalized(p) for p in files if p.isfile()]
[ "def", "keys", "(", "self", ",", "globpat", "=", "None", ")", ":", "if", "globpat", "is", "None", ":", "files", "=", "self", ".", "root", ".", "walkfiles", "(", ")", "else", ":", "files", "=", "[", "Path", "(", "p", ")", "for", "p", "in", "glob...
All keys in DB, or all keys matching a glob
[ "All", "keys", "in", "DB", "or", "all", "keys", "matching", "a", "glob" ]
python
test
mikedh/trimesh
trimesh/graph.py
https://github.com/mikedh/trimesh/blob/25e059bf6d4caa74f62ffd58ce4f61a90ee4e518/trimesh/graph.py#L236-L248
def connected_edges(G, nodes): """ Given graph G and list of nodes, return the list of edges that are connected to nodes """ nodes_in_G = collections.deque() for node in nodes: if not G.has_node(node): continue nodes_in_G.extend(nx.node_connected_component(G, node)) ...
[ "def", "connected_edges", "(", "G", ",", "nodes", ")", ":", "nodes_in_G", "=", "collections", ".", "deque", "(", ")", "for", "node", "in", "nodes", ":", "if", "not", "G", ".", "has_node", "(", "node", ")", ":", "continue", "nodes_in_G", ".", "extend", ...
Given graph G and list of nodes, return the list of edges that are connected to nodes
[ "Given", "graph", "G", "and", "list", "of", "nodes", "return", "the", "list", "of", "edges", "that", "are", "connected", "to", "nodes" ]
python
train
PyGithub/PyGithub
github/Organization.py
https://github.com/PyGithub/PyGithub/blob/f716df86bbe7dc276c6596699fa9712b61ef974c/github/Organization.py#L759-L774
def get_repos(self, type=github.GithubObject.NotSet): """ :calls: `GET /orgs/:org/repos <http://developer.github.com/v3/repos>`_ :param type: string ('all', 'public', 'private', 'forks', 'sources', 'member') :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository...
[ "def", "get_repos", "(", "self", ",", "type", "=", "github", ".", "GithubObject", ".", "NotSet", ")", ":", "assert", "type", "is", "github", ".", "GithubObject", ".", "NotSet", "or", "isinstance", "(", "type", ",", "(", "str", ",", "unicode", ")", ")",...
:calls: `GET /orgs/:org/repos <http://developer.github.com/v3/repos>`_ :param type: string ('all', 'public', 'private', 'forks', 'sources', 'member') :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository`
[ ":", "calls", ":", "GET", "/", "orgs", "/", ":", "org", "/", "repos", "<http", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "repos", ">", "_", ":", "param", "type", ":", "string", "(", "all", "public", "private", "forks", "s...
python
train
mcash/merchant-api-python-sdk
mcash/mapi_client/mapi_client.py
https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L492-L512
def update_ticket(self, tid, tickets=None): """If the customer should be granted an electronic ticket as a result of a successful payment, the merchant may (at any time) PUT ticket information to this endpoint. There is an ordered list of tickets; the merchant may PUT several times to up...
[ "def", "update_ticket", "(", "self", ",", "tid", ",", "tickets", "=", "None", ")", ":", "arguments", "=", "{", "'tickets'", ":", "tickets", "}", "return", "self", ".", "do_req", "(", "'PUT'", ",", "self", ".", "merchant_api_base_url", "+", "'/payment_reque...
If the customer should be granted an electronic ticket as a result of a successful payment, the merchant may (at any time) PUT ticket information to this endpoint. There is an ordered list of tickets; the merchant may PUT several times to update the list. The PUT overwrites any existing ...
[ "If", "the", "customer", "should", "be", "granted", "an", "electronic", "ticket", "as", "a", "result", "of", "a", "successful", "payment", "the", "merchant", "may", "(", "at", "any", "time", ")", "PUT", "ticket", "information", "to", "this", "endpoint", "....
python
train
SmokinCaterpillar/pypet
pypet/parameter.py
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/parameter.py#L1566-L1578
def _build_names(self, name_idx, is_dia): """Formats a name for storage :return: A tuple of names with the following format: `xspm__spsp__XXXX__spsp__XXXXXXXX` where the first 'XXXX' refer to the property and the latter 'XXXXXXX' to the sparse matrix index. """ ...
[ "def", "_build_names", "(", "self", ",", "name_idx", ",", "is_dia", ")", ":", "name_list", "=", "self", ".", "_get_name_list", "(", "is_dia", ")", "return", "tuple", "(", "[", "'explored%s.set_%05d.xspm_%s_%08d'", "%", "(", "SparseParameter", ".", "IDENTIFIER", ...
Formats a name for storage :return: A tuple of names with the following format: `xspm__spsp__XXXX__spsp__XXXXXXXX` where the first 'XXXX' refer to the property and the latter 'XXXXXXX' to the sparse matrix index.
[ "Formats", "a", "name", "for", "storage" ]
python
test
instana/python-sensor
instana/agent.py
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/agent.py#L207-L227
def task_response(self, message_id, data): """ When the host agent passes us a task and we do it, this function is used to respond with the results of the task. """ try: response = None payload = json.dumps(data) logger.debug("Task response is...
[ "def", "task_response", "(", "self", ",", "message_id", ",", "data", ")", ":", "try", ":", "response", "=", "None", "payload", "=", "json", ".", "dumps", "(", "data", ")", "logger", ".", "debug", "(", "\"Task response is %s: %s\"", "%", "(", "self", ".",...
When the host agent passes us a task and we do it, this function is used to respond with the results of the task.
[ "When", "the", "host", "agent", "passes", "us", "a", "task", "and", "we", "do", "it", "this", "function", "is", "used", "to", "respond", "with", "the", "results", "of", "the", "task", "." ]
python
train
pallets/werkzeug
src/werkzeug/http.py
https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/http.py#L337-L375
def parse_dict_header(value, cls=dict): """Parse lists of key, value pairs as described by RFC 2068 Section 2 and convert them into a python dict (or any other mapping object created from the type with a dict like interface provided by the `cls` argument): >>> d = parse_dict_header('foo="is a fish", ba...
[ "def", "parse_dict_header", "(", "value", ",", "cls", "=", "dict", ")", ":", "result", "=", "cls", "(", ")", "if", "not", "isinstance", "(", "value", ",", "text_type", ")", ":", "# XXX: validate", "value", "=", "bytes_to_wsgi", "(", "value", ")", "for", ...
Parse lists of key, value pairs as described by RFC 2068 Section 2 and convert them into a python dict (or any other mapping object created from the type with a dict like interface provided by the `cls` argument): >>> d = parse_dict_header('foo="is a fish", bar="as well"') >>> type(d) is dict True ...
[ "Parse", "lists", "of", "key", "value", "pairs", "as", "described", "by", "RFC", "2068", "Section", "2", "and", "convert", "them", "into", "a", "python", "dict", "(", "or", "any", "other", "mapping", "object", "created", "from", "the", "type", "with", "a...
python
train
cisco-sas/kitty
kitty/fuzzers/server.py
https://github.com/cisco-sas/kitty/blob/cb0760989dcdfe079e43ac574d872d0b18953a32/kitty/fuzzers/server.py#L59-L75
def _run_sequence(self, sequence): ''' Run a single sequence ''' self._check_pause() self._pre_test() session_data = self.target.get_session_data() self._test_info() resp = None for edge in sequence: if edge.callback: ed...
[ "def", "_run_sequence", "(", "self", ",", "sequence", ")", ":", "self", ".", "_check_pause", "(", ")", "self", ".", "_pre_test", "(", ")", "session_data", "=", "self", ".", "target", ".", "get_session_data", "(", ")", "self", ".", "_test_info", "(", ")",...
Run a single sequence
[ "Run", "a", "single", "sequence" ]
python
train
pandas-dev/pandas
pandas/core/groupby/groupby.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/groupby/groupby.py#L756-L799
def _try_cast(self, result, obj, numeric_only=False): """ Try to cast the result to our obj original type, we may have roundtripped through object in the mean-time. If numeric_only is True, then only try to cast numerics and not datetimelikes. """ if obj.ndim > ...
[ "def", "_try_cast", "(", "self", ",", "result", ",", "obj", ",", "numeric_only", "=", "False", ")", ":", "if", "obj", ".", "ndim", ">", "1", ":", "dtype", "=", "obj", ".", "_values", ".", "dtype", "else", ":", "dtype", "=", "obj", ".", "dtype", "...
Try to cast the result to our obj original type, we may have roundtripped through object in the mean-time. If numeric_only is True, then only try to cast numerics and not datetimelikes.
[ "Try", "to", "cast", "the", "result", "to", "our", "obj", "original", "type", "we", "may", "have", "roundtripped", "through", "object", "in", "the", "mean", "-", "time", "." ]
python
train