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
python-bugzilla/python-bugzilla
bugzilla/base.py
Bugzilla.logged_in
def logged_in(self): """ This is True if this instance is logged in else False. We test if this session is authenticated by calling the User.get() XMLRPC method with ids set. Logged-out users cannot pass the 'ids' parameter and will result in a 505 error. If we tried to login wi...
python
def logged_in(self): """ This is True if this instance is logged in else False. We test if this session is authenticated by calling the User.get() XMLRPC method with ids set. Logged-out users cannot pass the 'ids' parameter and will result in a 505 error. If we tried to login wi...
[ "def", "logged_in", "(", "self", ")", ":", "try", ":", "self", ".", "_proxy", ".", "User", ".", "get", "(", "{", "'ids'", ":", "[", "]", "}", ")", "return", "True", "except", "Fault", "as", "e", ":", "if", "e", ".", "faultCode", "==", "505", "o...
This is True if this instance is logged in else False. We test if this session is authenticated by calling the User.get() XMLRPC method with ids set. Logged-out users cannot pass the 'ids' parameter and will result in a 505 error. If we tried to login with a token, but the token was inc...
[ "This", "is", "True", "if", "this", "instance", "is", "logged", "in", "else", "False", "." ]
7de8b225104f24a1eee3e837bf1e02d60aefe69f
https://github.com/python-bugzilla/python-bugzilla/blob/7de8b225104f24a1eee3e837bf1e02d60aefe69f/bugzilla/base.py#L658-L682
train
python-bugzilla/python-bugzilla
bugzilla/base.py
Bugzilla._getbugfields
def _getbugfields(self): """ Get the list of valid fields for Bug objects """ r = self._proxy.Bug.fields({'include_fields': ['name']}) return [f['name'] for f in r['fields']]
python
def _getbugfields(self): """ Get the list of valid fields for Bug objects """ r = self._proxy.Bug.fields({'include_fields': ['name']}) return [f['name'] for f in r['fields']]
[ "def", "_getbugfields", "(", "self", ")", ":", "r", "=", "self", ".", "_proxy", ".", "Bug", ".", "fields", "(", "{", "'include_fields'", ":", "[", "'name'", "]", "}", ")", "return", "[", "f", "[", "'name'", "]", "for", "f", "in", "r", "[", "'fiel...
Get the list of valid fields for Bug objects
[ "Get", "the", "list", "of", "valid", "fields", "for", "Bug", "objects" ]
7de8b225104f24a1eee3e837bf1e02d60aefe69f
https://github.com/python-bugzilla/python-bugzilla/blob/7de8b225104f24a1eee3e837bf1e02d60aefe69f/bugzilla/base.py#L689-L694
train
python-bugzilla/python-bugzilla
bugzilla/base.py
Bugzilla.getbugfields
def getbugfields(self, force_refresh=False): """ Calls getBugFields, which returns a list of fields in each bug for this bugzilla instance. This can be used to set the list of attrs on the Bug object. """ if force_refresh or not self._cache.bugfields: log.debu...
python
def getbugfields(self, force_refresh=False): """ Calls getBugFields, which returns a list of fields in each bug for this bugzilla instance. This can be used to set the list of attrs on the Bug object. """ if force_refresh or not self._cache.bugfields: log.debu...
[ "def", "getbugfields", "(", "self", ",", "force_refresh", "=", "False", ")", ":", "if", "force_refresh", "or", "not", "self", ".", "_cache", ".", "bugfields", ":", "log", ".", "debug", "(", "\"Refreshing bugfields\"", ")", "self", ".", "_cache", ".", "bugf...
Calls getBugFields, which returns a list of fields in each bug for this bugzilla instance. This can be used to set the list of attrs on the Bug object.
[ "Calls", "getBugFields", "which", "returns", "a", "list", "of", "fields", "in", "each", "bug", "for", "this", "bugzilla", "instance", ".", "This", "can", "be", "used", "to", "set", "the", "list", "of", "attrs", "on", "the", "Bug", "object", "." ]
7de8b225104f24a1eee3e837bf1e02d60aefe69f
https://github.com/python-bugzilla/python-bugzilla/blob/7de8b225104f24a1eee3e837bf1e02d60aefe69f/bugzilla/base.py#L696-L708
train
python-bugzilla/python-bugzilla
bugzilla/base.py
Bugzilla.refresh_products
def refresh_products(self, **kwargs): """ Refresh a product's cached info. Basically calls product_get with the passed arguments, and tries to intelligently update our product cache. For example, if we already have cached info for product=foo, and you pass in names=["bar...
python
def refresh_products(self, **kwargs): """ Refresh a product's cached info. Basically calls product_get with the passed arguments, and tries to intelligently update our product cache. For example, if we already have cached info for product=foo, and you pass in names=["bar...
[ "def", "refresh_products", "(", "self", ",", "**", "kwargs", ")", ":", "for", "product", "in", "self", ".", "product_get", "(", "**", "kwargs", ")", ":", "updated", "=", "False", "for", "current", "in", "self", ".", "_cache", ".", "products", "[", ":",...
Refresh a product's cached info. Basically calls product_get with the passed arguments, and tries to intelligently update our product cache. For example, if we already have cached info for product=foo, and you pass in names=["bar", "baz"], the new cache will have info for produc...
[ "Refresh", "a", "product", "s", "cached", "info", ".", "Basically", "calls", "product_get", "with", "the", "passed", "arguments", "and", "tries", "to", "intelligently", "update", "our", "product", "cache", "." ]
7de8b225104f24a1eee3e837bf1e02d60aefe69f
https://github.com/python-bugzilla/python-bugzilla/blob/7de8b225104f24a1eee3e837bf1e02d60aefe69f/bugzilla/base.py#L765-L787
train
python-bugzilla/python-bugzilla
bugzilla/base.py
Bugzilla.getproducts
def getproducts(self, force_refresh=False, **kwargs): """ Query all products and return the raw dict info. Takes all the same arguments as product_get. On first invocation this will contact bugzilla and internally cache the results. Subsequent getproducts calls or accesses to ...
python
def getproducts(self, force_refresh=False, **kwargs): """ Query all products and return the raw dict info. Takes all the same arguments as product_get. On first invocation this will contact bugzilla and internally cache the results. Subsequent getproducts calls or accesses to ...
[ "def", "getproducts", "(", "self", ",", "force_refresh", "=", "False", ",", "**", "kwargs", ")", ":", "if", "force_refresh", "or", "not", "self", ".", "_cache", ".", "products", ":", "self", ".", "refresh_products", "(", "**", "kwargs", ")", "return", "s...
Query all products and return the raw dict info. Takes all the same arguments as product_get. On first invocation this will contact bugzilla and internally cache the results. Subsequent getproducts calls or accesses to self.products will return this cached data only. :param for...
[ "Query", "all", "products", "and", "return", "the", "raw", "dict", "info", ".", "Takes", "all", "the", "same", "arguments", "as", "product_get", "." ]
7de8b225104f24a1eee3e837bf1e02d60aefe69f
https://github.com/python-bugzilla/python-bugzilla/blob/7de8b225104f24a1eee3e837bf1e02d60aefe69f/bugzilla/base.py#L789-L802
train
python-bugzilla/python-bugzilla
bugzilla/base.py
Bugzilla.getcomponentdetails
def getcomponentdetails(self, product, component, force_refresh=False): """ Helper for accessing a single component's info. This is a wrapper around getcomponentsdetails, see that for explanation """ d = self.getcomponentsdetails(product, force_refresh) return d[component...
python
def getcomponentdetails(self, product, component, force_refresh=False): """ Helper for accessing a single component's info. This is a wrapper around getcomponentsdetails, see that for explanation """ d = self.getcomponentsdetails(product, force_refresh) return d[component...
[ "def", "getcomponentdetails", "(", "self", ",", "product", ",", "component", ",", "force_refresh", "=", "False", ")", ":", "d", "=", "self", ".", "getcomponentsdetails", "(", "product", ",", "force_refresh", ")", "return", "d", "[", "component", "]" ]
Helper for accessing a single component's info. This is a wrapper around getcomponentsdetails, see that for explanation
[ "Helper", "for", "accessing", "a", "single", "component", "s", "info", ".", "This", "is", "a", "wrapper", "around", "getcomponentsdetails", "see", "that", "for", "explanation" ]
7de8b225104f24a1eee3e837bf1e02d60aefe69f
https://github.com/python-bugzilla/python-bugzilla/blob/7de8b225104f24a1eee3e837bf1e02d60aefe69f/bugzilla/base.py#L851-L857
train
python-bugzilla/python-bugzilla
bugzilla/base.py
Bugzilla.getcomponents
def getcomponents(self, product, force_refresh=False): """ Return a list of component names for the passed product. This can be implemented with Product.get, but behind the scenes it uses Bug.legal_values. Reason being that on bugzilla instances with tons of components, like bug...
python
def getcomponents(self, product, force_refresh=False): """ Return a list of component names for the passed product. This can be implemented with Product.get, but behind the scenes it uses Bug.legal_values. Reason being that on bugzilla instances with tons of components, like bug...
[ "def", "getcomponents", "(", "self", ",", "product", ",", "force_refresh", "=", "False", ")", ":", "proddict", "=", "self", ".", "_lookup_product_in_cache", "(", "product", ")", "product_id", "=", "proddict", ".", "get", "(", "\"id\"", ",", "None", ")", "i...
Return a list of component names for the passed product. This can be implemented with Product.get, but behind the scenes it uses Bug.legal_values. Reason being that on bugzilla instances with tons of components, like bugzilla.redhat.com Product=Fedora for example, there's a 10x speed di...
[ "Return", "a", "list", "of", "component", "names", "for", "the", "passed", "product", "." ]
7de8b225104f24a1eee3e837bf1e02d60aefe69f
https://github.com/python-bugzilla/python-bugzilla/blob/7de8b225104f24a1eee3e837bf1e02d60aefe69f/bugzilla/base.py#L859-L892
train
python-bugzilla/python-bugzilla
bugzilla/base.py
Bugzilla._process_include_fields
def _process_include_fields(self, include_fields, exclude_fields, extra_fields): """ Internal helper to process include_fields lists """ def _convert_fields(_in): if not _in: return _in for newname, oldname in self....
python
def _process_include_fields(self, include_fields, exclude_fields, extra_fields): """ Internal helper to process include_fields lists """ def _convert_fields(_in): if not _in: return _in for newname, oldname in self....
[ "def", "_process_include_fields", "(", "self", ",", "include_fields", ",", "exclude_fields", ",", "extra_fields", ")", ":", "def", "_convert_fields", "(", "_in", ")", ":", "if", "not", "_in", ":", "return", "_in", "for", "newname", ",", "oldname", "in", "sel...
Internal helper to process include_fields lists
[ "Internal", "helper", "to", "process", "include_fields", "lists" ]
7de8b225104f24a1eee3e837bf1e02d60aefe69f
https://github.com/python-bugzilla/python-bugzilla/blob/7de8b225104f24a1eee3e837bf1e02d60aefe69f/bugzilla/base.py#L958-L987
train
python-bugzilla/python-bugzilla
bugzilla/base.py
Bugzilla._getbugs
def _getbugs(self, idlist, permissive, include_fields=None, exclude_fields=None, extra_fields=None): """ Return a list of dicts of full bug info for each given bug id. bug ids that couldn't be found will return None instead of a dict. """ oldidlist = idlist id...
python
def _getbugs(self, idlist, permissive, include_fields=None, exclude_fields=None, extra_fields=None): """ Return a list of dicts of full bug info for each given bug id. bug ids that couldn't be found will return None instead of a dict. """ oldidlist = idlist id...
[ "def", "_getbugs", "(", "self", ",", "idlist", ",", "permissive", ",", "include_fields", "=", "None", ",", "exclude_fields", "=", "None", ",", "extra_fields", "=", "None", ")", ":", "oldidlist", "=", "idlist", "idlist", "=", "[", "]", "for", "i", "in", ...
Return a list of dicts of full bug info for each given bug id. bug ids that couldn't be found will return None instead of a dict.
[ "Return", "a", "list", "of", "dicts", "of", "full", "bug", "info", "for", "each", "given", "bug", "id", ".", "bug", "ids", "that", "couldn", "t", "be", "found", "will", "return", "None", "instead", "of", "a", "dict", "." ]
7de8b225104f24a1eee3e837bf1e02d60aefe69f
https://github.com/python-bugzilla/python-bugzilla/blob/7de8b225104f24a1eee3e837bf1e02d60aefe69f/bugzilla/base.py#L1010-L1056
train
python-bugzilla/python-bugzilla
bugzilla/base.py
Bugzilla._getbug
def _getbug(self, objid, **kwargs): """ Thin wrapper around _getbugs to handle the slight argument tweaks for fetching a single bug. The main bit is permissive=False, which will tell bugzilla to raise an explicit error if we can't fetch that bug. This logic is called fro...
python
def _getbug(self, objid, **kwargs): """ Thin wrapper around _getbugs to handle the slight argument tweaks for fetching a single bug. The main bit is permissive=False, which will tell bugzilla to raise an explicit error if we can't fetch that bug. This logic is called fro...
[ "def", "_getbug", "(", "self", ",", "objid", ",", "**", "kwargs", ")", ":", "return", "self", ".", "_getbugs", "(", "[", "objid", "]", ",", "permissive", "=", "False", ",", "**", "kwargs", ")", "[", "0", "]" ]
Thin wrapper around _getbugs to handle the slight argument tweaks for fetching a single bug. The main bit is permissive=False, which will tell bugzilla to raise an explicit error if we can't fetch that bug. This logic is called from Bug() too
[ "Thin", "wrapper", "around", "_getbugs", "to", "handle", "the", "slight", "argument", "tweaks", "for", "fetching", "a", "single", "bug", ".", "The", "main", "bit", "is", "permissive", "=", "False", "which", "will", "tell", "bugzilla", "to", "raise", "an", ...
7de8b225104f24a1eee3e837bf1e02d60aefe69f
https://github.com/python-bugzilla/python-bugzilla/blob/7de8b225104f24a1eee3e837bf1e02d60aefe69f/bugzilla/base.py#L1058-L1067
train
python-bugzilla/python-bugzilla
bugzilla/base.py
Bugzilla.getbug
def getbug(self, objid, include_fields=None, exclude_fields=None, extra_fields=None): """ Return a Bug object with the full complement of bug data already loaded. """ data = self._getbug(objid, include_fields=include_fields, exclude_fields=exclude_field...
python
def getbug(self, objid, include_fields=None, exclude_fields=None, extra_fields=None): """ Return a Bug object with the full complement of bug data already loaded. """ data = self._getbug(objid, include_fields=include_fields, exclude_fields=exclude_field...
[ "def", "getbug", "(", "self", ",", "objid", ",", "include_fields", "=", "None", ",", "exclude_fields", "=", "None", ",", "extra_fields", "=", "None", ")", ":", "data", "=", "self", ".", "_getbug", "(", "objid", ",", "include_fields", "=", "include_fields",...
Return a Bug object with the full complement of bug data already loaded.
[ "Return", "a", "Bug", "object", "with", "the", "full", "complement", "of", "bug", "data", "already", "loaded", "." ]
7de8b225104f24a1eee3e837bf1e02d60aefe69f
https://github.com/python-bugzilla/python-bugzilla/blob/7de8b225104f24a1eee3e837bf1e02d60aefe69f/bugzilla/base.py#L1069-L1078
train
python-bugzilla/python-bugzilla
bugzilla/base.py
Bugzilla.getbugs
def getbugs(self, idlist, include_fields=None, exclude_fields=None, extra_fields=None, permissive=True): """ Return a list of Bug objects with the full complement of bug data already loaded. If there's a problem getting the data for a given id, the corresp...
python
def getbugs(self, idlist, include_fields=None, exclude_fields=None, extra_fields=None, permissive=True): """ Return a list of Bug objects with the full complement of bug data already loaded. If there's a problem getting the data for a given id, the corresp...
[ "def", "getbugs", "(", "self", ",", "idlist", ",", "include_fields", "=", "None", ",", "exclude_fields", "=", "None", ",", "extra_fields", "=", "None", ",", "permissive", "=", "True", ")", ":", "data", "=", "self", ".", "_getbugs", "(", "idlist", ",", ...
Return a list of Bug objects with the full complement of bug data already loaded. If there's a problem getting the data for a given id, the corresponding item in the returned list will be None.
[ "Return", "a", "list", "of", "Bug", "objects", "with", "the", "full", "complement", "of", "bug", "data", "already", "loaded", ".", "If", "there", "s", "a", "problem", "getting", "the", "data", "for", "a", "given", "id", "the", "corresponding", "item", "i...
7de8b225104f24a1eee3e837bf1e02d60aefe69f
https://github.com/python-bugzilla/python-bugzilla/blob/7de8b225104f24a1eee3e837bf1e02d60aefe69f/bugzilla/base.py#L1080-L1093
train
python-bugzilla/python-bugzilla
bugzilla/base.py
Bugzilla.update_tags
def update_tags(self, idlist, tags_add=None, tags_remove=None): """ Updates the 'tags' field for a bug. """ tags = {} if tags_add: tags["add"] = self._listify(tags_add) if tags_remove: tags["remove"] = self._listify(tags_remove) d = { ...
python
def update_tags(self, idlist, tags_add=None, tags_remove=None): """ Updates the 'tags' field for a bug. """ tags = {} if tags_add: tags["add"] = self._listify(tags_add) if tags_remove: tags["remove"] = self._listify(tags_remove) d = { ...
[ "def", "update_tags", "(", "self", ",", "idlist", ",", "tags_add", "=", "None", ",", "tags_remove", "=", "None", ")", ":", "tags", "=", "{", "}", "if", "tags_add", ":", "tags", "[", "\"add\"", "]", "=", "self", ".", "_listify", "(", "tags_add", ")", ...
Updates the 'tags' field for a bug.
[ "Updates", "the", "tags", "field", "for", "a", "bug", "." ]
7de8b225104f24a1eee3e837bf1e02d60aefe69f
https://github.com/python-bugzilla/python-bugzilla/blob/7de8b225104f24a1eee3e837bf1e02d60aefe69f/bugzilla/base.py#L1328-L1343
train
python-bugzilla/python-bugzilla
bugzilla/base.py
Bugzilla._attachment_uri
def _attachment_uri(self, attachid): """ Returns the URI for the given attachment ID. """ att_uri = self.url.replace('xmlrpc.cgi', 'attachment.cgi') att_uri = att_uri + '?id=%s' % attachid return att_uri
python
def _attachment_uri(self, attachid): """ Returns the URI for the given attachment ID. """ att_uri = self.url.replace('xmlrpc.cgi', 'attachment.cgi') att_uri = att_uri + '?id=%s' % attachid return att_uri
[ "def", "_attachment_uri", "(", "self", ",", "attachid", ")", ":", "att_uri", "=", "self", ".", "url", ".", "replace", "(", "'xmlrpc.cgi'", ",", "'attachment.cgi'", ")", "att_uri", "=", "att_uri", "+", "'?id=%s'", "%", "attachid", "return", "att_uri" ]
Returns the URI for the given attachment ID.
[ "Returns", "the", "URI", "for", "the", "given", "attachment", "ID", "." ]
7de8b225104f24a1eee3e837bf1e02d60aefe69f
https://github.com/python-bugzilla/python-bugzilla/blob/7de8b225104f24a1eee3e837bf1e02d60aefe69f/bugzilla/base.py#L1501-L1507
train
python-bugzilla/python-bugzilla
bugzilla/base.py
Bugzilla.attachfile
def attachfile(self, idlist, attachfile, description, **kwargs): """ Attach a file to the given bug IDs. Returns the ID of the attachment or raises XMLRPC Fault if something goes wrong. attachfile may be a filename (which will be opened) or a file-like object, which must provide...
python
def attachfile(self, idlist, attachfile, description, **kwargs): """ Attach a file to the given bug IDs. Returns the ID of the attachment or raises XMLRPC Fault if something goes wrong. attachfile may be a filename (which will be opened) or a file-like object, which must provide...
[ "def", "attachfile", "(", "self", ",", "idlist", ",", "attachfile", ",", "description", ",", "**", "kwargs", ")", ":", "if", "isinstance", "(", "attachfile", ",", "str", ")", ":", "f", "=", "open", "(", "attachfile", ",", "\"rb\"", ")", "elif", "hasatt...
Attach a file to the given bug IDs. Returns the ID of the attachment or raises XMLRPC Fault if something goes wrong. attachfile may be a filename (which will be opened) or a file-like object, which must provide a 'read' method. If it's not one of these, this method will raise a TypeErro...
[ "Attach", "a", "file", "to", "the", "given", "bug", "IDs", ".", "Returns", "the", "ID", "of", "the", "attachment", "or", "raises", "XMLRPC", "Fault", "if", "something", "goes", "wrong", "." ]
7de8b225104f24a1eee3e837bf1e02d60aefe69f
https://github.com/python-bugzilla/python-bugzilla/blob/7de8b225104f24a1eee3e837bf1e02d60aefe69f/bugzilla/base.py#L1509-L1581
train
python-bugzilla/python-bugzilla
bugzilla/base.py
Bugzilla.openattachment
def openattachment(self, attachid): """ Get the contents of the attachment with the given attachment ID. Returns a file-like object. """ attachments = self.get_attachments(None, attachid) data = attachments["attachments"][str(attachid)] xmlrpcbinary = data["data"]...
python
def openattachment(self, attachid): """ Get the contents of the attachment with the given attachment ID. Returns a file-like object. """ attachments = self.get_attachments(None, attachid) data = attachments["attachments"][str(attachid)] xmlrpcbinary = data["data"]...
[ "def", "openattachment", "(", "self", ",", "attachid", ")", ":", "attachments", "=", "self", ".", "get_attachments", "(", "None", ",", "attachid", ")", "data", "=", "attachments", "[", "\"attachments\"", "]", "[", "str", "(", "attachid", ")", "]", "xmlrpcb...
Get the contents of the attachment with the given attachment ID. Returns a file-like object.
[ "Get", "the", "contents", "of", "the", "attachment", "with", "the", "given", "attachment", "ID", ".", "Returns", "a", "file", "-", "like", "object", "." ]
7de8b225104f24a1eee3e837bf1e02d60aefe69f
https://github.com/python-bugzilla/python-bugzilla/blob/7de8b225104f24a1eee3e837bf1e02d60aefe69f/bugzilla/base.py#L1584-L1597
train
python-bugzilla/python-bugzilla
bugzilla/base.py
Bugzilla.get_attachments
def get_attachments(self, ids, attachment_ids, include_fields=None, exclude_fields=None): """ Wrapper for Bug.attachments. One of ids or attachment_ids is required :param ids: Get attachments for this bug ID :param attachment_ids: Specific attachment ID to get ...
python
def get_attachments(self, ids, attachment_ids, include_fields=None, exclude_fields=None): """ Wrapper for Bug.attachments. One of ids or attachment_ids is required :param ids: Get attachments for this bug ID :param attachment_ids: Specific attachment ID to get ...
[ "def", "get_attachments", "(", "self", ",", "ids", ",", "attachment_ids", ",", "include_fields", "=", "None", ",", "exclude_fields", "=", "None", ")", ":", "params", "=", "{", "\"ids\"", ":", "self", ".", "_listify", "(", "ids", ")", "or", "[", "]", ",...
Wrapper for Bug.attachments. One of ids or attachment_ids is required :param ids: Get attachments for this bug ID :param attachment_ids: Specific attachment ID to get https://bugzilla.readthedocs.io/en/latest/api/core/v1/attachment.html#get-attachment
[ "Wrapper", "for", "Bug", ".", "attachments", ".", "One", "of", "ids", "or", "attachment_ids", "is", "required" ]
7de8b225104f24a1eee3e837bf1e02d60aefe69f
https://github.com/python-bugzilla/python-bugzilla/blob/7de8b225104f24a1eee3e837bf1e02d60aefe69f/bugzilla/base.py#L1616-L1635
train
python-bugzilla/python-bugzilla
bugzilla/base.py
Bugzilla.createbug
def createbug(self, *args, **kwargs): """ Create a bug with the given info. Returns a new Bug object. Check bugzilla API documentation for valid values, at least product, component, summary, version, and description need to be passed. """ data = self._validate_cre...
python
def createbug(self, *args, **kwargs): """ Create a bug with the given info. Returns a new Bug object. Check bugzilla API documentation for valid values, at least product, component, summary, version, and description need to be passed. """ data = self._validate_cre...
[ "def", "createbug", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "data", "=", "self", ".", "_validate_createbug", "(", "*", "args", ",", "**", "kwargs", ")", "rawbug", "=", "self", ".", "_proxy", ".", "Bug", ".", "create", "(", "da...
Create a bug with the given info. Returns a new Bug object. Check bugzilla API documentation for valid values, at least product, component, summary, version, and description need to be passed.
[ "Create", "a", "bug", "with", "the", "given", "info", ".", "Returns", "a", "new", "Bug", "object", ".", "Check", "bugzilla", "API", "documentation", "for", "valid", "values", "at", "least", "product", "component", "summary", "version", "and", "description", ...
7de8b225104f24a1eee3e837bf1e02d60aefe69f
https://github.com/python-bugzilla/python-bugzilla/blob/7de8b225104f24a1eee3e837bf1e02d60aefe69f/bugzilla/base.py#L1739-L1749
train
python-bugzilla/python-bugzilla
bugzilla/base.py
Bugzilla._getusers
def _getusers(self, ids=None, names=None, match=None): """ Return a list of users that match criteria. :kwarg ids: list of user ids to return data on :kwarg names: list of user names to return data on :kwarg match: list of patterns. Returns users whose real name or ...
python
def _getusers(self, ids=None, names=None, match=None): """ Return a list of users that match criteria. :kwarg ids: list of user ids to return data on :kwarg names: list of user names to return data on :kwarg match: list of patterns. Returns users whose real name or ...
[ "def", "_getusers", "(", "self", ",", "ids", "=", "None", ",", "names", "=", "None", ",", "match", "=", "None", ")", ":", "params", "=", "{", "}", "if", "ids", ":", "params", "[", "'ids'", "]", "=", "self", ".", "_listify", "(", "ids", ")", "if...
Return a list of users that match criteria. :kwarg ids: list of user ids to return data on :kwarg names: list of user names to return data on :kwarg match: list of patterns. Returns users whose real name or login name match the pattern. :raises XMLRPC Fault: Code 51: if a B...
[ "Return", "a", "list", "of", "users", "that", "match", "criteria", "." ]
7de8b225104f24a1eee3e837bf1e02d60aefe69f
https://github.com/python-bugzilla/python-bugzilla/blob/7de8b225104f24a1eee3e837bf1e02d60aefe69f/bugzilla/base.py#L1756-L1784
train
python-bugzilla/python-bugzilla
bugzilla/base.py
Bugzilla.getusers
def getusers(self, userlist): """ Return a list of Users from . :userlist: List of usernames to lookup :returns: List of User records """ userobjs = [User(self, **rawuser) for rawuser in self._getusers(names=userlist).get('users', [])] # Retu...
python
def getusers(self, userlist): """ Return a list of Users from . :userlist: List of usernames to lookup :returns: List of User records """ userobjs = [User(self, **rawuser) for rawuser in self._getusers(names=userlist).get('users', [])] # Retu...
[ "def", "getusers", "(", "self", ",", "userlist", ")", ":", "userobjs", "=", "[", "User", "(", "self", ",", "**", "rawuser", ")", "for", "rawuser", "in", "self", ".", "_getusers", "(", "names", "=", "userlist", ")", ".", "get", "(", "'users'", ",", ...
Return a list of Users from . :userlist: List of usernames to lookup :returns: List of User records
[ "Return", "a", "list", "of", "Users", "from", "." ]
7de8b225104f24a1eee3e837bf1e02d60aefe69f
https://github.com/python-bugzilla/python-bugzilla/blob/7de8b225104f24a1eee3e837bf1e02d60aefe69f/bugzilla/base.py#L1797-L1816
train
python-bugzilla/python-bugzilla
bugzilla/base.py
Bugzilla.searchusers
def searchusers(self, pattern): """ Return a bugzilla User for the given list of patterns :arg pattern: List of patterns to match against. :returns: List of User records """ return [User(self, **rawuser) for rawuser in self._getusers(match=pattern).get('u...
python
def searchusers(self, pattern): """ Return a bugzilla User for the given list of patterns :arg pattern: List of patterns to match against. :returns: List of User records """ return [User(self, **rawuser) for rawuser in self._getusers(match=pattern).get('u...
[ "def", "searchusers", "(", "self", ",", "pattern", ")", ":", "return", "[", "User", "(", "self", ",", "**", "rawuser", ")", "for", "rawuser", "in", "self", ".", "_getusers", "(", "match", "=", "pattern", ")", ".", "get", "(", "'users'", ",", "[", "...
Return a bugzilla User for the given list of patterns :arg pattern: List of patterns to match against. :returns: List of User records
[ "Return", "a", "bugzilla", "User", "for", "the", "given", "list", "of", "patterns" ]
7de8b225104f24a1eee3e837bf1e02d60aefe69f
https://github.com/python-bugzilla/python-bugzilla/blob/7de8b225104f24a1eee3e837bf1e02d60aefe69f/bugzilla/base.py#L1819-L1827
train
python-bugzilla/python-bugzilla
bugzilla/base.py
Bugzilla.createuser
def createuser(self, email, name='', password=''): """ Return a bugzilla User for the given username :arg email: The email address to use in bugzilla :kwarg name: Real name to associate with the account :kwarg password: Password to set for the bugzilla account :raises XM...
python
def createuser(self, email, name='', password=''): """ Return a bugzilla User for the given username :arg email: The email address to use in bugzilla :kwarg name: Real name to associate with the account :kwarg password: Password to set for the bugzilla account :raises XM...
[ "def", "createuser", "(", "self", ",", "email", ",", "name", "=", "''", ",", "password", "=", "''", ")", ":", "self", ".", "_proxy", ".", "User", ".", "create", "(", "email", ",", "name", ",", "password", ")", "return", "self", ".", "getuser", "(",...
Return a bugzilla User for the given username :arg email: The email address to use in bugzilla :kwarg name: Real name to associate with the account :kwarg password: Password to set for the bugzilla account :raises XMLRPC Fault: Code 501 if the username already exists Code 50...
[ "Return", "a", "bugzilla", "User", "for", "the", "given", "username" ]
7de8b225104f24a1eee3e837bf1e02d60aefe69f
https://github.com/python-bugzilla/python-bugzilla/blob/7de8b225104f24a1eee3e837bf1e02d60aefe69f/bugzilla/base.py#L1829-L1843
train
python-bugzilla/python-bugzilla
bugzilla/bug.py
Bug.refresh
def refresh(self, include_fields=None, exclude_fields=None, extra_fields=None): """ Refresh the bug with the latest data from bugzilla """ # pylint: disable=protected-access r = self.bugzilla._getbug(self.bug_id, include_fields=include_fields, exclude_fields=e...
python
def refresh(self, include_fields=None, exclude_fields=None, extra_fields=None): """ Refresh the bug with the latest data from bugzilla """ # pylint: disable=protected-access r = self.bugzilla._getbug(self.bug_id, include_fields=include_fields, exclude_fields=e...
[ "def", "refresh", "(", "self", ",", "include_fields", "=", "None", ",", "exclude_fields", "=", "None", ",", "extra_fields", "=", "None", ")", ":", "r", "=", "self", ".", "bugzilla", ".", "_getbug", "(", "self", ".", "bug_id", ",", "include_fields", "=", ...
Refresh the bug with the latest data from bugzilla
[ "Refresh", "the", "bug", "with", "the", "latest", "data", "from", "bugzilla" ]
7de8b225104f24a1eee3e837bf1e02d60aefe69f
https://github.com/python-bugzilla/python-bugzilla/blob/7de8b225104f24a1eee3e837bf1e02d60aefe69f/bugzilla/bug.py#L117-L127
train
python-bugzilla/python-bugzilla
bugzilla/bug.py
Bug._update_dict
def _update_dict(self, newdict): """ Update internal dictionary, in a way that ensures no duplicate entries are stored WRT field aliases """ if self.bugzilla: self.bugzilla.post_translation({}, newdict) # pylint: disable=protected-access alias...
python
def _update_dict(self, newdict): """ Update internal dictionary, in a way that ensures no duplicate entries are stored WRT field aliases """ if self.bugzilla: self.bugzilla.post_translation({}, newdict) # pylint: disable=protected-access alias...
[ "def", "_update_dict", "(", "self", ",", "newdict", ")", ":", "if", "self", ".", "bugzilla", ":", "self", ".", "bugzilla", ".", "post_translation", "(", "{", "}", ",", "newdict", ")", "aliases", "=", "self", ".", "bugzilla", ".", "_get_bug_aliases", "(",...
Update internal dictionary, in a way that ensures no duplicate entries are stored WRT field aliases
[ "Update", "internal", "dictionary", "in", "a", "way", "that", "ensures", "no", "duplicate", "entries", "are", "stored", "WRT", "field", "aliases" ]
7de8b225104f24a1eee3e837bf1e02d60aefe69f
https://github.com/python-bugzilla/python-bugzilla/blob/7de8b225104f24a1eee3e837bf1e02d60aefe69f/bugzilla/bug.py#L130-L161
train
python-bugzilla/python-bugzilla
bugzilla/bug.py
Bug.deletecc
def deletecc(self, cclist, comment=None): """ Removes the given email addresses from the CC list for this bug. """ vals = self.bugzilla.build_update(comment=comment, cc_remove=cclist) log.debug("deletecc: update=%s", vals) return...
python
def deletecc(self, cclist, comment=None): """ Removes the given email addresses from the CC list for this bug. """ vals = self.bugzilla.build_update(comment=comment, cc_remove=cclist) log.debug("deletecc: update=%s", vals) return...
[ "def", "deletecc", "(", "self", ",", "cclist", ",", "comment", "=", "None", ")", ":", "vals", "=", "self", ".", "bugzilla", ".", "build_update", "(", "comment", "=", "comment", ",", "cc_remove", "=", "cclist", ")", "log", ".", "debug", "(", "\"deletecc...
Removes the given email addresses from the CC list for this bug.
[ "Removes", "the", "given", "email", "addresses", "from", "the", "CC", "list", "for", "this", "bug", "." ]
7de8b225104f24a1eee3e837bf1e02d60aefe69f
https://github.com/python-bugzilla/python-bugzilla/blob/7de8b225104f24a1eee3e837bf1e02d60aefe69f/bugzilla/bug.py#L267-L275
train
python-bugzilla/python-bugzilla
bugzilla/bug.py
Bug.addcomment
def addcomment(self, comment, private=False): """ Add the given comment to this bug. Set private to True to mark this comment as private. """ # Note: fedora bodhi uses this function vals = self.bugzilla.build_update(comment=comment, ...
python
def addcomment(self, comment, private=False): """ Add the given comment to this bug. Set private to True to mark this comment as private. """ # Note: fedora bodhi uses this function vals = self.bugzilla.build_update(comment=comment, ...
[ "def", "addcomment", "(", "self", ",", "comment", ",", "private", "=", "False", ")", ":", "vals", "=", "self", ".", "bugzilla", ".", "build_update", "(", "comment", "=", "comment", ",", "comment_private", "=", "private", ")", "log", ".", "debug", "(", ...
Add the given comment to this bug. Set private to True to mark this comment as private.
[ "Add", "the", "given", "comment", "to", "this", "bug", ".", "Set", "private", "to", "True", "to", "mark", "this", "comment", "as", "private", "." ]
7de8b225104f24a1eee3e837bf1e02d60aefe69f
https://github.com/python-bugzilla/python-bugzilla/blob/7de8b225104f24a1eee3e837bf1e02d60aefe69f/bugzilla/bug.py#L282-L292
train
python-bugzilla/python-bugzilla
bugzilla/bug.py
Bug.getcomments
def getcomments(self): """ Returns an array of comment dictionaries for this bug """ comment_list = self.bugzilla.get_comments([self.bug_id]) return comment_list['bugs'][str(self.bug_id)]['comments']
python
def getcomments(self): """ Returns an array of comment dictionaries for this bug """ comment_list = self.bugzilla.get_comments([self.bug_id]) return comment_list['bugs'][str(self.bug_id)]['comments']
[ "def", "getcomments", "(", "self", ")", ":", "comment_list", "=", "self", ".", "bugzilla", ".", "get_comments", "(", "[", "self", ".", "bug_id", "]", ")", "return", "comment_list", "[", "'bugs'", "]", "[", "str", "(", "self", ".", "bug_id", ")", "]", ...
Returns an array of comment dictionaries for this bug
[ "Returns", "an", "array", "of", "comment", "dictionaries", "for", "this", "bug" ]
7de8b225104f24a1eee3e837bf1e02d60aefe69f
https://github.com/python-bugzilla/python-bugzilla/blob/7de8b225104f24a1eee3e837bf1e02d60aefe69f/bugzilla/bug.py#L294-L299
train
python-bugzilla/python-bugzilla
bugzilla/bug.py
Bug.get_flag_status
def get_flag_status(self, name): """ Return a flag 'status' field This method works only for simple flags that have only a 'status' field with no "requestee" info, and no multiple values. For more complex flags, use get_flags() to get extended flag value information. """...
python
def get_flag_status(self, name): """ Return a flag 'status' field This method works only for simple flags that have only a 'status' field with no "requestee" info, and no multiple values. For more complex flags, use get_flags() to get extended flag value information. """...
[ "def", "get_flag_status", "(", "self", ",", "name", ")", ":", "f", "=", "self", ".", "get_flags", "(", "name", ")", "if", "not", "f", ":", "return", "None", "assert", "len", "(", "f", ")", "<=", "1", "return", "f", "[", "0", "]", "[", "'status'",...
Return a flag 'status' field This method works only for simple flags that have only a 'status' field with no "requestee" info, and no multiple values. For more complex flags, use get_flags() to get extended flag value information.
[ "Return", "a", "flag", "status", "field" ]
7de8b225104f24a1eee3e837bf1e02d60aefe69f
https://github.com/python-bugzilla/python-bugzilla/blob/7de8b225104f24a1eee3e837bf1e02d60aefe69f/bugzilla/bug.py#L328-L344
train
python-bugzilla/python-bugzilla
bugzilla/bug.py
Bug.get_attachments
def get_attachments(self, include_fields=None, exclude_fields=None): """ Helper call to Bugzilla.get_attachments. If you want to fetch specific attachment IDs, use that function instead """ if "attachments" in self.__dict__: return self.attachments data = sel...
python
def get_attachments(self, include_fields=None, exclude_fields=None): """ Helper call to Bugzilla.get_attachments. If you want to fetch specific attachment IDs, use that function instead """ if "attachments" in self.__dict__: return self.attachments data = sel...
[ "def", "get_attachments", "(", "self", ",", "include_fields", "=", "None", ",", "exclude_fields", "=", "None", ")", ":", "if", "\"attachments\"", "in", "self", ".", "__dict__", ":", "return", "self", ".", "attachments", "data", "=", "self", ".", "bugzilla", ...
Helper call to Bugzilla.get_attachments. If you want to fetch specific attachment IDs, use that function instead
[ "Helper", "call", "to", "Bugzilla", ".", "get_attachments", ".", "If", "you", "want", "to", "fetch", "specific", "attachment", "IDs", "use", "that", "function", "instead" ]
7de8b225104f24a1eee3e837bf1e02d60aefe69f
https://github.com/python-bugzilla/python-bugzilla/blob/7de8b225104f24a1eee3e837bf1e02d60aefe69f/bugzilla/bug.py#L366-L376
train
python-bugzilla/python-bugzilla
bugzilla/bug.py
User.refresh
def refresh(self): """ Update User object with latest info from bugzilla """ newuser = self.bugzilla.getuser(self.email) self.__dict__.update(newuser.__dict__)
python
def refresh(self): """ Update User object with latest info from bugzilla """ newuser = self.bugzilla.getuser(self.email) self.__dict__.update(newuser.__dict__)
[ "def", "refresh", "(", "self", ")", ":", "newuser", "=", "self", ".", "bugzilla", ".", "getuser", "(", "self", ".", "email", ")", "self", ".", "__dict__", ".", "update", "(", "newuser", ".", "__dict__", ")" ]
Update User object with latest info from bugzilla
[ "Update", "User", "object", "with", "latest", "info", "from", "bugzilla" ]
7de8b225104f24a1eee3e837bf1e02d60aefe69f
https://github.com/python-bugzilla/python-bugzilla/blob/7de8b225104f24a1eee3e837bf1e02d60aefe69f/bugzilla/bug.py#L441-L446
train
python-bugzilla/python-bugzilla
bugzilla/rhbugzilla.py
RHBugzilla.pre_translation
def pre_translation(self, query): """ Translates the query for possible aliases """ old = query.copy() if 'bug_id' in query: if not isinstance(query['bug_id'], list): query['id'] = query['bug_id'].split(',') else: query['id...
python
def pre_translation(self, query): """ Translates the query for possible aliases """ old = query.copy() if 'bug_id' in query: if not isinstance(query['bug_id'], list): query['id'] = query['bug_id'].split(',') else: query['id...
[ "def", "pre_translation", "(", "self", ",", "query", ")", ":", "old", "=", "query", ".", "copy", "(", ")", "if", "'bug_id'", "in", "query", ":", "if", "not", "isinstance", "(", "query", "[", "'bug_id'", "]", ",", "list", ")", ":", "query", "[", "'i...
Translates the query for possible aliases
[ "Translates", "the", "query", "for", "possible", "aliases" ]
7de8b225104f24a1eee3e837bf1e02d60aefe69f
https://github.com/python-bugzilla/python-bugzilla/blob/7de8b225104f24a1eee3e837bf1e02d60aefe69f/bugzilla/rhbugzilla.py#L252-L284
train
python-bugzilla/python-bugzilla
bugzilla/rhbugzilla.py
RHBugzilla.post_translation
def post_translation(self, query, bug): """ Convert the results of getbug back to the ancient RHBZ value formats """ ignore = query # RHBZ _still_ returns component and version as lists, which # deviates from upstream. Copy the list values to components #...
python
def post_translation(self, query, bug): """ Convert the results of getbug back to the ancient RHBZ value formats """ ignore = query # RHBZ _still_ returns component and version as lists, which # deviates from upstream. Copy the list values to components #...
[ "def", "post_translation", "(", "self", ",", "query", ",", "bug", ")", ":", "ignore", "=", "query", "if", "'component'", "in", "bug", "and", "\"components\"", "not", "in", "bug", ":", "val", "=", "bug", "[", "'component'", "]", "bug", "[", "'components'"...
Convert the results of getbug back to the ancient RHBZ value formats
[ "Convert", "the", "results", "of", "getbug", "back", "to", "the", "ancient", "RHBZ", "value", "formats" ]
7de8b225104f24a1eee3e837bf1e02d60aefe69f
https://github.com/python-bugzilla/python-bugzilla/blob/7de8b225104f24a1eee3e837bf1e02d60aefe69f/bugzilla/rhbugzilla.py#L286-L315
train
kdeldycke/maildir-deduplicate
maildir_deduplicate/deduplicate.py
DuplicateSet.delete
def delete(self, mail): """ Delete a mail from the filesystem. """ self.stats['mail_deleted'] += 1 if self.conf.dry_run: logger.info("Skip deletion of {!r}.".format(mail)) return logger.debug("Deleting {!r}...".format(mail)) # XXX Investigate the use of m...
python
def delete(self, mail): """ Delete a mail from the filesystem. """ self.stats['mail_deleted'] += 1 if self.conf.dry_run: logger.info("Skip deletion of {!r}.".format(mail)) return logger.debug("Deleting {!r}...".format(mail)) # XXX Investigate the use of m...
[ "def", "delete", "(", "self", ",", "mail", ")", ":", "self", ".", "stats", "[", "'mail_deleted'", "]", "+=", "1", "if", "self", ".", "conf", ".", "dry_run", ":", "logger", ".", "info", "(", "\"Skip deletion of {!r}.\"", ".", "format", "(", "mail", ")",...
Delete a mail from the filesystem.
[ "Delete", "a", "mail", "from", "the", "filesystem", "." ]
f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733
https://github.com/kdeldycke/maildir-deduplicate/blob/f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733/maildir_deduplicate/deduplicate.py#L109-L120
train
kdeldycke/maildir-deduplicate
maildir_deduplicate/deduplicate.py
DuplicateSet.check_differences
def check_differences(self): """ In-depth check of mail differences. Compare all mails of the duplicate set with each other, both in size and content. Raise an error if we're not within the limits imposed by the threshold setting. """ logger.info("Check that mail differe...
python
def check_differences(self): """ In-depth check of mail differences. Compare all mails of the duplicate set with each other, both in size and content. Raise an error if we're not within the limits imposed by the threshold setting. """ logger.info("Check that mail differe...
[ "def", "check_differences", "(", "self", ")", ":", "logger", ".", "info", "(", "\"Check that mail differences are within the limits.\"", ")", "if", "self", ".", "conf", ".", "size_threshold", "<", "0", ":", "logger", ".", "info", "(", "\"Skip checking for size diffe...
In-depth check of mail differences. Compare all mails of the duplicate set with each other, both in size and content. Raise an error if we're not within the limits imposed by the threshold setting.
[ "In", "-", "depth", "check", "of", "mail", "differences", "." ]
f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733
https://github.com/kdeldycke/maildir-deduplicate/blob/f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733/maildir_deduplicate/deduplicate.py#L122-L157
train
kdeldycke/maildir-deduplicate
maildir_deduplicate/deduplicate.py
DuplicateSet.diff
def diff(self, mail_a, mail_b): """ Return difference in bytes between two mails' normalized body. TODO: rewrite the diff algorithm to not rely on naive unified diff result parsing. """ return len(''.join(unified_diff( mail_a.body_lines, mail_b.body_lines, ...
python
def diff(self, mail_a, mail_b): """ Return difference in bytes between two mails' normalized body. TODO: rewrite the diff algorithm to not rely on naive unified diff result parsing. """ return len(''.join(unified_diff( mail_a.body_lines, mail_b.body_lines, ...
[ "def", "diff", "(", "self", ",", "mail_a", ",", "mail_b", ")", ":", "return", "len", "(", "''", ".", "join", "(", "unified_diff", "(", "mail_a", ".", "body_lines", ",", "mail_b", ".", "body_lines", ",", "fromfile", "=", "'a'", ",", "tofile", "=", "'b...
Return difference in bytes between two mails' normalized body. TODO: rewrite the diff algorithm to not rely on naive unified diff result parsing.
[ "Return", "difference", "in", "bytes", "between", "two", "mails", "normalized", "body", "." ]
f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733
https://github.com/kdeldycke/maildir-deduplicate/blob/f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733/maildir_deduplicate/deduplicate.py#L159-L170
train
kdeldycke/maildir-deduplicate
maildir_deduplicate/deduplicate.py
DuplicateSet.pretty_diff
def pretty_diff(self, mail_a, mail_b): """ Returns a verbose unified diff between two mails' normalized body. """ return ''.join(unified_diff( mail_a.body_lines, mail_b.body_lines, fromfile='Normalized body of {}'.format(mail_a.path), tofile='Normalized body o...
python
def pretty_diff(self, mail_a, mail_b): """ Returns a verbose unified diff between two mails' normalized body. """ return ''.join(unified_diff( mail_a.body_lines, mail_b.body_lines, fromfile='Normalized body of {}'.format(mail_a.path), tofile='Normalized body o...
[ "def", "pretty_diff", "(", "self", ",", "mail_a", ",", "mail_b", ")", ":", "return", "''", ".", "join", "(", "unified_diff", "(", "mail_a", ".", "body_lines", ",", "mail_b", ".", "body_lines", ",", "fromfile", "=", "'Normalized body of {}'", ".", "format", ...
Returns a verbose unified diff between two mails' normalized body.
[ "Returns", "a", "verbose", "unified", "diff", "between", "two", "mails", "normalized", "body", "." ]
f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733
https://github.com/kdeldycke/maildir-deduplicate/blob/f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733/maildir_deduplicate/deduplicate.py#L172-L181
train
kdeldycke/maildir-deduplicate
maildir_deduplicate/deduplicate.py
DuplicateSet.apply_strategy
def apply_strategy(self): """ Apply deduplication with the configured strategy. Transform strategy keyword into its method ID, and call it. """ method_id = self.conf.strategy.replace('-', '_') if not hasattr(DuplicateSet, method_id): raise NotImplementedError( ...
python
def apply_strategy(self): """ Apply deduplication with the configured strategy. Transform strategy keyword into its method ID, and call it. """ method_id = self.conf.strategy.replace('-', '_') if not hasattr(DuplicateSet, method_id): raise NotImplementedError( ...
[ "def", "apply_strategy", "(", "self", ")", ":", "method_id", "=", "self", ".", "conf", ".", "strategy", ".", "replace", "(", "'-'", ",", "'_'", ")", "if", "not", "hasattr", "(", "DuplicateSet", ",", "method_id", ")", ":", "raise", "NotImplementedError", ...
Apply deduplication with the configured strategy. Transform strategy keyword into its method ID, and call it.
[ "Apply", "deduplication", "with", "the", "configured", "strategy", "." ]
f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733
https://github.com/kdeldycke/maildir-deduplicate/blob/f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733/maildir_deduplicate/deduplicate.py#L183-L192
train
kdeldycke/maildir-deduplicate
maildir_deduplicate/deduplicate.py
DuplicateSet.dedupe
def dedupe(self): """ Performs the deduplication and its preliminary checks. """ if len(self.pool) == 1: logger.debug("Ignore set: only one message found.") self.stats['mail_unique'] += 1 self.stats['set_ignored'] += 1 return try: # Fi...
python
def dedupe(self): """ Performs the deduplication and its preliminary checks. """ if len(self.pool) == 1: logger.debug("Ignore set: only one message found.") self.stats['mail_unique'] += 1 self.stats['set_ignored'] += 1 return try: # Fi...
[ "def", "dedupe", "(", "self", ")", ":", "if", "len", "(", "self", ".", "pool", ")", "==", "1", ":", "logger", ".", "debug", "(", "\"Ignore set: only one message found.\"", ")", "self", ".", "stats", "[", "'mail_unique'", "]", "+=", "1", "self", ".", "s...
Performs the deduplication and its preliminary checks.
[ "Performs", "the", "deduplication", "and", "its", "preliminary", "checks", "." ]
f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733
https://github.com/kdeldycke/maildir-deduplicate/blob/f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733/maildir_deduplicate/deduplicate.py#L194-L224
train
kdeldycke/maildir-deduplicate
maildir_deduplicate/deduplicate.py
DuplicateSet.delete_older
def delete_older(self): """ Delete all older duplicates. Only keeps the subset sharing the most recent timestamp. """ logger.info( "Deleting all mails strictly older than the {} timestamp..." "".format(self.newest_timestamp)) # Select candidates for delet...
python
def delete_older(self): """ Delete all older duplicates. Only keeps the subset sharing the most recent timestamp. """ logger.info( "Deleting all mails strictly older than the {} timestamp..." "".format(self.newest_timestamp)) # Select candidates for delet...
[ "def", "delete_older", "(", "self", ")", ":", "logger", ".", "info", "(", "\"Deleting all mails strictly older than the {} timestamp...\"", "\"\"", ".", "format", "(", "self", ".", "newest_timestamp", ")", ")", "candidates", "=", "[", "mail", "for", "mail", "in", ...
Delete all older duplicates. Only keeps the subset sharing the most recent timestamp.
[ "Delete", "all", "older", "duplicates", "." ]
f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733
https://github.com/kdeldycke/maildir-deduplicate/blob/f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733/maildir_deduplicate/deduplicate.py#L228-L247
train
kdeldycke/maildir-deduplicate
maildir_deduplicate/deduplicate.py
DuplicateSet.delete_oldest
def delete_oldest(self): """ Delete all the oldest duplicates. Keeps all mail of the duplicate set but those sharing the oldest timestamp. """ logger.info( "Deleting all mails sharing the oldest {} timestamp...".format( self.oldest_timestamp)) ...
python
def delete_oldest(self): """ Delete all the oldest duplicates. Keeps all mail of the duplicate set but those sharing the oldest timestamp. """ logger.info( "Deleting all mails sharing the oldest {} timestamp...".format( self.oldest_timestamp)) ...
[ "def", "delete_oldest", "(", "self", ")", ":", "logger", ".", "info", "(", "\"Deleting all mails sharing the oldest {} timestamp...\"", ".", "format", "(", "self", ".", "oldest_timestamp", ")", ")", "candidates", "=", "[", "mail", "for", "mail", "in", "self", "....
Delete all the oldest duplicates. Keeps all mail of the duplicate set but those sharing the oldest timestamp.
[ "Delete", "all", "the", "oldest", "duplicates", "." ]
f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733
https://github.com/kdeldycke/maildir-deduplicate/blob/f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733/maildir_deduplicate/deduplicate.py#L249-L270
train
kdeldycke/maildir-deduplicate
maildir_deduplicate/deduplicate.py
DuplicateSet.delete_bigger
def delete_bigger(self): """ Delete all bigger duplicates. Only keeps the subset sharing the smallest size. """ logger.info( "Deleting all mails strictly bigger than {} bytes...".format( self.smallest_size)) # Select candidates for deletion. c...
python
def delete_bigger(self): """ Delete all bigger duplicates. Only keeps the subset sharing the smallest size. """ logger.info( "Deleting all mails strictly bigger than {} bytes...".format( self.smallest_size)) # Select candidates for deletion. c...
[ "def", "delete_bigger", "(", "self", ")", ":", "logger", ".", "info", "(", "\"Deleting all mails strictly bigger than {} bytes...\"", ".", "format", "(", "self", ".", "smallest_size", ")", ")", "candidates", "=", "[", "mail", "for", "mail", "in", "self", ".", ...
Delete all bigger duplicates. Only keeps the subset sharing the smallest size.
[ "Delete", "all", "bigger", "duplicates", "." ]
f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733
https://github.com/kdeldycke/maildir-deduplicate/blob/f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733/maildir_deduplicate/deduplicate.py#L361-L380
train
kdeldycke/maildir-deduplicate
maildir_deduplicate/deduplicate.py
DuplicateSet.delete_biggest
def delete_biggest(self): """ Delete all the biggest duplicates. Keeps all mail of the duplicate set but those sharing the biggest size. """ logger.info( "Deleting all mails sharing the biggest size of {} bytes..." "".format(self.biggest_size)) # ...
python
def delete_biggest(self): """ Delete all the biggest duplicates. Keeps all mail of the duplicate set but those sharing the biggest size. """ logger.info( "Deleting all mails sharing the biggest size of {} bytes..." "".format(self.biggest_size)) # ...
[ "def", "delete_biggest", "(", "self", ")", ":", "logger", ".", "info", "(", "\"Deleting all mails sharing the biggest size of {} bytes...\"", "\"\"", ".", "format", "(", "self", ".", "biggest_size", ")", ")", "candidates", "=", "[", "mail", "for", "mail", "in", ...
Delete all the biggest duplicates. Keeps all mail of the duplicate set but those sharing the biggest size.
[ "Delete", "all", "the", "biggest", "duplicates", "." ]
f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733
https://github.com/kdeldycke/maildir-deduplicate/blob/f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733/maildir_deduplicate/deduplicate.py#L382-L403
train
kdeldycke/maildir-deduplicate
maildir_deduplicate/deduplicate.py
DuplicateSet.delete_matching_path
def delete_matching_path(self): """ Delete all duplicates whose file path match the regexp. """ logger.info( "Deleting all mails with file path matching the {} regexp..." "".format(self.conf.regexp.pattern)) # Select candidates for deletion. candidates = [ ...
python
def delete_matching_path(self): """ Delete all duplicates whose file path match the regexp. """ logger.info( "Deleting all mails with file path matching the {} regexp..." "".format(self.conf.regexp.pattern)) # Select candidates for deletion. candidates = [ ...
[ "def", "delete_matching_path", "(", "self", ")", ":", "logger", ".", "info", "(", "\"Deleting all mails with file path matching the {} regexp...\"", "\"\"", ".", "format", "(", "self", ".", "conf", ".", "regexp", ".", "pattern", ")", ")", "candidates", "=", "[", ...
Delete all duplicates whose file path match the regexp.
[ "Delete", "all", "duplicates", "whose", "file", "path", "match", "the", "regexp", "." ]
f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733
https://github.com/kdeldycke/maildir-deduplicate/blob/f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733/maildir_deduplicate/deduplicate.py#L405-L422
train
kdeldycke/maildir-deduplicate
maildir_deduplicate/deduplicate.py
Deduplicate.canonical_path
def canonical_path(path): """ Return a normalized, canonical path to a file or folder. Removes all symbolic links encountered in the path to detect natural mail and maildir duplicates on the fly. """ return os.path.normcase(os.path.realpath(os.path.abspath( os.path.e...
python
def canonical_path(path): """ Return a normalized, canonical path to a file or folder. Removes all symbolic links encountered in the path to detect natural mail and maildir duplicates on the fly. """ return os.path.normcase(os.path.realpath(os.path.abspath( os.path.e...
[ "def", "canonical_path", "(", "path", ")", ":", "return", "os", ".", "path", ".", "normcase", "(", "os", ".", "path", ".", "realpath", "(", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "expanduser", "(", "path", ")", ")", ")", ...
Return a normalized, canonical path to a file or folder. Removes all symbolic links encountered in the path to detect natural mail and maildir duplicates on the fly.
[ "Return", "a", "normalized", "canonical", "path", "to", "a", "file", "or", "folder", "." ]
f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733
https://github.com/kdeldycke/maildir-deduplicate/blob/f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733/maildir_deduplicate/deduplicate.py#L489-L496
train
kdeldycke/maildir-deduplicate
maildir_deduplicate/deduplicate.py
Deduplicate.add_maildir
def add_maildir(self, maildir_path): """ Load up a maildir and compute hash for each mail found. """ maildir_path = self.canonical_path(maildir_path) logger.info("Opening maildir at {} ...".format(maildir_path)) # Maildir parser requires a string, not a unicode, as path. maildir ...
python
def add_maildir(self, maildir_path): """ Load up a maildir and compute hash for each mail found. """ maildir_path = self.canonical_path(maildir_path) logger.info("Opening maildir at {} ...".format(maildir_path)) # Maildir parser requires a string, not a unicode, as path. maildir ...
[ "def", "add_maildir", "(", "self", ",", "maildir_path", ")", ":", "maildir_path", "=", "self", ".", "canonical_path", "(", "maildir_path", ")", "logger", ".", "info", "(", "\"Opening maildir at {} ...\"", ".", "format", "(", "maildir_path", ")", ")", "maildir", ...
Load up a maildir and compute hash for each mail found.
[ "Load", "up", "a", "maildir", "and", "compute", "hash", "for", "each", "mail", "found", "." ]
f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733
https://github.com/kdeldycke/maildir-deduplicate/blob/f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733/maildir_deduplicate/deduplicate.py#L498-L533
train
kdeldycke/maildir-deduplicate
maildir_deduplicate/deduplicate.py
Deduplicate.run
def run(self): """ Run the deduplication process. We apply the removal strategy one duplicate set at a time to keep memory footprint low and make the log of actions easier to read. """ logger.info( "The {} strategy will be applied on each duplicate set.".format( ...
python
def run(self): """ Run the deduplication process. We apply the removal strategy one duplicate set at a time to keep memory footprint low and make the log of actions easier to read. """ logger.info( "The {} strategy will be applied on each duplicate set.".format( ...
[ "def", "run", "(", "self", ")", ":", "logger", ".", "info", "(", "\"The {} strategy will be applied on each duplicate set.\"", ".", "format", "(", "self", ".", "conf", ".", "strategy", ")", ")", "self", ".", "stats", "[", "'set_total'", "]", "=", "len", "(",...
Run the deduplication process. We apply the removal strategy one duplicate set at a time to keep memory footprint low and make the log of actions easier to read.
[ "Run", "the", "deduplication", "process", "." ]
f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733
https://github.com/kdeldycke/maildir-deduplicate/blob/f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733/maildir_deduplicate/deduplicate.py#L535-L557
train
kdeldycke/maildir-deduplicate
maildir_deduplicate/deduplicate.py
Deduplicate.report
def report(self): """ Print user-friendly statistics and metrics. """ table = [["Mails", "Metric"]] table.append(["Found", self.stats['mail_found']]) table.append(["Skipped", self.stats['mail_skipped']]) table.append(["Rejected", self.stats['mail_rejected']]) table.append...
python
def report(self): """ Print user-friendly statistics and metrics. """ table = [["Mails", "Metric"]] table.append(["Found", self.stats['mail_found']]) table.append(["Skipped", self.stats['mail_skipped']]) table.append(["Rejected", self.stats['mail_rejected']]) table.append...
[ "def", "report", "(", "self", ")", ":", "table", "=", "[", "[", "\"Mails\"", ",", "\"Metric\"", "]", "]", "table", ".", "append", "(", "[", "\"Found\"", ",", "self", ".", "stats", "[", "'mail_found'", "]", "]", ")", "table", ".", "append", "(", "["...
Print user-friendly statistics and metrics.
[ "Print", "user", "-", "friendly", "statistics", "and", "metrics", "." ]
f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733
https://github.com/kdeldycke/maildir-deduplicate/blob/f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733/maildir_deduplicate/deduplicate.py#L559-L608
train
kdeldycke/maildir-deduplicate
maildir_deduplicate/cli.py
cli
def cli(ctx): """ CLI for maildirs content analysis and deletion. """ level = logger.level try: level_to_name = logging._levelToName # Fallback to pre-Python 3.4 internals. except AttributeError: level_to_name = logging._levelNames level_name = level_to_name.get(level, level) ...
python
def cli(ctx): """ CLI for maildirs content analysis and deletion. """ level = logger.level try: level_to_name = logging._levelToName # Fallback to pre-Python 3.4 internals. except AttributeError: level_to_name = logging._levelNames level_name = level_to_name.get(level, level) ...
[ "def", "cli", "(", "ctx", ")", ":", "level", "=", "logger", ".", "level", "try", ":", "level_to_name", "=", "logging", ".", "_levelToName", "except", "AttributeError", ":", "level_to_name", "=", "logging", ".", "_levelNames", "level_name", "=", "level_to_name"...
CLI for maildirs content analysis and deletion.
[ "CLI", "for", "maildirs", "content", "analysis", "and", "deletion", "." ]
f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733
https://github.com/kdeldycke/maildir-deduplicate/blob/f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733/maildir_deduplicate/cli.py#L59-L76
train
kdeldycke/maildir-deduplicate
maildir_deduplicate/cli.py
validate_regexp
def validate_regexp(ctx, param, value): """ Validate and compile regular expression. """ if value: try: value = re.compile(value) except ValueError: raise click.BadParameter('invalid regular expression.') return value
python
def validate_regexp(ctx, param, value): """ Validate and compile regular expression. """ if value: try: value = re.compile(value) except ValueError: raise click.BadParameter('invalid regular expression.') return value
[ "def", "validate_regexp", "(", "ctx", ",", "param", ",", "value", ")", ":", "if", "value", ":", "try", ":", "value", "=", "re", ".", "compile", "(", "value", ")", "except", "ValueError", ":", "raise", "click", ".", "BadParameter", "(", "'invalid regular ...
Validate and compile regular expression.
[ "Validate", "and", "compile", "regular", "expression", "." ]
f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733
https://github.com/kdeldycke/maildir-deduplicate/blob/f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733/maildir_deduplicate/cli.py#L79-L86
train
kdeldycke/maildir-deduplicate
maildir_deduplicate/cli.py
validate_maildirs
def validate_maildirs(ctx, param, value): """ Check that folders are maildirs. """ for path in value: for subdir in MD_SUBDIRS: if not os.path.isdir(os.path.join(path, subdir)): raise click.BadParameter( '{} is not a maildir (missing {!r} sub-directory).'....
python
def validate_maildirs(ctx, param, value): """ Check that folders are maildirs. """ for path in value: for subdir in MD_SUBDIRS: if not os.path.isdir(os.path.join(path, subdir)): raise click.BadParameter( '{} is not a maildir (missing {!r} sub-directory).'....
[ "def", "validate_maildirs", "(", "ctx", ",", "param", ",", "value", ")", ":", "for", "path", "in", "value", ":", "for", "subdir", "in", "MD_SUBDIRS", ":", "if", "not", "os", ".", "path", ".", "isdir", "(", "os", ".", "path", ".", "join", "(", "path...
Check that folders are maildirs.
[ "Check", "that", "folders", "are", "maildirs", "." ]
f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733
https://github.com/kdeldycke/maildir-deduplicate/blob/f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733/maildir_deduplicate/cli.py#L89-L97
train
kdeldycke/maildir-deduplicate
maildir_deduplicate/cli.py
deduplicate
def deduplicate( ctx, strategy, time_source, regexp, dry_run, message_id, size_threshold, content_threshold, show_diff, maildirs): """ Deduplicate mails from a set of maildir folders. Run a first pass computing the canonical hash of each encountered mail from their headers, then a second pa...
python
def deduplicate( ctx, strategy, time_source, regexp, dry_run, message_id, size_threshold, content_threshold, show_diff, maildirs): """ Deduplicate mails from a set of maildir folders. Run a first pass computing the canonical hash of each encountered mail from their headers, then a second pa...
[ "def", "deduplicate", "(", "ctx", ",", "strategy", ",", "time_source", ",", "regexp", ",", "dry_run", ",", "message_id", ",", "size_threshold", ",", "content_threshold", ",", "show_diff", ",", "maildirs", ")", ":", "if", "not", "maildirs", ":", "click", ".",...
Deduplicate mails from a set of maildir folders. Run a first pass computing the canonical hash of each encountered mail from their headers, then a second pass to apply the deletion strategy on each subset of duplicate mails. \b Removal strategies for each subsets of duplicate mails: - delete...
[ "Deduplicate", "mails", "from", "a", "set", "of", "maildir", "folders", "." ]
f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733
https://github.com/kdeldycke/maildir-deduplicate/blob/f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733/maildir_deduplicate/cli.py#L140-L211
train
kdeldycke/maildir-deduplicate
maildir_deduplicate/cli.py
hash
def hash(ctx, message_id, message): """ Take a single mail message and show its canonicalised form and hash. Mainly used to debug message hashing. """ conf = Config(message_id=message_id) mail = Mail(message, conf) logger.info(mail.header_text) logger.info('-' * 70) logger.info('Hash:...
python
def hash(ctx, message_id, message): """ Take a single mail message and show its canonicalised form and hash. Mainly used to debug message hashing. """ conf = Config(message_id=message_id) mail = Mail(message, conf) logger.info(mail.header_text) logger.info('-' * 70) logger.info('Hash:...
[ "def", "hash", "(", "ctx", ",", "message_id", ",", "message", ")", ":", "conf", "=", "Config", "(", "message_id", "=", "message_id", ")", "mail", "=", "Mail", "(", "message", ",", "conf", ")", "logger", ".", "info", "(", "mail", ".", "header_text", "...
Take a single mail message and show its canonicalised form and hash. Mainly used to debug message hashing.
[ "Take", "a", "single", "mail", "message", "and", "show", "its", "canonicalised", "form", "and", "hash", "." ]
f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733
https://github.com/kdeldycke/maildir-deduplicate/blob/f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733/maildir_deduplicate/cli.py#L224-L235
train
kdeldycke/maildir-deduplicate
setup.py
read_file
def read_file(*relative_path_elements): """ Return content of a file relative to this ``setup.py``. """ file_path = path.join(path.dirname(__file__), *relative_path_elements) return io.open(file_path, encoding='utf8').read().strip()
python
def read_file(*relative_path_elements): """ Return content of a file relative to this ``setup.py``. """ file_path = path.join(path.dirname(__file__), *relative_path_elements) return io.open(file_path, encoding='utf8').read().strip()
[ "def", "read_file", "(", "*", "relative_path_elements", ")", ":", "file_path", "=", "path", ".", "join", "(", "path", ".", "dirname", "(", "__file__", ")", ",", "*", "relative_path_elements", ")", "return", "io", ".", "open", "(", "file_path", ",", "encodi...
Return content of a file relative to this ``setup.py``.
[ "Return", "content", "of", "a", "file", "relative", "to", "this", "setup", ".", "py", "." ]
f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733
https://github.com/kdeldycke/maildir-deduplicate/blob/f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733/setup.py#L68-L71
train
kdeldycke/maildir-deduplicate
maildir_deduplicate/mail.py
Mail.message
def message(self): """ Read mail, parse it and return a Message instance. """ logger.debug("Parsing mail at {} ...".format(self.path)) with open(self.path, 'rb') as mail_file: if PY2: message = email.message_from_file(mail_file) else: messa...
python
def message(self): """ Read mail, parse it and return a Message instance. """ logger.debug("Parsing mail at {} ...".format(self.path)) with open(self.path, 'rb') as mail_file: if PY2: message = email.message_from_file(mail_file) else: messa...
[ "def", "message", "(", "self", ")", ":", "logger", ".", "debug", "(", "\"Parsing mail at {} ...\"", ".", "format", "(", "self", ".", "path", ")", ")", "with", "open", "(", "self", ".", "path", ",", "'rb'", ")", "as", "mail_file", ":", "if", "PY2", ":...
Read mail, parse it and return a Message instance.
[ "Read", "mail", "parse", "it", "and", "return", "a", "Message", "instance", "." ]
f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733
https://github.com/kdeldycke/maildir-deduplicate/blob/f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733/maildir_deduplicate/mail.py#L60-L68
train
kdeldycke/maildir-deduplicate
maildir_deduplicate/mail.py
Mail.timestamp
def timestamp(self): """ Compute the normalized canonical timestamp of the mail. """ # XXX ctime does not refer to creation time on POSIX systems, but # rather the last time the inode data changed. Source: # https://userprimary.net/posts/2007/11/18 # /ctime-in-unix-means-last-cha...
python
def timestamp(self): """ Compute the normalized canonical timestamp of the mail. """ # XXX ctime does not refer to creation time on POSIX systems, but # rather the last time the inode data changed. Source: # https://userprimary.net/posts/2007/11/18 # /ctime-in-unix-means-last-cha...
[ "def", "timestamp", "(", "self", ")", ":", "if", "self", ".", "conf", ".", "time_source", "==", "CTIME", ":", "return", "os", ".", "path", ".", "getctime", "(", "self", ".", "path", ")", "return", "email", ".", "utils", ".", "mktime_tz", "(", "email"...
Compute the normalized canonical timestamp of the mail.
[ "Compute", "the", "normalized", "canonical", "timestamp", "of", "the", "mail", "." ]
f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733
https://github.com/kdeldycke/maildir-deduplicate/blob/f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733/maildir_deduplicate/mail.py#L71-L82
train
kdeldycke/maildir-deduplicate
maildir_deduplicate/mail.py
Mail.body_lines
def body_lines(self): """ Return a normalized list of lines from message's body. """ if not self.message.is_multipart(): body = self.message.get_payload(None, decode=True) else: _, _, body = self.message.as_string().partition("\n\n") if isinstance(body, bytes): ...
python
def body_lines(self): """ Return a normalized list of lines from message's body. """ if not self.message.is_multipart(): body = self.message.get_payload(None, decode=True) else: _, _, body = self.message.as_string().partition("\n\n") if isinstance(body, bytes): ...
[ "def", "body_lines", "(", "self", ")", ":", "if", "not", "self", ".", "message", ".", "is_multipart", "(", ")", ":", "body", "=", "self", ".", "message", ".", "get_payload", "(", "None", ",", "decode", "=", "True", ")", "else", ":", "_", ",", "_", ...
Return a normalized list of lines from message's body.
[ "Return", "a", "normalized", "list", "of", "lines", "from", "message", "s", "body", "." ]
f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733
https://github.com/kdeldycke/maildir-deduplicate/blob/f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733/maildir_deduplicate/mail.py#L99-L114
train
kdeldycke/maildir-deduplicate
maildir_deduplicate/mail.py
Mail.subject
def subject(self): """ Normalized subject. Only used for debugging and human-friendly logging. """ # Fetch subject from first message. subject = self.message.get('Subject', '') subject, _ = re.subn(r'\s+', ' ', subject) return subject
python
def subject(self): """ Normalized subject. Only used for debugging and human-friendly logging. """ # Fetch subject from first message. subject = self.message.get('Subject', '') subject, _ = re.subn(r'\s+', ' ', subject) return subject
[ "def", "subject", "(", "self", ")", ":", "subject", "=", "self", ".", "message", ".", "get", "(", "'Subject'", ",", "''", ")", "subject", ",", "_", "=", "re", ".", "subn", "(", "r'\\s+'", ",", "' '", ",", "subject", ")", "return", "subject" ]
Normalized subject. Only used for debugging and human-friendly logging.
[ "Normalized", "subject", "." ]
f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733
https://github.com/kdeldycke/maildir-deduplicate/blob/f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733/maildir_deduplicate/mail.py#L117-L125
train
kdeldycke/maildir-deduplicate
maildir_deduplicate/mail.py
Mail.hash_key
def hash_key(self): """ Returns the canonical hash of a mail. """ if self.conf.message_id: message_id = self.message.get('Message-Id') if message_id: return message_id.strip() logger.error( "No Message-ID in {}: {}".format(self.path, se...
python
def hash_key(self): """ Returns the canonical hash of a mail. """ if self.conf.message_id: message_id = self.message.get('Message-Id') if message_id: return message_id.strip() logger.error( "No Message-ID in {}: {}".format(self.path, se...
[ "def", "hash_key", "(", "self", ")", ":", "if", "self", ".", "conf", ".", "message_id", ":", "message_id", "=", "self", ".", "message", ".", "get", "(", "'Message-Id'", ")", "if", "message_id", ":", "return", "message_id", ".", "strip", "(", ")", "logg...
Returns the canonical hash of a mail.
[ "Returns", "the", "canonical", "hash", "of", "a", "mail", "." ]
f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733
https://github.com/kdeldycke/maildir-deduplicate/blob/f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733/maildir_deduplicate/mail.py#L128-L138
train
kdeldycke/maildir-deduplicate
maildir_deduplicate/mail.py
Mail.canonical_headers
def canonical_headers(self): """ Copy selected headers into a new string. """ canonical_headers = '' for header in HEADERS: if header not in self.message: continue for value in self.message.get_all(header): canonical_value = self.canonica...
python
def canonical_headers(self): """ Copy selected headers into a new string. """ canonical_headers = '' for header in HEADERS: if header not in self.message: continue for value in self.message.get_all(header): canonical_value = self.canonica...
[ "def", "canonical_headers", "(", "self", ")", ":", "canonical_headers", "=", "''", "for", "header", "in", "HEADERS", ":", "if", "header", "not", "in", "self", ".", "message", ":", "continue", "for", "value", "in", "self", ".", "message", ".", "get_all", ...
Copy selected headers into a new string.
[ "Copy", "selected", "headers", "into", "a", "new", "string", "." ]
f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733
https://github.com/kdeldycke/maildir-deduplicate/blob/f1c6ff25b80c6c1a4dc2dc7a65b34d808b0b7733/maildir_deduplicate/mail.py#L148-L178
train
keepkey/python-keepkey
keepkeylib/transport_hid.py
HidTransport.enumerate
def enumerate(cls): """ Return a list of available KeepKey devices. """ devices = {} for d in hid.enumerate(0, 0): vendor_id = d['vendor_id'] product_id = d['product_id'] serial_number = d['serial_number'] interface_number = d['inte...
python
def enumerate(cls): """ Return a list of available KeepKey devices. """ devices = {} for d in hid.enumerate(0, 0): vendor_id = d['vendor_id'] product_id = d['product_id'] serial_number = d['serial_number'] interface_number = d['inte...
[ "def", "enumerate", "(", "cls", ")", ":", "devices", "=", "{", "}", "for", "d", "in", "hid", ".", "enumerate", "(", "0", ",", "0", ")", ":", "vendor_id", "=", "d", "[", "'vendor_id'", "]", "product_id", "=", "d", "[", "'product_id'", "]", "serial_n...
Return a list of available KeepKey devices.
[ "Return", "a", "list", "of", "available", "KeepKey", "devices", "." ]
8318e3a8c4025d499342130ce4305881a325c013
https://github.com/keepkey/python-keepkey/blob/8318e3a8c4025d499342130ce4305881a325c013/keepkeylib/transport_hid.py#L75-L102
train
keepkey/python-keepkey
keepkeylib/transport_hid.py
HidTransport.is_connected
def is_connected(self): """ Check if the device is still connected. """ for d in hid.enumerate(0, 0): if d['path'] == self.device: return True return False
python
def is_connected(self): """ Check if the device is still connected. """ for d in hid.enumerate(0, 0): if d['path'] == self.device: return True return False
[ "def", "is_connected", "(", "self", ")", ":", "for", "d", "in", "hid", ".", "enumerate", "(", "0", ",", "0", ")", ":", "if", "d", "[", "'path'", "]", "==", "self", ".", "device", ":", "return", "True", "return", "False" ]
Check if the device is still connected.
[ "Check", "if", "the", "device", "is", "still", "connected", "." ]
8318e3a8c4025d499342130ce4305881a325c013
https://github.com/keepkey/python-keepkey/blob/8318e3a8c4025d499342130ce4305881a325c013/keepkeylib/transport_hid.py#L104-L111
train
keepkey/python-keepkey
keepkeylib/transport.py
Transport.session_end
def session_end(self): """ End a session. Se session_begin for an in depth description of TREZOR sessions. """ self.session_depth -= 1 self.session_depth = max(0, self.session_depth) if self.session_depth == 0: self._session_end()
python
def session_end(self): """ End a session. Se session_begin for an in depth description of TREZOR sessions. """ self.session_depth -= 1 self.session_depth = max(0, self.session_depth) if self.session_depth == 0: self._session_end()
[ "def", "session_end", "(", "self", ")", ":", "self", ".", "session_depth", "-=", "1", "self", ".", "session_depth", "=", "max", "(", "0", ",", "self", ".", "session_depth", ")", "if", "self", ".", "session_depth", "==", "0", ":", "self", ".", "_session...
End a session. Se session_begin for an in depth description of TREZOR sessions.
[ "End", "a", "session", ".", "Se", "session_begin", "for", "an", "in", "depth", "description", "of", "TREZOR", "sessions", "." ]
8318e3a8c4025d499342130ce4305881a325c013
https://github.com/keepkey/python-keepkey/blob/8318e3a8c4025d499342130ce4305881a325c013/keepkeylib/transport.py#L48-L55
train
keepkey/python-keepkey
keepkeylib/transport.py
Transport.read
def read(self): """ If there is data available to be read from the transport, reads the data and tries to parse it as a protobuf message. If the parsing succeeds, return a protobuf object. Otherwise, returns None. """ if not self.ready_to_read(): return None ...
python
def read(self): """ If there is data available to be read from the transport, reads the data and tries to parse it as a protobuf message. If the parsing succeeds, return a protobuf object. Otherwise, returns None. """ if not self.ready_to_read(): return None ...
[ "def", "read", "(", "self", ")", ":", "if", "not", "self", ".", "ready_to_read", "(", ")", ":", "return", "None", "data", "=", "self", ".", "_read", "(", ")", "if", "data", "is", "None", ":", "return", "None", "return", "self", ".", "_parse_message",...
If there is data available to be read from the transport, reads the data and tries to parse it as a protobuf message. If the parsing succeeds, return a protobuf object. Otherwise, returns None.
[ "If", "there", "is", "data", "available", "to", "be", "read", "from", "the", "transport", "reads", "the", "data", "and", "tries", "to", "parse", "it", "as", "a", "protobuf", "message", ".", "If", "the", "parsing", "succeeds", "return", "a", "protobuf", "...
8318e3a8c4025d499342130ce4305881a325c013
https://github.com/keepkey/python-keepkey/blob/8318e3a8c4025d499342130ce4305881a325c013/keepkeylib/transport.py#L71-L83
train
keepkey/python-keepkey
keepkeylib/transport.py
Transport.read_blocking
def read_blocking(self): """ Same as read, except blocks untill data is available to be read. """ while True: data = self._read() if data != None: break return self._parse_message(data)
python
def read_blocking(self): """ Same as read, except blocks untill data is available to be read. """ while True: data = self._read() if data != None: break return self._parse_message(data)
[ "def", "read_blocking", "(", "self", ")", ":", "while", "True", ":", "data", "=", "self", ".", "_read", "(", ")", "if", "data", "!=", "None", ":", "break", "return", "self", ".", "_parse_message", "(", "data", ")" ]
Same as read, except blocks untill data is available to be read.
[ "Same", "as", "read", "except", "blocks", "untill", "data", "is", "available", "to", "be", "read", "." ]
8318e3a8c4025d499342130ce4305881a325c013
https://github.com/keepkey/python-keepkey/blob/8318e3a8c4025d499342130ce4305881a325c013/keepkeylib/transport.py#L85-L94
train
keepkey/python-keepkey
keepkeylib/filecache.py
_get_cache_name
def _get_cache_name(function): """ returns a name for the module's cache db. """ module_name = _inspect.getfile(function) module_name = _os.path.abspath(module_name) cache_name = module_name # fix for '<string>' or '<stdin>' in exec or interpreter usage. cache_name = cache_name.replace(...
python
def _get_cache_name(function): """ returns a name for the module's cache db. """ module_name = _inspect.getfile(function) module_name = _os.path.abspath(module_name) cache_name = module_name # fix for '<string>' or '<stdin>' in exec or interpreter usage. cache_name = cache_name.replace(...
[ "def", "_get_cache_name", "(", "function", ")", ":", "module_name", "=", "_inspect", ".", "getfile", "(", "function", ")", "module_name", "=", "_os", ".", "path", ".", "abspath", "(", "module_name", ")", "cache_name", "=", "module_name", "cache_name", "=", "...
returns a name for the module's cache db.
[ "returns", "a", "name", "for", "the", "module", "s", "cache", "db", "." ]
8318e3a8c4025d499342130ce4305881a325c013
https://github.com/keepkey/python-keepkey/blob/8318e3a8c4025d499342130ce4305881a325c013/keepkeylib/filecache.py#L81-L98
train
keepkey/python-keepkey
keepkeylib/filecache.py
filecache
def filecache(seconds_of_validity=None, fail_silently=False): ''' filecache is called and the decorator should be returned. ''' def filecache_decorator(function): @_functools.wraps(function) def function_with_cache(*args, **kwargs): try: key = _args_key(functi...
python
def filecache(seconds_of_validity=None, fail_silently=False): ''' filecache is called and the decorator should be returned. ''' def filecache_decorator(function): @_functools.wraps(function) def function_with_cache(*args, **kwargs): try: key = _args_key(functi...
[ "def", "filecache", "(", "seconds_of_validity", "=", "None", ",", "fail_silently", "=", "False", ")", ":", "def", "filecache_decorator", "(", "function", ")", ":", "@", "_functools", ".", "wraps", "(", "function", ")", "def", "function_with_cache", "(", "*", ...
filecache is called and the decorator should be returned.
[ "filecache", "is", "called", "and", "the", "decorator", "should", "be", "returned", "." ]
8318e3a8c4025d499342130ce4305881a325c013
https://github.com/keepkey/python-keepkey/blob/8318e3a8c4025d499342130ce4305881a325c013/keepkeylib/filecache.py#L129-L187
train
juju/python-libjuju
juju/model.py
ModelState.entity_data
def entity_data(self, entity_type, entity_id, history_index): """Return the data dict for an entity at a specific index of its history. """ return self.entity_history(entity_type, entity_id)[history_index]
python
def entity_data(self, entity_type, entity_id, history_index): """Return the data dict for an entity at a specific index of its history. """ return self.entity_history(entity_type, entity_id)[history_index]
[ "def", "entity_data", "(", "self", ",", "entity_type", ",", "entity_id", ",", "history_index", ")", ":", "return", "self", ".", "entity_history", "(", "entity_type", ",", "entity_id", ")", "[", "history_index", "]" ]
Return the data dict for an entity at a specific index of its history.
[ "Return", "the", "data", "dict", "for", "an", "entity", "at", "a", "specific", "index", "of", "its", "history", "." ]
58f0011f4c57cd68830258952fa952eaadca6b38
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L164-L169
train
juju/python-libjuju
juju/model.py
ModelState.get_entity
def get_entity( self, entity_type, entity_id, history_index=-1, connected=True): """Return an object instance for the given entity_type and id. By default the object state matches the most recent state from Juju. To get an instance of the object in an older state, pass histo...
python
def get_entity( self, entity_type, entity_id, history_index=-1, connected=True): """Return an object instance for the given entity_type and id. By default the object state matches the most recent state from Juju. To get an instance of the object in an older state, pass histo...
[ "def", "get_entity", "(", "self", ",", "entity_type", ",", "entity_id", ",", "history_index", "=", "-", "1", ",", "connected", "=", "True", ")", ":", "if", "history_index", "<", "0", "and", "history_index", "!=", "-", "1", ":", "history_index", "+=", "le...
Return an object instance for the given entity_type and id. By default the object state matches the most recent state from Juju. To get an instance of the object in an older state, pass history_index, an index into the history deque for the entity.
[ "Return", "an", "object", "instance", "for", "the", "given", "entity_type", "and", "id", "." ]
58f0011f4c57cd68830258952fa952eaadca6b38
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L197-L220
train
juju/python-libjuju
juju/model.py
ModelEntity.on_change
def on_change(self, callable_): """Add a change observer to this entity. """ self.model.add_observer( callable_, self.entity_type, 'change', self.entity_id)
python
def on_change(self, callable_): """Add a change observer to this entity. """ self.model.add_observer( callable_, self.entity_type, 'change', self.entity_id)
[ "def", "on_change", "(", "self", ",", "callable_", ")", ":", "self", ".", "model", ".", "add_observer", "(", "callable_", ",", "self", ".", "entity_type", ",", "'change'", ",", "self", ".", "entity_id", ")" ]
Add a change observer to this entity.
[ "Add", "a", "change", "observer", "to", "this", "entity", "." ]
58f0011f4c57cd68830258952fa952eaadca6b38
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L265-L270
train
juju/python-libjuju
juju/model.py
ModelEntity.on_remove
def on_remove(self, callable_): """Add a remove observer to this entity. """ self.model.add_observer( callable_, self.entity_type, 'remove', self.entity_id)
python
def on_remove(self, callable_): """Add a remove observer to this entity. """ self.model.add_observer( callable_, self.entity_type, 'remove', self.entity_id)
[ "def", "on_remove", "(", "self", ",", "callable_", ")", ":", "self", ".", "model", ".", "add_observer", "(", "callable_", ",", "self", ".", "entity_type", ",", "'remove'", ",", "self", ".", "entity_id", ")" ]
Add a remove observer to this entity.
[ "Add", "a", "remove", "observer", "to", "this", "entity", "." ]
58f0011f4c57cd68830258952fa952eaadca6b38
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L272-L277
train
juju/python-libjuju
juju/model.py
ModelEntity.dead
def dead(self): """Returns True if this entity no longer exists in the underlying model. """ return ( self.data is None or self.model.state.entity_data( self.entity_type, self.entity_id, -1) is None )
python
def dead(self): """Returns True if this entity no longer exists in the underlying model. """ return ( self.data is None or self.model.state.entity_data( self.entity_type, self.entity_id, -1) is None )
[ "def", "dead", "(", "self", ")", ":", "return", "(", "self", ".", "data", "is", "None", "or", "self", ".", "model", ".", "state", ".", "entity_data", "(", "self", ".", "entity_type", ",", "self", ".", "entity_id", ",", "-", "1", ")", "is", "None", ...
Returns True if this entity no longer exists in the underlying model.
[ "Returns", "True", "if", "this", "entity", "no", "longer", "exists", "in", "the", "underlying", "model", "." ]
58f0011f4c57cd68830258952fa952eaadca6b38
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L300-L309
train
juju/python-libjuju
juju/model.py
ModelEntity.previous
def previous(self): """Return a copy of this object as was at its previous state in history. Returns None if this object is new (and therefore has no history). The returned object is always "disconnected", i.e. does not receive live updates. """ return self.mod...
python
def previous(self): """Return a copy of this object as was at its previous state in history. Returns None if this object is new (and therefore has no history). The returned object is always "disconnected", i.e. does not receive live updates. """ return self.mod...
[ "def", "previous", "(", "self", ")", ":", "return", "self", ".", "model", ".", "state", ".", "get_entity", "(", "self", ".", "entity_type", ",", "self", ".", "entity_id", ",", "self", ".", "_history_index", "-", "1", ",", "connected", "=", "False", ")"...
Return a copy of this object as was at its previous state in history. Returns None if this object is new (and therefore has no history). The returned object is always "disconnected", i.e. does not receive live updates.
[ "Return", "a", "copy", "of", "this", "object", "as", "was", "at", "its", "previous", "state", "in", "history", "." ]
58f0011f4c57cd68830258952fa952eaadca6b38
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L343-L355
train
juju/python-libjuju
juju/model.py
ModelEntity.next
def next(self): """Return a copy of this object at its next state in history. Returns None if this object is already the latest. The returned object is "disconnected", i.e. does not receive live updates, unless it is current (latest). """ if self._history_index...
python
def next(self): """Return a copy of this object at its next state in history. Returns None if this object is already the latest. The returned object is "disconnected", i.e. does not receive live updates, unless it is current (latest). """ if self._history_index...
[ "def", "next", "(", "self", ")", ":", "if", "self", ".", "_history_index", "==", "-", "1", ":", "return", "None", "new_index", "=", "self", ".", "_history_index", "+", "1", "connected", "=", "(", "new_index", "==", "len", "(", "self", ".", "model", "...
Return a copy of this object at its next state in history. Returns None if this object is already the latest. The returned object is "disconnected", i.e. does not receive live updates, unless it is current (latest).
[ "Return", "a", "copy", "of", "this", "object", "at", "its", "next", "state", "in", "history", "." ]
58f0011f4c57cd68830258952fa952eaadca6b38
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L357-L377
train
juju/python-libjuju
juju/model.py
Model.connect
async def connect(self, *args, **kwargs): """Connect to a juju model. This supports two calling conventions: The model and (optionally) authentication information can be taken from the data files created by the Juju CLI. This convention will be used if a ``model_name`` is spec...
python
async def connect(self, *args, **kwargs): """Connect to a juju model. This supports two calling conventions: The model and (optionally) authentication information can be taken from the data files created by the Juju CLI. This convention will be used if a ``model_name`` is spec...
[ "async", "def", "connect", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "await", "self", ".", "disconnect", "(", ")", "if", "'endpoint'", "not", "in", "kwargs", "and", "len", "(", "args", ")", "<", "2", ":", "if", "args", "and", ...
Connect to a juju model. This supports two calling conventions: The model and (optionally) authentication information can be taken from the data files created by the Juju CLI. This convention will be used if a ``model_name`` is specified, or if the ``endpoint`` and ``uuid`` ar...
[ "Connect", "to", "a", "juju", "model", "." ]
58f0011f4c57cd68830258952fa952eaadca6b38
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L465-L547
train
juju/python-libjuju
juju/model.py
Model.add_local_charm_dir
async def add_local_charm_dir(self, charm_dir, series): """Upload a local charm to the model. This will automatically generate an archive from the charm dir. :param charm_dir: Path to the charm directory :param series: Charm series """ fh = tempfile.NamedTempor...
python
async def add_local_charm_dir(self, charm_dir, series): """Upload a local charm to the model. This will automatically generate an archive from the charm dir. :param charm_dir: Path to the charm directory :param series: Charm series """ fh = tempfile.NamedTempor...
[ "async", "def", "add_local_charm_dir", "(", "self", ",", "charm_dir", ",", "series", ")", ":", "fh", "=", "tempfile", ".", "NamedTemporaryFile", "(", ")", "CharmArchiveGenerator", "(", "charm_dir", ")", ".", "make_archive", "(", "fh", ".", "name", ")", "with...
Upload a local charm to the model. This will automatically generate an archive from the charm dir. :param charm_dir: Path to the charm directory :param series: Charm series
[ "Upload", "a", "local", "charm", "to", "the", "model", "." ]
58f0011f4c57cd68830258952fa952eaadca6b38
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L597-L615
train
juju/python-libjuju
juju/model.py
Model.add_local_charm
def add_local_charm(self, charm_file, series, size=None): """Upload a local charm archive to the model. Returns the 'local:...' url that should be used to deploy the charm. :param charm_file: Path to charm zip archive :param series: Charm series :param size: Size of the archive...
python
def add_local_charm(self, charm_file, series, size=None): """Upload a local charm archive to the model. Returns the 'local:...' url that should be used to deploy the charm. :param charm_file: Path to charm zip archive :param series: Charm series :param size: Size of the archive...
[ "def", "add_local_charm", "(", "self", ",", "charm_file", ",", "series", ",", "size", "=", "None", ")", ":", "conn", ",", "headers", ",", "path_prefix", "=", "self", ".", "connection", "(", ")", ".", "https_connection", "(", ")", "path", "=", "\"%s/charm...
Upload a local charm archive to the model. Returns the 'local:...' url that should be used to deploy the charm. :param charm_file: Path to charm zip archive :param series: Charm series :param size: Size of the archive, in bytes :return str: 'local:...' url for deploying the cha...
[ "Upload", "a", "local", "charm", "archive", "to", "the", "model", "." ]
58f0011f4c57cd68830258952fa952eaadca6b38
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L617-L648
train
juju/python-libjuju
juju/model.py
Model.all_units_idle
def all_units_idle(self): """Return True if all units are idle. """ for unit in self.units.values(): unit_status = unit.data['agent-status']['current'] if unit_status != 'idle': return False return True
python
def all_units_idle(self): """Return True if all units are idle. """ for unit in self.units.values(): unit_status = unit.data['agent-status']['current'] if unit_status != 'idle': return False return True
[ "def", "all_units_idle", "(", "self", ")", ":", "for", "unit", "in", "self", ".", "units", ".", "values", "(", ")", ":", "unit_status", "=", "unit", ".", "data", "[", "'agent-status'", "]", "[", "'current'", "]", "if", "unit_status", "!=", "'idle'", ":...
Return True if all units are idle.
[ "Return", "True", "if", "all", "units", "are", "idle", "." ]
58f0011f4c57cd68830258952fa952eaadca6b38
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L650-L658
train
juju/python-libjuju
juju/model.py
Model.reset
async def reset(self, force=False): """Reset the model to a clean state. :param bool force: Force-terminate machines. This returns only after the model has reached a clean state. "Clean" means no applications or machines exist in the model. """ log.debug('Resetting mod...
python
async def reset(self, force=False): """Reset the model to a clean state. :param bool force: Force-terminate machines. This returns only after the model has reached a clean state. "Clean" means no applications or machines exist in the model. """ log.debug('Resetting mod...
[ "async", "def", "reset", "(", "self", ",", "force", "=", "False", ")", ":", "log", ".", "debug", "(", "'Resetting model'", ")", "for", "app", "in", "self", ".", "applications", ".", "values", "(", ")", ":", "await", "app", ".", "destroy", "(", ")", ...
Reset the model to a clean state. :param bool force: Force-terminate machines. This returns only after the model has reached a clean state. "Clean" means no applications or machines exist in the model.
[ "Reset", "the", "model", "to", "a", "clean", "state", "." ]
58f0011f4c57cd68830258952fa952eaadca6b38
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L660-L676
train
juju/python-libjuju
juju/model.py
Model.get_info
async def get_info(self): """Return a client.ModelInfo object for this Model. Retrieves latest info for this Model from the api server. The return value is cached on the Model.info attribute so that the valued may be accessed again without another api call, if desired. ...
python
async def get_info(self): """Return a client.ModelInfo object for this Model. Retrieves latest info for this Model from the api server. The return value is cached on the Model.info attribute so that the valued may be accessed again without another api call, if desired. ...
[ "async", "def", "get_info", "(", "self", ")", ":", "facade", "=", "client", ".", "ClientFacade", ".", "from_connection", "(", "self", ".", "connection", "(", ")", ")", "self", ".", "_info", "=", "await", "facade", ".", "ModelInfo", "(", ")", "log", "."...
Return a client.ModelInfo object for this Model. Retrieves latest info for this Model from the api server. The return value is cached on the Model.info attribute so that the valued may be accessed again without another api call, if desired. This method is called automatically w...
[ "Return", "a", "client", ".", "ModelInfo", "object", "for", "this", "Model", "." ]
58f0011f4c57cd68830258952fa952eaadca6b38
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L731-L749
train
juju/python-libjuju
juju/model.py
Model.add_observer
def add_observer( self, callable_, entity_type=None, action=None, entity_id=None, predicate=None): """Register an "on-model-change" callback Once the model is connected, ``callable_`` will be called each time the model changes. ``callable_`` should be Awaitable a...
python
def add_observer( self, callable_, entity_type=None, action=None, entity_id=None, predicate=None): """Register an "on-model-change" callback Once the model is connected, ``callable_`` will be called each time the model changes. ``callable_`` should be Awaitable a...
[ "def", "add_observer", "(", "self", ",", "callable_", ",", "entity_type", "=", "None", ",", "action", "=", "None", ",", "entity_id", "=", "None", ",", "predicate", "=", "None", ")", ":", "observer", "=", "_Observer", "(", "callable_", ",", "entity_type", ...
Register an "on-model-change" callback Once the model is connected, ``callable_`` will be called each time the model changes. ``callable_`` should be Awaitable and accept the following positional arguments: delta - An instance of :class:`juju.delta.EntityDelta` cont...
[ "Register", "an", "on", "-", "model", "-", "change", "callback" ]
58f0011f4c57cd68830258952fa952eaadca6b38
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L759-L797
train
juju/python-libjuju
juju/model.py
Model._watch
def _watch(self): """Start an asynchronous watch against this model. See :meth:`add_observer` to register an onchange callback. """ async def _all_watcher(): try: allwatcher = client.AllWatcherFacade.from_connection( self.connection()) ...
python
def _watch(self): """Start an asynchronous watch against this model. See :meth:`add_observer` to register an onchange callback. """ async def _all_watcher(): try: allwatcher = client.AllWatcherFacade.from_connection( self.connection()) ...
[ "def", "_watch", "(", "self", ")", ":", "async", "def", "_all_watcher", "(", ")", ":", "try", ":", "allwatcher", "=", "client", ".", "AllWatcherFacade", ".", "from_connection", "(", "self", ".", "connection", "(", ")", ")", "while", "not", "self", ".", ...
Start an asynchronous watch against this model. See :meth:`add_observer` to register an onchange callback.
[ "Start", "an", "asynchronous", "watch", "against", "this", "model", "." ]
58f0011f4c57cd68830258952fa952eaadca6b38
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L799-L873
train
juju/python-libjuju
juju/model.py
Model._notify_observers
async def _notify_observers(self, delta, old_obj, new_obj): """Call observing callbacks, notifying them of a change in model state :param delta: The raw change from the watcher (:class:`juju.client.overrides.Delta`) :param old_obj: The object in the model that this delta updates. ...
python
async def _notify_observers(self, delta, old_obj, new_obj): """Call observing callbacks, notifying them of a change in model state :param delta: The raw change from the watcher (:class:`juju.client.overrides.Delta`) :param old_obj: The object in the model that this delta updates. ...
[ "async", "def", "_notify_observers", "(", "self", ",", "delta", ",", "old_obj", ",", "new_obj", ")", ":", "if", "new_obj", "and", "not", "old_obj", ":", "delta", ".", "type", "=", "'add'", "log", ".", "debug", "(", "'Model changed: %s %s %s'", ",", "delta"...
Call observing callbacks, notifying them of a change in model state :param delta: The raw change from the watcher (:class:`juju.client.overrides.Delta`) :param old_obj: The object in the model that this delta updates. May be None. :param new_obj: The object in the model ...
[ "Call", "observing", "callbacks", "notifying", "them", "of", "a", "change", "in", "model", "state" ]
58f0011f4c57cd68830258952fa952eaadca6b38
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L875-L896
train
juju/python-libjuju
juju/model.py
Model._wait
async def _wait(self, entity_type, entity_id, action, predicate=None): """ Block the calling routine until a given action has happened to the given entity :param entity_type: The entity's type. :param entity_id: The entity's id. :param action: the type of action (e.g., '...
python
async def _wait(self, entity_type, entity_id, action, predicate=None): """ Block the calling routine until a given action has happened to the given entity :param entity_type: The entity's type. :param entity_id: The entity's id. :param action: the type of action (e.g., '...
[ "async", "def", "_wait", "(", "self", ",", "entity_type", ",", "entity_id", ",", "action", ",", "predicate", "=", "None", ")", ":", "q", "=", "asyncio", ".", "Queue", "(", "loop", "=", "self", ".", "_connector", ".", "loop", ")", "async", "def", "cal...
Block the calling routine until a given action has happened to the given entity :param entity_type: The entity's type. :param entity_id: The entity's id. :param action: the type of action (e.g., 'add', 'change', or 'remove') :param predicate: optional callable that must take as ...
[ "Block", "the", "calling", "routine", "until", "a", "given", "action", "has", "happened", "to", "the", "given", "entity" ]
58f0011f4c57cd68830258952fa952eaadca6b38
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L898-L922
train
juju/python-libjuju
juju/model.py
Model._wait_for_new
async def _wait_for_new(self, entity_type, entity_id): """Wait for a new object to appear in the Model and return it. Waits for an object of type ``entity_type`` with id ``entity_id`` to appear in the model. This is similar to watching for the object using ``block_until``, but uses the...
python
async def _wait_for_new(self, entity_type, entity_id): """Wait for a new object to appear in the Model and return it. Waits for an object of type ``entity_type`` with id ``entity_id`` to appear in the model. This is similar to watching for the object using ``block_until``, but uses the...
[ "async", "def", "_wait_for_new", "(", "self", ",", "entity_type", ",", "entity_id", ")", ":", "if", "entity_id", "in", "self", ".", "state", ".", "_live_entity_map", "(", "entity_type", ")", ":", "return", "self", ".", "state", ".", "_live_entity_map", "(", ...
Wait for a new object to appear in the Model and return it. Waits for an object of type ``entity_type`` with id ``entity_id`` to appear in the model. This is similar to watching for the object using ``block_until``, but uses the watcher rather than polling.
[ "Wait", "for", "a", "new", "object", "to", "appear", "in", "the", "Model", "and", "return", "it", "." ]
58f0011f4c57cd68830258952fa952eaadca6b38
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L924-L936
train
juju/python-libjuju
juju/model.py
Model.wait_for_action
async def wait_for_action(self, action_id): """Given an action, wait for it to complete.""" if action_id.startswith("action-"): # if we've been passed action.tag, transform it into the # id that the api deltas will use. action_id = action_id[7:] def predicat...
python
async def wait_for_action(self, action_id): """Given an action, wait for it to complete.""" if action_id.startswith("action-"): # if we've been passed action.tag, transform it into the # id that the api deltas will use. action_id = action_id[7:] def predicat...
[ "async", "def", "wait_for_action", "(", "self", ",", "action_id", ")", ":", "if", "action_id", ".", "startswith", "(", "\"action-\"", ")", ":", "action_id", "=", "action_id", "[", "7", ":", "]", "def", "predicate", "(", "delta", ")", ":", "return", "delt...
Given an action, wait for it to complete.
[ "Given", "an", "action", "wait", "for", "it", "to", "complete", "." ]
58f0011f4c57cd68830258952fa952eaadca6b38
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L938-L949
train
juju/python-libjuju
juju/model.py
Model.add_machine
async def add_machine( self, spec=None, constraints=None, disks=None, series=None): """Start a new, empty machine and optionally a container, or add a container to a machine. :param str spec: Machine specification Examples:: (None) - starts a new machine...
python
async def add_machine( self, spec=None, constraints=None, disks=None, series=None): """Start a new, empty machine and optionally a container, or add a container to a machine. :param str spec: Machine specification Examples:: (None) - starts a new machine...
[ "async", "def", "add_machine", "(", "self", ",", "spec", "=", "None", ",", "constraints", "=", "None", ",", "disks", "=", "None", ",", "series", "=", "None", ")", ":", "params", "=", "client", ".", "AddMachineParams", "(", ")", "if", "spec", ":", "if...
Start a new, empty machine and optionally a container, or add a container to a machine. :param str spec: Machine specification Examples:: (None) - starts a new machine 'lxd' - starts a new machine with one lxd container 'lxd:4' - starts a new...
[ "Start", "a", "new", "empty", "machine", "and", "optionally", "a", "container", "or", "add", "a", "container", "to", "a", "machine", "." ]
58f0011f4c57cd68830258952fa952eaadca6b38
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L967-L1077
train
juju/python-libjuju
juju/model.py
Model.add_relation
async def add_relation(self, relation1, relation2): """Add a relation between two applications. :param str relation1: '<application>[:<relation_name>]' :param str relation2: '<application>[:<relation_name>]' """ connection = self.connection() app_facade = client.Applica...
python
async def add_relation(self, relation1, relation2): """Add a relation between two applications. :param str relation1: '<application>[:<relation_name>]' :param str relation2: '<application>[:<relation_name>]' """ connection = self.connection() app_facade = client.Applica...
[ "async", "def", "add_relation", "(", "self", ",", "relation1", ",", "relation2", ")", ":", "connection", "=", "self", ".", "connection", "(", ")", "app_facade", "=", "client", ".", "ApplicationFacade", ".", "from_connection", "(", "connection", ")", "log", "...
Add a relation between two applications. :param str relation1: '<application>[:<relation_name>]' :param str relation2: '<application>[:<relation_name>]'
[ "Add", "a", "relation", "between", "two", "applications", "." ]
58f0011f4c57cd68830258952fa952eaadca6b38
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L1079-L1113
train
juju/python-libjuju
juju/model.py
Model.add_ssh_key
async def add_ssh_key(self, user, key): """Add a public SSH key to this model. :param str user: The username of the user :param str key: The public ssh key """ key_facade = client.KeyManagerFacade.from_connection(self.connection()) return await key_facade.AddKeys([key],...
python
async def add_ssh_key(self, user, key): """Add a public SSH key to this model. :param str user: The username of the user :param str key: The public ssh key """ key_facade = client.KeyManagerFacade.from_connection(self.connection()) return await key_facade.AddKeys([key],...
[ "async", "def", "add_ssh_key", "(", "self", ",", "user", ",", "key", ")", ":", "key_facade", "=", "client", ".", "KeyManagerFacade", ".", "from_connection", "(", "self", ".", "connection", "(", ")", ")", "return", "await", "key_facade", ".", "AddKeys", "("...
Add a public SSH key to this model. :param str user: The username of the user :param str key: The public ssh key
[ "Add", "a", "public", "SSH", "key", "to", "this", "model", "." ]
58f0011f4c57cd68830258952fa952eaadca6b38
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L1127-L1135
train
juju/python-libjuju
juju/model.py
Model.debug_log
def debug_log( self, no_tail=False, exclude_module=None, include_module=None, include=None, level=None, limit=0, lines=10, replay=False, exclude=None): """Get log messages for this model. :param bool no_tail: Stop after returning existing log messages :param ...
python
def debug_log( self, no_tail=False, exclude_module=None, include_module=None, include=None, level=None, limit=0, lines=10, replay=False, exclude=None): """Get log messages for this model. :param bool no_tail: Stop after returning existing log messages :param ...
[ "def", "debug_log", "(", "self", ",", "no_tail", "=", "False", ",", "exclude_module", "=", "None", ",", "include_module", "=", "None", ",", "include", "=", "None", ",", "level", "=", "None", ",", "limit", "=", "0", ",", "lines", "=", "10", ",", "repl...
Get log messages for this model. :param bool no_tail: Stop after returning existing log messages :param list exclude_module: Do not show log messages for these logging modules :param list include_module: Only show log messages for these logging modules :param lis...
[ "Get", "log", "messages", "for", "this", "model", "." ]
58f0011f4c57cd68830258952fa952eaadca6b38
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L1199-L1221
train
juju/python-libjuju
juju/model.py
Model._deploy
async def _deploy(self, charm_url, application, series, config, constraints, endpoint_bindings, resources, storage, channel=None, num_units=None, placement=None, devices=None): """Logic shared between `Model.deploy` and `BundleHandler.deploy`. ...
python
async def _deploy(self, charm_url, application, series, config, constraints, endpoint_bindings, resources, storage, channel=None, num_units=None, placement=None, devices=None): """Logic shared between `Model.deploy` and `BundleHandler.deploy`. ...
[ "async", "def", "_deploy", "(", "self", ",", "charm_url", ",", "application", ",", "series", ",", "config", ",", "constraints", ",", "endpoint_bindings", ",", "resources", ",", "storage", ",", "channel", "=", "None", ",", "num_units", "=", "None", ",", "pl...
Logic shared between `Model.deploy` and `BundleHandler.deploy`.
[ "Logic", "shared", "between", "Model", ".", "deploy", "and", "BundleHandler", ".", "deploy", "." ]
58f0011f4c57cd68830258952fa952eaadca6b38
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L1407-L1441
train
juju/python-libjuju
juju/model.py
Model.destroy_unit
async def destroy_unit(self, *unit_names): """Destroy units by name. """ connection = self.connection() app_facade = client.ApplicationFacade.from_connection(connection) log.debug( 'Destroying unit%s %s', 's' if len(unit_names) == 1 else '', ...
python
async def destroy_unit(self, *unit_names): """Destroy units by name. """ connection = self.connection() app_facade = client.ApplicationFacade.from_connection(connection) log.debug( 'Destroying unit%s %s', 's' if len(unit_names) == 1 else '', ...
[ "async", "def", "destroy_unit", "(", "self", ",", "*", "unit_names", ")", ":", "connection", "=", "self", ".", "connection", "(", ")", "app_facade", "=", "client", ".", "ApplicationFacade", ".", "from_connection", "(", "connection", ")", "log", ".", "debug",...
Destroy units by name.
[ "Destroy", "units", "by", "name", "." ]
58f0011f4c57cd68830258952fa952eaadca6b38
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L1449-L1461
train
juju/python-libjuju
juju/model.py
Model.get_config
async def get_config(self): """Return the configuration settings for this model. :returns: A ``dict`` mapping keys to `ConfigValue` instances, which have `source` and `value` attributes. """ config_facade = client.ModelConfigFacade.from_connection( self.connectio...
python
async def get_config(self): """Return the configuration settings for this model. :returns: A ``dict`` mapping keys to `ConfigValue` instances, which have `source` and `value` attributes. """ config_facade = client.ModelConfigFacade.from_connection( self.connectio...
[ "async", "def", "get_config", "(", "self", ")", ":", "config_facade", "=", "client", ".", "ModelConfigFacade", ".", "from_connection", "(", "self", ".", "connection", "(", ")", ")", "result", "=", "await", "config_facade", ".", "ModelGet", "(", ")", "config"...
Return the configuration settings for this model. :returns: A ``dict`` mapping keys to `ConfigValue` instances, which have `source` and `value` attributes.
[ "Return", "the", "configuration", "settings", "for", "this", "model", "." ]
58f0011f4c57cd68830258952fa952eaadca6b38
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L1492-L1505
train
juju/python-libjuju
juju/model.py
Model.get_constraints
async def get_constraints(self): """Return the machine constraints for this model. :returns: A ``dict`` of constraints. """ constraints = {} client_facade = client.ClientFacade.from_connection(self.connection()) result = await client_facade.GetModelConstraints() ...
python
async def get_constraints(self): """Return the machine constraints for this model. :returns: A ``dict`` of constraints. """ constraints = {} client_facade = client.ClientFacade.from_connection(self.connection()) result = await client_facade.GetModelConstraints() ...
[ "async", "def", "get_constraints", "(", "self", ")", ":", "constraints", "=", "{", "}", "client_facade", "=", "client", ".", "ClientFacade", ".", "from_connection", "(", "self", ".", "connection", "(", ")", ")", "result", "=", "await", "client_facade", ".", ...
Return the machine constraints for this model. :returns: A ``dict`` of constraints.
[ "Return", "the", "machine", "constraints", "for", "this", "model", "." ]
58f0011f4c57cd68830258952fa952eaadca6b38
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L1507-L1530
train
juju/python-libjuju
juju/model.py
Model.restore_backup
def restore_backup( self, bootstrap=False, constraints=None, archive=None, backup_id=None, upload_tools=False): """Restore a backup archive to a new controller. :param bool bootstrap: Bootstrap a new state machine :param constraints: Model constraints :type const...
python
def restore_backup( self, bootstrap=False, constraints=None, archive=None, backup_id=None, upload_tools=False): """Restore a backup archive to a new controller. :param bool bootstrap: Bootstrap a new state machine :param constraints: Model constraints :type const...
[ "def", "restore_backup", "(", "self", ",", "bootstrap", "=", "False", ",", "constraints", "=", "None", ",", "archive", "=", "None", ",", "backup_id", "=", "None", ",", "upload_tools", "=", "False", ")", ":", "raise", "NotImplementedError", "(", ")" ]
Restore a backup archive to a new controller. :param bool bootstrap: Bootstrap a new state machine :param constraints: Model constraints :type constraints: :class:`juju.Constraints` :param str archive: Path to backup archive to restore :param str backup_id: Id of backup to resto...
[ "Restore", "a", "backup", "archive", "to", "a", "new", "controller", "." ]
58f0011f4c57cd68830258952fa952eaadca6b38
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L1645-L1658
train
juju/python-libjuju
juju/model.py
Model.set_config
async def set_config(self, config): """Set configuration keys on this model. :param dict config: Mapping of config keys to either string values or `ConfigValue` instances, as returned by `get_config`. """ config_facade = client.ModelConfigFacade.from_connection( ...
python
async def set_config(self, config): """Set configuration keys on this model. :param dict config: Mapping of config keys to either string values or `ConfigValue` instances, as returned by `get_config`. """ config_facade = client.ModelConfigFacade.from_connection( ...
[ "async", "def", "set_config", "(", "self", ",", "config", ")", ":", "config_facade", "=", "client", ".", "ModelConfigFacade", ".", "from_connection", "(", "self", ".", "connection", "(", ")", ")", "for", "key", ",", "value", "in", "config", ".", "items", ...
Set configuration keys on this model. :param dict config: Mapping of config keys to either string values or `ConfigValue` instances, as returned by `get_config`.
[ "Set", "configuration", "keys", "on", "this", "model", "." ]
58f0011f4c57cd68830258952fa952eaadca6b38
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L1675-L1687
train
juju/python-libjuju
juju/model.py
Model.set_constraints
async def set_constraints(self, constraints): """Set machine constraints on this model. :param dict config: Mapping of model constraints """ client_facade = client.ClientFacade.from_connection(self.connection()) await client_facade.SetModelConstraints( application=''...
python
async def set_constraints(self, constraints): """Set machine constraints on this model. :param dict config: Mapping of model constraints """ client_facade = client.ClientFacade.from_connection(self.connection()) await client_facade.SetModelConstraints( application=''...
[ "async", "def", "set_constraints", "(", "self", ",", "constraints", ")", ":", "client_facade", "=", "client", ".", "ClientFacade", ".", "from_connection", "(", "self", ".", "connection", "(", ")", ")", "await", "client_facade", ".", "SetModelConstraints", "(", ...
Set machine constraints on this model. :param dict config: Mapping of model constraints
[ "Set", "machine", "constraints", "on", "this", "model", "." ]
58f0011f4c57cd68830258952fa952eaadca6b38
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L1689-L1697
train
juju/python-libjuju
juju/model.py
Model.get_action_output
async def get_action_output(self, action_uuid, wait=None): """Get the results of an action by ID. :param str action_uuid: Id of the action :param int wait: Time in seconds to wait for action to complete. :return dict: Output from action :raises: :class:`JujuError` if invalid act...
python
async def get_action_output(self, action_uuid, wait=None): """Get the results of an action by ID. :param str action_uuid: Id of the action :param int wait: Time in seconds to wait for action to complete. :return dict: Output from action :raises: :class:`JujuError` if invalid act...
[ "async", "def", "get_action_output", "(", "self", ",", "action_uuid", ",", "wait", "=", "None", ")", ":", "action_facade", "=", "client", ".", "ActionFacade", ".", "from_connection", "(", "self", ".", "connection", "(", ")", ")", "entity", "=", "[", "{", ...
Get the results of an action by ID. :param str action_uuid: Id of the action :param int wait: Time in seconds to wait for action to complete. :return dict: Output from action :raises: :class:`JujuError` if invalid action_uuid
[ "Get", "the", "results", "of", "an", "action", "by", "ID", "." ]
58f0011f4c57cd68830258952fa952eaadca6b38
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L1699-L1732
train
juju/python-libjuju
juju/model.py
Model.get_action_status
async def get_action_status(self, uuid_or_prefix=None, name=None): """Get the status of all actions, filtered by ID, ID prefix, or name. :param str uuid_or_prefix: Filter by action uuid or prefix :param str name: Filter by action name """ results = {} action_results = [...
python
async def get_action_status(self, uuid_or_prefix=None, name=None): """Get the status of all actions, filtered by ID, ID prefix, or name. :param str uuid_or_prefix: Filter by action uuid or prefix :param str name: Filter by action name """ results = {} action_results = [...
[ "async", "def", "get_action_status", "(", "self", ",", "uuid_or_prefix", "=", "None", ",", "name", "=", "None", ")", ":", "results", "=", "{", "}", "action_results", "=", "[", "]", "action_facade", "=", "client", ".", "ActionFacade", ".", "from_connection", ...
Get the status of all actions, filtered by ID, ID prefix, or name. :param str uuid_or_prefix: Filter by action uuid or prefix :param str name: Filter by action name
[ "Get", "the", "status", "of", "all", "actions", "filtered", "by", "ID", "ID", "prefix", "or", "name", "." ]
58f0011f4c57cd68830258952fa952eaadca6b38
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L1734-L1761
train
juju/python-libjuju
juju/model.py
Model.get_status
async def get_status(self, filters=None, utc=False): """Return the status of the model. :param str filters: Optional list of applications, units, or machines to include, which can use wildcards ('*'). :param bool utc: Display time as UTC in RFC3339 format """ client...
python
async def get_status(self, filters=None, utc=False): """Return the status of the model. :param str filters: Optional list of applications, units, or machines to include, which can use wildcards ('*'). :param bool utc: Display time as UTC in RFC3339 format """ client...
[ "async", "def", "get_status", "(", "self", ",", "filters", "=", "None", ",", "utc", "=", "False", ")", ":", "client_facade", "=", "client", ".", "ClientFacade", ".", "from_connection", "(", "self", ".", "connection", "(", ")", ")", "return", "await", "cl...
Return the status of the model. :param str filters: Optional list of applications, units, or machines to include, which can use wildcards ('*'). :param bool utc: Display time as UTC in RFC3339 format
[ "Return", "the", "status", "of", "the", "model", "." ]
58f0011f4c57cd68830258952fa952eaadca6b38
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L1771-L1780
train
juju/python-libjuju
juju/model.py
Model.sync_tools
def sync_tools( self, all_=False, destination=None, dry_run=False, public=False, source=None, stream=None, version=None): """Copy Juju tools into this model. :param bool all_: Copy all versions, not just the latest :param str destination: Path to local destination direct...
python
def sync_tools( self, all_=False, destination=None, dry_run=False, public=False, source=None, stream=None, version=None): """Copy Juju tools into this model. :param bool all_: Copy all versions, not just the latest :param str destination: Path to local destination direct...
[ "def", "sync_tools", "(", "self", ",", "all_", "=", "False", ",", "destination", "=", "None", ",", "dry_run", "=", "False", ",", "public", "=", "False", ",", "source", "=", "None", ",", "stream", "=", "None", ",", "version", "=", "None", ")", ":", ...
Copy Juju tools into this model. :param bool all_: Copy all versions, not just the latest :param str destination: Path to local destination directory :param bool dry_run: Don't do the actual copy :param bool public: Tools are for a public cloud, so generate mirrors informati...
[ "Copy", "Juju", "tools", "into", "this", "model", "." ]
58f0011f4c57cd68830258952fa952eaadca6b38
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L1782-L1797
train