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
CLARIAH/grlc
src/swagger.py
get_repo_info
def get_repo_info(loader, sha, prov_g): """Generate swagger information from the repo being used.""" user_repo = loader.getFullName() repo_title = loader.getRepoTitle() contact_name = loader.getContactName() contact_url = loader.getContactUrl() commit_list = loader.getCommitList() licence_ur...
python
def get_repo_info(loader, sha, prov_g): """Generate swagger information from the repo being used.""" user_repo = loader.getFullName() repo_title = loader.getRepoTitle() contact_name = loader.getContactName() contact_url = loader.getContactUrl() commit_list = loader.getCommitList() licence_ur...
[ "def", "get_repo_info", "(", "loader", ",", "sha", ",", "prov_g", ")", ":", "user_repo", "=", "loader", ".", "getFullName", "(", ")", "repo_title", "=", "loader", ".", "getRepoTitle", "(", ")", "contact_name", "=", "loader", ".", "getContactName", "(", ")"...
Generate swagger information from the repo being used.
[ "Generate", "swagger", "information", "from", "the", "repo", "being", "used", "." ]
f5664e34f039010c00ef8ebb69917c05e8ce75d7
https://github.com/CLARIAH/grlc/blob/f5664e34f039010c00ef8ebb69917c05e8ce75d7/src/swagger.py#L24-L61
train
CLARIAH/grlc
src/pagination.py
buildPaginationHeader
def buildPaginationHeader(resultCount, resultsPerPage, pageArg, url): '''Build link header for result pagination''' lastPage = resultCount / resultsPerPage if pageArg: page = int(pageArg) next_url = re.sub("page=[0-9]+", "page={}".format(page + 1), url) prev_url = re.sub("page=[0-9]...
python
def buildPaginationHeader(resultCount, resultsPerPage, pageArg, url): '''Build link header for result pagination''' lastPage = resultCount / resultsPerPage if pageArg: page = int(pageArg) next_url = re.sub("page=[0-9]+", "page={}".format(page + 1), url) prev_url = re.sub("page=[0-9]...
[ "def", "buildPaginationHeader", "(", "resultCount", ",", "resultsPerPage", ",", "pageArg", ",", "url", ")", ":", "lastPage", "=", "resultCount", "/", "resultsPerPage", "if", "pageArg", ":", "page", "=", "int", "(", "pageArg", ")", "next_url", "=", "re", ".",...
Build link header for result pagination
[ "Build", "link", "header", "for", "result", "pagination" ]
f5664e34f039010c00ef8ebb69917c05e8ce75d7
https://github.com/CLARIAH/grlc/blob/f5664e34f039010c00ef8ebb69917c05e8ce75d7/src/pagination.py#L12-L35
train
goerz/better-apidoc
better_apidoc.py
format_directive
def format_directive(module, package=None): # type: (unicode, unicode) -> unicode """Create the automodule directive and add the options.""" directive = '.. automodule:: %s\n' % makename(package, module) for option in OPTIONS: directive += ' :%s:\n' % option return directive
python
def format_directive(module, package=None): # type: (unicode, unicode) -> unicode """Create the automodule directive and add the options.""" directive = '.. automodule:: %s\n' % makename(package, module) for option in OPTIONS: directive += ' :%s:\n' % option return directive
[ "def", "format_directive", "(", "module", ",", "package", "=", "None", ")", ":", "directive", "=", "'.. automodule:: %s\\n'", "%", "makename", "(", "package", ",", "module", ")", "for", "option", "in", "OPTIONS", ":", "directive", "+=", "' :%s:\\n'", "%", ...
Create the automodule directive and add the options.
[ "Create", "the", "automodule", "directive", "and", "add", "the", "options", "." ]
bbf979e01d7eff1a597c2608ef2609d1e83e8001
https://github.com/goerz/better-apidoc/blob/bbf979e01d7eff1a597c2608ef2609d1e83e8001/better_apidoc.py#L116-L122
train
goerz/better-apidoc
better_apidoc.py
extract_summary
def extract_summary(obj): # type: (List[unicode], Any) -> unicode """Extract summary from docstring.""" try: doc = inspect.getdoc(obj).split("\n") except AttributeError: doc = '' # Skip a blank lines at the top while doc and not doc[0].strip(): doc.pop(0) # If ther...
python
def extract_summary(obj): # type: (List[unicode], Any) -> unicode """Extract summary from docstring.""" try: doc = inspect.getdoc(obj).split("\n") except AttributeError: doc = '' # Skip a blank lines at the top while doc and not doc[0].strip(): doc.pop(0) # If ther...
[ "def", "extract_summary", "(", "obj", ")", ":", "try", ":", "doc", "=", "inspect", ".", "getdoc", "(", "obj", ")", ".", "split", "(", "\"\\n\"", ")", "except", "AttributeError", ":", "doc", "=", "''", "while", "doc", "and", "not", "doc", "[", "0", ...
Extract summary from docstring.
[ "Extract", "summary", "from", "docstring", "." ]
bbf979e01d7eff1a597c2608ef2609d1e83e8001
https://github.com/goerz/better-apidoc/blob/bbf979e01d7eff1a597c2608ef2609d1e83e8001/better_apidoc.py#L272-L312
train
goerz/better-apidoc
better_apidoc.py
_get_member_ref_str
def _get_member_ref_str(name, obj, role='obj', known_refs=None): """generate a ReST-formmated reference link to the given `obj` of type `role`, using `name` as the link text""" if known_refs is not None: if name in known_refs: return known_refs[name] ref = _get_fullname(name, obj) ...
python
def _get_member_ref_str(name, obj, role='obj', known_refs=None): """generate a ReST-formmated reference link to the given `obj` of type `role`, using `name` as the link text""" if known_refs is not None: if name in known_refs: return known_refs[name] ref = _get_fullname(name, obj) ...
[ "def", "_get_member_ref_str", "(", "name", ",", "obj", ",", "role", "=", "'obj'", ",", "known_refs", "=", "None", ")", ":", "if", "known_refs", "is", "not", "None", ":", "if", "name", "in", "known_refs", ":", "return", "known_refs", "[", "name", "]", "...
generate a ReST-formmated reference link to the given `obj` of type `role`, using `name` as the link text
[ "generate", "a", "ReST", "-", "formmated", "reference", "link", "to", "the", "given", "obj", "of", "type", "role", "using", "name", "as", "the", "link", "text" ]
bbf979e01d7eff1a597c2608ef2609d1e83e8001
https://github.com/goerz/better-apidoc/blob/bbf979e01d7eff1a597c2608ef2609d1e83e8001/better_apidoc.py#L315-L322
train
goerz/better-apidoc
better_apidoc.py
_get_mod_ns
def _get_mod_ns(name, fullname, includeprivate): """Return the template context of module identified by `fullname` as a dict""" ns = { # template variables 'name': name, 'fullname': fullname, 'members': [], 'functions': [], 'classes': [], 'exceptions': [], 'subpackages': [], 'submodules': [...
python
def _get_mod_ns(name, fullname, includeprivate): """Return the template context of module identified by `fullname` as a dict""" ns = { # template variables 'name': name, 'fullname': fullname, 'members': [], 'functions': [], 'classes': [], 'exceptions': [], 'subpackages': [], 'submodules': [...
[ "def", "_get_mod_ns", "(", "name", ",", "fullname", ",", "includeprivate", ")", ":", "ns", "=", "{", "'name'", ":", "name", ",", "'fullname'", ":", "fullname", ",", "'members'", ":", "[", "]", ",", "'functions'", ":", "[", "]", ",", "'classes'", ":", ...
Return the template context of module identified by `fullname` as a dict
[ "Return", "the", "template", "context", "of", "module", "identified", "by", "fullname", "as", "a", "dict" ]
bbf979e01d7eff1a597c2608ef2609d1e83e8001
https://github.com/goerz/better-apidoc/blob/bbf979e01d7eff1a597c2608ef2609d1e83e8001/better_apidoc.py#L345-L362
train
ValvePython/vdf
vdf/vdict.py
VDFDict.get_all_for
def get_all_for(self, key): """ Returns all values of the given key """ if not isinstance(key, _string_type): raise TypeError("Key needs to be a string.") return [self[(idx, key)] for idx in _range(self.__kcount[key])]
python
def get_all_for(self, key): """ Returns all values of the given key """ if not isinstance(key, _string_type): raise TypeError("Key needs to be a string.") return [self[(idx, key)] for idx in _range(self.__kcount[key])]
[ "def", "get_all_for", "(", "self", ",", "key", ")", ":", "if", "not", "isinstance", "(", "key", ",", "_string_type", ")", ":", "raise", "TypeError", "(", "\"Key needs to be a string.\"", ")", "return", "[", "self", "[", "(", "idx", ",", "key", ")", "]", ...
Returns all values of the given key
[ "Returns", "all", "values", "of", "the", "given", "key" ]
4b168702736f51318baa3a12aa5a2827d360f94a
https://github.com/ValvePython/vdf/blob/4b168702736f51318baa3a12aa5a2827d360f94a/vdf/vdict.py#L186-L190
train
ValvePython/vdf
vdf/vdict.py
VDFDict.remove_all_for
def remove_all_for(self, key): """ Removes all items with the given key """ if not isinstance(key, _string_type): raise TypeError("Key need to be a string.") for idx in _range(self.__kcount[key]): super(VDFDict, self).__delitem__((idx, key)) self.__omap = list(f...
python
def remove_all_for(self, key): """ Removes all items with the given key """ if not isinstance(key, _string_type): raise TypeError("Key need to be a string.") for idx in _range(self.__kcount[key]): super(VDFDict, self).__delitem__((idx, key)) self.__omap = list(f...
[ "def", "remove_all_for", "(", "self", ",", "key", ")", ":", "if", "not", "isinstance", "(", "key", ",", "_string_type", ")", ":", "raise", "TypeError", "(", "\"Key need to be a string.\"", ")", "for", "idx", "in", "_range", "(", "self", ".", "__kcount", "[...
Removes all items with the given key
[ "Removes", "all", "items", "with", "the", "given", "key" ]
4b168702736f51318baa3a12aa5a2827d360f94a
https://github.com/ValvePython/vdf/blob/4b168702736f51318baa3a12aa5a2827d360f94a/vdf/vdict.py#L192-L202
train
ValvePython/vdf
vdf/vdict.py
VDFDict.has_duplicates
def has_duplicates(self): """ Returns ``True`` if the dict contains keys with duplicates. Recurses through any all keys with value that is ``VDFDict``. """ for n in getattr(self.__kcount, _iter_values)(): if n != 1: return True def dict_recurs...
python
def has_duplicates(self): """ Returns ``True`` if the dict contains keys with duplicates. Recurses through any all keys with value that is ``VDFDict``. """ for n in getattr(self.__kcount, _iter_values)(): if n != 1: return True def dict_recurs...
[ "def", "has_duplicates", "(", "self", ")", ":", "for", "n", "in", "getattr", "(", "self", ".", "__kcount", ",", "_iter_values", ")", "(", ")", ":", "if", "n", "!=", "1", ":", "return", "True", "def", "dict_recurse", "(", "obj", ")", ":", "for", "v"...
Returns ``True`` if the dict contains keys with duplicates. Recurses through any all keys with value that is ``VDFDict``.
[ "Returns", "True", "if", "the", "dict", "contains", "keys", "with", "duplicates", ".", "Recurses", "through", "any", "all", "keys", "with", "value", "that", "is", "VDFDict", "." ]
4b168702736f51318baa3a12aa5a2827d360f94a
https://github.com/ValvePython/vdf/blob/4b168702736f51318baa3a12aa5a2827d360f94a/vdf/vdict.py#L204-L221
train
ValvePython/vdf
vdf/__init__.py
dumps
def dumps(obj, pretty=False, escaped=True): """ Serialize ``obj`` to a VDF formatted ``str``. """ if not isinstance(obj, dict): raise TypeError("Expected data to be an instance of``dict``") if not isinstance(pretty, bool): raise TypeError("Expected pretty to be of type bool") if ...
python
def dumps(obj, pretty=False, escaped=True): """ Serialize ``obj`` to a VDF formatted ``str``. """ if not isinstance(obj, dict): raise TypeError("Expected data to be an instance of``dict``") if not isinstance(pretty, bool): raise TypeError("Expected pretty to be of type bool") if ...
[ "def", "dumps", "(", "obj", ",", "pretty", "=", "False", ",", "escaped", "=", "True", ")", ":", "if", "not", "isinstance", "(", "obj", ",", "dict", ")", ":", "raise", "TypeError", "(", "\"Expected data to be an instance of``dict``\"", ")", "if", "not", "is...
Serialize ``obj`` to a VDF formatted ``str``.
[ "Serialize", "obj", "to", "a", "VDF", "formatted", "str", "." ]
4b168702736f51318baa3a12aa5a2827d360f94a
https://github.com/ValvePython/vdf/blob/4b168702736f51318baa3a12aa5a2827d360f94a/vdf/__init__.py#L189-L200
train
ValvePython/vdf
vdf/__init__.py
binary_dumps
def binary_dumps(obj, alt_format=False): """ Serialize ``obj`` to a binary VDF formatted ``bytes``. """ return b''.join(_binary_dump_gen(obj, alt_format=alt_format))
python
def binary_dumps(obj, alt_format=False): """ Serialize ``obj`` to a binary VDF formatted ``bytes``. """ return b''.join(_binary_dump_gen(obj, alt_format=alt_format))
[ "def", "binary_dumps", "(", "obj", ",", "alt_format", "=", "False", ")", ":", "return", "b''", ".", "join", "(", "_binary_dump_gen", "(", "obj", ",", "alt_format", "=", "alt_format", ")", ")" ]
Serialize ``obj`` to a binary VDF formatted ``bytes``.
[ "Serialize", "obj", "to", "a", "binary", "VDF", "formatted", "bytes", "." ]
4b168702736f51318baa3a12aa5a2827d360f94a
https://github.com/ValvePython/vdf/blob/4b168702736f51318baa3a12aa5a2827d360f94a/vdf/__init__.py#L367-L371
train
ValvePython/vdf
vdf/__init__.py
vbkv_loads
def vbkv_loads(s, mapper=dict, merge_duplicate_keys=True): """ Deserialize ``s`` (``bytes`` containing a VBKV to a Python object. ``mapper`` specifies the Python object used after deserializetion. ``dict` is used by default. Alternatively, ``collections.OrderedDict`` can be used if you wish to pres...
python
def vbkv_loads(s, mapper=dict, merge_duplicate_keys=True): """ Deserialize ``s`` (``bytes`` containing a VBKV to a Python object. ``mapper`` specifies the Python object used after deserializetion. ``dict` is used by default. Alternatively, ``collections.OrderedDict`` can be used if you wish to pres...
[ "def", "vbkv_loads", "(", "s", ",", "mapper", "=", "dict", ",", "merge_duplicate_keys", "=", "True", ")", ":", "if", "s", "[", ":", "4", "]", "!=", "b'VBKV'", ":", "raise", "ValueError", "(", "\"Invalid header\"", ")", "checksum", ",", "=", "struct", "...
Deserialize ``s`` (``bytes`` containing a VBKV to a Python object. ``mapper`` specifies the Python object used after deserializetion. ``dict` is used by default. Alternatively, ``collections.OrderedDict`` can be used if you wish to preserve key order. Or any object that acts like a ``dict``. ``merge_d...
[ "Deserialize", "s", "(", "bytes", "containing", "a", "VBKV", "to", "a", "Python", "object", "." ]
4b168702736f51318baa3a12aa5a2827d360f94a
https://github.com/ValvePython/vdf/blob/4b168702736f51318baa3a12aa5a2827d360f94a/vdf/__init__.py#L421-L441
train
ValvePython/vdf
vdf/__init__.py
vbkv_dumps
def vbkv_dumps(obj): """ Serialize ``obj`` to a VBKV formatted ``bytes``. """ data = b''.join(_binary_dump_gen(obj, alt_format=True)) checksum = crc32(data) return b'VBKV' + struct.pack('<i', checksum) + data
python
def vbkv_dumps(obj): """ Serialize ``obj`` to a VBKV formatted ``bytes``. """ data = b''.join(_binary_dump_gen(obj, alt_format=True)) checksum = crc32(data) return b'VBKV' + struct.pack('<i', checksum) + data
[ "def", "vbkv_dumps", "(", "obj", ")", ":", "data", "=", "b''", ".", "join", "(", "_binary_dump_gen", "(", "obj", ",", "alt_format", "=", "True", ")", ")", "checksum", "=", "crc32", "(", "data", ")", "return", "b'VBKV'", "+", "struct", ".", "pack", "(...
Serialize ``obj`` to a VBKV formatted ``bytes``.
[ "Serialize", "obj", "to", "a", "VBKV", "formatted", "bytes", "." ]
4b168702736f51318baa3a12aa5a2827d360f94a
https://github.com/ValvePython/vdf/blob/4b168702736f51318baa3a12aa5a2827d360f94a/vdf/__init__.py#L443-L450
train
ldo/dbussy
dbussy.py
signature_validate
def signature_validate(signature, error = None) : "is signature a valid sequence of zero or more complete types." error, my_error = _get_error(error) result = dbus.dbus_signature_validate(signature.encode(), error._dbobj) != 0 my_error.raise_if_set() return \ result
python
def signature_validate(signature, error = None) : "is signature a valid sequence of zero or more complete types." error, my_error = _get_error(error) result = dbus.dbus_signature_validate(signature.encode(), error._dbobj) != 0 my_error.raise_if_set() return \ result
[ "def", "signature_validate", "(", "signature", ",", "error", "=", "None", ")", ":", "\"is signature a valid sequence of zero or more complete types.\"", "error", ",", "my_error", "=", "_get_error", "(", "error", ")", "result", "=", "dbus", ".", "dbus_signature_validate"...
is signature a valid sequence of zero or more complete types.
[ "is", "signature", "a", "valid", "sequence", "of", "zero", "or", "more", "complete", "types", "." ]
59e4fbe8b8111ceead884e50d1973901a0a2d240
https://github.com/ldo/dbussy/blob/59e4fbe8b8111ceead884e50d1973901a0a2d240/dbussy.py#L5539-L5545
train
ldo/dbussy
dbussy.py
unparse_signature
def unparse_signature(signature) : "converts a signature from parsed form to string form." signature = parse_signature(signature) if not isinstance(signature, (tuple, list)) : signature = [signature] #end if return \ DBUS.Signature("".join(t.signature for t in signature))
python
def unparse_signature(signature) : "converts a signature from parsed form to string form." signature = parse_signature(signature) if not isinstance(signature, (tuple, list)) : signature = [signature] #end if return \ DBUS.Signature("".join(t.signature for t in signature))
[ "def", "unparse_signature", "(", "signature", ")", ":", "\"converts a signature from parsed form to string form.\"", "signature", "=", "parse_signature", "(", "signature", ")", "if", "not", "isinstance", "(", "signature", ",", "(", "tuple", ",", "list", ")", ")", ":...
converts a signature from parsed form to string form.
[ "converts", "a", "signature", "from", "parsed", "form", "to", "string", "form", "." ]
59e4fbe8b8111ceead884e50d1973901a0a2d240
https://github.com/ldo/dbussy/blob/59e4fbe8b8111ceead884e50d1973901a0a2d240/dbussy.py#L5616-L5623
train
ldo/dbussy
dbussy.py
signature_validate_single
def signature_validate_single(signature, error = None) : "is signature a single valid type." error, my_error = _get_error(error) result = dbus.dbus_signature_validate_single(signature.encode(), error._dbobj) != 0 my_error.raise_if_set() return \ result
python
def signature_validate_single(signature, error = None) : "is signature a single valid type." error, my_error = _get_error(error) result = dbus.dbus_signature_validate_single(signature.encode(), error._dbobj) != 0 my_error.raise_if_set() return \ result
[ "def", "signature_validate_single", "(", "signature", ",", "error", "=", "None", ")", ":", "\"is signature a single valid type.\"", "error", ",", "my_error", "=", "_get_error", "(", "error", ")", "result", "=", "dbus", ".", "dbus_signature_validate_single", "(", "si...
is signature a single valid type.
[ "is", "signature", "a", "single", "valid", "type", "." ]
59e4fbe8b8111ceead884e50d1973901a0a2d240
https://github.com/ldo/dbussy/blob/59e4fbe8b8111ceead884e50d1973901a0a2d240/dbussy.py#L5626-L5632
train
ldo/dbussy
dbussy.py
split_path
def split_path(path) : "convenience routine for splitting a path into a list of components." if isinstance(path, (tuple, list)) : result = path # assume already split elif path == "/" : result = [] else : if not path.startswith("/") or path.endswith("/") : raise DBusE...
python
def split_path(path) : "convenience routine for splitting a path into a list of components." if isinstance(path, (tuple, list)) : result = path # assume already split elif path == "/" : result = [] else : if not path.startswith("/") or path.endswith("/") : raise DBusE...
[ "def", "split_path", "(", "path", ")", ":", "\"convenience routine for splitting a path into a list of components.\"", "if", "isinstance", "(", "path", ",", "(", "tuple", ",", "list", ")", ")", ":", "result", "=", "path", "elif", "path", "==", "\"/\"", ":", "res...
convenience routine for splitting a path into a list of components.
[ "convenience", "routine", "for", "splitting", "a", "path", "into", "a", "list", "of", "components", "." ]
59e4fbe8b8111ceead884e50d1973901a0a2d240
https://github.com/ldo/dbussy/blob/59e4fbe8b8111ceead884e50d1973901a0a2d240/dbussy.py#L5672-L5685
train
ldo/dbussy
dbussy.py
validate_utf8
def validate_utf8(alleged_utf8, error = None) : "alleged_utf8 must be null-terminated bytes." error, my_error = _get_error(error) result = dbus.dbus_validate_utf8(alleged_utf8, error._dbobj) != 0 my_error.raise_if_set() return \ result
python
def validate_utf8(alleged_utf8, error = None) : "alleged_utf8 must be null-terminated bytes." error, my_error = _get_error(error) result = dbus.dbus_validate_utf8(alleged_utf8, error._dbobj) != 0 my_error.raise_if_set() return \ result
[ "def", "validate_utf8", "(", "alleged_utf8", ",", "error", "=", "None", ")", ":", "\"alleged_utf8 must be null-terminated bytes.\"", "error", ",", "my_error", "=", "_get_error", "(", "error", ")", "result", "=", "dbus", ".", "dbus_validate_utf8", "(", "alleged_utf8"...
alleged_utf8 must be null-terminated bytes.
[ "alleged_utf8", "must", "be", "null", "-", "terminated", "bytes", "." ]
59e4fbe8b8111ceead884e50d1973901a0a2d240
https://github.com/ldo/dbussy/blob/59e4fbe8b8111ceead884e50d1973901a0a2d240/dbussy.py#L5759-L5765
train
ldo/dbussy
dbussy.py
DBUS.int_subtype
def int_subtype(i, bits, signed) : "returns integer i after checking that it fits in the given number of bits." if not isinstance(i, int) : raise TypeError("value is not int: %s" % repr(i)) #end if if signed : lo = - 1 << bits - 1 hi = (1 << bits - 1) ...
python
def int_subtype(i, bits, signed) : "returns integer i after checking that it fits in the given number of bits." if not isinstance(i, int) : raise TypeError("value is not int: %s" % repr(i)) #end if if signed : lo = - 1 << bits - 1 hi = (1 << bits - 1) ...
[ "def", "int_subtype", "(", "i", ",", "bits", ",", "signed", ")", ":", "\"returns integer i after checking that it fits in the given number of bits.\"", "if", "not", "isinstance", "(", "i", ",", "int", ")", ":", "raise", "TypeError", "(", "\"value is not int: %s\"", "%...
returns integer i after checking that it fits in the given number of bits.
[ "returns", "integer", "i", "after", "checking", "that", "it", "fits", "in", "the", "given", "number", "of", "bits", "." ]
59e4fbe8b8111ceead884e50d1973901a0a2d240
https://github.com/ldo/dbussy/blob/59e4fbe8b8111ceead884e50d1973901a0a2d240/dbussy.py#L88-L107
train
ldo/dbussy
dbussy.py
Connection.server_id
def server_id(self) : "asks the server at the other end for its unique id." c_result = dbus.dbus_connection_get_server_id(self._dbobj) result = ct.cast(c_result, ct.c_char_p).value.decode() dbus.dbus_free(c_result) return \ result
python
def server_id(self) : "asks the server at the other end for its unique id." c_result = dbus.dbus_connection_get_server_id(self._dbobj) result = ct.cast(c_result, ct.c_char_p).value.decode() dbus.dbus_free(c_result) return \ result
[ "def", "server_id", "(", "self", ")", ":", "\"asks the server at the other end for its unique id.\"", "c_result", "=", "dbus", ".", "dbus_connection_get_server_id", "(", "self", ".", "_dbobj", ")", "result", "=", "ct", ".", "cast", "(", "c_result", ",", "ct", ".",...
asks the server at the other end for its unique id.
[ "asks", "the", "server", "at", "the", "other", "end", "for", "its", "unique", "id", "." ]
59e4fbe8b8111ceead884e50d1973901a0a2d240
https://github.com/ldo/dbussy/blob/59e4fbe8b8111ceead884e50d1973901a0a2d240/dbussy.py#L2146-L2152
train
ldo/dbussy
dbussy.py
Connection.send
def send(self, message) : "puts a message in the outgoing queue." if not isinstance(message, Message) : raise TypeError("message must be a Message") #end if serial = ct.c_uint() if not dbus.dbus_connection_send(self._dbobj, message._dbobj, ct.byref(serial)) : ...
python
def send(self, message) : "puts a message in the outgoing queue." if not isinstance(message, Message) : raise TypeError("message must be a Message") #end if serial = ct.c_uint() if not dbus.dbus_connection_send(self._dbobj, message._dbobj, ct.byref(serial)) : ...
[ "def", "send", "(", "self", ",", "message", ")", ":", "\"puts a message in the outgoing queue.\"", "if", "not", "isinstance", "(", "message", ",", "Message", ")", ":", "raise", "TypeError", "(", "\"message must be a Message\"", ")", "serial", "=", "ct", ".", "c_...
puts a message in the outgoing queue.
[ "puts", "a", "message", "in", "the", "outgoing", "queue", "." ]
59e4fbe8b8111ceead884e50d1973901a0a2d240
https://github.com/ldo/dbussy/blob/59e4fbe8b8111ceead884e50d1973901a0a2d240/dbussy.py#L2187-L2197
train
ldo/dbussy
dbussy.py
Connection.send_with_reply_and_block
def send_with_reply_and_block(self, message, timeout = DBUS.TIMEOUT_USE_DEFAULT, error = None) : "sends a message, blocks the thread until the reply is available, and returns it." if not isinstance(message, Message) : raise TypeError("message must be a Message") #end if error...
python
def send_with_reply_and_block(self, message, timeout = DBUS.TIMEOUT_USE_DEFAULT, error = None) : "sends a message, blocks the thread until the reply is available, and returns it." if not isinstance(message, Message) : raise TypeError("message must be a Message") #end if error...
[ "def", "send_with_reply_and_block", "(", "self", ",", "message", ",", "timeout", "=", "DBUS", ".", "TIMEOUT_USE_DEFAULT", ",", "error", "=", "None", ")", ":", "\"sends a message, blocks the thread until the reply is available, and returns it.\"", "if", "not", "isinstance", ...
sends a message, blocks the thread until the reply is available, and returns it.
[ "sends", "a", "message", "blocks", "the", "thread", "until", "the", "reply", "is", "available", "and", "returns", "it", "." ]
59e4fbe8b8111ceead884e50d1973901a0a2d240
https://github.com/ldo/dbussy/blob/59e4fbe8b8111ceead884e50d1973901a0a2d240/dbussy.py#L2219-L2233
train
ldo/dbussy
dbussy.py
Connection.list_registered
def list_registered(self, parent_path) : "lists all the object paths for which you have ObjectPathVTable handlers registered." child_entries = ct.POINTER(ct.c_char_p)() if not dbus.dbus_connection_list_registered(self._dbobj, parent_path.encode(), ct.byref(child_entries)) : raise Cal...
python
def list_registered(self, parent_path) : "lists all the object paths for which you have ObjectPathVTable handlers registered." child_entries = ct.POINTER(ct.c_char_p)() if not dbus.dbus_connection_list_registered(self._dbobj, parent_path.encode(), ct.byref(child_entries)) : raise Cal...
[ "def", "list_registered", "(", "self", ",", "parent_path", ")", ":", "\"lists all the object paths for which you have ObjectPathVTable handlers registered.\"", "child_entries", "=", "ct", ".", "POINTER", "(", "ct", ".", "c_char_p", ")", "(", ")", "if", "not", "dbus", ...
lists all the object paths for which you have ObjectPathVTable handlers registered.
[ "lists", "all", "the", "object", "paths", "for", "which", "you", "have", "ObjectPathVTable", "handlers", "registered", "." ]
59e4fbe8b8111ceead884e50d1973901a0a2d240
https://github.com/ldo/dbussy/blob/59e4fbe8b8111ceead884e50d1973901a0a2d240/dbussy.py#L2661-L2678
train
ldo/dbussy
dbussy.py
Connection.bus_get
def bus_get(celf, type, private, error = None) : "returns a Connection to one of the predefined D-Bus buses; type is a BUS_xxx value." error, my_error = _get_error(error) result = (dbus.dbus_bus_get, dbus.dbus_bus_get_private)[private](type, error._dbobj) my_error.raise_if_set() ...
python
def bus_get(celf, type, private, error = None) : "returns a Connection to one of the predefined D-Bus buses; type is a BUS_xxx value." error, my_error = _get_error(error) result = (dbus.dbus_bus_get, dbus.dbus_bus_get_private)[private](type, error._dbobj) my_error.raise_if_set() ...
[ "def", "bus_get", "(", "celf", ",", "type", ",", "private", ",", "error", "=", "None", ")", ":", "\"returns a Connection to one of the predefined D-Bus buses; type is a BUS_xxx value.\"", "error", ",", "my_error", "=", "_get_error", "(", "error", ")", "result", "=", ...
returns a Connection to one of the predefined D-Bus buses; type is a BUS_xxx value.
[ "returns", "a", "Connection", "to", "one", "of", "the", "predefined", "D", "-", "Bus", "buses", ";", "type", "is", "a", "BUS_xxx", "value", "." ]
59e4fbe8b8111ceead884e50d1973901a0a2d240
https://github.com/ldo/dbussy/blob/59e4fbe8b8111ceead884e50d1973901a0a2d240/dbussy.py#L2924-L2933
train
ldo/dbussy
dbussy.py
Connection.become_monitor
def become_monitor(self, rules) : "turns the connection into one that can only receive monitoring messages." message = Message.new_method_call \ ( destination = DBUS.SERVICE_DBUS, path = DBUS.PATH_DBUS, iface = DBUS.INTERFACE_MONITORING, method =...
python
def become_monitor(self, rules) : "turns the connection into one that can only receive monitoring messages." message = Message.new_method_call \ ( destination = DBUS.SERVICE_DBUS, path = DBUS.PATH_DBUS, iface = DBUS.INTERFACE_MONITORING, method =...
[ "def", "become_monitor", "(", "self", ",", "rules", ")", ":", "\"turns the connection into one that can only receive monitoring messages.\"", "message", "=", "Message", ".", "new_method_call", "(", "destination", "=", "DBUS", ".", "SERVICE_DBUS", ",", "path", "=", "DBUS...
turns the connection into one that can only receive monitoring messages.
[ "turns", "the", "connection", "into", "one", "that", "can", "only", "receive", "monitoring", "messages", "." ]
59e4fbe8b8111ceead884e50d1973901a0a2d240
https://github.com/ldo/dbussy/blob/59e4fbe8b8111ceead884e50d1973901a0a2d240/dbussy.py#L3371-L3381
train
ldo/dbussy
dbussy.py
PreallocatedSend.send
def send(self, message) : "alternative to Connection.send_preallocated." if not isinstance(message, Message) : raise TypeError("message must be a Message") #end if assert not self._sent, "preallocated has already been sent" serial = ct.c_uint() dbus.dbus_conne...
python
def send(self, message) : "alternative to Connection.send_preallocated." if not isinstance(message, Message) : raise TypeError("message must be a Message") #end if assert not self._sent, "preallocated has already been sent" serial = ct.c_uint() dbus.dbus_conne...
[ "def", "send", "(", "self", ",", "message", ")", ":", "\"alternative to Connection.send_preallocated.\"", "if", "not", "isinstance", "(", "message", ",", "Message", ")", ":", "raise", "TypeError", "(", "\"message must be a Message\"", ")", "assert", "not", "self", ...
alternative to Connection.send_preallocated.
[ "alternative", "to", "Connection", ".", "send_preallocated", "." ]
59e4fbe8b8111ceead884e50d1973901a0a2d240
https://github.com/ldo/dbussy/blob/59e4fbe8b8111ceead884e50d1973901a0a2d240/dbussy.py#L3869-L3879
train
ldo/dbussy
dbussy.py
Message.new_error
def new_error(self, name, message) : "creates a new DBUS.MESSAGE_TYPE_ERROR message that is a reply to this Message." result = dbus.dbus_message_new_error(self._dbobj, name.encode(), (lambda : None, lambda : message.encode())[message != None]()) if result == None : raise CallFailed("...
python
def new_error(self, name, message) : "creates a new DBUS.MESSAGE_TYPE_ERROR message that is a reply to this Message." result = dbus.dbus_message_new_error(self._dbobj, name.encode(), (lambda : None, lambda : message.encode())[message != None]()) if result == None : raise CallFailed("...
[ "def", "new_error", "(", "self", ",", "name", ",", "message", ")", ":", "\"creates a new DBUS.MESSAGE_TYPE_ERROR message that is a reply to this Message.\"", "result", "=", "dbus", ".", "dbus_message_new_error", "(", "self", ".", "_dbobj", ",", "name", ".", "encode", ...
creates a new DBUS.MESSAGE_TYPE_ERROR message that is a reply to this Message.
[ "creates", "a", "new", "DBUS", ".", "MESSAGE_TYPE_ERROR", "message", "that", "is", "a", "reply", "to", "this", "Message", "." ]
59e4fbe8b8111ceead884e50d1973901a0a2d240
https://github.com/ldo/dbussy/blob/59e4fbe8b8111ceead884e50d1973901a0a2d240/dbussy.py#L3930-L3937
train
ldo/dbussy
dbussy.py
Message.new_method_call
def new_method_call(celf, destination, path, iface, method) : "creates a new DBUS.MESSAGE_TYPE_METHOD_CALL message." result = dbus.dbus_message_new_method_call \ ( (lambda : None, lambda : destination.encode())[destination != None](), path.encode(), (lambda ...
python
def new_method_call(celf, destination, path, iface, method) : "creates a new DBUS.MESSAGE_TYPE_METHOD_CALL message." result = dbus.dbus_message_new_method_call \ ( (lambda : None, lambda : destination.encode())[destination != None](), path.encode(), (lambda ...
[ "def", "new_method_call", "(", "celf", ",", "destination", ",", "path", ",", "iface", ",", "method", ")", ":", "\"creates a new DBUS.MESSAGE_TYPE_METHOD_CALL message.\"", "result", "=", "dbus", ".", "dbus_message_new_method_call", "(", "(", "lambda", ":", "None", ",...
creates a new DBUS.MESSAGE_TYPE_METHOD_CALL message.
[ "creates", "a", "new", "DBUS", ".", "MESSAGE_TYPE_METHOD_CALL", "message", "." ]
59e4fbe8b8111ceead884e50d1973901a0a2d240
https://github.com/ldo/dbussy/blob/59e4fbe8b8111ceead884e50d1973901a0a2d240/dbussy.py#L3943-L3956
train
ldo/dbussy
dbussy.py
Message.new_method_return
def new_method_return(self) : "creates a new DBUS.MESSAGE_TYPE_METHOD_RETURN that is a reply to this Message." result = dbus.dbus_message_new_method_return(self._dbobj) if result == None : raise CallFailed("dbus_message_new_method_return") #end if return \ ...
python
def new_method_return(self) : "creates a new DBUS.MESSAGE_TYPE_METHOD_RETURN that is a reply to this Message." result = dbus.dbus_message_new_method_return(self._dbobj) if result == None : raise CallFailed("dbus_message_new_method_return") #end if return \ ...
[ "def", "new_method_return", "(", "self", ")", ":", "\"creates a new DBUS.MESSAGE_TYPE_METHOD_RETURN that is a reply to this Message.\"", "result", "=", "dbus", ".", "dbus_message_new_method_return", "(", "self", ".", "_dbobj", ")", "if", "result", "==", "None", ":", "rais...
creates a new DBUS.MESSAGE_TYPE_METHOD_RETURN that is a reply to this Message.
[ "creates", "a", "new", "DBUS", ".", "MESSAGE_TYPE_METHOD_RETURN", "that", "is", "a", "reply", "to", "this", "Message", "." ]
59e4fbe8b8111ceead884e50d1973901a0a2d240
https://github.com/ldo/dbussy/blob/59e4fbe8b8111ceead884e50d1973901a0a2d240/dbussy.py#L3959-L3966
train
ldo/dbussy
dbussy.py
Message.new_signal
def new_signal(celf, path, iface, name) : "creates a new DBUS.MESSAGE_TYPE_SIGNAL message." result = dbus.dbus_message_new_signal(path.encode(), iface.encode(), name.encode()) if result == None : raise CallFailed("dbus_message_new_signal") #end if return \ ...
python
def new_signal(celf, path, iface, name) : "creates a new DBUS.MESSAGE_TYPE_SIGNAL message." result = dbus.dbus_message_new_signal(path.encode(), iface.encode(), name.encode()) if result == None : raise CallFailed("dbus_message_new_signal") #end if return \ ...
[ "def", "new_signal", "(", "celf", ",", "path", ",", "iface", ",", "name", ")", ":", "\"creates a new DBUS.MESSAGE_TYPE_SIGNAL message.\"", "result", "=", "dbus", ".", "dbus_message_new_signal", "(", "path", ".", "encode", "(", ")", ",", "iface", ".", "encode", ...
creates a new DBUS.MESSAGE_TYPE_SIGNAL message.
[ "creates", "a", "new", "DBUS", ".", "MESSAGE_TYPE_SIGNAL", "message", "." ]
59e4fbe8b8111ceead884e50d1973901a0a2d240
https://github.com/ldo/dbussy/blob/59e4fbe8b8111ceead884e50d1973901a0a2d240/dbussy.py#L3970-L3977
train
ldo/dbussy
dbussy.py
Message.copy
def copy(self) : "creates a copy of this Message." result = dbus.dbus_message_copy(self._dbobj) if result == None : raise CallFailed("dbus_message_copy") #end if return \ type(self)(result)
python
def copy(self) : "creates a copy of this Message." result = dbus.dbus_message_copy(self._dbobj) if result == None : raise CallFailed("dbus_message_copy") #end if return \ type(self)(result)
[ "def", "copy", "(", "self", ")", ":", "\"creates a copy of this Message.\"", "result", "=", "dbus", ".", "dbus_message_copy", "(", "self", ".", "_dbobj", ")", "if", "result", "==", "None", ":", "raise", "CallFailed", "(", "\"dbus_message_copy\"", ")", "return", ...
creates a copy of this Message.
[ "creates", "a", "copy", "of", "this", "Message", "." ]
59e4fbe8b8111ceead884e50d1973901a0a2d240
https://github.com/ldo/dbussy/blob/59e4fbe8b8111ceead884e50d1973901a0a2d240/dbussy.py#L3980-L3987
train
ldo/dbussy
dbussy.py
Message.iter_init
def iter_init(self) : "creates an iterator for extracting the arguments of the Message." iter = self.ExtractIter(None) if dbus.dbus_message_iter_init(self._dbobj, iter._dbobj) == 0 : iter._nulliter = True #end if return \ iter
python
def iter_init(self) : "creates an iterator for extracting the arguments of the Message." iter = self.ExtractIter(None) if dbus.dbus_message_iter_init(self._dbobj, iter._dbobj) == 0 : iter._nulliter = True #end if return \ iter
[ "def", "iter_init", "(", "self", ")", ":", "\"creates an iterator for extracting the arguments of the Message.\"", "iter", "=", "self", ".", "ExtractIter", "(", "None", ")", "if", "dbus", ".", "dbus_message_iter_init", "(", "self", ".", "_dbobj", ",", "iter", ".", ...
creates an iterator for extracting the arguments of the Message.
[ "creates", "an", "iterator", "for", "extracting", "the", "arguments", "of", "the", "Message", "." ]
59e4fbe8b8111ceead884e50d1973901a0a2d240
https://github.com/ldo/dbussy/blob/59e4fbe8b8111ceead884e50d1973901a0a2d240/dbussy.py#L4278-L4285
train
ldo/dbussy
dbussy.py
Message.iter_init_append
def iter_init_append(self) : "creates a Message.AppendIter for appending arguments to the Message." iter = self.AppendIter(None) dbus.dbus_message_iter_init_append(self._dbobj, iter._dbobj) return \ iter
python
def iter_init_append(self) : "creates a Message.AppendIter for appending arguments to the Message." iter = self.AppendIter(None) dbus.dbus_message_iter_init_append(self._dbobj, iter._dbobj) return \ iter
[ "def", "iter_init_append", "(", "self", ")", ":", "\"creates a Message.AppendIter for appending arguments to the Message.\"", "iter", "=", "self", ".", "AppendIter", "(", "None", ")", "dbus", ".", "dbus_message_iter_init_append", "(", "self", ".", "_dbobj", ",", "iter",...
creates a Message.AppendIter for appending arguments to the Message.
[ "creates", "a", "Message", ".", "AppendIter", "for", "appending", "arguments", "to", "the", "Message", "." ]
59e4fbe8b8111ceead884e50d1973901a0a2d240
https://github.com/ldo/dbussy/blob/59e4fbe8b8111ceead884e50d1973901a0a2d240/dbussy.py#L4329-L4334
train
ldo/dbussy
dbussy.py
Message.error_name
def error_name(self) : "the error name for a DBUS.MESSAGE_TYPE_ERROR message." result = dbus.dbus_message_get_error_name(self._dbobj) if result != None : result = result.decode() #end if return \ result
python
def error_name(self) : "the error name for a DBUS.MESSAGE_TYPE_ERROR message." result = dbus.dbus_message_get_error_name(self._dbobj) if result != None : result = result.decode() #end if return \ result
[ "def", "error_name", "(", "self", ")", ":", "\"the error name for a DBUS.MESSAGE_TYPE_ERROR message.\"", "result", "=", "dbus", ".", "dbus_message_get_error_name", "(", "self", ".", "_dbobj", ")", "if", "result", "!=", "None", ":", "result", "=", "result", ".", "d...
the error name for a DBUS.MESSAGE_TYPE_ERROR message.
[ "the", "error", "name", "for", "a", "DBUS", ".", "MESSAGE_TYPE_ERROR", "message", "." ]
59e4fbe8b8111ceead884e50d1973901a0a2d240
https://github.com/ldo/dbussy/blob/59e4fbe8b8111ceead884e50d1973901a0a2d240/dbussy.py#L4519-L4526
train
ldo/dbussy
dbussy.py
Message.destination
def destination(self) : "the bus name that the message is to be sent to." result = dbus.dbus_message_get_destination(self._dbobj) if result != None : result = result.decode() #end if return \ result
python
def destination(self) : "the bus name that the message is to be sent to." result = dbus.dbus_message_get_destination(self._dbobj) if result != None : result = result.decode() #end if return \ result
[ "def", "destination", "(", "self", ")", ":", "\"the bus name that the message is to be sent to.\"", "result", "=", "dbus", ".", "dbus_message_get_destination", "(", "self", ".", "_dbobj", ")", "if", "result", "!=", "None", ":", "result", "=", "result", ".", "decod...
the bus name that the message is to be sent to.
[ "the", "bus", "name", "that", "the", "message", "is", "to", "be", "sent", "to", "." ]
59e4fbe8b8111ceead884e50d1973901a0a2d240
https://github.com/ldo/dbussy/blob/59e4fbe8b8111ceead884e50d1973901a0a2d240/dbussy.py#L4537-L4544
train
ldo/dbussy
dbussy.py
Message.marshal
def marshal(self) : "serializes this Message into the wire protocol format and returns a bytes object." buf = ct.POINTER(ct.c_ubyte)() nr_bytes = ct.c_int() if not dbus.dbus_message_marshal(self._dbobj, ct.byref(buf), ct.byref(nr_bytes)) : raise CallFailed("dbus_message_marsh...
python
def marshal(self) : "serializes this Message into the wire protocol format and returns a bytes object." buf = ct.POINTER(ct.c_ubyte)() nr_bytes = ct.c_int() if not dbus.dbus_message_marshal(self._dbobj, ct.byref(buf), ct.byref(nr_bytes)) : raise CallFailed("dbus_message_marsh...
[ "def", "marshal", "(", "self", ")", ":", "\"serializes this Message into the wire protocol format and returns a bytes object.\"", "buf", "=", "ct", ".", "POINTER", "(", "ct", ".", "c_ubyte", ")", "(", ")", "nr_bytes", "=", "ct", ".", "c_int", "(", ")", "if", "no...
serializes this Message into the wire protocol format and returns a bytes object.
[ "serializes", "this", "Message", "into", "the", "wire", "protocol", "format", "and", "returns", "a", "bytes", "object", "." ]
59e4fbe8b8111ceead884e50d1973901a0a2d240
https://github.com/ldo/dbussy/blob/59e4fbe8b8111ceead884e50d1973901a0a2d240/dbussy.py#L4690-L4706
train
ldo/dbussy
dbussy.py
PendingCall.cancel
def cancel(self) : "tells libdbus you no longer care about the pending incoming message." dbus.dbus_pending_call_cancel(self._dbobj) if self._awaiting != None : # This probably shouldn’t occur. Looking at the source of libdbus, # it doesn’t keep track of any “cancelled” s...
python
def cancel(self) : "tells libdbus you no longer care about the pending incoming message." dbus.dbus_pending_call_cancel(self._dbobj) if self._awaiting != None : # This probably shouldn’t occur. Looking at the source of libdbus, # it doesn’t keep track of any “cancelled” s...
[ "def", "cancel", "(", "self", ")", ":", "\"tells libdbus you no longer care about the pending incoming message.\"", "dbus", ".", "dbus_pending_call_cancel", "(", "self", ".", "_dbobj", ")", "if", "self", ".", "_awaiting", "!=", "None", ":", "self", ".", "_awaiting", ...
tells libdbus you no longer care about the pending incoming message.
[ "tells", "libdbus", "you", "no", "longer", "care", "about", "the", "pending", "incoming", "message", "." ]
59e4fbe8b8111ceead884e50d1973901a0a2d240
https://github.com/ldo/dbussy/blob/59e4fbe8b8111ceead884e50d1973901a0a2d240/dbussy.py#L4834-L4841
train
ldo/dbussy
dbussy.py
Error.set
def set(self, name, msg) : "fills in the error name and message." dbus.dbus_set_error(self._dbobj, name.encode(), b"%s", msg.encode())
python
def set(self, name, msg) : "fills in the error name and message." dbus.dbus_set_error(self._dbobj, name.encode(), b"%s", msg.encode())
[ "def", "set", "(", "self", ",", "name", ",", "msg", ")", ":", "\"fills in the error name and message.\"", "dbus", ".", "dbus_set_error", "(", "self", ".", "_dbobj", ",", "name", ".", "encode", "(", ")", ",", "b\"%s\"", ",", "msg", ".", "encode", "(", ")"...
fills in the error name and message.
[ "fills", "in", "the", "error", "name", "and", "message", "." ]
59e4fbe8b8111ceead884e50d1973901a0a2d240
https://github.com/ldo/dbussy/blob/59e4fbe8b8111ceead884e50d1973901a0a2d240/dbussy.py#L4927-L4929
train
ldo/dbussy
dbussy.py
Introspection.parse
def parse(celf, s) : "generates an Introspection tree from the given XML string description." def from_string_elts(celf, attrs, tree) : elts = dict((k, attrs[k]) for k in attrs) child_tags = dict \ ( (childclass.tag_name, childclass) ...
python
def parse(celf, s) : "generates an Introspection tree from the given XML string description." def from_string_elts(celf, attrs, tree) : elts = dict((k, attrs[k]) for k in attrs) child_tags = dict \ ( (childclass.tag_name, childclass) ...
[ "def", "parse", "(", "celf", ",", "s", ")", ":", "\"generates an Introspection tree from the given XML string description.\"", "def", "from_string_elts", "(", "celf", ",", "attrs", ",", "tree", ")", ":", "elts", "=", "dict", "(", "(", "k", ",", "attrs", "[", "...
generates an Introspection tree from the given XML string description.
[ "generates", "an", "Introspection", "tree", "from", "the", "given", "XML", "string", "description", "." ]
59e4fbe8b8111ceead884e50d1973901a0a2d240
https://github.com/ldo/dbussy/blob/59e4fbe8b8111ceead884e50d1973901a0a2d240/dbussy.py#L6141-L6195
train
ldo/dbussy
dbussy.py
Introspection.unparse
def unparse(self, indent_step = 4, max_linelen = 72) : "returns an XML string description of this Introspection tree." out = io.StringIO() def to_string(obj, indent) : tag_name = obj.tag_name attrs = [] for attrname in obj.tag_attrs : attr = ...
python
def unparse(self, indent_step = 4, max_linelen = 72) : "returns an XML string description of this Introspection tree." out = io.StringIO() def to_string(obj, indent) : tag_name = obj.tag_name attrs = [] for attrname in obj.tag_attrs : attr = ...
[ "def", "unparse", "(", "self", ",", "indent_step", "=", "4", ",", "max_linelen", "=", "72", ")", ":", "\"returns an XML string description of this Introspection tree.\"", "out", "=", "io", ".", "StringIO", "(", ")", "def", "to_string", "(", "obj", ",", "indent",...
returns an XML string description of this Introspection tree.
[ "returns", "an", "XML", "string", "description", "of", "this", "Introspection", "tree", "." ]
59e4fbe8b8111ceead884e50d1973901a0a2d240
https://github.com/ldo/dbussy/blob/59e4fbe8b8111ceead884e50d1973901a0a2d240/dbussy.py#L6198-L6291
train
ldo/dbussy
ravel.py
ErrorReturn.as_error
def as_error(self) : "fills in and returns an Error object that reports the specified error name and message." result = dbus.Error.init() result.set(self.args[0], self.args[1]) return \ result
python
def as_error(self) : "fills in and returns an Error object that reports the specified error name and message." result = dbus.Error.init() result.set(self.args[0], self.args[1]) return \ result
[ "def", "as_error", "(", "self", ")", ":", "\"fills in and returns an Error object that reports the specified error name and message.\"", "result", "=", "dbus", ".", "Error", ".", "init", "(", ")", "result", ".", "set", "(", "self", ".", "args", "[", "0", "]", ",",...
fills in and returns an Error object that reports the specified error name and message.
[ "fills", "in", "and", "returns", "an", "Error", "object", "that", "reports", "the", "specified", "error", "name", "and", "message", "." ]
59e4fbe8b8111ceead884e50d1973901a0a2d240
https://github.com/ldo/dbussy/blob/59e4fbe8b8111ceead884e50d1973901a0a2d240/ravel.py#L37-L42
train
ldo/dbussy
ravel.py
Connection.release_name_async
async def release_name_async(self, bus_name, error = None, timeout = DBUS.TIMEOUT_USE_DEFAULT) : "releases a registered bus name." assert self.loop != None, "no event loop to attach coroutine to" return \ await self.connection.bus_release_name_async(bus_name, error = error, timeout =...
python
async def release_name_async(self, bus_name, error = None, timeout = DBUS.TIMEOUT_USE_DEFAULT) : "releases a registered bus name." assert self.loop != None, "no event loop to attach coroutine to" return \ await self.connection.bus_release_name_async(bus_name, error = error, timeout =...
[ "async", "def", "release_name_async", "(", "self", ",", "bus_name", ",", "error", "=", "None", ",", "timeout", "=", "DBUS", ".", "TIMEOUT_USE_DEFAULT", ")", ":", "\"releases a registered bus name.\"", "assert", "self", ".", "loop", "!=", "None", ",", "\"no event...
releases a registered bus name.
[ "releases", "a", "registered", "bus", "name", "." ]
59e4fbe8b8111ceead884e50d1973901a0a2d240
https://github.com/ldo/dbussy/blob/59e4fbe8b8111ceead884e50d1973901a0a2d240/ravel.py#L382-L386
train
martinpitt/python-dbusmock
dbusmock/templates/bluez4.py
DefaultAdapter
def DefaultAdapter(self): '''Retrieve the default adapter ''' default_adapter = None for obj in mockobject.objects.keys(): if obj.startswith('/org/bluez/') and 'dev_' not in obj: default_adapter = obj if default_adapter: return dbus.ObjectPath(default_adapter, variant_l...
python
def DefaultAdapter(self): '''Retrieve the default adapter ''' default_adapter = None for obj in mockobject.objects.keys(): if obj.startswith('/org/bluez/') and 'dev_' not in obj: default_adapter = obj if default_adapter: return dbus.ObjectPath(default_adapter, variant_l...
[ "def", "DefaultAdapter", "(", "self", ")", ":", "default_adapter", "=", "None", "for", "obj", "in", "mockobject", ".", "objects", ".", "keys", "(", ")", ":", "if", "obj", ".", "startswith", "(", "'/org/bluez/'", ")", "and", "'dev_'", "not", "in", "obj", ...
Retrieve the default adapter
[ "Retrieve", "the", "default", "adapter" ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/bluez4.py#L155-L168
train
martinpitt/python-dbusmock
dbusmock/templates/bluez4.py
ListAdapters
def ListAdapters(self): '''List all known adapters ''' adapters = [] for obj in mockobject.objects.keys(): if obj.startswith('/org/bluez/') and 'dev_' not in obj: adapters.append(dbus.ObjectPath(obj, variant_level=1)) return dbus.Array(adapters, variant_level=1)
python
def ListAdapters(self): '''List all known adapters ''' adapters = [] for obj in mockobject.objects.keys(): if obj.startswith('/org/bluez/') and 'dev_' not in obj: adapters.append(dbus.ObjectPath(obj, variant_level=1)) return dbus.Array(adapters, variant_level=1)
[ "def", "ListAdapters", "(", "self", ")", ":", "adapters", "=", "[", "]", "for", "obj", "in", "mockobject", ".", "objects", ".", "keys", "(", ")", ":", "if", "obj", ".", "startswith", "(", "'/org/bluez/'", ")", "and", "'dev_'", "not", "in", "obj", ":"...
List all known adapters
[ "List", "all", "known", "adapters" ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/bluez4.py#L173-L182
train
martinpitt/python-dbusmock
dbusmock/templates/bluez4.py
CreateDevice
def CreateDevice(self, device_address): '''Create a new device ''' device_name = 'dev_' + device_address.replace(':', '_').upper() adapter_path = self.path path = adapter_path + '/' + device_name if path not in mockobject.objects: raise dbus.exceptions.DBusException( 'Could not ...
python
def CreateDevice(self, device_address): '''Create a new device ''' device_name = 'dev_' + device_address.replace(':', '_').upper() adapter_path = self.path path = adapter_path + '/' + device_name if path not in mockobject.objects: raise dbus.exceptions.DBusException( 'Could not ...
[ "def", "CreateDevice", "(", "self", ",", "device_address", ")", ":", "device_name", "=", "'dev_'", "+", "device_address", ".", "replace", "(", "':'", ",", "'_'", ")", ".", "upper", "(", ")", "adapter_path", "=", "self", ".", "path", "path", "=", "adapter...
Create a new device
[ "Create", "a", "new", "device" ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/bluez4.py#L187-L202
train
martinpitt/python-dbusmock
dbusmock/templates/bluez4.py
AddDevice
def AddDevice(self, adapter_device_name, device_address, alias): '''Convenience method to add a Bluetooth device You have to specify a device address which must be a valid Bluetooth address (e.g. 'AA:BB:CC:DD:EE:FF'). The alias is the human-readable name for the device (e.g. as set on the device itself...
python
def AddDevice(self, adapter_device_name, device_address, alias): '''Convenience method to add a Bluetooth device You have to specify a device address which must be a valid Bluetooth address (e.g. 'AA:BB:CC:DD:EE:FF'). The alias is the human-readable name for the device (e.g. as set on the device itself...
[ "def", "AddDevice", "(", "self", ",", "adapter_device_name", ",", "device_address", ",", "alias", ")", ":", "device_name", "=", "'dev_'", "+", "device_address", ".", "replace", "(", "':'", ",", "'_'", ")", ".", "upper", "(", ")", "adapter_path", "=", "'/or...
Convenience method to add a Bluetooth device You have to specify a device address which must be a valid Bluetooth address (e.g. 'AA:BB:CC:DD:EE:FF'). The alias is the human-readable name for the device (e.g. as set on the device itself), and the adapter device name is the device_name passed to AddAdapt...
[ "Convenience", "method", "to", "add", "a", "Bluetooth", "device" ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/bluez4.py#L207-L269
train
martinpitt/python-dbusmock
dbusmock/templates/bluez4.py
ListDevices
def ListDevices(self): '''List all known devices ''' devices = [] for obj in mockobject.objects.keys(): if obj.startswith('/org/bluez/') and 'dev_' in obj: devices.append(dbus.ObjectPath(obj, variant_level=1)) return dbus.Array(devices, variant_level=1)
python
def ListDevices(self): '''List all known devices ''' devices = [] for obj in mockobject.objects.keys(): if obj.startswith('/org/bluez/') and 'dev_' in obj: devices.append(dbus.ObjectPath(obj, variant_level=1)) return dbus.Array(devices, variant_level=1)
[ "def", "ListDevices", "(", "self", ")", ":", "devices", "=", "[", "]", "for", "obj", "in", "mockobject", ".", "objects", ".", "keys", "(", ")", ":", "if", "obj", ".", "startswith", "(", "'/org/bluez/'", ")", "and", "'dev_'", "in", "obj", ":", "device...
List all known devices
[ "List", "all", "known", "devices" ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/bluez4.py#L274-L283
train
martinpitt/python-dbusmock
dbusmock/templates/bluez4.py
FindDevice
def FindDevice(self, address): '''Find a specific device by bluetooth address. ''' for obj in mockobject.objects.keys(): if obj.startswith('/org/bluez/') and 'dev_' in obj: o = mockobject.objects[obj] if o.props[DEVICE_IFACE]['Address'] \ == dbus.String(ad...
python
def FindDevice(self, address): '''Find a specific device by bluetooth address. ''' for obj in mockobject.objects.keys(): if obj.startswith('/org/bluez/') and 'dev_' in obj: o = mockobject.objects[obj] if o.props[DEVICE_IFACE]['Address'] \ == dbus.String(ad...
[ "def", "FindDevice", "(", "self", ",", "address", ")", ":", "for", "obj", "in", "mockobject", ".", "objects", ".", "keys", "(", ")", ":", "if", "obj", ".", "startswith", "(", "'/org/bluez/'", ")", "and", "'dev_'", "in", "obj", ":", "o", "=", "mockobj...
Find a specific device by bluetooth address.
[ "Find", "a", "specific", "device", "by", "bluetooth", "address", "." ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/bluez4.py#L288-L299
train
martinpitt/python-dbusmock
dbusmock/templates/bluez4.py
Connect
def Connect(self): '''Connect a device ''' device_path = self.path if device_path not in mockobject.objects: raise dbus.exceptions.DBusException('No such device.', name='org.bluez.Error.NoSuchDevice') device = mockobject.objects[device_path] dev...
python
def Connect(self): '''Connect a device ''' device_path = self.path if device_path not in mockobject.objects: raise dbus.exceptions.DBusException('No such device.', name='org.bluez.Error.NoSuchDevice') device = mockobject.objects[device_path] dev...
[ "def", "Connect", "(", "self", ")", ":", "device_path", "=", "self", ".", "path", "if", "device_path", "not", "in", "mockobject", ".", "objects", ":", "raise", "dbus", ".", "exceptions", ".", "DBusException", "(", "'No such device.'", ",", "name", "=", "'o...
Connect a device
[ "Connect", "a", "device" ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/bluez4.py#L376-L396
train
martinpitt/python-dbusmock
dbusmock/templates/bluez4.py
Disconnect
def Disconnect(self): '''Disconnect a device ''' device_path = self.path if device_path not in mockobject.objects: raise dbus.exceptions.DBusException('No such device.', name='org.bluez.Error.NoSuchDevice') device = mockobject.objects[device_path] ...
python
def Disconnect(self): '''Disconnect a device ''' device_path = self.path if device_path not in mockobject.objects: raise dbus.exceptions.DBusException('No such device.', name='org.bluez.Error.NoSuchDevice') device = mockobject.objects[device_path] ...
[ "def", "Disconnect", "(", "self", ")", ":", "device_path", "=", "self", ".", "path", "if", "device_path", "not", "in", "mockobject", ".", "objects", ":", "raise", "dbus", ".", "exceptions", ".", "DBusException", "(", "'No such device.'", ",", "name", "=", ...
Disconnect a device
[ "Disconnect", "a", "device" ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/bluez4.py#L401-L425
train
martinpitt/python-dbusmock
dbusmock/templates/networkmanager.py
AddEthernetDevice
def AddEthernetDevice(self, device_name, iface_name, state): '''Add an ethernet device. You have to specify device_name, device interface name (e. g. eth0), and state. You can use the predefined DeviceState values (e. g. DeviceState.ACTIVATED) or supply a numeric value. For valid state values pleas...
python
def AddEthernetDevice(self, device_name, iface_name, state): '''Add an ethernet device. You have to specify device_name, device interface name (e. g. eth0), and state. You can use the predefined DeviceState values (e. g. DeviceState.ACTIVATED) or supply a numeric value. For valid state values pleas...
[ "def", "AddEthernetDevice", "(", "self", ",", "device_name", ",", "iface_name", ",", "state", ")", ":", "path", "=", "'/org/freedesktop/NetworkManager/Devices/'", "+", "device_name", "wired_props", "=", "{", "'Carrier'", ":", "False", ",", "'HwAddress'", ":", "dbu...
Add an ethernet device. You have to specify device_name, device interface name (e. g. eth0), and state. You can use the predefined DeviceState values (e. g. DeviceState.ACTIVATED) or supply a numeric value. For valid state values please visit http://projects.gnome.org/NetworkManager/developers/api/...
[ "Add", "an", "ethernet", "device", "." ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/networkmanager.py#L299-L343
train
martinpitt/python-dbusmock
dbusmock/templates/networkmanager.py
AddWiFiDevice
def AddWiFiDevice(self, device_name, iface_name, state): '''Add a WiFi Device. You have to specify device_name, device interface name (e. g. wlan0) and state. You can use the predefined DeviceState values (e. g. DeviceState.ACTIVATED) or supply a numeric value. For valid state values, please visit...
python
def AddWiFiDevice(self, device_name, iface_name, state): '''Add a WiFi Device. You have to specify device_name, device interface name (e. g. wlan0) and state. You can use the predefined DeviceState values (e. g. DeviceState.ACTIVATED) or supply a numeric value. For valid state values, please visit...
[ "def", "AddWiFiDevice", "(", "self", ",", "device_name", ",", "iface_name", ",", "state", ")", ":", "path", "=", "'/org/freedesktop/NetworkManager/Devices/'", "+", "device_name", "self", ".", "AddObject", "(", "path", ",", "WIRELESS_DEVICE_IFACE", ",", "{", "'HwAd...
Add a WiFi Device. You have to specify device_name, device interface name (e. g. wlan0) and state. You can use the predefined DeviceState values (e. g. DeviceState.ACTIVATED) or supply a numeric value. For valid state values, please visit http://projects.gnome.org/NetworkManager/developers/api/09/...
[ "Add", "a", "WiFi", "Device", "." ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/networkmanager.py#L348-L404
train
martinpitt/python-dbusmock
dbusmock/templates/networkmanager.py
AddAccessPoint
def AddAccessPoint(self, dev_path, ap_name, ssid, hw_address, mode, frequency, rate, strength, security): '''Add an access point to an existing WiFi device. You have to specify WiFi Device path, Access Point object name, ssid, hw_address, mode, frequency, rate, strength and security. ...
python
def AddAccessPoint(self, dev_path, ap_name, ssid, hw_address, mode, frequency, rate, strength, security): '''Add an access point to an existing WiFi device. You have to specify WiFi Device path, Access Point object name, ssid, hw_address, mode, frequency, rate, strength and security. ...
[ "def", "AddAccessPoint", "(", "self", ",", "dev_path", ",", "ap_name", ",", "ssid", ",", "hw_address", ",", "mode", ",", "frequency", ",", "rate", ",", "strength", ",", "security", ")", ":", "dev_obj", "=", "dbusmock", ".", "get_object", "(", "dev_path", ...
Add an access point to an existing WiFi device. You have to specify WiFi Device path, Access Point object name, ssid, hw_address, mode, frequency, rate, strength and security. For valid access point property values, please visit http://projects.gnome.org/NetworkManager/developers/api/09/spec.html#org.f...
[ "Add", "an", "access", "point", "to", "an", "existing", "WiFi", "device", "." ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/networkmanager.py#L409-L456
train
martinpitt/python-dbusmock
dbusmock/templates/networkmanager.py
AddWiFiConnection
def AddWiFiConnection(self, dev_path, connection_name, ssid_name, key_mgmt): '''Add an available connection to an existing WiFi device and access point. You have to specify WiFi Device path, Connection object name, SSID and key management. The SSID must match one of the previously created access point...
python
def AddWiFiConnection(self, dev_path, connection_name, ssid_name, key_mgmt): '''Add an available connection to an existing WiFi device and access point. You have to specify WiFi Device path, Connection object name, SSID and key management. The SSID must match one of the previously created access point...
[ "def", "AddWiFiConnection", "(", "self", ",", "dev_path", ",", "connection_name", ",", "ssid_name", ",", "key_mgmt", ")", ":", "dev_obj", "=", "dbusmock", ".", "get_object", "(", "dev_path", ")", "connection_path", "=", "'/org/freedesktop/NetworkManager/Settings/'", ...
Add an available connection to an existing WiFi device and access point. You have to specify WiFi Device path, Connection object name, SSID and key management. The SSID must match one of the previously created access points. Please note that this does not set any global properties. Returns the n...
[ "Add", "an", "available", "connection", "to", "an", "existing", "WiFi", "device", "and", "access", "point", "." ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/networkmanager.py#L461-L557
train
martinpitt/python-dbusmock
dbusmock/templates/networkmanager.py
AddActiveConnection
def AddActiveConnection(self, devices, connection_device, specific_object, name, state): '''Add an active connection to an existing WiFi device. You have to a list of the involved WiFi devices, the connection path, the access point path, ActiveConnection object name and connection state. Please no...
python
def AddActiveConnection(self, devices, connection_device, specific_object, name, state): '''Add an active connection to an existing WiFi device. You have to a list of the involved WiFi devices, the connection path, the access point path, ActiveConnection object name and connection state. Please no...
[ "def", "AddActiveConnection", "(", "self", ",", "devices", ",", "connection_device", ",", "specific_object", ",", "name", ",", "state", ")", ":", "conn_obj", "=", "dbusmock", ".", "get_object", "(", "connection_device", ")", "settings", "=", "conn_obj", ".", "...
Add an active connection to an existing WiFi device. You have to a list of the involved WiFi devices, the connection path, the access point path, ActiveConnection object name and connection state. Please note that this does not set any global properties. Returns the new object path.
[ "Add", "an", "active", "connection", "to", "an", "existing", "WiFi", "device", "." ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/networkmanager.py#L562-L608
train
martinpitt/python-dbusmock
dbusmock/templates/networkmanager.py
RemoveAccessPoint
def RemoveAccessPoint(self, dev_path, ap_path): '''Remove the specified access point. You have to specify the device to remove the access point from, and the path of the access point. Please note that this does not set any global properties. ''' dev_obj = dbusmock.get_object(dev_path) ap...
python
def RemoveAccessPoint(self, dev_path, ap_path): '''Remove the specified access point. You have to specify the device to remove the access point from, and the path of the access point. Please note that this does not set any global properties. ''' dev_obj = dbusmock.get_object(dev_path) ap...
[ "def", "RemoveAccessPoint", "(", "self", ",", "dev_path", ",", "ap_path", ")", ":", "dev_obj", "=", "dbusmock", ".", "get_object", "(", "dev_path", ")", "aps", "=", "dev_obj", ".", "Get", "(", "WIRELESS_DEVICE_IFACE", ",", "'AccessPoints'", ")", "aps", ".", ...
Remove the specified access point. You have to specify the device to remove the access point from, and the path of the access point. Please note that this does not set any global properties.
[ "Remove", "the", "specified", "access", "point", "." ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/networkmanager.py#L613-L633
train
martinpitt/python-dbusmock
dbusmock/templates/networkmanager.py
RemoveWifiConnection
def RemoveWifiConnection(self, dev_path, connection_path): '''Remove the specified WiFi connection. You have to specify the device to remove the connection from, and the path of the Connection. Please note that this does not set any global properties. ''' dev_obj = dbusmock.get_object(dev_pat...
python
def RemoveWifiConnection(self, dev_path, connection_path): '''Remove the specified WiFi connection. You have to specify the device to remove the connection from, and the path of the Connection. Please note that this does not set any global properties. ''' dev_obj = dbusmock.get_object(dev_pat...
[ "def", "RemoveWifiConnection", "(", "self", ",", "dev_path", ",", "connection_path", ")", ":", "dev_obj", "=", "dbusmock", ".", "get_object", "(", "dev_path", ")", "settings_obj", "=", "dbusmock", ".", "get_object", "(", "SETTINGS_OBJ", ")", "connections", "=", ...
Remove the specified WiFi connection. You have to specify the device to remove the connection from, and the path of the Connection. Please note that this does not set any global properties.
[ "Remove", "the", "specified", "WiFi", "connection", "." ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/networkmanager.py#L638-L668
train
martinpitt/python-dbusmock
dbusmock/templates/networkmanager.py
RemoveActiveConnection
def RemoveActiveConnection(self, dev_path, active_connection_path): '''Remove the specified ActiveConnection. You have to specify the device to remove the connection from, and the path of the ActiveConnection. Please note that this does not set any global properties. ''' self.SetDeviceDisconne...
python
def RemoveActiveConnection(self, dev_path, active_connection_path): '''Remove the specified ActiveConnection. You have to specify the device to remove the connection from, and the path of the ActiveConnection. Please note that this does not set any global properties. ''' self.SetDeviceDisconne...
[ "def", "RemoveActiveConnection", "(", "self", ",", "dev_path", ",", "active_connection_path", ")", ":", "self", ".", "SetDeviceDisconnected", "(", "dev_path", ")", "NM", "=", "dbusmock", ".", "get_object", "(", "MANAGER_OBJ", ")", "active_connections", "=", "NM", ...
Remove the specified ActiveConnection. You have to specify the device to remove the connection from, and the path of the ActiveConnection. Please note that this does not set any global properties.
[ "Remove", "the", "specified", "ActiveConnection", "." ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/networkmanager.py#L673-L693
train
martinpitt/python-dbusmock
dbusmock/templates/networkmanager.py
SettingsAddConnection
def SettingsAddConnection(self, connection_settings): '''Add a connection. connection_settings is a String String Variant Map Map. See https://developer.gnome.org/NetworkManager/0.9/spec.html #type-String_String_Variant_Map_Map If you omit uuid, this method adds one for you. ''' if 'u...
python
def SettingsAddConnection(self, connection_settings): '''Add a connection. connection_settings is a String String Variant Map Map. See https://developer.gnome.org/NetworkManager/0.9/spec.html #type-String_String_Variant_Map_Map If you omit uuid, this method adds one for you. ''' if 'u...
[ "def", "SettingsAddConnection", "(", "self", ",", "connection_settings", ")", ":", "if", "'uuid'", "not", "in", "connection_settings", "[", "'connection'", "]", ":", "connection_settings", "[", "'connection'", "]", "[", "'uuid'", "]", "=", "str", "(", "uuid", ...
Add a connection. connection_settings is a String String Variant Map Map. See https://developer.gnome.org/NetworkManager/0.9/spec.html #type-String_String_Variant_Map_Map If you omit uuid, this method adds one for you.
[ "Add", "a", "connection", "." ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/networkmanager.py#L698-L765
train
martinpitt/python-dbusmock
dbusmock/templates/networkmanager.py
ConnectionUpdate
def ConnectionUpdate(self, settings): '''Update settings on a connection. settings is a String String Variant Map Map. See https://developer.gnome.org/NetworkManager/0.9/spec.html #type-String_String_Variant_Map_Map ''' connection_path = self.connection_path NM = dbusmock.get_object(MA...
python
def ConnectionUpdate(self, settings): '''Update settings on a connection. settings is a String String Variant Map Map. See https://developer.gnome.org/NetworkManager/0.9/spec.html #type-String_String_Variant_Map_Map ''' connection_path = self.connection_path NM = dbusmock.get_object(MA...
[ "def", "ConnectionUpdate", "(", "self", ",", "settings", ")", ":", "connection_path", "=", "self", ".", "connection_path", "NM", "=", "dbusmock", ".", "get_object", "(", "MANAGER_OBJ", ")", "settings_obj", "=", "dbusmock", ".", "get_object", "(", "SETTINGS_OBJ",...
Update settings on a connection. settings is a String String Variant Map Map. See https://developer.gnome.org/NetworkManager/0.9/spec.html #type-String_String_Variant_Map_Map
[ "Update", "settings", "on", "a", "connection", "." ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/networkmanager.py#L779-L823
train
martinpitt/python-dbusmock
dbusmock/templates/networkmanager.py
ConnectionDelete
def ConnectionDelete(self): '''Deletes a connection. This also * removes the deleted connection from any device, * removes any active connection(s) it might be associated with, * removes it from the Settings interface, * as well as deletes the object from the mock. Note: If...
python
def ConnectionDelete(self): '''Deletes a connection. This also * removes the deleted connection from any device, * removes any active connection(s) it might be associated with, * removes it from the Settings interface, * as well as deletes the object from the mock. Note: If...
[ "def", "ConnectionDelete", "(", "self", ")", ":", "connection_path", "=", "self", ".", "connection_path", "NM", "=", "dbusmock", ".", "get_object", "(", "MANAGER_OBJ", ")", "settings_obj", "=", "dbusmock", ".", "get_object", "(", "SETTINGS_OBJ", ")", "active_con...
Deletes a connection. This also * removes the deleted connection from any device, * removes any active connection(s) it might be associated with, * removes it from the Settings interface, * as well as deletes the object from the mock. Note: If this was the only active connectio...
[ "Deletes", "a", "connection", "." ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/networkmanager.py#L853-L913
train
martinpitt/python-dbusmock
dbusmock/templates/upower.py
AddAC
def AddAC(self, device_name, model_name): '''Convenience method to add an AC object You have to specify a device name which must be a valid part of an object path, e. g. "mock_ac", and an arbitrary model name. Please note that this does not set any global properties such as "on-battery". Retu...
python
def AddAC(self, device_name, model_name): '''Convenience method to add an AC object You have to specify a device name which must be a valid part of an object path, e. g. "mock_ac", and an arbitrary model name. Please note that this does not set any global properties such as "on-battery". Retu...
[ "def", "AddAC", "(", "self", ",", "device_name", ",", "model_name", ")", ":", "path", "=", "'/org/freedesktop/UPower/devices/'", "+", "device_name", "self", ".", "AddObject", "(", "path", ",", "DEVICE_IFACE", ",", "{", "'PowerSupply'", ":", "dbus", ".", "Boole...
Convenience method to add an AC object You have to specify a device name which must be a valid part of an object path, e. g. "mock_ac", and an arbitrary model name. Please note that this does not set any global properties such as "on-battery". Returns the new object path.
[ "Convenience", "method", "to", "add", "an", "AC", "object" ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/upower.py#L101-L122
train
martinpitt/python-dbusmock
dbusmock/templates/upower.py
AddDischargingBattery
def AddDischargingBattery(self, device_name, model_name, percentage, seconds_to_empty): '''Convenience method to add a discharging battery object You have to specify a device name which must be a valid part of an object path, e. g. "mock_ac", an arbitrary model name, the charge percentage, and the seco...
python
def AddDischargingBattery(self, device_name, model_name, percentage, seconds_to_empty): '''Convenience method to add a discharging battery object You have to specify a device name which must be a valid part of an object path, e. g. "mock_ac", an arbitrary model name, the charge percentage, and the seco...
[ "def", "AddDischargingBattery", "(", "self", ",", "device_name", ",", "model_name", ",", "percentage", ",", "seconds_to_empty", ")", ":", "path", "=", "'/org/freedesktop/UPower/devices/'", "+", "device_name", "self", ".", "AddObject", "(", "path", ",", "DEVICE_IFACE...
Convenience method to add a discharging battery object You have to specify a device name which must be a valid part of an object path, e. g. "mock_ac", an arbitrary model name, the charge percentage, and the seconds until the battery is empty. Please note that this does not set any global properties s...
[ "Convenience", "method", "to", "add", "a", "discharging", "battery", "object" ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/upower.py#L127-L157
train
martinpitt/python-dbusmock
dbusmock/templates/upower.py
SetupDisplayDevice
def SetupDisplayDevice(self, type, state, percentage, energy, energy_full, energy_rate, time_to_empty, time_to_full, is_present, icon_name, warning_level): '''Convenience method to configure DisplayDevice properties This calls Set() for all properties that the Disp...
python
def SetupDisplayDevice(self, type, state, percentage, energy, energy_full, energy_rate, time_to_empty, time_to_full, is_present, icon_name, warning_level): '''Convenience method to configure DisplayDevice properties This calls Set() for all properties that the Disp...
[ "def", "SetupDisplayDevice", "(", "self", ",", "type", ",", "state", ",", "percentage", ",", "energy", ",", "energy_full", ",", "energy_rate", ",", "time_to_empty", ",", "time_to_full", ",", "is_present", ",", "icon_name", ",", "warning_level", ")", ":", "if",...
Convenience method to configure DisplayDevice properties This calls Set() for all properties that the DisplayDevice is defined to have, and is shorter if you have to completely set it up instead of changing just one or two properties. This is only available when mocking the 1.0 API.
[ "Convenience", "method", "to", "configure", "DisplayDevice", "properties" ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/upower.py#L197-L234
train
martinpitt/python-dbusmock
dbusmock/templates/upower.py
SetDeviceProperties
def SetDeviceProperties(self, object_path, properties): '''Convenience method to Set a device's properties. object_path: the device to update properties: dictionary of keys to dbus variants. If the 1.0 API is being mocked, changing this property will trigger the device's PropertiesChanged signal; ...
python
def SetDeviceProperties(self, object_path, properties): '''Convenience method to Set a device's properties. object_path: the device to update properties: dictionary of keys to dbus variants. If the 1.0 API is being mocked, changing this property will trigger the device's PropertiesChanged signal; ...
[ "def", "SetDeviceProperties", "(", "self", ",", "object_path", ",", "properties", ")", ":", "device", "=", "dbusmock", ".", "get_object", "(", "object_path", ")", "for", "key", ",", "value", "in", "properties", ".", "items", "(", ")", ":", "device", ".", ...
Convenience method to Set a device's properties. object_path: the device to update properties: dictionary of keys to dbus variants. If the 1.0 API is being mocked, changing this property will trigger the device's PropertiesChanged signal; otherwise, the older org.freedesktop.UPower DeviceChanged s...
[ "Convenience", "method", "to", "Set", "a", "device", "s", "properties", "." ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/upower.py#L238-L256
train
martinpitt/python-dbusmock
dbusmock/templates/logind.py
AddSeat
def AddSeat(self, seat): '''Convenience method to add a seat. Return the object path of the new seat. ''' seat_path = '/org/freedesktop/login1/seat/' + seat if seat_path in mockobject.objects: raise dbus.exceptions.DBusException('Seat %s already exists' % seat, ...
python
def AddSeat(self, seat): '''Convenience method to add a seat. Return the object path of the new seat. ''' seat_path = '/org/freedesktop/login1/seat/' + seat if seat_path in mockobject.objects: raise dbus.exceptions.DBusException('Seat %s already exists' % seat, ...
[ "def", "AddSeat", "(", "self", ",", "seat", ")", ":", "seat_path", "=", "'/org/freedesktop/login1/seat/'", "+", "seat", "if", "seat_path", "in", "mockobject", ".", "objects", ":", "raise", "dbus", ".", "exceptions", ".", "DBusException", "(", "'Seat %s already e...
Convenience method to add a seat. Return the object path of the new seat.
[ "Convenience", "method", "to", "add", "a", "seat", "." ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/logind.py#L117-L145
train
martinpitt/python-dbusmock
dbusmock/templates/logind.py
AddUser
def AddUser(self, uid, username, active): '''Convenience method to add a user. Return the object path of the new user. ''' user_path = '/org/freedesktop/login1/user/%i' % uid if user_path in mockobject.objects: raise dbus.exceptions.DBusException('User %i already exists' % uid, ...
python
def AddUser(self, uid, username, active): '''Convenience method to add a user. Return the object path of the new user. ''' user_path = '/org/freedesktop/login1/user/%i' % uid if user_path in mockobject.objects: raise dbus.exceptions.DBusException('User %i already exists' % uid, ...
[ "def", "AddUser", "(", "self", ",", "uid", ",", "username", ",", "active", ")", ":", "user_path", "=", "'/org/freedesktop/login1/user/%i'", "%", "uid", "if", "user_path", "in", "mockobject", ".", "objects", ":", "raise", "dbus", ".", "exceptions", ".", "DBus...
Convenience method to add a user. Return the object path of the new user.
[ "Convenience", "method", "to", "add", "a", "user", "." ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/logind.py#L150-L183
train
martinpitt/python-dbusmock
dbusmock/templates/logind.py
AddSession
def AddSession(self, session_id, seat, uid, username, active): '''Convenience method to add a session. If the given seat and/or user do not exit, they will be created. Return the object path of the new session. ''' seat_path = dbus.ObjectPath('/org/freedesktop/login1/seat/' + seat) if seat_pat...
python
def AddSession(self, session_id, seat, uid, username, active): '''Convenience method to add a session. If the given seat and/or user do not exit, they will be created. Return the object path of the new session. ''' seat_path = dbus.ObjectPath('/org/freedesktop/login1/seat/' + seat) if seat_pat...
[ "def", "AddSession", "(", "self", ",", "session_id", ",", "seat", ",", "uid", ",", "username", ",", "active", ")", ":", "seat_path", "=", "dbus", ".", "ObjectPath", "(", "'/org/freedesktop/login1/seat/'", "+", "seat", ")", "if", "seat_path", "not", "in", "...
Convenience method to add a session. If the given seat and/or user do not exit, they will be created. Return the object path of the new session.
[ "Convenience", "method", "to", "add", "a", "session", "." ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/logind.py#L188-L260
train
martinpitt/python-dbusmock
dbusmock/mockobject.py
DBusMockObject._set_up_object_manager
def _set_up_object_manager(self): '''Set up this mock object as a D-Bus ObjectManager.''' if self.path == '/': cond = 'k != \'/\'' else: cond = 'k.startswith(\'%s/\')' % self.path self.AddMethod(OBJECT_MANAGER_IFACE, 'GetManagedObjects', ''...
python
def _set_up_object_manager(self): '''Set up this mock object as a D-Bus ObjectManager.''' if self.path == '/': cond = 'k != \'/\'' else: cond = 'k.startswith(\'%s/\')' % self.path self.AddMethod(OBJECT_MANAGER_IFACE, 'GetManagedObjects', ''...
[ "def", "_set_up_object_manager", "(", "self", ")", ":", "if", "self", ".", "path", "==", "'/'", ":", "cond", "=", "'k != \\'/\\''", "else", ":", "cond", "=", "'k.startswith(\\'%s/\\')'", "%", "self", ".", "path", "self", ".", "AddMethod", "(", "OBJECT_MANAGE...
Set up this mock object as a D-Bus ObjectManager.
[ "Set", "up", "this", "mock", "object", "as", "a", "D", "-", "Bus", "ObjectManager", "." ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/mockobject.py#L108-L119
train
martinpitt/python-dbusmock
dbusmock/mockobject.py
DBusMockObject.Get
def Get(self, interface_name, property_name): '''Standard D-Bus API for getting a property value''' self.log('Get %s.%s' % (interface_name, property_name)) if not interface_name: interface_name = self.interface try: return self.GetAll(interface_name)[property_na...
python
def Get(self, interface_name, property_name): '''Standard D-Bus API for getting a property value''' self.log('Get %s.%s' % (interface_name, property_name)) if not interface_name: interface_name = self.interface try: return self.GetAll(interface_name)[property_na...
[ "def", "Get", "(", "self", ",", "interface_name", ",", "property_name", ")", ":", "self", ".", "log", "(", "'Get %s.%s'", "%", "(", "interface_name", ",", "property_name", ")", ")", "if", "not", "interface_name", ":", "interface_name", "=", "self", ".", "i...
Standard D-Bus API for getting a property value
[ "Standard", "D", "-", "Bus", "API", "for", "getting", "a", "property", "value" ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/mockobject.py#L133-L145
train
martinpitt/python-dbusmock
dbusmock/mockobject.py
DBusMockObject.GetAll
def GetAll(self, interface_name, *args, **kwargs): '''Standard D-Bus API for getting all property values''' self.log('GetAll ' + interface_name) if not interface_name: interface_name = self.interface try: return self.props[interface_name] except KeyError...
python
def GetAll(self, interface_name, *args, **kwargs): '''Standard D-Bus API for getting all property values''' self.log('GetAll ' + interface_name) if not interface_name: interface_name = self.interface try: return self.props[interface_name] except KeyError...
[ "def", "GetAll", "(", "self", ",", "interface_name", ",", "*", "args", ",", "**", "kwargs", ")", ":", "self", ".", "log", "(", "'GetAll '", "+", "interface_name", ")", "if", "not", "interface_name", ":", "interface_name", "=", "self", ".", "interface", "...
Standard D-Bus API for getting all property values
[ "Standard", "D", "-", "Bus", "API", "for", "getting", "all", "property", "values" ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/mockobject.py#L149-L161
train
martinpitt/python-dbusmock
dbusmock/mockobject.py
DBusMockObject.Set
def Set(self, interface_name, property_name, value, *args, **kwargs): '''Standard D-Bus API for setting a property value''' self.log('Set %s.%s%s' % (interface_name, property_name, self.format_args((value,)))) try: ...
python
def Set(self, interface_name, property_name, value, *args, **kwargs): '''Standard D-Bus API for setting a property value''' self.log('Set %s.%s%s' % (interface_name, property_name, self.format_args((value,)))) try: ...
[ "def", "Set", "(", "self", ",", "interface_name", ",", "property_name", ",", "value", ",", "*", "args", ",", "**", "kwargs", ")", ":", "self", ".", "log", "(", "'Set %s.%s%s'", "%", "(", "interface_name", ",", "property_name", ",", "self", ".", "format_a...
Standard D-Bus API for setting a property value
[ "Standard", "D", "-", "Bus", "API", "for", "setting", "a", "property", "value" ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/mockobject.py#L165-L192
train
martinpitt/python-dbusmock
dbusmock/mockobject.py
DBusMockObject.AddObject
def AddObject(self, path, interface, properties, methods): '''Add a new D-Bus object to the mock path: D-Bus object path interface: Primary D-Bus interface name of this object (where properties and methods will be put on) properties: A property_name (string) → value m...
python
def AddObject(self, path, interface, properties, methods): '''Add a new D-Bus object to the mock path: D-Bus object path interface: Primary D-Bus interface name of this object (where properties and methods will be put on) properties: A property_name (string) → value m...
[ "def", "AddObject", "(", "self", ",", "path", ",", "interface", ",", "properties", ",", "methods", ")", ":", "if", "path", "in", "objects", ":", "raise", "dbus", ".", "exceptions", ".", "DBusException", "(", "'object %s already exists'", "%", "path", ",", ...
Add a new D-Bus object to the mock path: D-Bus object path interface: Primary D-Bus interface name of this object (where properties and methods will be put on) properties: A property_name (string) → value map with initial properties on "interface" ...
[ "Add", "a", "new", "D", "-", "Bus", "object", "to", "the", "mock" ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/mockobject.py#L197-L241
train
martinpitt/python-dbusmock
dbusmock/mockobject.py
DBusMockObject.RemoveObject
def RemoveObject(self, path): '''Remove a D-Bus object from the mock As with AddObject, this will *not* emit the InterfacesRemoved signal if it’s an ObjectManager instance. ''' try: objects[path].remove_from_connection() del objects[path] except K...
python
def RemoveObject(self, path): '''Remove a D-Bus object from the mock As with AddObject, this will *not* emit the InterfacesRemoved signal if it’s an ObjectManager instance. ''' try: objects[path].remove_from_connection() del objects[path] except K...
[ "def", "RemoveObject", "(", "self", ",", "path", ")", ":", "try", ":", "objects", "[", "path", "]", ".", "remove_from_connection", "(", ")", "del", "objects", "[", "path", "]", "except", "KeyError", ":", "raise", "dbus", ".", "exceptions", ".", "DBusExce...
Remove a D-Bus object from the mock As with AddObject, this will *not* emit the InterfacesRemoved signal if it’s an ObjectManager instance.
[ "Remove", "a", "D", "-", "Bus", "object", "from", "the", "mock" ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/mockobject.py#L246-L258
train
martinpitt/python-dbusmock
dbusmock/mockobject.py
DBusMockObject.Reset
def Reset(self): '''Reset the mock object state. Remove all mock objects from the bus and tidy up so the state is as if python-dbusmock had just been restarted. If the mock object was originally created with a template (from the command line, the Python API or by calling AddTemp...
python
def Reset(self): '''Reset the mock object state. Remove all mock objects from the bus and tidy up so the state is as if python-dbusmock had just been restarted. If the mock object was originally created with a template (from the command line, the Python API or by calling AddTemp...
[ "def", "Reset", "(", "self", ")", ":", "for", "obj_name", ",", "obj", "in", "objects", ".", "items", "(", ")", ":", "if", "obj_name", "!=", "self", ".", "path", ":", "obj", ".", "remove_from_connection", "(", ")", "objects", ".", "clear", "(", ")", ...
Reset the mock object state. Remove all mock objects from the bus and tidy up so the state is as if python-dbusmock had just been restarted. If the mock object was originally created with a template (from the command line, the Python API or by calling AddTemplate over D-Bus), it will be...
[ "Reset", "the", "mock", "object", "state", "." ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/mockobject.py#L262-L291
train
martinpitt/python-dbusmock
dbusmock/mockobject.py
DBusMockObject.AddMethod
def AddMethod(self, interface, name, in_sig, out_sig, code): '''Add a method to this object interface: D-Bus interface to add this to. For convenience you can specify '' here to add the method to the object's main interface (as specified on construction). n...
python
def AddMethod(self, interface, name, in_sig, out_sig, code): '''Add a method to this object interface: D-Bus interface to add this to. For convenience you can specify '' here to add the method to the object's main interface (as specified on construction). n...
[ "def", "AddMethod", "(", "self", ",", "interface", ",", "name", ",", "in_sig", ",", "out_sig", ",", "code", ")", ":", "if", "not", "interface", ":", "interface", "=", "self", ".", "interface", "n_args", "=", "len", "(", "dbus", ".", "Signature", "(", ...
Add a method to this object interface: D-Bus interface to add this to. For convenience you can specify '' here to add the method to the object's main interface (as specified on construction). name: Name of the method in_sig: Signature of input arguments; fo...
[ "Add", "a", "method", "to", "this", "object" ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/mockobject.py#L296-L348
train
martinpitt/python-dbusmock
dbusmock/mockobject.py
DBusMockObject.AddMethods
def AddMethods(self, interface, methods): '''Add several methods to this object interface: D-Bus interface to add this to. For convenience you can specify '' here to add the method to the object's main interface (as specified on construction). methods: list...
python
def AddMethods(self, interface, methods): '''Add several methods to this object interface: D-Bus interface to add this to. For convenience you can specify '' here to add the method to the object's main interface (as specified on construction). methods: list...
[ "def", "AddMethods", "(", "self", ",", "interface", ",", "methods", ")", ":", "for", "method", "in", "methods", ":", "self", ".", "AddMethod", "(", "interface", ",", "*", "method", ")" ]
Add several methods to this object interface: D-Bus interface to add this to. For convenience you can specify '' here to add the method to the object's main interface (as specified on construction). methods: list of 4-tuples (name, in_sig, out_sig, code) describing...
[ "Add", "several", "methods", "to", "this", "object" ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/mockobject.py#L353-L363
train
martinpitt/python-dbusmock
dbusmock/mockobject.py
DBusMockObject.AddProperty
def AddProperty(self, interface, name, value): '''Add property to this object interface: D-Bus interface to add this to. For convenience you can specify '' here to add the property to the object's main interface (as specified on construction). name: Propert...
python
def AddProperty(self, interface, name, value): '''Add property to this object interface: D-Bus interface to add this to. For convenience you can specify '' here to add the property to the object's main interface (as specified on construction). name: Propert...
[ "def", "AddProperty", "(", "self", ",", "interface", ",", "name", ",", "value", ")", ":", "if", "not", "interface", ":", "interface", "=", "self", ".", "interface", "try", ":", "self", ".", "props", "[", "interface", "]", "[", "name", "]", "raise", "...
Add property to this object interface: D-Bus interface to add this to. For convenience you can specify '' here to add the property to the object's main interface (as specified on construction). name: Property name. value: Property value.
[ "Add", "property", "to", "this", "object" ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/mockobject.py#L368-L394
train
martinpitt/python-dbusmock
dbusmock/mockobject.py
DBusMockObject.AddProperties
def AddProperties(self, interface, properties): '''Add several properties to this object interface: D-Bus interface to add this to. For convenience you can specify '' here to add the property to the object's main interface (as specified on construction). pr...
python
def AddProperties(self, interface, properties): '''Add several properties to this object interface: D-Bus interface to add this to. For convenience you can specify '' here to add the property to the object's main interface (as specified on construction). pr...
[ "def", "AddProperties", "(", "self", ",", "interface", ",", "properties", ")", ":", "for", "k", ",", "v", "in", "properties", ".", "items", "(", ")", ":", "self", ".", "AddProperty", "(", "interface", ",", "k", ",", "v", ")" ]
Add several properties to this object interface: D-Bus interface to add this to. For convenience you can specify '' here to add the property to the object's main interface (as specified on construction). properties: A property_name (string) → value map
[ "Add", "several", "properties", "to", "this", "object" ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/mockobject.py#L399-L408
train
martinpitt/python-dbusmock
dbusmock/mockobject.py
DBusMockObject.AddTemplate
def AddTemplate(self, template, parameters): '''Load a template into the mock. python-dbusmock ships a set of standard mocks for common system services such as UPower and NetworkManager. With these the actual tests become a lot simpler, as they only have to set up the particular ...
python
def AddTemplate(self, template, parameters): '''Load a template into the mock. python-dbusmock ships a set of standard mocks for common system services such as UPower and NetworkManager. With these the actual tests become a lot simpler, as they only have to set up the particular ...
[ "def", "AddTemplate", "(", "self", ",", "template", ",", "parameters", ")", ":", "try", ":", "module", "=", "load_module", "(", "template", ")", "except", "ImportError", "as", "e", ":", "raise", "dbus", ".", "exceptions", ".", "DBusException", "(", "'Canno...
Load a template into the mock. python-dbusmock ships a set of standard mocks for common system services such as UPower and NetworkManager. With these the actual tests become a lot simpler, as they only have to set up the particular properties for the tests, and not the skeleton of commo...
[ "Load", "a", "template", "into", "the", "mock", "." ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/mockobject.py#L413-L460
train
martinpitt/python-dbusmock
dbusmock/mockobject.py
DBusMockObject.EmitSignal
def EmitSignal(self, interface, name, signature, args): '''Emit a signal from the object. interface: D-Bus interface to send the signal from. For convenience you can specify '' here to add the method to the object's main interface (as specified on construction). ...
python
def EmitSignal(self, interface, name, signature, args): '''Emit a signal from the object. interface: D-Bus interface to send the signal from. For convenience you can specify '' here to add the method to the object's main interface (as specified on construction). ...
[ "def", "EmitSignal", "(", "self", ",", "interface", ",", "name", ",", "signature", ",", "args", ")", ":", "if", "not", "interface", ":", "interface", "=", "self", ".", "interface", "if", "signature", "==", "''", "and", "len", "(", "args", ")", ">", "...
Emit a signal from the object. interface: D-Bus interface to send the signal from. For convenience you can specify '' here to add the method to the object's main interface (as specified on construction). name: Name of the signal signature: Signature of inpu...
[ "Emit", "a", "signal", "from", "the", "object", "." ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/mockobject.py#L465-L496
train
martinpitt/python-dbusmock
dbusmock/mockobject.py
DBusMockObject.GetMethodCalls
def GetMethodCalls(self, method): '''List all the logged calls of a particular method. Return a list of (timestamp, args_list) tuples. ''' return [(row[0], row[2]) for row in self.call_log if row[1] == method]
python
def GetMethodCalls(self, method): '''List all the logged calls of a particular method. Return a list of (timestamp, args_list) tuples. ''' return [(row[0], row[2]) for row in self.call_log if row[1] == method]
[ "def", "GetMethodCalls", "(", "self", ",", "method", ")", ":", "return", "[", "(", "row", "[", "0", "]", ",", "row", "[", "2", "]", ")", "for", "row", "in", "self", ".", "call_log", "if", "row", "[", "1", "]", "==", "method", "]" ]
List all the logged calls of a particular method. Return a list of (timestamp, args_list) tuples.
[ "List", "all", "the", "logged", "calls", "of", "a", "particular", "method", "." ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/mockobject.py#L511-L516
train
martinpitt/python-dbusmock
dbusmock/mockobject.py
DBusMockObject.mock_method
def mock_method(self, interface, dbus_method, in_signature, *args, **kwargs): '''Master mock method. This gets "instantiated" in AddMethod(). Execute the code snippet of the method and return the "ret" variable if it was set. ''' # print('mock_method', dbus_method, self, in_sign...
python
def mock_method(self, interface, dbus_method, in_signature, *args, **kwargs): '''Master mock method. This gets "instantiated" in AddMethod(). Execute the code snippet of the method and return the "ret" variable if it was set. ''' # print('mock_method', dbus_method, self, in_sign...
[ "def", "mock_method", "(", "self", ",", "interface", ",", "dbus_method", ",", "in_signature", ",", "*", "args", ",", "**", "kwargs", ")", ":", "if", "in_signature", "==", "''", "and", "len", "(", "args", ")", ">", "0", ":", "raise", "TypeError", "(", ...
Master mock method. This gets "instantiated" in AddMethod(). Execute the code snippet of the method and return the "ret" variable if it was set.
[ "Master", "mock", "method", "." ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/mockobject.py#L548-L579
train
martinpitt/python-dbusmock
dbusmock/mockobject.py
DBusMockObject.format_args
def format_args(self, args): '''Format a D-Bus argument tuple into an appropriate logging string.''' def format_arg(a): if isinstance(a, dbus.Boolean): return str(bool(a)) if isinstance(a, dbus.Byte): return str(int(a)) if isinstance(a...
python
def format_args(self, args): '''Format a D-Bus argument tuple into an appropriate logging string.''' def format_arg(a): if isinstance(a, dbus.Boolean): return str(bool(a)) if isinstance(a, dbus.Byte): return str(int(a)) if isinstance(a...
[ "def", "format_args", "(", "self", ",", "args", ")", ":", "def", "format_arg", "(", "a", ")", ":", "if", "isinstance", "(", "a", ",", "dbus", ".", "Boolean", ")", ":", "return", "str", "(", "bool", "(", "a", ")", ")", "if", "isinstance", "(", "a"...
Format a D-Bus argument tuple into an appropriate logging string.
[ "Format", "a", "D", "-", "Bus", "argument", "tuple", "into", "an", "appropriate", "logging", "string", "." ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/mockobject.py#L581-L618
train
martinpitt/python-dbusmock
dbusmock/mockobject.py
DBusMockObject.log
def log(self, msg): '''Log a message, prefixed with a timestamp. If a log file was specified in the constructor, it is written there, otherwise it goes to stdout. ''' if self.logfile: fd = self.logfile.fileno() else: fd = sys.stdout.fileno() ...
python
def log(self, msg): '''Log a message, prefixed with a timestamp. If a log file was specified in the constructor, it is written there, otherwise it goes to stdout. ''' if self.logfile: fd = self.logfile.fileno() else: fd = sys.stdout.fileno() ...
[ "def", "log", "(", "self", ",", "msg", ")", ":", "if", "self", ".", "logfile", ":", "fd", "=", "self", ".", "logfile", ".", "fileno", "(", ")", "else", ":", "fd", "=", "sys", ".", "stdout", ".", "fileno", "(", ")", "os", ".", "write", "(", "f...
Log a message, prefixed with a timestamp. If a log file was specified in the constructor, it is written there, otherwise it goes to stdout.
[ "Log", "a", "message", "prefixed", "with", "a", "timestamp", "." ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/mockobject.py#L620-L631
train
martinpitt/python-dbusmock
dbusmock/mockobject.py
DBusMockObject.Introspect
def Introspect(self, object_path, connection): '''Return XML description of this object's interfaces, methods and signals. This wraps dbus-python's Introspect() method to include the dynamic methods and properties. ''' # temporarily add our dynamic methods cls = self.__c...
python
def Introspect(self, object_path, connection): '''Return XML description of this object's interfaces, methods and signals. This wraps dbus-python's Introspect() method to include the dynamic methods and properties. ''' # temporarily add our dynamic methods cls = self.__c...
[ "def", "Introspect", "(", "self", ",", "object_path", ",", "connection", ")", ":", "cls", "=", "self", ".", "__class__", ".", "__module__", "+", "'.'", "+", "self", ".", "__class__", ".", "__name__", "orig_interfaces", "=", "self", ".", "_dbus_class_table", ...
Return XML description of this object's interfaces, methods and signals. This wraps dbus-python's Introspect() method to include the dynamic methods and properties.
[ "Return", "XML", "description", "of", "this", "object", "s", "interfaces", "methods", "and", "signals", "." ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/mockobject.py#L638-L684
train
martinpitt/python-dbusmock
dbusmock/templates/bluez5-obex.py
CreateSession
def CreateSession(self, destination, args): '''OBEX method to create a new transfer session. The destination must be the address of the destination Bluetooth device. The given arguments must be a map from well-known keys to values, containing at least the ‘Target’ key, whose value must be ‘PBAP’ (other...
python
def CreateSession(self, destination, args): '''OBEX method to create a new transfer session. The destination must be the address of the destination Bluetooth device. The given arguments must be a map from well-known keys to values, containing at least the ‘Target’ key, whose value must be ‘PBAP’ (other...
[ "def", "CreateSession", "(", "self", ",", "destination", ",", "args", ")", ":", "if", "'Target'", "not", "in", "args", "or", "args", "[", "'Target'", "]", ".", "upper", "(", ")", "!=", "'PBAP'", ":", "raise", "dbus", ".", "exceptions", ".", "DBusExcept...
OBEX method to create a new transfer session. The destination must be the address of the destination Bluetooth device. The given arguments must be a map from well-known keys to values, containing at least the ‘Target’ key, whose value must be ‘PBAP’ (other keys and values are accepted by the real daemo...
[ "OBEX", "method", "to", "create", "a", "new", "transfer", "session", "." ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/bluez5-obex.py#L58-L118
train
martinpitt/python-dbusmock
dbusmock/templates/bluez5-obex.py
RemoveSession
def RemoveSession(self, session_path): '''OBEX method to remove an existing transfer session. This takes the path of the transfer Session object and removes it. ''' manager = mockobject.objects['/'] # Remove all the session's transfers. transfer_id = 0 while session_path + '/transfer' + s...
python
def RemoveSession(self, session_path): '''OBEX method to remove an existing transfer session. This takes the path of the transfer Session object and removes it. ''' manager = mockobject.objects['/'] # Remove all the session's transfers. transfer_id = 0 while session_path + '/transfer' + s...
[ "def", "RemoveSession", "(", "self", ",", "session_path", ")", ":", "manager", "=", "mockobject", ".", "objects", "[", "'/'", "]", "transfer_id", "=", "0", "while", "session_path", "+", "'/transfer'", "+", "str", "(", "transfer_id", ")", "in", "mockobject", ...
OBEX method to remove an existing transfer session. This takes the path of the transfer Session object and removes it.
[ "OBEX", "method", "to", "remove", "an", "existing", "transfer", "session", "." ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/bluez5-obex.py#L123-L152
train
martinpitt/python-dbusmock
dbusmock/templates/bluez5-obex.py
PullAll
def PullAll(self, target_file, filters): '''OBEX method to start a pull transfer of a phone book. This doesn't complete the transfer; code to mock up activating and completing the transfer must be provided by the test driver, as it’s too complex and test-specific to put here. The target_file is th...
python
def PullAll(self, target_file, filters): '''OBEX method to start a pull transfer of a phone book. This doesn't complete the transfer; code to mock up activating and completing the transfer must be provided by the test driver, as it’s too complex and test-specific to put here. The target_file is th...
[ "def", "PullAll", "(", "self", ",", "target_file", ",", "filters", ")", ":", "session_path", "=", "self", ".", "path", "transfer_id", "=", "0", "while", "session_path", "+", "'/transfer'", "+", "str", "(", "transfer_id", ")", "in", "mockobject", ".", "obje...
OBEX method to start a pull transfer of a phone book. This doesn't complete the transfer; code to mock up activating and completing the transfer must be provided by the test driver, as it’s too complex and test-specific to put here. The target_file is the absolute path for a file which will have zero ...
[ "OBEX", "method", "to", "start", "a", "pull", "transfer", "of", "a", "phone", "book", "." ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/bluez5-obex.py#L157-L228
train
martinpitt/python-dbusmock
dbusmock/templates/bluez5-obex.py
UpdateStatus
def UpdateStatus(self, is_complete): '''Mock method to update the transfer status. If is_complete is False, this marks the transfer is active; otherwise it marks the transfer as complete. It is an error to call this method after calling it with is_complete as True. In both cases, it updates the nu...
python
def UpdateStatus(self, is_complete): '''Mock method to update the transfer status. If is_complete is False, this marks the transfer is active; otherwise it marks the transfer as complete. It is an error to call this method after calling it with is_complete as True. In both cases, it updates the nu...
[ "def", "UpdateStatus", "(", "self", ",", "is_complete", ")", ":", "status", "=", "'complete'", "if", "is_complete", "else", "'active'", "transferred", "=", "os", ".", "path", ".", "getsize", "(", "self", ".", "props", "[", "TRANSFER_IFACE", "]", "[", "'Fil...
Mock method to update the transfer status. If is_complete is False, this marks the transfer is active; otherwise it marks the transfer as complete. It is an error to call this method after calling it with is_complete as True. In both cases, it updates the number of bytes transferred to be the current ...
[ "Mock", "method", "to", "update", "the", "transfer", "status", "." ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/bluez5-obex.py#L261-L285
train
martinpitt/python-dbusmock
dbusmock/templates/ofono.py
AddModem
def AddModem(self, name, properties): '''Convenience method to add a modem You have to specify a device name which must be a valid part of an object path, e. g. "mock_ac". For future extensions you can specify a "properties" array, but no extra properties are supported for now. Returns the new obj...
python
def AddModem(self, name, properties): '''Convenience method to add a modem You have to specify a device name which must be a valid part of an object path, e. g. "mock_ac". For future extensions you can specify a "properties" array, but no extra properties are supported for now. Returns the new obj...
[ "def", "AddModem", "(", "self", ",", "name", ",", "properties", ")", ":", "path", "=", "'/'", "+", "name", "self", ".", "AddObject", "(", "path", ",", "'org.ofono.Modem'", ",", "{", "'Online'", ":", "dbus", ".", "Boolean", "(", "True", ",", "variant_le...
Convenience method to add a modem You have to specify a device name which must be a valid part of an object path, e. g. "mock_ac". For future extensions you can specify a "properties" array, but no extra properties are supported for now. Returns the new object path.
[ "Convenience", "method", "to", "add", "a", "modem" ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/ofono.py#L65-L114
train
martinpitt/python-dbusmock
dbusmock/templates/ofono.py
add_voice_call_api
def add_voice_call_api(mock): '''Add org.ofono.VoiceCallManager API to a mock''' # also add an emergency number which is not a real one, in case one runs a # test case against a production ofono :-) mock.AddProperty('org.ofono.VoiceCallManager', 'EmergencyNumbers', ['911', '13373']) mock.calls = [...
python
def add_voice_call_api(mock): '''Add org.ofono.VoiceCallManager API to a mock''' # also add an emergency number which is not a real one, in case one runs a # test case against a production ofono :-) mock.AddProperty('org.ofono.VoiceCallManager', 'EmergencyNumbers', ['911', '13373']) mock.calls = [...
[ "def", "add_voice_call_api", "(", "mock", ")", ":", "mock", ".", "AddProperty", "(", "'org.ofono.VoiceCallManager'", ",", "'EmergencyNumbers'", ",", "[", "'911'", ",", "'13373'", "]", ")", "mock", ".", "calls", "=", "[", "]", "mock", ".", "AddMethods", "(", ...
Add org.ofono.VoiceCallManager API to a mock
[ "Add", "org", ".", "ofono", ".", "VoiceCallManager", "API", "to", "a", "mock" ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/ofono.py#L169-L190
train
martinpitt/python-dbusmock
dbusmock/templates/ofono.py
add_netreg_api
def add_netreg_api(mock): '''Add org.ofono.NetworkRegistration API to a mock''' # also add an emergency number which is not a real one, in case one runs a # test case against a production ofono :-) mock.AddProperties('org.ofono.NetworkRegistration', { 'Mode': 'auto', 'Status': 'register...
python
def add_netreg_api(mock): '''Add org.ofono.NetworkRegistration API to a mock''' # also add an emergency number which is not a real one, in case one runs a # test case against a production ofono :-) mock.AddProperties('org.ofono.NetworkRegistration', { 'Mode': 'auto', 'Status': 'register...
[ "def", "add_netreg_api", "(", "mock", ")", ":", "mock", ".", "AddProperties", "(", "'org.ofono.NetworkRegistration'", ",", "{", "'Mode'", ":", "'auto'", ",", "'Status'", ":", "'registered'", ",", "'LocationAreaCode'", ":", "_parameters", ".", "get", "(", "'Locat...
Add org.ofono.NetworkRegistration API to a mock
[ "Add", "org", ".", "ofono", ".", "NetworkRegistration", "API", "to", "a", "mock" ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/ofono.py#L262-L302
train
martinpitt/python-dbusmock
dbusmock/templates/ofono.py
add_simmanager_api
def add_simmanager_api(self, mock): '''Add org.ofono.SimManager API to a mock''' iface = 'org.ofono.SimManager' mock.AddProperties(iface, { 'BarredDialing': _parameters.get('BarredDialing', False), 'CardIdentifier': _parameters.get('CardIdentifier', new_iccid(self)), 'FixedDialing':...
python
def add_simmanager_api(self, mock): '''Add org.ofono.SimManager API to a mock''' iface = 'org.ofono.SimManager' mock.AddProperties(iface, { 'BarredDialing': _parameters.get('BarredDialing', False), 'CardIdentifier': _parameters.get('CardIdentifier', new_iccid(self)), 'FixedDialing':...
[ "def", "add_simmanager_api", "(", "self", ",", "mock", ")", ":", "iface", "=", "'org.ofono.SimManager'", "mock", ".", "AddProperties", "(", "iface", ",", "{", "'BarredDialing'", ":", "_parameters", ".", "get", "(", "'BarredDialing'", ",", "False", ")", ",", ...
Add org.ofono.SimManager API to a mock
[ "Add", "org", ".", "ofono", ".", "SimManager", "API", "to", "a", "mock" ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/ofono.py#L329-L388
train
martinpitt/python-dbusmock
dbusmock/templates/ofono.py
add_connectionmanager_api
def add_connectionmanager_api(mock): '''Add org.ofono.ConnectionManager API to a mock''' iface = 'org.ofono.ConnectionManager' mock.AddProperties(iface, { 'Attached': _parameters.get('Attached', True), 'Bearer': _parameters.get('Bearer', 'gprs'), 'RoamingAllowed': _parameters.get('R...
python
def add_connectionmanager_api(mock): '''Add org.ofono.ConnectionManager API to a mock''' iface = 'org.ofono.ConnectionManager' mock.AddProperties(iface, { 'Attached': _parameters.get('Attached', True), 'Bearer': _parameters.get('Bearer', 'gprs'), 'RoamingAllowed': _parameters.get('R...
[ "def", "add_connectionmanager_api", "(", "mock", ")", ":", "iface", "=", "'org.ofono.ConnectionManager'", "mock", ".", "AddProperties", "(", "iface", ",", "{", "'Attached'", ":", "_parameters", ".", "get", "(", "'Attached'", ",", "True", ")", ",", "'Bearer'", ...
Add org.ofono.ConnectionManager API to a mock
[ "Add", "org", ".", "ofono", ".", "ConnectionManager", "API", "to", "a", "mock" ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/ofono.py#L408-L426
train
martinpitt/python-dbusmock
dbusmock/templates/bluez5.py
BlockDevice
def BlockDevice(self, adapter_device_name, device_address): '''Convenience method to mark an existing device as blocked. You have to specify a device address which must be a valid Bluetooth address (e.g. 'AA:BB:CC:DD:EE:FF'). The adapter device name is the device_name passed to AddAdapter. This di...
python
def BlockDevice(self, adapter_device_name, device_address): '''Convenience method to mark an existing device as blocked. You have to specify a device address which must be a valid Bluetooth address (e.g. 'AA:BB:CC:DD:EE:FF'). The adapter device name is the device_name passed to AddAdapter. This di...
[ "def", "BlockDevice", "(", "self", ",", "adapter_device_name", ",", "device_address", ")", ":", "device_name", "=", "'dev_'", "+", "device_address", ".", "replace", "(", "':'", ",", "'_'", ")", ".", "upper", "(", ")", "adapter_path", "=", "'/org/bluez/'", "+...
Convenience method to mark an existing device as blocked. You have to specify a device address which must be a valid Bluetooth address (e.g. 'AA:BB:CC:DD:EE:FF'). The adapter device name is the device_name passed to AddAdapter. This disconnects the device if it was connected. If the specified ada...
[ "Convenience", "method", "to", "mark", "an", "existing", "device", "as", "blocked", "." ]
26f65f78bc0ed347233f699a8d6ee0e6880e7eb0
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/bluez5.py#L268-L308
train
briancappello/flask-unchained
flask_unchained/bundles/api/model_resource.py
ModelResource.create
def create(self, instance, errors): """ Create an instance of a model. :param instance: The created model instance. :param errors: Any errors. :return: The created model instance, or a dictionary of errors. """ if errors: return self.errors(errors) ...
python
def create(self, instance, errors): """ Create an instance of a model. :param instance: The created model instance. :param errors: Any errors. :return: The created model instance, or a dictionary of errors. """ if errors: return self.errors(errors) ...
[ "def", "create", "(", "self", ",", "instance", ",", "errors", ")", ":", "if", "errors", ":", "return", "self", ".", "errors", "(", "errors", ")", "return", "self", ".", "created", "(", "instance", ")" ]
Create an instance of a model. :param instance: The created model instance. :param errors: Any errors. :return: The created model instance, or a dictionary of errors.
[ "Create", "an", "instance", "of", "a", "model", "." ]
4d536cb90e2cc4829c1c05f2c74d3e22901a1399
https://github.com/briancappello/flask-unchained/blob/4d536cb90e2cc4829c1c05f2c74d3e22901a1399/flask_unchained/bundles/api/model_resource.py#L300-L310
train
briancappello/flask-unchained
flask_unchained/bundles/api/model_resource.py
ModelResource.patch
def patch(self, instance, errors): """ Partially update a model instance. :param instance: The model instance. :param errors: Any errors. :return: The updated model instance, or a dictionary of errors. """ if errors: return self.errors(errors) ...
python
def patch(self, instance, errors): """ Partially update a model instance. :param instance: The model instance. :param errors: Any errors. :return: The updated model instance, or a dictionary of errors. """ if errors: return self.errors(errors) ...
[ "def", "patch", "(", "self", ",", "instance", ",", "errors", ")", ":", "if", "errors", ":", "return", "self", ".", "errors", "(", "errors", ")", "return", "self", ".", "updated", "(", "instance", ")" ]
Partially update a model instance. :param instance: The model instance. :param errors: Any errors. :return: The updated model instance, or a dictionary of errors.
[ "Partially", "update", "a", "model", "instance", "." ]
4d536cb90e2cc4829c1c05f2c74d3e22901a1399
https://github.com/briancappello/flask-unchained/blob/4d536cb90e2cc4829c1c05f2c74d3e22901a1399/flask_unchained/bundles/api/model_resource.py#L323-L333
train
briancappello/flask-unchained
flask_unchained/bundles/api/model_resource.py
ModelResource.put
def put(self, instance, errors): """ Update a model instance. :param instance: The model instance. :param errors: Any errors. :return: The updated model instance, or a dictionary of errors. """ if errors: return self.errors(errors) return self...
python
def put(self, instance, errors): """ Update a model instance. :param instance: The model instance. :param errors: Any errors. :return: The updated model instance, or a dictionary of errors. """ if errors: return self.errors(errors) return self...
[ "def", "put", "(", "self", ",", "instance", ",", "errors", ")", ":", "if", "errors", ":", "return", "self", ".", "errors", "(", "errors", ")", "return", "self", ".", "updated", "(", "instance", ")" ]
Update a model instance. :param instance: The model instance. :param errors: Any errors. :return: The updated model instance, or a dictionary of errors.
[ "Update", "a", "model", "instance", "." ]
4d536cb90e2cc4829c1c05f2c74d3e22901a1399
https://github.com/briancappello/flask-unchained/blob/4d536cb90e2cc4829c1c05f2c74d3e22901a1399/flask_unchained/bundles/api/model_resource.py#L336-L346
train
briancappello/flask-unchained
flask_unchained/bundles/controller/__init__.py
ControllerBundle.before_init_app
def before_init_app(self, app: FlaskUnchained): """ Configure the Jinja environment and template loader. """ from .templates import (UnchainedJinjaEnvironment, UnchainedJinjaLoader) app.jinja_environment = UnchainedJinjaEnvironment app.jinj...
python
def before_init_app(self, app: FlaskUnchained): """ Configure the Jinja environment and template loader. """ from .templates import (UnchainedJinjaEnvironment, UnchainedJinjaLoader) app.jinja_environment = UnchainedJinjaEnvironment app.jinj...
[ "def", "before_init_app", "(", "self", ",", "app", ":", "FlaskUnchained", ")", ":", "from", ".", "templates", "import", "(", "UnchainedJinjaEnvironment", ",", "UnchainedJinjaLoader", ")", "app", ".", "jinja_environment", "=", "UnchainedJinjaEnvironment", "app", ".",...
Configure the Jinja environment and template loader.
[ "Configure", "the", "Jinja", "environment", "and", "template", "loader", "." ]
4d536cb90e2cc4829c1c05f2c74d3e22901a1399
https://github.com/briancappello/flask-unchained/blob/4d536cb90e2cc4829c1c05f2c74d3e22901a1399/flask_unchained/bundles/controller/__init__.py#L43-L55
train