repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
pudo/normality | normality/cleaning.py | collapse_spaces | def collapse_spaces(text):
"""Remove newlines, tabs and multiple spaces with single spaces."""
if not isinstance(text, six.string_types):
return text
return COLLAPSE_RE.sub(WS, text).strip(WS) | python | def collapse_spaces(text):
"""Remove newlines, tabs and multiple spaces with single spaces."""
if not isinstance(text, six.string_types):
return text
return COLLAPSE_RE.sub(WS, text).strip(WS) | [
"def",
"collapse_spaces",
"(",
"text",
")",
":",
"if",
"not",
"isinstance",
"(",
"text",
",",
"six",
".",
"string_types",
")",
":",
"return",
"text",
"return",
"COLLAPSE_RE",
".",
"sub",
"(",
"WS",
",",
"text",
")",
".",
"strip",
"(",
"WS",
")"
] | Remove newlines, tabs and multiple spaces with single spaces. | [
"Remove",
"newlines",
"tabs",
"and",
"multiple",
"spaces",
"with",
"single",
"spaces",
"."
] | b53cc2c6e5c6205573d2010f72d90808710a4b58 | https://github.com/pudo/normality/blob/b53cc2c6e5c6205573d2010f72d90808710a4b58/normality/cleaning.py#L82-L86 | train |
pudo/normality | normality/__init__.py | normalize | def normalize(text, lowercase=True, collapse=True, latinize=False, ascii=False,
encoding_default='utf-8', encoding=None,
replace_categories=UNICODE_CATEGORIES):
"""The main normalization function for text.
This will take a string and apply a set of transformations to it so
that ... | python | def normalize(text, lowercase=True, collapse=True, latinize=False, ascii=False,
encoding_default='utf-8', encoding=None,
replace_categories=UNICODE_CATEGORIES):
"""The main normalization function for text.
This will take a string and apply a set of transformations to it so
that ... | [
"def",
"normalize",
"(",
"text",
",",
"lowercase",
"=",
"True",
",",
"collapse",
"=",
"True",
",",
"latinize",
"=",
"False",
",",
"ascii",
"=",
"False",
",",
"encoding_default",
"=",
"'utf-8'",
",",
"encoding",
"=",
"None",
",",
"replace_categories",
"=",
... | The main normalization function for text.
This will take a string and apply a set of transformations to it so
that it can be processed more easily afterwards. Arguments:
* ``lowercase``: not very mysterious.
* ``collapse``: replace multiple whitespace-like characters with a
single whitespace. Th... | [
"The",
"main",
"normalization",
"function",
"for",
"text",
"."
] | b53cc2c6e5c6205573d2010f72d90808710a4b58 | https://github.com/pudo/normality/blob/b53cc2c6e5c6205573d2010f72d90808710a4b58/normality/__init__.py#L9-L57 | train |
pudo/normality | normality/__init__.py | slugify | def slugify(text, sep='-'):
"""A simple slug generator."""
text = stringify(text)
if text is None:
return None
text = text.replace(sep, WS)
text = normalize(text, ascii=True)
if text is None:
return None
return text.replace(WS, sep) | python | def slugify(text, sep='-'):
"""A simple slug generator."""
text = stringify(text)
if text is None:
return None
text = text.replace(sep, WS)
text = normalize(text, ascii=True)
if text is None:
return None
return text.replace(WS, sep) | [
"def",
"slugify",
"(",
"text",
",",
"sep",
"=",
"'-'",
")",
":",
"text",
"=",
"stringify",
"(",
"text",
")",
"if",
"text",
"is",
"None",
":",
"return",
"None",
"text",
"=",
"text",
".",
"replace",
"(",
"sep",
",",
"WS",
")",
"text",
"=",
"normali... | A simple slug generator. | [
"A",
"simple",
"slug",
"generator",
"."
] | b53cc2c6e5c6205573d2010f72d90808710a4b58 | https://github.com/pudo/normality/blob/b53cc2c6e5c6205573d2010f72d90808710a4b58/normality/__init__.py#L60-L69 | train |
pudo/normality | normality/transliteration.py | latinize_text | def latinize_text(text, ascii=False):
"""Transliterate the given text to the latin script.
This attempts to convert a given text to latin script using the
closest match of characters vis a vis the original script.
"""
if text is None or not isinstance(text, six.string_types) or not len(text):
... | python | def latinize_text(text, ascii=False):
"""Transliterate the given text to the latin script.
This attempts to convert a given text to latin script using the
closest match of characters vis a vis the original script.
"""
if text is None or not isinstance(text, six.string_types) or not len(text):
... | [
"def",
"latinize_text",
"(",
"text",
",",
"ascii",
"=",
"False",
")",
":",
"if",
"text",
"is",
"None",
"or",
"not",
"isinstance",
"(",
"text",
",",
"six",
".",
"string_types",
")",
"or",
"not",
"len",
"(",
"text",
")",
":",
"return",
"text",
"if",
... | Transliterate the given text to the latin script.
This attempts to convert a given text to latin script using the
closest match of characters vis a vis the original script. | [
"Transliterate",
"the",
"given",
"text",
"to",
"the",
"latin",
"script",
"."
] | b53cc2c6e5c6205573d2010f72d90808710a4b58 | https://github.com/pudo/normality/blob/b53cc2c6e5c6205573d2010f72d90808710a4b58/normality/transliteration.py#L18-L36 | train |
pudo/normality | normality/transliteration.py | ascii_text | def ascii_text(text):
"""Transliterate the given text and make sure it ends up as ASCII."""
text = latinize_text(text, ascii=True)
if isinstance(text, six.text_type):
text = text.encode('ascii', 'ignore').decode('ascii')
return text | python | def ascii_text(text):
"""Transliterate the given text and make sure it ends up as ASCII."""
text = latinize_text(text, ascii=True)
if isinstance(text, six.text_type):
text = text.encode('ascii', 'ignore').decode('ascii')
return text | [
"def",
"ascii_text",
"(",
"text",
")",
":",
"text",
"=",
"latinize_text",
"(",
"text",
",",
"ascii",
"=",
"True",
")",
"if",
"isinstance",
"(",
"text",
",",
"six",
".",
"text_type",
")",
":",
"text",
"=",
"text",
".",
"encode",
"(",
"'ascii'",
",",
... | Transliterate the given text and make sure it ends up as ASCII. | [
"Transliterate",
"the",
"given",
"text",
"and",
"make",
"sure",
"it",
"ends",
"up",
"as",
"ASCII",
"."
] | b53cc2c6e5c6205573d2010f72d90808710a4b58 | https://github.com/pudo/normality/blob/b53cc2c6e5c6205573d2010f72d90808710a4b58/normality/transliteration.py#L39-L44 | train |
SolutionsCloud/apidoc | apidoc/object/source_raw.py | Method.message | def message(self):
"""Return default message for this element
"""
if self.code != 200:
for code in self.response_codes:
if code.code == self.code:
return code.message
raise ValueError("Unknown response code \"%s\" in \"%s\"." % (self.c... | python | def message(self):
"""Return default message for this element
"""
if self.code != 200:
for code in self.response_codes:
if code.code == self.code:
return code.message
raise ValueError("Unknown response code \"%s\" in \"%s\"." % (self.c... | [
"def",
"message",
"(",
"self",
")",
":",
"if",
"self",
".",
"code",
"!=",
"200",
":",
"for",
"code",
"in",
"self",
".",
"response_codes",
":",
"if",
"code",
".",
"code",
"==",
"self",
".",
"code",
":",
"return",
"code",
".",
"message",
"raise",
"Va... | Return default message for this element | [
"Return",
"default",
"message",
"for",
"this",
"element"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/object/source_raw.py#L162-L172 | train |
SolutionsCloud/apidoc | apidoc/object/source_raw.py | Parameter.get_default_sample | def get_default_sample(self):
"""Return default value for the element
"""
if self.type not in Object.Types or self.type is Object.Types.type:
return self.type_object.get_sample()
else:
return self.get_object().get_sample() | python | def get_default_sample(self):
"""Return default value for the element
"""
if self.type not in Object.Types or self.type is Object.Types.type:
return self.type_object.get_sample()
else:
return self.get_object().get_sample() | [
"def",
"get_default_sample",
"(",
"self",
")",
":",
"if",
"self",
".",
"type",
"not",
"in",
"Object",
".",
"Types",
"or",
"self",
".",
"type",
"is",
"Object",
".",
"Types",
".",
"type",
":",
"return",
"self",
".",
"type_object",
".",
"get_sample",
"(",... | Return default value for the element | [
"Return",
"default",
"value",
"for",
"the",
"element"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/object/source_raw.py#L216-L222 | train |
SolutionsCloud/apidoc | apidoc/object/source_raw.py | Object.factory | def factory(cls, str_type, version):
"""Return a proper object
"""
type = Object.Types(str_type)
if type is Object.Types.object:
object = ObjectObject()
elif type is Object.Types.array:
object = ObjectArray()
elif type is Object.Types.number:
... | python | def factory(cls, str_type, version):
"""Return a proper object
"""
type = Object.Types(str_type)
if type is Object.Types.object:
object = ObjectObject()
elif type is Object.Types.array:
object = ObjectArray()
elif type is Object.Types.number:
... | [
"def",
"factory",
"(",
"cls",
",",
"str_type",
",",
"version",
")",
":",
"type",
"=",
"Object",
".",
"Types",
"(",
"str_type",
")",
"if",
"type",
"is",
"Object",
".",
"Types",
".",
"object",
":",
"object",
"=",
"ObjectObject",
"(",
")",
"elif",
"type... | Return a proper object | [
"Return",
"a",
"proper",
"object"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/object/source_raw.py#L327-L360 | train |
SolutionsCloud/apidoc | apidoc/command/run.py | main | def main():
"""Main function to run command
"""
configParser = FileParser()
logging.config.dictConfig(
configParser.load_from_file(os.path.join(os.path.dirname(os.path.dirname(__file__)), 'settings', 'logging.yml'))
)
ApiDoc().main() | python | def main():
"""Main function to run command
"""
configParser = FileParser()
logging.config.dictConfig(
configParser.load_from_file(os.path.join(os.path.dirname(os.path.dirname(__file__)), 'settings', 'logging.yml'))
)
ApiDoc().main() | [
"def",
"main",
"(",
")",
":",
"configParser",
"=",
"FileParser",
"(",
")",
"logging",
".",
"config",
".",
"dictConfig",
"(",
"configParser",
".",
"load_from_file",
"(",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
... | Main function to run command | [
"Main",
"function",
"to",
"run",
"command"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/command/run.py#L247-L254 | train |
SolutionsCloud/apidoc | apidoc/command/run.py | ApiDoc._init_config | def _init_config(self):
"""return command's configuration from call's arguments
"""
options = self.parser.parse_args()
if options.config is None and options.input is None:
self.parser.print_help()
sys.exit(2)
if options.config is not None:
con... | python | def _init_config(self):
"""return command's configuration from call's arguments
"""
options = self.parser.parse_args()
if options.config is None and options.input is None:
self.parser.print_help()
sys.exit(2)
if options.config is not None:
con... | [
"def",
"_init_config",
"(",
"self",
")",
":",
"options",
"=",
"self",
".",
"parser",
".",
"parse_args",
"(",
")",
"if",
"options",
".",
"config",
"is",
"None",
"and",
"options",
".",
"input",
"is",
"None",
":",
"self",
".",
"parser",
".",
"print_help",... | return command's configuration from call's arguments | [
"return",
"command",
"s",
"configuration",
"from",
"call",
"s",
"arguments"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/command/run.py#L91-L130 | train |
SolutionsCloud/apidoc | apidoc/command/run.py | ApiDoc.main | def main(self):
"""Run the command
"""
self._init_config()
if self.dry_run:
return self.run_dry_run()
elif self.watch:
return self.run_watch()
else:
return self.run_render() | python | def main(self):
"""Run the command
"""
self._init_config()
if self.dry_run:
return self.run_dry_run()
elif self.watch:
return self.run_watch()
else:
return self.run_render() | [
"def",
"main",
"(",
"self",
")",
":",
"self",
".",
"_init_config",
"(",
")",
"if",
"self",
".",
"dry_run",
":",
"return",
"self",
".",
"run_dry_run",
"(",
")",
"elif",
"self",
".",
"watch",
":",
"return",
"self",
".",
"run_watch",
"(",
")",
"else",
... | Run the command | [
"Run",
"the",
"command"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/command/run.py#L135-L145 | train |
SolutionsCloud/apidoc | apidoc/command/run.py | ApiDoc._watch_refresh_source | def _watch_refresh_source(self, event):
"""Refresh sources then templates
"""
self.logger.info("Sources changed...")
try:
self.sources = self._get_sources()
self._render_template(self.sources)
except:
pass | python | def _watch_refresh_source(self, event):
"""Refresh sources then templates
"""
self.logger.info("Sources changed...")
try:
self.sources = self._get_sources()
self._render_template(self.sources)
except:
pass | [
"def",
"_watch_refresh_source",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"logger",
".",
"info",
"(",
"\"Sources changed...\"",
")",
"try",
":",
"self",
".",
"sources",
"=",
"self",
".",
"_get_sources",
"(",
")",
"self",
".",
"_render_template",
"(... | Refresh sources then templates | [
"Refresh",
"sources",
"then",
"templates"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/command/run.py#L225-L234 | train |
SolutionsCloud/apidoc | apidoc/command/run.py | ApiDoc._watch_refresh_template | def _watch_refresh_template(self, event):
"""Refresh template's contents
"""
self.logger.info("Template changed...")
try:
self._render_template(self.sources)
except:
pass | python | def _watch_refresh_template(self, event):
"""Refresh template's contents
"""
self.logger.info("Template changed...")
try:
self._render_template(self.sources)
except:
pass | [
"def",
"_watch_refresh_template",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"logger",
".",
"info",
"(",
"\"Template changed...\"",
")",
"try",
":",
"self",
".",
"_render_template",
"(",
"self",
".",
"sources",
")",
"except",
":",
"pass"
] | Refresh template's contents | [
"Refresh",
"template",
"s",
"contents"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/command/run.py#L236-L244 | train |
SolutionsCloud/apidoc | apidoc/lib/util/decorator.py | add_property | def add_property(attribute, type):
"""Add a property to a class
"""
def decorator(cls):
"""Decorator
"""
private = "_" + attribute
def getAttr(self):
"""Property getter
"""
if getattr(self, private) is None:
setattr(self, p... | python | def add_property(attribute, type):
"""Add a property to a class
"""
def decorator(cls):
"""Decorator
"""
private = "_" + attribute
def getAttr(self):
"""Property getter
"""
if getattr(self, private) is None:
setattr(self, p... | [
"def",
"add_property",
"(",
"attribute",
",",
"type",
")",
":",
"def",
"decorator",
"(",
"cls",
")",
":",
"\"\"\"Decorator\n \"\"\"",
"private",
"=",
"\"_\"",
"+",
"attribute",
"def",
"getAttr",
"(",
"self",
")",
":",
"\"\"\"Property getter\n \"\... | Add a property to a class | [
"Add",
"a",
"property",
"to",
"a",
"class"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/lib/util/decorator.py#L3-L27 | train |
SolutionsCloud/apidoc | setup_cmd/__init__.py | Resource._merge_files | def _merge_files(self, input_files, output_file):
"""Combine the input files to a big output file"""
# we assume that all the input files have the same charset
with open(output_file, mode='wb') as out:
for input_file in input_files:
out.write(open(input_file, mode='rb... | python | def _merge_files(self, input_files, output_file):
"""Combine the input files to a big output file"""
# we assume that all the input files have the same charset
with open(output_file, mode='wb') as out:
for input_file in input_files:
out.write(open(input_file, mode='rb... | [
"def",
"_merge_files",
"(",
"self",
",",
"input_files",
",",
"output_file",
")",
":",
"# we assume that all the input files have the same charset",
"with",
"open",
"(",
"output_file",
",",
"mode",
"=",
"'wb'",
")",
"as",
"out",
":",
"for",
"input_file",
"in",
"inp... | Combine the input files to a big output file | [
"Combine",
"the",
"input",
"files",
"to",
"a",
"big",
"output",
"file"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/setup_cmd/__init__.py#L118-L123 | train |
SolutionsCloud/apidoc | apidoc/factory/source/object.py | Object.create_from_name_and_dictionary | def create_from_name_and_dictionary(self, name, datas):
"""Return a populated object Object from dictionary datas
"""
if "type" not in datas:
str_type = "any"
else:
str_type = str(datas["type"]).lower()
if str_type not in ObjectRaw.Types:
type... | python | def create_from_name_and_dictionary(self, name, datas):
"""Return a populated object Object from dictionary datas
"""
if "type" not in datas:
str_type = "any"
else:
str_type = str(datas["type"]).lower()
if str_type not in ObjectRaw.Types:
type... | [
"def",
"create_from_name_and_dictionary",
"(",
"self",
",",
"name",
",",
"datas",
")",
":",
"if",
"\"type\"",
"not",
"in",
"datas",
":",
"str_type",
"=",
"\"any\"",
"else",
":",
"str_type",
"=",
"str",
"(",
"datas",
"[",
"\"type\"",
"]",
")",
".",
"lower... | Return a populated object Object from dictionary datas | [
"Return",
"a",
"populated",
"object",
"Object",
"from",
"dictionary",
"datas"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/factory/source/object.py#L13-L117 | train |
SolutionsCloud/apidoc | apidoc/service/merger.py | Merger.merge_extends | def merge_extends(self, target, extends, inherit_key="inherit", inherit=False):
"""Merge extended dicts
"""
if isinstance(target, dict):
if inherit and inherit_key in target and not to_boolean(target[inherit_key]):
return
if not isinstance(extends, dict):
... | python | def merge_extends(self, target, extends, inherit_key="inherit", inherit=False):
"""Merge extended dicts
"""
if isinstance(target, dict):
if inherit and inherit_key in target and not to_boolean(target[inherit_key]):
return
if not isinstance(extends, dict):
... | [
"def",
"merge_extends",
"(",
"self",
",",
"target",
",",
"extends",
",",
"inherit_key",
"=",
"\"inherit\"",
",",
"inherit",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"target",
",",
"dict",
")",
":",
"if",
"inherit",
"and",
"inherit_key",
"in",
"ta... | Merge extended dicts | [
"Merge",
"extended",
"dicts"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/service/merger.py#L9-L25 | train |
SolutionsCloud/apidoc | apidoc/service/merger.py | Merger.merge_sources | def merge_sources(self, datas):
"""Merge sources files
"""
datas = [data for data in datas if data is not None]
if len(datas) == 0:
raise ValueError("Data missing")
if len(datas) == 1:
return datas[0]
if isinstance(datas[0], list):
i... | python | def merge_sources(self, datas):
"""Merge sources files
"""
datas = [data for data in datas if data is not None]
if len(datas) == 0:
raise ValueError("Data missing")
if len(datas) == 1:
return datas[0]
if isinstance(datas[0], list):
i... | [
"def",
"merge_sources",
"(",
"self",
",",
"datas",
")",
":",
"datas",
"=",
"[",
"data",
"for",
"data",
"in",
"datas",
"if",
"data",
"is",
"not",
"None",
"]",
"if",
"len",
"(",
"datas",
")",
"==",
"0",
":",
"raise",
"ValueError",
"(",
"\"Data missing\... | Merge sources files | [
"Merge",
"sources",
"files"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/service/merger.py#L27-L61 | train |
SolutionsCloud/apidoc | apidoc/service/merger.py | Merger.merge_configs | def merge_configs(self, config, datas):
"""Merge configs files
"""
if not isinstance(config, dict) or len([x for x in datas if not isinstance(x, dict)]) > 0:
raise TypeError("Unable to merge: Dictionnary expected")
for key, value in config.items():
others = [x[ke... | python | def merge_configs(self, config, datas):
"""Merge configs files
"""
if not isinstance(config, dict) or len([x for x in datas if not isinstance(x, dict)]) > 0:
raise TypeError("Unable to merge: Dictionnary expected")
for key, value in config.items():
others = [x[ke... | [
"def",
"merge_configs",
"(",
"self",
",",
"config",
",",
"datas",
")",
":",
"if",
"not",
"isinstance",
"(",
"config",
",",
"dict",
")",
"or",
"len",
"(",
"[",
"x",
"for",
"x",
"in",
"datas",
"if",
"not",
"isinstance",
"(",
"x",
",",
"dict",
")",
... | Merge configs files | [
"Merge",
"configs",
"files"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/service/merger.py#L63-L76 | train |
SolutionsCloud/apidoc | apidoc/object/source_sample.py | Object.factory | def factory(cls, object_raw):
"""Return a proper object
"""
if object_raw is None:
return None
if object_raw.type is ObjectRaw.Types.object:
return ObjectObject(object_raw)
elif object_raw.type is ObjectRaw.Types.type:
return ObjectType(object_... | python | def factory(cls, object_raw):
"""Return a proper object
"""
if object_raw is None:
return None
if object_raw.type is ObjectRaw.Types.object:
return ObjectObject(object_raw)
elif object_raw.type is ObjectRaw.Types.type:
return ObjectType(object_... | [
"def",
"factory",
"(",
"cls",
",",
"object_raw",
")",
":",
"if",
"object_raw",
"is",
"None",
":",
"return",
"None",
"if",
"object_raw",
".",
"type",
"is",
"ObjectRaw",
".",
"Types",
".",
"object",
":",
"return",
"ObjectObject",
"(",
"object_raw",
")",
"e... | Return a proper object | [
"Return",
"a",
"proper",
"object"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/object/source_sample.py#L59-L77 | train |
SolutionsCloud/apidoc | apidoc/service/template.py | Template.render | def render(self, sources, config, out=sys.stdout):
"""Render the documentation as defined in config Object
"""
logger = logging.getLogger()
template = self.env.get_template(self.input)
output = template.render(sources=sources, layout=config["output"]["layout"], config=config["out... | python | def render(self, sources, config, out=sys.stdout):
"""Render the documentation as defined in config Object
"""
logger = logging.getLogger()
template = self.env.get_template(self.input)
output = template.render(sources=sources, layout=config["output"]["layout"], config=config["out... | [
"def",
"render",
"(",
"self",
",",
"sources",
",",
"config",
",",
"out",
"=",
"sys",
".",
"stdout",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
")",
"template",
"=",
"self",
".",
"env",
".",
"get_template",
"(",
"self",
".",
"input",
... | Render the documentation as defined in config Object | [
"Render",
"the",
"documentation",
"as",
"defined",
"in",
"config",
"Object"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/service/template.py#L19-L84 | train |
SolutionsCloud/apidoc | apidoc/factory/source/configuration.py | Configuration.create_from_dictionary | def create_from_dictionary(self, datas):
"""Return a populated object Configuration from dictionnary datas
"""
configuration = ObjectConfiguration()
if "uri" in datas:
configuration.uri = str(datas["uri"])
if "title" in datas:
configuration.title = str(da... | python | def create_from_dictionary(self, datas):
"""Return a populated object Configuration from dictionnary datas
"""
configuration = ObjectConfiguration()
if "uri" in datas:
configuration.uri = str(datas["uri"])
if "title" in datas:
configuration.title = str(da... | [
"def",
"create_from_dictionary",
"(",
"self",
",",
"datas",
")",
":",
"configuration",
"=",
"ObjectConfiguration",
"(",
")",
"if",
"\"uri\"",
"in",
"datas",
":",
"configuration",
".",
"uri",
"=",
"str",
"(",
"datas",
"[",
"\"uri\"",
"]",
")",
"if",
"\"titl... | Return a populated object Configuration from dictionnary datas | [
"Return",
"a",
"populated",
"object",
"Configuration",
"from",
"dictionnary",
"datas"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/factory/source/configuration.py#L10-L22 | train |
SolutionsCloud/apidoc | apidoc/factory/source/parameter.py | Parameter.create_from_name_and_dictionary | def create_from_name_and_dictionary(self, name, datas):
"""Return a populated object Parameter from dictionary datas
"""
parameter = ObjectParameter()
self.set_common_datas(parameter, name, datas)
if "optional" in datas:
parameter.optional = to_boolean(datas["optiona... | python | def create_from_name_and_dictionary(self, name, datas):
"""Return a populated object Parameter from dictionary datas
"""
parameter = ObjectParameter()
self.set_common_datas(parameter, name, datas)
if "optional" in datas:
parameter.optional = to_boolean(datas["optiona... | [
"def",
"create_from_name_and_dictionary",
"(",
"self",
",",
"name",
",",
"datas",
")",
":",
"parameter",
"=",
"ObjectParameter",
"(",
")",
"self",
".",
"set_common_datas",
"(",
"parameter",
",",
"name",
",",
"datas",
")",
"if",
"\"optional\"",
"in",
"datas",
... | Return a populated object Parameter from dictionary datas | [
"Return",
"a",
"populated",
"object",
"Parameter",
"from",
"dictionary",
"datas"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/factory/source/parameter.py#L12-L25 | train |
SolutionsCloud/apidoc | apidoc/service/source.py | Source.validate | def validate(self, sources):
"""Validate the format of sources
"""
if not isinstance(sources, Root):
raise Exception("Source object expected")
parameters = self.get_uri_with_missing_parameters(sources)
for parameter in parameters:
logging.getLogger().warn... | python | def validate(self, sources):
"""Validate the format of sources
"""
if not isinstance(sources, Root):
raise Exception("Source object expected")
parameters = self.get_uri_with_missing_parameters(sources)
for parameter in parameters:
logging.getLogger().warn... | [
"def",
"validate",
"(",
"self",
",",
"sources",
")",
":",
"if",
"not",
"isinstance",
"(",
"sources",
",",
"Root",
")",
":",
"raise",
"Exception",
"(",
"\"Source object expected\"",
")",
"parameters",
"=",
"self",
".",
"get_uri_with_missing_parameters",
"(",
"s... | Validate the format of sources | [
"Validate",
"the",
"format",
"of",
"sources"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/service/source.py#L12-L20 | train |
SolutionsCloud/apidoc | apidoc/service/config.py | Config.validate | def validate(self, config):
"""Validate that the source file is ok
"""
if not isinstance(config, ConfigObject):
raise Exception("Config object expected")
if config["output"]["componants"] not in ("local", "remote", "embedded", "without"):
raise ValueError("Unknow... | python | def validate(self, config):
"""Validate that the source file is ok
"""
if not isinstance(config, ConfigObject):
raise Exception("Config object expected")
if config["output"]["componants"] not in ("local", "remote", "embedded", "without"):
raise ValueError("Unknow... | [
"def",
"validate",
"(",
"self",
",",
"config",
")",
":",
"if",
"not",
"isinstance",
"(",
"config",
",",
"ConfigObject",
")",
":",
"raise",
"Exception",
"(",
"\"Config object expected\"",
")",
"if",
"config",
"[",
"\"output\"",
"]",
"[",
"\"componants\"",
"]"... | Validate that the source file is ok | [
"Validate",
"that",
"the",
"source",
"file",
"is",
"ok"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/service/config.py#L10-L36 | train |
SolutionsCloud/apidoc | apidoc/service/config.py | Config.get_template_from_config | def get_template_from_config(self, config):
"""Retrieve a template path from the config object
"""
if config["output"]["template"] == "default":
return os.path.join(
os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
'template',
... | python | def get_template_from_config(self, config):
"""Retrieve a template path from the config object
"""
if config["output"]["template"] == "default":
return os.path.join(
os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
'template',
... | [
"def",
"get_template_from_config",
"(",
"self",
",",
"config",
")",
":",
"if",
"config",
"[",
"\"output\"",
"]",
"[",
"\"template\"",
"]",
"==",
"\"default\"",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
... | Retrieve a template path from the config object | [
"Retrieve",
"a",
"template",
"path",
"from",
"the",
"config",
"object"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/service/config.py#L38-L48 | train |
SolutionsCloud/apidoc | apidoc/factory/source/responseCode.py | ResponseCode.create_from_dictionary | def create_from_dictionary(self, datas):
"""Return a populated object ResponseCode from dictionary datas
"""
if "code" not in datas:
raise ValueError("A response code must contain a code in \"%s\"." % repr(datas))
code = ObjectResponseCode()
self.set_common_datas(cod... | python | def create_from_dictionary(self, datas):
"""Return a populated object ResponseCode from dictionary datas
"""
if "code" not in datas:
raise ValueError("A response code must contain a code in \"%s\"." % repr(datas))
code = ObjectResponseCode()
self.set_common_datas(cod... | [
"def",
"create_from_dictionary",
"(",
"self",
",",
"datas",
")",
":",
"if",
"\"code\"",
"not",
"in",
"datas",
":",
"raise",
"ValueError",
"(",
"\"A response code must contain a code in \\\"%s\\\".\"",
"%",
"repr",
"(",
"datas",
")",
")",
"code",
"=",
"ObjectRespon... | Return a populated object ResponseCode from dictionary datas | [
"Return",
"a",
"populated",
"object",
"ResponseCode",
"from",
"dictionary",
"datas"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/factory/source/responseCode.py#L54-L71 | train |
SolutionsCloud/apidoc | apidoc/lib/fswatcher/observer.py | Observer.add_handler | def add_handler(self, path, handler):
"""Add a path in watch queue
"""
self.signatures[path] = self.get_path_signature(path)
self.handlers[path] = handler | python | def add_handler(self, path, handler):
"""Add a path in watch queue
"""
self.signatures[path] = self.get_path_signature(path)
self.handlers[path] = handler | [
"def",
"add_handler",
"(",
"self",
",",
"path",
",",
"handler",
")",
":",
"self",
".",
"signatures",
"[",
"path",
"]",
"=",
"self",
".",
"get_path_signature",
"(",
"path",
")",
"self",
".",
"handlers",
"[",
"path",
"]",
"=",
"handler"
] | Add a path in watch queue | [
"Add",
"a",
"path",
"in",
"watch",
"queue"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/lib/fswatcher/observer.py#L19-L23 | train |
SolutionsCloud/apidoc | apidoc/lib/fswatcher/observer.py | Observer.get_path_signature | def get_path_signature(self, path):
"""generate a unique signature for file contained in path
"""
if not os.path.exists(path):
return None
if os.path.isdir(path):
merge = {}
for root, dirs, files in os.walk(path):
for name in files:
... | python | def get_path_signature(self, path):
"""generate a unique signature for file contained in path
"""
if not os.path.exists(path):
return None
if os.path.isdir(path):
merge = {}
for root, dirs, files in os.walk(path):
for name in files:
... | [
"def",
"get_path_signature",
"(",
"self",
",",
"path",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"return",
"None",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"path",
")",
":",
"merge",
"=",
"{",
"}",
"for",
... | generate a unique signature for file contained in path | [
"generate",
"a",
"unique",
"signature",
"for",
"file",
"contained",
"in",
"path"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/lib/fswatcher/observer.py#L25-L38 | train |
SolutionsCloud/apidoc | apidoc/lib/fswatcher/observer.py | Observer.check | def check(self):
"""Check if a file is changed
"""
for (path, handler) in self.handlers.items():
current_signature = self.signatures[path]
new_signature = self.get_path_signature(path)
if new_signature != current_signature:
self.signatures[path... | python | def check(self):
"""Check if a file is changed
"""
for (path, handler) in self.handlers.items():
current_signature = self.signatures[path]
new_signature = self.get_path_signature(path)
if new_signature != current_signature:
self.signatures[path... | [
"def",
"check",
"(",
"self",
")",
":",
"for",
"(",
"path",
",",
"handler",
")",
"in",
"self",
".",
"handlers",
".",
"items",
"(",
")",
":",
"current_signature",
"=",
"self",
".",
"signatures",
"[",
"path",
"]",
"new_signature",
"=",
"self",
".",
"get... | Check if a file is changed | [
"Check",
"if",
"a",
"file",
"is",
"changed"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/lib/fswatcher/observer.py#L40-L48 | train |
SolutionsCloud/apidoc | apidoc/object/source_dto.py | Version.get_comparable_values | def get_comparable_values(self):
"""Return a tupple of values representing the unicity of the object
"""
return (int(self.major), int(self.minor), str(self.label), str(self.name)) | python | def get_comparable_values(self):
"""Return a tupple of values representing the unicity of the object
"""
return (int(self.major), int(self.minor), str(self.label), str(self.name)) | [
"def",
"get_comparable_values",
"(",
"self",
")",
":",
"return",
"(",
"int",
"(",
"self",
".",
"major",
")",
",",
"int",
"(",
"self",
".",
"minor",
")",
",",
"str",
"(",
"self",
".",
"label",
")",
",",
"str",
"(",
"self",
".",
"name",
")",
")"
] | Return a tupple of values representing the unicity of the object | [
"Return",
"a",
"tupple",
"of",
"values",
"representing",
"the",
"unicity",
"of",
"the",
"object"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/object/source_dto.py#L61-L64 | train |
SolutionsCloud/apidoc | apidoc/object/source_dto.py | Category.get_comparable_values | def get_comparable_values(self):
"""Return a tupple of values representing the unicity of the object
"""
return (int(self.order), str(self.label), str(self.name)) | python | def get_comparable_values(self):
"""Return a tupple of values representing the unicity of the object
"""
return (int(self.order), str(self.label), str(self.name)) | [
"def",
"get_comparable_values",
"(",
"self",
")",
":",
"return",
"(",
"int",
"(",
"self",
".",
"order",
")",
",",
"str",
"(",
"self",
".",
"label",
")",
",",
"str",
"(",
"self",
".",
"name",
")",
")"
] | Return a tupple of values representing the unicity of the object | [
"Return",
"a",
"tupple",
"of",
"values",
"representing",
"the",
"unicity",
"of",
"the",
"object"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/object/source_dto.py#L80-L83 | train |
SolutionsCloud/apidoc | apidoc/object/source_dto.py | Parameter.get_comparable_values | def get_comparable_values(self):
"""Return a tupple of values representing the unicity of the object
"""
return (not self.generic, str(self.name), str(self.description)) | python | def get_comparable_values(self):
"""Return a tupple of values representing the unicity of the object
"""
return (not self.generic, str(self.name), str(self.description)) | [
"def",
"get_comparable_values",
"(",
"self",
")",
":",
"return",
"(",
"not",
"self",
".",
"generic",
",",
"str",
"(",
"self",
".",
"name",
")",
",",
"str",
"(",
"self",
".",
"description",
")",
")"
] | Return a tupple of values representing the unicity of the object | [
"Return",
"a",
"tupple",
"of",
"values",
"representing",
"the",
"unicity",
"of",
"the",
"object"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/object/source_dto.py#L181-L184 | train |
SolutionsCloud/apidoc | apidoc/object/source_dto.py | RequestParameter.get_comparable_values_for_ordering | def get_comparable_values_for_ordering(self):
"""Return a tupple of values representing the unicity of the object
"""
return (0 if self.position >= 0 else 1, int(self.position), str(self.name), str(self.description)) | python | def get_comparable_values_for_ordering(self):
"""Return a tupple of values representing the unicity of the object
"""
return (0 if self.position >= 0 else 1, int(self.position), str(self.name), str(self.description)) | [
"def",
"get_comparable_values_for_ordering",
"(",
"self",
")",
":",
"return",
"(",
"0",
"if",
"self",
".",
"position",
">=",
"0",
"else",
"1",
",",
"int",
"(",
"self",
".",
"position",
")",
",",
"str",
"(",
"self",
".",
"name",
")",
",",
"str",
"(",
... | Return a tupple of values representing the unicity of the object | [
"Return",
"a",
"tupple",
"of",
"values",
"representing",
"the",
"unicity",
"of",
"the",
"object"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/object/source_dto.py#L204-L208 | train |
SolutionsCloud/apidoc | apidoc/object/source_dto.py | ResponseCode.get_comparable_values | def get_comparable_values(self):
"""Return a tupple of values representing the unicity of the object
"""
return (not self.generic, int(self.code), str(self.message), str(self.description)) | python | def get_comparable_values(self):
"""Return a tupple of values representing the unicity of the object
"""
return (not self.generic, int(self.code), str(self.message), str(self.description)) | [
"def",
"get_comparable_values",
"(",
"self",
")",
":",
"return",
"(",
"not",
"self",
".",
"generic",
",",
"int",
"(",
"self",
".",
"code",
")",
",",
"str",
"(",
"self",
".",
"message",
")",
",",
"str",
"(",
"self",
".",
"description",
")",
")"
] | Return a tupple of values representing the unicity of the object | [
"Return",
"a",
"tupple",
"of",
"values",
"representing",
"the",
"unicity",
"of",
"the",
"object"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/object/source_dto.py#L221-L224 | train |
SolutionsCloud/apidoc | apidoc/object/source_dto.py | Object.factory | def factory(cls, object_source):
"""Return a proper object
"""
if object_source.type is ObjectRaw.Types.object:
return ObjectObject(object_source)
elif object_source.type not in ObjectRaw.Types or object_source.type is ObjectRaw.Types.type:
return ObjectType(objec... | python | def factory(cls, object_source):
"""Return a proper object
"""
if object_source.type is ObjectRaw.Types.object:
return ObjectObject(object_source)
elif object_source.type not in ObjectRaw.Types or object_source.type is ObjectRaw.Types.type:
return ObjectType(objec... | [
"def",
"factory",
"(",
"cls",
",",
"object_source",
")",
":",
"if",
"object_source",
".",
"type",
"is",
"ObjectRaw",
".",
"Types",
".",
"object",
":",
"return",
"ObjectObject",
"(",
"object_source",
")",
"elif",
"object_source",
".",
"type",
"not",
"in",
"... | Return a proper object | [
"Return",
"a",
"proper",
"object"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/object/source_dto.py#L273-L289 | train |
SolutionsCloud/apidoc | apidoc/object/source_dto.py | Object.get_comparable_values | def get_comparable_values(self):
"""Return a tupple of values representing the unicity of the object
"""
return (str(self.name), str(self.description), str(self.type), bool(self.optional), str(self.constraints) if isinstance(self, Constraintable) else "") | python | def get_comparable_values(self):
"""Return a tupple of values representing the unicity of the object
"""
return (str(self.name), str(self.description), str(self.type), bool(self.optional), str(self.constraints) if isinstance(self, Constraintable) else "") | [
"def",
"get_comparable_values",
"(",
"self",
")",
":",
"return",
"(",
"str",
"(",
"self",
".",
"name",
")",
",",
"str",
"(",
"self",
".",
"description",
")",
",",
"str",
"(",
"self",
".",
"type",
")",
",",
"bool",
"(",
"self",
".",
"optional",
")",... | Return a tupple of values representing the unicity of the object | [
"Return",
"a",
"tupple",
"of",
"values",
"representing",
"the",
"unicity",
"of",
"the",
"object"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/object/source_dto.py#L301-L304 | train |
SolutionsCloud/apidoc | apidoc/object/source_dto.py | ObjectEnum.get_comparable_values | def get_comparable_values(self):
"""Return a tupple of values representing the unicity of the object
"""
return (str(self.name), str(self.description), str(self.constraints)) | python | def get_comparable_values(self):
"""Return a tupple of values representing the unicity of the object
"""
return (str(self.name), str(self.description), str(self.constraints)) | [
"def",
"get_comparable_values",
"(",
"self",
")",
":",
"return",
"(",
"str",
"(",
"self",
".",
"name",
")",
",",
"str",
"(",
"self",
".",
"description",
")",
",",
"str",
"(",
"self",
".",
"constraints",
")",
")"
] | Return a tupple of values representing the unicity of the object | [
"Return",
"a",
"tupple",
"of",
"values",
"representing",
"the",
"unicity",
"of",
"the",
"object"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/object/source_dto.py#L370-L373 | train |
SolutionsCloud/apidoc | apidoc/factory/source/category.py | Category.create_from_name_and_dictionary | def create_from_name_and_dictionary(self, name, datas):
"""Return a populated object Category from dictionary datas
"""
category = ObjectCategory(name)
self.set_common_datas(category, name, datas)
if "order" in datas:
category.order = int(datas["order"])
ret... | python | def create_from_name_and_dictionary(self, name, datas):
"""Return a populated object Category from dictionary datas
"""
category = ObjectCategory(name)
self.set_common_datas(category, name, datas)
if "order" in datas:
category.order = int(datas["order"])
ret... | [
"def",
"create_from_name_and_dictionary",
"(",
"self",
",",
"name",
",",
"datas",
")",
":",
"category",
"=",
"ObjectCategory",
"(",
"name",
")",
"self",
".",
"set_common_datas",
"(",
"category",
",",
"name",
",",
"datas",
")",
"if",
"\"order\"",
"in",
"datas... | Return a populated object Category from dictionary datas | [
"Return",
"a",
"populated",
"object",
"Category",
"from",
"dictionary",
"datas"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/factory/source/category.py#L10-L19 | train |
SolutionsCloud/apidoc | apidoc/service/parser.py | Parser.load_from_file | def load_from_file(self, file_path, format=None):
"""Return dict from a file config
"""
if format is None:
base_name, file_extension = os.path.splitext(file_path)
if file_extension in (".yaml", ".yml"):
format = "yaml"
elif file_extension in ("... | python | def load_from_file(self, file_path, format=None):
"""Return dict from a file config
"""
if format is None:
base_name, file_extension = os.path.splitext(file_path)
if file_extension in (".yaml", ".yml"):
format = "yaml"
elif file_extension in ("... | [
"def",
"load_from_file",
"(",
"self",
",",
"file_path",
",",
"format",
"=",
"None",
")",
":",
"if",
"format",
"is",
"None",
":",
"base_name",
",",
"file_extension",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"file_path",
")",
"if",
"file_extension",
"... | Return dict from a file config | [
"Return",
"dict",
"from",
"a",
"file",
"config"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/service/parser.py#L10-L27 | train |
SolutionsCloud/apidoc | apidoc/service/parser.py | Parser.load_all_from_directory | def load_all_from_directory(self, directory_path):
"""Return a list of dict from a directory containing files
"""
datas = []
for root, folders, files in os.walk(directory_path):
for f in files:
datas.append(self.load_from_file(os.path.join(root, f)))
... | python | def load_all_from_directory(self, directory_path):
"""Return a list of dict from a directory containing files
"""
datas = []
for root, folders, files in os.walk(directory_path):
for f in files:
datas.append(self.load_from_file(os.path.join(root, f)))
... | [
"def",
"load_all_from_directory",
"(",
"self",
",",
"directory_path",
")",
":",
"datas",
"=",
"[",
"]",
"for",
"root",
",",
"folders",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"directory_path",
")",
":",
"for",
"f",
"in",
"files",
":",
"datas",
".",... | Return a list of dict from a directory containing files | [
"Return",
"a",
"list",
"of",
"dict",
"from",
"a",
"directory",
"containing",
"files"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/service/parser.py#L29-L37 | train |
SolutionsCloud/apidoc | apidoc/lib/util/serialize.py | json_repr | def json_repr(obj):
"""Represent instance of a class as JSON.
"""
def serialize(obj):
"""Recursively walk object's hierarchy.
"""
if obj is None:
return None
if isinstance(obj, Enum):
return str(obj)
if isinstance(obj, (bool, int, float, str))... | python | def json_repr(obj):
"""Represent instance of a class as JSON.
"""
def serialize(obj):
"""Recursively walk object's hierarchy.
"""
if obj is None:
return None
if isinstance(obj, Enum):
return str(obj)
if isinstance(obj, (bool, int, float, str))... | [
"def",
"json_repr",
"(",
"obj",
")",
":",
"def",
"serialize",
"(",
"obj",
")",
":",
"\"\"\"Recursively walk object's hierarchy.\n \"\"\"",
"if",
"obj",
"is",
"None",
":",
"return",
"None",
"if",
"isinstance",
"(",
"obj",
",",
"Enum",
")",
":",
"return",... | Represent instance of a class as JSON. | [
"Represent",
"instance",
"of",
"a",
"class",
"as",
"JSON",
"."
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/lib/util/serialize.py#L5-L31 | train |
SolutionsCloud/apidoc | apidoc/factory/source/rootDto.py | RootDto.create_from_root | def create_from_root(self, root_source):
"""Return a populated Object Root from dictionnary datas
"""
root_dto = ObjectRoot()
root_dto.configuration = root_source.configuration
root_dto.versions = [Version(x) for x in root_source.versions.values()]
for version in sorte... | python | def create_from_root(self, root_source):
"""Return a populated Object Root from dictionnary datas
"""
root_dto = ObjectRoot()
root_dto.configuration = root_source.configuration
root_dto.versions = [Version(x) for x in root_source.versions.values()]
for version in sorte... | [
"def",
"create_from_root",
"(",
"self",
",",
"root_source",
")",
":",
"root_dto",
"=",
"ObjectRoot",
"(",
")",
"root_dto",
".",
"configuration",
"=",
"root_source",
".",
"configuration",
"root_dto",
".",
"versions",
"=",
"[",
"Version",
"(",
"x",
")",
"for",... | Return a populated Object Root from dictionnary datas | [
"Return",
"a",
"populated",
"Object",
"Root",
"from",
"dictionnary",
"datas"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/factory/source/rootDto.py#L18-L36 | train |
SolutionsCloud/apidoc | apidoc/factory/source/element.py | Element.set_common_datas | def set_common_datas(self, element, name, datas):
"""Populated common data for an element from dictionnary datas
"""
element.name = str(name)
if "description" in datas:
element.description = str(datas["description"]).strip()
if isinstance(element, Sampleable) and ele... | python | def set_common_datas(self, element, name, datas):
"""Populated common data for an element from dictionnary datas
"""
element.name = str(name)
if "description" in datas:
element.description = str(datas["description"]).strip()
if isinstance(element, Sampleable) and ele... | [
"def",
"set_common_datas",
"(",
"self",
",",
"element",
",",
"name",
",",
"datas",
")",
":",
"element",
".",
"name",
"=",
"str",
"(",
"name",
")",
"if",
"\"description\"",
"in",
"datas",
":",
"element",
".",
"description",
"=",
"str",
"(",
"datas",
"["... | Populated common data for an element from dictionnary datas | [
"Populated",
"common",
"data",
"for",
"an",
"element",
"from",
"dictionnary",
"datas"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/factory/source/element.py#L12-L29 | train |
SolutionsCloud/apidoc | apidoc/factory/source/element.py | Element.create_dictionary_of_element_from_dictionary | def create_dictionary_of_element_from_dictionary(self, property_name, datas):
"""Populate a dictionary of elements
"""
response = {}
if property_name in datas and datas[property_name] is not None and isinstance(datas[property_name], collections.Iterable):
for key, value in da... | python | def create_dictionary_of_element_from_dictionary(self, property_name, datas):
"""Populate a dictionary of elements
"""
response = {}
if property_name in datas and datas[property_name] is not None and isinstance(datas[property_name], collections.Iterable):
for key, value in da... | [
"def",
"create_dictionary_of_element_from_dictionary",
"(",
"self",
",",
"property_name",
",",
"datas",
")",
":",
"response",
"=",
"{",
"}",
"if",
"property_name",
"in",
"datas",
"and",
"datas",
"[",
"property_name",
"]",
"is",
"not",
"None",
"and",
"isinstance"... | Populate a dictionary of elements | [
"Populate",
"a",
"dictionary",
"of",
"elements"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/factory/source/element.py#L31-L39 | train |
SolutionsCloud/apidoc | apidoc/factory/source/element.py | Element.create_list_of_element_from_dictionary | def create_list_of_element_from_dictionary(self, property_name, datas):
"""Populate a list of elements
"""
response = []
if property_name in datas and datas[property_name] is not None and isinstance(datas[property_name], list):
for value in datas[property_name]:
... | python | def create_list_of_element_from_dictionary(self, property_name, datas):
"""Populate a list of elements
"""
response = []
if property_name in datas and datas[property_name] is not None and isinstance(datas[property_name], list):
for value in datas[property_name]:
... | [
"def",
"create_list_of_element_from_dictionary",
"(",
"self",
",",
"property_name",
",",
"datas",
")",
":",
"response",
"=",
"[",
"]",
"if",
"property_name",
"in",
"datas",
"and",
"datas",
"[",
"property_name",
"]",
"is",
"not",
"None",
"and",
"isinstance",
"(... | Populate a list of elements | [
"Populate",
"a",
"list",
"of",
"elements"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/factory/source/element.py#L41-L49 | train |
SolutionsCloud/apidoc | apidoc/factory/source/element.py | Element.get_enum | def get_enum(self, property, enum, datas):
"""Factory enum type
"""
str_property = str(datas[property]).lower()
if str_property not in enum:
raise ValueError("Unknow enum \"%s\" for \"%s\"." % (str_property, property))
return enum(str_property) | python | def get_enum(self, property, enum, datas):
"""Factory enum type
"""
str_property = str(datas[property]).lower()
if str_property not in enum:
raise ValueError("Unknow enum \"%s\" for \"%s\"." % (str_property, property))
return enum(str_property) | [
"def",
"get_enum",
"(",
"self",
",",
"property",
",",
"enum",
",",
"datas",
")",
":",
"str_property",
"=",
"str",
"(",
"datas",
"[",
"property",
"]",
")",
".",
"lower",
"(",
")",
"if",
"str_property",
"not",
"in",
"enum",
":",
"raise",
"ValueError",
... | Factory enum type | [
"Factory",
"enum",
"type"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/factory/source/element.py#L51-L57 | train |
SolutionsCloud/apidoc | apidoc/factory/template.py | Template.create_from_config | def create_from_config(self, config):
"""Create a template object file defined in the config object
"""
configService = ConfigService()
template = TemplateService()
template.output = config["output"]["location"]
template_file = configService.get_template_from_config(co... | python | def create_from_config(self, config):
"""Create a template object file defined in the config object
"""
configService = ConfigService()
template = TemplateService()
template.output = config["output"]["location"]
template_file = configService.get_template_from_config(co... | [
"def",
"create_from_config",
"(",
"self",
",",
"config",
")",
":",
"configService",
"=",
"ConfigService",
"(",
")",
"template",
"=",
"TemplateService",
"(",
")",
"template",
".",
"output",
"=",
"config",
"[",
"\"output\"",
"]",
"[",
"\"location\"",
"]",
"tem... | Create a template object file defined in the config object | [
"Create",
"a",
"template",
"object",
"file",
"defined",
"in",
"the",
"config",
"object"
] | 1ee25d886a5bea11dc744c2f3d0abb0b55d942e1 | https://github.com/SolutionsCloud/apidoc/blob/1ee25d886a5bea11dc744c2f3d0abb0b55d942e1/apidoc/factory/template.py#L12-L25 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiNetworkIPv4.py | ApiNetworkIPv4.deploy | def deploy(self, id_networkv4):
"""Deploy network in equipments and set column 'active = 1' in tables redeipv4
:param id_networkv4: ID for NetworkIPv4
:return: Equipments configuration output
"""
data = dict()
uri = 'api/networkv4/%s/equipments/' % id_networkv4
... | python | def deploy(self, id_networkv4):
"""Deploy network in equipments and set column 'active = 1' in tables redeipv4
:param id_networkv4: ID for NetworkIPv4
:return: Equipments configuration output
"""
data = dict()
uri = 'api/networkv4/%s/equipments/' % id_networkv4
... | [
"def",
"deploy",
"(",
"self",
",",
"id_networkv4",
")",
":",
"data",
"=",
"dict",
"(",
")",
"uri",
"=",
"'api/networkv4/%s/equipments/'",
"%",
"id_networkv4",
"return",
"super",
"(",
"ApiNetworkIPv4",
",",
"self",
")",
".",
"post",
"(",
"uri",
",",
"data",... | Deploy network in equipments and set column 'active = 1' in tables redeipv4
:param id_networkv4: ID for NetworkIPv4
:return: Equipments configuration output | [
"Deploy",
"network",
"in",
"equipments",
"and",
"set",
"column",
"active",
"=",
"1",
"in",
"tables",
"redeipv4"
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiNetworkIPv4.py#L22-L33 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiNetworkIPv4.py | ApiNetworkIPv4.get_by_id | def get_by_id(self, id_networkv4):
"""Get IPv4 network
:param id_networkv4: ID for NetworkIPv4
:return: IPv4 Network
"""
uri = 'api/networkv4/%s/' % id_networkv4
return super(ApiNetworkIPv4, self).get(uri) | python | def get_by_id(self, id_networkv4):
"""Get IPv4 network
:param id_networkv4: ID for NetworkIPv4
:return: IPv4 Network
"""
uri = 'api/networkv4/%s/' % id_networkv4
return super(ApiNetworkIPv4, self).get(uri) | [
"def",
"get_by_id",
"(",
"self",
",",
"id_networkv4",
")",
":",
"uri",
"=",
"'api/networkv4/%s/'",
"%",
"id_networkv4",
"return",
"super",
"(",
"ApiNetworkIPv4",
",",
"self",
")",
".",
"get",
"(",
"uri",
")"
] | Get IPv4 network
:param id_networkv4: ID for NetworkIPv4
:return: IPv4 Network | [
"Get",
"IPv4",
"network"
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiNetworkIPv4.py#L35-L45 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiNetworkIPv4.py | ApiNetworkIPv4.list | def list(self, environment_vip=None):
"""List IPv4 networks
:param environment_vip: environment vip to filter
:return: IPv4 Networks
"""
uri = 'api/networkv4/?'
if environment_vip:
uri += 'environment_vip=%s' % environment_vip
return super(ApiNetwo... | python | def list(self, environment_vip=None):
"""List IPv4 networks
:param environment_vip: environment vip to filter
:return: IPv4 Networks
"""
uri = 'api/networkv4/?'
if environment_vip:
uri += 'environment_vip=%s' % environment_vip
return super(ApiNetwo... | [
"def",
"list",
"(",
"self",
",",
"environment_vip",
"=",
"None",
")",
":",
"uri",
"=",
"'api/networkv4/?'",
"if",
"environment_vip",
":",
"uri",
"+=",
"'environment_vip=%s'",
"%",
"environment_vip",
"return",
"super",
"(",
"ApiNetworkIPv4",
",",
"self",
")",
"... | List IPv4 networks
:param environment_vip: environment vip to filter
:return: IPv4 Networks | [
"List",
"IPv4",
"networks"
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiNetworkIPv4.py#L47-L59 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiNetworkIPv4.py | ApiNetworkIPv4.undeploy | def undeploy(self, id_networkv4):
"""Remove deployment of network in equipments and set column 'active = 0' in tables redeipv4 ]
:param id_networkv4: ID for NetworkIPv4
:return: Equipments configuration output
"""
uri = 'api/networkv4/%s/equipments/' % id_networkv4
re... | python | def undeploy(self, id_networkv4):
"""Remove deployment of network in equipments and set column 'active = 0' in tables redeipv4 ]
:param id_networkv4: ID for NetworkIPv4
:return: Equipments configuration output
"""
uri = 'api/networkv4/%s/equipments/' % id_networkv4
re... | [
"def",
"undeploy",
"(",
"self",
",",
"id_networkv4",
")",
":",
"uri",
"=",
"'api/networkv4/%s/equipments/'",
"%",
"id_networkv4",
"return",
"super",
"(",
"ApiNetworkIPv4",
",",
"self",
")",
".",
"delete",
"(",
"uri",
")"
] | Remove deployment of network in equipments and set column 'active = 0' in tables redeipv4 ]
:param id_networkv4: ID for NetworkIPv4
:return: Equipments configuration output | [
"Remove",
"deployment",
"of",
"network",
"in",
"equipments",
"and",
"set",
"column",
"active",
"=",
"0",
"in",
"tables",
"redeipv4",
"]"
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiNetworkIPv4.py#L61-L71 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiNetworkIPv4.py | ApiNetworkIPv4.check_vip_ip | def check_vip_ip(self, ip, environment_vip):
"""
Check available ip in environment vip
"""
uri = 'api/ipv4/ip/%s/environment-vip/%s/' % (ip, environment_vip)
return super(ApiNetworkIPv4, self).get(uri) | python | def check_vip_ip(self, ip, environment_vip):
"""
Check available ip in environment vip
"""
uri = 'api/ipv4/ip/%s/environment-vip/%s/' % (ip, environment_vip)
return super(ApiNetworkIPv4, self).get(uri) | [
"def",
"check_vip_ip",
"(",
"self",
",",
"ip",
",",
"environment_vip",
")",
":",
"uri",
"=",
"'api/ipv4/ip/%s/environment-vip/%s/'",
"%",
"(",
"ip",
",",
"environment_vip",
")",
"return",
"super",
"(",
"ApiNetworkIPv4",
",",
"self",
")",
".",
"get",
"(",
"ur... | Check available ip in environment vip | [
"Check",
"available",
"ip",
"in",
"environment",
"vip"
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiNetworkIPv4.py#L73-L79 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiNetworkIPv4.py | ApiNetworkIPv4.delete_ipv4 | def delete_ipv4(self, ipv4_id):
"""
Delete ipv4
"""
uri = 'api/ipv4/%s/' % (ipv4_id)
return super(ApiNetworkIPv4, self).delete(uri) | python | def delete_ipv4(self, ipv4_id):
"""
Delete ipv4
"""
uri = 'api/ipv4/%s/' % (ipv4_id)
return super(ApiNetworkIPv4, self).delete(uri) | [
"def",
"delete_ipv4",
"(",
"self",
",",
"ipv4_id",
")",
":",
"uri",
"=",
"'api/ipv4/%s/'",
"%",
"(",
"ipv4_id",
")",
"return",
"super",
"(",
"ApiNetworkIPv4",
",",
"self",
")",
".",
"delete",
"(",
"uri",
")"
] | Delete ipv4 | [
"Delete",
"ipv4"
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiNetworkIPv4.py#L81-L87 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiNetworkIPv4.py | ApiNetworkIPv4.search | def search(self, **kwargs):
"""
Method to search ipv4's based on extends search.
:param search: Dict containing QuerySets to find ipv4's.
:param include: Array containing fields to include on response.
:param exclude: Array containing fields to exclude on response.
:para... | python | def search(self, **kwargs):
"""
Method to search ipv4's based on extends search.
:param search: Dict containing QuerySets to find ipv4's.
:param include: Array containing fields to include on response.
:param exclude: Array containing fields to exclude on response.
:para... | [
"def",
"search",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"super",
"(",
"ApiNetworkIPv4",
",",
"self",
")",
".",
"get",
"(",
"self",
".",
"prepare_url",
"(",
"'api/v3/networkv4/'",
",",
"kwargs",
")",
")"
] | Method to search ipv4's based on extends search.
:param search: Dict containing QuerySets to find ipv4's.
:param include: Array containing fields to include on response.
:param exclude: Array containing fields to exclude on response.
:param fields: Array containing fields to override d... | [
"Method",
"to",
"search",
"ipv4",
"s",
"based",
"on",
"extends",
"search",
"."
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiNetworkIPv4.py#L89-L102 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiNetworkIPv4.py | ApiNetworkIPv4.delete | def delete(self, ids):
"""
Method to delete network-ipv4's by their ids
:param ids: Identifiers of network-ipv4's
:return: None
"""
url = build_uri_with_ids('api/v3/networkv4/%s/', ids)
return super(ApiNetworkIPv4, self).delete(url) | python | def delete(self, ids):
"""
Method to delete network-ipv4's by their ids
:param ids: Identifiers of network-ipv4's
:return: None
"""
url = build_uri_with_ids('api/v3/networkv4/%s/', ids)
return super(ApiNetworkIPv4, self).delete(url) | [
"def",
"delete",
"(",
"self",
",",
"ids",
")",
":",
"url",
"=",
"build_uri_with_ids",
"(",
"'api/v3/networkv4/%s/'",
",",
"ids",
")",
"return",
"super",
"(",
"ApiNetworkIPv4",
",",
"self",
")",
".",
"delete",
"(",
"url",
")"
] | Method to delete network-ipv4's by their ids
:param ids: Identifiers of network-ipv4's
:return: None | [
"Method",
"to",
"delete",
"network",
"-",
"ipv4",
"s",
"by",
"their",
"ids"
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiNetworkIPv4.py#L119-L128 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiNetworkIPv4.py | ApiNetworkIPv4.update | def update(self, networkipv4s):
"""
Method to update network-ipv4's
:param networkipv4s: List containing network-ipv4's desired to updated
:return: None
"""
data = {'networks': networkipv4s}
networkipv4s_ids = [str(networkipv4.get('id'))
... | python | def update(self, networkipv4s):
"""
Method to update network-ipv4's
:param networkipv4s: List containing network-ipv4's desired to updated
:return: None
"""
data = {'networks': networkipv4s}
networkipv4s_ids = [str(networkipv4.get('id'))
... | [
"def",
"update",
"(",
"self",
",",
"networkipv4s",
")",
":",
"data",
"=",
"{",
"'networks'",
":",
"networkipv4s",
"}",
"networkipv4s_ids",
"=",
"[",
"str",
"(",
"networkipv4",
".",
"get",
"(",
"'id'",
")",
")",
"for",
"networkipv4",
"in",
"networkipv4s",
... | Method to update network-ipv4's
:param networkipv4s: List containing network-ipv4's desired to updated
:return: None | [
"Method",
"to",
"update",
"network",
"-",
"ipv4",
"s"
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiNetworkIPv4.py#L130-L143 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiNetworkIPv4.py | ApiNetworkIPv4.create | def create(self, networkipv4s):
"""
Method to create network-ipv4's
:param networkipv4s: List containing networkipv4's desired to be created on database
:return: None
"""
data = {'networks': networkipv4s}
return super(ApiNetworkIPv4, self).post('api/v3/networkv4... | python | def create(self, networkipv4s):
"""
Method to create network-ipv4's
:param networkipv4s: List containing networkipv4's desired to be created on database
:return: None
"""
data = {'networks': networkipv4s}
return super(ApiNetworkIPv4, self).post('api/v3/networkv4... | [
"def",
"create",
"(",
"self",
",",
"networkipv4s",
")",
":",
"data",
"=",
"{",
"'networks'",
":",
"networkipv4s",
"}",
"return",
"super",
"(",
"ApiNetworkIPv4",
",",
"self",
")",
".",
"post",
"(",
"'api/v3/networkv4/'",
",",
"data",
")"
] | Method to create network-ipv4's
:param networkipv4s: List containing networkipv4's desired to be created on database
:return: None | [
"Method",
"to",
"create",
"network",
"-",
"ipv4",
"s"
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiNetworkIPv4.py#L145-L154 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/DivisaoDc.py | DivisaoDc.inserir | def inserir(self, name):
"""Inserts a new Division Dc and returns its identifier.
:param name: Division Dc name. String with a minimum 2 and maximum of 80 characters
:return: Dictionary with the following structure:
::
{'division_dc': {'id': < id_division_dc >}}
... | python | def inserir(self, name):
"""Inserts a new Division Dc and returns its identifier.
:param name: Division Dc name. String with a minimum 2 and maximum of 80 characters
:return: Dictionary with the following structure:
::
{'division_dc': {'id': < id_division_dc >}}
... | [
"def",
"inserir",
"(",
"self",
",",
"name",
")",
":",
"division_dc_map",
"=",
"dict",
"(",
")",
"division_dc_map",
"[",
"'name'",
"]",
"=",
"name",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"{",
"'division_dc'",
":",
"division_dc_map",
"}",
... | Inserts a new Division Dc and returns its identifier.
:param name: Division Dc name. String with a minimum 2 and maximum of 80 characters
:return: Dictionary with the following structure:
::
{'division_dc': {'id': < id_division_dc >}}
:raise InvalidParameterError: Name i... | [
"Inserts",
"a",
"new",
"Division",
"Dc",
"and",
"returns",
"its",
"identifier",
"."
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/DivisaoDc.py#L58-L81 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/DivisaoDc.py | DivisaoDc.alterar | def alterar(self, id_divisiondc, name):
"""Change Division Dc from by the identifier.
:param id_divisiondc: Identifier of the Division Dc. Integer value and greater than zero.
:param name: Division Dc name. String with a minimum 2 and maximum of 80 characters
:return: None
:ra... | python | def alterar(self, id_divisiondc, name):
"""Change Division Dc from by the identifier.
:param id_divisiondc: Identifier of the Division Dc. Integer value and greater than zero.
:param name: Division Dc name. String with a minimum 2 and maximum of 80 characters
:return: None
:ra... | [
"def",
"alterar",
"(",
"self",
",",
"id_divisiondc",
",",
"name",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_divisiondc",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'The identifier of Division Dc is invalid or was not informed.'",
")",
"url",
"=",
"... | Change Division Dc from by the identifier.
:param id_divisiondc: Identifier of the Division Dc. Integer value and greater than zero.
:param name: Division Dc name. String with a minimum 2 and maximum of 80 characters
:return: None
:raise InvalidParameterError: The identifier of Divisi... | [
"Change",
"Division",
"Dc",
"from",
"by",
"the",
"identifier",
"."
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/DivisaoDc.py#L83-L109 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/DivisaoDc.py | DivisaoDc.remover | def remover(self, id_divisiondc):
"""Remove Division Dc from by the identifier.
:param id_divisiondc: Identifier of the Division Dc. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: The identifier of Division Dc is null and invalid.
:raise Divis... | python | def remover(self, id_divisiondc):
"""Remove Division Dc from by the identifier.
:param id_divisiondc: Identifier of the Division Dc. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: The identifier of Division Dc is null and invalid.
:raise Divis... | [
"def",
"remover",
"(",
"self",
",",
"id_divisiondc",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_divisiondc",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'The identifier of Division Dc is invalid or was not informed.'",
")",
"url",
"=",
"'divisiondc/'",
... | Remove Division Dc from by the identifier.
:param id_divisiondc: Identifier of the Division Dc. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: The identifier of Division Dc is null and invalid.
:raise DivisaoDcNaoExisteError: Division Dc not registere... | [
"Remove",
"Division",
"Dc",
"from",
"by",
"the",
"identifier",
"."
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/DivisaoDc.py#L111-L132 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiObjectType.py | ApiObjectType.search | def search(self, **kwargs):
"""
Method to search object types based on extends search.
:param search: Dict containing QuerySets to find object types.
:param include: Array containing fields to include on response.
:param exclude: Array containing fields to exclude on response.
... | python | def search(self, **kwargs):
"""
Method to search object types based on extends search.
:param search: Dict containing QuerySets to find object types.
:param include: Array containing fields to include on response.
:param exclude: Array containing fields to exclude on response.
... | [
"def",
"search",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"super",
"(",
"ApiObjectType",
",",
"self",
")",
".",
"get",
"(",
"self",
".",
"prepare_url",
"(",
"'api/v3/object-type/'",
",",
"kwargs",
")",
")"
] | Method to search object types based on extends search.
:param search: Dict containing QuerySets to find object types.
:param include: Array containing fields to include on response.
:param exclude: Array containing fields to exclude on response.
:param fields: Array containing fields t... | [
"Method",
"to",
"search",
"object",
"types",
"based",
"on",
"extends",
"search",
"."
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiObjectType.py#L36-L49 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/Vlan.py | Vlan.find_vlans | def find_vlans(
self,
number,
name,
iexact,
environment,
net_type,
network,
ip_version,
subnet,
acl,
pagination):
"""
Find vlans by all search parameters
:param nu... | python | def find_vlans(
self,
number,
name,
iexact,
environment,
net_type,
network,
ip_version,
subnet,
acl,
pagination):
"""
Find vlans by all search parameters
:param nu... | [
"def",
"find_vlans",
"(",
"self",
",",
"number",
",",
"name",
",",
"iexact",
",",
"environment",
",",
"net_type",
",",
"network",
",",
"ip_version",
",",
"subnet",
",",
"acl",
",",
"pagination",
")",
":",
"if",
"not",
"isinstance",
"(",
"pagination",
","... | Find vlans by all search parameters
:param number: Filter by vlan number column
:param name: Filter by vlan name column
:param iexact: Filter by name will be exact?
:param environment: Filter by environment ID related
:param net_type: Filter by network_type ID related
:p... | [
"Find",
"vlans",
"by",
"all",
"search",
"parameters"
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Vlan.py#L84-L164 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/Vlan.py | Vlan.listar_por_ambiente | def listar_por_ambiente(self, id_ambiente):
"""List all VLANs from an environment.
** The itens returning from network is there to be compatible with other system **
:param id_ambiente: Environment identifier.
:return: Following dictionary:
::
{'vlan': [{'id': < id_v... | python | def listar_por_ambiente(self, id_ambiente):
"""List all VLANs from an environment.
** The itens returning from network is there to be compatible with other system **
:param id_ambiente: Environment identifier.
:return: Following dictionary:
::
{'vlan': [{'id': < id_v... | [
"def",
"listar_por_ambiente",
"(",
"self",
",",
"id_ambiente",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_ambiente",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'Environment id is none or invalid.'",
")",
"url",
"=",
"'vlan/ambiente/'",
"+",
"str",
... | List all VLANs from an environment.
** The itens returning from network is there to be compatible with other system **
:param id_ambiente: Environment identifier.
:return: Following dictionary:
::
{'vlan': [{'id': < id_vlan >,
'nome': < nome_vlan >,
'num_... | [
"List",
"all",
"VLANs",
"from",
"an",
"environment",
".",
"**",
"The",
"itens",
"returning",
"from",
"network",
"is",
"there",
"to",
"be",
"compatible",
"with",
"other",
"system",
"**",
":",
"param",
"id_ambiente",
":",
"Environment",
"identifier",
"."
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Vlan.py#L189-L232 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/Vlan.py | Vlan.alocar | def alocar(
self,
nome,
id_tipo_rede,
id_ambiente,
descricao,
id_ambiente_vip=None,
vrf=None):
"""Inserts a new VLAN.
:param nome: Name of Vlan. String with a maximum of 50 characters.
:param id_tipo_rede: Ident... | python | def alocar(
self,
nome,
id_tipo_rede,
id_ambiente,
descricao,
id_ambiente_vip=None,
vrf=None):
"""Inserts a new VLAN.
:param nome: Name of Vlan. String with a maximum of 50 characters.
:param id_tipo_rede: Ident... | [
"def",
"alocar",
"(",
"self",
",",
"nome",
",",
"id_tipo_rede",
",",
"id_ambiente",
",",
"descricao",
",",
"id_ambiente_vip",
"=",
"None",
",",
"vrf",
"=",
"None",
")",
":",
"vlan_map",
"=",
"dict",
"(",
")",
"vlan_map",
"[",
"'nome'",
"]",
"=",
"nome"... | Inserts a new VLAN.
:param nome: Name of Vlan. String with a maximum of 50 characters.
:param id_tipo_rede: Identifier of the Network Type. Integer value and greater than zero.
:param id_ambiente: Identifier of the Environment. Integer value and greater than zero.
:param descricao: Desc... | [
"Inserts",
"a",
"new",
"VLAN",
"."
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Vlan.py#L234-L296 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/Vlan.py | Vlan.insert_vlan | def insert_vlan(
self,
environment_id,
name,
number,
description,
acl_file,
acl_file_v6,
network_ipv4,
network_ipv6,
vrf=None):
"""Create new VLAN
:param environment_id: ID for Enviro... | python | def insert_vlan(
self,
environment_id,
name,
number,
description,
acl_file,
acl_file_v6,
network_ipv4,
network_ipv6,
vrf=None):
"""Create new VLAN
:param environment_id: ID for Enviro... | [
"def",
"insert_vlan",
"(",
"self",
",",
"environment_id",
",",
"name",
",",
"number",
",",
"description",
",",
"acl_file",
",",
"acl_file_v6",
",",
"network_ipv4",
",",
"network_ipv6",
",",
"vrf",
"=",
"None",
")",
":",
"if",
"not",
"is_valid_int_param",
"("... | Create new VLAN
:param environment_id: ID for Environment.
:param name: The name of VLAN.
:param description: Some description to VLAN.
:param number: Number of Vlan
:param acl_file: Acl IPv4 File name to VLAN.
:param acl_file_v6: Acl IPv6 File name to VLAN.
:par... | [
"Create",
"new",
"VLAN"
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Vlan.py#L298-L362 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/Vlan.py | Vlan.edit_vlan | def edit_vlan(
self,
environment_id,
name,
number,
description,
acl_file,
acl_file_v6,
id_vlan):
"""Edit a VLAN
:param id_vlan: ID for Vlan
:param environment_id: ID for Environment.
:param n... | python | def edit_vlan(
self,
environment_id,
name,
number,
description,
acl_file,
acl_file_v6,
id_vlan):
"""Edit a VLAN
:param id_vlan: ID for Vlan
:param environment_id: ID for Environment.
:param n... | [
"def",
"edit_vlan",
"(",
"self",
",",
"environment_id",
",",
"name",
",",
"number",
",",
"description",
",",
"acl_file",
",",
"acl_file_v6",
",",
"id_vlan",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_vlan",
")",
":",
"raise",
"InvalidParameterError"... | Edit a VLAN
:param id_vlan: ID for Vlan
:param environment_id: ID for Environment.
:param name: The name of VLAN.
:param description: Some description to VLAN.
:param number: Number of Vlan
:param acl_file: Acl IPv4 File name to VLAN.
:param acl_file_v6: Acl IPv6... | [
"Edit",
"a",
"VLAN"
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Vlan.py#L364-L414 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/Vlan.py | Vlan.create_vlan | def create_vlan(self, id_vlan):
""" Set column 'ativada = 1'.
:param id_vlan: VLAN identifier.
:return: None
"""
vlan_map = dict()
vlan_map['vlan_id'] = id_vlan
code, xml = self.submit({'vlan': vlan_map}, 'PUT', 'vlan/create/')
return self.response(c... | python | def create_vlan(self, id_vlan):
""" Set column 'ativada = 1'.
:param id_vlan: VLAN identifier.
:return: None
"""
vlan_map = dict()
vlan_map['vlan_id'] = id_vlan
code, xml = self.submit({'vlan': vlan_map}, 'PUT', 'vlan/create/')
return self.response(c... | [
"def",
"create_vlan",
"(",
"self",
",",
"id_vlan",
")",
":",
"vlan_map",
"=",
"dict",
"(",
")",
"vlan_map",
"[",
"'vlan_id'",
"]",
"=",
"id_vlan",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"{",
"'vlan'",
":",
"vlan_map",
"}",
",",
"'PUT'",... | Set column 'ativada = 1'.
:param id_vlan: VLAN identifier.
:return: None | [
"Set",
"column",
"ativada",
"=",
"1",
"."
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Vlan.py#L416-L430 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/Vlan.py | Vlan.allocate_without_network | def allocate_without_network(self, environment_id, name, description, vrf=None):
"""Create new VLAN without add NetworkIPv4.
:param environment_id: ID for Environment.
:param name: The name of VLAN.
:param description: Some description to VLAN.
:return: Following dictionary:
... | python | def allocate_without_network(self, environment_id, name, description, vrf=None):
"""Create new VLAN without add NetworkIPv4.
:param environment_id: ID for Environment.
:param name: The name of VLAN.
:param description: Some description to VLAN.
:return: Following dictionary:
... | [
"def",
"allocate_without_network",
"(",
"self",
",",
"environment_id",
",",
"name",
",",
"description",
",",
"vrf",
"=",
"None",
")",
":",
"vlan_map",
"=",
"dict",
"(",
")",
"vlan_map",
"[",
"'environment_id'",
"]",
"=",
"environment_id",
"vlan_map",
"[",
"'... | Create new VLAN without add NetworkIPv4.
:param environment_id: ID for Environment.
:param name: The name of VLAN.
:param description: Some description to VLAN.
:return: Following dictionary:
::
{'vlan': {'id': < id_vlan >,
'nome': < nome_vlan >,
... | [
"Create",
"new",
"VLAN",
"without",
"add",
"NetworkIPv4",
"."
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Vlan.py#L432-L468 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/Vlan.py | Vlan.verificar_permissao | def verificar_permissao(self, id_vlan, nome_equipamento, nome_interface):
"""Check if there is communication permission for VLAN to trunk.
Run script 'configurador'.
The "stdout" key value of response dictionary is 1(one) if VLAN has permission,
or 0(zero), otherwise.
:param i... | python | def verificar_permissao(self, id_vlan, nome_equipamento, nome_interface):
"""Check if there is communication permission for VLAN to trunk.
Run script 'configurador'.
The "stdout" key value of response dictionary is 1(one) if VLAN has permission,
or 0(zero), otherwise.
:param i... | [
"def",
"verificar_permissao",
"(",
"self",
",",
"id_vlan",
",",
"nome_equipamento",
",",
"nome_interface",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_vlan",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'Vlan id is invalid or was not informed.'",
")",
... | Check if there is communication permission for VLAN to trunk.
Run script 'configurador'.
The "stdout" key value of response dictionary is 1(one) if VLAN has permission,
or 0(zero), otherwise.
:param id_vlan: VLAN identifier.
:param nome_equipamento: Equipment name.
:pa... | [
"Check",
"if",
"there",
"is",
"communication",
"permission",
"for",
"VLAN",
"to",
"trunk",
"."
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Vlan.py#L554-L596 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/Vlan.py | Vlan.buscar | def buscar(self, id_vlan):
"""Get VLAN by its identifier.
:param id_vlan: VLAN identifier.
:return: Following dictionary:
::
{'vlan': {'id': < id_vlan >,
'nome': < nome_vlan >,
'num_vlan': < num_vlan >,
'id_ambiente': < id_ambiente >,
... | python | def buscar(self, id_vlan):
"""Get VLAN by its identifier.
:param id_vlan: VLAN identifier.
:return: Following dictionary:
::
{'vlan': {'id': < id_vlan >,
'nome': < nome_vlan >,
'num_vlan': < num_vlan >,
'id_ambiente': < id_ambiente >,
... | [
"def",
"buscar",
"(",
"self",
",",
"id_vlan",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_vlan",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'Vlan id is invalid or was not informed.'",
")",
"url",
"=",
"'vlan/'",
"+",
"str",
"(",
"id_vlan",
")",... | Get VLAN by its identifier.
:param id_vlan: VLAN identifier.
:return: Following dictionary:
::
{'vlan': {'id': < id_vlan >,
'nome': < nome_vlan >,
'num_vlan': < num_vlan >,
'id_ambiente': < id_ambiente >,
'id_tipo_rede': < id_tipo_rede >,
... | [
"Get",
"VLAN",
"by",
"its",
"identifier",
"."
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Vlan.py#L598-L669 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/Vlan.py | Vlan.get | def get(self, id_vlan):
"""Get a VLAN by your primary key.
Network IPv4/IPv6 related will also be fetched.
:param id_vlan: ID for VLAN.
:return: Following dictionary:
::
{'vlan': {'id': < id_vlan >,
'nome': < nome_vlan >,
'num_vlan': < num_vlan >... | python | def get(self, id_vlan):
"""Get a VLAN by your primary key.
Network IPv4/IPv6 related will also be fetched.
:param id_vlan: ID for VLAN.
:return: Following dictionary:
::
{'vlan': {'id': < id_vlan >,
'nome': < nome_vlan >,
'num_vlan': < num_vlan >... | [
"def",
"get",
"(",
"self",
",",
"id_vlan",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_vlan",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'Parameter id_vlan is invalid. Value: '",
"+",
"id_vlan",
")",
"url",
"=",
"'vlan/'",
"+",
"str",
"(",
"i... | Get a VLAN by your primary key.
Network IPv4/IPv6 related will also be fetched.
:param id_vlan: ID for VLAN.
:return: Following dictionary:
::
{'vlan': {'id': < id_vlan >,
'nome': < nome_vlan >,
'num_vlan': < num_vlan >,
'id_ambiente': < id_amb... | [
"Get",
"a",
"VLAN",
"by",
"your",
"primary",
"key",
".",
"Network",
"IPv4",
"/",
"IPv6",
"related",
"will",
"also",
"be",
"fetched",
"."
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Vlan.py#L671-L711 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/Vlan.py | Vlan.listar_permissao | def listar_permissao(self, nome_equipamento, nome_interface):
"""List all VLANS having communication permission to trunk from a port in switch.
Run script 'configurador'.
::
The value of 'stdout' key of return dictionary can have a list of numbers or
number intervals of VL... | python | def listar_permissao(self, nome_equipamento, nome_interface):
"""List all VLANS having communication permission to trunk from a port in switch.
Run script 'configurador'.
::
The value of 'stdout' key of return dictionary can have a list of numbers or
number intervals of VL... | [
"def",
"listar_permissao",
"(",
"self",
",",
"nome_equipamento",
",",
"nome_interface",
")",
":",
"vlan_map",
"=",
"dict",
"(",
")",
"vlan_map",
"[",
"'nome'",
"]",
"=",
"nome_equipamento",
"vlan_map",
"[",
"'nome_interface'",
"]",
"=",
"nome_interface",
"code",... | List all VLANS having communication permission to trunk from a port in switch.
Run script 'configurador'.
::
The value of 'stdout' key of return dictionary can have a list of numbers or
number intervals of VLAN´s, comma separated. Examples of possible returns of 'stdout' below:
... | [
"List",
"all",
"VLANS",
"having",
"communication",
"permission",
"to",
"trunk",
"from",
"a",
"port",
"in",
"switch",
"."
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Vlan.py#L713-L752 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/Vlan.py | Vlan.create_ipv4 | def create_ipv4(self, id_network_ipv4):
"""Create VLAN in layer 2 using script 'navlan'.
:param id_network_ipv4: NetworkIPv4 ID.
:return: Following dictionary:
::
{‘sucesso’: {‘codigo’: < codigo >,
‘descricao’: {'stdout':< stdout >, 'stderr':< stderr >}}}
... | python | def create_ipv4(self, id_network_ipv4):
"""Create VLAN in layer 2 using script 'navlan'.
:param id_network_ipv4: NetworkIPv4 ID.
:return: Following dictionary:
::
{‘sucesso’: {‘codigo’: < codigo >,
‘descricao’: {'stdout':< stdout >, 'stderr':< stderr >}}}
... | [
"def",
"create_ipv4",
"(",
"self",
",",
"id_network_ipv4",
")",
":",
"url",
"=",
"'vlan/v4/create/'",
"vlan_map",
"=",
"dict",
"(",
")",
"vlan_map",
"[",
"'id_network_ip'",
"]",
"=",
"id_network_ipv4",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"... | Create VLAN in layer 2 using script 'navlan'.
:param id_network_ipv4: NetworkIPv4 ID.
:return: Following dictionary:
::
{‘sucesso’: {‘codigo’: < codigo >,
‘descricao’: {'stdout':< stdout >, 'stderr':< stderr >}}}
:raise NetworkIPv4NaoExisteError: NetworkIPv4 not ... | [
"Create",
"VLAN",
"in",
"layer",
"2",
"using",
"script",
"navlan",
"."
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Vlan.py#L786-L815 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/Vlan.py | Vlan.create_ipv6 | def create_ipv6(self, id_network_ipv6):
"""Create VLAN in layer 2 using script 'navlan'.
:param id_network_ipv6: NetworkIPv6 ID.
:return: Following dictionary:
::
{‘sucesso’: {‘codigo’: < codigo >,
‘descricao’: {'stdout':< stdout >, 'stderr':< stderr >}}}
... | python | def create_ipv6(self, id_network_ipv6):
"""Create VLAN in layer 2 using script 'navlan'.
:param id_network_ipv6: NetworkIPv6 ID.
:return: Following dictionary:
::
{‘sucesso’: {‘codigo’: < codigo >,
‘descricao’: {'stdout':< stdout >, 'stderr':< stderr >}}}
... | [
"def",
"create_ipv6",
"(",
"self",
",",
"id_network_ipv6",
")",
":",
"url",
"=",
"'vlan/v6/create/'",
"vlan_map",
"=",
"dict",
"(",
")",
"vlan_map",
"[",
"'id_network_ip'",
"]",
"=",
"id_network_ipv6",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"... | Create VLAN in layer 2 using script 'navlan'.
:param id_network_ipv6: NetworkIPv6 ID.
:return: Following dictionary:
::
{‘sucesso’: {‘codigo’: < codigo >,
‘descricao’: {'stdout':< stdout >, 'stderr':< stderr >}}}
:raise NetworkIPv6NaoExisteError: NetworkIPv6 not ... | [
"Create",
"VLAN",
"in",
"layer",
"2",
"using",
"script",
"navlan",
"."
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Vlan.py#L817-L846 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/Vlan.py | Vlan.apply_acl | def apply_acl(self, equipments, vlan, environment, network):
'''Apply the file acl in equipments
:param equipments: list of equipments
:param vlan: Vvlan
:param environment: Environment
:param network: v4 or v6
:raise Exception: Failed to apply acl
:return: Tru... | python | def apply_acl(self, equipments, vlan, environment, network):
'''Apply the file acl in equipments
:param equipments: list of equipments
:param vlan: Vvlan
:param environment: Environment
:param network: v4 or v6
:raise Exception: Failed to apply acl
:return: Tru... | [
"def",
"apply_acl",
"(",
"self",
",",
"equipments",
",",
"vlan",
",",
"environment",
",",
"network",
")",
":",
"vlan_map",
"=",
"dict",
"(",
")",
"vlan_map",
"[",
"'equipments'",
"]",
"=",
"equipments",
"vlan_map",
"[",
"'vlan'",
"]",
"=",
"vlan",
"vlan_... | Apply the file acl in equipments
:param equipments: list of equipments
:param vlan: Vvlan
:param environment: Environment
:param network: v4 or v6
:raise Exception: Failed to apply acl
:return: True case Apply and sysout of script | [
"Apply",
"the",
"file",
"acl",
"in",
"equipments"
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Vlan.py#L848-L871 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/Vlan.py | Vlan.confirm_vlan | def confirm_vlan(self, number_net, id_environment_vlan, ip_version=None):
"""Checking if the vlan insert need to be confirmed
:param number_net: Filter by vlan number column
:param id_environment_vlan: Filter by environment ID related
:param ip_version: Ip version for checking
... | python | def confirm_vlan(self, number_net, id_environment_vlan, ip_version=None):
"""Checking if the vlan insert need to be confirmed
:param number_net: Filter by vlan number column
:param id_environment_vlan: Filter by environment ID related
:param ip_version: Ip version for checking
... | [
"def",
"confirm_vlan",
"(",
"self",
",",
"number_net",
",",
"id_environment_vlan",
",",
"ip_version",
"=",
"None",
")",
":",
"url",
"=",
"'vlan/confirm/'",
"+",
"str",
"(",
"number_net",
")",
"+",
"'/'",
"+",
"id_environment_vlan",
"+",
"'/'",
"+",
"str",
... | Checking if the vlan insert need to be confirmed
:param number_net: Filter by vlan number column
:param id_environment_vlan: Filter by environment ID related
:param ip_version: Ip version for checking
:return: True is need confirmation, False if no need
:raise AmbienteNaoExist... | [
"Checking",
"if",
"the",
"vlan",
"insert",
"need",
"to",
"be",
"confirmed"
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Vlan.py#L873-L893 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/Vlan.py | Vlan.check_number_available | def check_number_available(self, id_environment, num_vlan, id_vlan):
"""Checking if environment has a number vlan available
:param id_environment: Identifier of environment
:param num_vlan: Vlan number
:param id_vlan: Vlan indentifier (False if inserting a vlan)
:return: True i... | python | def check_number_available(self, id_environment, num_vlan, id_vlan):
"""Checking if environment has a number vlan available
:param id_environment: Identifier of environment
:param num_vlan: Vlan number
:param id_vlan: Vlan indentifier (False if inserting a vlan)
:return: True i... | [
"def",
"check_number_available",
"(",
"self",
",",
"id_environment",
",",
"num_vlan",
",",
"id_vlan",
")",
":",
"url",
"=",
"'vlan/check_number_available/'",
"+",
"str",
"(",
"id_environment",
")",
"+",
"'/'",
"+",
"str",
"(",
"num_vlan",
")",
"+",
"'/'",
"+... | Checking if environment has a number vlan available
:param id_environment: Identifier of environment
:param num_vlan: Vlan number
:param id_vlan: Vlan indentifier (False if inserting a vlan)
:return: True is has number available, False if hasn't
:raise AmbienteNaoExisteError: ... | [
"Checking",
"if",
"environment",
"has",
"a",
"number",
"vlan",
"available"
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Vlan.py#L895-L916 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/Vlan.py | Vlan.validar | def validar(self, id_vlan):
"""Validates ACL - IPv4 of VLAN from its identifier.
Assigns 1 to 'acl_valida'.
:param id_vlan: Identifier of the Vlan. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: Vlan identifier is null and invalid.
:r... | python | def validar(self, id_vlan):
"""Validates ACL - IPv4 of VLAN from its identifier.
Assigns 1 to 'acl_valida'.
:param id_vlan: Identifier of the Vlan. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: Vlan identifier is null and invalid.
:r... | [
"def",
"validar",
"(",
"self",
",",
"id_vlan",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_vlan",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'The identifier of Vlan is invalid or was not informed.'",
")",
"url",
"=",
"'vlan/'",
"+",
"str",
"(",
"... | Validates ACL - IPv4 of VLAN from its identifier.
Assigns 1 to 'acl_valida'.
:param id_vlan: Identifier of the Vlan. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: Vlan identifier is null and invalid.
:raise VlanNaoExisteError: Vlan not regis... | [
"Validates",
"ACL",
"-",
"IPv4",
"of",
"VLAN",
"from",
"its",
"identifier",
"."
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Vlan.py#L918-L941 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/Vlan.py | Vlan.validate_ipv6 | def validate_ipv6(self, id_vlan):
"""Validates ACL - IPv6 of VLAN from its identifier.
Assigns 1 to 'acl_valida_v6'.
:param id_vlan: Identifier of the Vlan. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: Vlan identifier is null and invalid.
... | python | def validate_ipv6(self, id_vlan):
"""Validates ACL - IPv6 of VLAN from its identifier.
Assigns 1 to 'acl_valida_v6'.
:param id_vlan: Identifier of the Vlan. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: Vlan identifier is null and invalid.
... | [
"def",
"validate_ipv6",
"(",
"self",
",",
"id_vlan",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_vlan",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'The identifier of Vlan is invalid or was not informed.'",
")",
"url",
"=",
"'vlan/'",
"+",
"str",
"(... | Validates ACL - IPv6 of VLAN from its identifier.
Assigns 1 to 'acl_valida_v6'.
:param id_vlan: Identifier of the Vlan. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: Vlan identifier is null and invalid.
:raise VlanNaoExisteError: Vlan not re... | [
"Validates",
"ACL",
"-",
"IPv6",
"of",
"VLAN",
"from",
"its",
"identifier",
"."
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Vlan.py#L943-L966 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/Vlan.py | Vlan.remove | def remove(self, id_vlan):
"""Remove a VLAN by your primary key.
Execute script to remove VLAN
:param id_vlan: ID for VLAN.
:return: Following dictionary:
::
{‘sucesso’: {‘codigo’: < codigo >,
‘descricao’: {'stdout':< stdout >, 'stderr':< stderr >}}}
... | python | def remove(self, id_vlan):
"""Remove a VLAN by your primary key.
Execute script to remove VLAN
:param id_vlan: ID for VLAN.
:return: Following dictionary:
::
{‘sucesso’: {‘codigo’: < codigo >,
‘descricao’: {'stdout':< stdout >, 'stderr':< stderr >}}}
... | [
"def",
"remove",
"(",
"self",
",",
"id_vlan",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_vlan",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'Parameter id_vlan is invalid. Value: '",
"+",
"id_vlan",
")",
"url",
"=",
"'vlan/'",
"+",
"str",
"(",
... | Remove a VLAN by your primary key.
Execute script to remove VLAN
:param id_vlan: ID for VLAN.
:return: Following dictionary:
::
{‘sucesso’: {‘codigo’: < codigo >,
‘descricao’: {'stdout':< stdout >, 'stderr':< stderr >}}}
:raise InvalidParameterError: Iden... | [
"Remove",
"a",
"VLAN",
"by",
"your",
"primary",
"key",
".",
"Execute",
"script",
"to",
"remove",
"VLAN"
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Vlan.py#L968-L996 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/Vlan.py | Vlan.deallocate | def deallocate(self, id_vlan):
"""Deallocate all relationships between Vlan.
:param id_vlan: Identifier of the VLAN. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: VLAN identifier is null and invalid.
:raise VlanError: VLAN is active.
... | python | def deallocate(self, id_vlan):
"""Deallocate all relationships between Vlan.
:param id_vlan: Identifier of the VLAN. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: VLAN identifier is null and invalid.
:raise VlanError: VLAN is active.
... | [
"def",
"deallocate",
"(",
"self",
",",
"id_vlan",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_vlan",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'The identifier of Vlan is invalid or was not informed.'",
")",
"url",
"=",
"'vlan/'",
"+",
"str",
"(",
... | Deallocate all relationships between Vlan.
:param id_vlan: Identifier of the VLAN. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: VLAN identifier is null and invalid.
:raise VlanError: VLAN is active.
:raise VlanNaoExisteError: VLAN not found.... | [
"Deallocate",
"all",
"relationships",
"between",
"Vlan",
"."
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Vlan.py#L998-L1020 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/Vlan.py | Vlan.allocate_IPv6 | def allocate_IPv6(
self,
name,
id_network_type,
id_environment,
description,
id_environment_vip=None):
"""Inserts a new VLAN.
:param name: Name of Vlan. String with a maximum of 50 characters.
:param id_network_type: Identi... | python | def allocate_IPv6(
self,
name,
id_network_type,
id_environment,
description,
id_environment_vip=None):
"""Inserts a new VLAN.
:param name: Name of Vlan. String with a maximum of 50 characters.
:param id_network_type: Identi... | [
"def",
"allocate_IPv6",
"(",
"self",
",",
"name",
",",
"id_network_type",
",",
"id_environment",
",",
"description",
",",
"id_environment_vip",
"=",
"None",
")",
":",
"vlan_map",
"=",
"dict",
"(",
")",
"vlan_map",
"[",
"'name'",
"]",
"=",
"name",
"vlan_map",... | Inserts a new VLAN.
:param name: Name of Vlan. String with a maximum of 50 characters.
:param id_network_type: Identifier of the Netwok Type. Integer value and greater than zero.
:param id_environment: Identifier of the Environment. Integer value and greater than zero.
:param descriptio... | [
"Inserts",
"a",
"new",
"VLAN",
"."
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Vlan.py#L1022-L1091 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/Vlan.py | Vlan.create_script_acl | def create_script_acl(self, id_vlan, network_type):
'''Generate the script acl
:param id_vlan: Vlan Id
:param network_type: v4 or v6
:raise InvalidValueError: Attrs invalids.
:raise XMLError: Networkapi failed to generate the XML response.
:raise VlanACLDuplicatedError:... | python | def create_script_acl(self, id_vlan, network_type):
'''Generate the script acl
:param id_vlan: Vlan Id
:param network_type: v4 or v6
:raise InvalidValueError: Attrs invalids.
:raise XMLError: Networkapi failed to generate the XML response.
:raise VlanACLDuplicatedError:... | [
"def",
"create_script_acl",
"(",
"self",
",",
"id_vlan",
",",
"network_type",
")",
":",
"vlan_map",
"=",
"dict",
"(",
")",
"vlan_map",
"[",
"'id_vlan'",
"]",
"=",
"id_vlan",
"vlan_map",
"[",
"'network_type'",
"]",
"=",
"network_type",
"url",
"=",
"'vlan/crea... | Generate the script acl
:param id_vlan: Vlan Id
:param network_type: v4 or v6
:raise InvalidValueError: Attrs invalids.
:raise XMLError: Networkapi failed to generate the XML response.
:raise VlanACLDuplicatedError: ACL name duplicate.
:raise VlanNotFoundError: Vlan not... | [
"Generate",
"the",
"script",
"acl"
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Vlan.py#L1132-L1171 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/UsuarioGrupo.py | UsuarioGrupo.inserir | def inserir(self, id_user, id_group):
"""Create a relationship between User and Group.
:param id_user: Identifier of the User. Integer value and greater than zero.
:param id_group: Identifier of the Group. Integer value and greater than zero.
:return: Dictionary with the following stru... | python | def inserir(self, id_user, id_group):
"""Create a relationship between User and Group.
:param id_user: Identifier of the User. Integer value and greater than zero.
:param id_group: Identifier of the Group. Integer value and greater than zero.
:return: Dictionary with the following stru... | [
"def",
"inserir",
"(",
"self",
",",
"id_user",
",",
"id_group",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_user",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'The identifier of User is invalid or was not informed.'",
")",
"if",
"not",
"is_valid_int_p... | Create a relationship between User and Group.
:param id_user: Identifier of the User. Integer value and greater than zero.
:param id_group: Identifier of the Group. Integer value and greater than zero.
:return: Dictionary with the following structure:
::
{'user_group': {'i... | [
"Create",
"a",
"relationship",
"between",
"User",
"and",
"Group",
"."
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/UsuarioGrupo.py#L38-L67 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/xml_utils.py | dumps | def dumps(map, root_name, root_attributes=None):
"""Cria um string no formato XML a partir dos elementos do map.
Os elementos do mapa serão nós filhos do root_name.
Cada chave do map será um Nó no XML. E o valor da chave será o conteúdo do Nó.
Exemplos:
::
- Mapa: {'networkapi':1}
... | python | def dumps(map, root_name, root_attributes=None):
"""Cria um string no formato XML a partir dos elementos do map.
Os elementos do mapa serão nós filhos do root_name.
Cada chave do map será um Nó no XML. E o valor da chave será o conteúdo do Nó.
Exemplos:
::
- Mapa: {'networkapi':1}
... | [
"def",
"dumps",
"(",
"map",
",",
"root_name",
",",
"root_attributes",
"=",
"None",
")",
":",
"xml",
"=",
"''",
"try",
":",
"implementation",
"=",
"getDOMImplementation",
"(",
")",
"except",
"ImportError",
"as",
"i",
":",
"raise",
"XMLErrorUtils",
"(",
"i",... | Cria um string no formato XML a partir dos elementos do map.
Os elementos do mapa serão nós filhos do root_name.
Cada chave do map será um Nó no XML. E o valor da chave será o conteúdo do Nó.
Exemplos:
::
- Mapa: {'networkapi':1}
XML: <?xml version="1.0" encoding="UTF-8"?>&l... | [
"Cria",
"um",
"string",
"no",
"formato",
"XML",
"a",
"partir",
"dos",
"elementos",
"do",
"map",
"."
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/xml_utils.py#L106-L191 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/xml_utils.py | loads | def loads(xml, force_list=None):
"""Cria um dicionário com os dados do XML.
O dicionário terá como chave o nome do nó root e como valor o conteúdo do nó root.
Quando o conteúdo de um nó é uma lista de nós então o valor do nó será
um dicionário com uma chave para cada nó.
Entretanto, se existir nós,... | python | def loads(xml, force_list=None):
"""Cria um dicionário com os dados do XML.
O dicionário terá como chave o nome do nó root e como valor o conteúdo do nó root.
Quando o conteúdo de um nó é uma lista de nós então o valor do nó será
um dicionário com uma chave para cada nó.
Entretanto, se existir nós,... | [
"def",
"loads",
"(",
"xml",
",",
"force_list",
"=",
"None",
")",
":",
"if",
"force_list",
"is",
"None",
":",
"force_list",
"=",
"[",
"]",
"try",
":",
"xml",
"=",
"remove_illegal_characters",
"(",
"xml",
")",
"doc",
"=",
"parseString",
"(",
"xml",
")",
... | Cria um dicionário com os dados do XML.
O dicionário terá como chave o nome do nó root e como valor o conteúdo do nó root.
Quando o conteúdo de um nó é uma lista de nós então o valor do nó será
um dicionário com uma chave para cada nó.
Entretanto, se existir nós, de um mesmo pai, com o mesmo nome, entã... | [
"Cria",
"um",
"dicionário",
"com",
"os",
"dados",
"do",
"XML",
"."
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/xml_utils.py#L261-L330 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiOptionVip.py | ApiOptionVip.option_vip_by_environment_vip_type | def option_vip_by_environment_vip_type(self, environment_vip_id, type_option):
"""
List option vip.
param environment_vip_id: Id of Environment Vip
Param type_option: type option vip
"""
uri = "api/v3/option-vip/environment-vip/%s/type-option/%s/" % (environment_vip_id, ... | python | def option_vip_by_environment_vip_type(self, environment_vip_id, type_option):
"""
List option vip.
param environment_vip_id: Id of Environment Vip
Param type_option: type option vip
"""
uri = "api/v3/option-vip/environment-vip/%s/type-option/%s/" % (environment_vip_id, ... | [
"def",
"option_vip_by_environment_vip_type",
"(",
"self",
",",
"environment_vip_id",
",",
"type_option",
")",
":",
"uri",
"=",
"\"api/v3/option-vip/environment-vip/%s/type-option/%s/\"",
"%",
"(",
"environment_vip_id",
",",
"type_option",
")",
"return",
"self",
".",
"get"... | List option vip.
param environment_vip_id: Id of Environment Vip
Param type_option: type option vip | [
"List",
"option",
"vip",
".",
"param",
"environment_vip_id",
":",
"Id",
"of",
"Environment",
"Vip",
"Param",
"type_option",
":",
"type",
"option",
"vip"
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiOptionVip.py#L36-L45 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiV4Neighbor.py | ApiV4Neighbor.search | def search(self, **kwargs):
"""
Method to search neighbors based on extends search.
:param search: Dict containing QuerySets to find neighbors.
:param include: Array containing fields to include on response.
:param exclude: Array containing fields to exclude on response.
... | python | def search(self, **kwargs):
"""
Method to search neighbors based on extends search.
:param search: Dict containing QuerySets to find neighbors.
:param include: Array containing fields to include on response.
:param exclude: Array containing fields to exclude on response.
... | [
"def",
"search",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"super",
"(",
"ApiV4Neighbor",
",",
"self",
")",
".",
"get",
"(",
"self",
".",
"prepare_url",
"(",
"'api/v4/neighbor/'",
",",
"kwargs",
")",
")"
] | Method to search neighbors based on extends search.
:param search: Dict containing QuerySets to find neighbors.
:param include: Array containing fields to include on response.
:param exclude: Array containing fields to exclude on response.
:param fields: Array containing fields to over... | [
"Method",
"to",
"search",
"neighbors",
"based",
"on",
"extends",
"search",
"."
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiV4Neighbor.py#L36-L49 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiV4Neighbor.py | ApiV4Neighbor.delete | def delete(self, ids):
"""
Method to delete neighbors by their id's
:param ids: Identifiers of neighbors
:return: None
"""
url = build_uri_with_ids('api/v4/neighbor/%s/', ids)
return super(ApiV4Neighbor, self).delete(url) | python | def delete(self, ids):
"""
Method to delete neighbors by their id's
:param ids: Identifiers of neighbors
:return: None
"""
url = build_uri_with_ids('api/v4/neighbor/%s/', ids)
return super(ApiV4Neighbor, self).delete(url) | [
"def",
"delete",
"(",
"self",
",",
"ids",
")",
":",
"url",
"=",
"build_uri_with_ids",
"(",
"'api/v4/neighbor/%s/'",
",",
"ids",
")",
"return",
"super",
"(",
"ApiV4Neighbor",
",",
"self",
")",
".",
"delete",
"(",
"url",
")"
] | Method to delete neighbors by their id's
:param ids: Identifiers of neighbors
:return: None | [
"Method",
"to",
"delete",
"neighbors",
"by",
"their",
"id",
"s"
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiV4Neighbor.py#L65-L73 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiV4Neighbor.py | ApiV4Neighbor.update | def update(self, neighbors):
"""
Method to update neighbors
:param neighbors: List containing neighbors desired to updated
:return: None
"""
data = {'neighbors': neighbors}
neighbors_ids = [str(env.get('id')) for env in neighbors]
return super(ApiV4Neig... | python | def update(self, neighbors):
"""
Method to update neighbors
:param neighbors: List containing neighbors desired to updated
:return: None
"""
data = {'neighbors': neighbors}
neighbors_ids = [str(env.get('id')) for env in neighbors]
return super(ApiV4Neig... | [
"def",
"update",
"(",
"self",
",",
"neighbors",
")",
":",
"data",
"=",
"{",
"'neighbors'",
":",
"neighbors",
"}",
"neighbors_ids",
"=",
"[",
"str",
"(",
"env",
".",
"get",
"(",
"'id'",
")",
")",
"for",
"env",
"in",
"neighbors",
"]",
"return",
"super"... | Method to update neighbors
:param neighbors: List containing neighbors desired to updated
:return: None | [
"Method",
"to",
"update",
"neighbors"
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiV4Neighbor.py#L75-L87 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiV4Neighbor.py | ApiV4Neighbor.create | def create(self, neighbors):
"""
Method to create neighbors
:param neighbors: List containing neighbors desired to be created on database
:return: None
"""
data = {'neighbors': neighbors}
return super(ApiV4Neighbor, self).post('api/v4/neighbor/', data) | python | def create(self, neighbors):
"""
Method to create neighbors
:param neighbors: List containing neighbors desired to be created on database
:return: None
"""
data = {'neighbors': neighbors}
return super(ApiV4Neighbor, self).post('api/v4/neighbor/', data) | [
"def",
"create",
"(",
"self",
",",
"neighbors",
")",
":",
"data",
"=",
"{",
"'neighbors'",
":",
"neighbors",
"}",
"return",
"super",
"(",
"ApiV4Neighbor",
",",
"self",
")",
".",
"post",
"(",
"'api/v4/neighbor/'",
",",
"data",
")"
] | Method to create neighbors
:param neighbors: List containing neighbors desired to be created on database
:return: None | [
"Method",
"to",
"create",
"neighbors"
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiV4Neighbor.py#L89-L98 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/EspecificacaoGrupoVirtual.py | EspecificacaoGrupoVirtual.add_equipamento | def add_equipamento(
self,
id_tipo_equipamento,
id_modelo,
prefixo,
id_grupo,
id_vlan,
descricao_vlan):
"""Adiciona um equipamento na lista de equipamentos para operação de inserir/alterar um grupo virtual.
:param id_ti... | python | def add_equipamento(
self,
id_tipo_equipamento,
id_modelo,
prefixo,
id_grupo,
id_vlan,
descricao_vlan):
"""Adiciona um equipamento na lista de equipamentos para operação de inserir/alterar um grupo virtual.
:param id_ti... | [
"def",
"add_equipamento",
"(",
"self",
",",
"id_tipo_equipamento",
",",
"id_modelo",
",",
"prefixo",
",",
"id_grupo",
",",
"id_vlan",
",",
"descricao_vlan",
")",
":",
"equipamento_map",
"=",
"dict",
"(",
")",
"equipamento_map",
"[",
"'id_tipo_equipamento'",
"]",
... | Adiciona um equipamento na lista de equipamentos para operação de inserir/alterar um grupo virtual.
:param id_tipo_equipamento: Identificador do tipo de equipamento.
:param id_modelo: Identificador do modelo do equipamento.
:param prefixo: Prefixo do nome do equipamento.
:param id_grupo... | [
"Adiciona",
"um",
"equipamento",
"na",
"lista",
"de",
"equipamentos",
"para",
"operação",
"de",
"inserir",
"/",
"alterar",
"um",
"grupo",
"virtual",
"."
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/EspecificacaoGrupoVirtual.py#L32-L62 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/EspecificacaoGrupoVirtual.py | EspecificacaoGrupoVirtual.add_equipamento_remove | def add_equipamento_remove(self, id, id_ip, ids_ips_vips):
'''Adiciona um equipamento na lista de equipamentos para operação de remover um grupo virtual.
:param id: Identificador do equipamento.
:param id_ip: Identificador do IP do equipamento.
:param ids_ips_vips: Lista com os identifi... | python | def add_equipamento_remove(self, id, id_ip, ids_ips_vips):
'''Adiciona um equipamento na lista de equipamentos para operação de remover um grupo virtual.
:param id: Identificador do equipamento.
:param id_ip: Identificador do IP do equipamento.
:param ids_ips_vips: Lista com os identifi... | [
"def",
"add_equipamento_remove",
"(",
"self",
",",
"id",
",",
"id_ip",
",",
"ids_ips_vips",
")",
":",
"equipament_map",
"=",
"dict",
"(",
")",
"equipament_map",
"[",
"'id'",
"]",
"=",
"id",
"equipament_map",
"[",
"'id_ip'",
"]",
"=",
"id_ip",
"equipament_map... | Adiciona um equipamento na lista de equipamentos para operação de remover um grupo virtual.
:param id: Identificador do equipamento.
:param id_ip: Identificador do IP do equipamento.
:param ids_ips_vips: Lista com os identificadores de IPs criados para cada VIP e associados ao
equip... | [
"Adiciona",
"um",
"equipamento",
"na",
"lista",
"de",
"equipamentos",
"para",
"operação",
"de",
"remover",
"um",
"grupo",
"virtual",
"."
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/EspecificacaoGrupoVirtual.py#L64-L79 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/EspecificacaoGrupoVirtual.py | EspecificacaoGrupoVirtual.add_vip | def add_vip(
self,
id,
real_name_sufixo,
id_vlan,
descricao_vlan,
id_vlan_real,
descricao_vlan_real,
balanceadores,
id_healthcheck_expect,
finalidade,
cliente,
ambiente,
... | python | def add_vip(
self,
id,
real_name_sufixo,
id_vlan,
descricao_vlan,
id_vlan_real,
descricao_vlan_real,
balanceadores,
id_healthcheck_expect,
finalidade,
cliente,
ambiente,
... | [
"def",
"add_vip",
"(",
"self",
",",
"id",
",",
"real_name_sufixo",
",",
"id_vlan",
",",
"descricao_vlan",
",",
"id_vlan_real",
",",
"descricao_vlan_real",
",",
"balanceadores",
",",
"id_healthcheck_expect",
",",
"finalidade",
",",
"cliente",
",",
"ambiente",
",",
... | Adiciona um VIP na lista de VIPs para operação de inserir/alterar um grupo virtual.
Os parâmetros abaixo somente são necessários para a operação de alteração:
- 'real_maps': Deverá conter os reals atualmente criados para a requisição de VIP.
- 'id_requisicao_vip': O identificador da re... | [
"Adiciona",
"um",
"VIP",
"na",
"lista",
"de",
"VIPs",
"para",
"operação",
"de",
"inserir",
"/",
"alterar",
"um",
"grupo",
"virtual",
"."
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/EspecificacaoGrupoVirtual.py#L81-L207 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/EspecificacaoGrupoVirtual.py | EspecificacaoGrupoVirtual.add_vip_remove | def add_vip_remove(self, id_ip, id_equipamentos):
'''Adiciona um VIP na lista de VIPs para operação de remover um grupo virtual.
:param id_ip: Identificador do IP criado para o VIP.
:param id_equipamentos: Lista com os identificadores dos balanceadores associados ao IP do VIP.
:return:... | python | def add_vip_remove(self, id_ip, id_equipamentos):
'''Adiciona um VIP na lista de VIPs para operação de remover um grupo virtual.
:param id_ip: Identificador do IP criado para o VIP.
:param id_equipamentos: Lista com os identificadores dos balanceadores associados ao IP do VIP.
:return:... | [
"def",
"add_vip_remove",
"(",
"self",
",",
"id_ip",
",",
"id_equipamentos",
")",
":",
"vip_map",
"=",
"dict",
"(",
")",
"vip_map",
"[",
"'id_ip'",
"]",
"=",
"id_ip",
"vip_map",
"[",
"'balanceadores'",
"]",
"=",
"{",
"'id_equipamento'",
":",
"id_equipamentos"... | Adiciona um VIP na lista de VIPs para operação de remover um grupo virtual.
:param id_ip: Identificador do IP criado para o VIP.
:param id_equipamentos: Lista com os identificadores dos balanceadores associados ao IP do VIP.
:return: None | [
"Adiciona",
"um",
"VIP",
"na",
"lista",
"de",
"VIPs",
"para",
"operação",
"de",
"remover",
"um",
"grupo",
"virtual",
"."
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/EspecificacaoGrupoVirtual.py#L209-L221 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/EspecificacaoGrupoVirtual.py | EspecificacaoGrupoVirtual.add_vip_incremento | def add_vip_incremento(self, id):
"""Adiciona um vip à especificação do grupo virtual.
:param id: Identificador de referencia do VIP.
"""
vip_map = dict()
vip_map['id'] = id
self.lista_vip.append(vip_map) | python | def add_vip_incremento(self, id):
"""Adiciona um vip à especificação do grupo virtual.
:param id: Identificador de referencia do VIP.
"""
vip_map = dict()
vip_map['id'] = id
self.lista_vip.append(vip_map) | [
"def",
"add_vip_incremento",
"(",
"self",
",",
"id",
")",
":",
"vip_map",
"=",
"dict",
"(",
")",
"vip_map",
"[",
"'id'",
"]",
"=",
"id",
"self",
".",
"lista_vip",
".",
"append",
"(",
"vip_map",
")"
] | Adiciona um vip à especificação do grupo virtual.
:param id: Identificador de referencia do VIP. | [
"Adiciona",
"um",
"vip",
"à",
"especificação",
"do",
"grupo",
"virtual",
"."
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/EspecificacaoGrupoVirtual.py#L223-L232 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/EquipamentoAcesso.py | EquipamentoAcesso.get_access | def get_access(self, id_access):
"""Get Equipment Access by id.
:return: Dictionary with following:
::
{'equipamento_acesso':
{'id_equipamento': < id_equipamento >,
'fqdn': < fqdn >,
'user': < user >,
'pass': < pass >,
'i... | python | def get_access(self, id_access):
"""Get Equipment Access by id.
:return: Dictionary with following:
::
{'equipamento_acesso':
{'id_equipamento': < id_equipamento >,
'fqdn': < fqdn >,
'user': < user >,
'pass': < pass >,
'i... | [
"def",
"get_access",
"(",
"self",
",",
"id_access",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_access",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'Equipment Access ID is invalid.'",
")",
"url",
"=",
"'equipamentoacesso/id/'",
"+",
"str",
"(",
"... | Get Equipment Access by id.
:return: Dictionary with following:
::
{'equipamento_acesso':
{'id_equipamento': < id_equipamento >,
'fqdn': < fqdn >,
'user': < user >,
'pass': < pass >,
'id_tipo_acesso': < id_tipo_acesso >,
... | [
"Get",
"Equipment",
"Access",
"by",
"id",
"."
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/EquipamentoAcesso.py#L38-L61 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/EquipamentoAcesso.py | EquipamentoAcesso.list_by_equip | def list_by_equip(self, name):
"""
List all equipment access by equipment name
:return: Dictionary with the following structure:
::
{‘equipamento_acesso’:[ {'id': <id_equiptos_access>,
'equipamento': <id_equip>,
'fqdn': <fqdn>,
'user': <... | python | def list_by_equip(self, name):
"""
List all equipment access by equipment name
:return: Dictionary with the following structure:
::
{‘equipamento_acesso’:[ {'id': <id_equiptos_access>,
'equipamento': <id_equip>,
'fqdn': <fqdn>,
'user': <... | [
"def",
"list_by_equip",
"(",
"self",
",",
"name",
")",
":",
"equip_access_map",
"=",
"dict",
"(",
")",
"equip_access_map",
"[",
"'name'",
"]",
"=",
"name",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"{",
"\"equipamento_acesso\"",
":",
"equip_acce... | List all equipment access by equipment name
:return: Dictionary with the following structure:
::
{‘equipamento_acesso’:[ {'id': <id_equiptos_access>,
'equipamento': <id_equip>,
'fqdn': <fqdn>,
'user': <user>,
'password': <pass>
'... | [
"List",
"all",
"equipment",
"access",
"by",
"equipment",
"name"
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/EquipamentoAcesso.py#L92-L120 | train |
globocom/GloboNetworkAPI-client-python | networkapiclient/EquipamentoAcesso.py | EquipamentoAcesso.inserir | def inserir(
self,
id_equipamento,
fqdn,
user,
password,
id_tipo_acesso,
enable_pass):
"""Add new relationship between equipment and access type and returns its id.
:param id_equipamento: Equipment identifier.
:... | python | def inserir(
self,
id_equipamento,
fqdn,
user,
password,
id_tipo_acesso,
enable_pass):
"""Add new relationship between equipment and access type and returns its id.
:param id_equipamento: Equipment identifier.
:... | [
"def",
"inserir",
"(",
"self",
",",
"id_equipamento",
",",
"fqdn",
",",
"user",
",",
"password",
",",
"id_tipo_acesso",
",",
"enable_pass",
")",
":",
"equipamento_acesso_map",
"=",
"dict",
"(",
")",
"equipamento_acesso_map",
"[",
"'id_equipamento'",
"]",
"=",
... | Add new relationship between equipment and access type and returns its id.
:param id_equipamento: Equipment identifier.
:param fqdn: Equipment FQDN.
:param user: User.
:param password: Password.
:param id_tipo_acesso: Access Type identifier.
:param enable_pass: Enable ac... | [
"Add",
"new",
"relationship",
"between",
"equipment",
"and",
"access",
"type",
"and",
"returns",
"its",
"id",
"."
] | cf34f913da48d9abbf750114f5d2ac4b2dde137d | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/EquipamentoAcesso.py#L122-L160 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.