repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
inveniosoftware/invenio-oauthclient
invenio_oauthclient/contrib/cern.py
account_groups_and_extra_data
def account_groups_and_extra_data(account, resource, refresh_timedelta=None): """Fetch account groups and extra data from resource if necessary.""" updated = datetime.utcnow() modified_since = updated if refresh_timedelta is not None: modified_since += refresh_t...
python
def account_groups_and_extra_data(account, resource, refresh_timedelta=None): """Fetch account groups and extra data from resource if necessary.""" updated = datetime.utcnow() modified_since = updated if refresh_timedelta is not None: modified_since += refresh_t...
[ "def", "account_groups_and_extra_data", "(", "account", ",", "resource", ",", "refresh_timedelta", "=", "None", ")", ":", "updated", "=", "datetime", ".", "utcnow", "(", ")", "modified_since", "=", "updated", "if", "refresh_timedelta", "is", "not", "None", ":", ...
Fetch account groups and extra data from resource if necessary.
[ "Fetch", "account", "groups", "and", "extra", "data", "from", "resource", "if", "necessary", "." ]
2500dc6935738107617aeade79e050d7608004bb
https://github.com/inveniosoftware/invenio-oauthclient/blob/2500dc6935738107617aeade79e050d7608004bb/invenio_oauthclient/contrib/cern.py#L232-L256
train
inveniosoftware/invenio-oauthclient
invenio_oauthclient/contrib/cern.py
extend_identity
def extend_identity(identity, groups): """Extend identity with roles based on CERN groups.""" provides = set([UserNeed(current_user.email)] + [ RoleNeed('{0}@cern.ch'.format(name)) for name in groups ]) identity.provides |= provides session[OAUTHCLIENT_CERN_SESSION_KEY] = provides
python
def extend_identity(identity, groups): """Extend identity with roles based on CERN groups.""" provides = set([UserNeed(current_user.email)] + [ RoleNeed('{0}@cern.ch'.format(name)) for name in groups ]) identity.provides |= provides session[OAUTHCLIENT_CERN_SESSION_KEY] = provides
[ "def", "extend_identity", "(", "identity", ",", "groups", ")", ":", "provides", "=", "set", "(", "[", "UserNeed", "(", "current_user", ".", "email", ")", "]", "+", "[", "RoleNeed", "(", "'{0}@cern.ch'", ".", "format", "(", "name", ")", ")", "for", "nam...
Extend identity with roles based on CERN groups.
[ "Extend", "identity", "with", "roles", "based", "on", "CERN", "groups", "." ]
2500dc6935738107617aeade79e050d7608004bb
https://github.com/inveniosoftware/invenio-oauthclient/blob/2500dc6935738107617aeade79e050d7608004bb/invenio_oauthclient/contrib/cern.py#L259-L265
train
inveniosoftware/invenio-oauthclient
invenio_oauthclient/contrib/cern.py
get_dict_from_response
def get_dict_from_response(response): """Prepare new mapping with 'Value's groupped by 'Type'.""" result = {} if getattr(response, '_resp') and response._resp.code > 400: return result for i in response.data: # strip the schema from the key k = i['Type'].replace(REMOTE_APP_RESOU...
python
def get_dict_from_response(response): """Prepare new mapping with 'Value's groupped by 'Type'.""" result = {} if getattr(response, '_resp') and response._resp.code > 400: return result for i in response.data: # strip the schema from the key k = i['Type'].replace(REMOTE_APP_RESOU...
[ "def", "get_dict_from_response", "(", "response", ")", ":", "result", "=", "{", "}", "if", "getattr", "(", "response", ",", "'_resp'", ")", "and", "response", ".", "_resp", ".", "code", ">", "400", ":", "return", "result", "for", "i", "in", "response", ...
Prepare new mapping with 'Value's groupped by 'Type'.
[ "Prepare", "new", "mapping", "with", "Value", "s", "groupped", "by", "Type", "." ]
2500dc6935738107617aeade79e050d7608004bb
https://github.com/inveniosoftware/invenio-oauthclient/blob/2500dc6935738107617aeade79e050d7608004bb/invenio_oauthclient/contrib/cern.py#L274-L285
train
inveniosoftware/invenio-oauthclient
invenio_oauthclient/contrib/cern.py
get_resource
def get_resource(remote): """Query CERN Resources to get user info and groups.""" cached_resource = session.pop('cern_resource', None) if cached_resource: return cached_resource response = remote.get(REMOTE_APP_RESOURCE_API_URL) dict_response = get_dict_from_response(response) session['...
python
def get_resource(remote): """Query CERN Resources to get user info and groups.""" cached_resource = session.pop('cern_resource', None) if cached_resource: return cached_resource response = remote.get(REMOTE_APP_RESOURCE_API_URL) dict_response = get_dict_from_response(response) session['...
[ "def", "get_resource", "(", "remote", ")", ":", "cached_resource", "=", "session", ".", "pop", "(", "'cern_resource'", ",", "None", ")", "if", "cached_resource", ":", "return", "cached_resource", "response", "=", "remote", ".", "get", "(", "REMOTE_APP_RESOURCE_A...
Query CERN Resources to get user info and groups.
[ "Query", "CERN", "Resources", "to", "get", "user", "info", "and", "groups", "." ]
2500dc6935738107617aeade79e050d7608004bb
https://github.com/inveniosoftware/invenio-oauthclient/blob/2500dc6935738107617aeade79e050d7608004bb/invenio_oauthclient/contrib/cern.py#L288-L297
train
inveniosoftware/invenio-oauthclient
invenio_oauthclient/contrib/cern.py
on_identity_changed
def on_identity_changed(sender, identity): """Store groups in session whenever identity changes. :param identity: The user identity where information are stored. """ if isinstance(identity, AnonymousIdentity): return client_id = current_app.config['CERN_APP_CREDENTIALS']['consumer_key'] ...
python
def on_identity_changed(sender, identity): """Store groups in session whenever identity changes. :param identity: The user identity where information are stored. """ if isinstance(identity, AnonymousIdentity): return client_id = current_app.config['CERN_APP_CREDENTIALS']['consumer_key'] ...
[ "def", "on_identity_changed", "(", "sender", ",", "identity", ")", ":", "if", "isinstance", "(", "identity", ",", "AnonymousIdentity", ")", ":", "return", "client_id", "=", "current_app", ".", "config", "[", "'CERN_APP_CREDENTIALS'", "]", "[", "'consumer_key'", ...
Store groups in session whenever identity changes. :param identity: The user identity where information are stored.
[ "Store", "groups", "in", "session", "whenever", "identity", "changes", "." ]
2500dc6935738107617aeade79e050d7608004bb
https://github.com/inveniosoftware/invenio-oauthclient/blob/2500dc6935738107617aeade79e050d7608004bb/invenio_oauthclient/contrib/cern.py#L373-L400
train
inveniosoftware/invenio-oauthclient
invenio_oauthclient/models.py
RemoteAccount.get
def get(cls, user_id, client_id): """Get RemoteAccount object for user. :param user_id: User id :param client_id: Client id. :returns: A :class:`invenio_oauthclient.models.RemoteAccount` instance. """ return cls.query.filter_by( user_id=user_id, c...
python
def get(cls, user_id, client_id): """Get RemoteAccount object for user. :param user_id: User id :param client_id: Client id. :returns: A :class:`invenio_oauthclient.models.RemoteAccount` instance. """ return cls.query.filter_by( user_id=user_id, c...
[ "def", "get", "(", "cls", ",", "user_id", ",", "client_id", ")", ":", "return", "cls", ".", "query", ".", "filter_by", "(", "user_id", "=", "user_id", ",", "client_id", "=", "client_id", ",", ")", ".", "first", "(", ")" ]
Get RemoteAccount object for user. :param user_id: User id :param client_id: Client id. :returns: A :class:`invenio_oauthclient.models.RemoteAccount` instance.
[ "Get", "RemoteAccount", "object", "for", "user", "." ]
2500dc6935738107617aeade79e050d7608004bb
https://github.com/inveniosoftware/invenio-oauthclient/blob/2500dc6935738107617aeade79e050d7608004bb/invenio_oauthclient/models.py#L63-L73
train
inveniosoftware/invenio-oauthclient
invenio_oauthclient/models.py
RemoteAccount.create
def create(cls, user_id, client_id, extra_data): """Create new remote account for user. :param user_id: User id. :param client_id: Client id. :param extra_data: JSON-serializable dictionary of any extra data that needs to be save together with this link. :returns: A ...
python
def create(cls, user_id, client_id, extra_data): """Create new remote account for user. :param user_id: User id. :param client_id: Client id. :param extra_data: JSON-serializable dictionary of any extra data that needs to be save together with this link. :returns: A ...
[ "def", "create", "(", "cls", ",", "user_id", ",", "client_id", ",", "extra_data", ")", ":", "with", "db", ".", "session", ".", "begin_nested", "(", ")", ":", "account", "=", "cls", "(", "user_id", "=", "user_id", ",", "client_id", "=", "client_id", ","...
Create new remote account for user. :param user_id: User id. :param client_id: Client id. :param extra_data: JSON-serializable dictionary of any extra data that needs to be save together with this link. :returns: A :class:`invenio_oauthclient.models.RemoteAccount` instance.
[ "Create", "new", "remote", "account", "for", "user", "." ]
2500dc6935738107617aeade79e050d7608004bb
https://github.com/inveniosoftware/invenio-oauthclient/blob/2500dc6935738107617aeade79e050d7608004bb/invenio_oauthclient/models.py#L76-L92
train
inveniosoftware/invenio-oauthclient
invenio_oauthclient/models.py
RemoteToken.update_token
def update_token(self, token, secret): """Update token with new values. :param token: The token value. :param secret: The secret key. """ if self.access_token != token or self.secret != secret: with db.session.begin_nested(): self.access_token = token...
python
def update_token(self, token, secret): """Update token with new values. :param token: The token value. :param secret: The secret key. """ if self.access_token != token or self.secret != secret: with db.session.begin_nested(): self.access_token = token...
[ "def", "update_token", "(", "self", ",", "token", ",", "secret", ")", ":", "if", "self", ".", "access_token", "!=", "token", "or", "self", ".", "secret", "!=", "secret", ":", "with", "db", ".", "session", ".", "begin_nested", "(", ")", ":", "self", "...
Update token with new values. :param token: The token value. :param secret: The secret key.
[ "Update", "token", "with", "new", "values", "." ]
2500dc6935738107617aeade79e050d7608004bb
https://github.com/inveniosoftware/invenio-oauthclient/blob/2500dc6935738107617aeade79e050d7608004bb/invenio_oauthclient/models.py#L153-L163
train
inveniosoftware/invenio-oauthclient
invenio_oauthclient/models.py
RemoteToken.get
def get(cls, user_id, client_id, token_type='', access_token=None): """Get RemoteToken for user. :param user_id: The user id. :param client_id: The client id. :param token_type: The token type. (Default: ``''``) :param access_token: If set, will filter also by access token. ...
python
def get(cls, user_id, client_id, token_type='', access_token=None): """Get RemoteToken for user. :param user_id: The user id. :param client_id: The client id. :param token_type: The token type. (Default: ``''``) :param access_token: If set, will filter also by access token. ...
[ "def", "get", "(", "cls", ",", "user_id", ",", "client_id", ",", "token_type", "=", "''", ",", "access_token", "=", "None", ")", ":", "args", "=", "[", "RemoteAccount", ".", "id", "==", "RemoteToken", ".", "id_remote_account", ",", "RemoteAccount", ".", ...
Get RemoteToken for user. :param user_id: The user id. :param client_id: The client id. :param token_type: The token type. (Default: ``''``) :param access_token: If set, will filter also by access token. (Default: ``None``) :returns: A :class:`invenio_oauthclient.mod...
[ "Get", "RemoteToken", "for", "user", "." ]
2500dc6935738107617aeade79e050d7608004bb
https://github.com/inveniosoftware/invenio-oauthclient/blob/2500dc6935738107617aeade79e050d7608004bb/invenio_oauthclient/models.py#L166-L188
train
inveniosoftware/invenio-oauthclient
invenio_oauthclient/models.py
RemoteToken.get_by_token
def get_by_token(cls, client_id, access_token, token_type=''): """Get RemoteAccount object for token. :param client_id: The client id. :param access_token: The access token. :param token_type: The token type. (Default: ``''``) :returns: A :class:`invenio_oauthclient.models.Remot...
python
def get_by_token(cls, client_id, access_token, token_type=''): """Get RemoteAccount object for token. :param client_id: The client id. :param access_token: The access token. :param token_type: The token type. (Default: ``''``) :returns: A :class:`invenio_oauthclient.models.Remot...
[ "def", "get_by_token", "(", "cls", ",", "client_id", ",", "access_token", ",", "token_type", "=", "''", ")", ":", "return", "cls", ".", "query", ".", "options", "(", "db", ".", "joinedload", "(", "'remote_account'", ")", ")", ".", "filter", "(", "RemoteA...
Get RemoteAccount object for token. :param client_id: The client id. :param access_token: The access token. :param token_type: The token type. (Default: ``''``) :returns: A :class:`invenio_oauthclient.models.RemoteToken` instance.
[ "Get", "RemoteAccount", "object", "for", "token", "." ]
2500dc6935738107617aeade79e050d7608004bb
https://github.com/inveniosoftware/invenio-oauthclient/blob/2500dc6935738107617aeade79e050d7608004bb/invenio_oauthclient/models.py#L191-L204
train
qacafe/cdrouter.py
cdrouter/exports.py
ExportsService.bulk_export
def bulk_export(self, config_ids=None, device_ids=None, package_ids=None, result_ids=None, exclude_captures=False): """Bulk export a set of configs, devices, packages and results. :param config_ids: (optional) Int list of config IDs. :param device_ids: (optional) Int list of device IDs. ...
python
def bulk_export(self, config_ids=None, device_ids=None, package_ids=None, result_ids=None, exclude_captures=False): """Bulk export a set of configs, devices, packages and results. :param config_ids: (optional) Int list of config IDs. :param device_ids: (optional) Int list of device IDs. ...
[ "def", "bulk_export", "(", "self", ",", "config_ids", "=", "None", ",", "device_ids", "=", "None", ",", "package_ids", "=", "None", ",", "result_ids", "=", "None", ",", "exclude_captures", "=", "False", ")", ":", "if", "config_ids", "is", "None", ":", "c...
Bulk export a set of configs, devices, packages and results. :param config_ids: (optional) Int list of config IDs. :param device_ids: (optional) Int list of device IDs. :param package_ids: (optional) Int list of package IDs. :param result_ids: (optional) Int list of result IDs. ...
[ "Bulk", "export", "a", "set", "of", "configs", "devices", "packages", "and", "results", "." ]
aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/exports.py#L22-L52
train
cokelaer/reports
reports/report.py
Report._init_report
def _init_report(self): """create the report directory and return the directory name""" self.sections = [] self.section_names = [] # if the directory already exists, print a warning try: if os.path.isdir(self.directory) is False: if self.verbose: ...
python
def _init_report(self): """create the report directory and return the directory name""" self.sections = [] self.section_names = [] # if the directory already exists, print a warning try: if os.path.isdir(self.directory) is False: if self.verbose: ...
[ "def", "_init_report", "(", "self", ")", ":", "self", ".", "sections", "=", "[", "]", "self", ".", "section_names", "=", "[", "]", "try", ":", "if", "os", ".", "path", ".", "isdir", "(", "self", ".", "directory", ")", "is", "False", ":", "if", "s...
create the report directory and return the directory name
[ "create", "the", "report", "directory", "and", "return", "the", "directory", "name" ]
7703b1e27d440c3193ee6cc90bfecd78cc98b737
https://github.com/cokelaer/reports/blob/7703b1e27d440c3193ee6cc90bfecd78cc98b737/reports/report.py#L159-L209
train
cokelaer/reports
reports/report.py
Report.get_time_now
def get_time_now(self): """Returns a time stamp""" import datetime import getpass username = getpass.getuser() # this is not working on some systems: os.environ["USERNAME"] timenow = str(datetime.datetime.now()) timenow = timenow.split('.')[0] msg = '<div ...
python
def get_time_now(self): """Returns a time stamp""" import datetime import getpass username = getpass.getuser() # this is not working on some systems: os.environ["USERNAME"] timenow = str(datetime.datetime.now()) timenow = timenow.split('.')[0] msg = '<div ...
[ "def", "get_time_now", "(", "self", ")", ":", "import", "datetime", "import", "getpass", "username", "=", "getpass", ".", "getuser", "(", ")", "timenow", "=", "str", "(", "datetime", ".", "datetime", ".", "now", "(", ")", ")", "timenow", "=", "timenow", ...
Returns a time stamp
[ "Returns", "a", "time", "stamp" ]
7703b1e27d440c3193ee6cc90bfecd78cc98b737
https://github.com/cokelaer/reports/blob/7703b1e27d440c3193ee6cc90bfecd78cc98b737/reports/report.py#L230-L240
train
makinacorpus/django-tracking-fields
tracking_fields/decorators.py
_track_class_related_field
def _track_class_related_field(cls, field): """ Track a field on a related model """ # field = field on current model # related_field = field on related model (field, related_field) = field.split('__', 1) field_obj = cls._meta.get_field(field) related_cls = field_obj.remote_field.model relat...
python
def _track_class_related_field(cls, field): """ Track a field on a related model """ # field = field on current model # related_field = field on related model (field, related_field) = field.split('__', 1) field_obj = cls._meta.get_field(field) related_cls = field_obj.remote_field.model relat...
[ "def", "_track_class_related_field", "(", "cls", ",", "field", ")", ":", "(", "field", ",", "related_field", ")", "=", "field", ".", "split", "(", "'__'", ",", "1", ")", "field_obj", "=", "cls", ".", "_meta", ".", "get_field", "(", "field", ")", "relat...
Track a field on a related model
[ "Track", "a", "field", "on", "a", "related", "model" ]
463313d0f9c0f8107a0413f4d418d1a8c2311981
https://github.com/makinacorpus/django-tracking-fields/blob/463313d0f9c0f8107a0413f4d418d1a8c2311981/tracking_fields/decorators.py#L35-L71
train
makinacorpus/django-tracking-fields
tracking_fields/decorators.py
_track_class_field
def _track_class_field(cls, field): """ Track a field on the current model """ if '__' in field: _track_class_related_field(cls, field) return # Will raise FieldDoesNotExist if there is an error cls._meta.get_field(field) # Detect m2m fields changes if isinstance(cls._meta.get_fi...
python
def _track_class_field(cls, field): """ Track a field on the current model """ if '__' in field: _track_class_related_field(cls, field) return # Will raise FieldDoesNotExist if there is an error cls._meta.get_field(field) # Detect m2m fields changes if isinstance(cls._meta.get_fi...
[ "def", "_track_class_field", "(", "cls", ",", "field", ")", ":", "if", "'__'", "in", "field", ":", "_track_class_related_field", "(", "cls", ",", "field", ")", "return", "cls", ".", "_meta", ".", "get_field", "(", "field", ")", "if", "isinstance", "(", "...
Track a field on the current model
[ "Track", "a", "field", "on", "the", "current", "model" ]
463313d0f9c0f8107a0413f4d418d1a8c2311981
https://github.com/makinacorpus/django-tracking-fields/blob/463313d0f9c0f8107a0413f4d418d1a8c2311981/tracking_fields/decorators.py#L74-L87
train
makinacorpus/django-tracking-fields
tracking_fields/decorators.py
_track_class
def _track_class(cls, fields): """ Track fields on the specified model """ # Small tests to ensure everything is all right assert not getattr(cls, '_is_tracked', False) for field in fields: _track_class_field(cls, field) _add_signals_to_cls(cls) # Mark the class as tracked cls._is...
python
def _track_class(cls, fields): """ Track fields on the specified model """ # Small tests to ensure everything is all right assert not getattr(cls, '_is_tracked', False) for field in fields: _track_class_field(cls, field) _add_signals_to_cls(cls) # Mark the class as tracked cls._is...
[ "def", "_track_class", "(", "cls", ",", "fields", ")", ":", "assert", "not", "getattr", "(", "cls", ",", "'_is_tracked'", ",", "False", ")", "for", "field", "in", "fields", ":", "_track_class_field", "(", "cls", ",", "field", ")", "_add_signals_to_cls", "(...
Track fields on the specified model
[ "Track", "fields", "on", "the", "specified", "model" ]
463313d0f9c0f8107a0413f4d418d1a8c2311981
https://github.com/makinacorpus/django-tracking-fields/blob/463313d0f9c0f8107a0413f4d418d1a8c2311981/tracking_fields/decorators.py#L90-L107
train
makinacorpus/django-tracking-fields
tracking_fields/decorators.py
_add_get_tracking_url
def _add_get_tracking_url(cls): """ Add a method to get the tracking url of an object. """ def get_tracking_url(self): """ return url to tracking view in admin panel """ url = reverse('admin:tracking_fields_trackingevent_changelist') object_id = '{0}%3A{1}'.format( ContentTyp...
python
def _add_get_tracking_url(cls): """ Add a method to get the tracking url of an object. """ def get_tracking_url(self): """ return url to tracking view in admin panel """ url = reverse('admin:tracking_fields_trackingevent_changelist') object_id = '{0}%3A{1}'.format( ContentTyp...
[ "def", "_add_get_tracking_url", "(", "cls", ")", ":", "def", "get_tracking_url", "(", "self", ")", ":", "url", "=", "reverse", "(", "'admin:tracking_fields_trackingevent_changelist'", ")", "object_id", "=", "'{0}%3A{1}'", ".", "format", "(", "ContentType", ".", "o...
Add a method to get the tracking url of an object.
[ "Add", "a", "method", "to", "get", "the", "tracking", "url", "of", "an", "object", "." ]
463313d0f9c0f8107a0413f4d418d1a8c2311981
https://github.com/makinacorpus/django-tracking-fields/blob/463313d0f9c0f8107a0413f4d418d1a8c2311981/tracking_fields/decorators.py#L110-L121
train
makinacorpus/django-tracking-fields
tracking_fields/decorators.py
track
def track(*fields): """ Decorator used to track changes on Model's fields. :Example: >>> @track('name') ... class Human(models.Model): ... name = models.CharField(max_length=30) """ def inner(cls): _track_class(cls, fields) _add_get_tracking_url(cls) ...
python
def track(*fields): """ Decorator used to track changes on Model's fields. :Example: >>> @track('name') ... class Human(models.Model): ... name = models.CharField(max_length=30) """ def inner(cls): _track_class(cls, fields) _add_get_tracking_url(cls) ...
[ "def", "track", "(", "*", "fields", ")", ":", "def", "inner", "(", "cls", ")", ":", "_track_class", "(", "cls", ",", "fields", ")", "_add_get_tracking_url", "(", "cls", ")", "return", "cls", "return", "inner" ]
Decorator used to track changes on Model's fields. :Example: >>> @track('name') ... class Human(models.Model): ... name = models.CharField(max_length=30)
[ "Decorator", "used", "to", "track", "changes", "on", "Model", "s", "fields", "." ]
463313d0f9c0f8107a0413f4d418d1a8c2311981
https://github.com/makinacorpus/django-tracking-fields/blob/463313d0f9c0f8107a0413f4d418d1a8c2311981/tracking_fields/decorators.py#L124-L137
train
dourvaris/nano-python
docs/generate.py
indent
def indent(value, n=2, character=' '): """ Indent a value by `n` `character`s :param value: string to indent :param n: number of characters to indent by :param character: character to indent with """ prefix = n * character return '\n'.join(prefix + line for line in value.splitlines())
python
def indent(value, n=2, character=' '): """ Indent a value by `n` `character`s :param value: string to indent :param n: number of characters to indent by :param character: character to indent with """ prefix = n * character return '\n'.join(prefix + line for line in value.splitlines())
[ "def", "indent", "(", "value", ",", "n", "=", "2", ",", "character", "=", "' '", ")", ":", "prefix", "=", "n", "*", "character", "return", "'\\n'", ".", "join", "(", "prefix", "+", "line", "for", "line", "in", "value", ".", "splitlines", "(", ")", ...
Indent a value by `n` `character`s :param value: string to indent :param n: number of characters to indent by :param character: character to indent with
[ "Indent", "a", "value", "by", "n", "character", "s" ]
f26b8bc895b997067780f925049a70e82c0c2479
https://github.com/dourvaris/nano-python/blob/f26b8bc895b997067780f925049a70e82c0c2479/docs/generate.py#L13-L23
train
NetworkAutomation/jaide
jaide/core.py
Jaide.check_instance
def check_instance(function): """ Wrapper that tests the type of _session. Purpose: This decorator function is used by all functions within | the Jaide class that interact with a device to ensure the | proper session type is in use. If it is not, it will | atte...
python
def check_instance(function): """ Wrapper that tests the type of _session. Purpose: This decorator function is used by all functions within | the Jaide class that interact with a device to ensure the | proper session type is in use. If it is not, it will | atte...
[ "def", "check_instance", "(", "function", ")", ":", "def", "wrapper", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "func_trans", "=", "{", "\"commit\"", ":", "manager", ".", "Manager", ",", "\"compare_config\"", ":", "manager", ".", "Man...
Wrapper that tests the type of _session. Purpose: This decorator function is used by all functions within | the Jaide class that interact with a device to ensure the | proper session type is in use. If it is not, it will | attempt to migrate _session to that type befor...
[ "Wrapper", "that", "tests", "the", "type", "of", "_session", "." ]
8571b987a8c24c246dc09f1bcc11cb0f045ec33f
https://github.com/NetworkAutomation/jaide/blob/8571b987a8c24c246dc09f1bcc11cb0f045ec33f/jaide/core.py#L132-L201
train
NetworkAutomation/jaide
jaide/core.py
Jaide.commit
def commit(self, commands="", confirmed=None, comment=None, at_time=None, synchronize=False, req_format='text'): """ Perform a commit operation. Purpose: Executes a commit operation. All parameters are optional. | commit confirm and commit at are mutually exclusive. All ...
python
def commit(self, commands="", confirmed=None, comment=None, at_time=None, synchronize=False, req_format='text'): """ Perform a commit operation. Purpose: Executes a commit operation. All parameters are optional. | commit confirm and commit at are mutually exclusive. All ...
[ "def", "commit", "(", "self", ",", "commands", "=", "\"\"", ",", "confirmed", "=", "None", ",", "comment", "=", "None", ",", "at_time", "=", "None", ",", "synchronize", "=", "False", ",", "req_format", "=", "'text'", ")", ":", "if", "not", "commands", ...
Perform a commit operation. Purpose: Executes a commit operation. All parameters are optional. | commit confirm and commit at are mutually exclusive. All | the others can be used with each other and commit confirm/at. @param commands: A string or list of multiple commands...
[ "Perform", "a", "commit", "operation", "." ]
8571b987a8c24c246dc09f1bcc11cb0f045ec33f
https://github.com/NetworkAutomation/jaide/blob/8571b987a8c24c246dc09f1bcc11cb0f045ec33f/jaide/core.py#L214-L298
train
NetworkAutomation/jaide
jaide/core.py
Jaide.commit_check
def commit_check(self, commands="", req_format="text"): """ Execute a commit check operation. Purpose: This method will take in string of multiple commands, | and perform and 'commit check' on the device to ensure | the commands are syntactically correct. The response can ...
python
def commit_check(self, commands="", req_format="text"): """ Execute a commit check operation. Purpose: This method will take in string of multiple commands, | and perform and 'commit check' on the device to ensure | the commands are syntactically correct. The response can ...
[ "def", "commit_check", "(", "self", ",", "commands", "=", "\"\"", ",", "req_format", "=", "\"text\"", ")", ":", "if", "not", "commands", ":", "raise", "InvalidCommandError", "(", "'No commands specified'", ")", "clean_cmds", "=", "[", "]", "for", "cmd", "in"...
Execute a commit check operation. Purpose: This method will take in string of multiple commands, | and perform and 'commit check' on the device to ensure | the commands are syntactically correct. The response can | be formatted as text or as xml. @param com...
[ "Execute", "a", "commit", "check", "operation", "." ]
8571b987a8c24c246dc09f1bcc11cb0f045ec33f
https://github.com/NetworkAutomation/jaide/blob/8571b987a8c24c246dc09f1bcc11cb0f045ec33f/jaide/core.py#L301-L352
train
NetworkAutomation/jaide
jaide/core.py
Jaide.compare_config
def compare_config(self, commands="", req_format="text"): """ Execute a 'show | compare' against the specified commands. Purpose: This method will take in string of multiple commands, | and perform and 'show | compare' on the device to show the | differences between the ac...
python
def compare_config(self, commands="", req_format="text"): """ Execute a 'show | compare' against the specified commands. Purpose: This method will take in string of multiple commands, | and perform and 'show | compare' on the device to show the | differences between the ac...
[ "def", "compare_config", "(", "self", ",", "commands", "=", "\"\"", ",", "req_format", "=", "\"text\"", ")", ":", "if", "not", "commands", ":", "raise", "InvalidCommandError", "(", "'No commands specified'", ")", "clean_cmds", "=", "[", "cmd", "for", "cmd", ...
Execute a 'show | compare' against the specified commands. Purpose: This method will take in string of multiple commands, | and perform and 'show | compare' on the device to show the | differences between the active running configuration and | the changes proposed b...
[ "Execute", "a", "show", "|", "compare", "against", "the", "specified", "commands", "." ]
8571b987a8c24c246dc09f1bcc11cb0f045ec33f
https://github.com/NetworkAutomation/jaide/blob/8571b987a8c24c246dc09f1bcc11cb0f045ec33f/jaide/core.py#L355-L383
train
NetworkAutomation/jaide
jaide/core.py
Jaide.connect
def connect(self): """ Establish a connection to the device. Purpose: This method is used to make a connection to the junos | device. The internal property conn_type is what | determines the type of connection we make to the device. | - 'paramiko' is used fo...
python
def connect(self): """ Establish a connection to the device. Purpose: This method is used to make a connection to the junos | device. The internal property conn_type is what | determines the type of connection we make to the device. | - 'paramiko' is used fo...
[ "def", "connect", "(", "self", ")", ":", "if", "self", ".", "conn_type", "==", "'paramiko'", ":", "self", ".", "_session", "=", "paramiko", ".", "SSHClient", "(", ")", "logger", "=", "logging", ".", "Logger", ".", "manager", ".", "getLogger", "(", "'pa...
Establish a connection to the device. Purpose: This method is used to make a connection to the junos | device. The internal property conn_type is what | determines the type of connection we make to the device. | - 'paramiko' is used for operational commands (to allo...
[ "Establish", "a", "connection", "to", "the", "device", "." ]
8571b987a8c24c246dc09f1bcc11cb0f045ec33f
https://github.com/NetworkAutomation/jaide/blob/8571b987a8c24c246dc09f1bcc11cb0f045ec33f/jaide/core.py#L385-L457
train
NetworkAutomation/jaide
jaide/core.py
Jaide._copy_status
def _copy_status(self, filename, size, sent): """ Echo status of an SCP operation. Purpose: Callback function for an SCP operation. Used to show | the progress of an actively running copy. This directly | prints to stdout, one line for each file as it's copied. ...
python
def _copy_status(self, filename, size, sent): """ Echo status of an SCP operation. Purpose: Callback function for an SCP operation. Used to show | the progress of an actively running copy. This directly | prints to stdout, one line for each file as it's copied. ...
[ "def", "_copy_status", "(", "self", ",", "filename", ",", "size", ",", "sent", ")", ":", "output", "=", "\"Transferred %.0f%% of the file %s\"", "%", "(", "(", "float", "(", "sent", ")", "/", "float", "(", "size", ")", "*", "100", ")", ",", "path", "."...
Echo status of an SCP operation. Purpose: Callback function for an SCP operation. Used to show | the progress of an actively running copy. This directly | prints to stdout, one line for each file as it's copied. | The parameters received by this function are those r...
[ "Echo", "status", "of", "an", "SCP", "operation", "." ]
8571b987a8c24c246dc09f1bcc11cb0f045ec33f
https://github.com/NetworkAutomation/jaide/blob/8571b987a8c24c246dc09f1bcc11cb0f045ec33f/jaide/core.py#L459-L485
train
NetworkAutomation/jaide
jaide/core.py
Jaide.device_info
def device_info(self): """ Pull basic device information. Purpose: This function grabs the hostname, model, running version, and | serial number of the device. @returns: The output that should be shown to the user. @rtype: str """ # get hostname, model, a...
python
def device_info(self): """ Pull basic device information. Purpose: This function grabs the hostname, model, running version, and | serial number of the device. @returns: The output that should be shown to the user. @rtype: str """ # get hostname, model, a...
[ "def", "device_info", "(", "self", ")", ":", "resp", "=", "self", ".", "_session", ".", "get_software_information", "(", "format", "=", "'xml'", ")", "hostname", "=", "resp", ".", "xpath", "(", "'//software-information/host-name'", ")", "[", "0", "]", ".", ...
Pull basic device information. Purpose: This function grabs the hostname, model, running version, and | serial number of the device. @returns: The output that should be shown to the user. @rtype: str
[ "Pull", "basic", "device", "information", "." ]
8571b987a8c24c246dc09f1bcc11cb0f045ec33f
https://github.com/NetworkAutomation/jaide/blob/8571b987a8c24c246dc09f1bcc11cb0f045ec33f/jaide/core.py#L488-L588
train
NetworkAutomation/jaide
jaide/core.py
Jaide.diff_config
def diff_config(self, second_host, mode='stanza'): """ Generate configuration differences with a second device. Purpose: Open a second ncclient.manager.Manager with second_host, and | and pull the configuration from it. We then use difflib to | get the delta between the tw...
python
def diff_config(self, second_host, mode='stanza'): """ Generate configuration differences with a second device. Purpose: Open a second ncclient.manager.Manager with second_host, and | and pull the configuration from it. We then use difflib to | get the delta between the tw...
[ "def", "diff_config", "(", "self", ",", "second_host", ",", "mode", "=", "'stanza'", ")", ":", "second_conn", "=", "manager", ".", "connect", "(", "host", "=", "second_host", ",", "port", "=", "self", ".", "port", ",", "username", "=", "self", ".", "us...
Generate configuration differences with a second device. Purpose: Open a second ncclient.manager.Manager with second_host, and | and pull the configuration from it. We then use difflib to | get the delta between the two, and yield the results. @param second_host: the IP o...
[ "Generate", "configuration", "differences", "with", "a", "second", "device", "." ]
8571b987a8c24c246dc09f1bcc11cb0f045ec33f
https://github.com/NetworkAutomation/jaide/blob/8571b987a8c24c246dc09f1bcc11cb0f045ec33f/jaide/core.py#L592-L633
train
NetworkAutomation/jaide
jaide/core.py
Jaide._error_parse
def _error_parse(self, interface, face): """ Parse the extensive xml output of an interface and yield errors. Purpose: Takes the xml output of 'show interfaces extensive' for a | given interface and yields the error types that have a | significant number of errors. ...
python
def _error_parse(self, interface, face): """ Parse the extensive xml output of an interface and yield errors. Purpose: Takes the xml output of 'show interfaces extensive' for a | given interface and yields the error types that have a | significant number of errors. ...
[ "def", "_error_parse", "(", "self", ",", "interface", ",", "face", ")", ":", "try", ":", "error_list", "=", "interface", ".", "xpath", "(", "face", "+", "'-error-list'", ")", "[", "0", "]", ".", "getchildren", "(", ")", "except", "IndexError", ":", "pa...
Parse the extensive xml output of an interface and yield errors. Purpose: Takes the xml output of 'show interfaces extensive' for a | given interface and yields the error types that have a | significant number of errors. @param interface: The xml output of the 'sh int ext...
[ "Parse", "the", "extensive", "xml", "output", "of", "an", "interface", "and", "yield", "errors", "." ]
8571b987a8c24c246dc09f1bcc11cb0f045ec33f
https://github.com/NetworkAutomation/jaide/blob/8571b987a8c24c246dc09f1bcc11cb0f045ec33f/jaide/core.py#L657-L685
train
NetworkAutomation/jaide
jaide/core.py
Jaide.health_check
def health_check(self): """ Pull health and alarm information from the device. Purpose: Grab the cpu/mem usage, system/chassis alarms, top 5 | processes, and states if the primary/backup partitions are on | different versions. @returns: The output that should be s...
python
def health_check(self): """ Pull health and alarm information from the device. Purpose: Grab the cpu/mem usage, system/chassis alarms, top 5 | processes, and states if the primary/backup partitions are on | different versions. @returns: The output that should be s...
[ "def", "health_check", "(", "self", ")", ":", "output", "=", "'Chassis Alarms:\\n\\t'", "chassis_alarms", "=", "self", ".", "_session", ".", "command", "(", "\"show chassis alarms\"", ")", "chassis_alarms", "=", "chassis_alarms", ".", "xpath", "(", "'//alarm-detail'...
Pull health and alarm information from the device. Purpose: Grab the cpu/mem usage, system/chassis alarms, top 5 | processes, and states if the primary/backup partitions are on | different versions. @returns: The output that should be shown to the user. @rtype: st...
[ "Pull", "health", "and", "alarm", "information", "from", "the", "device", "." ]
8571b987a8c24c246dc09f1bcc11cb0f045ec33f
https://github.com/NetworkAutomation/jaide/blob/8571b987a8c24c246dc09f1bcc11cb0f045ec33f/jaide/core.py#L688-L734
train
NetworkAutomation/jaide
jaide/core.py
Jaide.interface_errors
def interface_errors(self): """ Parse 'show interfaces extensive' and return interfaces with errors. Purpose: This function is called for the -e flag. It will let the user | know if there are any interfaces with errors, and what those | interfaces are. @returns: T...
python
def interface_errors(self): """ Parse 'show interfaces extensive' and return interfaces with errors. Purpose: This function is called for the -e flag. It will let the user | know if there are any interfaces with errors, and what those | interfaces are. @returns: T...
[ "def", "interface_errors", "(", "self", ")", ":", "output", "=", "[", "]", "dev_response", "=", "self", ".", "_session", ".", "command", "(", "'sh interfaces extensive'", ")", "ints", "=", "dev_response", ".", "xpath", "(", "'//physical-interface'", ")", "ints...
Parse 'show interfaces extensive' and return interfaces with errors. Purpose: This function is called for the -e flag. It will let the user | know if there are any interfaces with errors, and what those | interfaces are. @returns: The output that should be shown to the us...
[ "Parse", "show", "interfaces", "extensive", "and", "return", "interfaces", "with", "errors", "." ]
8571b987a8c24c246dc09f1bcc11cb0f045ec33f
https://github.com/NetworkAutomation/jaide/blob/8571b987a8c24c246dc09f1bcc11cb0f045ec33f/jaide/core.py#L737-L772
train
NetworkAutomation/jaide
jaide/core.py
Jaide.lock
def lock(self): """ Lock the candidate config. Requires ncclient.manager.Manager. """ if isinstance(self._session, manager.Manager): self._session.lock()
python
def lock(self): """ Lock the candidate config. Requires ncclient.manager.Manager. """ if isinstance(self._session, manager.Manager): self._session.lock()
[ "def", "lock", "(", "self", ")", ":", "if", "isinstance", "(", "self", ".", "_session", ",", "manager", ".", "Manager", ")", ":", "self", ".", "_session", ".", "lock", "(", ")" ]
Lock the candidate config. Requires ncclient.manager.Manager.
[ "Lock", "the", "candidate", "config", ".", "Requires", "ncclient", ".", "manager", ".", "Manager", "." ]
8571b987a8c24c246dc09f1bcc11cb0f045ec33f
https://github.com/NetworkAutomation/jaide/blob/8571b987a8c24c246dc09f1bcc11cb0f045ec33f/jaide/core.py#L774-L777
train
NetworkAutomation/jaide
jaide/core.py
Jaide.op_cmd
def op_cmd(self, command, req_format='text', xpath_expr=""): """ Execute an operational mode command. Purpose: Used to send an operational mode command to the connected | device. This requires and uses a paramiko.SSHClient() as | the handler so that we can easily pass and ...
python
def op_cmd(self, command, req_format='text', xpath_expr=""): """ Execute an operational mode command. Purpose: Used to send an operational mode command to the connected | device. This requires and uses a paramiko.SSHClient() as | the handler so that we can easily pass and ...
[ "def", "op_cmd", "(", "self", ",", "command", ",", "req_format", "=", "'text'", ",", "xpath_expr", "=", "\"\"", ")", ":", "if", "not", "command", ":", "raise", "InvalidCommandError", "(", "\"Parameter 'command' cannot be empty\"", ")", "if", "req_format", ".", ...
Execute an operational mode command. Purpose: Used to send an operational mode command to the connected | device. This requires and uses a paramiko.SSHClient() as | the handler so that we can easily pass and allow all pipe | commands to be used. | ...
[ "Execute", "an", "operational", "mode", "command", "." ]
8571b987a8c24c246dc09f1bcc11cb0f045ec33f
https://github.com/NetworkAutomation/jaide/blob/8571b987a8c24c246dc09f1bcc11cb0f045ec33f/jaide/core.py#L780-L832
train
NetworkAutomation/jaide
jaide/core.py
Jaide.unlock
def unlock(self): """ Unlock the candidate config. Purpose: Unlocks the candidate configuration, so that other people can | edit the device. Requires the _session private variable to be | a type of a ncclient.manager.Manager. """ if isinstance(self._session...
python
def unlock(self): """ Unlock the candidate config. Purpose: Unlocks the candidate configuration, so that other people can | edit the device. Requires the _session private variable to be | a type of a ncclient.manager.Manager. """ if isinstance(self._session...
[ "def", "unlock", "(", "self", ")", ":", "if", "isinstance", "(", "self", ".", "_session", ",", "manager", ".", "Manager", ")", ":", "self", ".", "_session", ".", "unlock", "(", ")" ]
Unlock the candidate config. Purpose: Unlocks the candidate configuration, so that other people can | edit the device. Requires the _session private variable to be | a type of a ncclient.manager.Manager.
[ "Unlock", "the", "candidate", "config", "." ]
8571b987a8c24c246dc09f1bcc11cb0f045ec33f
https://github.com/NetworkAutomation/jaide/blob/8571b987a8c24c246dc09f1bcc11cb0f045ec33f/jaide/core.py#L942-L950
train
Fluxx/exam
exam/helpers.py
intercept
def intercept(obj, methodname, wrapper): """ Wraps an existing method on an object with the provided generator, which will be "sent" the value when it yields control. :: >>> def ensure_primary_key_is_set(): ... assert model.pk is None ... saved = yield ... a...
python
def intercept(obj, methodname, wrapper): """ Wraps an existing method on an object with the provided generator, which will be "sent" the value when it yields control. :: >>> def ensure_primary_key_is_set(): ... assert model.pk is None ... saved = yield ... a...
[ "def", "intercept", "(", "obj", ",", "methodname", ",", "wrapper", ")", ":", "original", "=", "getattr", "(", "obj", ",", "methodname", ")", "def", "replacement", "(", "*", "args", ",", "**", "kwargs", ")", ":", "wrapfn", "=", "wrapper", "(", "*", "a...
Wraps an existing method on an object with the provided generator, which will be "sent" the value when it yields control. :: >>> def ensure_primary_key_is_set(): ... assert model.pk is None ... saved = yield ... aasert model is saved ... assert model.pk ...
[ "Wraps", "an", "existing", "method", "on", "an", "object", "with", "the", "provided", "generator", "which", "will", "be", "sent", "the", "value", "when", "it", "yields", "control", "." ]
27dc53a703349ec09433a6b989d6fc32ad523c0b
https://github.com/Fluxx/exam/blob/27dc53a703349ec09433a6b989d6fc32ad523c0b/exam/helpers.py#L28-L72
train
mcieslik-mctp/papy
src/numap/NuMap.py
_Weave.next
def next(self): """ Returns the next element or raises ``StopIteration`` if stopped. """ # need new iterable? if self.r == self.repeats: self.i = (self.i + 1) % self.lenght self.r = 0 self.r += 1 if self.stopping and self.i == 0 and self.r...
python
def next(self): """ Returns the next element or raises ``StopIteration`` if stopped. """ # need new iterable? if self.r == self.repeats: self.i = (self.i + 1) % self.lenght self.r = 0 self.r += 1 if self.stopping and self.i == 0 and self.r...
[ "def", "next", "(", "self", ")", ":", "if", "self", ".", "r", "==", "self", ".", "repeats", ":", "self", ".", "i", "=", "(", "self", ".", "i", "+", "1", ")", "%", "self", ".", "lenght", "self", ".", "r", "=", "0", "self", ".", "r", "+=", ...
Returns the next element or raises ``StopIteration`` if stopped.
[ "Returns", "the", "next", "element", "or", "raises", "StopIteration", "if", "stopped", "." ]
708e50827b5db46bbea081982cb74b9b0e464064
https://github.com/mcieslik-mctp/papy/blob/708e50827b5db46bbea081982cb74b9b0e464064/src/numap/NuMap.py#L880-L896
train
mcieslik-mctp/papy
src/numap/NuMap.py
_NuMapTask.next
def next(self): """ Returns a result if availble within "timeout" else raises a ``TimeoutError`` exception. See documentation for ``NuMap.next``. """ return self.iterator.next(task=self.task, timeout=self.timeout, block=self.bl...
python
def next(self): """ Returns a result if availble within "timeout" else raises a ``TimeoutError`` exception. See documentation for ``NuMap.next``. """ return self.iterator.next(task=self.task, timeout=self.timeout, block=self.bl...
[ "def", "next", "(", "self", ")", ":", "return", "self", ".", "iterator", ".", "next", "(", "task", "=", "self", ".", "task", ",", "timeout", "=", "self", ".", "timeout", ",", "block", "=", "self", ".", "block", ")" ]
Returns a result if availble within "timeout" else raises a ``TimeoutError`` exception. See documentation for ``NuMap.next``.
[ "Returns", "a", "result", "if", "availble", "within", "timeout", "else", "raises", "a", "TimeoutError", "exception", ".", "See", "documentation", "for", "NuMap", ".", "next", "." ]
708e50827b5db46bbea081982cb74b9b0e464064
https://github.com/mcieslik-mctp/papy/blob/708e50827b5db46bbea081982cb74b9b0e464064/src/numap/NuMap.py#L919-L925
train
mcieslik-mctp/papy
src/papy/util/script.py
write_template
def write_template(fn, lang="python"): """ Write language-specific script template to file. Arguments: - fn(``string``) path to save the template to - lang('python', 'bash') which programming language """ with open(fn, "wb") as fh: if lang == "python": fh.wri...
python
def write_template(fn, lang="python"): """ Write language-specific script template to file. Arguments: - fn(``string``) path to save the template to - lang('python', 'bash') which programming language """ with open(fn, "wb") as fh: if lang == "python": fh.wri...
[ "def", "write_template", "(", "fn", ",", "lang", "=", "\"python\"", ")", ":", "with", "open", "(", "fn", ",", "\"wb\"", ")", "as", "fh", ":", "if", "lang", "==", "\"python\"", ":", "fh", ".", "write", "(", "PY_TEMPLATE", ")", "elif", "lang", "==", ...
Write language-specific script template to file. Arguments: - fn(``string``) path to save the template to - lang('python', 'bash') which programming language
[ "Write", "language", "-", "specific", "script", "template", "to", "file", "." ]
708e50827b5db46bbea081982cb74b9b0e464064
https://github.com/mcieslik-mctp/papy/blob/708e50827b5db46bbea081982cb74b9b0e464064/src/papy/util/script.py#L94-L108
train
mcieslik-mctp/papy
src/papy/util/script.py
script
def script(inbox, cfg): """ Execute arbitrary scripts. Arguments: - cfg(``dict``) script configuartion dictionary """ script_name = cfg["id"] script_id = str(abs(hash((cfg["id"],) + tuple(inbox[0].values()))))[0:8] # LOG.log(mp.DEFAULT, "@papy;script %s:%s started" % (script_na...
python
def script(inbox, cfg): """ Execute arbitrary scripts. Arguments: - cfg(``dict``) script configuartion dictionary """ script_name = cfg["id"] script_id = str(abs(hash((cfg["id"],) + tuple(inbox[0].values()))))[0:8] # LOG.log(mp.DEFAULT, "@papy;script %s:%s started" % (script_na...
[ "def", "script", "(", "inbox", ",", "cfg", ")", ":", "script_name", "=", "cfg", "[", "\"id\"", "]", "script_id", "=", "str", "(", "abs", "(", "hash", "(", "(", "cfg", "[", "\"id\"", "]", ",", ")", "+", "tuple", "(", "inbox", "[", "0", "]", ".",...
Execute arbitrary scripts. Arguments: - cfg(``dict``) script configuartion dictionary
[ "Execute", "arbitrary", "scripts", "." ]
708e50827b5db46bbea081982cb74b9b0e464064
https://github.com/mcieslik-mctp/papy/blob/708e50827b5db46bbea081982cb74b9b0e464064/src/papy/util/script.py#L152-L203
train
qacafe/cdrouter.py
cdrouter/jobs.py
JobsService.edit
def edit(self, resource): """Edit a job. :param resource: :class:`jobs.Job <jobs.Job>` object :return: :class:`jobs.Job <jobs.Job>` object :rtype: jobs.Job """ schema = JobSchema(exclude=('id', 'status', 'options', 'package_name', 'config_name', 'device_name', 'result_id...
python
def edit(self, resource): """Edit a job. :param resource: :class:`jobs.Job <jobs.Job>` object :return: :class:`jobs.Job <jobs.Job>` object :rtype: jobs.Job """ schema = JobSchema(exclude=('id', 'status', 'options', 'package_name', 'config_name', 'device_name', 'result_id...
[ "def", "edit", "(", "self", ",", "resource", ")", ":", "schema", "=", "JobSchema", "(", "exclude", "=", "(", "'id'", ",", "'status'", ",", "'options'", ",", "'package_name'", ",", "'config_name'", ",", "'device_name'", ",", "'result_id'", ",", "'user_id'", ...
Edit a job. :param resource: :class:`jobs.Job <jobs.Job>` object :return: :class:`jobs.Job <jobs.Job>` object :rtype: jobs.Job
[ "Edit", "a", "job", "." ]
aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/jobs.py#L153-L165
train
qacafe/cdrouter.py
cdrouter/jobs.py
JobsService.launch
def launch(self, resource): """Launch a new job. :param resource: :class:`jobs.Job <jobs.Job>` object :return: :class:`jobs.Job <jobs.Job>` object :rtype: jobs.Job """ schema = JobSchema(exclude=('id', 'status', 'package_name', 'config_name', 'device_name', 'result_id', ...
python
def launch(self, resource): """Launch a new job. :param resource: :class:`jobs.Job <jobs.Job>` object :return: :class:`jobs.Job <jobs.Job>` object :rtype: jobs.Job """ schema = JobSchema(exclude=('id', 'status', 'package_name', 'config_name', 'device_name', 'result_id', ...
[ "def", "launch", "(", "self", ",", "resource", ")", ":", "schema", "=", "JobSchema", "(", "exclude", "=", "(", "'id'", ",", "'status'", ",", "'package_name'", ",", "'config_name'", ",", "'device_name'", ",", "'result_id'", ",", "'user_id'", ",", "'created'",...
Launch a new job. :param resource: :class:`jobs.Job <jobs.Job>` object :return: :class:`jobs.Job <jobs.Job>` object :rtype: jobs.Job
[ "Launch", "a", "new", "job", "." ]
aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/jobs.py#L167-L179
train
qacafe/cdrouter.py
cdrouter/jobs.py
JobsService.bulk_launch
def bulk_launch(self, jobs=None, filter=None, all=False): # pylint: disable=redefined-builtin """Bulk launch a set of jobs. :param jobs: :class:`jobs.Job <jobs.Job>` list :param filter: (optional) Filters to apply as a string list. :param all: (optional) Apply to all if bool `True`. ...
python
def bulk_launch(self, jobs=None, filter=None, all=False): # pylint: disable=redefined-builtin """Bulk launch a set of jobs. :param jobs: :class:`jobs.Job <jobs.Job>` list :param filter: (optional) Filters to apply as a string list. :param all: (optional) Apply to all if bool `True`. ...
[ "def", "bulk_launch", "(", "self", ",", "jobs", "=", "None", ",", "filter", "=", "None", ",", "all", "=", "False", ")", ":", "json", "=", "None", "if", "jobs", "is", "not", "None", ":", "schema", "=", "JobSchema", "(", "exclude", "=", "(", "'id'", ...
Bulk launch a set of jobs. :param jobs: :class:`jobs.Job <jobs.Job>` list :param filter: (optional) Filters to apply as a string list. :param all: (optional) Apply to all if bool `True`.
[ "Bulk", "launch", "a", "set", "of", "jobs", "." ]
aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/jobs.py#L188-L204
train
qacafe/cdrouter.py
cdrouter/highlights.py
HighlightsService.get
def get(self, id, seq, line): # pylint: disable=invalid-name,redefined-builtin """Get a highlight. :param id: Result ID as an int. :param seq: TestResult sequence ID as an int. :param line: Line number in TestResult's logfile as an int. :return: :class:`highlights.Highlight <hig...
python
def get(self, id, seq, line): # pylint: disable=invalid-name,redefined-builtin """Get a highlight. :param id: Result ID as an int. :param seq: TestResult sequence ID as an int. :param line: Line number in TestResult's logfile as an int. :return: :class:`highlights.Highlight <hig...
[ "def", "get", "(", "self", ",", "id", ",", "seq", ",", "line", ")", ":", "schema", "=", "HighlightSchema", "(", ")", "resp", "=", "self", ".", "service", ".", "get_id", "(", "self", ".", "_base", "(", "id", ",", "seq", ")", ",", "line", ")", "r...
Get a highlight. :param id: Result ID as an int. :param seq: TestResult sequence ID as an int. :param line: Line number in TestResult's logfile as an int. :return: :class:`highlights.Highlight <highlights.Highlight>` object
[ "Get", "a", "highlight", "." ]
aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/highlights.py#L57-L67
train
qacafe/cdrouter.py
cdrouter/highlights.py
HighlightsService.create_or_edit
def create_or_edit(self, id, seq, resource): # pylint: disable=invalid-name,redefined-builtin """Create or edit a highlight. :param id: Result ID as an int. :param seq: TestResult sequence ID as an int. :param resource: :class:`highlights.Highlight <highlights.Highlight>` object ...
python
def create_or_edit(self, id, seq, resource): # pylint: disable=invalid-name,redefined-builtin """Create or edit a highlight. :param id: Result ID as an int. :param seq: TestResult sequence ID as an int. :param resource: :class:`highlights.Highlight <highlights.Highlight>` object ...
[ "def", "create_or_edit", "(", "self", ",", "id", ",", "seq", ",", "resource", ")", ":", "schema", "=", "HighlightSchema", "(", "exclude", "=", "(", "'id'", ",", "'seq'", ")", ")", "json", "=", "self", ".", "service", ".", "encode", "(", "schema", ","...
Create or edit a highlight. :param id: Result ID as an int. :param seq: TestResult sequence ID as an int. :param resource: :class:`highlights.Highlight <highlights.Highlight>` object :return: :class:`highlights.Highlight <highlights.Highlight>` object :rtype: highlights.Highligh...
[ "Create", "or", "edit", "a", "highlight", "." ]
aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/highlights.py#L69-L83
train
qacafe/cdrouter.py
cdrouter/highlights.py
HighlightsService.create
def create(self, id, seq, resource): # pylint: disable=invalid-name,redefined-builtin """Create a highlight. :param id: Result ID as an int. :param seq: TestResult sequence ID as an int. :param resource: :class:`highlights.Highlight <highlights.Highlight>` object :return: :class...
python
def create(self, id, seq, resource): # pylint: disable=invalid-name,redefined-builtin """Create a highlight. :param id: Result ID as an int. :param seq: TestResult sequence ID as an int. :param resource: :class:`highlights.Highlight <highlights.Highlight>` object :return: :class...
[ "def", "create", "(", "self", ",", "id", ",", "seq", ",", "resource", ")", ":", "return", "self", ".", "create_or_edit", "(", "id", ",", "seq", ",", "resource", ")" ]
Create a highlight. :param id: Result ID as an int. :param seq: TestResult sequence ID as an int. :param resource: :class:`highlights.Highlight <highlights.Highlight>` object :return: :class:`highlights.Highlight <highlights.Highlight>` object :rtype: highlights.Highlight
[ "Create", "a", "highlight", "." ]
aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/highlights.py#L85-L94
train
qacafe/cdrouter.py
cdrouter/highlights.py
HighlightsService.edit
def edit(self, id, seq, resource): # pylint: disable=invalid-name,redefined-builtin """Edit a highlight. :param id: Result ID as an int. :param seq: TestResult sequence ID as an int. :param resource: :class:`highlights.Highlight <highlights.Highlight>` object :return: :class:`hi...
python
def edit(self, id, seq, resource): # pylint: disable=invalid-name,redefined-builtin """Edit a highlight. :param id: Result ID as an int. :param seq: TestResult sequence ID as an int. :param resource: :class:`highlights.Highlight <highlights.Highlight>` object :return: :class:`hi...
[ "def", "edit", "(", "self", ",", "id", ",", "seq", ",", "resource", ")", ":", "return", "self", ".", "create_or_edit", "(", "id", ",", "seq", ",", "resource", ")" ]
Edit a highlight. :param id: Result ID as an int. :param seq: TestResult sequence ID as an int. :param resource: :class:`highlights.Highlight <highlights.Highlight>` object :return: :class:`highlights.Highlight <highlights.Highlight>` object :rtype: highlights.Highlight
[ "Edit", "a", "highlight", "." ]
aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/highlights.py#L96-L105
train
qacafe/cdrouter.py
cdrouter/highlights.py
HighlightsService.delete
def delete(self, id, seq, line): # pylint: disable=invalid-name,redefined-builtin """Delete a highlight. :param id: Result ID as an int. :param seq: TestResult sequence ID as an int. :param line: Line number in TestResult's logfile as an int. """ return self.service.dele...
python
def delete(self, id, seq, line): # pylint: disable=invalid-name,redefined-builtin """Delete a highlight. :param id: Result ID as an int. :param seq: TestResult sequence ID as an int. :param line: Line number in TestResult's logfile as an int. """ return self.service.dele...
[ "def", "delete", "(", "self", ",", "id", ",", "seq", ",", "line", ")", ":", "return", "self", ".", "service", ".", "delete_id", "(", "self", ".", "_base", "(", "id", ",", "seq", ")", ",", "line", ")" ]
Delete a highlight. :param id: Result ID as an int. :param seq: TestResult sequence ID as an int. :param line: Line number in TestResult's logfile as an int.
[ "Delete", "a", "highlight", "." ]
aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/highlights.py#L107-L114
train
inveniosoftware/invenio-oauthclient
invenio_oauthclient/views/client.py
post_ext_init
def post_ext_init(state): """Setup blueprint.""" app = state.app app.config.setdefault( 'OAUTHCLIENT_SITENAME', app.config.get('THEME_SITENAME', 'Invenio')) app.config.setdefault( 'OAUTHCLIENT_BASE_TEMPLATE', app.config.get('BASE_TEMPLATE', 'inveni...
python
def post_ext_init(state): """Setup blueprint.""" app = state.app app.config.setdefault( 'OAUTHCLIENT_SITENAME', app.config.get('THEME_SITENAME', 'Invenio')) app.config.setdefault( 'OAUTHCLIENT_BASE_TEMPLATE', app.config.get('BASE_TEMPLATE', 'inveni...
[ "def", "post_ext_init", "(", "state", ")", ":", "app", "=", "state", ".", "app", "app", ".", "config", ".", "setdefault", "(", "'OAUTHCLIENT_SITENAME'", ",", "app", ".", "config", ".", "get", "(", "'THEME_SITENAME'", ",", "'Invenio'", ")", ")", "app", "....
Setup blueprint.
[ "Setup", "blueprint", "." ]
2500dc6935738107617aeade79e050d7608004bb
https://github.com/inveniosoftware/invenio-oauthclient/blob/2500dc6935738107617aeade79e050d7608004bb/invenio_oauthclient/views/client.py#L43-L61
train
inveniosoftware/invenio-oauthclient
invenio_oauthclient/views/client.py
login
def login(remote_app): """Send user to remote application for authentication.""" oauth = current_app.extensions['oauthlib.client'] if remote_app not in oauth.remote_apps: return abort(404) # Get redirect target in safe manner. next_param = get_safe_redirect_target(arg='next') # Redire...
python
def login(remote_app): """Send user to remote application for authentication.""" oauth = current_app.extensions['oauthlib.client'] if remote_app not in oauth.remote_apps: return abort(404) # Get redirect target in safe manner. next_param = get_safe_redirect_target(arg='next') # Redire...
[ "def", "login", "(", "remote_app", ")", ":", "oauth", "=", "current_app", ".", "extensions", "[", "'oauthlib.client'", "]", "if", "remote_app", "not", "in", "oauth", ".", "remote_apps", ":", "return", "abort", "(", "404", ")", "next_param", "=", "get_safe_re...
Send user to remote application for authentication.
[ "Send", "user", "to", "remote", "application", "for", "authentication", "." ]
2500dc6935738107617aeade79e050d7608004bb
https://github.com/inveniosoftware/invenio-oauthclient/blob/2500dc6935738107617aeade79e050d7608004bb/invenio_oauthclient/views/client.py#L65-L93
train
inveniosoftware/invenio-oauthclient
invenio_oauthclient/views/client.py
authorized
def authorized(remote_app=None): """Authorized handler callback.""" if remote_app not in current_oauthclient.handlers: return abort(404) state_token = request.args.get('state') # Verify state parameter try: assert state_token # Checks authenticity and integrity of state and...
python
def authorized(remote_app=None): """Authorized handler callback.""" if remote_app not in current_oauthclient.handlers: return abort(404) state_token = request.args.get('state') # Verify state parameter try: assert state_token # Checks authenticity and integrity of state and...
[ "def", "authorized", "(", "remote_app", "=", "None", ")", ":", "if", "remote_app", "not", "in", "current_oauthclient", ".", "handlers", ":", "return", "abort", "(", "404", ")", "state_token", "=", "request", ".", "args", ".", "get", "(", "'state'", ")", ...
Authorized handler callback.
[ "Authorized", "handler", "callback", "." ]
2500dc6935738107617aeade79e050d7608004bb
https://github.com/inveniosoftware/invenio-oauthclient/blob/2500dc6935738107617aeade79e050d7608004bb/invenio_oauthclient/views/client.py#L97-L128
train
inveniosoftware/invenio-oauthclient
invenio_oauthclient/views/client.py
signup
def signup(remote_app): """Extra signup step.""" if remote_app not in current_oauthclient.signup_handlers: return abort(404) res = current_oauthclient.signup_handlers[remote_app]['view']() return abort(404) if res is None else res
python
def signup(remote_app): """Extra signup step.""" if remote_app not in current_oauthclient.signup_handlers: return abort(404) res = current_oauthclient.signup_handlers[remote_app]['view']() return abort(404) if res is None else res
[ "def", "signup", "(", "remote_app", ")", ":", "if", "remote_app", "not", "in", "current_oauthclient", ".", "signup_handlers", ":", "return", "abort", "(", "404", ")", "res", "=", "current_oauthclient", ".", "signup_handlers", "[", "remote_app", "]", "[", "'vie...
Extra signup step.
[ "Extra", "signup", "step", "." ]
2500dc6935738107617aeade79e050d7608004bb
https://github.com/inveniosoftware/invenio-oauthclient/blob/2500dc6935738107617aeade79e050d7608004bb/invenio_oauthclient/views/client.py#L132-L137
train
inveniosoftware/invenio-oauthclient
invenio_oauthclient/views/client.py
disconnect
def disconnect(remote_app): """Disconnect user from remote application. Removes application as well as associated information. """ if remote_app not in current_oauthclient.disconnect_handlers: return abort(404) ret = current_oauthclient.disconnect_handlers[remote_app]() db.session.comm...
python
def disconnect(remote_app): """Disconnect user from remote application. Removes application as well as associated information. """ if remote_app not in current_oauthclient.disconnect_handlers: return abort(404) ret = current_oauthclient.disconnect_handlers[remote_app]() db.session.comm...
[ "def", "disconnect", "(", "remote_app", ")", ":", "if", "remote_app", "not", "in", "current_oauthclient", ".", "disconnect_handlers", ":", "return", "abort", "(", "404", ")", "ret", "=", "current_oauthclient", ".", "disconnect_handlers", "[", "remote_app", "]", ...
Disconnect user from remote application. Removes application as well as associated information.
[ "Disconnect", "user", "from", "remote", "application", "." ]
2500dc6935738107617aeade79e050d7608004bb
https://github.com/inveniosoftware/invenio-oauthclient/blob/2500dc6935738107617aeade79e050d7608004bb/invenio_oauthclient/views/client.py#L141-L151
train
dourvaris/nano-python
src/nano/crypto.py
address_checksum
def address_checksum(address): """ Returns the checksum in bytes for an address in bytes """ address_bytes = address h = blake2b(digest_size=5) h.update(address_bytes) checksum = bytearray(h.digest()) checksum.reverse() return checksum
python
def address_checksum(address): """ Returns the checksum in bytes for an address in bytes """ address_bytes = address h = blake2b(digest_size=5) h.update(address_bytes) checksum = bytearray(h.digest()) checksum.reverse() return checksum
[ "def", "address_checksum", "(", "address", ")", ":", "address_bytes", "=", "address", "h", "=", "blake2b", "(", "digest_size", "=", "5", ")", "h", ".", "update", "(", "address_bytes", ")", "checksum", "=", "bytearray", "(", "h", ".", "digest", "(", ")", ...
Returns the checksum in bytes for an address in bytes
[ "Returns", "the", "checksum", "in", "bytes", "for", "an", "address", "in", "bytes" ]
f26b8bc895b997067780f925049a70e82c0c2479
https://github.com/dourvaris/nano-python/blob/f26b8bc895b997067780f925049a70e82c0c2479/src/nano/crypto.py#L16-L25
train
dourvaris/nano-python
src/nano/crypto.py
keypair_from_seed
def keypair_from_seed(seed, index=0): """ Generates a deterministic keypair from `seed` based on `index` :param seed: bytes value of seed :type seed: bytes :param index: offset from seed :type index: int :return: dict of the form: { 'private': private_key 'public': public_...
python
def keypair_from_seed(seed, index=0): """ Generates a deterministic keypair from `seed` based on `index` :param seed: bytes value of seed :type seed: bytes :param index: offset from seed :type index: int :return: dict of the form: { 'private': private_key 'public': public_...
[ "def", "keypair_from_seed", "(", "seed", ",", "index", "=", "0", ")", ":", "h", "=", "blake2b", "(", "digest_size", "=", "32", ")", "h", ".", "update", "(", "seed", "+", "struct", ".", "pack", "(", "\">L\"", ",", "index", ")", ")", "priv_key", "=",...
Generates a deterministic keypair from `seed` based on `index` :param seed: bytes value of seed :type seed: bytes :param index: offset from seed :type index: int :return: dict of the form: { 'private': private_key 'public': public_key }
[ "Generates", "a", "deterministic", "keypair", "from", "seed", "based", "on", "index" ]
f26b8bc895b997067780f925049a70e82c0c2479
https://github.com/dourvaris/nano-python/blob/f26b8bc895b997067780f925049a70e82c0c2479/src/nano/crypto.py#L38-L58
train
dourvaris/nano-python
src/nano/crypto.py
verify_signature
def verify_signature(message, signature, public_key): """ Verifies `signature` is correct for a `message` signed with `public_key` :param message: message to check :type message: bytes :param signature: signature to check :type signature: bytes :param public_key: public_key to check :...
python
def verify_signature(message, signature, public_key): """ Verifies `signature` is correct for a `message` signed with `public_key` :param message: message to check :type message: bytes :param signature: signature to check :type signature: bytes :param public_key: public_key to check :...
[ "def", "verify_signature", "(", "message", ",", "signature", ",", "public_key", ")", ":", "try", ":", "ed25519_blake2", ".", "checkvalid", "(", "signature", ",", "message", ",", "public_key", ")", "except", "ed25519_blake2", ".", "SignatureMismatch", ":", "retur...
Verifies `signature` is correct for a `message` signed with `public_key` :param message: message to check :type message: bytes :param signature: signature to check :type signature: bytes :param public_key: public_key to check :type public_key: bytes :return: True if valid, False otherwis...
[ "Verifies", "signature", "is", "correct", "for", "a", "message", "signed", "with", "public_key" ]
f26b8bc895b997067780f925049a70e82c0c2479
https://github.com/dourvaris/nano-python/blob/f26b8bc895b997067780f925049a70e82c0c2479/src/nano/crypto.py#L95-L116
train
dourvaris/nano-python
src/nano/crypto.py
sign_message
def sign_message(message, private_key, public_key=None): """ Signs a `message` using `private_key` and `public_key` .. warning:: Not safe to use with secret keys or secret data. See module docstring. This function should be used for testing only. :param message: the message to sign ...
python
def sign_message(message, private_key, public_key=None): """ Signs a `message` using `private_key` and `public_key` .. warning:: Not safe to use with secret keys or secret data. See module docstring. This function should be used for testing only. :param message: the message to sign ...
[ "def", "sign_message", "(", "message", ",", "private_key", ",", "public_key", "=", "None", ")", ":", "if", "public_key", "is", "None", ":", "public_key", "=", "private_to_public_key", "(", "private_key", ")", "return", "ed25519_blake2", ".", "signature_unsafe", ...
Signs a `message` using `private_key` and `public_key` .. warning:: Not safe to use with secret keys or secret data. See module docstring. This function should be used for testing only. :param message: the message to sign :type message: bytes :param private_key: private key used to ...
[ "Signs", "a", "message", "using", "private_key", "and", "public_key" ]
f26b8bc895b997067780f925049a70e82c0c2479
https://github.com/dourvaris/nano-python/blob/f26b8bc895b997067780f925049a70e82c0c2479/src/nano/crypto.py#L119-L142
train
qacafe/cdrouter.py
cdrouter/system.py
SystemService.check_for_lounge_upgrade
def check_for_lounge_upgrade(self, email, password): """Check the CDRouter Support Lounge for eligible upgrades using your Support Lounge email & password. :param email: CDRouter Support Lounge email as a string. :param password: CDRouter Support Lounge password as a string. :re...
python
def check_for_lounge_upgrade(self, email, password): """Check the CDRouter Support Lounge for eligible upgrades using your Support Lounge email & password. :param email: CDRouter Support Lounge email as a string. :param password: CDRouter Support Lounge password as a string. :re...
[ "def", "check_for_lounge_upgrade", "(", "self", ",", "email", ",", "password", ")", ":", "schema", "=", "ReleaseSchema", "(", ")", "resp", "=", "self", ".", "service", ".", "post", "(", "self", ".", "base", "+", "'lounge/check/'", ",", "json", "=", "{", ...
Check the CDRouter Support Lounge for eligible upgrades using your Support Lounge email & password. :param email: CDRouter Support Lounge email as a string. :param password: CDRouter Support Lounge password as a string. :return: :class:`system.Release <system.Release>` object :r...
[ "Check", "the", "CDRouter", "Support", "Lounge", "for", "eligible", "upgrades", "using", "your", "Support", "Lounge", "email", "&", "password", "." ]
aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/system.py#L323-L335
train
qacafe/cdrouter.py
cdrouter/system.py
SystemService.lounge_upgrade
def lounge_upgrade(self, email, password, release_id): """Download & install an upgrade from the CDRouter Support Lounge using your Support Lounge email & password. Please note that any running tests will be stopped. :param email: CDRouter Support Lounge email as a string. :para...
python
def lounge_upgrade(self, email, password, release_id): """Download & install an upgrade from the CDRouter Support Lounge using your Support Lounge email & password. Please note that any running tests will be stopped. :param email: CDRouter Support Lounge email as a string. :para...
[ "def", "lounge_upgrade", "(", "self", ",", "email", ",", "password", ",", "release_id", ")", ":", "schema", "=", "UpgradeSchema", "(", ")", "resp", "=", "self", ".", "service", ".", "post", "(", "self", ".", "base", "+", "'lounge/upgrade/'", ",", "json",...
Download & install an upgrade from the CDRouter Support Lounge using your Support Lounge email & password. Please note that any running tests will be stopped. :param email: CDRouter Support Lounge email as a string. :param password: CDRouter Support Lounge password as a string. ...
[ "Download", "&", "install", "an", "upgrade", "from", "the", "CDRouter", "Support", "Lounge", "using", "your", "Support", "Lounge", "email", "&", "password", ".", "Please", "note", "that", "any", "running", "tests", "will", "be", "stopped", "." ]
aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/system.py#L337-L351
train
qacafe/cdrouter.py
cdrouter/system.py
SystemService.lounge_update_license
def lounge_update_license(self): """Download & install a license for your CDRouter system from the CDRouter Support Lounge. :return: :class:`system.Upgrade <system.Upgrade>` object :rtype: system.Upgrade """ schema = UpgradeSchema() resp = self.service.post(self....
python
def lounge_update_license(self): """Download & install a license for your CDRouter system from the CDRouter Support Lounge. :return: :class:`system.Upgrade <system.Upgrade>` object :rtype: system.Upgrade """ schema = UpgradeSchema() resp = self.service.post(self....
[ "def", "lounge_update_license", "(", "self", ")", ":", "schema", "=", "UpgradeSchema", "(", ")", "resp", "=", "self", ".", "service", ".", "post", "(", "self", ".", "base", "+", "'license/'", ")", "return", "self", ".", "service", ".", "decode", "(", "...
Download & install a license for your CDRouter system from the CDRouter Support Lounge. :return: :class:`system.Upgrade <system.Upgrade>` object :rtype: system.Upgrade
[ "Download", "&", "install", "a", "license", "for", "your", "CDRouter", "system", "from", "the", "CDRouter", "Support", "Lounge", "." ]
aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/system.py#L368-L377
train
qacafe/cdrouter.py
cdrouter/system.py
SystemService.manual_update_license
def manual_update_license(self, fd, filename='cdrouter.lic'): """Update the license on your CDRouter system manually by uploading a .lic license from the CDRouter Support Lounge. :param fd: File-like object to upload. :param filename: (optional) Filename to use for license as string. ...
python
def manual_update_license(self, fd, filename='cdrouter.lic'): """Update the license on your CDRouter system manually by uploading a .lic license from the CDRouter Support Lounge. :param fd: File-like object to upload. :param filename: (optional) Filename to use for license as string. ...
[ "def", "manual_update_license", "(", "self", ",", "fd", ",", "filename", "=", "'cdrouter.lic'", ")", ":", "schema", "=", "UpgradeSchema", "(", ")", "resp", "=", "self", ".", "service", ".", "post", "(", "self", ".", "base", "+", "'license/'", ",", "files...
Update the license on your CDRouter system manually by uploading a .lic license from the CDRouter Support Lounge. :param fd: File-like object to upload. :param filename: (optional) Filename to use for license as string. :return: :class:`system.Upgrade <system.Upgrade>` object :r...
[ "Update", "the", "license", "on", "your", "CDRouter", "system", "manually", "by", "uploading", "a", ".", "lic", "license", "from", "the", "CDRouter", "Support", "Lounge", "." ]
aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/system.py#L379-L391
train
qacafe/cdrouter.py
cdrouter/system.py
SystemService.space
def space(self): """Get system disk space usage. :return: :class:`system.Space <system.Space>` object :rtype: system.Space """ schema = SpaceSchema() resp = self.service.get(self.base+'space/') return self.service.decode(schema, resp)
python
def space(self): """Get system disk space usage. :return: :class:`system.Space <system.Space>` object :rtype: system.Space """ schema = SpaceSchema() resp = self.service.get(self.base+'space/') return self.service.decode(schema, resp)
[ "def", "space", "(", "self", ")", ":", "schema", "=", "SpaceSchema", "(", ")", "resp", "=", "self", ".", "service", ".", "get", "(", "self", ".", "base", "+", "'space/'", ")", "return", "self", ".", "service", ".", "decode", "(", "schema", ",", "re...
Get system disk space usage. :return: :class:`system.Space <system.Space>` object :rtype: system.Space
[ "Get", "system", "disk", "space", "usage", "." ]
aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/system.py#L425-L433
train
qacafe/cdrouter.py
cdrouter/system.py
SystemService.interfaces
def interfaces(self, addresses=False): """Get system interfaces. :param addresses: (optional) If bool `True`, include interface addresses. :return: :class:`system.Interface <system.Interface>` list """ schema = InterfaceSchema() resp = self.service.get(self.base+'interfa...
python
def interfaces(self, addresses=False): """Get system interfaces. :param addresses: (optional) If bool `True`, include interface addresses. :return: :class:`system.Interface <system.Interface>` list """ schema = InterfaceSchema() resp = self.service.get(self.base+'interfa...
[ "def", "interfaces", "(", "self", ",", "addresses", "=", "False", ")", ":", "schema", "=", "InterfaceSchema", "(", ")", "resp", "=", "self", ".", "service", ".", "get", "(", "self", ".", "base", "+", "'interfaces/'", ",", "params", "=", "{", "'addresse...
Get system interfaces. :param addresses: (optional) If bool `True`, include interface addresses. :return: :class:`system.Interface <system.Interface>` list
[ "Get", "system", "interfaces", "." ]
aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/system.py#L442-L450
train
makinacorpus/django-tracking-fields
tracking_fields/tracking.py
_set_original_fields
def _set_original_fields(instance): """ Save fields value, only for non-m2m fields. """ original_fields = {} def _set_original_field(instance, field): if instance.pk is None: original_fields[field] = None else: if isinstance(instance._meta.get_field(field), F...
python
def _set_original_fields(instance): """ Save fields value, only for non-m2m fields. """ original_fields = {} def _set_original_field(instance, field): if instance.pk is None: original_fields[field] = None else: if isinstance(instance._meta.get_field(field), F...
[ "def", "_set_original_fields", "(", "instance", ")", ":", "original_fields", "=", "{", "}", "def", "_set_original_field", "(", "instance", ",", "field", ")", ":", "if", "instance", ".", "pk", "is", "None", ":", "original_fields", "[", "field", "]", "=", "N...
Save fields value, only for non-m2m fields.
[ "Save", "fields", "value", "only", "for", "non", "-", "m2m", "fields", "." ]
463313d0f9c0f8107a0413f4d418d1a8c2311981
https://github.com/makinacorpus/django-tracking-fields/blob/463313d0f9c0f8107a0413f4d418d1a8c2311981/tracking_fields/tracking.py#L29-L54
train
makinacorpus/django-tracking-fields
tracking_fields/tracking.py
_has_changed
def _has_changed(instance): """ Check if some tracked fields have changed """ for field, value in instance._original_fields.items(): if field != 'pk' and \ not isinstance(instance._meta.get_field(field), ManyToManyField): try: if field in getattr(instance, ...
python
def _has_changed(instance): """ Check if some tracked fields have changed """ for field, value in instance._original_fields.items(): if field != 'pk' and \ not isinstance(instance._meta.get_field(field), ManyToManyField): try: if field in getattr(instance, ...
[ "def", "_has_changed", "(", "instance", ")", ":", "for", "field", ",", "value", "in", "instance", ".", "_original_fields", ".", "items", "(", ")", ":", "if", "field", "!=", "'pk'", "and", "not", "isinstance", "(", "instance", ".", "_meta", ".", "get_fiel...
Check if some tracked fields have changed
[ "Check", "if", "some", "tracked", "fields", "have", "changed" ]
463313d0f9c0f8107a0413f4d418d1a8c2311981
https://github.com/makinacorpus/django-tracking-fields/blob/463313d0f9c0f8107a0413f4d418d1a8c2311981/tracking_fields/tracking.py#L57-L75
train
makinacorpus/django-tracking-fields
tracking_fields/tracking.py
_has_changed_related
def _has_changed_related(instance): """ Check if some related tracked fields have changed """ tracked_related_fields = getattr( instance, '_tracked_related_fields', {} ).keys() for field, value in instance._original_fields.items(): if field != 'pk' and \ ...
python
def _has_changed_related(instance): """ Check if some related tracked fields have changed """ tracked_related_fields = getattr( instance, '_tracked_related_fields', {} ).keys() for field, value in instance._original_fields.items(): if field != 'pk' and \ ...
[ "def", "_has_changed_related", "(", "instance", ")", ":", "tracked_related_fields", "=", "getattr", "(", "instance", ",", "'_tracked_related_fields'", ",", "{", "}", ")", ".", "keys", "(", ")", "for", "field", ",", "value", "in", "instance", ".", "_original_fi...
Check if some related tracked fields have changed
[ "Check", "if", "some", "related", "tracked", "fields", "have", "changed" ]
463313d0f9c0f8107a0413f4d418d1a8c2311981
https://github.com/makinacorpus/django-tracking-fields/blob/463313d0f9c0f8107a0413f4d418d1a8c2311981/tracking_fields/tracking.py#L78-L97
train
makinacorpus/django-tracking-fields
tracking_fields/tracking.py
_create_event
def _create_event(instance, action): """ Create a new event, getting the use if django-cuser is available. """ user = None user_repr = repr(user) if CUSER: user = CuserMiddleware.get_user() user_repr = repr(user) if user is not None and user.is_anonymous: user...
python
def _create_event(instance, action): """ Create a new event, getting the use if django-cuser is available. """ user = None user_repr = repr(user) if CUSER: user = CuserMiddleware.get_user() user_repr = repr(user) if user is not None and user.is_anonymous: user...
[ "def", "_create_event", "(", "instance", ",", "action", ")", ":", "user", "=", "None", "user_repr", "=", "repr", "(", "user", ")", "if", "CUSER", ":", "user", "=", "CuserMiddleware", ".", "get_user", "(", ")", "user_repr", "=", "repr", "(", "user", ")"...
Create a new event, getting the use if django-cuser is available.
[ "Create", "a", "new", "event", "getting", "the", "use", "if", "django", "-", "cuser", "is", "available", "." ]
463313d0f9c0f8107a0413f4d418d1a8c2311981
https://github.com/makinacorpus/django-tracking-fields/blob/463313d0f9c0f8107a0413f4d418d1a8c2311981/tracking_fields/tracking.py#L100-L117
train
makinacorpus/django-tracking-fields
tracking_fields/tracking.py
_create_tracked_field
def _create_tracked_field(event, instance, field, fieldname=None): """ Create a TrackedFieldModification for the instance. :param event: The TrackingEvent on which to add TrackingField :param instance: The instance on which the field is :param field: The field name to track :param fieldname: Th...
python
def _create_tracked_field(event, instance, field, fieldname=None): """ Create a TrackedFieldModification for the instance. :param event: The TrackingEvent on which to add TrackingField :param instance: The instance on which the field is :param field: The field name to track :param fieldname: Th...
[ "def", "_create_tracked_field", "(", "event", ",", "instance", ",", "field", ",", "fieldname", "=", "None", ")", ":", "fieldname", "=", "fieldname", "or", "field", "if", "isinstance", "(", "instance", ".", "_meta", ".", "get_field", "(", "field", ")", ",",...
Create a TrackedFieldModification for the instance. :param event: The TrackingEvent on which to add TrackingField :param instance: The instance on which the field is :param field: The field name to track :param fieldname: The displayed name for the field. Default to field.
[ "Create", "a", "TrackedFieldModification", "for", "the", "instance", "." ]
463313d0f9c0f8107a0413f4d418d1a8c2311981
https://github.com/makinacorpus/django-tracking-fields/blob/463313d0f9c0f8107a0413f4d418d1a8c2311981/tracking_fields/tracking.py#L145-L170
train
makinacorpus/django-tracking-fields
tracking_fields/tracking.py
_create_create_tracking_event
def _create_create_tracking_event(instance): """ Create a TrackingEvent and TrackedFieldModification for a CREATE event. """ event = _create_event(instance, CREATE) for field in instance._tracked_fields: if not isinstance(instance._meta.get_field(field), ManyToManyField): _create...
python
def _create_create_tracking_event(instance): """ Create a TrackingEvent and TrackedFieldModification for a CREATE event. """ event = _create_event(instance, CREATE) for field in instance._tracked_fields: if not isinstance(instance._meta.get_field(field), ManyToManyField): _create...
[ "def", "_create_create_tracking_event", "(", "instance", ")", ":", "event", "=", "_create_event", "(", "instance", ",", "CREATE", ")", "for", "field", "in", "instance", ".", "_tracked_fields", ":", "if", "not", "isinstance", "(", "instance", ".", "_meta", ".",...
Create a TrackingEvent and TrackedFieldModification for a CREATE event.
[ "Create", "a", "TrackingEvent", "and", "TrackedFieldModification", "for", "a", "CREATE", "event", "." ]
463313d0f9c0f8107a0413f4d418d1a8c2311981
https://github.com/makinacorpus/django-tracking-fields/blob/463313d0f9c0f8107a0413f4d418d1a8c2311981/tracking_fields/tracking.py#L173-L180
train
makinacorpus/django-tracking-fields
tracking_fields/tracking.py
_create_update_tracking_event
def _create_update_tracking_event(instance): """ Create a TrackingEvent and TrackedFieldModification for an UPDATE event. """ event = _create_event(instance, UPDATE) for field in instance._tracked_fields: if not isinstance(instance._meta.get_field(field), ManyToManyField): try: ...
python
def _create_update_tracking_event(instance): """ Create a TrackingEvent and TrackedFieldModification for an UPDATE event. """ event = _create_event(instance, UPDATE) for field in instance._tracked_fields: if not isinstance(instance._meta.get_field(field), ManyToManyField): try: ...
[ "def", "_create_update_tracking_event", "(", "instance", ")", ":", "event", "=", "_create_event", "(", "instance", ",", "UPDATE", ")", "for", "field", "in", "instance", ".", "_tracked_fields", ":", "if", "not", "isinstance", "(", "instance", ".", "_meta", ".",...
Create a TrackingEvent and TrackedFieldModification for an UPDATE event.
[ "Create", "a", "TrackingEvent", "and", "TrackedFieldModification", "for", "an", "UPDATE", "event", "." ]
463313d0f9c0f8107a0413f4d418d1a8c2311981
https://github.com/makinacorpus/django-tracking-fields/blob/463313d0f9c0f8107a0413f4d418d1a8c2311981/tracking_fields/tracking.py#L183-L200
train
makinacorpus/django-tracking-fields
tracking_fields/tracking.py
_create_update_tracking_related_event
def _create_update_tracking_related_event(instance): """ Create a TrackingEvent and TrackedFieldModification for an UPDATE event for each related model. """ events = {} # Create a dict mapping related model field to modified fields for field, related_fields in instance._tracked_related_field...
python
def _create_update_tracking_related_event(instance): """ Create a TrackingEvent and TrackedFieldModification for an UPDATE event for each related model. """ events = {} # Create a dict mapping related model field to modified fields for field, related_fields in instance._tracked_related_field...
[ "def", "_create_update_tracking_related_event", "(", "instance", ")", ":", "events", "=", "{", "}", "for", "field", ",", "related_fields", "in", "instance", ".", "_tracked_related_fields", ".", "items", "(", ")", ":", "if", "not", "isinstance", "(", "instance", ...
Create a TrackingEvent and TrackedFieldModification for an UPDATE event for each related model.
[ "Create", "a", "TrackingEvent", "and", "TrackedFieldModification", "for", "an", "UPDATE", "event", "for", "each", "related", "model", "." ]
463313d0f9c0f8107a0413f4d418d1a8c2311981
https://github.com/makinacorpus/django-tracking-fields/blob/463313d0f9c0f8107a0413f4d418d1a8c2311981/tracking_fields/tracking.py#L203-L239
train
makinacorpus/django-tracking-fields
tracking_fields/tracking.py
_get_m2m_field
def _get_m2m_field(model, sender): """ Get the field name from a model and a sender from m2m_changed signal. """ for field in getattr(model, '_tracked_fields', []): if isinstance(model._meta.get_field(field), ManyToManyField): if getattr(model, field).through == sender: ...
python
def _get_m2m_field(model, sender): """ Get the field name from a model and a sender from m2m_changed signal. """ for field in getattr(model, '_tracked_fields', []): if isinstance(model._meta.get_field(field), ManyToManyField): if getattr(model, field).through == sender: ...
[ "def", "_get_m2m_field", "(", "model", ",", "sender", ")", ":", "for", "field", "in", "getattr", "(", "model", ",", "'_tracked_fields'", ",", "[", "]", ")", ":", "if", "isinstance", "(", "model", ".", "_meta", ".", "get_field", "(", "field", ")", ",", ...
Get the field name from a model and a sender from m2m_changed signal.
[ "Get", "the", "field", "name", "from", "a", "model", "and", "a", "sender", "from", "m2m_changed", "signal", "." ]
463313d0f9c0f8107a0413f4d418d1a8c2311981
https://github.com/makinacorpus/django-tracking-fields/blob/463313d0f9c0f8107a0413f4d418d1a8c2311981/tracking_fields/tracking.py#L249-L260
train
makinacorpus/django-tracking-fields
tracking_fields/tracking.py
tracking_save
def tracking_save(sender, instance, raw, using, update_fields, **kwargs): """ Post save, detect creation or changes and log them. We need post_save to have the object for a create. """ if _has_changed(instance): if instance._original_fields['pk'] is None: # Create _cr...
python
def tracking_save(sender, instance, raw, using, update_fields, **kwargs): """ Post save, detect creation or changes and log them. We need post_save to have the object for a create. """ if _has_changed(instance): if instance._original_fields['pk'] is None: # Create _cr...
[ "def", "tracking_save", "(", "sender", ",", "instance", ",", "raw", ",", "using", ",", "update_fields", ",", "**", "kwargs", ")", ":", "if", "_has_changed", "(", "instance", ")", ":", "if", "instance", ".", "_original_fields", "[", "'pk'", "]", "is", "No...
Post save, detect creation or changes and log them. We need post_save to have the object for a create.
[ "Post", "save", "detect", "creation", "or", "changes", "and", "log", "them", ".", "We", "need", "post_save", "to", "have", "the", "object", "for", "a", "create", "." ]
463313d0f9c0f8107a0413f4d418d1a8c2311981
https://github.com/makinacorpus/django-tracking-fields/blob/463313d0f9c0f8107a0413f4d418d1a8c2311981/tracking_fields/tracking.py#L332-L349
train
andresriancho/w3af-api-client
w3af_api_client/log.py
LogEntry.from_entry_dict
def from_entry_dict(cls, entry_dict): """ This is a "constructor" for the LogEntry class. :param entry_dict: A dict we get from the REST API :return: An instance of LogEntry. """ # Debug helper # https://circleci.com/gh/andresriancho/w3af-api-docker/30 tr...
python
def from_entry_dict(cls, entry_dict): """ This is a "constructor" for the LogEntry class. :param entry_dict: A dict we get from the REST API :return: An instance of LogEntry. """ # Debug helper # https://circleci.com/gh/andresriancho/w3af-api-docker/30 tr...
[ "def", "from_entry_dict", "(", "cls", ",", "entry_dict", ")", ":", "try", ":", "_type", "=", "entry_dict", "[", "'type'", "]", "_id", "=", "entry_dict", "[", "'id'", "]", "_time", "=", "entry_dict", "[", "'time'", "]", "message", "=", "entry_dict", "[", ...
This is a "constructor" for the LogEntry class. :param entry_dict: A dict we get from the REST API :return: An instance of LogEntry.
[ "This", "is", "a", "constructor", "for", "the", "LogEntry", "class", "." ]
adeb79bad75264d754de69f0bb981b366da96f32
https://github.com/andresriancho/w3af-api-client/blob/adeb79bad75264d754de69f0bb981b366da96f32/w3af_api_client/log.py#L22-L42
train
qacafe/cdrouter.py
cdrouter/captures.py
CapturesService.list
def list(self, id, seq): # pylint: disable=invalid-name,redefined-builtin """Get a list of captures. :param id: Result ID as an int. :param seq: TestResult sequence ID as an int. :return: :class:`captures.Capture <captures.Capture>` list """ schema = CaptureSchema(exclud...
python
def list(self, id, seq): # pylint: disable=invalid-name,redefined-builtin """Get a list of captures. :param id: Result ID as an int. :param seq: TestResult sequence ID as an int. :return: :class:`captures.Capture <captures.Capture>` list """ schema = CaptureSchema(exclud...
[ "def", "list", "(", "self", ",", "id", ",", "seq", ")", ":", "schema", "=", "CaptureSchema", "(", "exclude", "=", "(", "'id'", ",", "'seq'", ")", ")", "resp", "=", "self", ".", "service", ".", "list", "(", "self", ".", "_base", "(", "id", ",", ...
Get a list of captures. :param id: Result ID as an int. :param seq: TestResult sequence ID as an int. :return: :class:`captures.Capture <captures.Capture>` list
[ "Get", "a", "list", "of", "captures", "." ]
aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/captures.py#L308-L317
train
qacafe/cdrouter.py
cdrouter/captures.py
CapturesService.get
def get(self, id, seq, intf): # pylint: disable=invalid-name,redefined-builtin """Get a capture. :param id: Result ID as an int. :param seq: TestResult sequence ID as an int. :param intf: Interface name as string. :return: :class:`captures.Capture <captures.Capture>` object ...
python
def get(self, id, seq, intf): # pylint: disable=invalid-name,redefined-builtin """Get a capture. :param id: Result ID as an int. :param seq: TestResult sequence ID as an int. :param intf: Interface name as string. :return: :class:`captures.Capture <captures.Capture>` object ...
[ "def", "get", "(", "self", ",", "id", ",", "seq", ",", "intf", ")", ":", "schema", "=", "CaptureSchema", "(", ")", "resp", "=", "self", ".", "service", ".", "get_id", "(", "self", ".", "_base", "(", "id", ",", "seq", ")", ",", "intf", ")", "ret...
Get a capture. :param id: Result ID as an int. :param seq: TestResult sequence ID as an int. :param intf: Interface name as string. :return: :class:`captures.Capture <captures.Capture>` object :rtype: captures.Capture
[ "Get", "a", "capture", "." ]
aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/captures.py#L319-L330
train
qacafe/cdrouter.py
cdrouter/captures.py
CapturesService.download
def download(self, id, seq, intf, inline=False): # pylint: disable=invalid-name,redefined-builtin """Download a capture as a PCAP file. :param id: Result ID as an int. :param seq: TestResult sequence ID as an int. :param intf: Interface name as string. :param inline: (optional) ...
python
def download(self, id, seq, intf, inline=False): # pylint: disable=invalid-name,redefined-builtin """Download a capture as a PCAP file. :param id: Result ID as an int. :param seq: TestResult sequence ID as an int. :param intf: Interface name as string. :param inline: (optional) ...
[ "def", "download", "(", "self", ",", "id", ",", "seq", ",", "intf", ",", "inline", "=", "False", ")", ":", "resp", "=", "self", ".", "service", ".", "get_id", "(", "self", ".", "_base", "(", "id", ",", "seq", ")", ",", "intf", ",", "params", "=...
Download a capture as a PCAP file. :param id: Result ID as an int. :param seq: TestResult sequence ID as an int. :param intf: Interface name as string. :param inline: (optional) Use inline version of capture file. :rtype: tuple `(io.BytesIO, 'filename')`
[ "Download", "a", "capture", "as", "a", "PCAP", "file", "." ]
aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/captures.py#L332-L346
train
qacafe/cdrouter.py
cdrouter/captures.py
CapturesService.summary
def summary(self, id, seq, intf, filter=None, inline=False): # pylint: disable=invalid-name,redefined-builtin """Get a capture's summary. :param id: Result ID as an int. :param seq: TestResult sequence ID as an int. :param intf: Interface name as string. :param filter: (optional...
python
def summary(self, id, seq, intf, filter=None, inline=False): # pylint: disable=invalid-name,redefined-builtin """Get a capture's summary. :param id: Result ID as an int. :param seq: TestResult sequence ID as an int. :param intf: Interface name as string. :param filter: (optional...
[ "def", "summary", "(", "self", ",", "id", ",", "seq", ",", "intf", ",", "filter", "=", "None", ",", "inline", "=", "False", ")", ":", "schema", "=", "SummarySchema", "(", ")", "resp", "=", "self", ".", "service", ".", "get", "(", "self", ".", "_b...
Get a capture's summary. :param id: Result ID as an int. :param seq: TestResult sequence ID as an int. :param intf: Interface name as string. :param filter: (optional) PCAP filter to apply as string. :param inline: (optional) Use inline version of capture file. :return: ...
[ "Get", "a", "capture", "s", "summary", "." ]
aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/captures.py#L348-L362
train
qacafe/cdrouter.py
cdrouter/captures.py
CapturesService.decode
def decode(self, id, seq, intf, filter=None, frame=None, inline=False): # pylint: disable=invalid-name,redefined-builtin """Get a capture's decode. :param id: Result ID as an int. :param seq: TestResult sequence ID as an int. :param intf: Interface name as string. :param filter:...
python
def decode(self, id, seq, intf, filter=None, frame=None, inline=False): # pylint: disable=invalid-name,redefined-builtin """Get a capture's decode. :param id: Result ID as an int. :param seq: TestResult sequence ID as an int. :param intf: Interface name as string. :param filter:...
[ "def", "decode", "(", "self", ",", "id", ",", "seq", ",", "intf", ",", "filter", "=", "None", ",", "frame", "=", "None", ",", "inline", "=", "False", ")", ":", "schema", "=", "DecodeSchema", "(", ")", "resp", "=", "self", ".", "service", ".", "ge...
Get a capture's decode. :param id: Result ID as an int. :param seq: TestResult sequence ID as an int. :param intf: Interface name as string. :param filter: (optional) PCAP filter to apply as string. :param frame: (optional) Frame number to decode. :param inline: (optiona...
[ "Get", "a", "capture", "s", "decode", "." ]
aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/captures.py#L364-L379
train
qacafe/cdrouter.py
cdrouter/captures.py
CapturesService.send_to_cloudshark
def send_to_cloudshark(self, id, seq, intf, inline=False): # pylint: disable=invalid-name,redefined-builtin """Send a capture to a CloudShark Appliance. Both cloudshark_appliance_url and cloudshark_appliance_token must be properly configured via system preferences. :param id: Result ID ...
python
def send_to_cloudshark(self, id, seq, intf, inline=False): # pylint: disable=invalid-name,redefined-builtin """Send a capture to a CloudShark Appliance. Both cloudshark_appliance_url and cloudshark_appliance_token must be properly configured via system preferences. :param id: Result ID ...
[ "def", "send_to_cloudshark", "(", "self", ",", "id", ",", "seq", ",", "intf", ",", "inline", "=", "False", ")", ":", "schema", "=", "CloudSharkSchema", "(", ")", "resp", "=", "self", ".", "service", ".", "post", "(", "self", ".", "_base", "(", "id", ...
Send a capture to a CloudShark Appliance. Both cloudshark_appliance_url and cloudshark_appliance_token must be properly configured via system preferences. :param id: Result ID as an int. :param seq: TestResult sequence ID as an int. :param intf: Interface name as string. ...
[ "Send", "a", "capture", "to", "a", "CloudShark", "Appliance", ".", "Both", "cloudshark_appliance_url", "and", "cloudshark_appliance_token", "must", "be", "properly", "configured", "via", "system", "preferences", "." ]
aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/captures.py#L398-L412
train
inveniosoftware/invenio-oauthclient
invenio_oauthclient/contrib/globus.py
get_dict_from_response
def get_dict_from_response(response): """Check for errors in the response and return the resulting JSON.""" if getattr(response, '_resp') and response._resp.code > 400: raise OAuthResponseError( 'Application mis-configuration in Globus', None, response ) return response....
python
def get_dict_from_response(response): """Check for errors in the response and return the resulting JSON.""" if getattr(response, '_resp') and response._resp.code > 400: raise OAuthResponseError( 'Application mis-configuration in Globus', None, response ) return response....
[ "def", "get_dict_from_response", "(", "response", ")", ":", "if", "getattr", "(", "response", ",", "'_resp'", ")", "and", "response", ".", "_resp", ".", "code", ">", "400", ":", "raise", "OAuthResponseError", "(", "'Application mis-configuration in Globus'", ",", ...
Check for errors in the response and return the resulting JSON.
[ "Check", "for", "errors", "in", "the", "response", "and", "return", "the", "resulting", "JSON", "." ]
2500dc6935738107617aeade79e050d7608004bb
https://github.com/inveniosoftware/invenio-oauthclient/blob/2500dc6935738107617aeade79e050d7608004bb/invenio_oauthclient/contrib/globus.py#L88-L95
train
inveniosoftware/invenio-oauthclient
invenio_oauthclient/contrib/globus.py
get_user_info
def get_user_info(remote): """Get user information from Globus. See the docs here for v2/oauth/userinfo: https://docs.globus.org/api/auth/reference/ """ response = remote.get(GLOBUS_USER_INFO_URL) user_info = get_dict_from_response(response) response.data['username'] = response.data['prefer...
python
def get_user_info(remote): """Get user information from Globus. See the docs here for v2/oauth/userinfo: https://docs.globus.org/api/auth/reference/ """ response = remote.get(GLOBUS_USER_INFO_URL) user_info = get_dict_from_response(response) response.data['username'] = response.data['prefer...
[ "def", "get_user_info", "(", "remote", ")", ":", "response", "=", "remote", ".", "get", "(", "GLOBUS_USER_INFO_URL", ")", "user_info", "=", "get_dict_from_response", "(", "response", ")", "response", ".", "data", "[", "'username'", "]", "=", "response", ".", ...
Get user information from Globus. See the docs here for v2/oauth/userinfo: https://docs.globus.org/api/auth/reference/
[ "Get", "user", "information", "from", "Globus", "." ]
2500dc6935738107617aeade79e050d7608004bb
https://github.com/inveniosoftware/invenio-oauthclient/blob/2500dc6935738107617aeade79e050d7608004bb/invenio_oauthclient/contrib/globus.py#L98-L109
train
inveniosoftware/invenio-oauthclient
invenio_oauthclient/contrib/globus.py
get_user_id
def get_user_id(remote, email): """Get the Globus identity for a users given email. A Globus ID is a UUID that can uniquely identify a Globus user. See the docs here for v2/api/identities https://docs.globus.org/api/auth/reference/ """ try: url = '{}?usernames={}'.format(GLOBUS_USER_ID_...
python
def get_user_id(remote, email): """Get the Globus identity for a users given email. A Globus ID is a UUID that can uniquely identify a Globus user. See the docs here for v2/api/identities https://docs.globus.org/api/auth/reference/ """ try: url = '{}?usernames={}'.format(GLOBUS_USER_ID_...
[ "def", "get_user_id", "(", "remote", ",", "email", ")", ":", "try", ":", "url", "=", "'{}?usernames={}'", ".", "format", "(", "GLOBUS_USER_ID_URL", ",", "email", ")", "user_id", "=", "get_dict_from_response", "(", "remote", ".", "get", "(", "url", ")", ")"...
Get the Globus identity for a users given email. A Globus ID is a UUID that can uniquely identify a Globus user. See the docs here for v2/api/identities https://docs.globus.org/api/auth/reference/
[ "Get", "the", "Globus", "identity", "for", "a", "users", "given", "email", "." ]
2500dc6935738107617aeade79e050d7608004bb
https://github.com/inveniosoftware/invenio-oauthclient/blob/2500dc6935738107617aeade79e050d7608004bb/invenio_oauthclient/contrib/globus.py#L112-L127
train
SylvanasSun/python-common-cache
common_cache/utils.py
get_function_signature
def get_function_signature(func): """ Return the signature string of the specified function. >>> def foo(name): pass >>> get_function_signature(foo) 'foo(name)' >>> something = 'Hello' >>> get_function_signature(something) Traceback (most recent call last): ... TypeError: Th...
python
def get_function_signature(func): """ Return the signature string of the specified function. >>> def foo(name): pass >>> get_function_signature(foo) 'foo(name)' >>> something = 'Hello' >>> get_function_signature(something) Traceback (most recent call last): ... TypeError: Th...
[ "def", "get_function_signature", "(", "func", ")", ":", "if", "func", "is", "None", ":", "return", "'Function is None'", "try", ":", "func_name", "=", "func", ".", "__name__", "except", "AttributeError", ":", "func_name", "=", "'None'", "if", "not", "inspect",...
Return the signature string of the specified function. >>> def foo(name): pass >>> get_function_signature(foo) 'foo(name)' >>> something = 'Hello' >>> get_function_signature(something) Traceback (most recent call last): ... TypeError: The argument must be a function object: None typ...
[ "Return", "the", "signature", "string", "of", "the", "specified", "function", "." ]
f113eb3cd751eed5ab5373e8610a31a444220cf8
https://github.com/SylvanasSun/python-common-cache/blob/f113eb3cd751eed5ab5373e8610a31a444220cf8/common_cache/utils.py#L10-L34
train
SylvanasSun/python-common-cache
common_cache/utils.py
RWLock.acquire_reader
def acquire_reader(self): """ Acquire a read lock, several threads can hold this type of lock. """ with self.mutex: while self.rwlock < 0 or self.rwlock == self.max_reader_concurrency or self.writers_waiting: self.readers_ok.wait() self.rwlock += 1
python
def acquire_reader(self): """ Acquire a read lock, several threads can hold this type of lock. """ with self.mutex: while self.rwlock < 0 or self.rwlock == self.max_reader_concurrency or self.writers_waiting: self.readers_ok.wait() self.rwlock += 1
[ "def", "acquire_reader", "(", "self", ")", ":", "with", "self", ".", "mutex", ":", "while", "self", ".", "rwlock", "<", "0", "or", "self", ".", "rwlock", "==", "self", ".", "max_reader_concurrency", "or", "self", ".", "writers_waiting", ":", "self", ".",...
Acquire a read lock, several threads can hold this type of lock.
[ "Acquire", "a", "read", "lock", "several", "threads", "can", "hold", "this", "type", "of", "lock", "." ]
f113eb3cd751eed5ab5373e8610a31a444220cf8
https://github.com/SylvanasSun/python-common-cache/blob/f113eb3cd751eed5ab5373e8610a31a444220cf8/common_cache/utils.py#L73-L80
train
SylvanasSun/python-common-cache
common_cache/utils.py
RWLock.acquire_writer
def acquire_writer(self): """ Acquire a write lock, only one thread can hold this lock and only when no read locks are also held. """ with self.mutex: while self.rwlock != 0: self._writer_wait() self.rwlock = -1
python
def acquire_writer(self): """ Acquire a write lock, only one thread can hold this lock and only when no read locks are also held. """ with self.mutex: while self.rwlock != 0: self._writer_wait() self.rwlock = -1
[ "def", "acquire_writer", "(", "self", ")", ":", "with", "self", ".", "mutex", ":", "while", "self", ".", "rwlock", "!=", "0", ":", "self", ".", "_writer_wait", "(", ")", "self", ".", "rwlock", "=", "-", "1" ]
Acquire a write lock, only one thread can hold this lock and only when no read locks are also held.
[ "Acquire", "a", "write", "lock", "only", "one", "thread", "can", "hold", "this", "lock", "and", "only", "when", "no", "read", "locks", "are", "also", "held", "." ]
f113eb3cd751eed5ab5373e8610a31a444220cf8
https://github.com/SylvanasSun/python-common-cache/blob/f113eb3cd751eed5ab5373e8610a31a444220cf8/common_cache/utils.py#L82-L90
train
qacafe/cdrouter.py
cdrouter/packages.py
PackagesService.list
def list(self, filter=None, type=None, sort=None, limit=None, page=None): # pylint: disable=redefined-builtin """Get a list of packages. :param filter: (optional) Filters to apply as a string list. :param type: (optional) `union` or `inter` as string. :param sort: (optional) Sort fields...
python
def list(self, filter=None, type=None, sort=None, limit=None, page=None): # pylint: disable=redefined-builtin """Get a list of packages. :param filter: (optional) Filters to apply as a string list. :param type: (optional) `union` or `inter` as string. :param sort: (optional) Sort fields...
[ "def", "list", "(", "self", ",", "filter", "=", "None", ",", "type", "=", "None", ",", "sort", "=", "None", ",", "limit", "=", "None", ",", "page", "=", "None", ")", ":", "schema", "=", "PackageSchema", "(", "exclude", "=", "(", "'testlist'", ",", ...
Get a list of packages. :param filter: (optional) Filters to apply as a string list. :param type: (optional) `union` or `inter` as string. :param sort: (optional) Sort fields to apply as string list. :param limit: (optional) Limit returned list length. :param page: (optional) Pa...
[ "Get", "a", "list", "of", "packages", "." ]
aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/packages.py#L190-L203
train
qacafe/cdrouter.py
cdrouter/packages.py
PackagesService.get
def get(self, id): # pylint: disable=invalid-name,redefined-builtin """Get a package. :param id: Package ID as an int. :return: :class:`packages.Package <packages.Package>` object :rtype: packages.Package """ schema = PackageSchema() resp = self.service.get_id(se...
python
def get(self, id): # pylint: disable=invalid-name,redefined-builtin """Get a package. :param id: Package ID as an int. :return: :class:`packages.Package <packages.Package>` object :rtype: packages.Package """ schema = PackageSchema() resp = self.service.get_id(se...
[ "def", "get", "(", "self", ",", "id", ")", ":", "schema", "=", "PackageSchema", "(", ")", "resp", "=", "self", ".", "service", ".", "get_id", "(", "self", ".", "base", ",", "id", ")", "return", "self", ".", "service", ".", "decode", "(", "schema", ...
Get a package. :param id: Package ID as an int. :return: :class:`packages.Package <packages.Package>` object :rtype: packages.Package
[ "Get", "a", "package", "." ]
aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/packages.py#L218-L227
train
qacafe/cdrouter.py
cdrouter/packages.py
PackagesService.create
def create(self, resource): """Create a new package. :param resource: :class:`packages.Package <packages.Package>` object :return: :class:`packages.Package <packages.Package>` object :rtype: packages.Package """ schema = PackageSchema(exclude=('id', 'created', 'updated',...
python
def create(self, resource): """Create a new package. :param resource: :class:`packages.Package <packages.Package>` object :return: :class:`packages.Package <packages.Package>` object :rtype: packages.Package """ schema = PackageSchema(exclude=('id', 'created', 'updated',...
[ "def", "create", "(", "self", ",", "resource", ")", ":", "schema", "=", "PackageSchema", "(", "exclude", "=", "(", "'id'", ",", "'created'", ",", "'updated'", ",", "'test_count'", ",", "'agent_id'", ",", "'result_id'", ")", ")", "json", "=", "self", ".",...
Create a new package. :param resource: :class:`packages.Package <packages.Package>` object :return: :class:`packages.Package <packages.Package>` object :rtype: packages.Package
[ "Create", "a", "new", "package", "." ]
aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/packages.py#L241-L253
train
qacafe/cdrouter.py
cdrouter/packages.py
PackagesService.analyze
def analyze(self, id): # pylint: disable=invalid-name,redefined-builtin """Get a list of tests that will be skipped for a package. :param id: Package ID as an int. :return: :class:`packages.Analysis <packages.Analysis>` object :rtype: packages.Analysis """ schema = Analy...
python
def analyze(self, id): # pylint: disable=invalid-name,redefined-builtin """Get a list of tests that will be skipped for a package. :param id: Package ID as an int. :return: :class:`packages.Analysis <packages.Analysis>` object :rtype: packages.Analysis """ schema = Analy...
[ "def", "analyze", "(", "self", ",", "id", ")", ":", "schema", "=", "AnalysisSchema", "(", ")", "resp", "=", "self", ".", "service", ".", "post", "(", "self", ".", "base", "+", "str", "(", "id", ")", "+", "'/'", ",", "params", "=", "{", "'process'...
Get a list of tests that will be skipped for a package. :param id: Package ID as an int. :return: :class:`packages.Analysis <packages.Analysis>` object :rtype: packages.Analysis
[ "Get", "a", "list", "of", "tests", "that", "will", "be", "skipped", "for", "a", "package", "." ]
aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/packages.py#L301-L310
train
qacafe/cdrouter.py
cdrouter/packages.py
PackagesService.bulk_copy
def bulk_copy(self, ids): """Bulk copy a set of packages. :param ids: Int list of package IDs. :return: :class:`packages.Package <packages.Package>` list """ schema = PackageSchema() return self.service.bulk_copy(self.base, self.RESOURCE, ids, schema)
python
def bulk_copy(self, ids): """Bulk copy a set of packages. :param ids: Int list of package IDs. :return: :class:`packages.Package <packages.Package>` list """ schema = PackageSchema() return self.service.bulk_copy(self.base, self.RESOURCE, ids, schema)
[ "def", "bulk_copy", "(", "self", ",", "ids", ")", ":", "schema", "=", "PackageSchema", "(", ")", "return", "self", ".", "service", ".", "bulk_copy", "(", "self", ".", "base", ",", "self", ".", "RESOURCE", ",", "ids", ",", "schema", ")" ]
Bulk copy a set of packages. :param ids: Int list of package IDs. :return: :class:`packages.Package <packages.Package>` list
[ "Bulk", "copy", "a", "set", "of", "packages", "." ]
aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/packages.py#L320-L327
train
qacafe/cdrouter.py
cdrouter/packages.py
PackagesService.bulk_edit
def bulk_edit(self, _fields, ids=None, filter=None, type=None, all=False): # pylint: disable=redefined-builtin """Bulk edit a set of packages. :param _fields: :class:`packages.Package <packages.Package>` object :param ids: (optional) Int list of package IDs. :param filter: (optional) St...
python
def bulk_edit(self, _fields, ids=None, filter=None, type=None, all=False): # pylint: disable=redefined-builtin """Bulk edit a set of packages. :param _fields: :class:`packages.Package <packages.Package>` object :param ids: (optional) Int list of package IDs. :param filter: (optional) St...
[ "def", "bulk_edit", "(", "self", ",", "_fields", ",", "ids", "=", "None", ",", "filter", "=", "None", ",", "type", "=", "None", ",", "all", "=", "False", ")", ":", "schema", "=", "PackageSchema", "(", "exclude", "=", "(", "'id'", ",", "'created'", ...
Bulk edit a set of packages. :param _fields: :class:`packages.Package <packages.Package>` object :param ids: (optional) Int list of package IDs. :param filter: (optional) String list of filters. :param type: (optional) `union` or `inter` as string. :param all: (optional) Apply t...
[ "Bulk", "edit", "a", "set", "of", "packages", "." ]
aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/packages.py#L329-L341
train
NetworkAutomation/jaide
jaide/utils.py
clean_lines
def clean_lines(commands): """ Generate strings that are not comments or lines with only whitespace. Purpose: This function is a generator that will read in either a | plain text file of strings(IP list, command list, etc), a | comma separated string of strings, or a list of strings. It ...
python
def clean_lines(commands): """ Generate strings that are not comments or lines with only whitespace. Purpose: This function is a generator that will read in either a | plain text file of strings(IP list, command list, etc), a | comma separated string of strings, or a list of strings. It ...
[ "def", "clean_lines", "(", "commands", ")", ":", "if", "isinstance", "(", "commands", ",", "basestring", ")", ":", "if", "path", ".", "isfile", "(", "commands", ")", ":", "commands", "=", "open", "(", "commands", ",", "'rb'", ")", "elif", "len", "(", ...
Generate strings that are not comments or lines with only whitespace. Purpose: This function is a generator that will read in either a | plain text file of strings(IP list, command list, etc), a | comma separated string of strings, or a list of strings. It | will crop out any comme...
[ "Generate", "strings", "that", "are", "not", "comments", "or", "lines", "with", "only", "whitespace", "." ]
8571b987a8c24c246dc09f1bcc11cb0f045ec33f
https://github.com/NetworkAutomation/jaide/blob/8571b987a8c24c246dc09f1bcc11cb0f045ec33f/jaide/utils.py#L8-L54
train
NetworkAutomation/jaide
jaide/utils.py
xpath
def xpath(source_xml, xpath_expr, req_format='string'): """ Filter xml based on an xpath expression. Purpose: This function applies an Xpath expression to the XML | supplied by source_xml. Returns a string subtree or | subtrees that match the Xpath expression. It can also return ...
python
def xpath(source_xml, xpath_expr, req_format='string'): """ Filter xml based on an xpath expression. Purpose: This function applies an Xpath expression to the XML | supplied by source_xml. Returns a string subtree or | subtrees that match the Xpath expression. It can also return ...
[ "def", "xpath", "(", "source_xml", ",", "xpath_expr", ",", "req_format", "=", "'string'", ")", ":", "tree", "=", "source_xml", "if", "not", "isinstance", "(", "source_xml", ",", "ET", ".", "Element", ")", ":", "tree", "=", "objectify", ".", "fromstring", ...
Filter xml based on an xpath expression. Purpose: This function applies an Xpath expression to the XML | supplied by source_xml. Returns a string subtree or | subtrees that match the Xpath expression. It can also return | an xml object if desired. @param source_xml: Plain text...
[ "Filter", "xml", "based", "on", "an", "xpath", "expression", "." ]
8571b987a8c24c246dc09f1bcc11cb0f045ec33f
https://github.com/NetworkAutomation/jaide/blob/8571b987a8c24c246dc09f1bcc11cb0f045ec33f/jaide/utils.py#L57-L97
train
crossbario/txaio-etcd
txaioetcd/_client_tx.py
Client.set
def set(self, key, value, lease=None, return_previous=None, timeout=None): """ Set the value for the key in the key-value store. Setting a value on a key increments the revision of the key-value store and generates one event in the event history. :param key: key is the ...
python
def set(self, key, value, lease=None, return_previous=None, timeout=None): """ Set the value for the key in the key-value store. Setting a value on a key increments the revision of the key-value store and generates one event in the event history. :param key: key is the ...
[ "def", "set", "(", "self", ",", "key", ",", "value", ",", "lease", "=", "None", ",", "return_previous", "=", "None", ",", "timeout", "=", "None", ")", ":", "assembler", "=", "commons", ".", "PutRequestAssembler", "(", "self", ".", "_url", ",", "key", ...
Set the value for the key in the key-value store. Setting a value on a key increments the revision of the key-value store and generates one event in the event history. :param key: key is the key, in bytes, to put into the key-value store. :type key: bytes :...
[ "Set", "the", "value", "for", "the", "key", "in", "the", "key", "-", "value", "store", "." ]
c9aebff7f288a0b219bffc9d2579d22cf543baa5
https://github.com/crossbario/txaio-etcd/blob/c9aebff7f288a0b219bffc9d2579d22cf543baa5/txaioetcd/_client_tx.py#L256-L291
train
crossbario/txaio-etcd
txaioetcd/_client_tx.py
Client.watch
def watch(self, keys, on_watch, filters=None, start_revision=None, return_previous=None): """ Watch one or more keys or key sets and invoke a callback. Watch watches for events happening or that have happened. The entire event history can be watched starting from the last compaction rev...
python
def watch(self, keys, on_watch, filters=None, start_revision=None, return_previous=None): """ Watch one or more keys or key sets and invoke a callback. Watch watches for events happening or that have happened. The entire event history can be watched starting from the last compaction rev...
[ "def", "watch", "(", "self", ",", "keys", ",", "on_watch", ",", "filters", "=", "None", ",", "start_revision", "=", "None", ",", "return_previous", "=", "None", ")", ":", "d", "=", "self", ".", "_start_watching", "(", "keys", ",", "on_watch", ",", "fil...
Watch one or more keys or key sets and invoke a callback. Watch watches for events happening or that have happened. The entire event history can be watched starting from the last compaction revision. :param keys: Watch these keys / key sets. :type keys: list of bytes or list of instanc...
[ "Watch", "one", "or", "more", "keys", "or", "key", "sets", "and", "invoke", "a", "callback", "." ]
c9aebff7f288a0b219bffc9d2579d22cf543baa5
https://github.com/crossbario/txaio-etcd/blob/c9aebff7f288a0b219bffc9d2579d22cf543baa5/txaioetcd/_client_tx.py#L408-L446
train
crossbario/txaio-etcd
txaioetcd/_client_tx.py
Client.lease
def lease(self, time_to_live, lease_id=None, timeout=None): """ Creates a lease which expires if the server does not receive a keep alive within a given time to live period. All keys attached to the lease will be expired and deleted if the lease expires. Each expired ke...
python
def lease(self, time_to_live, lease_id=None, timeout=None): """ Creates a lease which expires if the server does not receive a keep alive within a given time to live period. All keys attached to the lease will be expired and deleted if the lease expires. Each expired ke...
[ "def", "lease", "(", "self", ",", "time_to_live", ",", "lease_id", "=", "None", ",", "timeout", "=", "None", ")", ":", "assembler", "=", "commons", ".", "LeaseRequestAssembler", "(", "self", ".", "_url", ",", "time_to_live", ",", "lease_id", ")", "obj", ...
Creates a lease which expires if the server does not receive a keep alive within a given time to live period. All keys attached to the lease will be expired and deleted if the lease expires. Each expired key generates a delete event in the event history. :param time_to_live: T...
[ "Creates", "a", "lease", "which", "expires", "if", "the", "server", "does", "not", "receive", "a", "keep", "alive", "within", "a", "given", "time", "to", "live", "period", "." ]
c9aebff7f288a0b219bffc9d2579d22cf543baa5
https://github.com/crossbario/txaio-etcd/blob/c9aebff7f288a0b219bffc9d2579d22cf543baa5/txaioetcd/_client_tx.py#L590-L620
train
qacafe/cdrouter.py
cdrouter/imports.py
ImportsService.stage_import_from_file
def stage_import_from_file(self, fd, filename='upload.gz'): """Stage an import from a file upload. :param fd: File-like object to upload. :param filename: (optional) Filename to use for import as string. :return: :class:`imports.Import <imports.Import>` object """ schema...
python
def stage_import_from_file(self, fd, filename='upload.gz'): """Stage an import from a file upload. :param fd: File-like object to upload. :param filename: (optional) Filename to use for import as string. :return: :class:`imports.Import <imports.Import>` object """ schema...
[ "def", "stage_import_from_file", "(", "self", ",", "fd", ",", "filename", "=", "'upload.gz'", ")", ":", "schema", "=", "ImportSchema", "(", ")", "resp", "=", "self", ".", "service", ".", "post", "(", "self", ".", "base", ",", "files", "=", "{", "'file'...
Stage an import from a file upload. :param fd: File-like object to upload. :param filename: (optional) Filename to use for import as string. :return: :class:`imports.Import <imports.Import>` object
[ "Stage", "an", "import", "from", "a", "file", "upload", "." ]
aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/imports.py#L153-L163
train
qacafe/cdrouter.py
cdrouter/imports.py
ImportsService.stage_import_from_filesystem
def stage_import_from_filesystem(self, filepath): """Stage an import from a filesystem path. :param filepath: Local filesystem path as string. :return: :class:`imports.Import <imports.Import>` object """ schema = ImportSchema() resp = self.service.post(self.base, ...
python
def stage_import_from_filesystem(self, filepath): """Stage an import from a filesystem path. :param filepath: Local filesystem path as string. :return: :class:`imports.Import <imports.Import>` object """ schema = ImportSchema() resp = self.service.post(self.base, ...
[ "def", "stage_import_from_filesystem", "(", "self", ",", "filepath", ")", ":", "schema", "=", "ImportSchema", "(", ")", "resp", "=", "self", ".", "service", ".", "post", "(", "self", ".", "base", ",", "params", "=", "{", "'path'", ":", "filepath", "}", ...
Stage an import from a filesystem path. :param filepath: Local filesystem path as string. :return: :class:`imports.Import <imports.Import>` object
[ "Stage", "an", "import", "from", "a", "filesystem", "path", "." ]
aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/imports.py#L165-L174
train
qacafe/cdrouter.py
cdrouter/imports.py
ImportsService.stage_import_from_url
def stage_import_from_url(self, url, token=None, username=None, password=None, insecure=False): """Stage an import from a URL to another CDRouter system. :param url: URL to import as string. :param token: (optional) API token to use as string (may be required if importing from a CDRouter 10+ sy...
python
def stage_import_from_url(self, url, token=None, username=None, password=None, insecure=False): """Stage an import from a URL to another CDRouter system. :param url: URL to import as string. :param token: (optional) API token to use as string (may be required if importing from a CDRouter 10+ sy...
[ "def", "stage_import_from_url", "(", "self", ",", "url", ",", "token", "=", "None", ",", "username", "=", "None", ",", "password", "=", "None", ",", "insecure", "=", "False", ")", ":", "schema", "=", "ImportSchema", "(", ")", "resp", "=", "self", ".", ...
Stage an import from a URL to another CDRouter system. :param url: URL to import as string. :param token: (optional) API token to use as string (may be required if importing from a CDRouter 10+ system). :param username: (optional) API username to use as string (may be required if importing from...
[ "Stage", "an", "import", "from", "a", "URL", "to", "another", "CDRouter", "system", "." ]
aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/imports.py#L176-L189
train
qacafe/cdrouter.py
cdrouter/imports.py
ImportsService.get_commit_request
def get_commit_request(self, id): # pylint: disable=invalid-name,redefined-builtin """Get a commit request for a staged import. :param id: Staged import ID as an int. :return: :class:`imports.Request <imports.Request>` object :rtype: imports.Request """ schema = RequestS...
python
def get_commit_request(self, id): # pylint: disable=invalid-name,redefined-builtin """Get a commit request for a staged import. :param id: Staged import ID as an int. :return: :class:`imports.Request <imports.Request>` object :rtype: imports.Request """ schema = RequestS...
[ "def", "get_commit_request", "(", "self", ",", "id", ")", ":", "schema", "=", "RequestSchema", "(", ")", "resp", "=", "self", ".", "service", ".", "get", "(", "self", ".", "base", "+", "str", "(", "id", ")", "+", "'/request/'", ")", "return", "self",...
Get a commit request for a staged import. :param id: Staged import ID as an int. :return: :class:`imports.Request <imports.Request>` object :rtype: imports.Request
[ "Get", "a", "commit", "request", "for", "a", "staged", "import", "." ]
aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/imports.py#L202-L211
train
qacafe/cdrouter.py
cdrouter/imports.py
ImportsService.commit
def commit(self, id, impreq): # pylint: disable=invalid-name,redefined-builtin """Commit a staged import. :param id: Staged import ID as an int. :param impreq: :class:`imports.Request <imports.Request>` object :return: :class:`imports.Request <imports.Request>` object :rtype: im...
python
def commit(self, id, impreq): # pylint: disable=invalid-name,redefined-builtin """Commit a staged import. :param id: Staged import ID as an int. :param impreq: :class:`imports.Request <imports.Request>` object :return: :class:`imports.Request <imports.Request>` object :rtype: im...
[ "def", "commit", "(", "self", ",", "id", ",", "impreq", ")", ":", "schema", "=", "RequestSchema", "(", ")", "json", "=", "self", ".", "service", ".", "encode", "(", "schema", ",", "impreq", ")", "schema", "=", "RequestSchema", "(", ")", "resp", "=", ...
Commit a staged import. :param id: Staged import ID as an int. :param impreq: :class:`imports.Request <imports.Request>` object :return: :class:`imports.Request <imports.Request>` object :rtype: imports.Request
[ "Commit", "a", "staged", "import", "." ]
aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/imports.py#L213-L226
train