id
int32
0
252k
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
42,500
hfaran/Tornado-JSON
tornado_json/api_doc_gen.py
_cleandoc
def _cleandoc(doc): """Remove uniform indents from ``doc`` lines that are not empty :returns: Cleaned ``doc`` """ indent_length = lambda s: len(s) - len(s.lstrip(" ")) not_empty = lambda s: s != "" lines = doc.split("\n") indent = min(map(indent_length, filter(not_empty, lines))) retu...
python
def _cleandoc(doc): """Remove uniform indents from ``doc`` lines that are not empty :returns: Cleaned ``doc`` """ indent_length = lambda s: len(s) - len(s.lstrip(" ")) not_empty = lambda s: s != "" lines = doc.split("\n") indent = min(map(indent_length, filter(not_empty, lines))) retu...
[ "def", "_cleandoc", "(", "doc", ")", ":", "indent_length", "=", "lambda", "s", ":", "len", "(", "s", ")", "-", "len", "(", "s", ".", "lstrip", "(", "\" \"", ")", ")", "not_empty", "=", "lambda", "s", ":", "s", "!=", "\"\"", "lines", "=", "doc", ...
Remove uniform indents from ``doc`` lines that are not empty :returns: Cleaned ``doc``
[ "Remove", "uniform", "indents", "from", "doc", "lines", "that", "are", "not", "empty" ]
8d8b35ff77f13cb3ab1a606bd2083b26cc69c54f
https://github.com/hfaran/Tornado-JSON/blob/8d8b35ff77f13cb3ab1a606bd2083b26cc69c54f/tornado_json/api_doc_gen.py#L97-L108
42,501
hfaran/Tornado-JSON
tornado_json/api_doc_gen.py
get_api_docs
def get_api_docs(routes): """ Generates GitHub Markdown formatted API documentation using provided schemas in RequestHandler methods and their docstrings. :type routes: [(url, RequestHandler), ...] :param routes: List of routes (this is ideally all possible routes of the app) :rtype: s...
python
def get_api_docs(routes): """ Generates GitHub Markdown formatted API documentation using provided schemas in RequestHandler methods and their docstrings. :type routes: [(url, RequestHandler), ...] :param routes: List of routes (this is ideally all possible routes of the app) :rtype: s...
[ "def", "get_api_docs", "(", "routes", ")", ":", "routes", "=", "map", "(", "_get_tuple_from_route", ",", "routes", ")", "documentation", "=", "[", "]", "for", "url", ",", "rh", ",", "methods", "in", "sorted", "(", "routes", ",", "key", "=", "lambda", "...
Generates GitHub Markdown formatted API documentation using provided schemas in RequestHandler methods and their docstrings. :type routes: [(url, RequestHandler), ...] :param routes: List of routes (this is ideally all possible routes of the app) :rtype: str :returns: generated GFM-formatt...
[ "Generates", "GitHub", "Markdown", "formatted", "API", "documentation", "using", "provided", "schemas", "in", "RequestHandler", "methods", "and", "their", "docstrings", "." ]
8d8b35ff77f13cb3ab1a606bd2083b26cc69c54f
https://github.com/hfaran/Tornado-JSON/blob/8d8b35ff77f13cb3ab1a606bd2083b26cc69c54f/tornado_json/api_doc_gen.py#L237-L260
42,502
hfaran/Tornado-JSON
tornado_json/jsend.py
JSendMixin.error
def error(self, message, data=None, code=None): """An error occurred in processing the request, i.e. an exception was thrown. :type data: A JSON-serializable object :param data: A generic container for any other information about the error, i.e. the conditions that caused t...
python
def error(self, message, data=None, code=None): """An error occurred in processing the request, i.e. an exception was thrown. :type data: A JSON-serializable object :param data: A generic container for any other information about the error, i.e. the conditions that caused t...
[ "def", "error", "(", "self", ",", "message", ",", "data", "=", "None", ",", "code", "=", "None", ")", ":", "result", "=", "{", "'status'", ":", "'error'", ",", "'message'", ":", "message", "}", "if", "data", ":", "result", "[", "'data'", "]", "=", ...
An error occurred in processing the request, i.e. an exception was thrown. :type data: A JSON-serializable object :param data: A generic container for any other information about the error, i.e. the conditions that caused the error, stack traces, etc. :type mes...
[ "An", "error", "occurred", "in", "processing", "the", "request", "i", ".", "e", ".", "an", "exception", "was", "thrown", "." ]
8d8b35ff77f13cb3ab1a606bd2083b26cc69c54f
https://github.com/hfaran/Tornado-JSON/blob/8d8b35ff77f13cb3ab1a606bd2083b26cc69c54f/tornado_json/jsend.py#L35-L55
42,503
hfaran/Tornado-JSON
tornado_json/schema.py
input_schema_clean
def input_schema_clean(input_, input_schema): """ Updates schema default values with input data. :param input_: Input data :type input_: dict :param input_schema: Input schema :type input_schema: dict :returns: Nested dict with data (defaul values updated with input data) :rtype: dict...
python
def input_schema_clean(input_, input_schema): """ Updates schema default values with input data. :param input_: Input data :type input_: dict :param input_schema: Input schema :type input_schema: dict :returns: Nested dict with data (defaul values updated with input data) :rtype: dict...
[ "def", "input_schema_clean", "(", "input_", ",", "input_schema", ")", ":", "if", "input_schema", ".", "get", "(", "'type'", ")", "==", "'object'", ":", "try", ":", "defaults", "=", "get_object_defaults", "(", "input_schema", ")", "except", "NoObjectDefaults", ...
Updates schema default values with input data. :param input_: Input data :type input_: dict :param input_schema: Input schema :type input_schema: dict :returns: Nested dict with data (defaul values updated with input data) :rtype: dict
[ "Updates", "schema", "default", "values", "with", "input", "data", "." ]
8d8b35ff77f13cb3ab1a606bd2083b26cc69c54f
https://github.com/hfaran/Tornado-JSON/blob/8d8b35ff77f13cb3ab1a606bd2083b26cc69c54f/tornado_json/schema.py#L61-L79
42,504
hfaran/Tornado-JSON
tornado_json/schema.py
validate
def validate(input_schema=None, output_schema=None, input_example=None, output_example=None, validator_cls=None, format_checker=None, on_empty_404=False, use_defaults=False): """Parameterized decorator for schema validation :type validator_cls: IValidator cla...
python
def validate(input_schema=None, output_schema=None, input_example=None, output_example=None, validator_cls=None, format_checker=None, on_empty_404=False, use_defaults=False): """Parameterized decorator for schema validation :type validator_cls: IValidator cla...
[ "def", "validate", "(", "input_schema", "=", "None", ",", "output_schema", "=", "None", ",", "input_example", "=", "None", ",", "output_example", "=", "None", ",", "validator_cls", "=", "None", ",", "format_checker", "=", "None", ",", "on_empty_404", "=", "F...
Parameterized decorator for schema validation :type validator_cls: IValidator class :type format_checker: jsonschema.FormatChecker or None :type on_empty_404: bool :param on_empty_404: If this is set, and the result from the decorated method is a falsy value, a 404 will be raised. :type use...
[ "Parameterized", "decorator", "for", "schema", "validation" ]
8d8b35ff77f13cb3ab1a606bd2083b26cc69c54f
https://github.com/hfaran/Tornado-JSON/blob/8d8b35ff77f13cb3ab1a606bd2083b26cc69c54f/tornado_json/schema.py#L82-L201
42,505
hfaran/Tornado-JSON
setup.py
read
def read(filename): """Read and return `filename` in root dir of project and return string""" return codecs.open(os.path.join(__DIR__, filename), 'r').read()
python
def read(filename): """Read and return `filename` in root dir of project and return string""" return codecs.open(os.path.join(__DIR__, filename), 'r').read()
[ "def", "read", "(", "filename", ")", ":", "return", "codecs", ".", "open", "(", "os", ".", "path", ".", "join", "(", "__DIR__", ",", "filename", ")", ",", "'r'", ")", ".", "read", "(", ")" ]
Read and return `filename` in root dir of project and return string
[ "Read", "and", "return", "filename", "in", "root", "dir", "of", "project", "and", "return", "string" ]
8d8b35ff77f13cb3ab1a606bd2083b26cc69c54f
https://github.com/hfaran/Tornado-JSON/blob/8d8b35ff77f13cb3ab1a606bd2083b26cc69c54f/setup.py#L10-L12
42,506
hfaran/Tornado-JSON
tornado_json/utils.py
deep_update
def deep_update(source, overrides): """Update a nested dictionary or similar mapping. Modify ``source`` in place. :type source: collections.Mapping :type overrides: collections.Mapping :rtype: collections.Mapping """ for key, value in overrides.items(): if isinstance(value, collect...
python
def deep_update(source, overrides): """Update a nested dictionary or similar mapping. Modify ``source`` in place. :type source: collections.Mapping :type overrides: collections.Mapping :rtype: collections.Mapping """ for key, value in overrides.items(): if isinstance(value, collect...
[ "def", "deep_update", "(", "source", ",", "overrides", ")", ":", "for", "key", ",", "value", "in", "overrides", ".", "items", "(", ")", ":", "if", "isinstance", "(", "value", ",", "collections", ".", "Mapping", ")", "and", "value", ":", "returned", "="...
Update a nested dictionary or similar mapping. Modify ``source`` in place. :type source: collections.Mapping :type overrides: collections.Mapping :rtype: collections.Mapping
[ "Update", "a", "nested", "dictionary", "or", "similar", "mapping", "." ]
8d8b35ff77f13cb3ab1a606bd2083b26cc69c54f
https://github.com/hfaran/Tornado-JSON/blob/8d8b35ff77f13cb3ab1a606bd2083b26cc69c54f/tornado_json/utils.py#L7-L22
42,507
hfaran/Tornado-JSON
tornado_json/utils.py
is_handler_subclass
def is_handler_subclass(cls, classnames=("ViewHandler", "APIHandler")): """Determines if ``cls`` is indeed a subclass of ``classnames``""" if isinstance(cls, list): return any(is_handler_subclass(c) for c in cls) elif isinstance(cls, type): return any(c.__name__ in classnames for c in inspec...
python
def is_handler_subclass(cls, classnames=("ViewHandler", "APIHandler")): """Determines if ``cls`` is indeed a subclass of ``classnames``""" if isinstance(cls, list): return any(is_handler_subclass(c) for c in cls) elif isinstance(cls, type): return any(c.__name__ in classnames for c in inspec...
[ "def", "is_handler_subclass", "(", "cls", ",", "classnames", "=", "(", "\"ViewHandler\"", ",", "\"APIHandler\"", ")", ")", ":", "if", "isinstance", "(", "cls", ",", "list", ")", ":", "return", "any", "(", "is_handler_subclass", "(", "c", ")", "for", "c", ...
Determines if ``cls`` is indeed a subclass of ``classnames``
[ "Determines", "if", "cls", "is", "indeed", "a", "subclass", "of", "classnames" ]
8d8b35ff77f13cb3ab1a606bd2083b26cc69c54f
https://github.com/hfaran/Tornado-JSON/blob/8d8b35ff77f13cb3ab1a606bd2083b26cc69c54f/tornado_json/utils.py#L60-L72
42,508
hfaran/Tornado-JSON
tornado_json/requesthandlers.py
APIHandler.write_error
def write_error(self, status_code, **kwargs): """Override of RequestHandler.write_error Calls ``error()`` or ``fail()`` from JSendMixin depending on which exception was raised with provided reason and status code. :type status_code: int :param status_code: HTTP status code ...
python
def write_error(self, status_code, **kwargs): """Override of RequestHandler.write_error Calls ``error()`` or ``fail()`` from JSendMixin depending on which exception was raised with provided reason and status code. :type status_code: int :param status_code: HTTP status code ...
[ "def", "write_error", "(", "self", ",", "status_code", ",", "*", "*", "kwargs", ")", ":", "def", "get_exc_message", "(", "exception", ")", ":", "return", "exception", ".", "log_message", "if", "hasattr", "(", "exception", ",", "\"log_message\"", ")", "else",...
Override of RequestHandler.write_error Calls ``error()`` or ``fail()`` from JSendMixin depending on which exception was raised with provided reason and status code. :type status_code: int :param status_code: HTTP status code
[ "Override", "of", "RequestHandler", ".", "write_error" ]
8d8b35ff77f13cb3ab1a606bd2083b26cc69c54f
https://github.com/hfaran/Tornado-JSON/blob/8d8b35ff77f13cb3ab1a606bd2083b26cc69c54f/tornado_json/requesthandlers.py#L50-L85
42,509
hfaran/Tornado-JSON
tornado_json/routes.py
gen_submodule_names
def gen_submodule_names(package): """Walk package and yield names of all submodules :type package: package :param package: The package to get submodule names of :returns: Iterator that yields names of all submodules of ``package`` :rtype: Iterator that yields ``str`` """ for importer, modn...
python
def gen_submodule_names(package): """Walk package and yield names of all submodules :type package: package :param package: The package to get submodule names of :returns: Iterator that yields names of all submodules of ``package`` :rtype: Iterator that yields ``str`` """ for importer, modn...
[ "def", "gen_submodule_names", "(", "package", ")", ":", "for", "importer", ",", "modname", ",", "ispkg", "in", "pkgutil", ".", "walk_packages", "(", "path", "=", "package", ".", "__path__", ",", "prefix", "=", "package", ".", "__name__", "+", "'.'", ",", ...
Walk package and yield names of all submodules :type package: package :param package: The package to get submodule names of :returns: Iterator that yields names of all submodules of ``package`` :rtype: Iterator that yields ``str``
[ "Walk", "package", "and", "yield", "names", "of", "all", "submodules" ]
8d8b35ff77f13cb3ab1a606bd2083b26cc69c54f
https://github.com/hfaran/Tornado-JSON/blob/8d8b35ff77f13cb3ab1a606bd2083b26cc69c54f/tornado_json/routes.py#L28-L40
42,510
hfaran/Tornado-JSON
tornado_json/routes.py
get_module_routes
def get_module_routes(module_name, custom_routes=None, exclusions=None, arg_pattern=r'(?P<{}>[a-zA-Z0-9_\-]+)'): """Create and return routes for module_name Routes are (url, RequestHandler) tuples :returns: list of routes for ``module_name`` with respect to ``exclusions`` and...
python
def get_module_routes(module_name, custom_routes=None, exclusions=None, arg_pattern=r'(?P<{}>[a-zA-Z0-9_\-]+)'): """Create and return routes for module_name Routes are (url, RequestHandler) tuples :returns: list of routes for ``module_name`` with respect to ``exclusions`` and...
[ "def", "get_module_routes", "(", "module_name", ",", "custom_routes", "=", "None", ",", "exclusions", "=", "None", ",", "arg_pattern", "=", "r'(?P<{}>[a-zA-Z0-9_\\-]+)'", ")", ":", "def", "has_method", "(", "module", ",", "cls_name", ",", "method_name", ")", ":"...
Create and return routes for module_name Routes are (url, RequestHandler) tuples :returns: list of routes for ``module_name`` with respect to ``exclusions`` and ``custom_routes``. Returned routes are with URLs formatted such that they are forward-slash-separated by module/class level a...
[ "Create", "and", "return", "routes", "for", "module_name" ]
8d8b35ff77f13cb3ab1a606bd2083b26cc69c54f
https://github.com/hfaran/Tornado-JSON/blob/8d8b35ff77f13cb3ab1a606bd2083b26cc69c54f/tornado_json/routes.py#L43-L197
42,511
hfaran/Tornado-JSON
tornado_json/gen.py
coroutine
def coroutine(func, replace_callback=True): """Tornado-JSON compatible wrapper for ``tornado.gen.coroutine`` Annotates original argspec.args of ``func`` as attribute ``__argspec_args`` """ # gen.coroutine in tornado 3.x.x and 5.x.x have a different signature than 4.x.x if TORNADO_MAJOR != 4: ...
python
def coroutine(func, replace_callback=True): """Tornado-JSON compatible wrapper for ``tornado.gen.coroutine`` Annotates original argspec.args of ``func`` as attribute ``__argspec_args`` """ # gen.coroutine in tornado 3.x.x and 5.x.x have a different signature than 4.x.x if TORNADO_MAJOR != 4: ...
[ "def", "coroutine", "(", "func", ",", "replace_callback", "=", "True", ")", ":", "# gen.coroutine in tornado 3.x.x and 5.x.x have a different signature than 4.x.x", "if", "TORNADO_MAJOR", "!=", "4", ":", "wrapper", "=", "gen", ".", "coroutine", "(", "func", ")", "else...
Tornado-JSON compatible wrapper for ``tornado.gen.coroutine`` Annotates original argspec.args of ``func`` as attribute ``__argspec_args``
[ "Tornado", "-", "JSON", "compatible", "wrapper", "for", "tornado", ".", "gen", ".", "coroutine" ]
8d8b35ff77f13cb3ab1a606bd2083b26cc69c54f
https://github.com/hfaran/Tornado-JSON/blob/8d8b35ff77f13cb3ab1a606bd2083b26cc69c54f/tornado_json/gen.py#L8-L19
42,512
dlintott/gns3-converter
gns3converter/main.py
main
def main(): """ Entry point for gns3-converter """ arg_parse = setup_argparse() args = arg_parse.parse_args() if not args.quiet: print('GNS3 Topology Converter') if args.debug: logging_level = logging.DEBUG else: logging_level = logging.WARNING logging.basi...
python
def main(): """ Entry point for gns3-converter """ arg_parse = setup_argparse() args = arg_parse.parse_args() if not args.quiet: print('GNS3 Topology Converter') if args.debug: logging_level = logging.DEBUG else: logging_level = logging.WARNING logging.basi...
[ "def", "main", "(", ")", ":", "arg_parse", "=", "setup_argparse", "(", ")", "args", "=", "arg_parse", ".", "parse_args", "(", ")", "if", "not", "args", ".", "quiet", ":", "print", "(", "'GNS3 Topology Converter'", ")", "if", "args", ".", "debug", ":", ...
Entry point for gns3-converter
[ "Entry", "point", "for", "gns3", "-", "converter" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/main.py#L32-L66
42,513
dlintott/gns3-converter
gns3converter/main.py
setup_argparse
def setup_argparse(): """ Setup the argparse argument parser :return: instance of argparse :rtype: ArgumentParser """ parser = argparse.ArgumentParser( description='Convert old ini-style GNS3 topologies (<=0.8.7) to ' 'the newer version 1+ JSON format') parser.ad...
python
def setup_argparse(): """ Setup the argparse argument parser :return: instance of argparse :rtype: ArgumentParser """ parser = argparse.ArgumentParser( description='Convert old ini-style GNS3 topologies (<=0.8.7) to ' 'the newer version 1+ JSON format') parser.ad...
[ "def", "setup_argparse", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Convert old ini-style GNS3 topologies (<=0.8.7) to '", "'the newer version 1+ JSON format'", ")", "parser", ".", "add_argument", "(", "'--version'", ",", "...
Setup the argparse argument parser :return: instance of argparse :rtype: ArgumentParser
[ "Setup", "the", "argparse", "argument", "parser" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/main.py#L69-L94
42,514
dlintott/gns3-converter
gns3converter/main.py
do_conversion
def do_conversion(topology_def, topology_name, output_dir=None, debug=False, quiet=False): """ Convert the topology :param dict topology_def: Dict containing topology file and snapshot bool. For example: ``{'file': filename, 'sna...
python
def do_conversion(topology_def, topology_name, output_dir=None, debug=False, quiet=False): """ Convert the topology :param dict topology_def: Dict containing topology file and snapshot bool. For example: ``{'file': filename, 'sna...
[ "def", "do_conversion", "(", "topology_def", ",", "topology_name", ",", "output_dir", "=", "None", ",", "debug", "=", "False", ",", "quiet", "=", "False", ")", ":", "# Create a new instance of the the Converter", "gns3_conv", "=", "Converter", "(", "topology_def", ...
Convert the topology :param dict topology_def: Dict containing topology file and snapshot bool. For example: ``{'file': filename, 'snapshot': False}`` :param str topology_name: The name of the topology :param str output_dir: The directory in which...
[ "Convert", "the", "topology" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/main.py#L97-L132
42,515
dlintott/gns3-converter
gns3converter/main.py
get_snapshots
def get_snapshots(topology): """ Return the paths of any snapshot topologies :param str topology: topology file :return: list of dicts containing snapshot topologies :rtype: list """ snapshots = [] snap_dir = os.path.join(topology_dirname(topology), 'snapshots') if os.path.exists(sn...
python
def get_snapshots(topology): """ Return the paths of any snapshot topologies :param str topology: topology file :return: list of dicts containing snapshot topologies :rtype: list """ snapshots = [] snap_dir = os.path.join(topology_dirname(topology), 'snapshots') if os.path.exists(sn...
[ "def", "get_snapshots", "(", "topology", ")", ":", "snapshots", "=", "[", "]", "snap_dir", "=", "os", ".", "path", ".", "join", "(", "topology_dirname", "(", "topology", ")", ",", "'snapshots'", ")", "if", "os", ".", "path", ".", "exists", "(", "snap_d...
Return the paths of any snapshot topologies :param str topology: topology file :return: list of dicts containing snapshot topologies :rtype: list
[ "Return", "the", "paths", "of", "any", "snapshot", "topologies" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/main.py#L157-L174
42,516
dlintott/gns3-converter
gns3converter/main.py
name
def name(topology_file, topology_name=None): """ Calculate the name to save the converted topology as using either either a specified name or the directory name of the current project :param str topology_file: Topology filename :param topology_name: Optional topology name (Default: None) :type ...
python
def name(topology_file, topology_name=None): """ Calculate the name to save the converted topology as using either either a specified name or the directory name of the current project :param str topology_file: Topology filename :param topology_name: Optional topology name (Default: None) :type ...
[ "def", "name", "(", "topology_file", ",", "topology_name", "=", "None", ")", ":", "if", "topology_name", "is", "not", "None", ":", "logging", ".", "debug", "(", "'topology name supplied'", ")", "topo_name", "=", "topology_name", "else", ":", "logging", ".", ...
Calculate the name to save the converted topology as using either either a specified name or the directory name of the current project :param str topology_file: Topology filename :param topology_name: Optional topology name (Default: None) :type topology_name: str or None :return: new topology name...
[ "Calculate", "the", "name", "to", "save", "the", "converted", "topology", "as", "using", "either", "either", "a", "specified", "name", "or", "the", "directory", "name", "of", "the", "current", "project" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/main.py#L177-L194
42,517
dlintott/gns3-converter
gns3converter/main.py
snapshot_name
def snapshot_name(topo_name): """ Get the snapshot name :param str topo_name: topology file location. The name is taken from the directory containing the topology file using the following format: topology_NAME_snapshot_DATE_TIME :return: snapshot name...
python
def snapshot_name(topo_name): """ Get the snapshot name :param str topo_name: topology file location. The name is taken from the directory containing the topology file using the following format: topology_NAME_snapshot_DATE_TIME :return: snapshot name...
[ "def", "snapshot_name", "(", "topo_name", ")", ":", "topo_name", "=", "os", ".", "path", ".", "basename", "(", "topology_dirname", "(", "topo_name", ")", ")", "snap_re", "=", "re", ".", "compile", "(", "'^topology_(.+)(_snapshot_)(\\d{6}_\\d{6})$'", ")", "result...
Get the snapshot name :param str topo_name: topology file location. The name is taken from the directory containing the topology file using the following format: topology_NAME_snapshot_DATE_TIME :return: snapshot name :raises ConvertError: when unable to ...
[ "Get", "the", "snapshot", "name" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/main.py#L197-L216
42,518
dlintott/gns3-converter
gns3converter/main.py
save
def save(output_dir, converter, json_topology, snapshot, quiet): """ Save the converted topology :param str output_dir: Output Directory :param Converter converter: Converter instance :param JSONTopology json_topology: JSON topology layout :param bool snapshot: Is this a snapshot? :param bo...
python
def save(output_dir, converter, json_topology, snapshot, quiet): """ Save the converted topology :param str output_dir: Output Directory :param Converter converter: Converter instance :param JSONTopology json_topology: JSON topology layout :param bool snapshot: Is this a snapshot? :param bo...
[ "def", "save", "(", "output_dir", ",", "converter", ",", "json_topology", ",", "snapshot", ",", "quiet", ")", ":", "try", ":", "old_topology_dir", "=", "topology_dirname", "(", "converter", ".", "topology", ")", "if", "output_dir", ":", "output_dir", "=", "o...
Save the converted topology :param str output_dir: Output Directory :param Converter converter: Converter instance :param JSONTopology json_topology: JSON topology layout :param bool snapshot: Is this a snapshot? :param bool quiet: No console printing
[ "Save", "the", "converted", "topology" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/main.py#L219-L292
42,519
dlintott/gns3-converter
gns3converter/main.py
copy_configs
def copy_configs(configs, source, target): """ Copy dynamips configs to converted topology :param configs: Configs to copy :param str source: Source topology directory :param str target: Target topology files directory :return: True when a config cannot be found, otherwise false :rtype: boo...
python
def copy_configs(configs, source, target): """ Copy dynamips configs to converted topology :param configs: Configs to copy :param str source: Source topology directory :param str target: Target topology files directory :return: True when a config cannot be found, otherwise false :rtype: boo...
[ "def", "copy_configs", "(", "configs", ",", "source", ",", "target", ")", ":", "config_err", "=", "False", "if", "len", "(", "configs", ")", ">", "0", ":", "config_dir", "=", "os", ".", "path", ".", "join", "(", "target", ",", "'dynamips'", ",", "'co...
Copy dynamips configs to converted topology :param configs: Configs to copy :param str source: Source topology directory :param str target: Target topology files directory :return: True when a config cannot be found, otherwise false :rtype: bool
[ "Copy", "dynamips", "configs", "to", "converted", "topology" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/main.py#L295-L319
42,520
dlintott/gns3-converter
gns3converter/main.py
copy_vpcs_configs
def copy_vpcs_configs(source, target): """ Copy any VPCS configs to the converted topology :param str source: Source topology directory :param str target: Target topology files directory """ # Prepare a list of files to copy vpcs_files = glob.glob(os.path.join(source, 'configs', '*.vpc')) ...
python
def copy_vpcs_configs(source, target): """ Copy any VPCS configs to the converted topology :param str source: Source topology directory :param str target: Target topology files directory """ # Prepare a list of files to copy vpcs_files = glob.glob(os.path.join(source, 'configs', '*.vpc')) ...
[ "def", "copy_vpcs_configs", "(", "source", ",", "target", ")", ":", "# Prepare a list of files to copy", "vpcs_files", "=", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "source", ",", "'configs'", ",", "'*.vpc'", ")", ")", "vpcs_hist", "=",...
Copy any VPCS configs to the converted topology :param str source: Source topology directory :param str target: Target topology files directory
[ "Copy", "any", "VPCS", "configs", "to", "the", "converted", "topology" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/main.py#L322-L341
42,521
dlintott/gns3-converter
gns3converter/main.py
copy_topology_image
def copy_topology_image(source, target): """ Copy any images of the topology to the converted topology :param str source: Source topology directory :param str target: Target Directory """ files = glob.glob(os.path.join(source, '*.png')) for file in files: shutil.copy(file, target)
python
def copy_topology_image(source, target): """ Copy any images of the topology to the converted topology :param str source: Source topology directory :param str target: Target Directory """ files = glob.glob(os.path.join(source, '*.png')) for file in files: shutil.copy(file, target)
[ "def", "copy_topology_image", "(", "source", ",", "target", ")", ":", "files", "=", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "source", ",", "'*.png'", ")", ")", "for", "file", "in", "files", ":", "shutil", ".", "copy", "(", "f...
Copy any images of the topology to the converted topology :param str source: Source topology directory :param str target: Target Directory
[ "Copy", "any", "images", "of", "the", "topology", "to", "the", "converted", "topology" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/main.py#L344-L354
42,522
dlintott/gns3-converter
gns3converter/main.py
copy_images
def copy_images(images, source, target): """ Copy images to converted topology :param images: Images to copy :param source: Old Topology Directory :param target: Target topology files directory :return: True when an image cannot be found, otherwise false :rtype: bool """ image_err =...
python
def copy_images(images, source, target): """ Copy images to converted topology :param images: Images to copy :param source: Old Topology Directory :param target: Target topology files directory :return: True when an image cannot be found, otherwise false :rtype: bool """ image_err =...
[ "def", "copy_images", "(", "images", ",", "source", ",", "target", ")", ":", "image_err", "=", "False", "if", "len", "(", "images", ")", ">", "0", ":", "images_dir", "=", "os", ".", "path", ".", "join", "(", "target", ",", "'images'", ")", "os", "....
Copy images to converted topology :param images: Images to copy :param source: Old Topology Directory :param target: Target topology files directory :return: True when an image cannot be found, otherwise false :rtype: bool
[ "Copy", "images", "to", "converted", "topology" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/main.py#L357-L384
42,523
dlintott/gns3-converter
gns3converter/main.py
make_vbox_dirs
def make_vbox_dirs(max_vbox_id, output_dir, topology_name): """ Create VirtualBox working directories if required :param int max_vbox_id: Number of directories to create :param str output_dir: Output directory :param str topology_name: Topology name """ if max_vbox_id is not None: f...
python
def make_vbox_dirs(max_vbox_id, output_dir, topology_name): """ Create VirtualBox working directories if required :param int max_vbox_id: Number of directories to create :param str output_dir: Output directory :param str topology_name: Topology name """ if max_vbox_id is not None: f...
[ "def", "make_vbox_dirs", "(", "max_vbox_id", ",", "output_dir", ",", "topology_name", ")", ":", "if", "max_vbox_id", "is", "not", "None", ":", "for", "i", "in", "range", "(", "1", ",", "max_vbox_id", "+", "1", ")", ":", "vbox_dir", "=", "os", ".", "pat...
Create VirtualBox working directories if required :param int max_vbox_id: Number of directories to create :param str output_dir: Output directory :param str topology_name: Topology name
[ "Create", "VirtualBox", "working", "directories", "if", "required" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/main.py#L398-L410
42,524
dlintott/gns3-converter
gns3converter/main.py
make_qemu_dirs
def make_qemu_dirs(max_qemu_id, output_dir, topology_name): """ Create Qemu VM working directories if required :param int max_qemu_id: Number of directories to create :param str output_dir: Output directory :param str topology_name: Topology name """ if max_qemu_id is not None: for ...
python
def make_qemu_dirs(max_qemu_id, output_dir, topology_name): """ Create Qemu VM working directories if required :param int max_qemu_id: Number of directories to create :param str output_dir: Output directory :param str topology_name: Topology name """ if max_qemu_id is not None: for ...
[ "def", "make_qemu_dirs", "(", "max_qemu_id", ",", "output_dir", ",", "topology_name", ")", ":", "if", "max_qemu_id", "is", "not", "None", ":", "for", "i", "in", "range", "(", "1", ",", "max_qemu_id", "+", "1", ")", ":", "qemu_dir", "=", "os", ".", "pat...
Create Qemu VM working directories if required :param int max_qemu_id: Number of directories to create :param str output_dir: Output directory :param str topology_name: Topology name
[ "Create", "Qemu", "VM", "working", "directories", "if", "required" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/main.py#L413-L425
42,525
dlintott/gns3-converter
gns3converter/node.py
Node.add_wic
def add_wic(self, old_wic, wic): """ Convert the old style WIC slot to a new style WIC slot and add the WIC to the node properties :param str old_wic: Old WIC slot :param str wic: WIC name """ new_wic = 'wic' + old_wic[-1] self.node['properties'][new_wic]...
python
def add_wic(self, old_wic, wic): """ Convert the old style WIC slot to a new style WIC slot and add the WIC to the node properties :param str old_wic: Old WIC slot :param str wic: WIC name """ new_wic = 'wic' + old_wic[-1] self.node['properties'][new_wic]...
[ "def", "add_wic", "(", "self", ",", "old_wic", ",", "wic", ")", ":", "new_wic", "=", "'wic'", "+", "old_wic", "[", "-", "1", "]", "self", ".", "node", "[", "'properties'", "]", "[", "new_wic", "]", "=", "wic" ]
Convert the old style WIC slot to a new style WIC slot and add the WIC to the node properties :param str old_wic: Old WIC slot :param str wic: WIC name
[ "Convert", "the", "old", "style", "WIC", "slot", "to", "a", "new", "style", "WIC", "slot", "and", "add", "the", "WIC", "to", "the", "node", "properties" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/node.py#L49-L58
42,526
dlintott/gns3-converter
gns3converter/node.py
Node.add_slot_ports
def add_slot_ports(self, slot): """ Add the ports to be added for a adapter card :param str slot: Slot name """ slot_nb = int(slot[4]) # slot_adapter = None # if slot in self.node['properties']: # slot_adapter = self.node['properties'][slot] #...
python
def add_slot_ports(self, slot): """ Add the ports to be added for a adapter card :param str slot: Slot name """ slot_nb = int(slot[4]) # slot_adapter = None # if slot in self.node['properties']: # slot_adapter = self.node['properties'][slot] #...
[ "def", "add_slot_ports", "(", "self", ",", "slot", ")", ":", "slot_nb", "=", "int", "(", "slot", "[", "4", "]", ")", "# slot_adapter = None", "# if slot in self.node['properties']:", "# slot_adapter = self.node['properties'][slot]", "# elif self.device_info['model'] == 'c...
Add the ports to be added for a adapter card :param str slot: Slot name
[ "Add", "the", "ports", "to", "be", "added", "for", "a", "adapter", "card" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/node.py#L91-L121
42,527
dlintott/gns3-converter
gns3converter/node.py
Node.add_info_from_hv
def add_info_from_hv(self): """ Add the information we need from the old hypervisor section """ # Router Image if 'image' in self.hypervisor: self.node['properties']['image'] = \ os.path.basename(self.hypervisor['image']) # IDLE-PC if '...
python
def add_info_from_hv(self): """ Add the information we need from the old hypervisor section """ # Router Image if 'image' in self.hypervisor: self.node['properties']['image'] = \ os.path.basename(self.hypervisor['image']) # IDLE-PC if '...
[ "def", "add_info_from_hv", "(", "self", ")", ":", "# Router Image", "if", "'image'", "in", "self", ".", "hypervisor", ":", "self", ".", "node", "[", "'properties'", "]", "[", "'image'", "]", "=", "os", ".", "path", ".", "basename", "(", "self", ".", "h...
Add the information we need from the old hypervisor section
[ "Add", "the", "information", "we", "need", "from", "the", "old", "hypervisor", "section" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/node.py#L123-L145
42,528
dlintott/gns3-converter
gns3converter/node.py
Node.add_device_items
def add_device_items(self, item, device): """ Add the various items from the device to the node :param str item: item key :param dict device: dictionary containing items """ if item in ('aux', 'console'): self.node['properties'][item] = device[item] e...
python
def add_device_items(self, item, device): """ Add the various items from the device to the node :param str item: item key :param dict device: dictionary containing items """ if item in ('aux', 'console'): self.node['properties'][item] = device[item] e...
[ "def", "add_device_items", "(", "self", ",", "item", ",", "device", ")", ":", "if", "item", "in", "(", "'aux'", ",", "'console'", ")", ":", "self", ".", "node", "[", "'properties'", "]", "[", "item", "]", "=", "device", "[", "item", "]", "elif", "i...
Add the various items from the device to the node :param str item: item key :param dict device: dictionary containing items
[ "Add", "the", "various", "items", "from", "the", "device", "to", "the", "node" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/node.py#L147-L190
42,529
dlintott/gns3-converter
gns3converter/node.py
Node.add_to_virtualbox
def add_to_virtualbox(self): """ Add additional parameters that were in the VBoxDevice section or not present """ # VirtualBox Image if 'vmname' not in self.node['properties']: self.node['properties']['vmname'] = \ self.hypervisor['VBoxDevice']...
python
def add_to_virtualbox(self): """ Add additional parameters that were in the VBoxDevice section or not present """ # VirtualBox Image if 'vmname' not in self.node['properties']: self.node['properties']['vmname'] = \ self.hypervisor['VBoxDevice']...
[ "def", "add_to_virtualbox", "(", "self", ")", ":", "# VirtualBox Image", "if", "'vmname'", "not", "in", "self", ".", "node", "[", "'properties'", "]", ":", "self", ".", "node", "[", "'properties'", "]", "[", "'vmname'", "]", "=", "self", ".", "hypervisor",...
Add additional parameters that were in the VBoxDevice section or not present
[ "Add", "additional", "parameters", "that", "were", "in", "the", "VBoxDevice", "section", "or", "not", "present" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/node.py#L192-L208
42,530
dlintott/gns3-converter
gns3converter/node.py
Node.add_to_qemu
def add_to_qemu(self): """ Add additional parameters to a QemuVM Device that were present in its global conf section """ device = self.device_info['ext_conf'] node_prop = self.node['properties'] hv_device = self.hypervisor[device] # QEMU HDD Images ...
python
def add_to_qemu(self): """ Add additional parameters to a QemuVM Device that were present in its global conf section """ device = self.device_info['ext_conf'] node_prop = self.node['properties'] hv_device = self.hypervisor[device] # QEMU HDD Images ...
[ "def", "add_to_qemu", "(", "self", ")", ":", "device", "=", "self", ".", "device_info", "[", "'ext_conf'", "]", "node_prop", "=", "self", ".", "node", "[", "'properties'", "]", "hv_device", "=", "self", ".", "hypervisor", "[", "device", "]", "# QEMU HDD Im...
Add additional parameters to a QemuVM Device that were present in its global conf section
[ "Add", "additional", "parameters", "to", "a", "QemuVM", "Device", "that", "were", "present", "in", "its", "global", "conf", "section" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/node.py#L210-L264
42,531
dlintott/gns3-converter
gns3converter/node.py
Node.add_vm_ethernet_ports
def add_vm_ethernet_ports(self): """ Add ethernet ports to Virtualbox and Qemu nodes """ for i in range(self.node['properties']['adapters']): port = {'id': self.port_id, 'name': 'Ethernet%s' % i, 'port_number': i} self.node[...
python
def add_vm_ethernet_ports(self): """ Add ethernet ports to Virtualbox and Qemu nodes """ for i in range(self.node['properties']['adapters']): port = {'id': self.port_id, 'name': 'Ethernet%s' % i, 'port_number': i} self.node[...
[ "def", "add_vm_ethernet_ports", "(", "self", ")", ":", "for", "i", "in", "range", "(", "self", ".", "node", "[", "'properties'", "]", "[", "'adapters'", "]", ")", ":", "port", "=", "{", "'id'", ":", "self", ".", "port_id", ",", "'name'", ":", "'Ether...
Add ethernet ports to Virtualbox and Qemu nodes
[ "Add", "ethernet", "ports", "to", "Virtualbox", "and", "Qemu", "nodes" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/node.py#L266-L275
42,532
dlintott/gns3-converter
gns3converter/node.py
Node.set_qemu_symbol
def set_qemu_symbol(self): """ Set the appropriate symbol for QEMU Devices """ valid_devices = {'ASA': 'asa', 'PIX': 'PIX_firewall', 'JUNOS': 'router', 'IDS': 'ids'} if self.device_info['from'] in valid_devices \ and 'default_symbol' not i...
python
def set_qemu_symbol(self): """ Set the appropriate symbol for QEMU Devices """ valid_devices = {'ASA': 'asa', 'PIX': 'PIX_firewall', 'JUNOS': 'router', 'IDS': 'ids'} if self.device_info['from'] in valid_devices \ and 'default_symbol' not i...
[ "def", "set_qemu_symbol", "(", "self", ")", ":", "valid_devices", "=", "{", "'ASA'", ":", "'asa'", ",", "'PIX'", ":", "'PIX_firewall'", ",", "'JUNOS'", ":", "'router'", ",", "'IDS'", ":", "'ids'", "}", "if", "self", ".", "device_info", "[", "'from'", "]"...
Set the appropriate symbol for QEMU Devices
[ "Set", "the", "appropriate", "symbol", "for", "QEMU", "Devices" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/node.py#L277-L286
42,533
dlintott/gns3-converter
gns3converter/node.py
Node.set_symbol
def set_symbol(self, symbol): """ Set a symbol for a device :param str symbol: Symbol to use """ if symbol == 'EtherSwitch router': symbol = 'multilayer_switch' elif symbol == 'Host': symbol = 'computer' normal = ':/symbols/%s.normal.svg'...
python
def set_symbol(self, symbol): """ Set a symbol for a device :param str symbol: Symbol to use """ if symbol == 'EtherSwitch router': symbol = 'multilayer_switch' elif symbol == 'Host': symbol = 'computer' normal = ':/symbols/%s.normal.svg'...
[ "def", "set_symbol", "(", "self", ",", "symbol", ")", ":", "if", "symbol", "==", "'EtherSwitch router'", ":", "symbol", "=", "'multilayer_switch'", "elif", "symbol", "==", "'Host'", ":", "symbol", "=", "'computer'", "normal", "=", "':/symbols/%s.normal.svg'", "%...
Set a symbol for a device :param str symbol: Symbol to use
[ "Set", "a", "symbol", "for", "a", "device" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/node.py#L288-L303
42,534
dlintott/gns3-converter
gns3converter/node.py
Node.calc_ethsw_port
def calc_ethsw_port(self, port_num, port_def): """ Split and create the port entry for an Ethernet Switch :param port_num: port number :type port_num: str or int :param str port_def: port definition """ # Port String - access 1 SW2 1 # 0: type 1: vlan 2: ...
python
def calc_ethsw_port(self, port_num, port_def): """ Split and create the port entry for an Ethernet Switch :param port_num: port number :type port_num: str or int :param str port_def: port definition """ # Port String - access 1 SW2 1 # 0: type 1: vlan 2: ...
[ "def", "calc_ethsw_port", "(", "self", ",", "port_num", ",", "port_def", ")", ":", "# Port String - access 1 SW2 1", "# 0: type 1: vlan 2: destination device 3: destination port", "port_def", "=", "port_def", ".", "split", "(", "' '", ")", "if", "len", "(", "port_def", ...
Split and create the port entry for an Ethernet Switch :param port_num: port number :type port_num: str or int :param str port_def: port definition
[ "Split", "and", "create", "the", "port", "entry", "for", "an", "Ethernet", "Switch" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/node.py#L305-L331
42,535
dlintott/gns3-converter
gns3converter/node.py
Node.calc_mb_ports
def calc_mb_ports(self): """ Add the default ports to add to a router """ model = self.device_info['model'] chassis = self.device_info['chassis'] num_ports = MODEL_MATRIX[model][chassis]['ports'] ports = [] if num_ports > 0: port_type = MODEL_...
python
def calc_mb_ports(self): """ Add the default ports to add to a router """ model = self.device_info['model'] chassis = self.device_info['chassis'] num_ports = MODEL_MATRIX[model][chassis]['ports'] ports = [] if num_ports > 0: port_type = MODEL_...
[ "def", "calc_mb_ports", "(", "self", ")", ":", "model", "=", "self", ".", "device_info", "[", "'model'", "]", "chassis", "=", "self", ".", "device_info", "[", "'chassis'", "]", "num_ports", "=", "MODEL_MATRIX", "[", "model", "]", "[", "chassis", "]", "["...
Add the default ports to add to a router
[ "Add", "the", "default", "ports", "to", "add", "to", "a", "router" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/node.py#L354-L374
42,536
dlintott/gns3-converter
gns3converter/node.py
Node.calc_link
def calc_link(self, src_id, src_port, src_port_name, destination): """ Add a link item for processing later :param int src_id: Source node ID :param int src_port: Source port ID :param str src_port_name: Source port name :param dict destination: Destination """ ...
python
def calc_link(self, src_id, src_port, src_port_name, destination): """ Add a link item for processing later :param int src_id: Source node ID :param int src_port: Source port ID :param str src_port_name: Source port name :param dict destination: Destination """ ...
[ "def", "calc_link", "(", "self", ",", "src_id", ",", "src_port", ",", "src_port_name", ",", "destination", ")", ":", "if", "destination", "[", "'device'", "]", "==", "'NIO'", ":", "destination", "[", "'port'", "]", "=", "destination", "[", "'port'", "]", ...
Add a link item for processing later :param int src_id: Source node ID :param int src_port: Source port ID :param str src_port_name: Source port name :param dict destination: Destination
[ "Add", "a", "link", "item", "for", "processing", "later" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/node.py#L376-L395
42,537
dlintott/gns3-converter
gns3converter/node.py
Node.set_description
def set_description(self): """ Set the node description """ if self.device_info['type'] == 'Router': self.node['description'] = '%s %s' % (self.device_info['type'], self.device_info['model']) else: self.nod...
python
def set_description(self): """ Set the node description """ if self.device_info['type'] == 'Router': self.node['description'] = '%s %s' % (self.device_info['type'], self.device_info['model']) else: self.nod...
[ "def", "set_description", "(", "self", ")", ":", "if", "self", ".", "device_info", "[", "'type'", "]", "==", "'Router'", ":", "self", ".", "node", "[", "'description'", "]", "=", "'%s %s'", "%", "(", "self", ".", "device_info", "[", "'type'", "]", ",",...
Set the node description
[ "Set", "the", "node", "description" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/node.py#L402-L410
42,538
dlintott/gns3-converter
gns3converter/node.py
Node.set_type
def set_type(self): """ Set the node type """ if self.device_info['type'] == 'Router': self.node['type'] = self.device_info['model'].upper() else: self.node['type'] = self.device_info['type']
python
def set_type(self): """ Set the node type """ if self.device_info['type'] == 'Router': self.node['type'] = self.device_info['model'].upper() else: self.node['type'] = self.device_info['type']
[ "def", "set_type", "(", "self", ")", ":", "if", "self", ".", "device_info", "[", "'type'", "]", "==", "'Router'", ":", "self", ".", "node", "[", "'type'", "]", "=", "self", ".", "device_info", "[", "'model'", "]", ".", "upper", "(", ")", "else", ":...
Set the node type
[ "Set", "the", "node", "type" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/node.py#L412-L419
42,539
dlintott/gns3-converter
gns3converter/node.py
Node.calc_device_links
def calc_device_links(self): """ Calculate a router or VirtualBox link """ for connection in self.interfaces: int_type = connection['from'][0] int_name = connection['from'].replace(int_type, PORT_TYPES[int_type.upp...
python
def calc_device_links(self): """ Calculate a router or VirtualBox link """ for connection in self.interfaces: int_type = connection['from'][0] int_name = connection['from'].replace(int_type, PORT_TYPES[int_type.upp...
[ "def", "calc_device_links", "(", "self", ")", ":", "for", "connection", "in", "self", ".", "interfaces", ":", "int_type", "=", "connection", "[", "'from'", "]", "[", "0", "]", "int_name", "=", "connection", "[", "'from'", "]", ".", "replace", "(", "int_t...
Calculate a router or VirtualBox link
[ "Calculate", "a", "router", "or", "VirtualBox", "link" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/node.py#L431-L454
42,540
dlintott/gns3-converter
gns3converter/node.py
Node.calc_cloud_connection
def calc_cloud_connection(self): """ Add the ports and nios for a cloud connection :return: None on success or RuntimeError on error """ # Connection String - SW1:1:nio_gen_eth:eth0 # 0: Destination device 1: Destination port # 2: NIO 3: NIO Destination s...
python
def calc_cloud_connection(self): """ Add the ports and nios for a cloud connection :return: None on success or RuntimeError on error """ # Connection String - SW1:1:nio_gen_eth:eth0 # 0: Destination device 1: Destination port # 2: NIO 3: NIO Destination s...
[ "def", "calc_cloud_connection", "(", "self", ")", ":", "# Connection String - SW1:1:nio_gen_eth:eth0", "# 0: Destination device 1: Destination port", "# 2: NIO 3: NIO Destination", "self", ".", "node", "[", "'properties'", "]", "[", "'nios'", "]", "=", "[", "]", "if", "se...
Add the ports and nios for a cloud connection :return: None on success or RuntimeError on error
[ "Add", "the", "ports", "and", "nios", "for", "a", "cloud", "connection" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/node.py#L456-L488
42,541
dlintott/gns3-converter
gns3converter/node.py
Node.process_mappings
def process_mappings(self): """ Process the mappings for a Frame Relay switch. Removes duplicates and adds the mappings to the node properties """ for mapping_a in self.mappings: for mapping_b in self.mappings: if mapping_a['source'] == mapping_b['dest...
python
def process_mappings(self): """ Process the mappings for a Frame Relay switch. Removes duplicates and adds the mappings to the node properties """ for mapping_a in self.mappings: for mapping_b in self.mappings: if mapping_a['source'] == mapping_b['dest...
[ "def", "process_mappings", "(", "self", ")", ":", "for", "mapping_a", "in", "self", ".", "mappings", ":", "for", "mapping_b", "in", "self", ".", "mappings", ":", "if", "mapping_a", "[", "'source'", "]", "==", "mapping_b", "[", "'dest'", "]", ":", "self",...
Process the mappings for a Frame Relay switch. Removes duplicates and adds the mappings to the node properties
[ "Process", "the", "mappings", "for", "a", "Frame", "Relay", "switch", ".", "Removes", "duplicates", "and", "adds", "the", "mappings", "to", "the", "node", "properties" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/node.py#L490-L504
42,542
dlintott/gns3-converter
gns3converter/utils.py
fix_path
def fix_path(path): """ Fix windows path's. Linux path's will remain unaltered :param str path: The path to be fixed :return: The fixed path :rtype: str """ if '\\' in path: path = path.replace('\\', '/') path = os.path.normpath(path) return path
python
def fix_path(path): """ Fix windows path's. Linux path's will remain unaltered :param str path: The path to be fixed :return: The fixed path :rtype: str """ if '\\' in path: path = path.replace('\\', '/') path = os.path.normpath(path) return path
[ "def", "fix_path", "(", "path", ")", ":", "if", "'\\\\'", "in", "path", ":", "path", "=", "path", ".", "replace", "(", "'\\\\'", ",", "'/'", ")", "path", "=", "os", ".", "path", ".", "normpath", "(", "path", ")", "return", "path" ]
Fix windows path's. Linux path's will remain unaltered :param str path: The path to be fixed :return: The fixed path :rtype: str
[ "Fix", "windows", "path", "s", ".", "Linux", "path", "s", "will", "remain", "unaltered" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/utils.py#L18-L31
42,543
dlintott/gns3-converter
gns3converter/converter.py
Converter.read_topology
def read_topology(self): """ Read the ini-style topology file using ConfigObj :return config: Topology parsed by :py:mod:`ConfigObj` :rtype: ConfigObj """ configspec = resource_stream(__name__, 'configspec') try: handle = open(self._topology) ...
python
def read_topology(self): """ Read the ini-style topology file using ConfigObj :return config: Topology parsed by :py:mod:`ConfigObj` :rtype: ConfigObj """ configspec = resource_stream(__name__, 'configspec') try: handle = open(self._topology) ...
[ "def", "read_topology", "(", "self", ")", ":", "configspec", "=", "resource_stream", "(", "__name__", ",", "'configspec'", ")", "try", ":", "handle", "=", "open", "(", "self", ".", "_topology", ")", "handle", ".", "close", "(", ")", "try", ":", "config",...
Read the ini-style topology file using ConfigObj :return config: Topology parsed by :py:mod:`ConfigObj` :rtype: ConfigObj
[ "Read", "the", "ini", "-", "style", "topology", "file", "using", "ConfigObj" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/converter.py#L61-L106
42,544
dlintott/gns3-converter
gns3converter/converter.py
Converter.process_topology
def process_topology(self, old_top): """ Processes the sections returned by get_instances :param ConfigObj old_top: old topology as processed by :py:meth:`read_topology` :returns: tuple of dicts containing hypervisors, devices and artwork :rtype...
python
def process_topology(self, old_top): """ Processes the sections returned by get_instances :param ConfigObj old_top: old topology as processed by :py:meth:`read_topology` :returns: tuple of dicts containing hypervisors, devices and artwork :rtype...
[ "def", "process_topology", "(", "self", ",", "old_top", ")", ":", "sections", "=", "self", ".", "get_sections", "(", "old_top", ")", "topo", "=", "LegacyTopology", "(", "sections", ",", "old_top", ")", "for", "instance", "in", "sorted", "(", "sections", ")...
Processes the sections returned by get_instances :param ConfigObj old_top: old topology as processed by :py:meth:`read_topology` :returns: tuple of dicts containing hypervisors, devices and artwork :rtype: tuple
[ "Processes", "the", "sections", "returned", "by", "get_instances" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/converter.py#L108-L150
42,545
dlintott/gns3-converter
gns3converter/converter.py
Converter.generate_links
def generate_links(self, nodes): """ Generate a list of links :param list nodes: A list of nodes from :py:meth:`generate_nodes` :return: list of links :rtype: list """ new_links = [] for link in self.links: # Expand port name if required ...
python
def generate_links(self, nodes): """ Generate a list of links :param list nodes: A list of nodes from :py:meth:`generate_nodes` :return: list of links :rtype: list """ new_links = [] for link in self.links: # Expand port name if required ...
[ "def", "generate_links", "(", "self", ",", "nodes", ")", ":", "new_links", "=", "[", "]", "for", "link", "in", "self", ".", "links", ":", "# Expand port name if required", "if", "INTERFACE_RE", ".", "search", "(", "link", "[", "'dest_port'", "]", ")", "or"...
Generate a list of links :param list nodes: A list of nodes from :py:meth:`generate_nodes` :return: list of links :rtype: list
[ "Generate", "a", "list", "of", "links" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/converter.py#L265-L315
42,546
dlintott/gns3-converter
gns3converter/converter.py
Converter.device_id_from_name
def device_id_from_name(device_name, nodes): """ Get the device ID when given a device name :param str device_name: device name :param list nodes: list of nodes from :py:meth:`generate_nodes` :return: device ID :rtype: int """ device_id = None for...
python
def device_id_from_name(device_name, nodes): """ Get the device ID when given a device name :param str device_name: device name :param list nodes: list of nodes from :py:meth:`generate_nodes` :return: device ID :rtype: int """ device_id = None for...
[ "def", "device_id_from_name", "(", "device_name", ",", "nodes", ")", ":", "device_id", "=", "None", "for", "node", "in", "nodes", ":", "if", "device_name", "==", "node", "[", "'properties'", "]", "[", "'name'", "]", ":", "device_id", "=", "node", "[", "'...
Get the device ID when given a device name :param str device_name: device name :param list nodes: list of nodes from :py:meth:`generate_nodes` :return: device ID :rtype: int
[ "Get", "the", "device", "ID", "when", "given", "a", "device", "name" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/converter.py#L318-L332
42,547
dlintott/gns3-converter
gns3converter/converter.py
Converter.port_id_from_name
def port_id_from_name(port_name, device_id, nodes): """ Get the port ID when given a port name :param str port_name: port name :param str device_id: device ID :param list nodes: list of nodes from :py:meth:`generate_nodes` :return: port ID :rtype: int """...
python
def port_id_from_name(port_name, device_id, nodes): """ Get the port ID when given a port name :param str port_name: port name :param str device_id: device ID :param list nodes: list of nodes from :py:meth:`generate_nodes` :return: port ID :rtype: int """...
[ "def", "port_id_from_name", "(", "port_name", ",", "device_id", ",", "nodes", ")", ":", "port_id", "=", "None", "for", "node", "in", "nodes", ":", "if", "device_id", "==", "node", "[", "'id'", "]", ":", "for", "port", "in", "node", "[", "'ports'", "]",...
Get the port ID when given a port name :param str port_name: port name :param str device_id: device ID :param list nodes: list of nodes from :py:meth:`generate_nodes` :return: port ID :rtype: int
[ "Get", "the", "port", "ID", "when", "given", "a", "port", "name" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/converter.py#L335-L353
42,548
dlintott/gns3-converter
gns3converter/converter.py
Converter.convert_destination_to_id
def convert_destination_to_id(destination_node, destination_port, nodes): """ Convert a destination to device and port ID :param str destination_node: Destination node name :param str destination_port: Destination port name :param list nodes: list of nodes from :py:meth:`generat...
python
def convert_destination_to_id(destination_node, destination_port, nodes): """ Convert a destination to device and port ID :param str destination_node: Destination node name :param str destination_port: Destination port name :param list nodes: list of nodes from :py:meth:`generat...
[ "def", "convert_destination_to_id", "(", "destination_node", ",", "destination_port", ",", "nodes", ")", ":", "device_id", "=", "None", "device_name", "=", "None", "port_id", "=", "None", "if", "destination_node", "!=", "'NIO'", ":", "for", "node", "in", "nodes"...
Convert a destination to device and port ID :param str destination_node: Destination node name :param str destination_port: Destination port name :param list nodes: list of nodes from :py:meth:`generate_nodes` :return: dict containing device ID, device name and port ID :rtype: d...
[ "Convert", "a", "destination", "to", "device", "and", "port", "ID" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/converter.py#L356-L392
42,549
dlintott/gns3-converter
gns3converter/converter.py
Converter.get_node_name_from_id
def get_node_name_from_id(node_id, nodes): """ Get the name of a node when given the node_id :param int node_id: The ID of a node :param list nodes: list of nodes from :py:meth:`generate_nodes` :return: node name :rtype: str """ node_name = '' for...
python
def get_node_name_from_id(node_id, nodes): """ Get the name of a node when given the node_id :param int node_id: The ID of a node :param list nodes: list of nodes from :py:meth:`generate_nodes` :return: node name :rtype: str """ node_name = '' for...
[ "def", "get_node_name_from_id", "(", "node_id", ",", "nodes", ")", ":", "node_name", "=", "''", "for", "node", "in", "nodes", ":", "if", "node", "[", "'id'", "]", "==", "node_id", ":", "node_name", "=", "node", "[", "'properties'", "]", "[", "'name'", ...
Get the name of a node when given the node_id :param int node_id: The ID of a node :param list nodes: list of nodes from :py:meth:`generate_nodes` :return: node name :rtype: str
[ "Get", "the", "name", "of", "a", "node", "when", "given", "the", "node_id" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/converter.py#L395-L409
42,550
dlintott/gns3-converter
gns3converter/converter.py
Converter.get_port_name_from_id
def get_port_name_from_id(node_id, port_id, nodes): """ Get the name of a port for a given node and port ID :param int node_id: node ID :param int port_id: port ID :param list nodes: list of nodes from :py:meth:`generate_nodes` :return: port name :rtype: str ...
python
def get_port_name_from_id(node_id, port_id, nodes): """ Get the name of a port for a given node and port ID :param int node_id: node ID :param int port_id: port ID :param list nodes: list of nodes from :py:meth:`generate_nodes` :return: port name :rtype: str ...
[ "def", "get_port_name_from_id", "(", "node_id", ",", "port_id", ",", "nodes", ")", ":", "port_name", "=", "''", "for", "node", "in", "nodes", ":", "if", "node", "[", "'id'", "]", "==", "node_id", ":", "for", "port", "in", "node", "[", "'ports'", "]", ...
Get the name of a port for a given node and port ID :param int node_id: node ID :param int port_id: port ID :param list nodes: list of nodes from :py:meth:`generate_nodes` :return: port name :rtype: str
[ "Get", "the", "name", "of", "a", "port", "for", "a", "given", "node", "and", "port", "ID" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/converter.py#L412-L429
42,551
dlintott/gns3-converter
gns3converter/converter.py
Converter.add_node_connection
def add_node_connection(self, link, nodes): """ Add a connection to a node :param dict link: link definition :param list nodes: list of nodes from :py:meth:`generate_nodes` """ # Description src_desc = 'connected to %s on port %s' % \ (self.get...
python
def add_node_connection(self, link, nodes): """ Add a connection to a node :param dict link: link definition :param list nodes: list of nodes from :py:meth:`generate_nodes` """ # Description src_desc = 'connected to %s on port %s' % \ (self.get...
[ "def", "add_node_connection", "(", "self", ",", "link", ",", "nodes", ")", ":", "# Description", "src_desc", "=", "'connected to %s on port %s'", "%", "(", "self", ".", "get_node_name_from_id", "(", "link", "[", "'destination_node_id'", "]", ",", "nodes", ")", "...
Add a connection to a node :param dict link: link definition :param list nodes: list of nodes from :py:meth:`generate_nodes`
[ "Add", "a", "connection", "to", "a", "node" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/converter.py#L431-L464
42,552
dlintott/gns3-converter
gns3converter/converter.py
Converter.generate_shapes
def generate_shapes(shapes): """ Generate the shapes for the topology :param dict shapes: A dict of converted shapes from the old topology :return: dict containing two lists (ellipse, rectangle) :rtype: dict """ new_shapes = {'ellipse': [], 'rectangle': []} ...
python
def generate_shapes(shapes): """ Generate the shapes for the topology :param dict shapes: A dict of converted shapes from the old topology :return: dict containing two lists (ellipse, rectangle) :rtype: dict """ new_shapes = {'ellipse': [], 'rectangle': []} ...
[ "def", "generate_shapes", "(", "shapes", ")", ":", "new_shapes", "=", "{", "'ellipse'", ":", "[", "]", ",", "'rectangle'", ":", "[", "]", "}", "for", "shape", "in", "shapes", ":", "tmp_shape", "=", "{", "}", "for", "shape_item", "in", "shapes", "[", ...
Generate the shapes for the topology :param dict shapes: A dict of converted shapes from the old topology :return: dict containing two lists (ellipse, rectangle) :rtype: dict
[ "Generate", "the", "shapes", "for", "the", "topology" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/converter.py#L467-L485
42,553
dlintott/gns3-converter
gns3converter/converter.py
Converter.generate_notes
def generate_notes(notes): """ Generate the notes list :param dict notes: A dict of converted notes from the old topology :return: List of notes for the the topology :rtype: list """ new_notes = [] for note in notes: tmp_note = {} ...
python
def generate_notes(notes): """ Generate the notes list :param dict notes: A dict of converted notes from the old topology :return: List of notes for the the topology :rtype: list """ new_notes = [] for note in notes: tmp_note = {} ...
[ "def", "generate_notes", "(", "notes", ")", ":", "new_notes", "=", "[", "]", "for", "note", "in", "notes", ":", "tmp_note", "=", "{", "}", "for", "note_item", "in", "notes", "[", "note", "]", ":", "tmp_note", "[", "note_item", "]", "=", "notes", "[",...
Generate the notes list :param dict notes: A dict of converted notes from the old topology :return: List of notes for the the topology :rtype: list
[ "Generate", "the", "notes", "list" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/converter.py#L488-L505
42,554
dlintott/gns3-converter
gns3converter/converter.py
Converter.generate_images
def generate_images(self, pixmaps): """ Generate the images list and store the images to copy :param dict pixmaps: A dict of converted pixmaps from the old topology :return: A list of images :rtype: list """ new_images = [] for image in pixmaps: ...
python
def generate_images(self, pixmaps): """ Generate the images list and store the images to copy :param dict pixmaps: A dict of converted pixmaps from the old topology :return: A list of images :rtype: list """ new_images = [] for image in pixmaps: ...
[ "def", "generate_images", "(", "self", ",", "pixmaps", ")", ":", "new_images", "=", "[", "]", "for", "image", "in", "pixmaps", ":", "tmp_image", "=", "{", "}", "for", "img_item", "in", "pixmaps", "[", "image", "]", ":", "if", "img_item", "==", "'path'"...
Generate the images list and store the images to copy :param dict pixmaps: A dict of converted pixmaps from the old topology :return: A list of images :rtype: list
[ "Generate", "the", "images", "list", "and", "store", "the", "images", "to", "copy" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/converter.py#L507-L531
42,555
dlintott/gns3-converter
gns3converter/topology.py
LegacyTopology.add_qemu_path
def add_qemu_path(self, instance): """ Add the qemu path to the hypervisor conf data :param instance: Hypervisor instance """ tmp_conf = {'qemu_path': self.old_top[instance]['qemupath']} if len(self.topology['conf']) == 0: self.topology['conf'].append(tmp_con...
python
def add_qemu_path(self, instance): """ Add the qemu path to the hypervisor conf data :param instance: Hypervisor instance """ tmp_conf = {'qemu_path': self.old_top[instance]['qemupath']} if len(self.topology['conf']) == 0: self.topology['conf'].append(tmp_con...
[ "def", "add_qemu_path", "(", "self", ",", "instance", ")", ":", "tmp_conf", "=", "{", "'qemu_path'", ":", "self", ".", "old_top", "[", "instance", "]", "[", "'qemupath'", "]", "}", "if", "len", "(", "self", ".", "topology", "[", "'conf'", "]", ")", "...
Add the qemu path to the hypervisor conf data :param instance: Hypervisor instance
[ "Add", "the", "qemu", "path", "to", "the", "hypervisor", "conf", "data" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/topology.py#L162-L172
42,556
dlintott/gns3-converter
gns3converter/topology.py
LegacyTopology.add_conf_item
def add_conf_item(self, instance, item): """ Add a hypervisor configuration item :param instance: Hypervisor instance :param item: Item to add """ tmp_conf = {} if item not in EXTRA_CONF: tmp_conf['model'] = MODEL_TRANSFORM[item] for s_item ...
python
def add_conf_item(self, instance, item): """ Add a hypervisor configuration item :param instance: Hypervisor instance :param item: Item to add """ tmp_conf = {} if item not in EXTRA_CONF: tmp_conf['model'] = MODEL_TRANSFORM[item] for s_item ...
[ "def", "add_conf_item", "(", "self", ",", "instance", ",", "item", ")", ":", "tmp_conf", "=", "{", "}", "if", "item", "not", "in", "EXTRA_CONF", ":", "tmp_conf", "[", "'model'", "]", "=", "MODEL_TRANSFORM", "[", "item", "]", "for", "s_item", "in", "sor...
Add a hypervisor configuration item :param instance: Hypervisor instance :param item: Item to add
[ "Add", "a", "hypervisor", "configuration", "item" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/topology.py#L174-L198
42,557
dlintott/gns3-converter
gns3converter/topology.py
LegacyTopology.device_typename
def device_typename(item): """ Convert the old names to new-style names and types :param str item: A device in the form of 'TYPE NAME' :return: tuple containing device name and type details """ dev_type = {'ROUTER': {'from': 'ROUTER', 'des...
python
def device_typename(item): """ Convert the old names to new-style names and types :param str item: A device in the form of 'TYPE NAME' :return: tuple containing device name and type details """ dev_type = {'ROUTER': {'from': 'ROUTER', 'des...
[ "def", "device_typename", "(", "item", ")", ":", "dev_type", "=", "{", "'ROUTER'", ":", "{", "'from'", ":", "'ROUTER'", ",", "'desc'", ":", "'Router'", ",", "'type'", ":", "'Router'", ",", "'label_x'", ":", "19.5", "}", ",", "'QEMU'", ":", "{", "'from'...
Convert the old names to new-style names and types :param str item: A device in the form of 'TYPE NAME' :return: tuple containing device name and type details
[ "Convert", "the", "old", "names", "to", "new", "-", "style", "names", "and", "types" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/topology.py#L246-L314
42,558
dlintott/gns3-converter
gns3converter/topology.py
JSONTopology.get_topology
def get_topology(self): """ Get the converted topology ready for JSON encoding :return: converted topology assembled into a single dict :rtype: dict """ topology = {'name': self._name, 'resources_type': 'local', 'topology': {}, ...
python
def get_topology(self): """ Get the converted topology ready for JSON encoding :return: converted topology assembled into a single dict :rtype: dict """ topology = {'name': self._name, 'resources_type': 'local', 'topology': {}, ...
[ "def", "get_topology", "(", "self", ")", ":", "topology", "=", "{", "'name'", ":", "self", ".", "_name", ",", "'resources_type'", ":", "'local'", ",", "'topology'", ":", "{", "}", ",", "'type'", ":", "'topology'", ",", "'version'", ":", "'1.0'", "}", "...
Get the converted topology ready for JSON encoding :return: converted topology assembled into a single dict :rtype: dict
[ "Get", "the", "converted", "topology", "ready", "for", "JSON", "encoding" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/topology.py#L469-L498
42,559
dlintott/gns3-converter
gns3converter/topology.py
JSONTopology.get_vboxes
def get_vboxes(self): """ Get the maximum ID of the VBoxes :return: Maximum VBox ID :rtype: int """ vbox_list = [] vbox_max = None for node in self.nodes: if node['type'] == 'VirtualBoxVM': vbox_list.append(node['vbox_id']) ...
python
def get_vboxes(self): """ Get the maximum ID of the VBoxes :return: Maximum VBox ID :rtype: int """ vbox_list = [] vbox_max = None for node in self.nodes: if node['type'] == 'VirtualBoxVM': vbox_list.append(node['vbox_id']) ...
[ "def", "get_vboxes", "(", "self", ")", ":", "vbox_list", "=", "[", "]", "vbox_max", "=", "None", "for", "node", "in", "self", ".", "nodes", ":", "if", "node", "[", "'type'", "]", "==", "'VirtualBoxVM'", ":", "vbox_list", ".", "append", "(", "node", "...
Get the maximum ID of the VBoxes :return: Maximum VBox ID :rtype: int
[ "Get", "the", "maximum", "ID", "of", "the", "VBoxes" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/topology.py#L500-L515
42,560
dlintott/gns3-converter
gns3converter/topology.py
JSONTopology.get_qemus
def get_qemus(self): """ Get the maximum ID of the Qemu VMs :return: Maximum Qemu VM ID :rtype: int """ qemu_vm_list = [] qemu_vm_max = None for node in self.nodes: if node['type'] == 'QemuVM': qemu_vm_list.append(node['qemu_id...
python
def get_qemus(self): """ Get the maximum ID of the Qemu VMs :return: Maximum Qemu VM ID :rtype: int """ qemu_vm_list = [] qemu_vm_max = None for node in self.nodes: if node['type'] == 'QemuVM': qemu_vm_list.append(node['qemu_id...
[ "def", "get_qemus", "(", "self", ")", ":", "qemu_vm_list", "=", "[", "]", "qemu_vm_max", "=", "None", "for", "node", "in", "self", ".", "nodes", ":", "if", "node", "[", "'type'", "]", "==", "'QemuVM'", ":", "qemu_vm_list", ".", "append", "(", "node", ...
Get the maximum ID of the Qemu VMs :return: Maximum Qemu VM ID :rtype: int
[ "Get", "the", "maximum", "ID", "of", "the", "Qemu", "VMs" ]
acbc55da51de86388dc5b5f6da55809b3c86b7ca
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/topology.py#L517-L532
42,561
aeguana/PyFileMaker
PyFileMaker/xml2obj.py
Element.getElements
def getElements(self,name=''): 'Get a list of child elements' #If no tag name is specified, return the all children if not name: return self.children else: # else return only those children with a matching tag name elements = [] for element in self.children: if element.name == name: element...
python
def getElements(self,name=''): 'Get a list of child elements' #If no tag name is specified, return the all children if not name: return self.children else: # else return only those children with a matching tag name elements = [] for element in self.children: if element.name == name: element...
[ "def", "getElements", "(", "self", ",", "name", "=", "''", ")", ":", "#If no tag name is specified, return the all children", "if", "not", "name", ":", "return", "self", ".", "children", "else", ":", "# else return only those children with a matching tag name", "elements"...
Get a list of child elements
[ "Get", "a", "list", "of", "child", "elements" ]
ef269b52a97e329d91da3c4851ddac800d7fd7e6
https://github.com/aeguana/PyFileMaker/blob/ef269b52a97e329d91da3c4851ddac800d7fd7e6/PyFileMaker/xml2obj.py#L35-L46
42,562
aeguana/PyFileMaker
PyFileMaker/xml2obj.py
Xml2Obj.StartElement
def StartElement(self,name,attributes): 'SAX start element even handler' # Instantiate an Element object element = Element(name.encode(),attributes) # Push element onto the stack and make it a child of parent if len(self.nodeStack) > 0: parent = self.nodeStack[-1] parent.AddChild(element) else: ...
python
def StartElement(self,name,attributes): 'SAX start element even handler' # Instantiate an Element object element = Element(name.encode(),attributes) # Push element onto the stack and make it a child of parent if len(self.nodeStack) > 0: parent = self.nodeStack[-1] parent.AddChild(element) else: ...
[ "def", "StartElement", "(", "self", ",", "name", ",", "attributes", ")", ":", "# Instantiate an Element object", "element", "=", "Element", "(", "name", ".", "encode", "(", ")", ",", "attributes", ")", "# Push element onto the stack and make it a child of parent", "if...
SAX start element even handler
[ "SAX", "start", "element", "even", "handler" ]
ef269b52a97e329d91da3c4851ddac800d7fd7e6
https://github.com/aeguana/PyFileMaker/blob/ef269b52a97e329d91da3c4851ddac800d7fd7e6/PyFileMaker/xml2obj.py#L54-L65
42,563
aeguana/PyFileMaker
PyFileMaker/xml2obj.py
Xml2Obj.CharacterData
def CharacterData(self,data): 'SAX character data event handler' ## HACK: to preserve the newlines #if string.strip(data): data = data.encode("utf-8") element = self.nodeStack[-1] element.cdata += data return
python
def CharacterData(self,data): 'SAX character data event handler' ## HACK: to preserve the newlines #if string.strip(data): data = data.encode("utf-8") element = self.nodeStack[-1] element.cdata += data return
[ "def", "CharacterData", "(", "self", ",", "data", ")", ":", "## HACK: to preserve the newlines", "#if string.strip(data):", "data", "=", "data", ".", "encode", "(", "\"utf-8\"", ")", "element", "=", "self", ".", "nodeStack", "[", "-", "1", "]", "element", ".",...
SAX character data event handler
[ "SAX", "character", "data", "event", "handler" ]
ef269b52a97e329d91da3c4851ddac800d7fd7e6
https://github.com/aeguana/PyFileMaker/blob/ef269b52a97e329d91da3c4851ddac800d7fd7e6/PyFileMaker/xml2obj.py#L71-L78
42,564
aeguana/PyFileMaker
PyFileMaker/FMResultset.py
FMResultset.doShow
def doShow(self, xml=0): """Shows the contents of our resultset.""" if xml == 0: print 'Errorcode:', self.errorcode print print 'Product information:' for key in self.product.keys(): print ' ', key.encode('UTF-8'), print '->', self.product[key].encode('UTF-8') print print 'Datab...
python
def doShow(self, xml=0): """Shows the contents of our resultset.""" if xml == 0: print 'Errorcode:', self.errorcode print print 'Product information:' for key in self.product.keys(): print ' ', key.encode('UTF-8'), print '->', self.product[key].encode('UTF-8') print print 'Datab...
[ "def", "doShow", "(", "self", ",", "xml", "=", "0", ")", ":", "if", "xml", "==", "0", ":", "print", "'Errorcode:'", ",", "self", ".", "errorcode", "print", "print", "'Product information:'", "for", "key", "in", "self", ".", "product", ".", "keys", "(",...
Shows the contents of our resultset.
[ "Shows", "the", "contents", "of", "our", "resultset", "." ]
ef269b52a97e329d91da3c4851ddac800d7fd7e6
https://github.com/aeguana/PyFileMaker/blob/ef269b52a97e329d91da3c4851ddac800d7fd7e6/PyFileMaker/FMResultset.py#L128-L186
42,565
aeguana/PyFileMaker
PyFileMaker/FMServer.py
FMServer._setSkipRecords
def _setSkipRecords(self, skipRec): """Specifies how many records to skip in the found set""" if type(skipRec) == int or (type(skipRec) == str and skipRec.isdigit()): self._skipRecords = skipRec else: raise FMError, 'Unsupported -skip value (not a number).'
python
def _setSkipRecords(self, skipRec): """Specifies how many records to skip in the found set""" if type(skipRec) == int or (type(skipRec) == str and skipRec.isdigit()): self._skipRecords = skipRec else: raise FMError, 'Unsupported -skip value (not a number).'
[ "def", "_setSkipRecords", "(", "self", ",", "skipRec", ")", ":", "if", "type", "(", "skipRec", ")", "==", "int", "or", "(", "type", "(", "skipRec", ")", "==", "str", "and", "skipRec", ".", "isdigit", "(", ")", ")", ":", "self", ".", "_skipRecords", ...
Specifies how many records to skip in the found set
[ "Specifies", "how", "many", "records", "to", "skip", "in", "the", "found", "set" ]
ef269b52a97e329d91da3c4851ddac800d7fd7e6
https://github.com/aeguana/PyFileMaker/blob/ef269b52a97e329d91da3c4851ddac800d7fd7e6/PyFileMaker/FMServer.py#L111-L117
42,566
aeguana/PyFileMaker
PyFileMaker/FMServer.py
FMServer._setLogicalOperator
def _setLogicalOperator(self, lop): """Sets the way the find fields should be combined together.""" if not lop.lower() in ['and', 'or']: raise FMError, 'Unsupported logical operator (not one of "and" or "or").' self._lop = lop.lower()
python
def _setLogicalOperator(self, lop): """Sets the way the find fields should be combined together.""" if not lop.lower() in ['and', 'or']: raise FMError, 'Unsupported logical operator (not one of "and" or "or").' self._lop = lop.lower()
[ "def", "_setLogicalOperator", "(", "self", ",", "lop", ")", ":", "if", "not", "lop", ".", "lower", "(", ")", "in", "[", "'and'", ",", "'or'", "]", ":", "raise", "FMError", ",", "'Unsupported logical operator (not one of \"and\" or \"or\").'", "self", ".", "_lo...
Sets the way the find fields should be combined together.
[ "Sets", "the", "way", "the", "find", "fields", "should", "be", "combined", "together", "." ]
ef269b52a97e329d91da3c4851ddac800d7fd7e6
https://github.com/aeguana/PyFileMaker/blob/ef269b52a97e329d91da3c4851ddac800d7fd7e6/PyFileMaker/FMServer.py#L119-L125
42,567
aeguana/PyFileMaker
PyFileMaker/FMServer.py
FMServer._setComparasionOperator
def _setComparasionOperator(self, field, oper): """Sets correct operator for given string representation""" if oper != '': validOperators = { 'eq':'eq', 'equals':'eq', '=':'eq', '==':'eq', 'cn':'cn', 'contains':'cn', '%%':'cn', '%':'cn', '*':'cn', 'bw':'bw', 'begins w...
python
def _setComparasionOperator(self, field, oper): """Sets correct operator for given string representation""" if oper != '': validOperators = { 'eq':'eq', 'equals':'eq', '=':'eq', '==':'eq', 'cn':'cn', 'contains':'cn', '%%':'cn', '%':'cn', '*':'cn', 'bw':'bw', 'begins w...
[ "def", "_setComparasionOperator", "(", "self", ",", "field", ",", "oper", ")", ":", "if", "oper", "!=", "''", ":", "validOperators", "=", "{", "'eq'", ":", "'eq'", ",", "'equals'", ":", "'eq'", ",", "'='", ":", "'eq'", ",", "'=='", ":", "'eq'", ",", ...
Sets correct operator for given string representation
[ "Sets", "correct", "operator", "for", "given", "string", "representation" ]
ef269b52a97e329d91da3c4851ddac800d7fd7e6
https://github.com/aeguana/PyFileMaker/blob/ef269b52a97e329d91da3c4851ddac800d7fd7e6/PyFileMaker/FMServer.py#L127-L171
42,568
aeguana/PyFileMaker
PyFileMaker/FMServer.py
FMServer._addDBParam
def _addDBParam(self, name, value): """Adds a database parameter""" if name[-4:] == '__OP': return self._setComparasionOperator(name[:-4], value) if name[-3:] == '.op': return self._setComparasionOperator(name[:-3], value) if name.find('__') != -1: import re name = name.replace('__','::') elif na...
python
def _addDBParam(self, name, value): """Adds a database parameter""" if name[-4:] == '__OP': return self._setComparasionOperator(name[:-4], value) if name[-3:] == '.op': return self._setComparasionOperator(name[:-3], value) if name.find('__') != -1: import re name = name.replace('__','::') elif na...
[ "def", "_addDBParam", "(", "self", ",", "name", ",", "value", ")", ":", "if", "name", "[", "-", "4", ":", "]", "==", "'__OP'", ":", "return", "self", ".", "_setComparasionOperator", "(", "name", "[", ":", "-", "4", "]", ",", "value", ")", "if", "...
Adds a database parameter
[ "Adds", "a", "database", "parameter" ]
ef269b52a97e329d91da3c4851ddac800d7fd7e6
https://github.com/aeguana/PyFileMaker/blob/ef269b52a97e329d91da3c4851ddac800d7fd7e6/PyFileMaker/FMServer.py#L173-L188
42,569
aeguana/PyFileMaker
PyFileMaker/FMServer.py
FMServer.getFile
def getFile(self, file_xml_uri): """ This will execute cmd to fetch file data from FMServer """ find = re.match('/fmi/xml/cnt/([\w\d.-]+)\.([\w]+)?-*', file_xml_uri) file_name = find.group(1) file_extension = find.group(2) file_binary = self._doRequest(is_file=True, file_xml_uri=file_xml_uri) return (file_...
python
def getFile(self, file_xml_uri): """ This will execute cmd to fetch file data from FMServer """ find = re.match('/fmi/xml/cnt/([\w\d.-]+)\.([\w]+)?-*', file_xml_uri) file_name = find.group(1) file_extension = find.group(2) file_binary = self._doRequest(is_file=True, file_xml_uri=file_xml_uri) return (file_...
[ "def", "getFile", "(", "self", ",", "file_xml_uri", ")", ":", "find", "=", "re", ".", "match", "(", "'/fmi/xml/cnt/([\\w\\d.-]+)\\.([\\w]+)?-*'", ",", "file_xml_uri", ")", "file_name", "=", "find", ".", "group", "(", "1", ")", "file_extension", "=", "find", ...
This will execute cmd to fetch file data from FMServer
[ "This", "will", "execute", "cmd", "to", "fetch", "file", "data", "from", "FMServer" ]
ef269b52a97e329d91da3c4851ddac800d7fd7e6
https://github.com/aeguana/PyFileMaker/blob/ef269b52a97e329d91da3c4851ddac800d7fd7e6/PyFileMaker/FMServer.py#L222-L229
42,570
aeguana/PyFileMaker
PyFileMaker/FMServer.py
FMServer.doScript
def doScript(self, script_name, params=None, return_all=False): """This function executes the script for given layout for the current db.""" request = [ uu({'-db': self._db }), uu({'-lay': self._layout }), uu({'-script': script_name}) ] if params: request.append(uu({'-script.param': params })) r...
python
def doScript(self, script_name, params=None, return_all=False): """This function executes the script for given layout for the current db.""" request = [ uu({'-db': self._db }), uu({'-lay': self._layout }), uu({'-script': script_name}) ] if params: request.append(uu({'-script.param': params })) r...
[ "def", "doScript", "(", "self", ",", "script_name", ",", "params", "=", "None", ",", "return_all", "=", "False", ")", ":", "request", "=", "[", "uu", "(", "{", "'-db'", ":", "self", ".", "_db", "}", ")", ",", "uu", "(", "{", "'-lay'", ":", "self"...
This function executes the script for given layout for the current db.
[ "This", "function", "executes", "the", "script", "for", "given", "layout", "for", "the", "current", "db", "." ]
ef269b52a97e329d91da3c4851ddac800d7fd7e6
https://github.com/aeguana/PyFileMaker/blob/ef269b52a97e329d91da3c4851ddac800d7fd7e6/PyFileMaker/FMServer.py#L231-L253
42,571
aeguana/PyFileMaker
PyFileMaker/FMServer.py
FMServer.doScriptAfter
def doScriptAfter(self, func, func_kwargs={}, script_name='', params=None): """ This function will execute extra script after passed function """ request = [ uu({'-script': script_name}) ] if params: request.append(uu({'-script.param': params })) self._extra_script = request return func(**func_kwar...
python
def doScriptAfter(self, func, func_kwargs={}, script_name='', params=None): """ This function will execute extra script after passed function """ request = [ uu({'-script': script_name}) ] if params: request.append(uu({'-script.param': params })) self._extra_script = request return func(**func_kwar...
[ "def", "doScriptAfter", "(", "self", ",", "func", ",", "func_kwargs", "=", "{", "}", ",", "script_name", "=", "''", ",", "params", "=", "None", ")", ":", "request", "=", "[", "uu", "(", "{", "'-script'", ":", "script_name", "}", ")", "]", "if", "pa...
This function will execute extra script after passed function
[ "This", "function", "will", "execute", "extra", "script", "after", "passed", "function" ]
ef269b52a97e329d91da3c4851ddac800d7fd7e6
https://github.com/aeguana/PyFileMaker/blob/ef269b52a97e329d91da3c4851ddac800d7fd7e6/PyFileMaker/FMServer.py#L255-L266
42,572
aeguana/PyFileMaker
PyFileMaker/FMServer.py
FMServer.getDbNames
def getDbNames(self): """This function returns the list of open databases""" request = [] request.append(uu({'-dbnames': '' })) result = self._doRequest(request) result = FMResultset.FMResultset(result) dbNames = [] for dbName in result.resultset: dbNames.append(string.lower(dbName['DATABASE_NAME'])...
python
def getDbNames(self): """This function returns the list of open databases""" request = [] request.append(uu({'-dbnames': '' })) result = self._doRequest(request) result = FMResultset.FMResultset(result) dbNames = [] for dbName in result.resultset: dbNames.append(string.lower(dbName['DATABASE_NAME'])...
[ "def", "getDbNames", "(", "self", ")", ":", "request", "=", "[", "]", "request", ".", "append", "(", "uu", "(", "{", "'-dbnames'", ":", "''", "}", ")", ")", "result", "=", "self", ".", "_doRequest", "(", "request", ")", "result", "=", "FMResultset", ...
This function returns the list of open databases
[ "This", "function", "returns", "the", "list", "of", "open", "databases" ]
ef269b52a97e329d91da3c4851ddac800d7fd7e6
https://github.com/aeguana/PyFileMaker/blob/ef269b52a97e329d91da3c4851ddac800d7fd7e6/PyFileMaker/FMServer.py#L346-L359
42,573
aeguana/PyFileMaker
PyFileMaker/FMServer.py
FMServer.doFind
def doFind(self, WHAT={}, SORT=[], SKIP=None, MAX=None, LOP='AND', **params): """This function will perform the command -find.""" self._preFind(WHAT, SORT, SKIP, MAX, LOP) for key in params: self._addDBParam(key, params[key]) try: return self._doAction('-find') except FMServerError as e: if e.args...
python
def doFind(self, WHAT={}, SORT=[], SKIP=None, MAX=None, LOP='AND', **params): """This function will perform the command -find.""" self._preFind(WHAT, SORT, SKIP, MAX, LOP) for key in params: self._addDBParam(key, params[key]) try: return self._doAction('-find') except FMServerError as e: if e.args...
[ "def", "doFind", "(", "self", ",", "WHAT", "=", "{", "}", ",", "SORT", "=", "[", "]", ",", "SKIP", "=", "None", ",", "MAX", "=", "None", ",", "LOP", "=", "'AND'", ",", "*", "*", "params", ")", ":", "self", ".", "_preFind", "(", "WHAT", ",", ...
This function will perform the command -find.
[ "This", "function", "will", "perform", "the", "command", "-", "find", "." ]
ef269b52a97e329d91da3c4851ddac800d7fd7e6
https://github.com/aeguana/PyFileMaker/blob/ef269b52a97e329d91da3c4851ddac800d7fd7e6/PyFileMaker/FMServer.py#L420-L432
42,574
aeguana/PyFileMaker
PyFileMaker/FMServer.py
FMServer.doFindAll
def doFindAll(self, WHAT={}, SORT=[], SKIP=None, MAX=None): """This function will perform the command -findall.""" self._preFind(WHAT, SORT, SKIP, MAX) return self._doAction('-findall')
python
def doFindAll(self, WHAT={}, SORT=[], SKIP=None, MAX=None): """This function will perform the command -findall.""" self._preFind(WHAT, SORT, SKIP, MAX) return self._doAction('-findall')
[ "def", "doFindAll", "(", "self", ",", "WHAT", "=", "{", "}", ",", "SORT", "=", "[", "]", ",", "SKIP", "=", "None", ",", "MAX", "=", "None", ")", ":", "self", ".", "_preFind", "(", "WHAT", ",", "SORT", ",", "SKIP", ",", "MAX", ")", "return", "...
This function will perform the command -findall.
[ "This", "function", "will", "perform", "the", "command", "-", "findall", "." ]
ef269b52a97e329d91da3c4851ddac800d7fd7e6
https://github.com/aeguana/PyFileMaker/blob/ef269b52a97e329d91da3c4851ddac800d7fd7e6/PyFileMaker/FMServer.py#L434-L439
42,575
aeguana/PyFileMaker
PyFileMaker/FMServer.py
FMServer.doFindAny
def doFindAny(self, WHAT={}, SORT=[], SKIP=None, MAX=None, LOP='AND', **params): """This function will perform the command -findany.""" self._preFind(WHAT, SORT, SKIP, MAX, LOP) for key in params: self._addDBParam(key, params[key]) return self._doAction('-findany')
python
def doFindAny(self, WHAT={}, SORT=[], SKIP=None, MAX=None, LOP='AND', **params): """This function will perform the command -findany.""" self._preFind(WHAT, SORT, SKIP, MAX, LOP) for key in params: self._addDBParam(key, params[key]) return self._doAction('-findany')
[ "def", "doFindAny", "(", "self", ",", "WHAT", "=", "{", "}", ",", "SORT", "=", "[", "]", ",", "SKIP", "=", "None", ",", "MAX", "=", "None", ",", "LOP", "=", "'AND'", ",", "*", "*", "params", ")", ":", "self", ".", "_preFind", "(", "WHAT", ","...
This function will perform the command -findany.
[ "This", "function", "will", "perform", "the", "command", "-", "findany", "." ]
ef269b52a97e329d91da3c4851ddac800d7fd7e6
https://github.com/aeguana/PyFileMaker/blob/ef269b52a97e329d91da3c4851ddac800d7fd7e6/PyFileMaker/FMServer.py#L441-L449
42,576
aeguana/PyFileMaker
PyFileMaker/FMServer.py
FMServer.doDelete
def doDelete(self, WHAT={}): """This function will perform the command -delete.""" if hasattr(WHAT, '_modified'): self._addDBParam('RECORDID', WHAT.RECORDID) self._addDBParam('MODID', WHAT.MODID) elif type(WHAT) == dict and WHAT.has_key('RECORDID'): self._addDBParam('RECORDID', WHAT['RECORDID']) else:...
python
def doDelete(self, WHAT={}): """This function will perform the command -delete.""" if hasattr(WHAT, '_modified'): self._addDBParam('RECORDID', WHAT.RECORDID) self._addDBParam('MODID', WHAT.MODID) elif type(WHAT) == dict and WHAT.has_key('RECORDID'): self._addDBParam('RECORDID', WHAT['RECORDID']) else:...
[ "def", "doDelete", "(", "self", ",", "WHAT", "=", "{", "}", ")", ":", "if", "hasattr", "(", "WHAT", ",", "'_modified'", ")", ":", "self", ".", "_addDBParam", "(", "'RECORDID'", ",", "WHAT", ".", "RECORDID", ")", "self", ".", "_addDBParam", "(", "'MOD...
This function will perform the command -delete.
[ "This", "function", "will", "perform", "the", "command", "-", "delete", "." ]
ef269b52a97e329d91da3c4851ddac800d7fd7e6
https://github.com/aeguana/PyFileMaker/blob/ef269b52a97e329d91da3c4851ddac800d7fd7e6/PyFileMaker/FMServer.py#L451-L468
42,577
aeguana/PyFileMaker
PyFileMaker/FMServer.py
FMServer.doNew
def doNew(self, WHAT={}, **params): """This function will perform the command -new.""" if hasattr(WHAT, '_modified'): for key in WHAT: if key not in ['RECORDID','MODID']: if WHAT.__new2old__.has_key(key): self._addDBParam(WHAT.__new2old__[key].encode('utf-8'), WHAT[key]) else: self._ad...
python
def doNew(self, WHAT={}, **params): """This function will perform the command -new.""" if hasattr(WHAT, '_modified'): for key in WHAT: if key not in ['RECORDID','MODID']: if WHAT.__new2old__.has_key(key): self._addDBParam(WHAT.__new2old__[key].encode('utf-8'), WHAT[key]) else: self._ad...
[ "def", "doNew", "(", "self", ",", "WHAT", "=", "{", "}", ",", "*", "*", "params", ")", ":", "if", "hasattr", "(", "WHAT", ",", "'_modified'", ")", ":", "for", "key", "in", "WHAT", ":", "if", "key", "not", "in", "[", "'RECORDID'", ",", "'MODID'", ...
This function will perform the command -new.
[ "This", "function", "will", "perform", "the", "command", "-", "new", "." ]
ef269b52a97e329d91da3c4851ddac800d7fd7e6
https://github.com/aeguana/PyFileMaker/blob/ef269b52a97e329d91da3c4851ddac800d7fd7e6/PyFileMaker/FMServer.py#L501-L526
42,578
aeguana/PyFileMaker
PyFileMaker/FMServer.py
FMServer.doDup
def doDup(self, WHAT={}, **params): """This function will perform the command -dup.""" if hasattr(WHAT, '_modified'): for key, value in WHAT._modified(): if WHAT.__new2old__.has_key(key): self._addDBParam(WHAT.__new2old__[key].encode('utf-8'), value) else: self._addDBParam(key, value) self....
python
def doDup(self, WHAT={}, **params): """This function will perform the command -dup.""" if hasattr(WHAT, '_modified'): for key, value in WHAT._modified(): if WHAT.__new2old__.has_key(key): self._addDBParam(WHAT.__new2old__[key].encode('utf-8'), value) else: self._addDBParam(key, value) self....
[ "def", "doDup", "(", "self", ",", "WHAT", "=", "{", "}", ",", "*", "*", "params", ")", ":", "if", "hasattr", "(", "WHAT", ",", "'_modified'", ")", ":", "for", "key", ",", "value", "in", "WHAT", ".", "_modified", "(", ")", ":", "if", "WHAT", "."...
This function will perform the command -dup.
[ "This", "function", "will", "perform", "the", "command", "-", "dup", "." ]
ef269b52a97e329d91da3c4851ddac800d7fd7e6
https://github.com/aeguana/PyFileMaker/blob/ef269b52a97e329d91da3c4851ddac800d7fd7e6/PyFileMaker/FMServer.py#L536-L562
42,579
aeguana/PyFileMaker
PyFileMaker/FMServer.py
FMServer._buildUrl
def _buildUrl(self): """Builds url for normal FM requests.""" return '%(protocol)s://%(host)s:%(port)s%(address)s'%{ 'protocol': self._protocol, 'host': self._host, 'port': self._port, 'address': self._address, }
python
def _buildUrl(self): """Builds url for normal FM requests.""" return '%(protocol)s://%(host)s:%(port)s%(address)s'%{ 'protocol': self._protocol, 'host': self._host, 'port': self._port, 'address': self._address, }
[ "def", "_buildUrl", "(", "self", ")", ":", "return", "'%(protocol)s://%(host)s:%(port)s%(address)s'", "%", "{", "'protocol'", ":", "self", ".", "_protocol", ",", "'host'", ":", "self", ".", "_host", ",", "'port'", ":", "self", ".", "_port", ",", "'address'", ...
Builds url for normal FM requests.
[ "Builds", "url", "for", "normal", "FM", "requests", "." ]
ef269b52a97e329d91da3c4851ddac800d7fd7e6
https://github.com/aeguana/PyFileMaker/blob/ef269b52a97e329d91da3c4851ddac800d7fd7e6/PyFileMaker/FMServer.py#L646-L653
42,580
aeguana/PyFileMaker
PyFileMaker/FMServer.py
FMServer._buildFileUrl
def _buildFileUrl(self, xml_req): """Builds url for fetching the files from FM.""" return '%(protocol)s://%(host)s:%(port)s%(xml_req)s'%{ 'protocol': self._protocol, 'host': self._host, 'port': self._port, 'xml_req': xml_req, }
python
def _buildFileUrl(self, xml_req): """Builds url for fetching the files from FM.""" return '%(protocol)s://%(host)s:%(port)s%(xml_req)s'%{ 'protocol': self._protocol, 'host': self._host, 'port': self._port, 'xml_req': xml_req, }
[ "def", "_buildFileUrl", "(", "self", ",", "xml_req", ")", ":", "return", "'%(protocol)s://%(host)s:%(port)s%(xml_req)s'", "%", "{", "'protocol'", ":", "self", ".", "_protocol", ",", "'host'", ":", "self", ".", "_host", ",", "'port'", ":", "self", ".", "_port",...
Builds url for fetching the files from FM.
[ "Builds", "url", "for", "fetching", "the", "files", "from", "FM", "." ]
ef269b52a97e329d91da3c4851ddac800d7fd7e6
https://github.com/aeguana/PyFileMaker/blob/ef269b52a97e329d91da3c4851ddac800d7fd7e6/PyFileMaker/FMServer.py#L655-L662
42,581
aeguana/PyFileMaker
PyFileMaker/FMServer.py
FMServer._doRequest
def _doRequest(self, request=None, is_file=False, file_xml_uri=''): """This function will perform the specified request on the FileMaker server, and it will return the raw result from FileMaker.""" if request is None: request = [] if is_file and file_xml_uri: url = self._buildFileUrl(file_xml_uri) else...
python
def _doRequest(self, request=None, is_file=False, file_xml_uri=''): """This function will perform the specified request on the FileMaker server, and it will return the raw result from FileMaker.""" if request is None: request = [] if is_file and file_xml_uri: url = self._buildFileUrl(file_xml_uri) else...
[ "def", "_doRequest", "(", "self", ",", "request", "=", "None", ",", "is_file", "=", "False", ",", "file_xml_uri", "=", "''", ")", ":", "if", "request", "is", "None", ":", "request", "=", "[", "]", "if", "is_file", "and", "file_xml_uri", ":", "url", "...
This function will perform the specified request on the FileMaker server, and it will return the raw result from FileMaker.
[ "This", "function", "will", "perform", "the", "specified", "request", "on", "the", "FileMaker", "server", "and", "it", "will", "return", "the", "raw", "result", "from", "FileMaker", "." ]
ef269b52a97e329d91da3c4851ddac800d7fd7e6
https://github.com/aeguana/PyFileMaker/blob/ef269b52a97e329d91da3c4851ddac800d7fd7e6/PyFileMaker/FMServer.py#L664-L685
42,582
aeguana/PyFileMaker
PyFileMaker/FMError.py
FMErrorByNum
def FMErrorByNum( num ): """This function raises an error based on the specified error code.""" if not num in FMErrorNum.keys(): raise FMServerError, (num, FMErrorNum[-1]) elif num == 102: raise FMFieldError, (num, FMErrorNum[num]) else: raise FMServerError, (num, FMErrorNum[num...
python
def FMErrorByNum( num ): """This function raises an error based on the specified error code.""" if not num in FMErrorNum.keys(): raise FMServerError, (num, FMErrorNum[-1]) elif num == 102: raise FMFieldError, (num, FMErrorNum[num]) else: raise FMServerError, (num, FMErrorNum[num...
[ "def", "FMErrorByNum", "(", "num", ")", ":", "if", "not", "num", "in", "FMErrorNum", ".", "keys", "(", ")", ":", "raise", "FMServerError", ",", "(", "num", ",", "FMErrorNum", "[", "-", "1", "]", ")", "elif", "num", "==", "102", ":", "raise", "FMFie...
This function raises an error based on the specified error code.
[ "This", "function", "raises", "an", "error", "based", "on", "the", "specified", "error", "code", "." ]
ef269b52a97e329d91da3c4851ddac800d7fd7e6
https://github.com/aeguana/PyFileMaker/blob/ef269b52a97e329d91da3c4851ddac800d7fd7e6/PyFileMaker/FMError.py#L295-L303
42,583
aeguana/PyFileMaker
PyFileMaker/FMXML.py
FMXML.doParseXMLData
def doParseXMLData( self ): """This function parses the XML output of FileMaker.""" parser = xml2obj.Xml2Obj() # Not valid document comming from FMServer if self.data[-6:] == '</COL>': self.data += '</ROW></RESULTSET></FMPXMLRESULT>' xobj = parser.ParseString( self.data ) try: el = xobj.getElemen...
python
def doParseXMLData( self ): """This function parses the XML output of FileMaker.""" parser = xml2obj.Xml2Obj() # Not valid document comming from FMServer if self.data[-6:] == '</COL>': self.data += '</ROW></RESULTSET></FMPXMLRESULT>' xobj = parser.ParseString( self.data ) try: el = xobj.getElemen...
[ "def", "doParseXMLData", "(", "self", ")", ":", "parser", "=", "xml2obj", ".", "Xml2Obj", "(", ")", "# Not valid document comming from FMServer", "if", "self", ".", "data", "[", "-", "6", ":", "]", "==", "'</COL>'", ":", "self", ".", "data", "+=", "'</ROW>...
This function parses the XML output of FileMaker.
[ "This", "function", "parses", "the", "XML", "output", "of", "FileMaker", "." ]
ef269b52a97e329d91da3c4851ddac800d7fd7e6
https://github.com/aeguana/PyFileMaker/blob/ef269b52a97e329d91da3c4851ddac800d7fd7e6/PyFileMaker/FMXML.py#L22-L44
42,584
googleapis/gax-python
google/gax/utils/metrics.py
fill
def fill(metrics_headers=()): """Add the metrics headers known to GAX. Return an OrderedDict with all of the metrics headers provided to this function, as well as the metrics known to GAX (such as its own version, the GRPC version, etc.). """ # Create an ordered dictionary with the Python versi...
python
def fill(metrics_headers=()): """Add the metrics headers known to GAX. Return an OrderedDict with all of the metrics headers provided to this function, as well as the metrics known to GAX (such as its own version, the GRPC version, etc.). """ # Create an ordered dictionary with the Python versi...
[ "def", "fill", "(", "metrics_headers", "=", "(", ")", ")", ":", "# Create an ordered dictionary with the Python version, which", "# should go first.", "answer", "=", "collections", ".", "OrderedDict", "(", "(", "(", "'gl-python'", ",", "platform", ".", "python_version",...
Add the metrics headers known to GAX. Return an OrderedDict with all of the metrics headers provided to this function, as well as the metrics known to GAX (such as its own version, the GRPC version, etc.).
[ "Add", "the", "metrics", "headers", "known", "to", "GAX", "." ]
309aedfcfd48e4c8fa22dd60e9c84c3cc71bb20e
https://github.com/googleapis/gax-python/blob/309aedfcfd48e4c8fa22dd60e9c84c3cc71bb20e/google/gax/utils/metrics.py#L42-L68
42,585
googleapis/gax-python
google/gax/utils/metrics.py
stringify
def stringify(metrics_headers=()): """Convert the provided metrics headers to a string. Iterate over the metrics headers (a dictionary, usually ordered) and return a properly-formatted space-separated string (e.g. foo/1.2.3 bar/3.14.159). """ metrics_headers = collections.OrderedDict(metrics_he...
python
def stringify(metrics_headers=()): """Convert the provided metrics headers to a string. Iterate over the metrics headers (a dictionary, usually ordered) and return a properly-formatted space-separated string (e.g. foo/1.2.3 bar/3.14.159). """ metrics_headers = collections.OrderedDict(metrics_he...
[ "def", "stringify", "(", "metrics_headers", "=", "(", ")", ")", ":", "metrics_headers", "=", "collections", ".", "OrderedDict", "(", "metrics_headers", ")", "return", "' '", ".", "join", "(", "[", "'%s/%s'", "%", "(", "k", ",", "v", ")", "for", "k", ",...
Convert the provided metrics headers to a string. Iterate over the metrics headers (a dictionary, usually ordered) and return a properly-formatted space-separated string (e.g. foo/1.2.3 bar/3.14.159).
[ "Convert", "the", "provided", "metrics", "headers", "to", "a", "string", "." ]
309aedfcfd48e4c8fa22dd60e9c84c3cc71bb20e
https://github.com/googleapis/gax-python/blob/309aedfcfd48e4c8fa22dd60e9c84c3cc71bb20e/google/gax/utils/metrics.py#L71-L79
42,586
googleapis/gax-python
google/gax/bundling.py
_str_dotted_getattr
def _str_dotted_getattr(obj, name): """Expands extends getattr to allow dots in x to indicate nested objects. Args: obj (object): an object. name (str): a name for a field in the object. Returns: Any: the value of named attribute. Raises: AttributeError: if the named attri...
python
def _str_dotted_getattr(obj, name): """Expands extends getattr to allow dots in x to indicate nested objects. Args: obj (object): an object. name (str): a name for a field in the object. Returns: Any: the value of named attribute. Raises: AttributeError: if the named attri...
[ "def", "_str_dotted_getattr", "(", "obj", ",", "name", ")", ":", "for", "part", "in", "name", ".", "split", "(", "'.'", ")", ":", "obj", "=", "getattr", "(", "obj", ",", "part", ")", "return", "str", "(", "obj", ")", "if", "obj", "else", "None" ]
Expands extends getattr to allow dots in x to indicate nested objects. Args: obj (object): an object. name (str): a name for a field in the object. Returns: Any: the value of named attribute. Raises: AttributeError: if the named attribute does not exist.
[ "Expands", "extends", "getattr", "to", "allow", "dots", "in", "x", "to", "indicate", "nested", "objects", "." ]
309aedfcfd48e4c8fa22dd60e9c84c3cc71bb20e
https://github.com/googleapis/gax-python/blob/309aedfcfd48e4c8fa22dd60e9c84c3cc71bb20e/google/gax/bundling.py#L57-L72
42,587
googleapis/gax-python
google/gax/bundling.py
Task.request_bytesize
def request_bytesize(self): """The size of in bytes of the bundled field elements.""" return sum(len(str(e)) for elts in self._in_deque for e in elts)
python
def request_bytesize(self): """The size of in bytes of the bundled field elements.""" return sum(len(str(e)) for elts in self._in_deque for e in elts)
[ "def", "request_bytesize", "(", "self", ")", ":", "return", "sum", "(", "len", "(", "str", "(", "e", ")", ")", "for", "elts", "in", "self", ".", "_in_deque", "for", "e", "in", "elts", ")" ]
The size of in bytes of the bundled field elements.
[ "The", "size", "of", "in", "bytes", "of", "the", "bundled", "field", "elements", "." ]
309aedfcfd48e4c8fa22dd60e9c84c3cc71bb20e
https://github.com/googleapis/gax-python/blob/309aedfcfd48e4c8fa22dd60e9c84c3cc71bb20e/google/gax/bundling.py#L141-L143
42,588
googleapis/gax-python
google/gax/bundling.py
Task.run
def run(self): """Call the task's func. The task's func will be called with the bundling requests func """ if not self._in_deque: return req = self._bundling_request del getattr(req, self.bundled_field)[:] getattr(req, self.bundled_field).extend( ...
python
def run(self): """Call the task's func. The task's func will be called with the bundling requests func """ if not self._in_deque: return req = self._bundling_request del getattr(req, self.bundled_field)[:] getattr(req, self.bundled_field).extend( ...
[ "def", "run", "(", "self", ")", ":", "if", "not", "self", ".", "_in_deque", ":", "return", "req", "=", "self", ".", "_bundling_request", "del", "getattr", "(", "req", ",", "self", ".", "bundled_field", ")", "[", ":", "]", "getattr", "(", "req", ",", ...
Call the task's func. The task's func will be called with the bundling requests func
[ "Call", "the", "task", "s", "func", "." ]
309aedfcfd48e4c8fa22dd60e9c84c3cc71bb20e
https://github.com/googleapis/gax-python/blob/309aedfcfd48e4c8fa22dd60e9c84c3cc71bb20e/google/gax/bundling.py#L145-L161
42,589
googleapis/gax-python
google/gax/bundling.py
Task.extend
def extend(self, elts): """Adds elts to the tasks. Args: elts (Sequence): a iterable of elements that can be appended to the task's bundle_field. Returns: Event: an event that can be used to wait on the response. """ # Use a copy, not a refere...
python
def extend(self, elts): """Adds elts to the tasks. Args: elts (Sequence): a iterable of elements that can be appended to the task's bundle_field. Returns: Event: an event that can be used to wait on the response. """ # Use a copy, not a refere...
[ "def", "extend", "(", "self", ",", "elts", ")", ":", "# Use a copy, not a reference, as it is later necessary to mutate", "# the proto field from which elts are drawn in order to construct", "# the bundled request.", "elts", "=", "elts", "[", ":", "]", "self", ".", "_in_deque",...
Adds elts to the tasks. Args: elts (Sequence): a iterable of elements that can be appended to the task's bundle_field. Returns: Event: an event that can be used to wait on the response.
[ "Adds", "elts", "to", "the", "tasks", "." ]
309aedfcfd48e4c8fa22dd60e9c84c3cc71bb20e
https://github.com/googleapis/gax-python/blob/309aedfcfd48e4c8fa22dd60e9c84c3cc71bb20e/google/gax/bundling.py#L206-L223
42,590
googleapis/gax-python
google/gax/bundling.py
Task._event_for
def _event_for(self, elts): """Creates an Event that is set when the bundle with elts is sent.""" event = Event() event.canceller = self._canceller_for(elts, event) return event
python
def _event_for(self, elts): """Creates an Event that is set when the bundle with elts is sent.""" event = Event() event.canceller = self._canceller_for(elts, event) return event
[ "def", "_event_for", "(", "self", ",", "elts", ")", ":", "event", "=", "Event", "(", ")", "event", ".", "canceller", "=", "self", ".", "_canceller_for", "(", "elts", ",", "event", ")", "return", "event" ]
Creates an Event that is set when the bundle with elts is sent.
[ "Creates", "an", "Event", "that", "is", "set", "when", "the", "bundle", "with", "elts", "is", "sent", "." ]
309aedfcfd48e4c8fa22dd60e9c84c3cc71bb20e
https://github.com/googleapis/gax-python/blob/309aedfcfd48e4c8fa22dd60e9c84c3cc71bb20e/google/gax/bundling.py#L225-L229
42,591
googleapis/gax-python
google/gax/bundling.py
Task._canceller_for
def _canceller_for(self, elts, event): """Obtains a cancellation function that removes elts. The returned cancellation function returns ``True`` if all elements was removed successfully from the _in_deque, and false if it was not. """ def canceller(): """Cancels subm...
python
def _canceller_for(self, elts, event): """Obtains a cancellation function that removes elts. The returned cancellation function returns ``True`` if all elements was removed successfully from the _in_deque, and false if it was not. """ def canceller(): """Cancels subm...
[ "def", "_canceller_for", "(", "self", ",", "elts", ",", "event", ")", ":", "def", "canceller", "(", ")", ":", "\"\"\"Cancels submission of ``elts`` as part of this bundle.\n\n Returns:\n bool: ``False`` if any of elements had already been sent,\n ...
Obtains a cancellation function that removes elts. The returned cancellation function returns ``True`` if all elements was removed successfully from the _in_deque, and false if it was not.
[ "Obtains", "a", "cancellation", "function", "that", "removes", "elts", "." ]
309aedfcfd48e4c8fa22dd60e9c84c3cc71bb20e
https://github.com/googleapis/gax-python/blob/309aedfcfd48e4c8fa22dd60e9c84c3cc71bb20e/google/gax/bundling.py#L231-L251
42,592
googleapis/gax-python
google/gax/bundling.py
Executor.schedule
def schedule(self, api_call, bundle_id, bundle_desc, bundling_request, kwargs=None): """Schedules bundle_desc of bundling_request as part of bundle_id. The returned value an :class:`Event` that * has a ``result`` attribute that will eventually be set to the result th...
python
def schedule(self, api_call, bundle_id, bundle_desc, bundling_request, kwargs=None): """Schedules bundle_desc of bundling_request as part of bundle_id. The returned value an :class:`Event` that * has a ``result`` attribute that will eventually be set to the result th...
[ "def", "schedule", "(", "self", ",", "api_call", ",", "bundle_id", ",", "bundle_desc", ",", "bundling_request", ",", "kwargs", "=", "None", ")", ":", "kwargs", "=", "kwargs", "or", "dict", "(", ")", "bundle", "=", "self", ".", "_bundle_for", "(", "api_ca...
Schedules bundle_desc of bundling_request as part of bundle_id. The returned value an :class:`Event` that * has a ``result`` attribute that will eventually be set to the result the api call * will be used to wait for the response * holds the canceller function for canceling t...
[ "Schedules", "bundle_desc", "of", "bundling_request", "as", "part", "of", "bundle_id", "." ]
309aedfcfd48e4c8fa22dd60e9c84c3cc71bb20e
https://github.com/googleapis/gax-python/blob/309aedfcfd48e4c8fa22dd60e9c84c3cc71bb20e/google/gax/bundling.py#L277-L317
42,593
googleapis/gax-python
google/gax/grpc.py
create_stub
def create_stub(generated_create_stub, channel=None, service_path=None, service_port=None, credentials=None, scopes=None, ssl_credentials=None): """Creates a gRPC client stub. Args: generated_create_stub (Callable): The generated gRPC method to create a stub....
python
def create_stub(generated_create_stub, channel=None, service_path=None, service_port=None, credentials=None, scopes=None, ssl_credentials=None): """Creates a gRPC client stub. Args: generated_create_stub (Callable): The generated gRPC method to create a stub....
[ "def", "create_stub", "(", "generated_create_stub", ",", "channel", "=", "None", ",", "service_path", "=", "None", ",", "service_port", "=", "None", ",", "credentials", "=", "None", ",", "scopes", "=", "None", ",", "ssl_credentials", "=", "None", ")", ":", ...
Creates a gRPC client stub. Args: generated_create_stub (Callable): The generated gRPC method to create a stub. channel (grpc.Channel): A Channel object through which to make calls. If None, a secure channel is constructed. If specified, all remaining arguments a...
[ "Creates", "a", "gRPC", "client", "stub", "." ]
309aedfcfd48e4c8fa22dd60e9c84c3cc71bb20e
https://github.com/googleapis/gax-python/blob/309aedfcfd48e4c8fa22dd60e9c84c3cc71bb20e/google/gax/grpc.py#L77-L111
42,594
googleapis/gax-python
google/gax/_grpc_google_auth.py
get_default_credentials
def get_default_credentials(scopes): """Gets the Application Default Credentials.""" credentials, _ = google.auth.default(scopes=scopes) return credentials
python
def get_default_credentials(scopes): """Gets the Application Default Credentials.""" credentials, _ = google.auth.default(scopes=scopes) return credentials
[ "def", "get_default_credentials", "(", "scopes", ")", ":", "credentials", ",", "_", "=", "google", ".", "auth", ".", "default", "(", "scopes", "=", "scopes", ")", "return", "credentials" ]
Gets the Application Default Credentials.
[ "Gets", "the", "Application", "Default", "Credentials", "." ]
309aedfcfd48e4c8fa22dd60e9c84c3cc71bb20e
https://github.com/googleapis/gax-python/blob/309aedfcfd48e4c8fa22dd60e9c84c3cc71bb20e/google/gax/_grpc_google_auth.py#L60-L63
42,595
googleapis/gax-python
google/gax/retry.py
add_timeout_arg
def add_timeout_arg(a_func, timeout, **kwargs): """Updates a_func so that it gets called with the timeout as its final arg. This converts a callable, a_func, into another callable with an additional positional arg. Args: a_func (callable): a callable to be updated timeout (int): to be adde...
python
def add_timeout_arg(a_func, timeout, **kwargs): """Updates a_func so that it gets called with the timeout as its final arg. This converts a callable, a_func, into another callable with an additional positional arg. Args: a_func (callable): a callable to be updated timeout (int): to be adde...
[ "def", "add_timeout_arg", "(", "a_func", ",", "timeout", ",", "*", "*", "kwargs", ")", ":", "def", "inner", "(", "*", "args", ")", ":", "\"\"\"Updates args with the timeout.\"\"\"", "updated_args", "=", "args", "+", "(", "timeout", ",", ")", "return", "a_fun...
Updates a_func so that it gets called with the timeout as its final arg. This converts a callable, a_func, into another callable with an additional positional arg. Args: a_func (callable): a callable to be updated timeout (int): to be added to the original callable as it final positional ...
[ "Updates", "a_func", "so", "that", "it", "gets", "called", "with", "the", "timeout", "as", "its", "final", "arg", "." ]
309aedfcfd48e4c8fa22dd60e9c84c3cc71bb20e
https://github.com/googleapis/gax-python/blob/309aedfcfd48e4c8fa22dd60e9c84c3cc71bb20e/google/gax/retry.py#L49-L70
42,596
googleapis/gax-python
google/gax/retry.py
retryable
def retryable(a_func, retry_options, **kwargs): """Creates a function equivalent to a_func, but that retries on certain exceptions. Args: a_func (callable): A callable. retry_options (RetryOptions): Configures the exceptions upon which the callable should retry, and the parameters to th...
python
def retryable(a_func, retry_options, **kwargs): """Creates a function equivalent to a_func, but that retries on certain exceptions. Args: a_func (callable): A callable. retry_options (RetryOptions): Configures the exceptions upon which the callable should retry, and the parameters to th...
[ "def", "retryable", "(", "a_func", ",", "retry_options", ",", "*", "*", "kwargs", ")", ":", "delay_mult", "=", "retry_options", ".", "backoff_settings", ".", "retry_delay_multiplier", "max_delay_millis", "=", "retry_options", ".", "backoff_settings", ".", "max_retry...
Creates a function equivalent to a_func, but that retries on certain exceptions. Args: a_func (callable): A callable. retry_options (RetryOptions): Configures the exceptions upon which the callable should retry, and the parameters to the exponential backoff retry algorithm. kw...
[ "Creates", "a", "function", "equivalent", "to", "a_func", "but", "that", "retries", "on", "certain", "exceptions", "." ]
309aedfcfd48e4c8fa22dd60e9c84c3cc71bb20e
https://github.com/googleapis/gax-python/blob/309aedfcfd48e4c8fa22dd60e9c84c3cc71bb20e/google/gax/retry.py#L73-L145
42,597
googleapis/gax-python
google/gax/errors.py
create_error
def create_error(msg, cause=None): """Creates a ``GaxError`` or subclass. Attributes: msg (string): describes the error that occurred. cause (Exception, optional): the exception raised by a lower layer of the RPC stack (for example, gRPC) that caused this exception, or N...
python
def create_error(msg, cause=None): """Creates a ``GaxError`` or subclass. Attributes: msg (string): describes the error that occurred. cause (Exception, optional): the exception raised by a lower layer of the RPC stack (for example, gRPC) that caused this exception, or N...
[ "def", "create_error", "(", "msg", ",", "cause", "=", "None", ")", ":", "status_code", "=", "config", ".", "exc_to_code", "(", "cause", ")", "status_name", "=", "config", ".", "NAME_STATUS_CODES", ".", "get", "(", "status_code", ")", "if", "status_name", "...
Creates a ``GaxError`` or subclass. Attributes: msg (string): describes the error that occurred. cause (Exception, optional): the exception raised by a lower layer of the RPC stack (for example, gRPC) that caused this exception, or None if this exception originated in GAX. ...
[ "Creates", "a", "GaxError", "or", "subclass", "." ]
309aedfcfd48e4c8fa22dd60e9c84c3cc71bb20e
https://github.com/googleapis/gax-python/blob/309aedfcfd48e4c8fa22dd60e9c84c3cc71bb20e/google/gax/errors.py#L73-L90
42,598
googleapis/gax-python
google/gapic/longrunning/operations_client.py
OperationsClient.get_operation
def get_operation(self, name, options=None): """ Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service. Example: >>> from google.gapic.longrunning import operations_cl...
python
def get_operation(self, name, options=None): """ Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service. Example: >>> from google.gapic.longrunning import operations_cl...
[ "def", "get_operation", "(", "self", ",", "name", ",", "options", "=", "None", ")", ":", "# Create the request object.", "request", "=", "operations_pb2", ".", "GetOperationRequest", "(", "name", "=", "name", ")", "return", "self", ".", "_get_operation", "(", ...
Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service. Example: >>> from google.gapic.longrunning import operations_client >>> api = operations_client.OperationsClient() ...
[ "Gets", "the", "latest", "state", "of", "a", "long", "-", "running", "operation", ".", "Clients", "can", "use", "this", "method", "to", "poll", "the", "operation", "result", "at", "intervals", "as", "recommended", "by", "the", "API", "service", "." ]
309aedfcfd48e4c8fa22dd60e9c84c3cc71bb20e
https://github.com/googleapis/gax-python/blob/309aedfcfd48e4c8fa22dd60e9c84c3cc71bb20e/google/gapic/longrunning/operations_client.py#L187-L213
42,599
googleapis/gax-python
google/gapic/longrunning/operations_client.py
OperationsClient.cancel_operation
def cancel_operation(self, name, options=None): """ Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns ``google.rpc.Code.UNIMP...
python
def cancel_operation(self, name, options=None): """ Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns ``google.rpc.Code.UNIMP...
[ "def", "cancel_operation", "(", "self", ",", "name", ",", "options", "=", "None", ")", ":", "# Create the request object.", "request", "=", "operations_pb2", ".", "CancelOperationRequest", "(", "name", "=", "name", ")", "self", ".", "_cancel_operation", "(", "re...
Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns ``google.rpc.Code.UNIMPLEMENTED``. Clients can use ``Operations.GetOperation`` or ...
[ "Starts", "asynchronous", "cancellation", "on", "a", "long", "-", "running", "operation", ".", "The", "server", "makes", "a", "best", "effort", "to", "cancel", "the", "operation", "but", "success", "is", "not", "guaranteed", ".", "If", "the", "server", "does...
309aedfcfd48e4c8fa22dd60e9c84c3cc71bb20e
https://github.com/googleapis/gax-python/blob/309aedfcfd48e4c8fa22dd60e9c84c3cc71bb20e/google/gapic/longrunning/operations_client.py#L266-L296