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
matthieugouel/gibica
gibica/sementic.py
https://github.com/matthieugouel/gibica/blob/65f937f7a6255078cc22eb7691a2897466032909/gibica/sementic.py#L113-L115
def append_table(self, name, **kwargs): """Create a new table.""" self.stack.append(Table(name, **kwargs))
[ "def", "append_table", "(", "self", ",", "name", ",", "*", "*", "kwargs", ")", ":", "self", ".", "stack", ".", "append", "(", "Table", "(", "name", ",", "*", "*", "kwargs", ")", ")" ]
Create a new table.
[ "Create", "a", "new", "table", "." ]
python
train
Music-Moo/music2storage
music2storage/service.py
https://github.com/Music-Moo/music2storage/blob/de12b9046dd227fc8c1512b5060e7f5fcd8b0ee2/music2storage/service.py#L82-L101
def download(self, url): """ Downloads a MP3 file that is associated with the track at the URL passed. :param str url: URL of the track to be downloaded """ try: track = self.client.get('/resolve', url=url) except HTTPError: log.error(f"{...
[ "def", "download", "(", "self", ",", "url", ")", ":", "try", ":", "track", "=", "self", ".", "client", ".", "get", "(", "'/resolve'", ",", "url", "=", "url", ")", "except", "HTTPError", ":", "log", ".", "error", "(", "f\"{url} is not a Soundcloud URL.\""...
Downloads a MP3 file that is associated with the track at the URL passed. :param str url: URL of the track to be downloaded
[ "Downloads", "a", "MP3", "file", "that", "is", "associated", "with", "the", "track", "at", "the", "URL", "passed", ".", ":", "param", "str", "url", ":", "URL", "of", "the", "track", "to", "be", "downloaded" ]
python
test
tehmaze/diagram
diagram.py
https://github.com/tehmaze/diagram/blob/1701526a91c14dc8ebc6452c45c8ec9a563a56db/diagram.py#L373-L415
def consume(self, istream, ostream, batch=False): """Read points from istream and output to ostream.""" datapoints = [] # List of 2-tuples if batch: sleep = max(0.01, self.option.sleep) fd = istream.fileno() while True: try: ...
[ "def", "consume", "(", "self", ",", "istream", ",", "ostream", ",", "batch", "=", "False", ")", ":", "datapoints", "=", "[", "]", "# List of 2-tuples", "if", "batch", ":", "sleep", "=", "max", "(", "0.01", ",", "self", ".", "option", ".", "sleep", ")...
Read points from istream and output to ostream.
[ "Read", "points", "from", "istream", "and", "output", "to", "ostream", "." ]
python
valid
Kronuz/pyScss
scss/extension/compass/helpers.py
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/extension/compass/helpers.py#L73-L83
def compact(*args): """Returns a new list after removing any non-true values""" use_comma = True if len(args) == 1 and isinstance(args[0], List): use_comma = args[0].use_comma args = args[0] return List( [arg for arg in args if arg], use_comma=use_comma, )
[ "def", "compact", "(", "*", "args", ")", ":", "use_comma", "=", "True", "if", "len", "(", "args", ")", "==", "1", "and", "isinstance", "(", "args", "[", "0", "]", ",", "List", ")", ":", "use_comma", "=", "args", "[", "0", "]", ".", "use_comma", ...
Returns a new list after removing any non-true values
[ "Returns", "a", "new", "list", "after", "removing", "any", "non", "-", "true", "values" ]
python
train
fake-name/ChromeController
ChromeController/Generator/Generated.py
https://github.com/fake-name/ChromeController/blob/914dd136184e8f1165c7aa6ef30418aaf10c61f0/ChromeController/Generator/Generated.py#L1843-L1863
def Emulation_setNavigatorOverrides(self, platform): """ Function path: Emulation.setNavigatorOverrides Domain: Emulation Method name: setNavigatorOverrides WARNING: This function is marked 'Experimental'! Parameters: Required arguments: 'platform' (type: string) -> The platform navigator...
[ "def", "Emulation_setNavigatorOverrides", "(", "self", ",", "platform", ")", ":", "assert", "isinstance", "(", "platform", ",", "(", "str", ",", ")", ")", ",", "\"Argument 'platform' must be of type '['str']'. Received type: '%s'\"", "%", "type", "(", "platform", ")",...
Function path: Emulation.setNavigatorOverrides Domain: Emulation Method name: setNavigatorOverrides WARNING: This function is marked 'Experimental'! Parameters: Required arguments: 'platform' (type: string) -> The platform navigator.platform should return. No return value. Descriptio...
[ "Function", "path", ":", "Emulation", ".", "setNavigatorOverrides", "Domain", ":", "Emulation", "Method", "name", ":", "setNavigatorOverrides", "WARNING", ":", "This", "function", "is", "marked", "Experimental", "!", "Parameters", ":", "Required", "arguments", ":", ...
python
train
rbw/flask-journey
flask_journey/journey.py
https://github.com/rbw/flask-journey/blob/6181f59a7b5eef6a85b86ce6ed7d03c91f6bd285/flask_journey/journey.py#L135-L154
def _register_blueprint(self, app, bp, bundle_path, child_path, description): """Register and return info about the registered blueprint :param bp: :class:`flask.Blueprint` object :param bundle_path: the URL prefix of the bundle :param child_path: blueprint relative to the bundle path ...
[ "def", "_register_blueprint", "(", "self", ",", "app", ",", "bp", ",", "bundle_path", ",", "child_path", ",", "description", ")", ":", "base_path", "=", "sanitize_path", "(", "self", ".", "_journey_path", "+", "bundle_path", "+", "child_path", ")", "app", "....
Register and return info about the registered blueprint :param bp: :class:`flask.Blueprint` object :param bundle_path: the URL prefix of the bundle :param child_path: blueprint relative to the bundle path :return: Dict with info about the blueprint
[ "Register", "and", "return", "info", "about", "the", "registered", "blueprint" ]
python
valid
PyCQA/astroid
astroid/node_classes.py
https://github.com/PyCQA/astroid/blob/e0a298df55b15abcb77c2a93253f5ab7be52d0fb/astroid/node_classes.py#L3780-L3792
def raises_not_implemented(self): """Check if this node raises a :class:`NotImplementedError`. :returns: True if this node raises a :class:`NotImplementedError`, False otherwise. :rtype: bool """ if not self.exc: return False for name in self.exc....
[ "def", "raises_not_implemented", "(", "self", ")", ":", "if", "not", "self", ".", "exc", ":", "return", "False", "for", "name", "in", "self", ".", "exc", ".", "_get_name_nodes", "(", ")", ":", "if", "name", ".", "name", "==", "\"NotImplementedError\"", "...
Check if this node raises a :class:`NotImplementedError`. :returns: True if this node raises a :class:`NotImplementedError`, False otherwise. :rtype: bool
[ "Check", "if", "this", "node", "raises", "a", ":", "class", ":", "NotImplementedError", "." ]
python
train
hyperledger/sawtooth-core
rest_api/sawtooth_rest_api/state_delta_subscription_handler.py
https://github.com/hyperledger/sawtooth-core/blob/8cf473bc2207e51f02bd182d825158a57d72b098/rest_api/sawtooth_rest_api/state_delta_subscription_handler.py#L88-L117
async def subscriptions(self, request): """ Handles requests for new subscription websockets. Args: request (aiohttp.Request): the incoming request Returns: aiohttp.web.WebSocketResponse: the websocket response, when the resulting websocket is cl...
[ "async", "def", "subscriptions", "(", "self", ",", "request", ")", ":", "if", "not", "self", ".", "_accepting", ":", "return", "web", ".", "Response", "(", "status", "=", "503", ")", "web_sock", "=", "web", ".", "WebSocketResponse", "(", ")", "await", ...
Handles requests for new subscription websockets. Args: request (aiohttp.Request): the incoming request Returns: aiohttp.web.WebSocketResponse: the websocket response, when the resulting websocket is closed
[ "Handles", "requests", "for", "new", "subscription", "websockets", "." ]
python
train
pkgw/pwkit
pwkit/numutil.py
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/numutil.py#L283-L348
def reduce_data_frame (df, chunk_slicers, avg_cols=(), uavg_cols=(), minmax_cols=(), nchunk_colname='nchunk', uncert_prefix='u', min_points_per_chunk=3): """"Reduce" a DataFrame ...
[ "def", "reduce_data_frame", "(", "df", ",", "chunk_slicers", ",", "avg_cols", "=", "(", ")", ",", "uavg_cols", "=", "(", ")", ",", "minmax_cols", "=", "(", ")", ",", "nchunk_colname", "=", "'nchunk'", ",", "uncert_prefix", "=", "'u'", ",", "min_points_per_...
Reduce" a DataFrame by collapsing rows in grouped chunks. Returns another DataFrame with similar columns but fewer rows. Arguments: df The input :class:`pandas.DataFrame`. chunk_slicers An iterable that returns values that are used to slice *df* with its :meth:`pandas.DataFrame.iloc`...
[ "Reduce", "a", "DataFrame", "by", "collapsing", "rows", "in", "grouped", "chunks", ".", "Returns", "another", "DataFrame", "with", "similar", "columns", "but", "fewer", "rows", "." ]
python
train
Dallinger/Dallinger
dallinger/notifications.py
https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/notifications.py#L42-L52
def validate(self): """Could this config be used to send a real email?""" missing = [] for k, v in self._map.items(): attr = getattr(self, k, False) if not attr or attr == CONFIG_PLACEHOLDER: missing.append(v) if missing: return "Missin...
[ "def", "validate", "(", "self", ")", ":", "missing", "=", "[", "]", "for", "k", ",", "v", "in", "self", ".", "_map", ".", "items", "(", ")", ":", "attr", "=", "getattr", "(", "self", ",", "k", ",", "False", ")", "if", "not", "attr", "or", "at...
Could this config be used to send a real email?
[ "Could", "this", "config", "be", "used", "to", "send", "a", "real", "email?" ]
python
train
lk-geimfari/mimesis
mimesis/providers/date.py
https://github.com/lk-geimfari/mimesis/blob/4b16ee7a8dba6281a904654a88dbb4b052869fc5/mimesis/providers/date.py#L229-L243
def formatted_datetime(self, fmt: str = '', **kwargs) -> str: """Generate datetime string in human readable format. :param fmt: Custom format (default is format for current locale) :param kwargs: Keyword arguments for :meth:`~Datetime.datetime()` :return: Formatted datetime string. ...
[ "def", "formatted_datetime", "(", "self", ",", "fmt", ":", "str", "=", "''", ",", "*", "*", "kwargs", ")", "->", "str", ":", "dt_obj", "=", "self", ".", "datetime", "(", "*", "*", "kwargs", ")", "if", "not", "fmt", ":", "date_fmt", "=", "self", "...
Generate datetime string in human readable format. :param fmt: Custom format (default is format for current locale) :param kwargs: Keyword arguments for :meth:`~Datetime.datetime()` :return: Formatted datetime string.
[ "Generate", "datetime", "string", "in", "human", "readable", "format", "." ]
python
train
toastdriven/alligator
alligator/utils.py
https://github.com/toastdriven/alligator/blob/f18bcb35b350fc6b0886393f5246d69c892b36c7/alligator/utils.py#L49-L67
def import_module(module_name): """ Given a dotted Python path, imports & returns the module. If not found, raises ``UnknownModuleError``. Ex:: mod = import_module('random') :param module_name: The dotted Python path :type module_name: string :returns: module """ try: ...
[ "def", "import_module", "(", "module_name", ")", ":", "try", ":", "return", "importlib", ".", "import_module", "(", "module_name", ")", "except", "ImportError", "as", "err", ":", "raise", "UnknownModuleError", "(", "str", "(", "err", ")", ")" ]
Given a dotted Python path, imports & returns the module. If not found, raises ``UnknownModuleError``. Ex:: mod = import_module('random') :param module_name: The dotted Python path :type module_name: string :returns: module
[ "Given", "a", "dotted", "Python", "path", "imports", "&", "returns", "the", "module", "." ]
python
train
tgsmith61591/pmdarima
pmdarima/preprocessing/endog/boxcox.py
https://github.com/tgsmith61591/pmdarima/blob/a133de78ba5bd68da9785b061f519ba28cd514cc/pmdarima/preprocessing/endog/boxcox.py#L52-L80
def fit(self, y, exogenous=None): """Fit the transformer Learns the value of ``lmbda``, if not specified in the constructor. If defined in the constructor, is not re-learned. Parameters ---------- y : array-like or None, shape=(n_samples,) The endogenous (ti...
[ "def", "fit", "(", "self", ",", "y", ",", "exogenous", "=", "None", ")", ":", "lam1", "=", "self", ".", "lmbda", "lam2", "=", "self", ".", "lmbda2", "if", "lam2", "<", "0", ":", "raise", "ValueError", "(", "\"lmbda2 must be a non-negative scalar value\"", ...
Fit the transformer Learns the value of ``lmbda``, if not specified in the constructor. If defined in the constructor, is not re-learned. Parameters ---------- y : array-like or None, shape=(n_samples,) The endogenous (time-series) array. exogenous : array-...
[ "Fit", "the", "transformer" ]
python
train
blockstack/blockstack-core
blockstack/blockstackd.py
https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/blockstackd.py#L1498-L1508
def rpc_get_num_names_cumulative( self, **con_info ): """ Get the number of names that have ever existed Return {'status': True, 'count': count} on success Return {'error': ...} on error """ db = get_db_state(self.working_dir) num_names = db.get_num_names(include_...
[ "def", "rpc_get_num_names_cumulative", "(", "self", ",", "*", "*", "con_info", ")", ":", "db", "=", "get_db_state", "(", "self", ".", "working_dir", ")", "num_names", "=", "db", ".", "get_num_names", "(", "include_expired", "=", "True", ")", "db", ".", "cl...
Get the number of names that have ever existed Return {'status': True, 'count': count} on success Return {'error': ...} on error
[ "Get", "the", "number", "of", "names", "that", "have", "ever", "existed", "Return", "{", "status", ":", "True", "count", ":", "count", "}", "on", "success", "Return", "{", "error", ":", "...", "}", "on", "error" ]
python
train
pandas-dev/pandas
pandas/util/_decorators.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/util/_decorators.py#L324-L351
def make_signature(func): """ Returns a tuple containing the paramenter list with defaults and parameter list. Examples -------- >>> def f(a, b, c=2): >>> return a * b * c >>> print(make_signature(f)) (['a', 'b', 'c=2'], ['a', 'b', 'c']) """ spec = inspect.getfullargspe...
[ "def", "make_signature", "(", "func", ")", ":", "spec", "=", "inspect", ".", "getfullargspec", "(", "func", ")", "if", "spec", ".", "defaults", "is", "None", ":", "n_wo_defaults", "=", "len", "(", "spec", ".", "args", ")", "defaults", "=", "(", "''", ...
Returns a tuple containing the paramenter list with defaults and parameter list. Examples -------- >>> def f(a, b, c=2): >>> return a * b * c >>> print(make_signature(f)) (['a', 'b', 'c=2'], ['a', 'b', 'c'])
[ "Returns", "a", "tuple", "containing", "the", "paramenter", "list", "with", "defaults", "and", "parameter", "list", "." ]
python
train
obriencj/python-javatools
javatools/manifest.py
https://github.com/obriencj/python-javatools/blob/9e2332b452ddc508bed0615937dddcb2cf051557/javatools/manifest.py#L287-L295
def get_data(self, linesep=os.linesep): """ Serialize the section and return it as bytes :return bytes """ stream = BytesIO() self.store(stream, linesep) return stream.getvalue()
[ "def", "get_data", "(", "self", ",", "linesep", "=", "os", ".", "linesep", ")", ":", "stream", "=", "BytesIO", "(", ")", "self", ".", "store", "(", "stream", ",", "linesep", ")", "return", "stream", ".", "getvalue", "(", ")" ]
Serialize the section and return it as bytes :return bytes
[ "Serialize", "the", "section", "and", "return", "it", "as", "bytes", ":", "return", "bytes" ]
python
train
boriel/zxbasic
zxbpp.py
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpp.py#L517-L527
def p_ifdef_else_a(p): """ ifdefelsea : if_header NEWLINE program """ global ENABLED if ENABLED: p[0] = [p[2]] + p[3] else: p[0] = [] ENABLED = not ENABLED
[ "def", "p_ifdef_else_a", "(", "p", ")", ":", "global", "ENABLED", "if", "ENABLED", ":", "p", "[", "0", "]", "=", "[", "p", "[", "2", "]", "]", "+", "p", "[", "3", "]", "else", ":", "p", "[", "0", "]", "=", "[", "]", "ENABLED", "=", "not", ...
ifdefelsea : if_header NEWLINE program
[ "ifdefelsea", ":", "if_header", "NEWLINE", "program" ]
python
train
splunk/splunk-sdk-python
examples/analytics/bottle.py
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/analytics/bottle.py#L613-L615
def delete(self, path=None, method='DELETE', **options): """ Equals :meth:`route` with a ``DELETE`` method parameter. """ return self.route(path, method, **options)
[ "def", "delete", "(", "self", ",", "path", "=", "None", ",", "method", "=", "'DELETE'", ",", "*", "*", "options", ")", ":", "return", "self", ".", "route", "(", "path", ",", "method", ",", "*", "*", "options", ")" ]
Equals :meth:`route` with a ``DELETE`` method parameter.
[ "Equals", ":", "meth", ":", "route", "with", "a", "DELETE", "method", "parameter", "." ]
python
train
google/grr
grr/server/grr_response_server/databases/mem_cronjobs.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_cronjobs.py#L44-L65
def UpdateCronJob(self, cronjob_id, last_run_status=db.Database.unchanged, last_run_time=db.Database.unchanged, current_run_id=db.Database.unchanged, state=db.Database.unchanged, forced_run_requested=...
[ "def", "UpdateCronJob", "(", "self", ",", "cronjob_id", ",", "last_run_status", "=", "db", ".", "Database", ".", "unchanged", ",", "last_run_time", "=", "db", ".", "Database", ".", "unchanged", ",", "current_run_id", "=", "db", ".", "Database", ".", "unchang...
Updates run information for an existing cron job.
[ "Updates", "run", "information", "for", "an", "existing", "cron", "job", "." ]
python
train
KeepSafe/android-resource-remover
android_clean_app.py
https://github.com/KeepSafe/android-resource-remover/blob/f2b4fb5a6822da79c9b166e3250ca6bdc6ee06e8/android_clean_app.py#L87-L105
def run_lint_command(): """ Run lint command in the shell and save results to lint-result.xml """ lint, app_dir, lint_result, ignore_layouts = parse_args() if not lint_result: if not distutils.spawn.find_executable(lint): raise Exception( '`%s` executable could no...
[ "def", "run_lint_command", "(", ")", ":", "lint", ",", "app_dir", ",", "lint_result", ",", "ignore_layouts", "=", "parse_args", "(", ")", "if", "not", "lint_result", ":", "if", "not", "distutils", ".", "spawn", ".", "find_executable", "(", "lint", ")", ":"...
Run lint command in the shell and save results to lint-result.xml
[ "Run", "lint", "command", "in", "the", "shell", "and", "save", "results", "to", "lint", "-", "result", ".", "xml" ]
python
train
noxdafox/vminspect
vminspect/vulnscan.py
https://github.com/noxdafox/vminspect/blob/e685282564877e2d1950f1e09b292f4f4db1dbcd/vminspect/vulnscan.py#L68-L99
def scan(self, concurrency=1): """Iterates over the applications installed within the disk and queries the CVE DB to determine whether they are vulnerable. Concurrency controls the amount of concurrent queries against the CVE DB. For each vulnerable application the method yield...
[ "def", "scan", "(", "self", ",", "concurrency", "=", "1", ")", ":", "self", ".", "logger", ".", "debug", "(", "\"Scanning FS content.\"", ")", "with", "ThreadPoolExecutor", "(", "max_workers", "=", "concurrency", ")", "as", "executor", ":", "results", "=", ...
Iterates over the applications installed within the disk and queries the CVE DB to determine whether they are vulnerable. Concurrency controls the amount of concurrent queries against the CVE DB. For each vulnerable application the method yields a namedtuple: VulnApp(name ...
[ "Iterates", "over", "the", "applications", "installed", "within", "the", "disk", "and", "queries", "the", "CVE", "DB", "to", "determine", "whether", "they", "are", "vulnerable", "." ]
python
train
GNS3/gns3-server
gns3server/compute/builtin/nodes/ethernet_hub.py
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/builtin/nodes/ethernet_hub.py#L48-L54
def create(self): """ Creates this hub. """ super().create() log.info('Ethernet hub "{name}" [{id}] has been created'.format(name=self._name, id=self._id))
[ "def", "create", "(", "self", ")", ":", "super", "(", ")", ".", "create", "(", ")", "log", ".", "info", "(", "'Ethernet hub \"{name}\" [{id}] has been created'", ".", "format", "(", "name", "=", "self", ".", "_name", ",", "id", "=", "self", ".", "_id", ...
Creates this hub.
[ "Creates", "this", "hub", "." ]
python
train
textX/textX
textx/metamodel.py
https://github.com/textX/textX/blob/5796ac38116ad86584392dbecdbf923ede746361/textx/metamodel.py#L222-L235
def _enter_namespace(self, namespace_name): """ A namespace is usually an absolute file name of the grammar. A special namespace '__base__' is used for BASETYPE namespace. """ if namespace_name not in self.namespaces: self.namespaces[namespace_name] = {} ...
[ "def", "_enter_namespace", "(", "self", ",", "namespace_name", ")", ":", "if", "namespace_name", "not", "in", "self", ".", "namespaces", ":", "self", ".", "namespaces", "[", "namespace_name", "]", "=", "{", "}", "# BASETYPE namespace is imported in each namespace", ...
A namespace is usually an absolute file name of the grammar. A special namespace '__base__' is used for BASETYPE namespace.
[ "A", "namespace", "is", "usually", "an", "absolute", "file", "name", "of", "the", "grammar", ".", "A", "special", "namespace", "__base__", "is", "used", "for", "BASETYPE", "namespace", "." ]
python
train
noirbizarre/django.js
djangojs/context_serializer.py
https://github.com/noirbizarre/django.js/blob/65b267b04ffc0f969b9f8e2f8ce2f922397c8af1/djangojs/context_serializer.py#L37-L57
def as_dict(self): ''' Serialize the context as a dictionnary from a given request. ''' data = {} if settings.JS_CONTEXT_ENABLED: for context in RequestContext(self.request): for key, value in six.iteritems(context): if settings.JS_...
[ "def", "as_dict", "(", "self", ")", ":", "data", "=", "{", "}", "if", "settings", ".", "JS_CONTEXT_ENABLED", ":", "for", "context", "in", "RequestContext", "(", "self", ".", "request", ")", ":", "for", "key", ",", "value", "in", "six", ".", "iteritems"...
Serialize the context as a dictionnary from a given request.
[ "Serialize", "the", "context", "as", "a", "dictionnary", "from", "a", "given", "request", "." ]
python
train
juju/python-libjuju
juju/user.py
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/user.py#L62-L68
async def grant(self, acl='login'): """Set access level of this user on the controller. :param str acl: Access control ('login', 'add-model', or 'superuser') """ if await self.controller.grant(self.username, acl): self._user_info.access = acl
[ "async", "def", "grant", "(", "self", ",", "acl", "=", "'login'", ")", ":", "if", "await", "self", ".", "controller", ".", "grant", "(", "self", ".", "username", ",", "acl", ")", ":", "self", ".", "_user_info", ".", "access", "=", "acl" ]
Set access level of this user on the controller. :param str acl: Access control ('login', 'add-model', or 'superuser')
[ "Set", "access", "level", "of", "this", "user", "on", "the", "controller", "." ]
python
train
mdsol/rwslib
rwslib/builders/clinicaldata.py
https://github.com/mdsol/rwslib/blob/1a86bc072d408c009ed1de8bf6e98a1769f54d18/rwslib/builders/clinicaldata.py#L984-L990
def build(self, builder): """ Build XML by appending to builder """ builder.start("SourceID", {}) builder.data(self.source_id) builder.end("SourceID")
[ "def", "build", "(", "self", ",", "builder", ")", ":", "builder", ".", "start", "(", "\"SourceID\"", ",", "{", "}", ")", "builder", ".", "data", "(", "self", ".", "source_id", ")", "builder", ".", "end", "(", "\"SourceID\"", ")" ]
Build XML by appending to builder
[ "Build", "XML", "by", "appending", "to", "builder" ]
python
train
tensorflow/skflow
scripts/docs/docs.py
https://github.com/tensorflow/skflow/blob/f8da498a1abb7562f57dfc7010941578103061b6/scripts/docs/docs.py#L503-L511
def assert_no_leftovers(self): """Generate an error if there are leftover members.""" leftovers = [] for name in self._members.keys(): if name in self._members and name not in self._documented: leftovers.append(name) if leftovers: raise RuntimeError("%s: undocumented members: %s" % ...
[ "def", "assert_no_leftovers", "(", "self", ")", ":", "leftovers", "=", "[", "]", "for", "name", "in", "self", ".", "_members", ".", "keys", "(", ")", ":", "if", "name", "in", "self", ".", "_members", "and", "name", "not", "in", "self", ".", "_documen...
Generate an error if there are leftover members.
[ "Generate", "an", "error", "if", "there", "are", "leftover", "members", "." ]
python
train
GemHQ/round-py
round/wallets.py
https://github.com/GemHQ/round-py/blob/d0838f849cd260b1eb5df67ed3c6f2fe56c91c21/round/wallets.py#L431-L447
def signatures(self, transaction): """Sign a transaction. Args: transaction (coinop.Transaction) Returns: A list of signature dicts of the form [ {'primary': 'base58signaturestring'}, ... ] """ # TODO: output.metadata['type']['chang...
[ "def", "signatures", "(", "self", ",", "transaction", ")", ":", "# TODO: output.metadata['type']['change']", "if", "not", "self", ".", "multi_wallet", ":", "raise", "DecryptionError", "(", "\"This wallet must be unlocked with \"", "\"wallet.unlock(passphrase)\"", ")", "retu...
Sign a transaction. Args: transaction (coinop.Transaction) Returns: A list of signature dicts of the form [ {'primary': 'base58signaturestring'}, ... ]
[ "Sign", "a", "transaction", "." ]
python
train
metagriffin/morph
morph/__init__.py
https://github.com/metagriffin/morph/blob/907f169b0155712c466d3aac29f0907d0f36b443/morph/__init__.py#L147-L175
def unflatten(obj): ''' TODO: add docs ''' if not isdict(obj): raise ValueError( 'only dict-like objects can be unflattened, not %r' % (obj,)) ret = dict() sub = dict() for key, value in obj.items(): if '.' not in key and '[' not in key: ret[key] = value continue if '.' in ke...
[ "def", "unflatten", "(", "obj", ")", ":", "if", "not", "isdict", "(", "obj", ")", ":", "raise", "ValueError", "(", "'only dict-like objects can be unflattened, not %r'", "%", "(", "obj", ",", ")", ")", "ret", "=", "dict", "(", ")", "sub", "=", "dict", "(...
TODO: add docs
[ "TODO", ":", "add", "docs" ]
python
train
zhmcclient/python-zhmcclient
zhmcclient/_partition.py
https://github.com/zhmcclient/python-zhmcclient/blob/9657563e5d9184c51d3c903442a58b9725fdf335/zhmcclient/_partition.py#L688-L736
def mount_iso_image(self, image, image_name, ins_file_name): """ Upload an ISO image and associate it to this Partition using the HMC operation 'Mount ISO Image'. When the partition already has an ISO image associated, the newly uploaded image replaces the current one. ...
[ "def", "mount_iso_image", "(", "self", ",", "image", ",", "image_name", ",", "ins_file_name", ")", ":", "query_parms_str", "=", "'?image-name={}&ins-file-name={}'", ".", "format", "(", "quote", "(", "image_name", ",", "safe", "=", "''", ")", ",", "quote", "(",...
Upload an ISO image and associate it to this Partition using the HMC operation 'Mount ISO Image'. When the partition already has an ISO image associated, the newly uploaded image replaces the current one. Authorization requirements: * Object-access permission to this Partition...
[ "Upload", "an", "ISO", "image", "and", "associate", "it", "to", "this", "Partition", "using", "the", "HMC", "operation", "Mount", "ISO", "Image", "." ]
python
train
jborean93/smbprotocol
smbprotocol/connection.py
https://github.com/jborean93/smbprotocol/blob/d8eb00fbc824f97d0f4946e3f768c5e6c723499a/smbprotocol/connection.py#L1364-L1408
def _calculate_credit_charge(self, message): """ Calculates the credit charge for a request based on the command. If connection.supports_multi_credit is not True then the credit charge isn't valid so it returns 0. The credit charge is the number of credits that are required for ...
[ "def", "_calculate_credit_charge", "(", "self", ",", "message", ")", ":", "credit_size", "=", "65536", "if", "not", "self", ".", "supports_multi_credit", ":", "credit_charge", "=", "0", "elif", "message", ".", "COMMAND", "==", "Commands", ".", "SMB2_READ", ":"...
Calculates the credit charge for a request based on the command. If connection.supports_multi_credit is not True then the credit charge isn't valid so it returns 0. The credit charge is the number of credits that are required for sending/receiving data over 64 kilobytes, in the existing...
[ "Calculates", "the", "credit", "charge", "for", "a", "request", "based", "on", "the", "command", ".", "If", "connection", ".", "supports_multi_credit", "is", "not", "True", "then", "the", "credit", "charge", "isn", "t", "valid", "so", "it", "returns", "0", ...
python
train
ethpm/py-ethpm
ethpm/utils/deployments.py
https://github.com/ethpm/py-ethpm/blob/81ed58d7c636fe00c6770edeb0401812b1a5e8fc/ethpm/utils/deployments.py#L31-L53
def validate_linked_references( link_deps: Tuple[Tuple[int, bytes], ...], bytecode: bytes ) -> None: """ Validates that normalized linked_references (offset, expected_bytes) match the corresponding bytecode. """ offsets, values = zip(*link_deps) for idx, offset in enumerate(offsets): ...
[ "def", "validate_linked_references", "(", "link_deps", ":", "Tuple", "[", "Tuple", "[", "int", ",", "bytes", "]", ",", "...", "]", ",", "bytecode", ":", "bytes", ")", "->", "None", ":", "offsets", ",", "values", "=", "zip", "(", "*", "link_deps", ")", ...
Validates that normalized linked_references (offset, expected_bytes) match the corresponding bytecode.
[ "Validates", "that", "normalized", "linked_references", "(", "offset", "expected_bytes", ")", "match", "the", "corresponding", "bytecode", "." ]
python
train
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L691-L714
def com_google_fonts_check_usweightclass(font, ttFont, style): """Checking OS/2 usWeightClass.""" from fontbakery.profiles.shared_conditions import is_ttf weight_name, expected_value = expected_os2_weight(style) value = ttFont['OS/2'].usWeightClass if value != expected_value: if is_ttf(ttFont) and \ ...
[ "def", "com_google_fonts_check_usweightclass", "(", "font", ",", "ttFont", ",", "style", ")", ":", "from", "fontbakery", ".", "profiles", ".", "shared_conditions", "import", "is_ttf", "weight_name", ",", "expected_value", "=", "expected_os2_weight", "(", "style", ")...
Checking OS/2 usWeightClass.
[ "Checking", "OS", "/", "2", "usWeightClass", "." ]
python
train
python/core-workflow
cherry_picker/cherry_picker/cherry_picker.py
https://github.com/python/core-workflow/blob/b93c76195f6db382cfcefee334380fb4c68d4e21/cherry_picker/cherry_picker/cherry_picker.py#L168-L173
def fetch_upstream(self): """ git fetch <upstream> """ set_state(WORKFLOW_STATES.FETCHING_UPSTREAM) cmd = ["git", "fetch", self.upstream] self.run_cmd(cmd) set_state(WORKFLOW_STATES.FETCHED_UPSTREAM)
[ "def", "fetch_upstream", "(", "self", ")", ":", "set_state", "(", "WORKFLOW_STATES", ".", "FETCHING_UPSTREAM", ")", "cmd", "=", "[", "\"git\"", ",", "\"fetch\"", ",", "self", ".", "upstream", "]", "self", ".", "run_cmd", "(", "cmd", ")", "set_state", "(", ...
git fetch <upstream>
[ "git", "fetch", "<upstream", ">" ]
python
train
quarkslab/arybo
arybo/lib/mba_if.py
https://github.com/quarkslab/arybo/blob/04fad817090b3b9f2328a5e984457aba6024e971/arybo/lib/mba_if.py#L408-L426
def var(self, name): ''' Get an n-bit named symbolic variable Returns: An :class:`MBAVariable` object representing a symbolic variable Example: >>> mba.var('x') Vec([ x0, x1, x2, x3 ]) ''' ...
[ "def", "var", "(", "self", ",", "name", ")", ":", "ret", "=", "self", ".", "from_vec", "(", "self", ".", "var_symbols", "(", "name", ")", ")", "ret", ".", "name", "=", "name", "return", "ret" ]
Get an n-bit named symbolic variable Returns: An :class:`MBAVariable` object representing a symbolic variable Example: >>> mba.var('x') Vec([ x0, x1, x2, x3 ])
[ "Get", "an", "n", "-", "bit", "named", "symbolic", "variable" ]
python
train
buildbot/buildbot
worker/buildbot_worker/scripts/create_worker.py
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/worker/buildbot_worker/scripts/create_worker.py#L142-L195
def _makeInfoFiles(basedir, quiet): """ Create info/* files inside basedir. @param basedir: worker base directory relative path @param quiet: if True, don't print info messages @raise CreateWorkerError: on error making info directory or writing info files """ ...
[ "def", "_makeInfoFiles", "(", "basedir", ",", "quiet", ")", ":", "def", "createFile", "(", "path", ",", "file", ",", "contents", ")", ":", "filepath", "=", "os", ".", "path", ".", "join", "(", "path", ",", "file", ")", "if", "os", ".", "path", ".",...
Create info/* files inside basedir. @param basedir: worker base directory relative path @param quiet: if True, don't print info messages @raise CreateWorkerError: on error making info directory or writing info files
[ "Create", "info", "/", "*", "files", "inside", "basedir", "." ]
python
train
bachya/pyopenuv
pyopenuv/client.py
https://github.com/bachya/pyopenuv/blob/f7c2f9dd99dd4e3b8b1f9e501ea17ce62a7ace46/pyopenuv/client.py#L69-L76
async def uv_protection_window( self, low: float = 3.5, high: float = 3.5) -> dict: """Get data on when a UV protection window is.""" return await self.request( 'get', 'protection', params={ 'from': str(low), 'to': str(high) })
[ "async", "def", "uv_protection_window", "(", "self", ",", "low", ":", "float", "=", "3.5", ",", "high", ":", "float", "=", "3.5", ")", "->", "dict", ":", "return", "await", "self", ".", "request", "(", "'get'", ",", "'protection'", ",", "params", "=", ...
Get data on when a UV protection window is.
[ "Get", "data", "on", "when", "a", "UV", "protection", "window", "is", "." ]
python
train
ray-project/ray
python/ray/node.py
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/node.py#L438-L448
def start_monitor(self): """Start the monitor.""" stdout_file, stderr_file = self.new_log_files("monitor") process_info = ray.services.start_monitor( self._redis_address, stdout_file=stdout_file, stderr_file=stderr_file, autoscaling_config=self._ra...
[ "def", "start_monitor", "(", "self", ")", ":", "stdout_file", ",", "stderr_file", "=", "self", ".", "new_log_files", "(", "\"monitor\"", ")", "process_info", "=", "ray", ".", "services", ".", "start_monitor", "(", "self", ".", "_redis_address", ",", "stdout_fi...
Start the monitor.
[ "Start", "the", "monitor", "." ]
python
train
dpkp/kafka-python
kafka/client.py
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/client.py#L142-L177
def _send_broker_unaware_request(self, payloads, encoder_fn, decoder_fn): """ Attempt to send a broker-agnostic request to one of the available brokers. Keep trying until you succeed. """ hosts = set() for broker in self.brokers.values(): host, port, afi = get...
[ "def", "_send_broker_unaware_request", "(", "self", ",", "payloads", ",", "encoder_fn", ",", "decoder_fn", ")", ":", "hosts", "=", "set", "(", ")", "for", "broker", "in", "self", ".", "brokers", ".", "values", "(", ")", ":", "host", ",", "port", ",", "...
Attempt to send a broker-agnostic request to one of the available brokers. Keep trying until you succeed.
[ "Attempt", "to", "send", "a", "broker", "-", "agnostic", "request", "to", "one", "of", "the", "available", "brokers", ".", "Keep", "trying", "until", "you", "succeed", "." ]
python
train
sprockets/sprockets
sprockets/cli.py
https://github.com/sprockets/sprockets/blob/089dbaf04da54afd95645fce31f4ff9c8bdd8fae/sprockets/cli.py#L161-L187
def _configure_logging(application, verbosity=0, syslog=False): """Configure logging for the application, setting the appropriate verbosity and adding syslog if it's enabled. :param str application: The application module/package name :param int verbosity: 1 == INFO, 2 == DEBUG ...
[ "def", "_configure_logging", "(", "application", ",", "verbosity", "=", "0", ",", "syslog", "=", "False", ")", ":", "# Create a new copy of the logging config that will be modified", "config", "=", "dict", "(", "LOGGING", ")", "# Increase the logging verbosity", "if", "...
Configure logging for the application, setting the appropriate verbosity and adding syslog if it's enabled. :param str application: The application module/package name :param int verbosity: 1 == INFO, 2 == DEBUG :param bool syslog: Enable the syslog handler
[ "Configure", "logging", "for", "the", "application", "setting", "the", "appropriate", "verbosity", "and", "adding", "syslog", "if", "it", "s", "enabled", "." ]
python
train
StackStorm/pybind
pybind/slxos/v17s_1_02/overlay/access_list/type/vxlan/extended/ext_seq/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17s_1_02/overlay/access_list/type/vxlan/extended/ext_seq/__init__.py#L912-L933
def _set_src_port_any(self, v, load=False): """ Setter method for src_port_any, mapped from YANG variable /overlay/access_list/type/vxlan/extended/ext_seq/src_port_any (empty) If this variable is read-only (config: false) in the source YANG file, then _set_src_port_any is considered as a private met...
[ "def", "_set_src_port_any", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ",", "b...
Setter method for src_port_any, mapped from YANG variable /overlay/access_list/type/vxlan/extended/ext_seq/src_port_any (empty) If this variable is read-only (config: false) in the source YANG file, then _set_src_port_any is considered as a private method. Backends looking to populate this variable should ...
[ "Setter", "method", "for", "src_port_any", "mapped", "from", "YANG", "variable", "/", "overlay", "/", "access_list", "/", "type", "/", "vxlan", "/", "extended", "/", "ext_seq", "/", "src_port_any", "(", "empty", ")", "If", "this", "variable", "is", "read", ...
python
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_kmlread.py
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_kmlread.py#L318-L344
def readkmz(self, filename): '''reads in a kmz file and returns xml nodes''' #Strip quotation marks if neccessary filename.strip('"') #Open the zip file (as applicable) if filename[-4:] == '.kml': fo = open(filename, "r") fstring = fo.read() ...
[ "def", "readkmz", "(", "self", ",", "filename", ")", ":", "#Strip quotation marks if neccessary", "filename", ".", "strip", "(", "'\"'", ")", "#Open the zip file (as applicable) ", "if", "filename", "[", "-", "4", ":", "]", "==", "'.kml'", ":", "fo", "=", "...
reads in a kmz file and returns xml nodes
[ "reads", "in", "a", "kmz", "file", "and", "returns", "xml", "nodes" ]
python
train
jonathanj/txspinneret
txspinneret/route.py
https://github.com/jonathanj/txspinneret/blob/717008a2c313698984a23e3f3fc62ea3675ed02d/txspinneret/route.py#L31-L50
def Text(name, encoding=None): """ Match a route parameter. `Any` is a synonym for `Text`. :type name: `bytes` :param name: Route parameter name. :type encoding: `bytes` :param encoding: Default encoding to assume if the ``Content-Type`` header is lacking one. :return: ``ca...
[ "def", "Text", "(", "name", ",", "encoding", "=", "None", ")", ":", "def", "_match", "(", "request", ",", "value", ")", ":", "return", "name", ",", "query", ".", "Text", "(", "value", ",", "encoding", "=", "contentEncoding", "(", "request", ".", "req...
Match a route parameter. `Any` is a synonym for `Text`. :type name: `bytes` :param name: Route parameter name. :type encoding: `bytes` :param encoding: Default encoding to assume if the ``Content-Type`` header is lacking one. :return: ``callable`` suitable for use with `route` or `...
[ "Match", "a", "route", "parameter", "." ]
python
valid
CivicSpleen/ambry
ambry/identity.py
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/identity.py#L328-L331
def as_partition(self, **kwargs): """Return a PartitionName based on this name.""" return PartitionName(**dict(list(self.dict.items()) + list(kwargs.items())))
[ "def", "as_partition", "(", "self", ",", "*", "*", "kwargs", ")", ":", "return", "PartitionName", "(", "*", "*", "dict", "(", "list", "(", "self", ".", "dict", ".", "items", "(", ")", ")", "+", "list", "(", "kwargs", ".", "items", "(", ")", ")", ...
Return a PartitionName based on this name.
[ "Return", "a", "PartitionName", "based", "on", "this", "name", "." ]
python
train
trailofbits/manticore
manticore/utils/config.py
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/config.py#L105-L112
def get_description(self, name: str) -> str: """ Return the description, or a help string of variable identified by |name|. """ if name not in self._vars: raise ConfigError(f"{self.name}.{name} not defined.") return self._vars[name].description
[ "def", "get_description", "(", "self", ",", "name", ":", "str", ")", "->", "str", ":", "if", "name", "not", "in", "self", ".", "_vars", ":", "raise", "ConfigError", "(", "f\"{self.name}.{name} not defined.\"", ")", "return", "self", ".", "_vars", "[", "nam...
Return the description, or a help string of variable identified by |name|.
[ "Return", "the", "description", "or", "a", "help", "string", "of", "variable", "identified", "by", "|name|", "." ]
python
valid
flowersteam/explauto
explauto/sensorimotor_model/inverse/cma.py
https://github.com/flowersteam/explauto/blob/cf0f81ecb9f6412f7276a95bd27359000e1e26b6/explauto/sensorimotor_model/inverse/cma.py#L6381-L6521
def plot_divers(self, iabscissa=1, foffset=1e-19): """plot fitness, sigma, axis ratio... :param iabscissa: 0 means vs evaluations, 1 means vs iterations :param foffset: added to f-value :See: `plot()` """ from matplotlib.pyplot import semilogy, hold, grid, \ ...
[ "def", "plot_divers", "(", "self", ",", "iabscissa", "=", "1", ",", "foffset", "=", "1e-19", ")", ":", "from", "matplotlib", ".", "pyplot", "import", "semilogy", ",", "hold", ",", "grid", ",", "axis", ",", "title", ",", "text", "fontsize", "=", "pyplot...
plot fitness, sigma, axis ratio... :param iabscissa: 0 means vs evaluations, 1 means vs iterations :param foffset: added to f-value :See: `plot()`
[ "plot", "fitness", "sigma", "axis", "ratio", "..." ]
python
train
defunkt/pystache
pystache/loader.py
https://github.com/defunkt/pystache/blob/17a5dfdcd56eb76af731d141de395a7632a905b8/pystache/loader.py#L124-L137
def load_file(self, file_name): """ Find and return the template with the given file name. Arguments: file_name: the file name of the template. """ locator = self._make_locator() path = locator.find_file(file_name, self.search_dirs) return self.read...
[ "def", "load_file", "(", "self", ",", "file_name", ")", ":", "locator", "=", "self", ".", "_make_locator", "(", ")", "path", "=", "locator", ".", "find_file", "(", "file_name", ",", "self", ".", "search_dirs", ")", "return", "self", ".", "read", "(", "...
Find and return the template with the given file name. Arguments: file_name: the file name of the template.
[ "Find", "and", "return", "the", "template", "with", "the", "given", "file", "name", "." ]
python
train
log2timeline/dfvfs
dfvfs/vfs/file_entry.py
https://github.com/log2timeline/dfvfs/blob/2b3ccd115f9901d89f383397d4a1376a873c83c4/dfvfs/vfs/file_entry.py#L521-L531
def IsPipe(self): """Determines if the file entry is a pipe. Returns: bool: True if the file entry is a pipe. """ if self._stat_object is None: self._stat_object = self._GetStat() if self._stat_object is not None: self.entry_type = self._stat_object.type return self.entry_type...
[ "def", "IsPipe", "(", "self", ")", ":", "if", "self", ".", "_stat_object", "is", "None", ":", "self", ".", "_stat_object", "=", "self", ".", "_GetStat", "(", ")", "if", "self", ".", "_stat_object", "is", "not", "None", ":", "self", ".", "entry_type", ...
Determines if the file entry is a pipe. Returns: bool: True if the file entry is a pipe.
[ "Determines", "if", "the", "file", "entry", "is", "a", "pipe", "." ]
python
train
tradenity/python-sdk
tradenity/resources/option_set.py
https://github.com/tradenity/python-sdk/blob/d13fbe23f4d6ff22554c6d8d2deaf209371adaf1/tradenity/resources/option_set.py#L302-L322
def create_option_set(cls, option_set, **kwargs): """Create OptionSet Create a new OptionSet This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.create_option_set(option_set, async=True) >...
[ "def", "create_option_set", "(", "cls", ",", "option_set", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async'", ")", ":", "return", "cls", ".", "_create_option_set_with_ht...
Create OptionSet Create a new OptionSet This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.create_option_set(option_set, async=True) >>> result = thread.get() :param async bool :...
[ "Create", "OptionSet" ]
python
train
pvlib/pvlib-python
pvlib/pvsystem.py
https://github.com/pvlib/pvlib-python/blob/2e844a595b820b43d1170269781fa66bd0ccc8a3/pvlib/pvsystem.py#L409-L439
def sapm(self, effective_irradiance, temp_cell, **kwargs): """ Use the :py:func:`sapm` function, the input parameters, and ``self.module_parameters`` to calculate Voc, Isc, Ix, Ixx, Vmp/Imp. Parameters ---------- poa_direct : Series The direct irradia...
[ "def", "sapm", "(", "self", ",", "effective_irradiance", ",", "temp_cell", ",", "*", "*", "kwargs", ")", ":", "return", "sapm", "(", "effective_irradiance", ",", "temp_cell", ",", "self", ".", "module_parameters", ")" ]
Use the :py:func:`sapm` function, the input parameters, and ``self.module_parameters`` to calculate Voc, Isc, Ix, Ixx, Vmp/Imp. Parameters ---------- poa_direct : Series The direct irradiance incident upon the module (W/m^2). poa_diffuse : Series ...
[ "Use", "the", ":", "py", ":", "func", ":", "sapm", "function", "the", "input", "parameters", "and", "self", ".", "module_parameters", "to", "calculate", "Voc", "Isc", "Ix", "Ixx", "Vmp", "/", "Imp", "." ]
python
train
videntity/django-djmongo
djmongo/decorators.py
https://github.com/videntity/django-djmongo/blob/7534e0981a2bc12634cf3f1ed03353623dc57565/djmongo/decorators.py#L120-L178
def check_read_httpauth_access(func): """ Call after login decorator. """ def wrapper(request, *args, **kwargs): database_name = kwargs.get('database_name', "") collection_name = kwargs.get('collection_name', "") if not database_name or not collection_name: retur...
[ "def", "check_read_httpauth_access", "(", "func", ")", ":", "def", "wrapper", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "database_name", "=", "kwargs", ".", "get", "(", "'database_name'", ",", "\"\"", ")", "collection_name", "=",...
Call after login decorator.
[ "Call", "after", "login", "decorator", "." ]
python
train
inveniosoftware/invenio-stats
invenio_stats/ext.py
https://github.com/inveniosoftware/invenio-stats/blob/d877ae5462084abb4a28a20f1ebb3d636769c1bc/invenio_stats/ext.py#L189-L192
def publish(self, event_type, events): """Publish events.""" assert event_type in self.events current_queues.queues['stats-{}'.format(event_type)].publish(events)
[ "def", "publish", "(", "self", ",", "event_type", ",", "events", ")", ":", "assert", "event_type", "in", "self", ".", "events", "current_queues", ".", "queues", "[", "'stats-{}'", ".", "format", "(", "event_type", ")", "]", ".", "publish", "(", "events", ...
Publish events.
[ "Publish", "events", "." ]
python
valid
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_fcoe_ext.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_fcoe_ext.py#L497-L511
def fcoe_get_interface_output_fcoe_intf_list_fcoe_intf_tx_ls_rjt(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") fcoe_get_interface = ET.Element("fcoe_get_interface") config = fcoe_get_interface output = ET.SubElement(fcoe_get_interface, "output"...
[ "def", "fcoe_get_interface_output_fcoe_intf_list_fcoe_intf_tx_ls_rjt", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "fcoe_get_interface", "=", "ET", ".", "Element", "(", "\"fcoe_get_interface\"", ")", ...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
mdsol/rwslib
rwslib/builders/core.py
https://github.com/mdsol/rwslib/blob/1a86bc072d408c009ed1de8bf6e98a1769f54d18/rwslib/builders/core.py#L78-L82
def getroot(self): """Build XML object, return the root""" builder = ET.TreeBuilder() self.build(builder) return builder.close()
[ "def", "getroot", "(", "self", ")", ":", "builder", "=", "ET", ".", "TreeBuilder", "(", ")", "self", ".", "build", "(", "builder", ")", "return", "builder", ".", "close", "(", ")" ]
Build XML object, return the root
[ "Build", "XML", "object", "return", "the", "root" ]
python
train
johnbywater/eventsourcing
eventsourcing/infrastructure/base.py
https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/infrastructure/base.py#L93-L97
def get_records(self, sequence_id, gt=None, gte=None, lt=None, lte=None, limit=None, query_ascending=True, results_ascending=True): """ Returns records for a sequence. """
[ "def", "get_records", "(", "self", ",", "sequence_id", ",", "gt", "=", "None", ",", "gte", "=", "None", ",", "lt", "=", "None", ",", "lte", "=", "None", ",", "limit", "=", "None", ",", "query_ascending", "=", "True", ",", "results_ascending", "=", "T...
Returns records for a sequence.
[ "Returns", "records", "for", "a", "sequence", "." ]
python
train
hickeroar/simplebayes
simplebayes/category.py
https://github.com/hickeroar/simplebayes/blob/b8da72c50d20b6f8c0df2c2f39620715b08ddd32/simplebayes/category.py#L40-L53
def train_token(self, word, count): """ Trains a particular token (increases the weight/count of it) :param word: the token we're going to train :type word: str :param count: the number of occurances in the sample :type count: int """ if word not in self....
[ "def", "train_token", "(", "self", ",", "word", ",", "count", ")", ":", "if", "word", "not", "in", "self", ".", "tokens", ":", "self", ".", "tokens", "[", "word", "]", "=", "0", "self", ".", "tokens", "[", "word", "]", "+=", "count", "self", ".",...
Trains a particular token (increases the weight/count of it) :param word: the token we're going to train :type word: str :param count: the number of occurances in the sample :type count: int
[ "Trains", "a", "particular", "token", "(", "increases", "the", "weight", "/", "count", "of", "it", ")" ]
python
train
manolomartinez/greg
greg/classes.py
https://github.com/manolomartinez/greg/blob/63bb24197c13087a01963ac439cd8380007d9467/greg/classes.py#L146-L158
def retrieve_download_path(self): """ Retrieves the download path (looks first into config_filename_global then into the [DEFAULT], then the [feed], section of config_filename_user. The latest takes preeminence) """ section = self.name if self.config.has_section( ...
[ "def", "retrieve_download_path", "(", "self", ")", ":", "section", "=", "self", ".", "name", "if", "self", ".", "config", ".", "has_section", "(", "self", ".", "name", ")", "else", "self", ".", "config", ".", "default_section", "download_path", "=", "self"...
Retrieves the download path (looks first into config_filename_global then into the [DEFAULT], then the [feed], section of config_filename_user. The latest takes preeminence)
[ "Retrieves", "the", "download", "path", "(", "looks", "first", "into", "config_filename_global", "then", "into", "the", "[", "DEFAULT", "]", "then", "the", "[", "feed", "]", "section", "of", "config_filename_user", ".", "The", "latest", "takes", "preeminence", ...
python
train
apache/incubator-mxnet
example/ctc/multiproc_data.py
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/example/ctc/multiproc_data.py#L59-L88
def _proc_loop(proc_id, alive, queue, fn): """Thread loop for generating data Parameters ---------- proc_id: int Process id alive: multiprocessing.Value variable for signaling whether process should continue or not queue: multiprocessing.Queue ...
[ "def", "_proc_loop", "(", "proc_id", ",", "alive", ",", "queue", ",", "fn", ")", ":", "print", "(", "\"proc {} started\"", ".", "format", "(", "proc_id", ")", ")", "try", ":", "while", "alive", ".", "value", ":", "data", "=", "fn", "(", ")", "put_suc...
Thread loop for generating data Parameters ---------- proc_id: int Process id alive: multiprocessing.Value variable for signaling whether process should continue or not queue: multiprocessing.Queue queue for passing data back fn: funct...
[ "Thread", "loop", "for", "generating", "data" ]
python
train
blink1073/oct2py
oct2py/core.py
https://github.com/blink1073/oct2py/blob/bfc69d2168ae3d98258f95bbc55a858c21836b58/oct2py/core.py#L523-L593
def _feval(self, func_name, func_args=(), dname='', nout=0, timeout=None, stream_handler=None, store_as='', plot_dir=None): """Run the given function with the given args. """ engine = self._engine if engine is None: raise Oct2PyError('Session is closed') ...
[ "def", "_feval", "(", "self", ",", "func_name", ",", "func_args", "=", "(", ")", ",", "dname", "=", "''", ",", "nout", "=", "0", ",", "timeout", "=", "None", ",", "stream_handler", "=", "None", ",", "store_as", "=", "''", ",", "plot_dir", "=", "Non...
Run the given function with the given args.
[ "Run", "the", "given", "function", "with", "the", "given", "args", "." ]
python
valid
great-expectations/great_expectations
great_expectations/dataset/pandas_dataset.py
https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/dataset/pandas_dataset.py#L199-L252
def multicolumn_map_expectation(cls, func): """ The multicolumn_map_expectation decorator handles boilerplate issues surrounding the common pattern of evaluating truthiness of some condition on a per row basis across a set of columns. """ if PY3: argspec = inspect.get...
[ "def", "multicolumn_map_expectation", "(", "cls", ",", "func", ")", ":", "if", "PY3", ":", "argspec", "=", "inspect", ".", "getfullargspec", "(", "func", ")", "[", "0", "]", "[", "1", ":", "]", "else", ":", "argspec", "=", "inspect", ".", "getargspec",...
The multicolumn_map_expectation decorator handles boilerplate issues surrounding the common pattern of evaluating truthiness of some condition on a per row basis across a set of columns.
[ "The", "multicolumn_map_expectation", "decorator", "handles", "boilerplate", "issues", "surrounding", "the", "common", "pattern", "of", "evaluating", "truthiness", "of", "some", "condition", "on", "a", "per", "row", "basis", "across", "a", "set", "of", "columns", ...
python
train
williballenthin/python-evtx
Evtx/Nodes.py
https://github.com/williballenthin/python-evtx/blob/4e9e29544adde64c79ff9b743269ecb18c677eb4/Evtx/Nodes.py#L980-L991
def template(self): ''' parse the template referenced by this root node. note, this template structure is not guaranteed to be located within the root node's boundaries. Returns: TemplateNode: the template. ''' instance = self.template_instance() offset...
[ "def", "template", "(", "self", ")", ":", "instance", "=", "self", ".", "template_instance", "(", ")", "offset", "=", "self", ".", "_chunk", ".", "offset", "(", ")", "+", "instance", ".", "template_offset", "(", ")", "node", "=", "TemplateNode", "(", "...
parse the template referenced by this root node. note, this template structure is not guaranteed to be located within the root node's boundaries. Returns: TemplateNode: the template.
[ "parse", "the", "template", "referenced", "by", "this", "root", "node", ".", "note", "this", "template", "structure", "is", "not", "guaranteed", "to", "be", "located", "within", "the", "root", "node", "s", "boundaries", "." ]
python
train
mozilla/python-zeppelin
zeppelin/converters/markdown.py
https://github.com/mozilla/python-zeppelin/blob/76ce6b7608ef6cf7b807bd5d850a58ea6a59ef07/zeppelin/converters/markdown.py#L237-L239
def write_image_to_disk(self, msg, result, fh): """Decode message to PNG and write to disk.""" cairosvg.svg2png(bytestring=msg.encode('utf-8'), write_to=fh)
[ "def", "write_image_to_disk", "(", "self", ",", "msg", ",", "result", ",", "fh", ")", ":", "cairosvg", ".", "svg2png", "(", "bytestring", "=", "msg", ".", "encode", "(", "'utf-8'", ")", ",", "write_to", "=", "fh", ")" ]
Decode message to PNG and write to disk.
[ "Decode", "message", "to", "PNG", "and", "write", "to", "disk", "." ]
python
train
zeldamods/aamp
aamp/parameters.py
https://github.com/zeldamods/aamp/blob/90d722d33357af5af9809a3fc83b9ceaecf943c1/aamp/parameters.py#L40-L42
def set_param(self, name: str, v) -> None: """Add or update an existing parameter.""" self.params[zlib.crc32(name.encode())] = v
[ "def", "set_param", "(", "self", ",", "name", ":", "str", ",", "v", ")", "->", "None", ":", "self", ".", "params", "[", "zlib", ".", "crc32", "(", "name", ".", "encode", "(", ")", ")", "]", "=", "v" ]
Add or update an existing parameter.
[ "Add", "or", "update", "an", "existing", "parameter", "." ]
python
train
saltstack/salt
salt/modules/supervisord.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/supervisord.py#L312-L335
def status_raw(name=None, user=None, conf_file=None, bin_env=None): ''' Display the raw output of status user user to run supervisorctl as conf_file path to supervisord config file bin_env path to supervisorctl bin or path to virtualenv with supervisor installed ...
[ "def", "status_raw", "(", "name", "=", "None", ",", "user", "=", "None", ",", "conf_file", "=", "None", ",", "bin_env", "=", "None", ")", ":", "ret", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "_ctl_cmd", "(", "'status'", ",", "name", ",", "con...
Display the raw output of status user user to run supervisorctl as conf_file path to supervisord config file bin_env path to supervisorctl bin or path to virtualenv with supervisor installed CLI Example: .. code-block:: bash salt '*' supervisord.status_raw
[ "Display", "the", "raw", "output", "of", "status" ]
python
train
zeroSteiner/smoke-zephyr
smoke_zephyr/utilities.py
https://github.com/zeroSteiner/smoke-zephyr/blob/a6d2498aeacc72ee52e7806f783a4d83d537ffb2/smoke_zephyr/utilities.py#L533-L564
def open_uri(uri): """ Open a URI in a platform intelligent way. On Windows this will use 'cmd.exe /c start' and on Linux this will use gvfs-open or xdg-open depending on which is available. If no suitable application can be found to open the URI, a RuntimeError will be raised. .. versionadded:: 1.3.0 :param s...
[ "def", "open_uri", "(", "uri", ")", ":", "close_fds", "=", "True", "startupinfo", "=", "None", "proc_args", "=", "[", "]", "if", "sys", ".", "platform", ".", "startswith", "(", "'win'", ")", ":", "proc_args", ".", "append", "(", "which", "(", "'cmd.exe...
Open a URI in a platform intelligent way. On Windows this will use 'cmd.exe /c start' and on Linux this will use gvfs-open or xdg-open depending on which is available. If no suitable application can be found to open the URI, a RuntimeError will be raised. .. versionadded:: 1.3.0 :param str uri: The URI to open.
[ "Open", "a", "URI", "in", "a", "platform", "intelligent", "way", ".", "On", "Windows", "this", "will", "use", "cmd", ".", "exe", "/", "c", "start", "and", "on", "Linux", "this", "will", "use", "gvfs", "-", "open", "or", "xdg", "-", "open", "depending...
python
train
edx/opaque-keys
opaque_keys/edx/block_types.py
https://github.com/edx/opaque-keys/blob/9807168660c12e0551c8fdd58fd1bc6b0bcb0a54/opaque_keys/edx/block_types.py#L40-L56
def _from_string(cls, serialized): """ Return an instance of `cls` parsed from its `serialized` form. Args: cls: The :class:`OpaqueKey` subclass. serialized (unicode): A serialized :class:`OpaqueKey`, with namespace already removed. Raises: InvalidKe...
[ "def", "_from_string", "(", "cls", ",", "serialized", ")", ":", "if", "':'", "not", "in", "serialized", ":", "raise", "InvalidKeyError", "(", "\"BlockTypeKeyV1 keys must contain ':' separating the block family from the block_type.\"", ",", "serialized", ")", "family", ","...
Return an instance of `cls` parsed from its `serialized` form. Args: cls: The :class:`OpaqueKey` subclass. serialized (unicode): A serialized :class:`OpaqueKey`, with namespace already removed. Raises: InvalidKeyError: Should be raised if `serialized` is not a valid...
[ "Return", "an", "instance", "of", "cls", "parsed", "from", "its", "serialized", "form", "." ]
python
train
prompt-toolkit/pymux
pymux/arrangement.py
https://github.com/prompt-toolkit/pymux/blob/3f66e62b9de4b2251c7f9afad6c516dc5a30ec67/pymux/arrangement.py#L275-L305
def remove_pane(self, pane): """ Remove pane from this Window. """ assert isinstance(pane, Pane) if pane in self.panes: # When this pane was focused, switch to previous active or next in order. if pane == self.active_pane: if self.previous...
[ "def", "remove_pane", "(", "self", ",", "pane", ")", ":", "assert", "isinstance", "(", "pane", ",", "Pane", ")", "if", "pane", "in", "self", ".", "panes", ":", "# When this pane was focused, switch to previous active or next in order.", "if", "pane", "==", "self",...
Remove pane from this Window.
[ "Remove", "pane", "from", "this", "Window", "." ]
python
train
nchopin/particles
book/mle/malikpitt_interpolation.py
https://github.com/nchopin/particles/blob/3faa97a1073db45c5889eef3e015dd76ef350b52/book/mle/malikpitt_interpolation.py#L16-L24
def avg_n_nplusone(x): """ returns x[0]/2, (x[0]+x[1])/2, ... (x[-2]+x[-1])/2, x[-1]/2 """ y = np.zeros(1 + x.shape[0]) hx = 0.5 * x y[:-1] = hx y[1:] += hx return y
[ "def", "avg_n_nplusone", "(", "x", ")", ":", "y", "=", "np", ".", "zeros", "(", "1", "+", "x", ".", "shape", "[", "0", "]", ")", "hx", "=", "0.5", "*", "x", "y", "[", ":", "-", "1", "]", "=", "hx", "y", "[", "1", ":", "]", "+=", "hx", ...
returns x[0]/2, (x[0]+x[1])/2, ... (x[-2]+x[-1])/2, x[-1]/2
[ "returns", "x", "[", "0", "]", "/", "2", "(", "x", "[", "0", "]", "+", "x", "[", "1", "]", ")", "/", "2", "...", "(", "x", "[", "-", "2", "]", "+", "x", "[", "-", "1", "]", ")", "/", "2", "x", "[", "-", "1", "]", "/", "2" ]
python
train
summanlp/textrank
summa/preprocessing/snowball.py
https://github.com/summanlp/textrank/blob/6844bbe8c4b2b468020ae0dfd6574a743f9ad442/summa/preprocessing/snowball.py#L659-L1032
def stem(self, word): """ Stem an English word and return the stemmed form. :param word: The word that is stemmed. :type word: str or unicode :return: The stemmed form. :rtype: unicode """ word = word.lower() if len(word) <= 2: retu...
[ "def", "stem", "(", "self", ",", "word", ")", ":", "word", "=", "word", ".", "lower", "(", ")", "if", "len", "(", "word", ")", "<=", "2", ":", "return", "word", "elif", "word", "in", "self", ".", "__special_words", ":", "return", "self", ".", "__...
Stem an English word and return the stemmed form. :param word: The word that is stemmed. :type word: str or unicode :return: The stemmed form. :rtype: unicode
[ "Stem", "an", "English", "word", "and", "return", "the", "stemmed", "form", "." ]
python
train
grundic/yagocd
yagocd/client.py
https://github.com/grundic/yagocd/blob/4c75336ae6f107c8723d37b15e52169151822127/yagocd/client.py#L131-L139
def agents(self): """ Property for accessing :class:`AgentManager` instance, which is used to manage agents. :rtype: yagocd.resources.agent.AgentManager """ if self._agent_manager is None: self._agent_manager = AgentManager(session=self._session) return self....
[ "def", "agents", "(", "self", ")", ":", "if", "self", ".", "_agent_manager", "is", "None", ":", "self", ".", "_agent_manager", "=", "AgentManager", "(", "session", "=", "self", ".", "_session", ")", "return", "self", ".", "_agent_manager" ]
Property for accessing :class:`AgentManager` instance, which is used to manage agents. :rtype: yagocd.resources.agent.AgentManager
[ "Property", "for", "accessing", ":", "class", ":", "AgentManager", "instance", "which", "is", "used", "to", "manage", "agents", "." ]
python
train
fedora-infra/fedmsg
fedmsg/meta/base.py
https://github.com/fedora-infra/fedmsg/blob/c21d6b3ce023fc3c0e881c704f5b55fb6e6392d7/fedmsg/meta/base.py#L146-L154
def handle_msg(self, msg, **config): """ If we can handle the given message, return the remainder of the topic. Returns None if we can't handle the message. """ match = self.__prefix__.match(msg['topic']) if match: return match.groups()[-1] or ""
[ "def", "handle_msg", "(", "self", ",", "msg", ",", "*", "*", "config", ")", ":", "match", "=", "self", ".", "__prefix__", ".", "match", "(", "msg", "[", "'topic'", "]", ")", "if", "match", ":", "return", "match", ".", "groups", "(", ")", "[", "-"...
If we can handle the given message, return the remainder of the topic. Returns None if we can't handle the message.
[ "If", "we", "can", "handle", "the", "given", "message", "return", "the", "remainder", "of", "the", "topic", "." ]
python
train
ayust/kitnirc
kitnirc/client.py
https://github.com/ayust/kitnirc/blob/cf19fe39219da75f053e1a3976bf21331b6fefea/kitnirc/client.py#L409-L429
def join(self, target, key=None): """Attempt to join a channel. The optional second argument is the channel key, if needed. """ chantypes = self.server.features.get("CHANTYPES", "#") if not target or target[0] not in chantypes: # Among other things, this prevents acc...
[ "def", "join", "(", "self", ",", "target", ",", "key", "=", "None", ")", ":", "chantypes", "=", "self", ".", "server", ".", "features", ".", "get", "(", "\"CHANTYPES\"", ",", "\"#\"", ")", "if", "not", "target", "or", "target", "[", "0", "]", "not"...
Attempt to join a channel. The optional second argument is the channel key, if needed.
[ "Attempt", "to", "join", "a", "channel", "." ]
python
train
datacats/datacats
datacats/environment.py
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/environment.py#L94-L100
def save(self): """ Save environment settings into environment directory, overwriting any existing configuration and discarding site config """ task.save_new_environment(self.name, self.datadir, self.target, self.ckan_version, self.deploy_target, self.always_prod)
[ "def", "save", "(", "self", ")", ":", "task", ".", "save_new_environment", "(", "self", ".", "name", ",", "self", ".", "datadir", ",", "self", ".", "target", ",", "self", ".", "ckan_version", ",", "self", ".", "deploy_target", ",", "self", ".", "always...
Save environment settings into environment directory, overwriting any existing configuration and discarding site config
[ "Save", "environment", "settings", "into", "environment", "directory", "overwriting", "any", "existing", "configuration", "and", "discarding", "site", "config" ]
python
train
pasztorpisti/json-cfg
src/jsoncfg/text_encoding.py
https://github.com/pasztorpisti/json-cfg/blob/4627b14a92521ef8a39bbedaa7af8d380d406d07/src/jsoncfg/text_encoding.py#L23-L40
def decode_utf_text_buffer(buf, default_encoding='UTF-8', use_utf8_strings=True): """ :param buf: Binary file contents with optional BOM prefix. :param default_encoding: The encoding to be used if the buffer doesn't have a BOM prefix. :param use_utf8_strings: Used only in case of python2: You can ch...
[ "def", "decode_utf_text_buffer", "(", "buf", ",", "default_encoding", "=", "'UTF-8'", ",", "use_utf8_strings", "=", "True", ")", ":", "buf", ",", "encoding", "=", "detect_encoding_and_remove_bom", "(", "buf", ",", "default_encoding", ")", "if", "python2", "and", ...
:param buf: Binary file contents with optional BOM prefix. :param default_encoding: The encoding to be used if the buffer doesn't have a BOM prefix. :param use_utf8_strings: Used only in case of python2: You can choose utf-8 str in-memory string representation in case of python. If use_utf8_strings is ...
[ ":", "param", "buf", ":", "Binary", "file", "contents", "with", "optional", "BOM", "prefix", ".", ":", "param", "default_encoding", ":", "The", "encoding", "to", "be", "used", "if", "the", "buffer", "doesn", "t", "have", "a", "BOM", "prefix", ".", ":", ...
python
train
HPAC/matchpy
matchpy/expressions/expressions.py
https://github.com/HPAC/matchpy/blob/06b2ec50ee0efdf3dd183768c0ffdb51b7efc393/matchpy/expressions/expressions.py#L426-L482
def new( name: str, arity: Arity, class_name: str=None, *, associative: bool=False, commutative: bool=False, one_identity: bool=False, infix: bool=False ) -> Type['Operation']: """Utility method to create a new o...
[ "def", "new", "(", "name", ":", "str", ",", "arity", ":", "Arity", ",", "class_name", ":", "str", "=", "None", ",", "*", ",", "associative", ":", "bool", "=", "False", ",", "commutative", ":", "bool", "=", "False", ",", "one_identity", ":", "bool", ...
Utility method to create a new operation type. Example: >>> Times = Operation.new('*', Arity.polyadic, 'Times', associative=True, commutative=True, one_identity=True) >>> Times Times['*', Arity(min_count=2, fixed_size=False), associative, commutative, one_identity] >>> str(Time...
[ "Utility", "method", "to", "create", "a", "new", "operation", "type", "." ]
python
train
mcieslik-mctp/papy
src/papy/util/func.py
https://github.com/mcieslik-mctp/papy/blob/708e50827b5db46bbea081982cb74b9b0e464064/src/papy/util/func.py#L510-L520
def pickle_dumps(inbox): """ Serializes the first element of the input using the pickle protocol using the fastes binary protocol. """ # http://bugs.python.org/issue4074 gc.disable() str_ = cPickle.dumps(inbox[0], cPickle.HIGHEST_PROTOCOL) gc.enable() return str_
[ "def", "pickle_dumps", "(", "inbox", ")", ":", "# http://bugs.python.org/issue4074", "gc", ".", "disable", "(", ")", "str_", "=", "cPickle", ".", "dumps", "(", "inbox", "[", "0", "]", ",", "cPickle", ".", "HIGHEST_PROTOCOL", ")", "gc", ".", "enable", "(", ...
Serializes the first element of the input using the pickle protocol using the fastes binary protocol.
[ "Serializes", "the", "first", "element", "of", "the", "input", "using", "the", "pickle", "protocol", "using", "the", "fastes", "binary", "protocol", "." ]
python
train
ownport/scrapy-dblite
dblite/__init__.py
https://github.com/ownport/scrapy-dblite/blob/6de5021caa31d439478d9808738b046d1db699c9/dblite/__init__.py#L54-L58
def _regexp(expr, item): ''' REGEXP function for Sqlite ''' reg = re.compile(expr) return reg.search(item) is not None
[ "def", "_regexp", "(", "expr", ",", "item", ")", ":", "reg", "=", "re", ".", "compile", "(", "expr", ")", "return", "reg", ".", "search", "(", "item", ")", "is", "not", "None" ]
REGEXP function for Sqlite
[ "REGEXP", "function", "for", "Sqlite" ]
python
train
Gorialis/jishaku
jishaku/cog.py
https://github.com/Gorialis/jishaku/blob/fc7c479b9d510ede189a929c8aa6f7c8ef7f9a6e/jishaku/cog.py#L347-L359
async def jsk_sudo(self, ctx: commands.Context, *, command_string: str): """ Run a command bypassing all checks and cooldowns. This also bypasses permission checks so this has a high possibility of making a command raise. """ alt_ctx = await copy_context_with(ctx, content=ctx.p...
[ "async", "def", "jsk_sudo", "(", "self", ",", "ctx", ":", "commands", ".", "Context", ",", "*", ",", "command_string", ":", "str", ")", ":", "alt_ctx", "=", "await", "copy_context_with", "(", "ctx", ",", "content", "=", "ctx", ".", "prefix", "+", "comm...
Run a command bypassing all checks and cooldowns. This also bypasses permission checks so this has a high possibility of making a command raise.
[ "Run", "a", "command", "bypassing", "all", "checks", "and", "cooldowns", "." ]
python
train
pybel/pybel
src/pybel/struct/mutation/induction/annotations.py
https://github.com/pybel/pybel/blob/c8a7a1bdae4c475fa2a8c77f3a9a5f6d79556ca0/src/pybel/struct/mutation/induction/annotations.py#L40-L53
def get_subgraph_by_annotation_value(graph, annotation, values): """Induce a sub-graph over all edges whose annotations match the given key and value. :param pybel.BELGraph graph: A BEL graph :param str annotation: The annotation to group by :param values: The value(s) for the annotation :type valu...
[ "def", "get_subgraph_by_annotation_value", "(", "graph", ",", "annotation", ",", "values", ")", ":", "if", "isinstance", "(", "values", ",", "str", ")", ":", "values", "=", "{", "values", "}", "return", "get_subgraph_by_annotations", "(", "graph", ",", "{", ...
Induce a sub-graph over all edges whose annotations match the given key and value. :param pybel.BELGraph graph: A BEL graph :param str annotation: The annotation to group by :param values: The value(s) for the annotation :type values: str or iter[str] :return: A subgraph of the original BEL graph ...
[ "Induce", "a", "sub", "-", "graph", "over", "all", "edges", "whose", "annotations", "match", "the", "given", "key", "and", "value", "." ]
python
train
serkanyersen/underscore.py
src/underscore.py
https://github.com/serkanyersen/underscore.py/blob/07c25c3f0f789536e4ad47aa315faccc0da9602f/src/underscore.py#L245-L248
def filter(self, func): """ Return all the elements that pass a truth test. """ return self._wrap(list(filter(func, self.obj)))
[ "def", "filter", "(", "self", ",", "func", ")", ":", "return", "self", ".", "_wrap", "(", "list", "(", "filter", "(", "func", ",", "self", ".", "obj", ")", ")", ")" ]
Return all the elements that pass a truth test.
[ "Return", "all", "the", "elements", "that", "pass", "a", "truth", "test", "." ]
python
train
dbcli/cli_helpers
cli_helpers/config.py
https://github.com/dbcli/cli_helpers/blob/3ebd891ac0c02bad061182dbcb54a47fb21980ae/cli_helpers/config.py#L77-L101
def read_default_config(self): """Read the default config file. :raises DefaultConfigValidationError: There was a validation error with the *default* file. """ if self.validate: self.default_config = ConfigObj(configspec=self.def...
[ "def", "read_default_config", "(", "self", ")", ":", "if", "self", ".", "validate", ":", "self", ".", "default_config", "=", "ConfigObj", "(", "configspec", "=", "self", ".", "default_file", ",", "list_values", "=", "False", ",", "_inspec", "=", "True", ",...
Read the default config file. :raises DefaultConfigValidationError: There was a validation error with the *default* file.
[ "Read", "the", "default", "config", "file", "." ]
python
test
marl/jams
jams/schema.py
https://github.com/marl/jams/blob/b16778399b9528efbd71434842a079f7691a7a66/jams/schema.py#L50-L75
def namespace(ns_key): '''Construct a validation schema for a given namespace. Parameters ---------- ns_key : str Namespace key identifier (eg, 'beat' or 'segment_tut') Returns ------- schema : dict JSON schema of `namespace` ''' if ns_key not in __NAMESPACE__: ...
[ "def", "namespace", "(", "ns_key", ")", ":", "if", "ns_key", "not", "in", "__NAMESPACE__", ":", "raise", "NamespaceError", "(", "'Unknown namespace: {:s}'", ".", "format", "(", "ns_key", ")", ")", "sch", "=", "copy", ".", "deepcopy", "(", "JAMS_SCHEMA", "[",...
Construct a validation schema for a given namespace. Parameters ---------- ns_key : str Namespace key identifier (eg, 'beat' or 'segment_tut') Returns ------- schema : dict JSON schema of `namespace`
[ "Construct", "a", "validation", "schema", "for", "a", "given", "namespace", "." ]
python
valid
ryanvarley/ExoData
exodata/assumptions.py
https://github.com/ryanvarley/ExoData/blob/e0d3652117214d2377a707d6778f93b7eb201a41/exodata/assumptions.py#L82-L92
def planetRadiusType(radius): """ Returns the planet radiustype given the mass and using planetAssumptions['radiusType'] """ if radius is np.nan: return None for radiusLimit, radiusType in planetAssumptions['radiusType']: if radius < radiusLimit: return radiusType
[ "def", "planetRadiusType", "(", "radius", ")", ":", "if", "radius", "is", "np", ".", "nan", ":", "return", "None", "for", "radiusLimit", ",", "radiusType", "in", "planetAssumptions", "[", "'radiusType'", "]", ":", "if", "radius", "<", "radiusLimit", ":", "...
Returns the planet radiustype given the mass and using planetAssumptions['radiusType']
[ "Returns", "the", "planet", "radiustype", "given", "the", "mass", "and", "using", "planetAssumptions", "[", "radiusType", "]" ]
python
train
MacHu-GWU/crawl_zillow-project
crawl_zillow/helpers.py
https://github.com/MacHu-GWU/crawl_zillow-project/blob/c6d7ca8e4c80e7e7e963496433ef73df1413c16e/crawl_zillow/helpers.py#L5-L16
def int_filter(text): """Extract integer from text. **中文文档** 摘除文本内的整数。 """ res = list() for char in text: if char.isdigit(): res.append(char) return int("".join(res))
[ "def", "int_filter", "(", "text", ")", ":", "res", "=", "list", "(", ")", "for", "char", "in", "text", ":", "if", "char", ".", "isdigit", "(", ")", ":", "res", ".", "append", "(", "char", ")", "return", "int", "(", "\"\"", ".", "join", "(", "re...
Extract integer from text. **中文文档** 摘除文本内的整数。
[ "Extract", "integer", "from", "text", "." ]
python
train
StackStorm/pybind
pybind/slxos/v17s_1_02/brocade_interface_ext_rpc/get_media_detail/output/interface/on_board/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17s_1_02/brocade_interface_ext_rpc/get_media_detail/output/interface/on_board/__init__.py#L99-L122
def _set_speed(self, v, load=False): """ Setter method for speed, mapped from YANG variable /brocade_interface_ext_rpc/get_media_detail/output/interface/on_board/speed (line-speed) If this variable is read-only (config: false) in the source YANG file, then _set_speed is considered as a private metho...
[ "def", "_set_speed", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ",", "base", ...
Setter method for speed, mapped from YANG variable /brocade_interface_ext_rpc/get_media_detail/output/interface/on_board/speed (line-speed) If this variable is read-only (config: false) in the source YANG file, then _set_speed is considered as a private method. Backends looking to populate this variable sho...
[ "Setter", "method", "for", "speed", "mapped", "from", "YANG", "variable", "/", "brocade_interface_ext_rpc", "/", "get_media_detail", "/", "output", "/", "interface", "/", "on_board", "/", "speed", "(", "line", "-", "speed", ")", "If", "this", "variable", "is",...
python
train
ninuxorg/nodeshot
nodeshot/interop/oldimporter/db.py
https://github.com/ninuxorg/nodeshot/blob/2466f0a55f522b2696026f196436ce7ba3f1e5c6/nodeshot/interop/oldimporter/db.py#L66-L72
def allow_migrate(self, db, model): """ Make sure the old_nodeshot app only appears in the 'old_nodeshot' database """ if db != 'old_nodeshot' or model._meta.app_label != 'oldimporter': return False return True
[ "def", "allow_migrate", "(", "self", ",", "db", ",", "model", ")", ":", "if", "db", "!=", "'old_nodeshot'", "or", "model", ".", "_meta", ".", "app_label", "!=", "'oldimporter'", ":", "return", "False", "return", "True" ]
Make sure the old_nodeshot app only appears in the 'old_nodeshot' database
[ "Make", "sure", "the", "old_nodeshot", "app", "only", "appears", "in", "the", "old_nodeshot", "database" ]
python
train
fabioz/PyDev.Debugger
_pydev_imps/_pydev_inspect.py
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/_pydev_imps/_pydev_inspect.py#L339-L345
def getabsfile(object): """Return an absolute path to the source or compiled file for an object. The idea is for each object to have a unique origin, so this routine normalizes the result as much as possible.""" return os.path.normcase( os.path.abspath(getsourcefile(object) or getfile(object)))
[ "def", "getabsfile", "(", "object", ")", ":", "return", "os", ".", "path", ".", "normcase", "(", "os", ".", "path", ".", "abspath", "(", "getsourcefile", "(", "object", ")", "or", "getfile", "(", "object", ")", ")", ")" ]
Return an absolute path to the source or compiled file for an object. The idea is for each object to have a unique origin, so this routine normalizes the result as much as possible.
[ "Return", "an", "absolute", "path", "to", "the", "source", "or", "compiled", "file", "for", "an", "object", "." ]
python
train
apache/spark
python/pyspark/mllib/util.py
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/mllib/util.py#L201-L237
def convertVectorColumnsToML(dataset, *cols): """ Converts vector columns in an input DataFrame from the :py:class:`pyspark.mllib.linalg.Vector` type to the new :py:class:`pyspark.ml.linalg.Vector` type under the `spark.ml` package. :param dataset: input datase...
[ "def", "convertVectorColumnsToML", "(", "dataset", ",", "*", "cols", ")", ":", "if", "not", "isinstance", "(", "dataset", ",", "DataFrame", ")", ":", "raise", "TypeError", "(", "\"Input dataset must be a DataFrame but got {}.\"", ".", "format", "(", "type", "(", ...
Converts vector columns in an input DataFrame from the :py:class:`pyspark.mllib.linalg.Vector` type to the new :py:class:`pyspark.ml.linalg.Vector` type under the `spark.ml` package. :param dataset: input dataset :param cols: a list of vector columns to be co...
[ "Converts", "vector", "columns", "in", "an", "input", "DataFrame", "from", "the", ":", "py", ":", "class", ":", "pyspark", ".", "mllib", ".", "linalg", ".", "Vector", "type", "to", "the", "new", ":", "py", ":", "class", ":", "pyspark", ".", "ml", "."...
python
train
sbg/sevenbridges-python
sevenbridges/meta/transformer.py
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/meta/transformer.py#L179-L192
def to_team(team): """Serializes team to id string :param team: object to serialize :return: string id """ from sevenbridges.models.team import Team if not team: raise SbgError('Team is required!') elif isinstance(team, Team): return team.i...
[ "def", "to_team", "(", "team", ")", ":", "from", "sevenbridges", ".", "models", ".", "team", "import", "Team", "if", "not", "team", ":", "raise", "SbgError", "(", "'Team is required!'", ")", "elif", "isinstance", "(", "team", ",", "Team", ")", ":", "retu...
Serializes team to id string :param team: object to serialize :return: string id
[ "Serializes", "team", "to", "id", "string", ":", "param", "team", ":", "object", "to", "serialize", ":", "return", ":", "string", "id" ]
python
train
Miserlou/Zappa
zappa/utilities.py
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/utilities.py#L430-L436
def get_event_source_status(event_source, lambda_arn, target_function, boto_session, dry=False): """ Given an event_source dictionary, create the object and get the event source status. """ event_source_obj, ctx, funk = get_event_source(event_source, lambda_arn, target_function, boto_session, dry=False...
[ "def", "get_event_source_status", "(", "event_source", ",", "lambda_arn", ",", "target_function", ",", "boto_session", ",", "dry", "=", "False", ")", ":", "event_source_obj", ",", "ctx", ",", "funk", "=", "get_event_source", "(", "event_source", ",", "lambda_arn",...
Given an event_source dictionary, create the object and get the event source status.
[ "Given", "an", "event_source", "dictionary", "create", "the", "object", "and", "get", "the", "event", "source", "status", "." ]
python
train
StackStorm/pybind
pybind/slxos/v17s_1_02/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17s_1_02/__init__.py#L3714-L3737
def _set_overlay_policy_map(self, v, load=False): """ Setter method for overlay_policy_map, mapped from YANG variable /overlay_policy_map (list) If this variable is read-only (config: false) in the source YANG file, then _set_overlay_policy_map is considered as a private method. Backends looking to ...
[ "def", "_set_overlay_policy_map", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ","...
Setter method for overlay_policy_map, mapped from YANG variable /overlay_policy_map (list) If this variable is read-only (config: false) in the source YANG file, then _set_overlay_policy_map is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._s...
[ "Setter", "method", "for", "overlay_policy_map", "mapped", "from", "YANG", "variable", "/", "overlay_policy_map", "(", "list", ")", "If", "this", "variable", "is", "read", "-", "only", "(", "config", ":", "false", ")", "in", "the", "source", "YANG", "file", ...
python
train
daknuett/py_register_machine2
core/parts.py
https://github.com/daknuett/py_register_machine2/blob/599c53cd7576297d0d7a53344ed5d9aa98acc751/core/parts.py#L110-L125
def write_word(self, offset, word): """ .. _write_word: Writes one word from a device, see read_word_. """ self._lock = True if(offset > self.current_max_offset): raise BUSError("Offset({}) exceeds address space of BUS({})".format(offset, self.current_max_offset)) self.writes += 1 self.truncat...
[ "def", "write_word", "(", "self", ",", "offset", ",", "word", ")", ":", "self", ".", "_lock", "=", "True", "if", "(", "offset", ">", "self", ".", "current_max_offset", ")", ":", "raise", "BUSError", "(", "\"Offset({}) exceeds address space of BUS({})\"", ".", ...
.. _write_word: Writes one word from a device, see read_word_.
[ "..", "_write_word", ":" ]
python
train
saltstack/salt
salt/utils/win_lgpo_netsh.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_lgpo_netsh.py#L473-L538
def set_settings(profile, setting, value, store='local'): ''' Configure firewall settings. Args: profile (str): The firewall profile to configure. Valid options are: - domain - public - private setting (str): The firewall settin...
[ "def", "set_settings", "(", "profile", ",", "setting", ",", "value", ",", "store", "=", "'local'", ")", ":", "# Input validation", "if", "profile", ".", "lower", "(", ")", "not", "in", "(", "'domain'", ",", "'public'", ",", "'private'", ")", ":", "raise"...
Configure firewall settings. Args: profile (str): The firewall profile to configure. Valid options are: - domain - public - private setting (str): The firewall setting to configure. Valid options are: - localfirewallrules ...
[ "Configure", "firewall", "settings", "." ]
python
train
gc3-uzh-ch/elasticluster
elasticluster/cluster.py
https://github.com/gc3-uzh-ch/elasticluster/blob/e6345633308c76de13b889417df572815aabe744/elasticluster/cluster.py#L209-L218
def to_dict(self, omit=()): """ Return a (shallow) copy of self cast to a dictionary, optionally omitting some key/value pairs. """ result = self.__dict__.copy() for key in omit: if key in result: del result[key] return result
[ "def", "to_dict", "(", "self", ",", "omit", "=", "(", ")", ")", ":", "result", "=", "self", ".", "__dict__", ".", "copy", "(", ")", "for", "key", "in", "omit", ":", "if", "key", "in", "result", ":", "del", "result", "[", "key", "]", "return", "...
Return a (shallow) copy of self cast to a dictionary, optionally omitting some key/value pairs.
[ "Return", "a", "(", "shallow", ")", "copy", "of", "self", "cast", "to", "a", "dictionary", "optionally", "omitting", "some", "key", "/", "value", "pairs", "." ]
python
train
ewels/MultiQC
multiqc/modules/goleft_indexcov/goleft_indexcov.py
https://github.com/ewels/MultiQC/blob/2037d6322b2554146a74efbf869156ad20d4c4ec/multiqc/modules/goleft_indexcov/goleft_indexcov.py#L26-L46
def _short_chrom(self, chrom): """Plot standard chromosomes + X, sorted numerically. Allows specification from a list of chromosomes via config for non-standard genomes. """ default_allowed = set(["X"]) allowed_chroms = set(getattr(config, "goleft_indexcov_config", {}).g...
[ "def", "_short_chrom", "(", "self", ",", "chrom", ")", ":", "default_allowed", "=", "set", "(", "[", "\"X\"", "]", ")", "allowed_chroms", "=", "set", "(", "getattr", "(", "config", ",", "\"goleft_indexcov_config\"", ",", "{", "}", ")", ".", "get", "(", ...
Plot standard chromosomes + X, sorted numerically. Allows specification from a list of chromosomes via config for non-standard genomes.
[ "Plot", "standard", "chromosomes", "+", "X", "sorted", "numerically", "." ]
python
train
daviddrysdale/python-phonenumbers
python/phonenumbers/phonenumberutil.py
https://github.com/daviddrysdale/python-phonenumbers/blob/9cc5bb4ab5e661e70789b4c64bf7a9383c7bdc20/python/phonenumbers/phonenumberutil.py#L3117-L3137
def can_be_internationally_dialled(numobj): """Returns True if the number can only be dialled from outside the region, or unknown. If the number can only be dialled from within the region as well, returns False. Does not check the number is a valid number. Note that, at the moment, this method does...
[ "def", "can_be_internationally_dialled", "(", "numobj", ")", ":", "metadata", "=", "PhoneMetadata", ".", "metadata_for_region", "(", "region_code_for_number", "(", "numobj", ")", ",", "None", ")", "if", "metadata", "is", "None", ":", "# Note numbers belonging to non-g...
Returns True if the number can only be dialled from outside the region, or unknown. If the number can only be dialled from within the region as well, returns False. Does not check the number is a valid number. Note that, at the moment, this method does not handle short numbers (which are currently ...
[ "Returns", "True", "if", "the", "number", "can", "only", "be", "dialled", "from", "outside", "the", "region", "or", "unknown", "." ]
python
train
rojopolis/lycanthropy
lycanthropy/lycanthropy.py
https://github.com/rojopolis/lycanthropy/blob/1a5ce2828714fc0e34780ac866532d4106d1a05b/lycanthropy/lycanthropy.py#L53-L76
def morph_dict(d, convert_function): """ Convert a nested dictionary from one convention to another. Args: d (dict): dictionary (nested or not) to be converted. convert_function (func): function that takes the string in one convention and returns it in the other one. Returns: ...
[ "def", "morph_dict", "(", "d", ",", "convert_function", ")", ":", "# Attribution: https://stackoverflow.com/a/33668421/633213", "new", "=", "{", "}", "for", "k", ",", "v", "in", "six", ".", "iteritems", "(", "d", ")", ":", "new_v", "=", "v", "if", "isinstanc...
Convert a nested dictionary from one convention to another. Args: d (dict): dictionary (nested or not) to be converted. convert_function (func): function that takes the string in one convention and returns it in the other one. Returns: Dictionary with the new keys.
[ "Convert", "a", "nested", "dictionary", "from", "one", "convention", "to", "another", ".", "Args", ":", "d", "(", "dict", ")", ":", "dictionary", "(", "nested", "or", "not", ")", "to", "be", "converted", ".", "convert_function", "(", "func", ")", ":", ...
python
train
gwpy/gwpy
gwpy/io/ligolw.py
https://github.com/gwpy/gwpy/blob/7a92b917e7dd2d99b15895293a1fa1d66cdb210a/gwpy/io/ligolw.py#L434-L451
def get_ligolw_element(xmldoc): """Find an existing <LIGO_LW> element in this XML Document """ from ligo.lw.ligolw import LIGO_LW try: from glue.ligolw.ligolw import LIGO_LW as LIGO_LW2 except ImportError: ligolw_types = (LIGO_LW,) else: ligolw_types = (LIGO_LW, LIGO_LW2)...
[ "def", "get_ligolw_element", "(", "xmldoc", ")", ":", "from", "ligo", ".", "lw", ".", "ligolw", "import", "LIGO_LW", "try", ":", "from", "glue", ".", "ligolw", ".", "ligolw", "import", "LIGO_LW", "as", "LIGO_LW2", "except", "ImportError", ":", "ligolw_types"...
Find an existing <LIGO_LW> element in this XML Document
[ "Find", "an", "existing", "<LIGO_LW", ">", "element", "in", "this", "XML", "Document" ]
python
train
SuperCowPowers/workbench
workbench/server/data_store.py
https://github.com/SuperCowPowers/workbench/blob/710232756dd717f734253315e3d0b33c9628dafb/workbench/server/data_store.py#L280-L290
def _list_samples(self, predicate=None): """List all samples that meet the predicate or all if predicate is not specified. Args: predicate: Match samples against this predicate (or all if not specified) Returns: List of the md5s for the matching samples """ ...
[ "def", "_list_samples", "(", "self", ",", "predicate", "=", "None", ")", ":", "cursor", "=", "self", ".", "database", "[", "self", ".", "sample_collection", "]", ".", "find", "(", "predicate", ",", "{", "'_id'", ":", "0", ",", "'md5'", ":", "1", "}",...
List all samples that meet the predicate or all if predicate is not specified. Args: predicate: Match samples against this predicate (or all if not specified) Returns: List of the md5s for the matching samples
[ "List", "all", "samples", "that", "meet", "the", "predicate", "or", "all", "if", "predicate", "is", "not", "specified", "." ]
python
train
TrainerDex/TrainerDex.py
trainerdex/client.py
https://github.com/TrainerDex/TrainerDex.py/blob/a693e1321abf2825f74bcbf29f0800f0c6835b62/trainerdex/client.py#L184-L190
def get_detailed_update(self, uid, uuid): """Returns the update object for the ID""" r = requests.get(api_url+'users/'+str(uid)+'/update/'+str(uuid)+'/', headers=self.headers) print(request_status(r)) r.raise_for_status() return Update(r.json())
[ "def", "get_detailed_update", "(", "self", ",", "uid", ",", "uuid", ")", ":", "r", "=", "requests", ".", "get", "(", "api_url", "+", "'users/'", "+", "str", "(", "uid", ")", "+", "'/update/'", "+", "str", "(", "uuid", ")", "+", "'/'", ",", "headers...
Returns the update object for the ID
[ "Returns", "the", "update", "object", "for", "the", "ID" ]
python
train