hexsha stringlengths 40 40 | repo stringlengths 7 114 | path stringlengths 4 124 | license listlengths 1 9 | language stringclasses 1
value | identifier stringlengths 1 71 | return_type stringlengths 1 749 ⌀ | original_string stringlengths 76 22.7k | original_docstring stringlengths 16 7.61k | docstring stringlengths 16 2.47k | docstring_tokens listlengths 6 477 | code stringlengths 14 10.2k | code_tokens listlengths 6 996 | short_docstring stringlengths 2 644 | short_docstring_tokens listlengths 1 116 | comment listlengths 1 89 | parameters listlengths 0 64 | docstring_params dict |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2e0385b57a710915d543bcf7ecd054ea0bca9836 | saintlyzero/aerich | aerich/migrate.py | [
"Apache-2.0"
] | Python | write_old_models | null | def write_old_models(cls, config: dict, app: str, location: str):
"""
write new models to old models
:param config:
:param app:
:param location:
:return:
"""
cls.app = app
old_model_files = []
models = config.get("apps").get(app).get("mode... |
write new models to old models
:param config:
:param app:
:param location:
:return:
| write new models to old models | [
"write",
"new",
"models",
"to",
"old",
"models"
] | def write_old_models(cls, config: dict, app: str, location: str):
cls.app = app
old_model_files = []
models = config.get("apps").get(app).get("models")
for model in models:
old_model_files.append(import_module(model).__file__)
cls.cp_models(app, old_model_files, os.pa... | [
"def",
"write_old_models",
"(",
"cls",
",",
"config",
":",
"dict",
",",
"app",
":",
"str",
",",
"location",
":",
"str",
")",
":",
"cls",
".",
"app",
"=",
"app",
"old_model_files",
"=",
"[",
"]",
"models",
"=",
"config",
".",
"get",
"(",
"\"apps\"",
... | write new models to old models | [
"write",
"new",
"models",
"to",
"old",
"models"
] | [
"\"\"\"\n write new models to old models\n :param config:\n :param app:\n :param location:\n :return:\n \"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "config",
"type": "dict"
},
{
"param": "app",
"type": "str"
},
{
"param": "location",
"type": "str"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
0397bc5dc3af8bd252e443b9ffe7d646331a23da | aspect-build/bazelcon-21 | bazel/rules/swc.bzl | [
"MIT"
] | Python | swc_compile | null | def swc_compile(name, swcrc, **kwargs):
"""Wrapper macro around the swc cli to compile a folder
Args:
name: name
swcrc: swcrc
**kwargs: **kwargs
"""
args = kwargs.pop("args", [])
args = [
"--no-swcrc",
"--source-maps",
"--config-file",
"%s/$(e... | Wrapper macro around the swc cli to compile a folder
Args:
name: name
swcrc: swcrc
**kwargs: **kwargs
| Wrapper macro around the swc cli to compile a folder | [
"Wrapper",
"macro",
"around",
"the",
"swc",
"cli",
"to",
"compile",
"a",
"folder"
] | def swc_compile(name, swcrc, **kwargs):
args = kwargs.pop("args", [])
args = [
"--no-swcrc",
"--source-maps",
"--config-file",
"%s/$(execpath %s)" % (path_to_workspace_root(), swcrc),
"--out-dir",
"%s/$(@D)" % path_to_workspace_root(),
] + args
data = kwar... | [
"def",
"swc_compile",
"(",
"name",
",",
"swcrc",
",",
"**",
"kwargs",
")",
":",
"args",
"=",
"kwargs",
".",
"pop",
"(",
"\"args\"",
",",
"[",
"]",
")",
"args",
"=",
"[",
"\"--no-swcrc\"",
",",
"\"--source-maps\"",
",",
"\"--config-file\"",
",",
"\"%s/$(e... | Wrapper macro around the swc cli to compile a folder | [
"Wrapper",
"macro",
"around",
"the",
"swc",
"cli",
"to",
"compile",
"a",
"folder"
] | [
"\"\"\"Wrapper macro around the swc cli to compile a folder\n\n Args:\n name: name\n swcrc: swcrc\n **kwargs: **kwargs\n \"\"\""
] | [
{
"param": "name",
"type": null
},
{
"param": "swcrc",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
"is_optional": null
},
{
"identifier": "swcrc",
"type": null,
"docstring": null,
... |
0397bc5dc3af8bd252e443b9ffe7d646331a23da | aspect-build/bazelcon-21 | bazel/rules/swc.bzl | [
"MIT"
] | Python | swc_bundle | null | def swc_bundle(name, entry, out, **kwargs):
"""Wrapper macro around the swc cli to bundle a folder
Args:
name: name
entry: entry
out: out
**kwargs: **kwargs
"""
args = kwargs.pop("args", [])
args = [
# --entry is parsed out by custom tool entry point & not fo... | Wrapper macro around the swc cli to bundle a folder
Args:
name: name
entry: entry
out: out
**kwargs: **kwargs
| Wrapper macro around the swc cli to bundle a folder | [
"Wrapper",
"macro",
"around",
"the",
"swc",
"cli",
"to",
"bundle",
"a",
"folder"
] | def swc_bundle(name, entry, out, **kwargs):
args = kwargs.pop("args", [])
args = [
"--entry",
"%s/%s" % (path_to_workspace_root(), entry),
"--out-file",
"%s/$(execpath %s)" % (path_to_workspace_root(), out),
] + args
npm_package_bin(
name = name,
outs = [
... | [
"def",
"swc_bundle",
"(",
"name",
",",
"entry",
",",
"out",
",",
"**",
"kwargs",
")",
":",
"args",
"=",
"kwargs",
".",
"pop",
"(",
"\"args\"",
",",
"[",
"]",
")",
"args",
"=",
"[",
"\"--entry\"",
",",
"\"%s/%s\"",
"%",
"(",
"path_to_workspace_root",
... | Wrapper macro around the swc cli to bundle a folder | [
"Wrapper",
"macro",
"around",
"the",
"swc",
"cli",
"to",
"bundle",
"a",
"folder"
] | [
"\"\"\"Wrapper macro around the swc cli to bundle a folder\n\n Args:\n name: name\n entry: entry\n out: out\n **kwargs: **kwargs\n \"\"\"",
"# --entry is parsed out by custom tool entry point & not forwarded to the underlying tool cli",
"# --output is parsed out by custom tool ... | [
{
"param": "name",
"type": null
},
{
"param": "entry",
"type": null
},
{
"param": "out",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
"is_optional": null
},
{
"identifier": "entry",
"type": null,
"docstring": null,
... |
0397bc5dc3af8bd252e443b9ffe7d646331a23da | aspect-build/bazelcon-21 | bazel/rules/swc.bzl | [
"MIT"
] | Python | swc_minify | null | def swc_minify(name, src, out, swcrc, **kwargs):
"""Wrapper macro around the swc cli to minify a bundle
Args:
name: name
src: src
out: out
swcrc: swcrc
**kwargs: **kwargs
"""
args = kwargs.pop("args", [])
args = [
"$(execpath %s)" % src,
"--no... | Wrapper macro around the swc cli to minify a bundle
Args:
name: name
src: src
out: out
swcrc: swcrc
**kwargs: **kwargs
| Wrapper macro around the swc cli to minify a bundle | [
"Wrapper",
"macro",
"around",
"the",
"swc",
"cli",
"to",
"minify",
"a",
"bundle"
] | def swc_minify(name, src, out, swcrc, **kwargs):
args = kwargs.pop("args", [])
args = [
"$(execpath %s)" % src,
"--no-swcrc",
"--source-maps",
"--config-file",
"$(execpath %s)" % swcrc,
"--out-file",
"$(execpath %s)" % out,
] + args
data = kwargs.p... | [
"def",
"swc_minify",
"(",
"name",
",",
"src",
",",
"out",
",",
"swcrc",
",",
"**",
"kwargs",
")",
":",
"args",
"=",
"kwargs",
".",
"pop",
"(",
"\"args\"",
",",
"[",
"]",
")",
"args",
"=",
"[",
"\"$(execpath %s)\"",
"%",
"src",
",",
"\"--no-swcrc\"",
... | Wrapper macro around the swc cli to minify a bundle | [
"Wrapper",
"macro",
"around",
"the",
"swc",
"cli",
"to",
"minify",
"a",
"bundle"
] | [
"\"\"\"Wrapper macro around the swc cli to minify a bundle\n\n Args:\n name: name\n src: src\n out: out\n swcrc: swcrc\n **kwargs: **kwargs\n \"\"\""
] | [
{
"param": "name",
"type": null
},
{
"param": "src",
"type": null
},
{
"param": "out",
"type": null
},
{
"param": "swcrc",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
"is_optional": null
},
{
"identifier": "src",
"type": null,
"docstring": null,
... |
08030ad41b44f51a75838ae05481dac2ff4f993b | aspect-build/bazelcon-21 | bazel/rules/angular_cli.bzl | [
"MIT"
] | Python | angular_cli_build | null | def angular_cli_build(name, target, **kwargs):
"""Wrapper macro around the angular cli architect layer
Args:
name: name
target: target
**kwargs: **kwargs
"""
args = kwargs.pop("args", [])
args = [
target,
"--outputPath=%s/$(@D)" % path_to_workspace_root(),
... | Wrapper macro around the angular cli architect layer
Args:
name: name
target: target
**kwargs: **kwargs
| Wrapper macro around the angular cli architect layer | [
"Wrapper",
"macro",
"around",
"the",
"angular",
"cli",
"architect",
"layer"
] | def angular_cli_build(name, target, **kwargs):
args = kwargs.pop("args", [])
args = [
target,
"--outputPath=%s/$(@D)" % path_to_workspace_root(),
] + args
env = kwargs.pop("env", {})
env["NG_BUILD_CACHE"] = "false"
_architect(
name = name,
args = args,
env... | [
"def",
"angular_cli_build",
"(",
"name",
",",
"target",
",",
"**",
"kwargs",
")",
":",
"args",
"=",
"kwargs",
".",
"pop",
"(",
"\"args\"",
",",
"[",
"]",
")",
"args",
"=",
"[",
"target",
",",
"\"--outputPath=%s/$(@D)\"",
"%",
"path_to_workspace_root",
"(",... | Wrapper macro around the angular cli architect layer | [
"Wrapper",
"macro",
"around",
"the",
"angular",
"cli",
"architect",
"layer"
] | [
"\"\"\"Wrapper macro around the angular cli architect layer\n\n Args:\n name: name\n target: target\n **kwargs: **kwargs\n \"\"\""
] | [
{
"param": "name",
"type": null
},
{
"param": "target",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
"is_optional": null
},
{
"identifier": "target",
"type": null,
"docstring": null,
... |
08030ad41b44f51a75838ae05481dac2ff4f993b | aspect-build/bazelcon-21 | bazel/rules/angular_cli.bzl | [
"MIT"
] | Python | angular_cli_run | null | def angular_cli_run(name, target, chdir, **kwargs):
"""Wrapper macro around the angular cli architect layer
Args:
name: name
target: target
chdir: chdir
**kwargs: **kwargs
"""
args = kwargs.pop("args", [])
args = [
"--node_options=--require=./$(execpath %s)" ... | Wrapper macro around the angular cli architect layer
Args:
name: name
target: target
chdir: chdir
**kwargs: **kwargs
| Wrapper macro around the angular cli architect layer | [
"Wrapper",
"macro",
"around",
"the",
"angular",
"cli",
"architect",
"layer"
] | def angular_cli_run(name, target, chdir, **kwargs):
args = kwargs.pop("args", [])
args = [
"--node_options=--require=./$(execpath %s)" % chdir,
target,
] + args
data = kwargs.pop("data", [])
data.append(chdir)
env = kwargs.pop("env", {})
env["NG_BUILD_CACHE"] = "false"
_a... | [
"def",
"angular_cli_run",
"(",
"name",
",",
"target",
",",
"chdir",
",",
"**",
"kwargs",
")",
":",
"args",
"=",
"kwargs",
".",
"pop",
"(",
"\"args\"",
",",
"[",
"]",
")",
"args",
"=",
"[",
"\"--node_options=--require=./$(execpath %s)\"",
"%",
"chdir",
",",... | Wrapper macro around the angular cli architect layer | [
"Wrapper",
"macro",
"around",
"the",
"angular",
"cli",
"architect",
"layer"
] | [
"\"\"\"Wrapper macro around the angular cli architect layer\n\n Args:\n name: name\n target: target\n chdir: chdir\n **kwargs: **kwargs\n \"\"\""
] | [
{
"param": "name",
"type": null
},
{
"param": "target",
"type": null
},
{
"param": "chdir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
"is_optional": null
},
{
"identifier": "target",
"type": null,
"docstring": null,
... |
dd60c95b228db00d536b66b6a65a79f4b12bcdc8 | aspect-build/bazelcon-21 | bazel/workspace/container_pull.bzl | [
"MIT"
] | Python | container_pull | null | def container_pull(
name,
registry,
repository,
tag = None,
digest = None,
**kwargs):
"""container_pull macro that improves the API around tags & digests.
This improves the API misconception when both a tag and digest are specified that the tag
is load bearin... | container_pull macro that improves the API around tags & digests.
This improves the API misconception when both a tag and digest are specified that the tag
is load bearing, when it isn't.
To prevent from users updating a tag and forgetting to update a digest, this macro allows
for either a tag or a di... | container_pull macro that improves the API around tags & digests.
This improves the API misconception when both a tag and digest are specified that the tag
is load bearing, when it isn't.
To prevent from users updating a tag and forgetting to update a digest, this macro allows
for either a tag or a digest to be specif... | [
"container_pull",
"macro",
"that",
"improves",
"the",
"API",
"around",
"tags",
"&",
"digests",
".",
"This",
"improves",
"the",
"API",
"misconception",
"when",
"both",
"a",
"tag",
"and",
"digest",
"are",
"specified",
"that",
"the",
"tag",
"is",
"load",
"beari... | def container_pull(
name,
registry,
repository,
tag = None,
digest = None,
**kwargs):
if not digest and not tag:
msg = """Either tag or digest must be specified in container_pull target %s.
Unpinned container_pull targets are not allowed.""" % name
fai... | [
"def",
"container_pull",
"(",
"name",
",",
"registry",
",",
"repository",
",",
"tag",
"=",
"None",
",",
"digest",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"if",
"not",
"digest",
"and",
"not",
"tag",
":",
"msg",
"=",
"\"\"\"Either tag or digest must be s... | container_pull macro that improves the API around tags & digests. | [
"container_pull",
"macro",
"that",
"improves",
"the",
"API",
"around",
"tags",
"&",
"digests",
"."
] | [
"\"\"\"container_pull macro that improves the API around tags & digests.\n\n This improves the API misconception when both a tag and digest are specified that the tag\n is load bearing, when it isn't.\n\n To prevent from users updating a tag and forgetting to update a digest, this macro allows\n for eit... | [
{
"param": "name",
"type": null
},
{
"param": "registry",
"type": null
},
{
"param": "repository",
"type": null
},
{
"param": "tag",
"type": null
},
{
"param": "digest",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "name",
"type": null,
"docstring": "A unique name for this repository.",
"docstring_tokens": [
"A",
"unique",
"name",
"for",
"this",
"repository",
"."
],
"defa... |
3786b6cd9f24d13f18fb82ffa19d73a029c73bbf | aspect-build/bazelcon-21 | bazel/workspace/deps.bzl | [
"MIT"
] | Python | deps | null | def deps():
"""Initialize and/or fetch additional external repository dependencies
This calls initialization functions on subset of external repositories require it
"""
# Initialize skylib workspace
bazel_skylib_workspace() | Initialize and/or fetch additional external repository dependencies
This calls initialization functions on subset of external repositories require it
| Initialize and/or fetch additional external repository dependencies
This calls initialization functions on subset of external repositories require it | [
"Initialize",
"and",
"/",
"or",
"fetch",
"additional",
"external",
"repository",
"dependencies",
"This",
"calls",
"initialization",
"functions",
"on",
"subset",
"of",
"external",
"repositories",
"require",
"it"
] | def deps():
bazel_skylib_workspace() | [
"def",
"deps",
"(",
")",
":",
"bazel_skylib_workspace",
"(",
")"
] | Initialize and/or fetch additional external repository dependencies
This calls initialization functions on subset of external repositories require it | [
"Initialize",
"and",
"/",
"or",
"fetch",
"additional",
"external",
"repository",
"dependencies",
"This",
"calls",
"initialization",
"functions",
"on",
"subset",
"of",
"external",
"repositories",
"require",
"it"
] | [
"\"\"\"Initialize and/or fetch additional external repository dependencies\n\n This calls initialization functions on subset of external repositories require it\n \"\"\"",
"# Initialize skylib workspace"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
fd3c3d35ffd9549cee0afea648ad1036ef9d7c43 | aspect-build/bazelcon-21 | bazel/workspace/repositories.bzl | [
"MIT"
] | Python | repositories | null | def repositories():
"""Download bazel external dependencies
Dependencies downloaded may have additional bootstrapping steps that are called afterwards.
They may also provide repository rules for fetching additional ecosystem specific deps such as npm packages
and docker images.
"""
http_archiv... | Download bazel external dependencies
Dependencies downloaded may have additional bootstrapping steps that are called afterwards.
They may also provide repository rules for fetching additional ecosystem specific deps such as npm packages
and docker images.
| Download bazel external dependencies
Dependencies downloaded may have additional bootstrapping steps that are called afterwards.
They may also provide repository rules for fetching additional ecosystem specific deps such as npm packages
and docker images. | [
"Download",
"bazel",
"external",
"dependencies",
"Dependencies",
"downloaded",
"may",
"have",
"additional",
"bootstrapping",
"steps",
"that",
"are",
"called",
"afterwards",
".",
"They",
"may",
"also",
"provide",
"repository",
"rules",
"for",
"fetching",
"additional",
... | def repositories():
http_archive(
name = "bazel_skylib",
urls = [
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.1.1/bazel-skylib-1.1.1.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.1.1/bazel-skylib-1.1.1.tar.gz",... | [
"def",
"repositories",
"(",
")",
":",
"http_archive",
"(",
"name",
"=",
"\"bazel_skylib\"",
",",
"urls",
"=",
"[",
"\"https://github.com/bazelbuild/bazel-skylib/releases/download/1.1.1/bazel-skylib-1.1.1.tar.gz\"",
",",
"\"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib... | Download bazel external dependencies
Dependencies downloaded may have additional bootstrapping steps that are called afterwards. | [
"Download",
"bazel",
"external",
"dependencies",
"Dependencies",
"downloaded",
"may",
"have",
"additional",
"bootstrapping",
"steps",
"that",
"are",
"called",
"afterwards",
"."
] | [
"\"\"\"Download bazel external dependencies\n\n Dependencies downloaded may have additional bootstrapping steps that are called afterwards.\n They may also provide repository rules for fetching additional ecosystem specific deps such as npm packages\n and docker images.\n \"\"\"",
"# Rules for buildin... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
fd5bb19ab8255a6383744525052a6e6cc9dfacde | aspect-build/bazelcon-21 | bazel/rules/webpack_cli.bzl | [
"MIT"
] | Python | webpack_cli | null | def webpack_cli(name, config, **kwargs):
"""Wrapper macro around the webpack cli
Args:
name: name
config: config
**kwargs: **kwargs
"""
args = kwargs.pop("args", [])
args = [
"--config=%s/$(execpath %s)" % (path_to_workspace_root(), config),
"--output-path=%s... | Wrapper macro around the webpack cli
Args:
name: name
config: config
**kwargs: **kwargs
| Wrapper macro around the webpack cli | [
"Wrapper",
"macro",
"around",
"the",
"webpack",
"cli"
] | def webpack_cli(name, config, **kwargs):
args = kwargs.pop("args", [])
args = [
"--config=%s/$(execpath %s)" % (path_to_workspace_root(), config),
"--output-path=%s/$(@D)" % path_to_workspace_root(),
] + args
data = kwargs.pop("data", [])
data.append(config)
_webpack_cli(
... | [
"def",
"webpack_cli",
"(",
"name",
",",
"config",
",",
"**",
"kwargs",
")",
":",
"args",
"=",
"kwargs",
".",
"pop",
"(",
"\"args\"",
",",
"[",
"]",
")",
"args",
"=",
"[",
"\"--config=%s/$(execpath %s)\"",
"%",
"(",
"path_to_workspace_root",
"(",
")",
","... | Wrapper macro around the webpack cli | [
"Wrapper",
"macro",
"around",
"the",
"webpack",
"cli"
] | [
"\"\"\"Wrapper macro around the webpack cli\n\n Args:\n name: name\n config: config\n **kwargs: **kwargs\n \"\"\""
] | [
{
"param": "name",
"type": null
},
{
"param": "config",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
"is_optional": null
},
{
"identifier": "config",
"type": null,
"docstring": null,
... |
90883518d346a718fd6be75156e3ec9998ce1a90 | aspect-build/bazelcon-21 | bazel/workspace/docker_deps.bzl | [
"MIT"
] | Python | docker_deps | null | def docker_deps():
"""Initialize and/or fetch additional docker dependencies"""
# Setup toolchain for building container images.
# NB: Docker toolchain uses rules_go rules so we must initialize its deps as well
container_repositories()
go_rules_dependencies()
go_register_toolchains(version = "1... | Initialize and/or fetch additional docker dependencies | Initialize and/or fetch additional docker dependencies | [
"Initialize",
"and",
"/",
"or",
"fetch",
"additional",
"docker",
"dependencies"
] | def docker_deps():
container_repositories()
go_rules_dependencies()
go_register_toolchains(version = "1.17.1")
container_go_deps()
container_pull(
name = "node-buster-slim",
registry = "index.docker.io",
repository = "node",
tag = "%s-buster-slim" % NODE_VERSION,
... | [
"def",
"docker_deps",
"(",
")",
":",
"container_repositories",
"(",
")",
"go_rules_dependencies",
"(",
")",
"go_register_toolchains",
"(",
"version",
"=",
"\"1.17.1\"",
")",
"container_go_deps",
"(",
")",
"container_pull",
"(",
"name",
"=",
"\"node-buster-slim\"",
"... | Initialize and/or fetch additional docker dependencies | [
"Initialize",
"and",
"/",
"or",
"fetch",
"additional",
"docker",
"dependencies"
] | [
"\"\"\"Initialize and/or fetch additional docker dependencies\"\"\"",
"# Setup toolchain for building container images.",
"# NB: Docker toolchain uses rules_go rules so we must initialize its deps as well"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
aa06b5b7cc4028d290e98e024acbce6f04edb51d | mekkablue/FixZeroHandles | FixZeroHandles.glyphsFilter/Contents/Resources/plugin.py | [
"Apache-2.0"
] | Python | xyAtPercentageBetweenTwoPoints | <not_specific> | def xyAtPercentageBetweenTwoPoints( self, firstPoint, secondPoint, percentage, allowedHandleLengthError = 0 ):
"""
Returns the x, y for the point at percentage
(where 100 percent is represented as 1.0)
between NSPoints firstPoint and secondPoint.
"""
x = firstPoint.x + percentage * ( secondPoint.x - firstPo... |
Returns the x, y for the point at percentage
(where 100 percent is represented as 1.0)
between NSPoints firstPoint and secondPoint.
| Returns the x, y for the point at percentage
(where 100 percent is represented as 1.0)
between NSPoints firstPoint and secondPoint. | [
"Returns",
"the",
"x",
"y",
"for",
"the",
"point",
"at",
"percentage",
"(",
"where",
"100",
"percent",
"is",
"represented",
"as",
"1",
".",
"0",
")",
"between",
"NSPoints",
"firstPoint",
"and",
"secondPoint",
"."
] | def xyAtPercentageBetweenTwoPoints( self, firstPoint, secondPoint, percentage, allowedHandleLengthError = 0 ):
x = firstPoint.x + percentage * ( secondPoint.x - firstPoint.x )
y = firstPoint.y + percentage * ( secondPoint.y - firstPoint.y )
if allowedHandleLengthError > 0:
min_percentage = percentage - 0.5 * p... | [
"def",
"xyAtPercentageBetweenTwoPoints",
"(",
"self",
",",
"firstPoint",
",",
"secondPoint",
",",
"percentage",
",",
"allowedHandleLengthError",
"=",
"0",
")",
":",
"x",
"=",
"firstPoint",
".",
"x",
"+",
"percentage",
"*",
"(",
"secondPoint",
".",
"x",
"-",
... | Returns the x, y for the point at percentage
(where 100 percent is represented as 1.0)
between NSPoints firstPoint and secondPoint. | [
"Returns",
"the",
"x",
"y",
"for",
"the",
"point",
"at",
"percentage",
"(",
"where",
"100",
"percent",
"is",
"represented",
"as",
"1",
".",
"0",
")",
"between",
"NSPoints",
"firstPoint",
"and",
"secondPoint",
"."
] | [
"\"\"\"\n\t\tReturns the x, y for the point at percentage\n\t\t(where 100 percent is represented as 1.0)\n\t\tbetween NSPoints firstPoint and secondPoint.\n\t\t\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "firstPoint",
"type": null
},
{
"param": "secondPoint",
"type": null
},
{
"param": "percentage",
"type": null
},
{
"param": "allowedHandleLengthError",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "firstPoint",
"type": null,
"docstring": null,
"docstring_toke... |
73ae81282323e25cd0d128b21854ed70c350a704 | weiwu-sre/tornado-prometheus | tornado_prometheus/__init__.py | [
"MIT"
] | Python | classify_status_code | <not_specific> | def classify_status_code(self, status_code):
"""
Prometheus recomends to have lower number of cardinality,
each combination creates a new metric in datastore,
to reduce this risk we store only the class of status code
"""
if 200 <= status_code < 300:
return "2... |
Prometheus recomends to have lower number of cardinality,
each combination creates a new metric in datastore,
to reduce this risk we store only the class of status code
| Prometheus recomends to have lower number of cardinality,
each combination creates a new metric in datastore,
to reduce this risk we store only the class of status code | [
"Prometheus",
"recomends",
"to",
"have",
"lower",
"number",
"of",
"cardinality",
"each",
"combination",
"creates",
"a",
"new",
"metric",
"in",
"datastore",
"to",
"reduce",
"this",
"risk",
"we",
"store",
"only",
"the",
"class",
"of",
"status",
"code"
] | def classify_status_code(self, status_code):
if 200 <= status_code < 300:
return "2xx"
if 300 <= status_code < 400:
return "3xx"
if 400 <= status_code < 500:
return "4xx"
return "5xx" | [
"def",
"classify_status_code",
"(",
"self",
",",
"status_code",
")",
":",
"if",
"200",
"<=",
"status_code",
"<",
"300",
":",
"return",
"\"2xx\"",
"if",
"300",
"<=",
"status_code",
"<",
"400",
":",
"return",
"\"3xx\"",
"if",
"400",
"<=",
"status_code",
"<",... | Prometheus recomends to have lower number of cardinality,
each combination creates a new metric in datastore,
to reduce this risk we store only the class of status code | [
"Prometheus",
"recomends",
"to",
"have",
"lower",
"number",
"of",
"cardinality",
"each",
"combination",
"creates",
"a",
"new",
"metric",
"in",
"datastore",
"to",
"reduce",
"this",
"risk",
"we",
"store",
"only",
"the",
"class",
"of",
"status",
"code"
] | [
"\"\"\"\n Prometheus recomends to have lower number of cardinality,\n each combination creates a new metric in datastore,\n to reduce this risk we store only the class of status code\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "status_code",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "status_code",
"type": null,
"docstring": null,
"docstring_tok... |
50f123bee67c19b487dcd1e0c084ed0b0715569f | andresbecker/RL_for_logistics | gym_warehouse/envs/warehouse_env.py | [
"MIT"
] | Python | render | null | def render(self, mode='human', sec_per_frame=0.5):
"""
Renders the environment in the desired mode.
Parameters
----------
mode : str
Currently, only 'human' is supported, which will render using
pygame.
"""
if mode == 'human':
... |
Renders the environment in the desired mode.
Parameters
----------
mode : str
Currently, only 'human' is supported, which will render using
pygame.
| Renders the environment in the desired mode.
Parameters
mode : str
Currently, only 'human' is supported, which will render using
pygame. | [
"Renders",
"the",
"environment",
"in",
"the",
"desired",
"mode",
".",
"Parameters",
"mode",
":",
"str",
"Currently",
"only",
"'",
"human",
"'",
"is",
"supported",
"which",
"will",
"render",
"using",
"pygame",
"."
] | def render(self, mode='human', sec_per_frame=0.5):
if mode == 'human':
if self.renderer is None:
self.renderer = WarehouseRenderer(self)
self.renderer.render()
time.sleep(sec_per_frame)
else:
super().render(mode=mode) | [
"def",
"render",
"(",
"self",
",",
"mode",
"=",
"'human'",
",",
"sec_per_frame",
"=",
"0.5",
")",
":",
"if",
"mode",
"==",
"'human'",
":",
"if",
"self",
".",
"renderer",
"is",
"None",
":",
"self",
".",
"renderer",
"=",
"WarehouseRenderer",
"(",
"self",... | Renders the environment in the desired mode. | [
"Renders",
"the",
"environment",
"in",
"the",
"desired",
"mode",
"."
] | [
"\"\"\"\n Renders the environment in the desired mode.\n\n Parameters\n ----------\n mode : str\n Currently, only 'human' is supported, which will render using\n pygame.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "mode",
"type": null
},
{
"param": "sec_per_frame",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mode",
"type": null,
"docstring": null,
"docstring_tokens": [... |
50f123bee67c19b487dcd1e0c084ed0b0715569f | andresbecker/RL_for_logistics | gym_warehouse/envs/warehouse_env.py | [
"MIT"
] | Python | _move | <not_specific> | def _move(self, action):
"""
Tries to move the agent in the direction indicated by action.
Parameters
----------
action : int
A move action. Must be in [0, 3].
Returns
-------
reward : int
The reward the agent gets for this action... |
Tries to move the agent in the direction indicated by action.
Parameters
----------
action : int
A move action. Must be in [0, 3].
Returns
-------
reward : int
The reward the agent gets for this action.
| Tries to move the agent in the direction indicated by action.
Parameters
action : int
A move action.
Returns
reward : int
The reward the agent gets for this action. | [
"Tries",
"to",
"move",
"the",
"agent",
"in",
"the",
"direction",
"indicated",
"by",
"action",
".",
"Parameters",
"action",
":",
"int",
"A",
"move",
"action",
".",
"Returns",
"reward",
":",
"int",
"The",
"reward",
"the",
"agent",
"gets",
"for",
"this",
"a... | def _move(self, action):
row, col = self.agent.position
delta_row, delta_col = MOVE_DELTAS[action]
row, col = row + delta_row, col + delta_col
if self._within_bounds(row, col) and (row, col) not in self.obstacles:
self.agent.position = (row, col)
self.action = f'Move ... | [
"def",
"_move",
"(",
"self",
",",
"action",
")",
":",
"row",
",",
"col",
"=",
"self",
".",
"agent",
".",
"position",
"delta_row",
",",
"delta_col",
"=",
"MOVE_DELTAS",
"[",
"action",
"]",
"row",
",",
"col",
"=",
"row",
"+",
"delta_row",
",",
"col",
... | Tries to move the agent in the direction indicated by action. | [
"Tries",
"to",
"move",
"the",
"agent",
"in",
"the",
"direction",
"indicated",
"by",
"action",
"."
] | [
"\"\"\"\n Tries to move the agent in the direction indicated by action.\n\n Parameters\n ----------\n action : int\n A move action. Must be in [0, 3].\n\n Returns\n -------\n reward : int\n The reward the agent gets for this action.\n \"\... | [
{
"param": "self",
"type": null
},
{
"param": "action",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "action",
"type": null,
"docstring": null,
"docstring_tokens":... |
50f123bee67c19b487dcd1e0c084ed0b0715569f | andresbecker/RL_for_logistics | gym_warehouse/envs/warehouse_env.py | [
"MIT"
] | Python | _pick | <not_specific> | def _pick(self, agent_slot, bin_slot):
"""
Tries to perform a pick action from the bin slot into the agent slot.
Parameters
----------
agent_slot : int
The slot of the agent to pick into.
bin_slot : int
The slot of the bin to pick from.
R... |
Tries to perform a pick action from the bin slot into the agent slot.
Parameters
----------
agent_slot : int
The slot of the agent to pick into.
bin_slot : int
The slot of the bin to pick from.
Returns
-------
reward : int
... | Tries to perform a pick action from the bin slot into the agent slot.
Parameters
agent_slot : int
The slot of the agent to pick into.
bin_slot : int
The slot of the bin to pick from.
Returns
reward : int
The reward the agent gets for trying to perform this action. | [
"Tries",
"to",
"perform",
"a",
"pick",
"action",
"from",
"the",
"bin",
"slot",
"into",
"the",
"agent",
"slot",
".",
"Parameters",
"agent_slot",
":",
"int",
"The",
"slot",
"of",
"the",
"agent",
"to",
"pick",
"into",
".",
"bin_slot",
":",
"int",
"The",
"... | def _pick(self, agent_slot, bin_slot):
if self.agent.position not in self.container_map:
return self.rewards['default']
container = self.container_map[self.agent.position]
if container is self.staging_out_area:
return self.rewards['default']
if not container.free(... | [
"def",
"_pick",
"(",
"self",
",",
"agent_slot",
",",
"bin_slot",
")",
":",
"if",
"self",
".",
"agent",
".",
"position",
"not",
"in",
"self",
".",
"container_map",
":",
"return",
"self",
".",
"rewards",
"[",
"'default'",
"]",
"container",
"=",
"self",
"... | Tries to perform a pick action from the bin slot into the agent slot. | [
"Tries",
"to",
"perform",
"a",
"pick",
"action",
"from",
"the",
"bin",
"slot",
"into",
"the",
"agent",
"slot",
"."
] | [
"\"\"\"\n Tries to perform a pick action from the bin slot into the agent slot.\n\n Parameters\n ----------\n agent_slot : int\n The slot of the agent to pick into.\n bin_slot : int\n The slot of the bin to pick from.\n\n Returns\n -------\n ... | [
{
"param": "self",
"type": null
},
{
"param": "agent_slot",
"type": null
},
{
"param": "bin_slot",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "agent_slot",
"type": null,
"docstring": null,
"docstring_toke... |
50f123bee67c19b487dcd1e0c084ed0b0715569f | andresbecker/RL_for_logistics | gym_warehouse/envs/warehouse_env.py | [
"MIT"
] | Python | _put | <not_specific> | def _put(self, agent_slot, bin_slot):
"""
Tries to perform a put action from the agent slot into the bin slot.
Parameters
----------
agent_slot : int
The slot of the agent containing the item to put.
bin_slot : int
The slot of the bin to put the i... |
Tries to perform a put action from the agent slot into the bin slot.
Parameters
----------
agent_slot : int
The slot of the agent containing the item to put.
bin_slot : int
The slot of the bin to put the item into.
Returns
-------
... | Tries to perform a put action from the agent slot into the bin slot.
Parameters
agent_slot : int
The slot of the agent containing the item to put.
bin_slot : int
The slot of the bin to put the item into.
Returns
reward : int
The reward the agent gets for trying to perform this action. | [
"Tries",
"to",
"perform",
"a",
"put",
"action",
"from",
"the",
"agent",
"slot",
"into",
"the",
"bin",
"slot",
".",
"Parameters",
"agent_slot",
":",
"int",
"The",
"slot",
"of",
"the",
"agent",
"containing",
"the",
"item",
"to",
"put",
".",
"bin_slot",
":"... | def _put(self, agent_slot, bin_slot):
if self.agent.position not in self.container_map:
return self.rewards['default']
container = self.container_map[self.agent.position]
if container is self.staging_in_area:
return self.rewards['default']
if container is self.sta... | [
"def",
"_put",
"(",
"self",
",",
"agent_slot",
",",
"bin_slot",
")",
":",
"if",
"self",
".",
"agent",
".",
"position",
"not",
"in",
"self",
".",
"container_map",
":",
"return",
"self",
".",
"rewards",
"[",
"'default'",
"]",
"container",
"=",
"self",
".... | Tries to perform a put action from the agent slot into the bin slot. | [
"Tries",
"to",
"perform",
"a",
"put",
"action",
"from",
"the",
"agent",
"slot",
"into",
"the",
"bin",
"slot",
"."
] | [
"\"\"\"\n Tries to perform a put action from the agent slot into the bin slot.\n\n Parameters\n ----------\n agent_slot : int\n The slot of the agent containing the item to put.\n bin_slot : int\n The slot of the bin to put the item into.\n\n Returns\n... | [
{
"param": "self",
"type": null
},
{
"param": "agent_slot",
"type": null
},
{
"param": "bin_slot",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "agent_slot",
"type": null,
"docstring": null,
"docstring_toke... |
50f123bee67c19b487dcd1e0c084ed0b0715569f | andresbecker/RL_for_logistics | gym_warehouse/envs/warehouse_env.py | [
"MIT"
] | Python | _update_transactions | null | def _update_transactions(self, p=0.5):
"""
Randomly adds new items to staging in area or staging out area.
When this method is called, with probability p/2 a new inbound item is
added, with probability p/2 a new outbound item is added, and with
probability 1 - p nothing is added.... |
Randomly adds new items to staging in area or staging out area.
When this method is called, with probability p/2 a new inbound item is
added, with probability p/2 a new outbound item is added, and with
probability 1 - p nothing is added. If a new item is to be added but
the corr... | Randomly adds new items to staging in area or staging out area.
When this method is called, with probability p/2 a new inbound item is
added, with probability p/2 a new outbound item is added, and with
probability 1 - p nothing is added. If a new item is to be added but
the corresponding area is full, nothing happens.
... | [
"Randomly",
"adds",
"new",
"items",
"to",
"staging",
"in",
"area",
"or",
"staging",
"out",
"area",
".",
"When",
"this",
"method",
"is",
"called",
"with",
"probability",
"p",
"/",
"2",
"a",
"new",
"inbound",
"item",
"is",
"added",
"with",
"probability",
"... | def _update_transactions(self, p=0.5):
flip = random.random()
bin_items = np.array([])
for bin_ in self.bins:
bin_items = np.append(bin_items, bin_.status)
bin_items = bin_items.flatten()
y = lambda x: True if x != 0 else False
bin_items_bool = [y(i) for i in ... | [
"def",
"_update_transactions",
"(",
"self",
",",
"p",
"=",
"0.5",
")",
":",
"flip",
"=",
"random",
".",
"random",
"(",
")",
"bin_items",
"=",
"np",
".",
"array",
"(",
"[",
"]",
")",
"for",
"bin_",
"in",
"self",
".",
"bins",
":",
"bin_items",
"=",
... | Randomly adds new items to staging in area or staging out area. | [
"Randomly",
"adds",
"new",
"items",
"to",
"staging",
"in",
"area",
"or",
"staging",
"out",
"area",
"."
] | [
"\"\"\"\n Randomly adds new items to staging in area or staging out area.\n When this method is called, with probability p/2 a new inbound item is\n added, with probability p/2 a new outbound item is added, and with\n probability 1 - p nothing is added. If a new item is to be added but\n... | [
{
"param": "self",
"type": null
},
{
"param": "p",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "p",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
50f123bee67c19b487dcd1e0c084ed0b0715569f | andresbecker/RL_for_logistics | gym_warehouse/envs/warehouse_env.py | [
"MIT"
] | Python | init_video | null | def init_video(self):
"""
Initialize renderer if not done yet. It will save the state history
throughout the complete simulation. Thus, this function needs to be
called before the simulation starts.
"""
self.video = True
# Initialize renderer if not done yet
... |
Initialize renderer if not done yet. It will save the state history
throughout the complete simulation. Thus, this function needs to be
called before the simulation starts.
| Initialize renderer if not done yet. It will save the state history
throughout the complete simulation. Thus, this function needs to be
called before the simulation starts. | [
"Initialize",
"renderer",
"if",
"not",
"done",
"yet",
".",
"It",
"will",
"save",
"the",
"state",
"history",
"throughout",
"the",
"complete",
"simulation",
".",
"Thus",
"this",
"function",
"needs",
"to",
"be",
"called",
"before",
"the",
"simulation",
"starts",
... | def init_video(self):
self.video = True
if self.renderer is None:
self.renderer = WarehouseRenderer(self) | [
"def",
"init_video",
"(",
"self",
")",
":",
"self",
".",
"video",
"=",
"True",
"if",
"self",
".",
"renderer",
"is",
"None",
":",
"self",
".",
"renderer",
"=",
"WarehouseRenderer",
"(",
"self",
")"
] | Initialize renderer if not done yet. | [
"Initialize",
"renderer",
"if",
"not",
"done",
"yet",
"."
] | [
"\"\"\"\n Initialize renderer if not done yet. It will save the state history\n throughout the complete simulation. Thus, this function needs to be\n called before the simulation starts.\n \"\"\"",
"# Initialize renderer if not done yet"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
50f123bee67c19b487dcd1e0c084ed0b0715569f | andresbecker/RL_for_logistics | gym_warehouse/envs/warehouse_env.py | [
"MIT"
] | Python | save_video | null | def save_video(self, video_filename):
"""
Save rendered environment as video in mp4 format.
Parameters
----------
video_filename : str
Plain filename of the video; filename extension (.mp4) will be
added automatically.
"""
self.video_filen... |
Save rendered environment as video in mp4 format.
Parameters
----------
video_filename : str
Plain filename of the video; filename extension (.mp4) will be
added automatically.
| Save rendered environment as video in mp4 format.
Parameters
video_filename : str
Plain filename of the video; filename extension (.mp4) will be
added automatically. | [
"Save",
"rendered",
"environment",
"as",
"video",
"in",
"mp4",
"format",
".",
"Parameters",
"video_filename",
":",
"str",
"Plain",
"filename",
"of",
"the",
"video",
";",
"filename",
"extension",
"(",
".",
"mp4",
")",
"will",
"be",
"added",
"automatically",
"... | def save_video(self, video_filename):
self.video_filename = ".".join([video_filename, "mp4"])
if self.video:
self.renderer.save_video()
else:
print("init_video has to be called before in order to save video; "
"aborting") | [
"def",
"save_video",
"(",
"self",
",",
"video_filename",
")",
":",
"self",
".",
"video_filename",
"=",
"\".\"",
".",
"join",
"(",
"[",
"video_filename",
",",
"\"mp4\"",
"]",
")",
"if",
"self",
".",
"video",
":",
"self",
".",
"renderer",
".",
"save_video"... | Save rendered environment as video in mp4 format. | [
"Save",
"rendered",
"environment",
"as",
"video",
"in",
"mp4",
"format",
"."
] | [
"\"\"\"\n Save rendered environment as video in mp4 format.\n\n Parameters\n ----------\n video_filename : str\n Plain filename of the video; filename extension (.mp4) will be\n added automatically.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "video_filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "video_filename",
"type": null,
"docstring": null,
"docstring_... |
50f123bee67c19b487dcd1e0c084ed0b0715569f | andresbecker/RL_for_logistics | gym_warehouse/envs/warehouse_env.py | [
"MIT"
] | Python | save_as_gif | null | def save_as_gif(self, filename_prefix = 'quick_test', save_dir = './', sec_per_frame=0.5):
"""
Save rendered environment as an animation in gif format.
Parameters
----------
gif_filename : str
Plain filename of the gif; filename extension (.gif) will be
a... |
Save rendered environment as an animation in gif format.
Parameters
----------
gif_filename : str
Plain filename of the gif; filename extension (.gif) will be
added automatically.
| Save rendered environment as an animation in gif format.
Parameters
gif_filename : str
Plain filename of the gif; filename extension (.gif) will be
added automatically. | [
"Save",
"rendered",
"environment",
"as",
"an",
"animation",
"in",
"gif",
"format",
".",
"Parameters",
"gif_filename",
":",
"str",
"Plain",
"filename",
"of",
"the",
"gif",
";",
"filename",
"extension",
"(",
".",
"gif",
")",
"will",
"be",
"added",
"automatical... | def save_as_gif(self, filename_prefix = 'quick_test', save_dir = './', sec_per_frame=0.5):
self.gif_filename = save_dir+'/'+filename_prefix+"_agent_interaction.gif"
if self.renderer:
self.renderer.save_as_gif(self.gif_filename, sec_per_frame)
else:
print("env.render(mode=... | [
"def",
"save_as_gif",
"(",
"self",
",",
"filename_prefix",
"=",
"'quick_test'",
",",
"save_dir",
"=",
"'./'",
",",
"sec_per_frame",
"=",
"0.5",
")",
":",
"self",
".",
"gif_filename",
"=",
"save_dir",
"+",
"'/'",
"+",
"filename_prefix",
"+",
"\"_agent_interacti... | Save rendered environment as an animation in gif format. | [
"Save",
"rendered",
"environment",
"as",
"an",
"animation",
"in",
"gif",
"format",
"."
] | [
"\"\"\"\n Save rendered environment as an animation in gif format.\n\n Parameters\n ----------\n gif_filename : str\n Plain filename of the gif; filename extension (.gif) will be\n added automatically.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "filename_prefix",
"type": null
},
{
"param": "save_dir",
"type": null
},
{
"param": "sec_per_frame",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename_prefix",
"type": null,
"docstring": null,
"docstring... |
50f123bee67c19b487dcd1e0c084ed0b0715569f | andresbecker/RL_for_logistics | gym_warehouse/envs/warehouse_env.py | [
"MIT"
] | Python | save_as_mp4 | null | def save_as_mp4(self, filename_prefix = 'quick_test', save_dir = './', sec_per_frame=0.5):
"""
Save rendered environment as an mp4 video.
Parameters
----------
gif_filename : str
Plain filename of the mp4; filename extension (.mp4) will be
added automatic... |
Save rendered environment as an mp4 video.
Parameters
----------
gif_filename : str
Plain filename of the mp4; filename extension (.mp4) will be
added automatically.
| Save rendered environment as an mp4 video.
Parameters
gif_filename : str
Plain filename of the mp4; filename extension (.mp4) will be
added automatically. | [
"Save",
"rendered",
"environment",
"as",
"an",
"mp4",
"video",
".",
"Parameters",
"gif_filename",
":",
"str",
"Plain",
"filename",
"of",
"the",
"mp4",
";",
"filename",
"extension",
"(",
".",
"mp4",
")",
"will",
"be",
"added",
"automatically",
"."
] | def save_as_mp4(self, filename_prefix = 'quick_test', save_dir = './', sec_per_frame=0.5):
self.mp4_filename = save_dir+'/'+filename_prefix+"_agent_interaction.mp4"
if self.renderer:
self.renderer.save_as_mp4(self.mp4_filename, sec_per_frame)
else:
print("env.render(mode=... | [
"def",
"save_as_mp4",
"(",
"self",
",",
"filename_prefix",
"=",
"'quick_test'",
",",
"save_dir",
"=",
"'./'",
",",
"sec_per_frame",
"=",
"0.5",
")",
":",
"self",
".",
"mp4_filename",
"=",
"save_dir",
"+",
"'/'",
"+",
"filename_prefix",
"+",
"\"_agent_interacti... | Save rendered environment as an mp4 video. | [
"Save",
"rendered",
"environment",
"as",
"an",
"mp4",
"video",
"."
] | [
"\"\"\"\n Save rendered environment as an mp4 video.\n\n Parameters\n ----------\n gif_filename : str\n Plain filename of the mp4; filename extension (.mp4) will be\n added automatically.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "filename_prefix",
"type": null
},
{
"param": "save_dir",
"type": null
},
{
"param": "sec_per_frame",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename_prefix",
"type": null,
"docstring": null,
"docstring... |
2440fab62582752a3bd1547a064e52bc97b44f17 | zevaverbach/cron-converter | cron_converter/cron.py | [
"MIT"
] | Python | to_string | str | def to_string(self) -> str:
"""Return the cron schedule as a string.
:return: cron string (str) -> The cron schedule as a string.
"""
if not self.parts:
raise LookupError('No schedule found')
return ' '.join(str(part) for part in self.parts) | Return the cron schedule as a string.
:return: cron string (str) -> The cron schedule as a string.
| Return the cron schedule as a string. | [
"Return",
"the",
"cron",
"schedule",
"as",
"a",
"string",
"."
] | def to_string(self) -> str:
if not self.parts:
raise LookupError('No schedule found')
return ' '.join(str(part) for part in self.parts) | [
"def",
"to_string",
"(",
"self",
")",
"->",
"str",
":",
"if",
"not",
"self",
".",
"parts",
":",
"raise",
"LookupError",
"(",
"'No schedule found'",
")",
"return",
"' '",
".",
"join",
"(",
"str",
"(",
"part",
")",
"for",
"part",
"in",
"self",
".",
"pa... | Return the cron schedule as a string. | [
"Return",
"the",
"cron",
"schedule",
"as",
"a",
"string",
"."
] | [
"\"\"\"Return the cron schedule as a string.\n\n :return: cron string (str) -> The cron schedule as a string.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "cron string (str) -> The cron schedule as a string.",
"docstring_tokens": [
"cron",
"string",
"(",
"str",
")",
"-",
">",
"The",
"cron",
"schedule",
"as",
"a",
"string"... |
2440fab62582752a3bd1547a064e52bc97b44f17 | zevaverbach/cron-converter | cron_converter/cron.py | [
"MIT"
] | Python | from_list | null | def from_list(self, cron_list: List[List[Union[str, int]]]):
"""Parses a 2-dimentional array of integers as a cron schedule.
:param cron_list: (list of list) The 2-dimensional list to parse.
:raises ValueError: Incorrect length of the cron list.
"""
cron_parts = []
if le... | Parses a 2-dimentional array of integers as a cron schedule.
:param cron_list: (list of list) The 2-dimensional list to parse.
:raises ValueError: Incorrect length of the cron list.
| Parses a 2-dimentional array of integers as a cron schedule. | [
"Parses",
"a",
"2",
"-",
"dimentional",
"array",
"of",
"integers",
"as",
"a",
"cron",
"schedule",
"."
] | def from_list(self, cron_list: List[List[Union[str, int]]]):
cron_parts = []
if len(cron_list) != 5:
raise ValueError(f'Invalid cron list')
for cron_part_list, unit in zip(cron_list, units):
part = Part(unit, self.options)
part.from_list(cron_part_list)
... | [
"def",
"from_list",
"(",
"self",
",",
"cron_list",
":",
"List",
"[",
"List",
"[",
"Union",
"[",
"str",
",",
"int",
"]",
"]",
"]",
")",
":",
"cron_parts",
"=",
"[",
"]",
"if",
"len",
"(",
"cron_list",
")",
"!=",
"5",
":",
"raise",
"ValueError",
"(... | Parses a 2-dimentional array of integers as a cron schedule. | [
"Parses",
"a",
"2",
"-",
"dimentional",
"array",
"of",
"integers",
"as",
"a",
"cron",
"schedule",
"."
] | [
"\"\"\"Parses a 2-dimentional array of integers as a cron schedule.\n\n :param cron_list: (list of list) The 2-dimensional list to parse.\n :raises ValueError: Incorrect length of the cron list.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "cron_list",
"type": "List[List[Union[str, int]]]"
}
] | {
"returns": [],
"raises": [
{
"docstring": "Incorrect length of the cron list.",
"docstring_tokens": [
"Incorrect",
"length",
"of",
"the",
"cron",
"list",
"."
],
"type": "ValueError"
}
],
"params": [
{
"identifier... |
2440fab62582752a3bd1547a064e52bc97b44f17 | zevaverbach/cron-converter | cron_converter/cron.py | [
"MIT"
] | Python | to_list | List[Part] | def to_list(self) -> List[Part]:
"""Returns the cron schedule as a 2-dimentional list of integers
:return: schedule_list -> The cron schedule as a list.
:raises LookupError: Empty Cron object.
"""
if not self.parts:
raise LookupError('No schedule found')
sche... | Returns the cron schedule as a 2-dimentional list of integers
:return: schedule_list -> The cron schedule as a list.
:raises LookupError: Empty Cron object.
| Returns the cron schedule as a 2-dimentional list of integers | [
"Returns",
"the",
"cron",
"schedule",
"as",
"a",
"2",
"-",
"dimentional",
"list",
"of",
"integers"
] | def to_list(self) -> List[Part]:
if not self.parts:
raise LookupError('No schedule found')
schedule_list = []
for part in self.parts:
schedule_list.append(part.to_list())
return schedule_list | [
"def",
"to_list",
"(",
"self",
")",
"->",
"List",
"[",
"Part",
"]",
":",
"if",
"not",
"self",
".",
"parts",
":",
"raise",
"LookupError",
"(",
"'No schedule found'",
")",
"schedule_list",
"=",
"[",
"]",
"for",
"part",
"in",
"self",
".",
"parts",
":",
... | Returns the cron schedule as a 2-dimentional list of integers | [
"Returns",
"the",
"cron",
"schedule",
"as",
"a",
"2",
"-",
"dimentional",
"list",
"of",
"integers"
] | [
"\"\"\"Returns the cron schedule as a 2-dimentional list of integers\n\n :return: schedule_list -> The cron schedule as a list.\n :raises LookupError: Empty Cron object.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "> The cron schedule as a list.",
"docstring_tokens": [
">",
"The",
"cron",
"schedule",
"as",
"a",
"list",
"."
],
"type": null
}
],
"raises": [
{
"docstring": "Empty Cron object.... |
2440fab62582752a3bd1547a064e52bc97b44f17 | zevaverbach/cron-converter | cron_converter/cron.py | [
"MIT"
] | Python | schedule | Seeker | def schedule(self, start_time: Optional[datetime] = None) -> Seeker:
"""Returns the time the schedule would run next.
:param start_time: A datetime object. If not provided, it will be now in utc.
:return: A schedule iterator.
"""
return Seeker(self, start_time) | Returns the time the schedule would run next.
:param start_time: A datetime object. If not provided, it will be now in utc.
:return: A schedule iterator.
| Returns the time the schedule would run next. | [
"Returns",
"the",
"time",
"the",
"schedule",
"would",
"run",
"next",
"."
] | def schedule(self, start_time: Optional[datetime] = None) -> Seeker:
return Seeker(self, start_time) | [
"def",
"schedule",
"(",
"self",
",",
"start_time",
":",
"Optional",
"[",
"datetime",
"]",
"=",
"None",
")",
"->",
"Seeker",
":",
"return",
"Seeker",
"(",
"self",
",",
"start_time",
")"
] | Returns the time the schedule would run next. | [
"Returns",
"the",
"time",
"the",
"schedule",
"would",
"run",
"next",
"."
] | [
"\"\"\"Returns the time the schedule would run next.\n\n :param start_time: A datetime object. If not provided, it will be now in utc.\n :return: A schedule iterator.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "start_time",
"type": "Optional[datetime]"
}
] | {
"returns": [
{
"docstring": "A schedule iterator.",
"docstring_tokens": [
"A",
"schedule",
"iterator",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstr... |
a745b03ff7fd7e842520354ef1c94beb7e324913 | Symantec/dao-client | dao/client/shell.py | [
"Apache-2.0"
] | Python | cli_argument | <not_specific> | def cli_argument(*args, **kwargs):
"""Function create a decorator that add named attributes to the function"""
def wrap(func):
"""Decorator internal wrapper"""
if not hasattr(func, 'cli_args'):
func.cli_args = list()
func.cli_args.append((args, kwargs))
return func
... | Function create a decorator that add named attributes to the function | Function create a decorator that add named attributes to the function | [
"Function",
"create",
"a",
"decorator",
"that",
"add",
"named",
"attributes",
"to",
"the",
"function"
] | def cli_argument(*args, **kwargs):
def wrap(func):
if not hasattr(func, 'cli_args'):
func.cli_args = list()
func.cli_args.append((args, kwargs))
return func
return wrap | [
"def",
"cli_argument",
"(",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"def",
"wrap",
"(",
"func",
")",
":",
"\"\"\"Decorator internal wrapper\"\"\"",
"if",
"not",
"hasattr",
"(",
"func",
",",
"'cli_args'",
")",
":",
"func",
".",
"cli_args",
"=",
"list",
... | Function create a decorator that add named attributes to the function | [
"Function",
"create",
"a",
"decorator",
"that",
"add",
"named",
"attributes",
"to",
"the",
"function"
] | [
"\"\"\"Function create a decorator that add named attributes to the function\"\"\"",
"\"\"\"Decorator internal wrapper\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
a745b03ff7fd7e842520354ef1c94beb7e324913 | Symantec/dao-client | dao/client/shell.py | [
"Apache-2.0"
] | Python | network_map_create | null | def network_map_create(self, args):
"""Create new network map. Map name should be unique"""
try:
eval(args.port2number)
except SyntaxError:
raise exceptions.DAOException('--port2number is not a valid eval')
try:
eval(args.number2unit)
except Sy... | Create new network map. Map name should be unique | Create new network map. Map name should be unique | [
"Create",
"new",
"network",
"map",
".",
"Map",
"name",
"should",
"be",
"unique"
] | def network_map_create(self, args):
try:
eval(args.port2number)
except SyntaxError:
raise exceptions.DAOException('--port2number is not a valid eval')
try:
eval(args.number2unit)
except SyntaxError:
raise exceptions.DAOException('--number2u... | [
"def",
"network_map_create",
"(",
"self",
",",
"args",
")",
":",
"try",
":",
"eval",
"(",
"args",
".",
"port2number",
")",
"except",
"SyntaxError",
":",
"raise",
"exceptions",
".",
"DAOException",
"(",
"'--port2number is not a valid eval'",
")",
"try",
":",
"e... | Create new network map. | [
"Create",
"new",
"network",
"map",
"."
] | [
"\"\"\"Create new network map. Map name should be unique\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "args",
"type": null,
"docstring": null,
"docstring_tokens": [... |
a745b03ff7fd7e842520354ef1c94beb7e324913 | Symantec/dao-client | dao/client/shell.py | [
"Apache-2.0"
] | Python | rack_update | null | def rack_update(self, args):
"""Update rack record in the DB"""
gateway = str(netaddr.IPAddress(args.gw)) if args.gw else None
self._print_result(
args, self._call('rack_update',
rack_name=args.rack,
env=args.env,
... | Update rack record in the DB | Update rack record in the DB | [
"Update",
"rack",
"record",
"in",
"the",
"DB"
] | def rack_update(self, args):
gateway = str(netaddr.IPAddress(args.gw)) if args.gw else None
self._print_result(
args, self._call('rack_update',
rack_name=args.rack,
env=args.env,
gw=gateway,
... | [
"def",
"rack_update",
"(",
"self",
",",
"args",
")",
":",
"gateway",
"=",
"str",
"(",
"netaddr",
".",
"IPAddress",
"(",
"args",
".",
"gw",
")",
")",
"if",
"args",
".",
"gw",
"else",
"None",
"self",
".",
"_print_result",
"(",
"args",
",",
"self",
".... | Update rack record in the DB | [
"Update",
"rack",
"record",
"in",
"the",
"DB"
] | [
"\"\"\"Update rack record in the DB\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "args",
"type": null,
"docstring": null,
"docstring_tokens": [... |
a745b03ff7fd7e842520354ef1c94beb7e324913 | Symantec/dao-client | dao/client/shell.py | [
"Apache-2.0"
] | Python | server_list | null | def server_list(self, args):
"""List servers, using provided filters."""
servers = self._call('servers_list',
rack_name=args.rack,
cluster_name=args.cluster,
serials=args.serial,
macs=args... | List servers, using provided filters. | List servers, using provided filters. | [
"List",
"servers",
"using",
"provided",
"filters",
"."
] | def server_list(self, args):
servers = self._call('servers_list',
rack_name=args.rack,
cluster_name=args.cluster,
serials=args.serial,
macs=args.mac,
ips=args.ip,
... | [
"def",
"server_list",
"(",
"self",
",",
"args",
")",
":",
"servers",
"=",
"self",
".",
"_call",
"(",
"'servers_list'",
",",
"rack_name",
"=",
"args",
".",
"rack",
",",
"cluster_name",
"=",
"args",
".",
"cluster",
",",
"serials",
"=",
"args",
".",
"seri... | List servers, using provided filters. | [
"List",
"servers",
"using",
"provided",
"filters",
"."
] | [
"\"\"\"List servers, using provided filters.\"\"\"",
"# way to fix unicode",
"# for backward comp-ty there are more code then is required"
] | [
{
"param": "self",
"type": null
},
{
"param": "args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "args",
"type": null,
"docstring": null,
"docstring_tokens": [... |
a745b03ff7fd7e842520354ef1c94beb7e324913 | Symantec/dao-client | dao/client/shell.py | [
"Apache-2.0"
] | Python | history | null | def history(self, args):
"""List history of updates to DB that was done using DAO.
"""
key_name, key_value = args.key.split('=') if args.key else (None, None)
result = self._call('history', args.type,
key=key_name, value=key_value)
self._print_result(a... | List history of updates to DB that was done using DAO.
| List history of updates to DB that was done using DAO. | [
"List",
"history",
"of",
"updates",
"to",
"DB",
"that",
"was",
"done",
"using",
"DAO",
"."
] | def history(self, args):
key_name, key_value = args.key.split('=') if args.key else (None, None)
result = self._call('history', args.type,
key=key_name, value=key_value)
self._print_result(args, result) | [
"def",
"history",
"(",
"self",
",",
"args",
")",
":",
"key_name",
",",
"key_value",
"=",
"args",
".",
"key",
".",
"split",
"(",
"'='",
")",
"if",
"args",
".",
"key",
"else",
"(",
"None",
",",
"None",
")",
"result",
"=",
"self",
".",
"_call",
"(",... | List history of updates to DB that was done using DAO. | [
"List",
"history",
"of",
"updates",
"to",
"DB",
"that",
"was",
"done",
"using",
"DAO",
"."
] | [
"\"\"\"List history of updates to DB that was done using DAO.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "args",
"type": null,
"docstring": null,
"docstring_tokens": [... |
a745b03ff7fd7e842520354ef1c94beb7e324913 | Symantec/dao-client | dao/client/shell.py | [
"Apache-2.0"
] | Python | cluster_list | null | def cluster_list(self, args):
"""List cluster (only for current location)."""
kwargs = dict(k.split('=') for k in args.key)
self._print_result(args, self._call('cluster_list', args.detailed,
**kwargs)) | List cluster (only for current location). | List cluster (only for current location). | [
"List",
"cluster",
"(",
"only",
"for",
"current",
"location",
")",
"."
] | def cluster_list(self, args):
kwargs = dict(k.split('=') for k in args.key)
self._print_result(args, self._call('cluster_list', args.detailed,
**kwargs)) | [
"def",
"cluster_list",
"(",
"self",
",",
"args",
")",
":",
"kwargs",
"=",
"dict",
"(",
"k",
".",
"split",
"(",
"'='",
")",
"for",
"k",
"in",
"args",
".",
"key",
")",
"self",
".",
"_print_result",
"(",
"args",
",",
"self",
".",
"_call",
"(",
"'clu... | List cluster (only for current location). | [
"List",
"cluster",
"(",
"only",
"for",
"current",
"location",
")",
"."
] | [
"\"\"\"List cluster (only for current location).\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "args",
"type": null,
"docstring": null,
"docstring_tokens": [... |
a745b03ff7fd7e842520354ef1c94beb7e324913 | Symantec/dao-client | dao/client/shell.py | [
"Apache-2.0"
] | Python | cluster_create | null | def cluster_create(self, args):
"""Create new cluster record. Cluster name should be unique per
location"""
self._print_result(args, self._call('cluster_create',
args.name,
args.type)) | Create new cluster record. Cluster name should be unique per
location | Create new cluster record. Cluster name should be unique per
location | [
"Create",
"new",
"cluster",
"record",
".",
"Cluster",
"name",
"should",
"be",
"unique",
"per",
"location"
] | def cluster_create(self, args):
self._print_result(args, self._call('cluster_create',
args.name,
args.type)) | [
"def",
"cluster_create",
"(",
"self",
",",
"args",
")",
":",
"self",
".",
"_print_result",
"(",
"args",
",",
"self",
".",
"_call",
"(",
"'cluster_create'",
",",
"args",
".",
"name",
",",
"args",
".",
"type",
")",
")"
] | Create new cluster record. | [
"Create",
"new",
"cluster",
"record",
"."
] | [
"\"\"\"Create new cluster record. Cluster name should be unique per\n location\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "args",
"type": null,
"docstring": null,
"docstring_tokens": [... |
a745b03ff7fd7e842520354ef1c94beb7e324913 | Symantec/dao-client | dao/client/shell.py | [
"Apache-2.0"
] | Python | os_list | null | def os_list(self, args):
"""List OS available for using on the worker."""
oss = self._call('os_list',
worker_name=args.worker,
os_name=args.os_name)
self._print_result(args, oss) | List OS available for using on the worker. | List OS available for using on the worker. | [
"List",
"OS",
"available",
"for",
"using",
"on",
"the",
"worker",
"."
] | def os_list(self, args):
oss = self._call('os_list',
worker_name=args.worker,
os_name=args.os_name)
self._print_result(args, oss) | [
"def",
"os_list",
"(",
"self",
",",
"args",
")",
":",
"oss",
"=",
"self",
".",
"_call",
"(",
"'os_list'",
",",
"worker_name",
"=",
"args",
".",
"worker",
",",
"os_name",
"=",
"args",
".",
"os_name",
")",
"self",
".",
"_print_result",
"(",
"args",
","... | List OS available for using on the worker. | [
"List",
"OS",
"available",
"for",
"using",
"on",
"the",
"worker",
"."
] | [
"\"\"\"List OS available for using on the worker.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "args",
"type": null,
"docstring": null,
"docstring_tokens": [... |
a745b03ff7fd7e842520354ef1c94beb7e324913 | Symantec/dao-client | dao/client/shell.py | [
"Apache-2.0"
] | Python | _print_result | null | def _print_result(self, args, result):
"""Print result in a format defined by self.print_format"""
if result is None:
result = 'Accepted'
if args.filter:
fields = args.filter.split(',')
#apply interfaces normalization, to make it user friendly
if i... | Print result in a format defined by self.print_format | Print result in a format defined by self.print_format | [
"Print",
"result",
"in",
"a",
"format",
"defined",
"by",
"self",
".",
"print_format"
] | def _print_result(self, args, result):
if result is None:
result = 'Accepted'
if args.filter:
fields = args.filter.split(',')
if isinstance(result, dict):
result = dict((k, self._filter(fields, v)[1])
for k, v in result.it... | [
"def",
"_print_result",
"(",
"self",
",",
"args",
",",
"result",
")",
":",
"if",
"result",
"is",
"None",
":",
"result",
"=",
"'Accepted'",
"if",
"args",
".",
"filter",
":",
"fields",
"=",
"args",
".",
"filter",
".",
"split",
"(",
"','",
")",
"if",
... | Print result in a format defined by self.print_format | [
"Print",
"result",
"in",
"a",
"format",
"defined",
"by",
"self",
".",
"print_format"
] | [
"\"\"\"Print result in a format defined by self.print_format\"\"\"",
"#apply interfaces normalization, to make it user friendly"
] | [
{
"param": "self",
"type": null
},
{
"param": "args",
"type": null
},
{
"param": "result",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "args",
"type": null,
"docstring": null,
"docstring_tokens": [... |
a745b03ff7fd7e842520354ef1c94beb7e324913 | Symantec/dao-client | dao/client/shell.py | [
"Apache-2.0"
] | Python | run | null | def run():
"""Entry point for CLI. Parse arguments, locate function and call it"""
user = check_user()
parser = get_parser()
args = parser.parse_args()
# Ensure environment is set
dao_location = args.location or os.getenv(CONF.client.location_var)
dao_location = dao_location or CONF.client.l... | Entry point for CLI. Parse arguments, locate function and call it | Entry point for CLI. Parse arguments, locate function and call it | [
"Entry",
"point",
"for",
"CLI",
".",
"Parse",
"arguments",
"locate",
"function",
"and",
"call",
"it"
] | def run():
user = check_user()
parser = get_parser()
args = parser.parse_args()
dao_location = args.location or os.getenv(CONF.client.location_var)
dao_location = dao_location or CONF.client.location
if not dao_location:
parser.error('Either --location or {0} should be specified'.
... | [
"def",
"run",
"(",
")",
":",
"user",
"=",
"check_user",
"(",
")",
"parser",
"=",
"get_parser",
"(",
")",
"args",
"=",
"parser",
".",
"parse_args",
"(",
")",
"dao_location",
"=",
"args",
".",
"location",
"or",
"os",
".",
"getenv",
"(",
"CONF",
".",
... | Entry point for CLI. | [
"Entry",
"point",
"for",
"CLI",
"."
] | [
"\"\"\"Entry point for CLI. Parse arguments, locate function and call it\"\"\"",
"# Ensure environment is set"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
c031cc0aa9ad76fd99f0da11cb7979f587b0d313 | tloubrieu-jpl/incubator-sdap-nexus-ingestion-manager | sdap_ingest_manager/collections_ingester/google_spreadsheet_collection_config.py | [
"Apache-2.0"
] | Python | read_google_spreadsheet | null | def read_google_spreadsheet(scope, spreadsheet_id, tab, cell_range, row_callback):
""" Read the given tab in the google spreadsheet
and apply to each row the callback function.
Get credential for the google spreadheet api as documented:
https://console.developers.google.com/apis/credentials
"""
... | Read the given tab in the google spreadsheet
and apply to each row the callback function.
Get credential for the google spreadheet api as documented:
https://console.developers.google.com/apis/credentials
| Read the given tab in the google spreadsheet
and apply to each row the callback function. | [
"Read",
"the",
"given",
"tab",
"in",
"the",
"google",
"spreadsheet",
"and",
"apply",
"to",
"each",
"row",
"the",
"callback",
"function",
"."
] | def read_google_spreadsheet(scope, spreadsheet_id, tab, cell_range, row_callback):
logger.info("Read google spreadsheet %s, tab %s containing collection configurations",
spreadsheet_id,
tab)
creds = None
token_file_path = os.path.join(sys.prefix, '.sdap_ingest_manager', 'toke... | [
"def",
"read_google_spreadsheet",
"(",
"scope",
",",
"spreadsheet_id",
",",
"tab",
",",
"cell_range",
",",
"row_callback",
")",
":",
"logger",
".",
"info",
"(",
"\"Read google spreadsheet %s, tab %s containing collection configurations\"",
",",
"spreadsheet_id",
",",
"tab... | Read the given tab in the google spreadsheet
and apply to each row the callback function. | [
"Read",
"the",
"given",
"tab",
"in",
"the",
"google",
"spreadsheet",
"and",
"apply",
"to",
"each",
"row",
"the",
"callback",
"function",
"."
] | [
"\"\"\" Read the given tab in the google spreadsheet\n and apply to each row the callback function.\n Get credential for the google spreadheet api as documented:\n https://console.developers.google.com/apis/credentials\n \"\"\"",
"# The file token.pickle stores the user's access and refresh tokens, an... | [
{
"param": "scope",
"type": null
},
{
"param": "spreadsheet_id",
"type": null
},
{
"param": "tab",
"type": null
},
{
"param": "cell_range",
"type": null
},
{
"param": "row_callback",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "scope",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "spreadsheet_id",
"type": null,
"docstring": null,
"docstring... |
24f18ab3bd167a20601be5bcca709dc5ad2b9a00 | tloubrieu-jpl/incubator-sdap-nexus-ingestion-manager | sdap_ingest_manager/collections_ingester/collection_ingestion.py | [
"Apache-2.0"
] | Python | create_granule_list | null | def create_granule_list(file_path_pattern, dataset_ingestion_history_manager,
granule_list_file_path, deconstruct_nfs=False,
date_from=None, date_to=None,
forward_processing=False):
""" Creates a granule list file from a file path pattern
... | Creates a granule list file from a file path pattern
matching the granules.
If a granules has already been ingested with same md5sum signature, it is not included in this list.
When deconstruct_nfs is True, the paths will shown as viewed on the nfs server
and not as they are mounted on ... | Creates a granule list file from a file path pattern
matching the granules.
If a granules has already been ingested with same md5sum signature, it is not included in this list.
When deconstruct_nfs is True, the paths will shown as viewed on the nfs server
and not as they are mounted on the nfs client where the script r... | [
"Creates",
"a",
"granule",
"list",
"file",
"from",
"a",
"file",
"path",
"pattern",
"matching",
"the",
"granules",
".",
"If",
"a",
"granules",
"has",
"already",
"been",
"ingested",
"with",
"same",
"md5sum",
"signature",
"it",
"is",
"not",
"included",
"in",
... | def create_granule_list(file_path_pattern, dataset_ingestion_history_manager,
granule_list_file_path, deconstruct_nfs=False,
date_from=None, date_to=None,
forward_processing=False):
file_list = get_file_list(file_path_pattern)
logger.info("... | [
"def",
"create_granule_list",
"(",
"file_path_pattern",
",",
"dataset_ingestion_history_manager",
",",
"granule_list_file_path",
",",
"deconstruct_nfs",
"=",
"False",
",",
"date_from",
"=",
"None",
",",
"date_to",
"=",
"None",
",",
"forward_processing",
"=",
"False",
... | Creates a granule list file from a file path pattern
matching the granules. | [
"Creates",
"a",
"granule",
"list",
"file",
"from",
"a",
"file",
"path",
"pattern",
"matching",
"the",
"granules",
"."
] | [
"\"\"\" Creates a granule list file from a file path pattern\n matching the granules.\n If a granules has already been ingested with same md5sum signature, it is not included in this list.\n When deconstruct_nfs is True, the paths will shown as viewed on the nfs server\n and not as they ... | [
{
"param": "file_path_pattern",
"type": null
},
{
"param": "dataset_ingestion_history_manager",
"type": null
},
{
"param": "granule_list_file_path",
"type": null
},
{
"param": "deconstruct_nfs",
"type": null
},
{
"param": "date_from",
"type": null
},
{
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file_path_pattern",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dataset_ingestion_history_manager",
"type": null,
"doc... |
24f18ab3bd167a20601be5bcca709dc5ad2b9a00 | tloubrieu-jpl/incubator-sdap-nexus-ingestion-manager | sdap_ingest_manager/collections_ingester/collection_ingestion.py | [
"Apache-2.0"
] | Python | collection_row_callback | <not_specific> | def collection_row_callback(collection,
collection_config_template,
granule_file_list_root_path,
dataset_configuration_root_path,
history_root_path,
deconstruct_nfs=False,
... | Create the configuration and launch the ingestion
for the given collection row
| Create the configuration and launch the ingestion
for the given collection row | [
"Create",
"the",
"configuration",
"and",
"launch",
"the",
"ingestion",
"for",
"the",
"given",
"collection",
"row"
] | def collection_row_callback(collection,
collection_config_template,
granule_file_list_root_path,
dataset_configuration_root_path,
history_root_path,
deconstruct_nfs=False,
... | [
"def",
"collection_row_callback",
"(",
"collection",
",",
"collection_config_template",
",",
"granule_file_list_root_path",
",",
"dataset_configuration_root_path",
",",
"history_root_path",
",",
"deconstruct_nfs",
"=",
"False",
",",
"**",
"pods_run_kwargs",
")",
":",
"datas... | Create the configuration and launch the ingestion
for the given collection row | [
"Create",
"the",
"configuration",
"and",
"launch",
"the",
"ingestion",
"for",
"the",
"given",
"collection",
"row"
] | [
"\"\"\" Create the configuration and launch the ingestion\n for the given collection row\n \"\"\"",
"# add prefix \"from\" because is a reserved name which can not be used as function argument",
"# group must match the following regex (([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?",
"# and when suffixe... | [
{
"param": "collection",
"type": null
},
{
"param": "collection_config_template",
"type": null
},
{
"param": "granule_file_list_root_path",
"type": null
},
{
"param": "dataset_configuration_root_path",
"type": null
},
{
"param": "history_root_path",
"type": nu... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "collection",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "collection_config_template",
"type": null,
"docstring": null,... |
b7df5809c407f6065be644f43d89d038da6b8807 | tloubrieu-jpl/incubator-sdap-nexus-ingestion-manager | sdap_ingest_manager/collections_ingester/yaml_file_collection_config.py | [
"Apache-2.0"
] | Python | read_yaml_collection_config | null | def read_yaml_collection_config(file, collection_callback):
"""
Read the collection configuration in a yaml file, sort them by priority order
and apply row_callback on each collection
:param file: yaml file containing the configurations of the collections
:param collection_callback: function which i... |
Read the collection configuration in a yaml file, sort them by priority order
and apply row_callback on each collection
:param file: yaml file containing the configurations of the collections
:param collection_callback: function which is applied to each collection, take as parameter a dictionary
wi... | Read the collection configuration in a yaml file, sort them by priority order
and apply row_callback on each collection | [
"Read",
"the",
"collection",
"configuration",
"in",
"a",
"yaml",
"file",
"sort",
"them",
"by",
"priority",
"order",
"and",
"apply",
"row_callback",
"on",
"each",
"collection"
] | def read_yaml_collection_config(file, collection_callback):
with open(file, 'r') as f:
collections = yaml.load(f, Loader=yaml.FullLoader)
collections_array = []
for (c_id, collection) in collections.items():
collection['id'] = c_id
for k, v in collection.items():
if type(... | [
"def",
"read_yaml_collection_config",
"(",
"file",
",",
"collection_callback",
")",
":",
"with",
"open",
"(",
"file",
",",
"'r'",
")",
"as",
"f",
":",
"collections",
"=",
"yaml",
".",
"load",
"(",
"f",
",",
"Loader",
"=",
"yaml",
".",
"FullLoader",
")",
... | Read the collection configuration in a yaml file, sort them by priority order
and apply row_callback on each collection | [
"Read",
"the",
"collection",
"configuration",
"in",
"a",
"yaml",
"file",
"sort",
"them",
"by",
"priority",
"order",
"and",
"apply",
"row_callback",
"on",
"each",
"collection"
] | [
"\"\"\"\n Read the collection configuration in a yaml file, sort them by priority order\n and apply row_callback on each collection\n :param file: yaml file containing the configurations of the collections\n :param collection_callback: function which is applied to each collection, take as parameter a di... | [
{
"param": "file",
"type": null
},
{
"param": "collection_callback",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "file",
"type": null,
"docstring": "yaml file containing the configurations of the collections",
"docstring_tokens":... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | find_key | <not_specific> | def find_key(rec_dict, target, depth=0):
"""
find key "target" in recursive dict
:param rec_dict: dict to search in, json schema dict, so it is combination of dict and arrays
:param target: target key to search for
:param depth: depth of the search (recursion)
:return:
"""
try:
... |
find key "target" in recursive dict
:param rec_dict: dict to search in, json schema dict, so it is combination of dict and arrays
:param target: target key to search for
:param depth: depth of the search (recursion)
:return:
| find key "target" in recursive dict | [
"find",
"key",
"\"",
"target",
"\"",
"in",
"recursive",
"dict"
] | def find_key(rec_dict, target, depth=0):
try:
if isinstance(rec_dict, dict):
for key, value in rec_dict.items():
if key == target:
return rec_dict[key]
for key, value in rec_dict.items():
r = find_key(value, target, depth + 1)
... | [
"def",
"find_key",
"(",
"rec_dict",
",",
"target",
",",
"depth",
"=",
"0",
")",
":",
"try",
":",
"if",
"isinstance",
"(",
"rec_dict",
",",
"dict",
")",
":",
"for",
"key",
",",
"value",
"in",
"rec_dict",
".",
"items",
"(",
")",
":",
"if",
"key",
"... | find key "target" in recursive dict | [
"find",
"key",
"\"",
"target",
"\"",
"in",
"recursive",
"dict"
] | [
"\"\"\"\r\n find key \"target\" in recursive dict\r\n :param rec_dict: dict to search in, json schema dict, so it is combination of dict and arrays\r\n :param target: target key to search for\r\n :param depth: depth of the search (recursion)\r\n :return:\r\n \"\"\""
] | [
{
"param": "rec_dict",
"type": null
},
{
"param": "target",
"type": null
},
{
"param": "depth",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "rec_dict",
"type": null,
"docstring": "dict to search in, json schema dict, so it is combination of dict and arrays",
... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | find_key_link | <not_specific> | def find_key_link(rec_dict, target, depth=0):
"""
find the first key recursively
also traverse lists (arrays, oneOf,..) but only returns the first occurance
:param rec_dict: dict to search in, json schema dict, so it is combination of dict and arrays
:param target: target key to search for
... |
find the first key recursively
also traverse lists (arrays, oneOf,..) but only returns the first occurance
:param rec_dict: dict to search in, json schema dict, so it is combination of dict and arrays
:param target: target key to search for
:param depth: depth of the search (recursion)
:r... | find the first key recursively
also traverse lists (arrays, oneOf,..) but only returns the first occurance | [
"find",
"the",
"first",
"key",
"recursively",
"also",
"traverse",
"lists",
"(",
"arrays",
"oneOf",
"..",
")",
"but",
"only",
"returns",
"the",
"first",
"occurance"
] | def find_key_link(rec_dict, target, depth=0):
if isinstance(rec_dict, dict):
for key, value in rec_dict.items():
if key == target:
return rec_dict[key]
rvalues = []
found = False
for key, value in rec_dict.items():
if key in ["oneOf", "allOf", ... | [
"def",
"find_key_link",
"(",
"rec_dict",
",",
"target",
",",
"depth",
"=",
"0",
")",
":",
"if",
"isinstance",
"(",
"rec_dict",
",",
"dict",
")",
":",
"for",
"key",
",",
"value",
"in",
"rec_dict",
".",
"items",
"(",
")",
":",
"if",
"key",
"==",
"tar... | find the first key recursively
also traverse lists (arrays, oneOf,..) but only returns the first occurance | [
"find",
"the",
"first",
"key",
"recursively",
"also",
"traverse",
"lists",
"(",
"arrays",
"oneOf",
"..",
")",
"but",
"only",
"returns",
"the",
"first",
"occurance"
] | [
"\"\"\"\r\n find the first key recursively\r\n also traverse lists (arrays, oneOf,..) but only returns the first occurance\r\n :param rec_dict: dict to search in, json schema dict, so it is combination of dict and arrays\r\n :param target: target key to search for\r\n :param depth: depth of the searc... | [
{
"param": "rec_dict",
"type": null
},
{
"param": "target",
"type": null
},
{
"param": "depth",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "rec_dict",
"type": null,
"docstring": "dict to search in, json schema dict, so it is combination of dict and arrays",
... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | replace_chars | <not_specific> | def replace_chars(a, chars):
"""
function that replaces the occurrences of chars in the string
:param a: input string
:param chars: chars to be replaced with "" (nothing)
:return:
"""
string = a
for char in chars:
copy_string = string.replace(char, '')
string = ... |
function that replaces the occurrences of chars in the string
:param a: input string
:param chars: chars to be replaced with "" (nothing)
:return:
| function that replaces the occurrences of chars in the string | [
"function",
"that",
"replaces",
"the",
"occurrences",
"of",
"chars",
"in",
"the",
"string"
] | def replace_chars(a, chars):
string = a
for char in chars:
copy_string = string.replace(char, '')
string = copy_string
return string | [
"def",
"replace_chars",
"(",
"a",
",",
"chars",
")",
":",
"string",
"=",
"a",
"for",
"char",
"in",
"chars",
":",
"copy_string",
"=",
"string",
".",
"replace",
"(",
"char",
",",
"''",
")",
"string",
"=",
"copy_string",
"return",
"string"
] | function that replaces the occurrences of chars in the string | [
"function",
"that",
"replaces",
"the",
"occurrences",
"of",
"chars",
"in",
"the",
"string"
] | [
"\"\"\"\r\n function that replaces the occurrences of chars in the string\r\n :param a: input string\r\n :param chars: chars to be replaced with \"\" (nothing)\r\n :return:\r\n \"\"\""
] | [
{
"param": "a",
"type": null
},
{
"param": "chars",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "a",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
"is... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | add_justification_smart | <not_specific> | def add_justification_smart(depth, input_string, no_dot_split=False):
"""
add the spaces for an correct indentation of the generated RAML code section
for descriptions in the RAML definitions
:param depth: character depth, e.g. an string prefix
:param input_string: string to be adjusted
:r... |
add the spaces for an correct indentation of the generated RAML code section
for descriptions in the RAML definitions
:param depth: character depth, e.g. an string prefix
:param input_string: string to be adjusted
:return: adjusted string
| add the spaces for an correct indentation of the generated RAML code section
for descriptions in the RAML definitions | [
"add",
"the",
"spaces",
"for",
"an",
"correct",
"indentation",
"of",
"the",
"generated",
"RAML",
"code",
"section",
"for",
"descriptions",
"in",
"the",
"RAML",
"definitions"
] | def add_justification_smart(depth, input_string, no_dot_split=False):
ret_string = ""
all_lines = input_string.splitlines()
for x_line in all_lines:
if no_dot_split is False:
lines = x_line.split(". ")
for line in lines:
string1 = depth + line + "\n"
... | [
"def",
"add_justification_smart",
"(",
"depth",
",",
"input_string",
",",
"no_dot_split",
"=",
"False",
")",
":",
"ret_string",
"=",
"\"\"",
"all_lines",
"=",
"input_string",
".",
"splitlines",
"(",
")",
"for",
"x_line",
"in",
"all_lines",
":",
"if",
"no_dot_s... | add the spaces for an correct indentation of the generated RAML code section
for descriptions in the RAML definitions | [
"add",
"the",
"spaces",
"for",
"an",
"correct",
"indentation",
"of",
"the",
"generated",
"RAML",
"code",
"section",
"for",
"descriptions",
"in",
"the",
"RAML",
"definitions"
] | [
"\"\"\"\r\n add the spaces for an correct indentation of the generated RAML code section\r\n for descriptions in the RAML definitions\r\n :param depth: character depth, e.g. an string prefix\r\n :param input_string: string to be adjusted\r\n :return: adjusted string\r\n \"\"\""
] | [
{
"param": "depth",
"type": null
},
{
"param": "input_string",
"type": null
},
{
"param": "no_dot_split",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "depth",
"type": null,
"docstring": "character depth, e.g. an string prefix",
"docstring_tokens": [
"charact... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | retrieve_path_value | <not_specific> | def retrieve_path_value(parse_tree, path, value):
"""
retrieves the parameter values of an path instance
:param parse_tree: the json parse tree of the swagger document
:param path: path value of the value to find
:param value: value to find
:return:
"""
keys = path.split("/")
... |
retrieves the parameter values of an path instance
:param parse_tree: the json parse tree of the swagger document
:param path: path value of the value to find
:param value: value to find
:return:
| retrieves the parameter values of an path instance | [
"retrieves",
"the",
"parameter",
"values",
"of",
"an",
"path",
"instance"
] | def retrieve_path_value(parse_tree, path, value):
keys = path.split("/")
my_tree = parse_tree
for key in keys:
ret_my_tree = get_dict_by_path_name(my_tree, key)
my_tree = ret_my_tree
ret_value = None
if my_tree is not None:
ret_value = my_tree[value]
return ret_value | [
"def",
"retrieve_path_value",
"(",
"parse_tree",
",",
"path",
",",
"value",
")",
":",
"keys",
"=",
"path",
".",
"split",
"(",
"\"/\"",
")",
"my_tree",
"=",
"parse_tree",
"for",
"key",
"in",
"keys",
":",
"ret_my_tree",
"=",
"get_dict_by_path_name",
"(",
"my... | retrieves the parameter values of an path instance | [
"retrieves",
"the",
"parameter",
"values",
"of",
"an",
"path",
"instance"
] | [
"\"\"\"\r\n retrieves the parameter values of an path instance\r\n :param parse_tree: the json parse tree of the swagger document\r\n :param path: path value of the value to find\r\n :param value: value to find\r\n :return:\r\n \"\"\""
] | [
{
"param": "parse_tree",
"type": null
},
{
"param": "path",
"type": null
},
{
"param": "value",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "parse_tree",
"type": null,
"docstring": "the json parse tree of the swagger document",
"docstring_tokens": [
... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | retrieve_path_dict | <not_specific> | def retrieve_path_dict(parse_tree, path):
"""
retrieves the parameter values of an path instance
:param parse_tree: the json parse tree of the swagger document
:param path: path value of the dict to find
:return:
"""
keys = path.split("/")
my_tree = parse_tree
for key in key... |
retrieves the parameter values of an path instance
:param parse_tree: the json parse tree of the swagger document
:param path: path value of the dict to find
:return:
| retrieves the parameter values of an path instance | [
"retrieves",
"the",
"parameter",
"values",
"of",
"an",
"path",
"instance"
] | def retrieve_path_dict(parse_tree, path):
keys = path.split("/")
my_tree = parse_tree
for key in keys:
ret_my_tree = get_dict_by_path_name(my_tree, key)
my_tree = ret_my_tree
return my_tree | [
"def",
"retrieve_path_dict",
"(",
"parse_tree",
",",
"path",
")",
":",
"keys",
"=",
"path",
".",
"split",
"(",
"\"/\"",
")",
"my_tree",
"=",
"parse_tree",
"for",
"key",
"in",
"keys",
":",
"ret_my_tree",
"=",
"get_dict_by_path_name",
"(",
"my_tree",
",",
"k... | retrieves the parameter values of an path instance | [
"retrieves",
"the",
"parameter",
"values",
"of",
"an",
"path",
"instance"
] | [
"\"\"\"\r\n retrieves the parameter values of an path instance\r\n :param parse_tree: the json parse tree of the swagger document\r\n :param path: path value of the dict to find\r\n :return:\r\n \"\"\""
] | [
{
"param": "parse_tree",
"type": null
},
{
"param": "path",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "parse_tree",
"type": null,
"docstring": "the json parse tree of the swagger document",
"docstring_tokens": [
... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | parameter_names | <not_specific> | def parameter_names(parse_tree, path, value):
"""
retrieves the parameter values of an path instance
:param parse_tree: the json parse tree of the swagger document
:param path: path value of the
:param value: value to find
:return:
"""
parameters = get_value_by_path_name(parse_tr... |
retrieves the parameter values of an path instance
:param parse_tree: the json parse tree of the swagger document
:param path: path value of the
:param value: value to find
:return:
| retrieves the parameter values of an path instance | [
"retrieves",
"the",
"parameter",
"values",
"of",
"an",
"path",
"instance"
] | def parameter_names(parse_tree, path, value):
parameters = get_value_by_path_name(parse_tree, path, "parameters")
path_names = ""
for parameter_data in parameters:
print("parameter_names", parameter_data)
return path_names | [
"def",
"parameter_names",
"(",
"parse_tree",
",",
"path",
",",
"value",
")",
":",
"parameters",
"=",
"get_value_by_path_name",
"(",
"parse_tree",
",",
"path",
",",
"\"parameters\"",
")",
"path_names",
"=",
"\"\"",
"for",
"parameter_data",
"in",
"parameters",
":"... | retrieves the parameter values of an path instance | [
"retrieves",
"the",
"parameter",
"values",
"of",
"an",
"path",
"instance"
] | [
"\"\"\"\r\n retrieves the parameter values of an path instance\r\n :param parse_tree: the json parse tree of the swagger document\r\n :param path: path value of the\r\n :param value: value to find\r\n :return:\r\n \"\"\"",
"# this is an list\r"
] | [
{
"param": "parse_tree",
"type": null
},
{
"param": "path",
"type": null
},
{
"param": "value",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "parse_tree",
"type": null,
"docstring": "the json parse tree of the swagger document",
"docstring_tokens": [
... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | query_ref | <not_specific> | def query_ref(parse_tree, parameter_ref, value):
"""
find the reference of the query value
:param parse_tree: full json parse tree of the swagger file
:param parameter_ref: reference value to be found
:param value: key in the reference to be found
:return:
"""
keys = parameter_re... |
find the reference of the query value
:param parse_tree: full json parse tree of the swagger file
:param parameter_ref: reference value to be found
:param value: key in the reference to be found
:return:
| find the reference of the query value | [
"find",
"the",
"reference",
"of",
"the",
"query",
"value"
] | def query_ref(parse_tree, parameter_ref, value):
keys = parameter_ref.split("/")
index = len(keys)
parameter_block = get_value_by_path_name(
parse_tree, "parameters", keys[index - 1])
try:
return parameter_block[value]
except:
return "" | [
"def",
"query_ref",
"(",
"parse_tree",
",",
"parameter_ref",
",",
"value",
")",
":",
"keys",
"=",
"parameter_ref",
".",
"split",
"(",
"\"/\"",
")",
"index",
"=",
"len",
"(",
"keys",
")",
"parameter_block",
"=",
"get_value_by_path_name",
"(",
"parse_tree",
",... | find the reference of the query value | [
"find",
"the",
"reference",
"of",
"the",
"query",
"value"
] | [
"\"\"\"\r\n find the reference of the query value\r\n :param parse_tree: full json parse tree of the swagger file\r\n :param parameter_ref: reference value to be found\r\n :param value: key in the reference to be found\r\n :return:\r\n \"\"\""
] | [
{
"param": "parse_tree",
"type": null
},
{
"param": "parameter_ref",
"type": null
},
{
"param": "value",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "parse_tree",
"type": null,
"docstring": "full json parse tree of the swagger file",
"docstring_tokens": [
"... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | swagger_rt | <not_specific> | def swagger_rt(json_data):
"""
get the rt value from the example
:param json_data: the swagger file as json struct
:return: array of arrays of found values e.g. [ [a,b],[a,b] ]
"""
rt_values = []
for path, item in json_data["paths"].items():
try:
x_example = item... |
get the rt value from the example
:param json_data: the swagger file as json struct
:return: array of arrays of found values e.g. [ [a,b],[a,b] ]
| get the rt value from the example | [
"get",
"the",
"rt",
"value",
"from",
"the",
"example"
] | def swagger_rt(json_data):
rt_values = []
for path, item in json_data["paths"].items():
try:
x_example = item["get"]["responses"]["200"]["x-example"]
rt = x_example.get("rt")
for rt_value in rt:
rt_values.append([path, rt_value])
except:
... | [
"def",
"swagger_rt",
"(",
"json_data",
")",
":",
"rt_values",
"=",
"[",
"]",
"for",
"path",
",",
"item",
"in",
"json_data",
"[",
"\"paths\"",
"]",
".",
"items",
"(",
")",
":",
"try",
":",
"x_example",
"=",
"item",
"[",
"\"get\"",
"]",
"[",
"\"respons... | get the rt value from the example | [
"get",
"the",
"rt",
"value",
"from",
"the",
"example"
] | [
"\"\"\"\r\n get the rt value from the example\r\n :param json_data: the swagger file as json struct\r\n :return: array of arrays of found values e.g. [ [a,b],[a,b] ]\r\n \"\"\""
] | [
{
"param": "json_data",
"type": null
}
] | {
"returns": [
{
"docstring": "array of arrays of found values e.g.",
"docstring_tokens": [
"array",
"of",
"arrays",
"of",
"found",
"values",
"e",
".",
"g",
"."
],
"type": null
}
],
"raises": [],
"par... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | swagger_if | <not_specific> | def swagger_if(json_data, input_path):
"""
get the if value from the schema that is referenced by the path in get (or post)
:param json_data: the swagger file as json struct
:param input_path: the path to which the if should be queried
:return: list of if values
"""
return swagger_pro... |
get the if value from the schema that is referenced by the path in get (or post)
:param json_data: the swagger file as json struct
:param input_path: the path to which the if should be queried
:return: list of if values
| get the if value from the schema that is referenced by the path in get (or post) | [
"get",
"the",
"if",
"value",
"from",
"the",
"schema",
"that",
"is",
"referenced",
"by",
"the",
"path",
"in",
"get",
"(",
"or",
"post",
")"
] | def swagger_if(json_data, input_path):
return swagger_property_data_schema(json_data, input_path, "if") | [
"def",
"swagger_if",
"(",
"json_data",
",",
"input_path",
")",
":",
"return",
"swagger_property_data_schema",
"(",
"json_data",
",",
"input_path",
",",
"\"if\"",
")"
] | get the if value from the schema that is referenced by the path in get (or post) | [
"get",
"the",
"if",
"value",
"from",
"the",
"schema",
"that",
"is",
"referenced",
"by",
"the",
"path",
"in",
"get",
"(",
"or",
"post",
")"
] | [
"\"\"\"\r\n get the if value from the schema that is referenced by the path in get (or post)\r\n :param json_data: the swagger file as json struct\r\n :param input_path: the path to which the if should be queried\r\n :return: list of if values\r\n \"\"\""
] | [
{
"param": "json_data",
"type": null
},
{
"param": "input_path",
"type": null
}
] | {
"returns": [
{
"docstring": "list of if values",
"docstring_tokens": [
"list",
"of",
"if",
"values"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "json_data",
"type": null,
"docstring": "the swagger file as ... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | swagger_if_exist | <not_specific> | def swagger_if_exist(json_data, input_path, if_value):
"""
checks the if_value from the schema that is referenced by the path in get (or post)
:param json_data: the swagger file as json struct
:param input_path: the path to which the if should be queried
:param if_value: value to be checked if ... |
checks the if_value from the schema that is referenced by the path in get (or post)
:param json_data: the swagger file as json struct
:param input_path: the path to which the if should be queried
:param if_value: value to be checked if it exist
:return: True if found, False not found
| checks the if_value from the schema that is referenced by the path in get (or post) | [
"checks",
"the",
"if_value",
"from",
"the",
"schema",
"that",
"is",
"referenced",
"by",
"the",
"path",
"in",
"get",
"(",
"or",
"post",
")"
] | def swagger_if_exist(json_data, input_path, if_value):
data = swagger_property_data_schema(json_data, input_path, "if")
if if_value in data:
return True
return False | [
"def",
"swagger_if_exist",
"(",
"json_data",
",",
"input_path",
",",
"if_value",
")",
":",
"data",
"=",
"swagger_property_data_schema",
"(",
"json_data",
",",
"input_path",
",",
"\"if\"",
")",
"if",
"if_value",
"in",
"data",
":",
"return",
"True",
"return",
"F... | checks the if_value from the schema that is referenced by the path in get (or post) | [
"checks",
"the",
"if_value",
"from",
"the",
"schema",
"that",
"is",
"referenced",
"by",
"the",
"path",
"in",
"get",
"(",
"or",
"post",
")"
] | [
"\"\"\"\r\n checks the if_value from the schema that is referenced by the path in get (or post)\r\n :param json_data: the swagger file as json struct\r\n :param input_path: the path to which the if should be queried\r\n :param if_value: value to be checked if it exist\r\n :return: True if found, Fals... | [
{
"param": "json_data",
"type": null
},
{
"param": "input_path",
"type": null
},
{
"param": "if_value",
"type": null
}
] | {
"returns": [
{
"docstring": "True if found, False not found",
"docstring_tokens": [
"True",
"if",
"found",
"False",
"not",
"found"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "json_data",
"type":... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | swagger_if_exist_all | <not_specific> | def swagger_if_exist_all(json_data, if_value):
"""
checks the if_value from the schema that is referenced in any path
:param json_data: the swagger file as json struct
:param if_value: value to be checked if it exist
:return: True if found, False not found
"""
for path, item in json_d... |
checks the if_value from the schema that is referenced in any path
:param json_data: the swagger file as json struct
:param if_value: value to be checked if it exist
:return: True if found, False not found
| checks the if_value from the schema that is referenced in any path | [
"checks",
"the",
"if_value",
"from",
"the",
"schema",
"that",
"is",
"referenced",
"in",
"any",
"path"
] | def swagger_if_exist_all(json_data, if_value):
for path, item in json_data["paths"].items():
data = swagger_property_data_schema(json_data, path, "if")
if if_value in data:
return True
return False | [
"def",
"swagger_if_exist_all",
"(",
"json_data",
",",
"if_value",
")",
":",
"for",
"path",
",",
"item",
"in",
"json_data",
"[",
"\"paths\"",
"]",
".",
"items",
"(",
")",
":",
"data",
"=",
"swagger_property_data_schema",
"(",
"json_data",
",",
"path",
",",
... | checks the if_value from the schema that is referenced in any path | [
"checks",
"the",
"if_value",
"from",
"the",
"schema",
"that",
"is",
"referenced",
"in",
"any",
"path"
] | [
"\"\"\"\r\n checks the if_value from the schema that is referenced in any path\r\n :param json_data: the swagger file as json struct\r\n :param if_value: value to be checked if it exist\r\n :return: True if found, False not found\r\n \"\"\""
] | [
{
"param": "json_data",
"type": null
},
{
"param": "if_value",
"type": null
}
] | {
"returns": [
{
"docstring": "True if found, False not found",
"docstring_tokens": [
"True",
"if",
"found",
"False",
"not",
"found"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "json_data",
"type":... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | swagger_property_data_schema | <not_specific> | def swagger_property_data_schema(json_data, input_path, name):
"""swagger_property_data_schema
get the value of the property name from the schema that is referenced by the path in get (or post)
it tries to get first the enum values or the default value.
if this is not found then it will try to get t... | swagger_property_data_schema
get the value of the property name from the schema that is referenced by the path in get (or post)
it tries to get first the enum values or the default value.
if this is not found then it will try to get the value from the example
:param json_data: the swagger file as js... | swagger_property_data_schema
get the value of the property name from the schema that is referenced by the path in get (or post)
it tries to get first the enum values or the default value.
if this is not found then it will try to get the value from the example | [
"swagger_property_data_schema",
"get",
"the",
"value",
"of",
"the",
"property",
"name",
"from",
"the",
"schema",
"that",
"is",
"referenced",
"by",
"the",
"path",
"in",
"get",
"(",
"or",
"post",
")",
"it",
"tries",
"to",
"get",
"first",
"the",
"enum",
"valu... | def swagger_property_data_schema(json_data, input_path, name):
data_values = []
schema = None
example = None
for path, path_item in json_data["paths"].items():
if input_path == path:
try:
schema = path_item["get"]["responses"]["200"]["schema"]
except:
... | [
"def",
"swagger_property_data_schema",
"(",
"json_data",
",",
"input_path",
",",
"name",
")",
":",
"data_values",
"=",
"[",
"]",
"schema",
"=",
"None",
"example",
"=",
"None",
"for",
"path",
",",
"path_item",
"in",
"json_data",
"[",
"\"paths\"",
"]",
".",
... | swagger_property_data_schema
get the value of the property name from the schema that is referenced by the path in get (or post)
it tries to get first the enum values or the default value. | [
"swagger_property_data_schema",
"get",
"the",
"value",
"of",
"the",
"property",
"name",
"from",
"the",
"schema",
"that",
"is",
"referenced",
"by",
"the",
"path",
"in",
"get",
"(",
"or",
"post",
")",
"it",
"tries",
"to",
"get",
"first",
"the",
"enum",
"valu... | [
"\"\"\"swagger_property_data_schema\r\n get the value of the property name from the schema that is referenced by the path in get (or post)\r\n it tries to get first the enum values or the default value.\r\n if this is not found then it will try to get the value from the example\r\n :param json_data: the... | [
{
"param": "json_data",
"type": null
},
{
"param": "input_path",
"type": null
},
{
"param": "name",
"type": null
}
] | {
"returns": [
{
"docstring": "list of if values",
"docstring_tokens": [
"list",
"of",
"if",
"values"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "json_data",
"type": null,
"docstring": "the swagger file as ... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | swagger_property_names | <not_specific> | def swagger_property_names(json_data, input_path):
"""
get the properties from the schema that is referenced by the path in get (or put)
:param json_data: the swagger file as json struct
:param input_path: the path to which the if should be queried
:return: list of if values
"""
prop... |
get the properties from the schema that is referenced by the path in get (or put)
:param json_data: the swagger file as json struct
:param input_path: the path to which the if should be queried
:return: list of if values
| get the properties from the schema that is referenced by the path in get (or put) | [
"get",
"the",
"properties",
"from",
"the",
"schema",
"that",
"is",
"referenced",
"by",
"the",
"path",
"in",
"get",
"(",
"or",
"put",
")"
] | def swagger_property_names(json_data, input_path):
prop_values = []
schema = None
for path, path_item in json_data["paths"].items():
if input_path == path:
try:
schema = path_item["get"]["responses"]["200"]["schema"]
except:
try:
... | [
"def",
"swagger_property_names",
"(",
"json_data",
",",
"input_path",
")",
":",
"prop_values",
"=",
"[",
"]",
"schema",
"=",
"None",
"for",
"path",
",",
"path_item",
"in",
"json_data",
"[",
"\"paths\"",
"]",
".",
"items",
"(",
")",
":",
"if",
"input_path",... | get the properties from the schema that is referenced by the path in get (or put) | [
"get",
"the",
"properties",
"from",
"the",
"schema",
"that",
"is",
"referenced",
"by",
"the",
"path",
"in",
"get",
"(",
"or",
"put",
")"
] | [
"\"\"\"\r\n get the properties from the schema that is referenced by the path in get (or put)\r\n :param json_data: the swagger file as json struct\r\n :param input_path: the path to which the if should be queried\r\n :return: list of if values\r\n \"\"\""
] | [
{
"param": "json_data",
"type": null
},
{
"param": "input_path",
"type": null
}
] | {
"returns": [
{
"docstring": "list of if values",
"docstring_tokens": [
"list",
"of",
"if",
"values"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "json_data",
"type": null,
"docstring": "the swagger file as ... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | swagger_properties | <not_specific> | def swagger_properties(json_data, input_path):
"""
get the properties from the schema that is referenced by the path in get (or post)
:param json_data: the swagger file as json struct
:param input_path: the path to which the if should be queried
:return: list of if values
"""
prop_bl... |
get the properties from the schema that is referenced by the path in get (or post)
:param json_data: the swagger file as json struct
:param input_path: the path to which the if should be queried
:return: list of if values
| get the properties from the schema that is referenced by the path in get (or post) | [
"get",
"the",
"properties",
"from",
"the",
"schema",
"that",
"is",
"referenced",
"by",
"the",
"path",
"in",
"get",
"(",
"or",
"post",
")"
] | def swagger_properties(json_data, input_path):
prop_block = []
schema = None
for path, path_item in json_data["paths"].items():
if input_path == path:
try:
schema = path_item["get"]["responses"]["200"]["schema"]
except:
try:
... | [
"def",
"swagger_properties",
"(",
"json_data",
",",
"input_path",
")",
":",
"prop_block",
"=",
"[",
"]",
"schema",
"=",
"None",
"for",
"path",
",",
"path_item",
"in",
"json_data",
"[",
"\"paths\"",
"]",
".",
"items",
"(",
")",
":",
"if",
"input_path",
"=... | get the properties from the schema that is referenced by the path in get (or post) | [
"get",
"the",
"properties",
"from",
"the",
"schema",
"that",
"is",
"referenced",
"by",
"the",
"path",
"in",
"get",
"(",
"or",
"post",
")"
] | [
"\"\"\"\r\n get the properties from the schema that is referenced by the path in get (or post)\r\n :param json_data: the swagger file as json struct\r\n :param input_path: the path to which the if should be queried\r\n :return: list of if values\r\n \"\"\"",
"# print(\"swagger_properties: path:\",... | [
{
"param": "json_data",
"type": null
},
{
"param": "input_path",
"type": null
}
] | {
"returns": [
{
"docstring": "list of if values",
"docstring_tokens": [
"list",
"of",
"if",
"values"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "json_data",
"type": null,
"docstring": "the swagger file as ... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | swagger_properties_get | <not_specific> | def swagger_properties_get(json_data, input_path):
"""
get the properties from the schema that is referenced by the path in get (or post)
:param json_data: the swagger file as json struct
:param input_path: the path to which the if should be queried
:return: list of if values
"""
pro... |
get the properties from the schema that is referenced by the path in get (or post)
:param json_data: the swagger file as json struct
:param input_path: the path to which the if should be queried
:return: list of if values
| get the properties from the schema that is referenced by the path in get (or post) | [
"get",
"the",
"properties",
"from",
"the",
"schema",
"that",
"is",
"referenced",
"by",
"the",
"path",
"in",
"get",
"(",
"or",
"post",
")"
] | def swagger_properties_get(json_data, input_path):
prop_block = {}
schema = None
for path, path_item in json_data["paths"].items():
if input_path == path:
try:
schema = path_item["get"]["responses"]["200"]["schema"]
except:
try:
... | [
"def",
"swagger_properties_get",
"(",
"json_data",
",",
"input_path",
")",
":",
"prop_block",
"=",
"{",
"}",
"schema",
"=",
"None",
"for",
"path",
",",
"path_item",
"in",
"json_data",
"[",
"\"paths\"",
"]",
".",
"items",
"(",
")",
":",
"if",
"input_path",
... | get the properties from the schema that is referenced by the path in get (or post) | [
"get",
"the",
"properties",
"from",
"the",
"schema",
"that",
"is",
"referenced",
"by",
"the",
"path",
"in",
"get",
"(",
"or",
"post",
")"
] | [
"\"\"\"\r\n get the properties from the schema that is referenced by the path in get (or post)\r\n :param json_data: the swagger file as json struct\r\n :param input_path: the path to which the if should be queried\r\n :return: list of if values\r\n \"\"\""
] | [
{
"param": "json_data",
"type": null
},
{
"param": "input_path",
"type": null
}
] | {
"returns": [
{
"docstring": "list of if values",
"docstring_tokens": [
"list",
"of",
"if",
"values"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "json_data",
"type": null,
"docstring": "the swagger file as ... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | swagger_properties_post | <not_specific> | def swagger_properties_post(json_data, input_path):
"""
get the properties from the schema that is referenced by the path in post (or get)
:param json_data: the swagger file as json struct
:param input_path: the path to which the if should be queried
:return: list of if values
"""
pr... |
get the properties from the schema that is referenced by the path in post (or get)
:param json_data: the swagger file as json struct
:param input_path: the path to which the if should be queried
:return: list of if values
| get the properties from the schema that is referenced by the path in post (or get) | [
"get",
"the",
"properties",
"from",
"the",
"schema",
"that",
"is",
"referenced",
"by",
"the",
"path",
"in",
"post",
"(",
"or",
"get",
")"
] | def swagger_properties_post(json_data, input_path):
prop_block = {}
schema = None
for path, path_item in json_data["paths"].items():
if input_path == path:
try:
schema_param = path_item["post"]["parameters"]
for item in schema_param:
sc... | [
"def",
"swagger_properties_post",
"(",
"json_data",
",",
"input_path",
")",
":",
"prop_block",
"=",
"{",
"}",
"schema",
"=",
"None",
"for",
"path",
",",
"path_item",
"in",
"json_data",
"[",
"\"paths\"",
"]",
".",
"items",
"(",
")",
":",
"if",
"input_path",... | get the properties from the schema that is referenced by the path in post (or get) | [
"get",
"the",
"properties",
"from",
"the",
"schema",
"that",
"is",
"referenced",
"by",
"the",
"path",
"in",
"post",
"(",
"or",
"get",
")"
] | [
"\"\"\"\r\n get the properties from the schema that is referenced by the path in post (or get)\r\n :param json_data: the swagger file as json struct\r\n :param input_path: the path to which the if should be queried\r\n :return: list of if values\r\n \"\"\""
] | [
{
"param": "json_data",
"type": null
},
{
"param": "input_path",
"type": null
}
] | {
"returns": [
{
"docstring": "list of if values",
"docstring_tokens": [
"list",
"of",
"if",
"values"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "json_data",
"type": null,
"docstring": "the swagger file as ... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | swagger_required_items | <not_specific> | def swagger_required_items(json_data, input_path):
"""
get the required properties list from the schema that is referenced by the path in post (or get)
:param json_data: the swagger file as json struct
:param input_path: the path to which the if should be queried
:return: list of if values
... |
get the required properties list from the schema that is referenced by the path in post (or get)
:param json_data: the swagger file as json struct
:param input_path: the path to which the if should be queried
:return: list of if values
| get the required properties list from the schema that is referenced by the path in post (or get) | [
"get",
"the",
"required",
"properties",
"list",
"from",
"the",
"schema",
"that",
"is",
"referenced",
"by",
"the",
"path",
"in",
"post",
"(",
"or",
"get",
")"
] | def swagger_required_items(json_data, input_path):
prop_block = []
schema = None
for path, path_item in json_data["paths"].items():
if input_path == path:
try:
schema_param = path_item["post"]["parameters"]
for item in schema_param:
sch... | [
"def",
"swagger_required_items",
"(",
"json_data",
",",
"input_path",
")",
":",
"prop_block",
"=",
"[",
"]",
"schema",
"=",
"None",
"for",
"path",
",",
"path_item",
"in",
"json_data",
"[",
"\"paths\"",
"]",
".",
"items",
"(",
")",
":",
"if",
"input_path",
... | get the required properties list from the schema that is referenced by the path in post (or get) | [
"get",
"the",
"required",
"properties",
"list",
"from",
"the",
"schema",
"that",
"is",
"referenced",
"by",
"the",
"path",
"in",
"post",
"(",
"or",
"get",
")"
] | [
"\"\"\"\r\n get the required properties list from the schema that is referenced by the path in post (or get)\r\n :param json_data: the swagger file as json struct\r\n :param input_path: the path to which the if should be queried\r\n :return: list of if values\r\n \"\"\""
] | [
{
"param": "json_data",
"type": null
},
{
"param": "input_path",
"type": null
}
] | {
"returns": [
{
"docstring": "list of if values",
"docstring_tokens": [
"list",
"of",
"if",
"values"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "json_data",
"type": null,
"docstring": "the swagger file as ... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | swagger_properties_filtered | <not_specific> | def swagger_properties_filtered(json_data, input_path):
"""
returns the properties of "GET & POST 200".
remove common properties & resource properties from the list of properties in the resource
see Resource spec
"""
properties_list_get = swagger_properties_get(json_data, input_path)... |
returns the properties of "GET & POST 200".
remove common properties & resource properties from the list of properties in the resource
see Resource spec
| returns the properties of "GET & POST 200".
remove common properties & resource properties from the list of properties in the resource
see Resource spec | [
"returns",
"the",
"properties",
"of",
"\"",
"GET",
"&",
"POST",
"200",
"\"",
".",
"remove",
"common",
"properties",
"&",
"resource",
"properties",
"from",
"the",
"list",
"of",
"properties",
"in",
"the",
"resource",
"see",
"Resource",
"spec"
] | def swagger_properties_filtered(json_data, input_path):
properties_list_get = swagger_properties_get(json_data, input_path)
properties_list_post = swagger_properties_post(json_data, input_path)
my_dict = OrderedDict()
if properties_list_get is not None:
for item, item_val in properties_list_get.... | [
"def",
"swagger_properties_filtered",
"(",
"json_data",
",",
"input_path",
")",
":",
"properties_list_get",
"=",
"swagger_properties_get",
"(",
"json_data",
",",
"input_path",
")",
"properties_list_post",
"=",
"swagger_properties_post",
"(",
"json_data",
",",
"input_path"... | returns the properties of "GET & POST 200". | [
"returns",
"the",
"properties",
"of",
"\"",
"GET",
"&",
"POST",
"200",
"\"",
"."
] | [
"\"\"\"\r\n returns the properties of \"GET & POST 200\".\r\n remove common properties & resource properties from the list of properties in the resource\r\n see Resource spec\r\n \"\"\""
] | [
{
"param": "json_data",
"type": null
},
{
"param": "input_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "json_data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "input_path",
"type": null,
"docstring": null,
"docstring... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | swagger_properties_filtered_get | <not_specific> | def swagger_properties_filtered_get(json_data, input_path):
"""
returns the properties of "GET 200".
remove common properties & resource properties from the list of properties in the resource
see Resource spec
"""
properties_list = swagger_properties_get(json_data, input_path)
m... |
returns the properties of "GET 200".
remove common properties & resource properties from the list of properties in the resource
see Resource spec
| returns the properties of "GET 200".
remove common properties & resource properties from the list of properties in the resource
see Resource spec | [
"returns",
"the",
"properties",
"of",
"\"",
"GET",
"200",
"\"",
".",
"remove",
"common",
"properties",
"&",
"resource",
"properties",
"from",
"the",
"list",
"of",
"properties",
"in",
"the",
"resource",
"see",
"Resource",
"spec"
] | def swagger_properties_filtered_get(json_data, input_path):
properties_list = swagger_properties_get(json_data, input_path)
my_dict = OrderedDict()
if properties_list is not None:
for item, item_val in properties_list.items():
if item not in ["n", "if", "rt", "id"]:
my_di... | [
"def",
"swagger_properties_filtered_get",
"(",
"json_data",
",",
"input_path",
")",
":",
"properties_list",
"=",
"swagger_properties_get",
"(",
"json_data",
",",
"input_path",
")",
"my_dict",
"=",
"OrderedDict",
"(",
")",
"if",
"properties_list",
"is",
"not",
"None"... | returns the properties of "GET 200". | [
"returns",
"the",
"properties",
"of",
"\"",
"GET",
"200",
"\"",
"."
] | [
"\"\"\"\r\n returns the properties of \"GET 200\".\r\n remove common properties & resource properties from the list of properties in the resource\r\n see Resource spec\r\n \"\"\""
] | [
{
"param": "json_data",
"type": null
},
{
"param": "input_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "json_data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "input_path",
"type": null,
"docstring": null,
"docstring... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | swagger_properties_filtered_post | <not_specific> | def swagger_properties_filtered_post(json_data, input_path):
"""
returns the properties of "POST 200".
remove common properties & resource properties from the list of properties in the resource
see Resource spec
"""
properties_list = swagger_properties_post(json_data, input_path)
... |
returns the properties of "POST 200".
remove common properties & resource properties from the list of properties in the resource
see Resource spec
| returns the properties of "POST 200".
remove common properties & resource properties from the list of properties in the resource
see Resource spec | [
"returns",
"the",
"properties",
"of",
"\"",
"POST",
"200",
"\"",
".",
"remove",
"common",
"properties",
"&",
"resource",
"properties",
"from",
"the",
"list",
"of",
"properties",
"in",
"the",
"resource",
"see",
"Resource",
"spec"
] | def swagger_properties_filtered_post(json_data, input_path):
properties_list = swagger_properties_post(json_data, input_path)
my_dict = OrderedDict()
if properties_list is not None:
for item, item_val in properties_list.items():
if item not in ["n", "if", "rt", "id"]:
my_... | [
"def",
"swagger_properties_filtered_post",
"(",
"json_data",
",",
"input_path",
")",
":",
"properties_list",
"=",
"swagger_properties_post",
"(",
"json_data",
",",
"input_path",
")",
"my_dict",
"=",
"OrderedDict",
"(",
")",
"if",
"properties_list",
"is",
"not",
"Non... | returns the properties of "POST 200". | [
"returns",
"the",
"properties",
"of",
"\"",
"POST",
"200",
"\"",
"."
] | [
"\"\"\"\r\n returns the properties of \"POST 200\".\r\n remove common properties & resource properties from the list of properties in the resource\r\n see Resource spec\r\n \"\"\""
] | [
{
"param": "json_data",
"type": null
},
{
"param": "input_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "json_data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "input_path",
"type": null,
"docstring": null,
"docstring... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | retrieve_rt_from_path | <not_specific> | def retrieve_rt_from_path(parse_tree, path):
"""
find the rt from path level
:param parse_tree: full json parse tree of the swagger file
:param parameter_ref: reference value to be found
:param value: key in the reference to be found
:return:
"""
found_values = swagger_rt(parse_t... |
find the rt from path level
:param parse_tree: full json parse tree of the swagger file
:param parameter_ref: reference value to be found
:param value: key in the reference to be found
:return:
| find the rt from path level | [
"find",
"the",
"rt",
"from",
"path",
"level"
] | def retrieve_rt_from_path(parse_tree, path):
found_values = swagger_rt(parse_tree)
for value in found_values:
if value[0] == path:
return value[1]
return "" | [
"def",
"retrieve_rt_from_path",
"(",
"parse_tree",
",",
"path",
")",
":",
"found_values",
"=",
"swagger_rt",
"(",
"parse_tree",
")",
"for",
"value",
"in",
"found_values",
":",
"if",
"value",
"[",
"0",
"]",
"==",
"path",
":",
"return",
"value",
"[",
"1",
... | find the rt from path level | [
"find",
"the",
"rt",
"from",
"path",
"level"
] | [
"\"\"\"\r\n find the rt from path level\r\n :param parse_tree: full json parse tree of the swagger file\r\n :param parameter_ref: reference value to be found\r\n :param value: key in the reference to be found\r\n :return:\r\n \"\"\""
] | [
{
"param": "parse_tree",
"type": null
},
{
"param": "path",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "parse_tree",
"type": null,
"docstring": "full json parse tree of the swagger file",
"docstring_tokens": [
"... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | query_path | <not_specific> | def query_path(parse_tree, my_path, value):
"""
find the reference of the query value
:param parse_tree: full json parse tree of the swagger file
:param parameter_ref: reference value to be found
:param value: key in the reference to be found
:return:
"""
keys = my_path.split("/"... |
find the reference of the query value
:param parse_tree: full json parse tree of the swagger file
:param parameter_ref: reference value to be found
:param value: key in the reference to be found
:return:
| find the reference of the query value | [
"find",
"the",
"reference",
"of",
"the",
"query",
"value"
] | def query_path(parse_tree, my_path, value):
keys = my_path.split("/")
index = len(keys)
parameter_block = get_value_by_path_name(
parse_tree, "parameters", keys[index - 1])
try:
return parameter_block[value]
except:
return "" | [
"def",
"query_path",
"(",
"parse_tree",
",",
"my_path",
",",
"value",
")",
":",
"keys",
"=",
"my_path",
".",
"split",
"(",
"\"/\"",
")",
"index",
"=",
"len",
"(",
"keys",
")",
"parameter_block",
"=",
"get_value_by_path_name",
"(",
"parse_tree",
",",
"\"par... | find the reference of the query value | [
"find",
"the",
"reference",
"of",
"the",
"query",
"value"
] | [
"\"\"\"\r\n find the reference of the query value\r\n :param parse_tree: full json parse tree of the swagger file\r\n :param parameter_ref: reference value to be found\r\n :param value: key in the reference to be found\r\n :return:\r\n \"\"\""
] | [
{
"param": "parse_tree",
"type": null
},
{
"param": "my_path",
"type": null
},
{
"param": "value",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "parse_tree",
"type": null,
"docstring": "full json parse tree of the swagger file",
"docstring_tokens": [
"... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | ishasbody | <not_specific> | def ishasbody(method):
"""
check if the method can have an body: e.g. put, post and patch
:param method: (get, put, post, ....)
:return:
"""
if method in ["put", "post", "patch"]:
return True
return False |
check if the method can have an body: e.g. put, post and patch
:param method: (get, put, post, ....)
:return:
| check if the method can have an body: e.g. put, post and patch | [
"check",
"if",
"the",
"method",
"can",
"have",
"an",
"body",
":",
"e",
".",
"g",
".",
"put",
"post",
"and",
"patch"
] | def ishasbody(method):
if method in ["put", "post", "patch"]:
return True
return False | [
"def",
"ishasbody",
"(",
"method",
")",
":",
"if",
"method",
"in",
"[",
"\"put\"",
",",
"\"post\"",
",",
"\"patch\"",
"]",
":",
"return",
"True",
"return",
"False"
] | check if the method can have an body: e.g. | [
"check",
"if",
"the",
"method",
"can",
"have",
"an",
"body",
":",
"e",
".",
"g",
"."
] | [
"\"\"\"\r\n check if the method can have an body: e.g. put, post and patch\r\n :param method: (get, put, post, ....)\r\n :return:\r\n \"\"\""
] | [
{
"param": "method",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "method",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | classsyntax | <not_specific> | def classsyntax(input_string):
"""
replace invalid chars so that it can be used and capitalize first char
:param input_string: string to be adjusted
:return: adjusted string
"""
chars_to_replace = "/\ +-*^|%$=~@()[].,"
return replace_chars(input_string, chars_to_replace).capitalize() |
replace invalid chars so that it can be used and capitalize first char
:param input_string: string to be adjusted
:return: adjusted string
| replace invalid chars so that it can be used and capitalize first char | [
"replace",
"invalid",
"chars",
"so",
"that",
"it",
"can",
"be",
"used",
"and",
"capitalize",
"first",
"char"
] | def classsyntax(input_string):
chars_to_replace = "/\ +-*^|%$=~@()[].,"
return replace_chars(input_string, chars_to_replace).capitalize() | [
"def",
"classsyntax",
"(",
"input_string",
")",
":",
"chars_to_replace",
"=",
"\"/\\ +-*^|%$=~@()[].,\"",
"return",
"replace_chars",
"(",
"input_string",
",",
"chars_to_replace",
")",
".",
"capitalize",
"(",
")"
] | replace invalid chars so that it can be used and capitalize first char | [
"replace",
"invalid",
"chars",
"so",
"that",
"it",
"can",
"be",
"used",
"and",
"capitalize",
"first",
"char"
] | [
"\"\"\"\r\n replace invalid chars so that it can be used and capitalize first char\r\n :param input_string: string to be adjusted\r\n :return: adjusted string\r\n \"\"\""
] | [
{
"param": "input_string",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "input_string",
"type": null,
"docstring": "string to be adjusted",
"docstring_tokens": [
"string",
... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | variablesyntax | <not_specific> | def variablesyntax(input_string):
"""
replace chars so that it can be used as an variable
:param input_string: string to be adjusted
:return: adjusted string
"""
chars_to_replace = "/\ +-*^|%$=~@()[].,?"
return "_" + replace_chars(input_string, chars_to_replace) |
replace chars so that it can be used as an variable
:param input_string: string to be adjusted
:return: adjusted string
| replace chars so that it can be used as an variable | [
"replace",
"chars",
"so",
"that",
"it",
"can",
"be",
"used",
"as",
"an",
"variable"
] | def variablesyntax(input_string):
chars_to_replace = "/\ +-*^|%$=~@()[].,?"
return "_" + replace_chars(input_string, chars_to_replace) | [
"def",
"variablesyntax",
"(",
"input_string",
")",
":",
"chars_to_replace",
"=",
"\"/\\ +-*^|%$=~@()[].,?\"",
"return",
"\"_\"",
"+",
"replace_chars",
"(",
"input_string",
",",
"chars_to_replace",
")"
] | replace chars so that it can be used as an variable | [
"replace",
"chars",
"so",
"that",
"it",
"can",
"be",
"used",
"as",
"an",
"variable"
] | [
"\"\"\"\r\n replace chars so that it can be used as an variable\r\n :param input_string: string to be adjusted\r\n :return: adjusted string\r\n \"\"\""
] | [
{
"param": "input_string",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "input_string",
"type": null,
"docstring": "string to be adjusted",
"docstring_tokens": [
"string",
... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | variableforbidden | <not_specific> | def variableforbidden(input_string):
"""
replace chars so that it can be used as an variable
:param input_string: string to be adjusted
:return: adjusted string
"""
if input_string in ["if", "var", "function", "null"]:
return "_" + input_string
return input_string |
replace chars so that it can be used as an variable
:param input_string: string to be adjusted
:return: adjusted string
| replace chars so that it can be used as an variable | [
"replace",
"chars",
"so",
"that",
"it",
"can",
"be",
"used",
"as",
"an",
"variable"
] | def variableforbidden(input_string):
if input_string in ["if", "var", "function", "null"]:
return "_" + input_string
return input_string | [
"def",
"variableforbidden",
"(",
"input_string",
")",
":",
"if",
"input_string",
"in",
"[",
"\"if\"",
",",
"\"var\"",
",",
"\"function\"",
",",
"\"null\"",
"]",
":",
"return",
"\"_\"",
"+",
"input_string",
"return",
"input_string"
] | replace chars so that it can be used as an variable | [
"replace",
"chars",
"so",
"that",
"it",
"can",
"be",
"used",
"as",
"an",
"variable"
] | [
"\"\"\"\r\n replace chars so that it can be used as an variable\r\n :param input_string: string to be adjusted\r\n :return: adjusted string\r\n \"\"\""
] | [
{
"param": "input_string",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "input_string",
"type": null,
"docstring": "string to be adjusted",
"docstring_tokens": [
"string",
... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | convert_to_cplus_type | <not_specific> | def convert_to_cplus_type(json_type):
"""
convert the json type to c++ type
:param json_type: the json type
:return: c++ type.
"""
if json_type in ["boolean"]:
return "bool"
if json_type in ["number"]:
return "double"
if json_type in ["integer"]:
return... |
convert the json type to c++ type
:param json_type: the json type
:return: c++ type.
| convert the json type to c++ type | [
"convert",
"the",
"json",
"type",
"to",
"c",
"++",
"type"
] | def convert_to_cplus_type(json_type):
if json_type in ["boolean"]:
return "bool"
if json_type in ["number"]:
return "double"
if json_type in ["integer"]:
return "int"
if json_type in ["string"]:
return "std::string"
if json_type in ["object"]:
return "OCRepr... | [
"def",
"convert_to_cplus_type",
"(",
"json_type",
")",
":",
"if",
"json_type",
"in",
"[",
"\"boolean\"",
"]",
":",
"return",
"\"bool\"",
"if",
"json_type",
"in",
"[",
"\"number\"",
"]",
":",
"return",
"\"double\"",
"if",
"json_type",
"in",
"[",
"\"integer\"",
... | convert the json type to c++ type | [
"convert",
"the",
"json",
"type",
"to",
"c",
"++",
"type"
] | [
"\"\"\"\r\n convert the json type to c++ type\r\n :param json_type: the json type\r\n :return: c++ type.\r\n \"\"\"",
"# uint8_t ?\r"
] | [
{
"param": "json_type",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "json_type",
"type": null,
"docstring": "the json type",
"docstring_tokens": [
"the",
"json",
... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | convert_to_cplus_array_type | <not_specific> | def convert_to_cplus_array_type(json_data):
"""
convert the json type to c++ type
:param json_type: the json type
:return: c++ type.
"""
subtype = json_data["items"].get("type")
subtype_oneOff = json_data["items"].get("oneOf")
if subtype is not None:
if subtype in ["st... |
convert the json type to c++ type
:param json_type: the json type
:return: c++ type.
| convert the json type to c++ type | [
"convert",
"the",
"json",
"type",
"to",
"c",
"++",
"type"
] | def convert_to_cplus_array_type(json_data):
subtype = json_data["items"].get("type")
subtype_oneOff = json_data["items"].get("oneOf")
if subtype is not None:
if subtype in ["string", "number", "boolean", "integer"]:
return "std::vector<" + convert_to_cplus_type(json_data["items"]["type"]... | [
"def",
"convert_to_cplus_array_type",
"(",
"json_data",
")",
":",
"subtype",
"=",
"json_data",
"[",
"\"items\"",
"]",
".",
"get",
"(",
"\"type\"",
")",
"subtype_oneOff",
"=",
"json_data",
"[",
"\"items\"",
"]",
".",
"get",
"(",
"\"oneOf\"",
")",
"if",
"subty... | convert the json type to c++ type | [
"convert",
"the",
"json",
"type",
"to",
"c",
"++",
"type"
] | [
"\"\"\"\r\n convert the json type to c++ type\r\n :param json_type: the json type\r\n :return: c++ type.\r\n \"\"\""
] | [
{
"param": "json_data",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "json_data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": nu... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | convert_to_c_type | <not_specific> | def convert_to_c_type(json_type):
"""
convert the json type to c type
:param json_type: the json type
:return: c type.
"""
if json_type in ["boolean"]:
return "bool"
if json_type in ["number"]:
return "double"
if json_type in ["integer"]:
return "int" ... |
convert the json type to c type
:param json_type: the json type
:return: c type.
| convert the json type to c type | [
"convert",
"the",
"json",
"type",
"to",
"c",
"type"
] | def convert_to_c_type(json_type):
if json_type in ["boolean"]:
return "bool"
if json_type in ["number"]:
return "double"
if json_type in ["integer"]:
return "int"
if json_type in ["string"]:
return "char*"
if json_type in ["string[]"]:
return "char**"
if... | [
"def",
"convert_to_c_type",
"(",
"json_type",
")",
":",
"if",
"json_type",
"in",
"[",
"\"boolean\"",
"]",
":",
"return",
"\"bool\"",
"if",
"json_type",
"in",
"[",
"\"number\"",
"]",
":",
"return",
"\"double\"",
"if",
"json_type",
"in",
"[",
"\"integer\"",
"]... | convert the json type to c type | [
"convert",
"the",
"json",
"type",
"to",
"c",
"type"
] | [
"\"\"\"\r\n convert the json type to c type\r\n :param json_type: the json type\r\n :return: c type.\r\n \"\"\"",
"# uint8_t ?\r",
"# array versions e.g. postpended with []\r"
] | [
{
"param": "json_type",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "json_type",
"type": null,
"docstring": "the json type",
"docstring_tokens": [
"the",
"json",
... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | convert_to_c_type_no_pointer | <not_specific> | def convert_to_c_type_no_pointer(json_type):
"""
convert the json type to c type
:param json_type: the json type
:return: c type.
"""
if json_type == "boolean":
return "bool"
if json_type == "number":
return "double"
if json_type == "integer":
return "i... |
convert the json type to c type
:param json_type: the json type
:return: c type.
| convert the json type to c type | [
"convert",
"the",
"json",
"type",
"to",
"c",
"type"
] | def convert_to_c_type_no_pointer(json_type):
if json_type == "boolean":
return "bool"
if json_type == "number":
return "double"
if json_type == "integer":
return "int"
if json_type == "string":
return "char"
if json_type == "string[]":
return "char"
if j... | [
"def",
"convert_to_c_type_no_pointer",
"(",
"json_type",
")",
":",
"if",
"json_type",
"==",
"\"boolean\"",
":",
"return",
"\"bool\"",
"if",
"json_type",
"==",
"\"number\"",
":",
"return",
"\"double\"",
"if",
"json_type",
"==",
"\"integer\"",
":",
"return",
"\"int\... | convert the json type to c type | [
"convert",
"the",
"json",
"type",
"to",
"c",
"type"
] | [
"\"\"\"\r\n convert the json type to c type\r\n :param json_type: the json type\r\n :return: c type.\r\n \"\"\"",
"# uint8_t ?\r",
"# array versions e.g. postpended with []\r",
"# 2D array versions e.g. postpended with [][]\r"
] | [
{
"param": "json_type",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "json_type",
"type": null,
"docstring": "the json type",
"docstring_tokens": [
"the",
"json",
... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | convert_to_c_type_array_size | <not_specific> | def convert_to_c_type_array_size(json_type):
"""
convert the json type to c type
:param json_type: the json type
:return: c type.
"""
if json_type == "boolean":
return 0
if json_type == "number":
return 0
if json_type == "integer":
return 0
if json... |
convert the json type to c type
:param json_type: the json type
:return: c type.
| convert the json type to c type | [
"convert",
"the",
"json",
"type",
"to",
"c",
"type"
] | def convert_to_c_type_array_size(json_type):
if json_type == "boolean":
return 0
if json_type == "number":
return 0
if json_type == "integer":
return 0
if json_type == "string":
return 1
if json_type == "string[]":
return 2
if json_type == "integer[]":
... | [
"def",
"convert_to_c_type_array_size",
"(",
"json_type",
")",
":",
"if",
"json_type",
"==",
"\"boolean\"",
":",
"return",
"0",
"if",
"json_type",
"==",
"\"number\"",
":",
"return",
"0",
"if",
"json_type",
"==",
"\"integer\"",
":",
"return",
"0",
"if",
"json_ty... | convert the json type to c type | [
"convert",
"the",
"json",
"type",
"to",
"c",
"type"
] | [
"\"\"\"\r\n convert the json type to c type\r\n :param json_type: the json type\r\n :return: c type.\r\n \"\"\"",
"# string is already an array\r",
"# array versions e.g. postpended with []\r",
"# array versions e.g. postpended with [][]\r"
] | [
{
"param": "json_type",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "json_type",
"type": null,
"docstring": "the json type",
"docstring_tokens": [
"the",
"json",
... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | convert_to_cplus_string_array | <not_specific> | def convert_to_cplus_string_array(my_array):
"""
convert the json type to c type
:param json_type: the json type
:return: c type.
"""
my_ret = '{'
counter = 0
if isinstance(my_array, str):
my_ret += '"' + str(my_array) + '"'
elif isinstance(my_array, list):
... |
convert the json type to c type
:param json_type: the json type
:return: c type.
| convert the json type to c type | [
"convert",
"the",
"json",
"type",
"to",
"c",
"type"
] | def convert_to_cplus_string_array(my_array):
my_ret = '{'
counter = 0
if isinstance(my_array, str):
my_ret += '"' + str(my_array) + '"'
elif isinstance(my_array, list):
for item in my_array:
if counter > 0:
my_ret += ','
my_ret += '"' + str(item) +... | [
"def",
"convert_to_cplus_string_array",
"(",
"my_array",
")",
":",
"my_ret",
"=",
"'{'",
"counter",
"=",
"0",
"if",
"isinstance",
"(",
"my_array",
",",
"str",
")",
":",
"my_ret",
"+=",
"'\"'",
"+",
"str",
"(",
"my_array",
")",
"+",
"'\"'",
"elif",
"isins... | convert the json type to c type | [
"convert",
"the",
"json",
"type",
"to",
"c",
"type"
] | [
"\"\"\"\r\n convert the json type to c type\r\n :param json_type: the json type\r\n :return: c type.\r\n \"\"\""
] | [
{
"param": "my_array",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "my_array",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": nul... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | sdf_supported_property | <not_specific> | def sdf_supported_property(property_name):
"""
Check to verify that this property is support natively in SDF (without modification)
:param property_name name to check
:return: boolean true/false
"""
# these supported items, assume the input models are valid JSON,
# and do no addition ... |
Check to verify that this property is support natively in SDF (without modification)
:param property_name name to check
:return: boolean true/false
| Check to verify that this property is support natively in SDF (without modification)
:param property_name name to check
:return: boolean true/false | [
"Check",
"to",
"verify",
"that",
"this",
"property",
"is",
"support",
"natively",
"in",
"SDF",
"(",
"without",
"modification",
")",
":",
"param",
"property_name",
"name",
"to",
"check",
":",
"return",
":",
"boolean",
"true",
"/",
"false"
] | def sdf_supported_property(property_name):
supportedProperties = ["type", "minimum",
"maximum", "uniqueItems", "format"]
supportedProperties.extend(
["minItems", "maxItems", "default", "exclusiveMinimum", "exclusiveMaximum"])
supportedProperties.extend(["maxLength", "minLe... | [
"def",
"sdf_supported_property",
"(",
"property_name",
")",
":",
"supportedProperties",
"=",
"[",
"\"type\"",
",",
"\"minimum\"",
",",
"\"maximum\"",
",",
"\"uniqueItems\"",
",",
"\"format\"",
"]",
"supportedProperties",
".",
"extend",
"(",
"[",
"\"minItems\"",
",",... | Check to verify that this property is support natively in SDF (without modification)
:param property_name name to check
:return: boolean true/false | [
"Check",
"to",
"verify",
"that",
"this",
"property",
"is",
"support",
"natively",
"in",
"SDF",
"(",
"without",
"modification",
")",
":",
"param",
"property_name",
"name",
"to",
"check",
":",
"return",
":",
"boolean",
"true",
"/",
"false"
] | [
"\"\"\"\r\n Check to verify that this property is support natively in SDF (without modification)\r\n :param property_name name to check\r\n :return: boolean true/false\r\n \"\"\"",
"# these supported items, assume the input models are valid JSON,\r",
"# and do no addition verification of linking pro... | [
{
"param": "property_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "property_name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | sdf_make_reference_external | null | def sdf_make_reference_external(iter_json_data, url):
"""
Checks all $ref and prepend the url to it if it is
a local reference (e.g. start with #)
:param json data
:param url url to be prefixed to the local reference
:return: data
"""
url_base = url.split("#")[0]
for propert... |
Checks all $ref and prepend the url to it if it is
a local reference (e.g. start with #)
:param json data
:param url url to be prefixed to the local reference
:return: data
| Checks all $ref and prepend the url to it if it is
a local reference
:param json data
:param url url to be prefixed to the local reference
:return: data | [
"Checks",
"all",
"$ref",
"and",
"prepend",
"the",
"url",
"to",
"it",
"if",
"it",
"is",
"a",
"local",
"reference",
":",
"param",
"json",
"data",
":",
"param",
"url",
"url",
"to",
"be",
"prefixed",
"to",
"the",
"local",
"reference",
":",
"return",
":",
... | def sdf_make_reference_external(iter_json_data, url):
url_base = url.split("#")[0]
for property_name, property_data in iter_json_data.items():
if property_name == "$ref":
if property_data[0] == "#":
new_url = url_base + property_data
iter_json_data[property_na... | [
"def",
"sdf_make_reference_external",
"(",
"iter_json_data",
",",
"url",
")",
":",
"url_base",
"=",
"url",
".",
"split",
"(",
"\"#\"",
")",
"[",
"0",
"]",
"for",
"property_name",
",",
"property_data",
"in",
"iter_json_data",
".",
"items",
"(",
")",
":",
"i... | Checks all $ref and prepend the url to it if it is
a local reference (e.g. | [
"Checks",
"all",
"$ref",
"and",
"prepend",
"the",
"url",
"to",
"it",
"if",
"it",
"is",
"a",
"local",
"reference",
"(",
"e",
".",
"g",
"."
] | [
"\"\"\"\r\n Checks all $ref and prepend the url to it if it is\r\n a local reference (e.g. start with #)\r\n :param json data\r\n :param url url to be prefixed to the local reference\r\n :return: data\r\n \"\"\""
] | [
{
"param": "iter_json_data",
"type": null
},
{
"param": "url",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "iter_json_data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "url",
"type": null,
"docstring": null,
"docstring_t... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | sdf_supported_property_non_string | <not_specific> | def sdf_supported_property_non_string(property_name):
"""
Check to verify that this property is support natively in SDF
(without modification)
:param property_name name to check
:return: boolean true/false
"""
supportedProperties = ["minimum",
"maximum", "u... |
Check to verify that this property is support natively in SDF
(without modification)
:param property_name name to check
:return: boolean true/false
| Check to verify that this property is support natively in SDF
(without modification)
:param property_name name to check
:return: boolean true/false | [
"Check",
"to",
"verify",
"that",
"this",
"property",
"is",
"support",
"natively",
"in",
"SDF",
"(",
"without",
"modification",
")",
":",
"param",
"property_name",
"name",
"to",
"check",
":",
"return",
":",
"boolean",
"true",
"/",
"false"
] | def sdf_supported_property_non_string(property_name):
supportedProperties = ["minimum",
"maximum", "uniqueItems", "default", "exclusiveMinimum"]
if property_name in supportedProperties:
return True
else:
return False | [
"def",
"sdf_supported_property_non_string",
"(",
"property_name",
")",
":",
"supportedProperties",
"=",
"[",
"\"minimum\"",
",",
"\"maximum\"",
",",
"\"uniqueItems\"",
",",
"\"default\"",
",",
"\"exclusiveMinimum\"",
"]",
"if",
"property_name",
"in",
"supportedProperties"... | Check to verify that this property is support natively in SDF
(without modification)
:param property_name name to check
:return: boolean true/false | [
"Check",
"to",
"verify",
"that",
"this",
"property",
"is",
"support",
"natively",
"in",
"SDF",
"(",
"without",
"modification",
")",
":",
"param",
"property_name",
"name",
"to",
"check",
":",
"return",
":",
"boolean",
"true",
"/",
"false"
] | [
"\"\"\"\r\n Check to verify that this property is support natively in SDF\r\n (without modification)\r\n :param property_name name to check\r\n :return: boolean true/false\r\n \"\"\"",
"# readOnly, enum, $ref handled in a special function,\r",
"# to rename / reorder properties\r"
] | [
{
"param": "property_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "property_name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | sdf_property_object | <not_specific> | def sdf_property_object(json_data, level):
"""
Take the property values from a resource type and reformat for sdf
:param json_data: sdfProperty's json_data from resource type
:param level: "top" = top level, ignore filtered out types, "sub" = subsequent level, no filter required
:return: json f... |
Take the property values from a resource type and reformat for sdf
:param json_data: sdfProperty's json_data from resource type
:param level: "top" = top level, ignore filtered out types, "sub" = subsequent level, no filter required
:return: json formatted string
| Take the property values from a resource type and reformat for sdf | [
"Take",
"the",
"property",
"values",
"from",
"a",
"resource",
"type",
"and",
"reformat",
"for",
"sdf"
] | def sdf_property_object(json_data, level):
if(level == "top"):
iter_json_data = swagger_properties_filtered(
json_data, sdf_return_path_info(json_data, "path")).items()
else:
iter_json_data = json_data.items()
output = ""
for i, (property_name, property_data) in enumerate(ite... | [
"def",
"sdf_property_object",
"(",
"json_data",
",",
"level",
")",
":",
"if",
"(",
"level",
"==",
"\"top\"",
")",
":",
"iter_json_data",
"=",
"swagger_properties_filtered",
"(",
"json_data",
",",
"sdf_return_path_info",
"(",
"json_data",
",",
"\"path\"",
")",
")... | Take the property values from a resource type and reformat for sdf | [
"Take",
"the",
"property",
"values",
"from",
"a",
"resource",
"type",
"and",
"reformat",
"for",
"sdf"
] | [
"\"\"\"\r\n Take the property values from a resource type and reformat for sdf\r\n :param json_data: sdfProperty's json_data from resource type\r\n :param level: \"top\" = top level, ignore filtered out types, \"sub\" = subsequent level, no filter required\r\n :return: json formatted string\r\n\r\n \... | [
{
"param": "json_data",
"type": null
},
{
"param": "level",
"type": null
}
] | {
"returns": [
{
"docstring": "json formatted string",
"docstring_tokens": [
"json",
"formatted",
"string"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "json_data",
"type": null,
"docstring": "sdfProperty's json_data... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | sdf_required_block_check | <not_specific> | def sdf_required_block_check(json_data):
"""
Return True/False if a required block should be populated
:json_data: inputted resource type file
:return: True/False
"""
if swagger_required_items(json_data, sdf_return_path_info(json_data, "path")) is None:
return False
else:
... |
Return True/False if a required block should be populated
:json_data: inputted resource type file
:return: True/False
| Return True/False if a required block should be populated | [
"Return",
"True",
"/",
"False",
"if",
"a",
"required",
"block",
"should",
"be",
"populated"
] | def sdf_required_block_check(json_data):
if swagger_required_items(json_data, sdf_return_path_info(json_data, "path")) is None:
return False
else:
return True | [
"def",
"sdf_required_block_check",
"(",
"json_data",
")",
":",
"if",
"swagger_required_items",
"(",
"json_data",
",",
"sdf_return_path_info",
"(",
"json_data",
",",
"\"path\"",
")",
")",
"is",
"None",
":",
"return",
"False",
"else",
":",
"return",
"True"
] | Return True/False if a required block should be populated | [
"Return",
"True",
"/",
"False",
"if",
"a",
"required",
"block",
"should",
"be",
"populated"
] | [
"\"\"\"\r\n Return True/False if a required block should be populated\r\n :json_data: inputted resource type file\r\n :return: True/False\r\n \"\"\""
] | [
{
"param": "json_data",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "json_data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": nu... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | sdf_required_object | <not_specific> | def sdf_required_object(json_value):
"""
Return the required object block for one-data-model
:param json_value: json object for resource type
:return: json formatted string for sdf required block
"""
output = "["
requiredItems = swagger_required_items(
json_data, sdf_return_p... |
Return the required object block for one-data-model
:param json_value: json object for resource type
:return: json formatted string for sdf required block
| Return the required object block for one-data-model | [
"Return",
"the",
"required",
"object",
"block",
"for",
"one",
"-",
"data",
"-",
"model"
] | def sdf_required_object(json_value):
output = "["
requiredItems = swagger_required_items(
json_data, sdf_return_path_info(json_data, "path"))
object_name = sdf_return_path_info(json_data, "name")
for i, requiredItem in enumerate(requiredItems):
output += "\"#/sdfObject/" + object_name + ... | [
"def",
"sdf_required_object",
"(",
"json_value",
")",
":",
"output",
"=",
"\"[\"",
"requiredItems",
"=",
"swagger_required_items",
"(",
"json_data",
",",
"sdf_return_path_info",
"(",
"json_data",
",",
"\"path\"",
")",
")",
"object_name",
"=",
"sdf_return_path_info",
... | Return the required object block for one-data-model | [
"Return",
"the",
"required",
"object",
"block",
"for",
"one",
"-",
"data",
"-",
"model"
] | [
"\"\"\"\r\n Return the required object block for one-data-model\r\n :param json_value: json object for resource type\r\n :return: json formatted string for sdf required block\r\n \"\"\""
] | [
{
"param": "json_value",
"type": null
}
] | {
"returns": [
{
"docstring": "json formatted string for sdf required block",
"docstring_tokens": [
"json",
"formatted",
"string",
"for",
"sdf",
"required",
"block"
],
"type": null
}
],
"raises": [],
"params": [
{
... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | sdf_item_object | <not_specific> | def sdf_item_object(itemObject):
"""
Take the item value and additionally parse for sdf
:param itemObject: item's value
:return: json formatted string
"""
i = 0
output = "{"
for i, (itemKey, itemValue) in enumerate(itemObject.items()):
if itemKey == "enum":
... |
Take the item value and additionally parse for sdf
:param itemObject: item's value
:return: json formatted string
| Take the item value and additionally parse for sdf | [
"Take",
"the",
"item",
"value",
"and",
"additionally",
"parse",
"for",
"sdf"
] | def sdf_item_object(itemObject):
i = 0
output = "{"
for i, (itemKey, itemValue) in enumerate(itemObject.items()):
if itemKey == "enum":
output = output + "\"" + itemKey + "\": "
output = output + sdf_enum_array(itemValue)
else:
if itemKey == "maximum":
... | [
"def",
"sdf_item_object",
"(",
"itemObject",
")",
":",
"i",
"=",
"0",
"output",
"=",
"\"{\"",
"for",
"i",
",",
"(",
"itemKey",
",",
"itemValue",
")",
"in",
"enumerate",
"(",
"itemObject",
".",
"items",
"(",
")",
")",
":",
"if",
"itemKey",
"==",
"\"en... | Take the item value and additionally parse for sdf | [
"Take",
"the",
"item",
"value",
"and",
"additionally",
"parse",
"for",
"sdf"
] | [
"\"\"\"\r\n Take the item value and additionally parse for sdf\r\n :param itemObject: item's value\r\n :return: json formatted string\r\n \"\"\"",
"# print(' sdf_item_object: $ref!! ', itemKey, itemValue)\r",
"# recursive !!\r",
"# recursive !!\r"
] | [
{
"param": "itemObject",
"type": null
}
] | {
"returns": [
{
"docstring": "json formatted string",
"docstring_tokens": [
"json",
"formatted",
"string"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "itemObject",
"type": null,
"docstring": null,
"docstring_... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | sdf_ref_properties | <not_specific> | def sdf_ref_properties(json_data, url):
"""
load referenced json property and return string formatted as sdf json schema
:param json_data: json_data of the inputted resource type
:param url: location of schema file and reference property, e.g. https://openconnectivityfoundation.github.io/IoTDataMode... |
load referenced json property and return string formatted as sdf json schema
:param json_data: json_data of the inputted resource type
:param url: location of schema file and reference property, e.g. https://openconnectivityfoundation.github.io/IoTDataModels/schemas/oic.baseresource.properties-schema.js... | load referenced json property and return string formatted as sdf json schema
:param json_data: json_data of the inputted resource type
:param url: location of schema file and reference property, e.g. | [
"load",
"referenced",
"json",
"property",
"and",
"return",
"string",
"formatted",
"as",
"sdf",
"json",
"schema",
":",
"param",
"json_data",
":",
"json_data",
"of",
"the",
"inputted",
"resource",
"type",
":",
"param",
"url",
":",
"location",
"of",
"schema",
"... | def sdf_ref_properties(json_data, url):
if "https" in url:
ref_json_dict = load_json_schema_fromURL(url)
sdf_make_reference_external(ref_json_dict, url)
elif "http" in url:
ref_json_dict = load_json_schema_fromURL(url)
sdf_make_reference_external(ref_json_dict, url)
else:
... | [
"def",
"sdf_ref_properties",
"(",
"json_data",
",",
"url",
")",
":",
"if",
"\"https\"",
"in",
"url",
":",
"ref_json_dict",
"=",
"load_json_schema_fromURL",
"(",
"url",
")",
"sdf_make_reference_external",
"(",
"ref_json_dict",
",",
"url",
")",
"elif",
"\"http\"",
... | load referenced json property and return string formatted as sdf json schema
:param json_data: json_data of the inputted resource type
:param url: location of schema file and reference property, e.g. | [
"load",
"referenced",
"json",
"property",
"and",
"return",
"string",
"formatted",
"as",
"sdf",
"json",
"schema",
":",
"param",
"json_data",
":",
"json_data",
"of",
"the",
"inputted",
"resource",
"type",
":",
"param",
"url",
":",
"location",
"of",
"schema",
"... | [
"\"\"\"\r\n load referenced json property and return string formatted as sdf json schema\r\n :param json_data: json_data of the inputted resource type\r\n :param url: location of schema file and reference property, e.g. https://openconnectivityfoundation.github.io/IoTDataModels/schemas/oic.baseresource.pro... | [
{
"param": "json_data",
"type": null
},
{
"param": "url",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "json_data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "url",
"type": null,
"docstring": null,
"docstring_tokens... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | sdf_readOnly_object | <not_specific> | def sdf_readOnly_object(RO_value):
"""
Take the read only value and convert it for sdf writable property
:param RO_value: Read only value string
:return: json formatted string
"""
if RO_value:
# "readOnly" = true
# "writeable" = false
return "false"
else:
... |
Take the read only value and convert it for sdf writable property
:param RO_value: Read only value string
:return: json formatted string
| Take the read only value and convert it for sdf writable property | [
"Take",
"the",
"read",
"only",
"value",
"and",
"convert",
"it",
"for",
"sdf",
"writable",
"property"
] | def sdf_readOnly_object(RO_value):
if RO_value:
return "false"
else:
return "true" | [
"def",
"sdf_readOnly_object",
"(",
"RO_value",
")",
":",
"if",
"RO_value",
":",
"return",
"\"false\"",
"else",
":",
"return",
"\"true\""
] | Take the read only value and convert it for sdf writable property | [
"Take",
"the",
"read",
"only",
"value",
"and",
"convert",
"it",
"for",
"sdf",
"writable",
"property"
] | [
"\"\"\"\r\n Take the read only value and convert it for sdf writable property\r\n :param RO_value: Read only value string\r\n :return: json formatted string\r\n \"\"\"",
"# \"readOnly\" = true\r",
"# \"writeable\" = false\r",
"# \"readOnly\" = false\r",
"# \"writeable\" = true\r"
] | [
{
"param": "RO_value",
"type": null
}
] | {
"returns": [
{
"docstring": "json formatted string",
"docstring_tokens": [
"json",
"formatted",
"string"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "RO_value",
"type": null,
"docstring": "Read only value string",... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | sdf_enum_array | <not_specific> | def sdf_enum_array(enumArray):
"""
Take the enum array value and additionally parse for sdf
:param enumArray: array of items associated with enum type
:return: json formatted string
"""
output = "["
for i, item in enumerate(enumArray):
output = output + "\"" + item + "\""
... |
Take the enum array value and additionally parse for sdf
:param enumArray: array of items associated with enum type
:return: json formatted string
| Take the enum array value and additionally parse for sdf | [
"Take",
"the",
"enum",
"array",
"value",
"and",
"additionally",
"parse",
"for",
"sdf"
] | def sdf_enum_array(enumArray):
output = "["
for i, item in enumerate(enumArray):
output = output + "\"" + item + "\""
if i < len(enumArray) - 1:
output = output + ","
else:
output = output + "]"
return output | [
"def",
"sdf_enum_array",
"(",
"enumArray",
")",
":",
"output",
"=",
"\"[\"",
"for",
"i",
",",
"item",
"in",
"enumerate",
"(",
"enumArray",
")",
":",
"output",
"=",
"output",
"+",
"\"\\\"\"",
"+",
"item",
"+",
"\"\\\"\"",
"if",
"i",
"<",
"len",
"(",
"... | Take the enum array value and additionally parse for sdf | [
"Take",
"the",
"enum",
"array",
"value",
"and",
"additionally",
"parse",
"for",
"sdf"
] | [
"\"\"\"\r\n Take the enum array value and additionally parse for sdf\r\n :param enumArray: array of items associated with enum type\r\n :return: json formatted string\r\n \"\"\""
] | [
{
"param": "enumArray",
"type": null
}
] | {
"returns": [
{
"docstring": "json formatted string",
"docstring_tokens": [
"json",
"formatted",
"string"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "enumArray",
"type": null,
"docstring": "array of items associat... |
0ddbd4ad4a5946f93d27bf67bd6269aae9dc503a | openconnectivityfoundation/swagger2x | src/swagger2x.py | [
"Apache-2.0"
] | Python | sdf_return_path_info | <not_specific> | def sdf_return_path_info(json_data, returnType):
"""
Return ocf resource type name: OCF name, e.g. oic.r.grinderAppliance returns grinderAppliance or grinderApplianceResURI
:json_data: inputted resource type file
:returnType: "name" or "path" or "description"
:return: if returnType: "name" - st... |
Return ocf resource type name: OCF name, e.g. oic.r.grinderAppliance returns grinderAppliance or grinderApplianceResURI
:json_data: inputted resource type file
:returnType: "name" or "path" or "description"
:return: if returnType: "name" - string formatted name: e.g. grinder
return... | Return ocf resource type name: OCF name, e.g. oic.r.grinderAppliance returns grinderAppliance or grinderApplianceResURI | [
"Return",
"ocf",
"resource",
"type",
"name",
":",
"OCF",
"name",
"e",
".",
"g",
".",
"oic",
".",
"r",
".",
"grinderAppliance",
"returns",
"grinderAppliance",
"or",
"grinderApplianceResURI"
] | def sdf_return_path_info(json_data, returnType):
rt = swagger_rt(json_data)
name = rt[0][1]
path = rt[0][0]
name = name.replace('oic.r.', '')
if len(rt) > 1:
print("WARNING: More than one path found: ", rt)
if returnType == "name":
return name
elif returnType == "description"... | [
"def",
"sdf_return_path_info",
"(",
"json_data",
",",
"returnType",
")",
":",
"rt",
"=",
"swagger_rt",
"(",
"json_data",
")",
"name",
"=",
"rt",
"[",
"0",
"]",
"[",
"1",
"]",
"path",
"=",
"rt",
"[",
"0",
"]",
"[",
"0",
"]",
"name",
"=",
"name",
"... | Return ocf resource type name: OCF name, e.g. | [
"Return",
"ocf",
"resource",
"type",
"name",
":",
"OCF",
"name",
"e",
".",
"g",
"."
] | [
"\"\"\"\r\n Return ocf resource type name: OCF name, e.g. oic.r.grinderAppliance returns grinderAppliance or grinderApplianceResURI\r\n :json_data: inputted resource type file\r\n :returnType: \"name\" or \"path\" or \"description\"\r\n :return: if returnType: \"name\" - string formatted name: e.g. grin... | [
{
"param": "json_data",
"type": null
},
{
"param": "returnType",
"type": null
}
] | {
"returns": [
{
"docstring": "if returnType: \"name\" - string formatted name: e.g. grinder\nreturnType: \"description\" - returns the description property of the \"get\" path,\nreturnType: \"path\" the path name, e.g. /GrinderResURI",
"docstring_tokens": [
"if",
"returnType",
... |
4f1191a859be387f69428bed4459aeac93a643cd | Wilduck/django-entity-event | entity_event/models.py | [
"MIT"
] | Python | events | <not_specific> | def events(self, **event_filters):
"""Return subscribed events, with basic filters.
This method of getting events is useful when you want to
display events for your medium, independent of what entities
were involved in those events. For example, this method can be
used to displa... | Return subscribed events, with basic filters.
This method of getting events is useful when you want to
display events for your medium, independent of what entities
were involved in those events. For example, this method can be
used to display a list of site-wide events that happened in ... | Return subscribed events, with basic filters.
This method of getting events is useful when you want to
display events for your medium, independent of what entities
were involved in those events. For example, this method can be
used to display a list of site-wide events that happened in the
past 24 hours.
code-block:: ... | [
"Return",
"subscribed",
"events",
"with",
"basic",
"filters",
".",
"This",
"method",
"of",
"getting",
"events",
"is",
"useful",
"when",
"you",
"want",
"to",
"display",
"events",
"for",
"your",
"medium",
"independent",
"of",
"what",
"entities",
"were",
"involve... | def events(self, **event_filters):
events = self.get_filtered_events(**event_filters)
subscriptions = Subscription.objects.filter(medium=self)
subscription_q_objects = [
Q(
eventactor__entity__in=self.followed_by(sub.subscribed_entities()),
source=sub.... | [
"def",
"events",
"(",
"self",
",",
"**",
"event_filters",
")",
":",
"events",
"=",
"self",
".",
"get_filtered_events",
"(",
"**",
"event_filters",
")",
"subscriptions",
"=",
"Subscription",
".",
"objects",
".",
"filter",
"(",
"medium",
"=",
"self",
")",
"s... | Return subscribed events, with basic filters. | [
"Return",
"subscribed",
"events",
"with",
"basic",
"filters",
"."
] | [
"\"\"\"Return subscribed events, with basic filters.\n\n This method of getting events is useful when you want to\n display events for your medium, independent of what entities\n were involved in those events. For example, this method can be\n used to display a list of site-wide events t... | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "A queryset of events.",
"docstring_tokens": [
"A",
"queryset",
"of",
"events",
"."
],
"type": "EventQuerySet"
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstri... |
4f1191a859be387f69428bed4459aeac93a643cd | Wilduck/django-entity-event | entity_event/models.py | [
"MIT"
] | Python | entity_events | <not_specific> | def entity_events(self, entity, **event_filters):
"""Return subscribed events for a given entity.
This method of getting events is useful when you want to see
only the events relevant to a single entity. The events
returned are events that the given entity is subscribed to,
eith... | Return subscribed events for a given entity.
This method of getting events is useful when you want to see
only the events relevant to a single entity. The events
returned are events that the given entity is subscribed to,
either directly as an individual entity, or because they are
... | Return subscribed events for a given entity.
This method of getting events is useful when you want to see
only the events relevant to a single entity. The events
returned are events that the given entity is subscribed to,
either directly as an individual entity, or because they are
part of a group subscription. As an e... | [
"Return",
"subscribed",
"events",
"for",
"a",
"given",
"entity",
".",
"This",
"method",
"of",
"getting",
"events",
"is",
"useful",
"when",
"you",
"want",
"to",
"see",
"only",
"the",
"events",
"relevant",
"to",
"a",
"single",
"entity",
".",
"The",
"events",... | def entity_events(self, entity, **event_filters):
events = self.get_filtered_events(**event_filters)
subscriptions = Subscription.objects.filter(medium=self)
subscriptions = self.subset_subscriptions(subscriptions, entity)
subscription_q_objects = [
Q(
eventac... | [
"def",
"entity_events",
"(",
"self",
",",
"entity",
",",
"**",
"event_filters",
")",
":",
"events",
"=",
"self",
".",
"get_filtered_events",
"(",
"**",
"event_filters",
")",
"subscriptions",
"=",
"Subscription",
".",
"objects",
".",
"filter",
"(",
"medium",
... | Return subscribed events for a given entity. | [
"Return",
"subscribed",
"events",
"for",
"a",
"given",
"entity",
"."
] | [
"\"\"\"Return subscribed events for a given entity.\n\n This method of getting events is useful when you want to see\n only the events relevant to a single entity. The events\n returned are events that the given entity is subscribed to,\n either directly as an individual entity, or becau... | [
{
"param": "self",
"type": null
},
{
"param": "entity",
"type": null
}
] | {
"returns": [
{
"docstring": "A queryset of events.",
"docstring_tokens": [
"A",
"queryset",
"of",
"events",
"."
],
"type": "EventQuerySet"
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstri... |
4f1191a859be387f69428bed4459aeac93a643cd | Wilduck/django-entity-event | entity_event/models.py | [
"MIT"
] | Python | events_targets | <not_specific> | def events_targets(self, entity_kind=None, **event_filters):
"""Return all events for this medium, with who each event is for.
This method is useful for individually notifying every
entity concerned with a collection of events, while
still respecting subscriptions and usubscriptions. Fo... | Return all events for this medium, with who each event is for.
This method is useful for individually notifying every
entity concerned with a collection of events, while
still respecting subscriptions and usubscriptions. For
example, ``events_targets`` can be used to send email
... | Return all events for this medium, with who each event is for.
This method is useful for individually notifying every
entity concerned with a collection of events, while
still respecting subscriptions and usubscriptions. For
example, ``events_targets`` can be used to send email
notifications, by retrieving all unseen e... | [
"Return",
"all",
"events",
"for",
"this",
"medium",
"with",
"who",
"each",
"event",
"is",
"for",
".",
"This",
"method",
"is",
"useful",
"for",
"individually",
"notifying",
"every",
"entity",
"concerned",
"with",
"a",
"collection",
"of",
"events",
"while",
"s... | def events_targets(self, entity_kind=None, **event_filters):
events = self.get_filtered_events(**event_filters)
subscriptions = Subscription.objects.filter(medium=self)
event_pairs = []
for event in events:
targets = []
for sub in subscriptions:
if... | [
"def",
"events_targets",
"(",
"self",
",",
"entity_kind",
"=",
"None",
",",
"**",
"event_filters",
")",
":",
"events",
"=",
"self",
".",
"get_filtered_events",
"(",
"**",
"event_filters",
")",
"subscriptions",
"=",
"Subscription",
".",
"objects",
".",
"filter"... | Return all events for this medium, with who each event is for. | [
"Return",
"all",
"events",
"for",
"this",
"medium",
"with",
"who",
"each",
"event",
"is",
"for",
"."
] | [
"\"\"\"Return all events for this medium, with who each event is for.\n\n This method is useful for individually notifying every\n entity concerned with a collection of events, while\n still respecting subscriptions and usubscriptions. For\n example, ``events_targets`` can be used to sen... | [
{
"param": "self",
"type": null
},
{
"param": "entity_kind",
"type": null
}
] | {
"returns": [
{
"docstring": "A list of tuples in the form ``(event, targets)``\nwhere ``targets`` is a list of entities.",
"docstring_tokens": [
"A",
"list",
"of",
"tuples",
"in",
"the",
"form",
"`",
"`",
"(",
"e... |
4f1191a859be387f69428bed4459aeac93a643cd | Wilduck/django-entity-event | entity_event/models.py | [
"MIT"
] | Python | subset_subscriptions | <not_specific> | def subset_subscriptions(self, subscriptions, entity=None):
"""Return only subscriptions the given entity is a part of.
An entity is "part of a subscription" if either:
1. The subscription is for that entity, with no
sub-entity-kind. That is, it is not a group subscription.
2.... | Return only subscriptions the given entity is a part of.
An entity is "part of a subscription" if either:
1. The subscription is for that entity, with no
sub-entity-kind. That is, it is not a group subscription.
2. The subscription is for a super-entity of the given entity,
an... | Return only subscriptions the given entity is a part of.
An entity is "part of a subscription" if either.
1. The subscription is for that entity, with no
sub-entity-kind. That is, it is not a group subscription.
2. The subscription is for a super-entity of the given entity,
and the subscription's sub-entity-kind is t... | [
"Return",
"only",
"subscriptions",
"the",
"given",
"entity",
"is",
"a",
"part",
"of",
".",
"An",
"entity",
"is",
"\"",
"part",
"of",
"a",
"subscription",
"\"",
"if",
"either",
".",
"1",
".",
"The",
"subscription",
"is",
"for",
"that",
"entity",
"with",
... | def subset_subscriptions(self, subscriptions, entity=None):
if entity is None:
return subscriptions
super_entities = EntityRelationship.objects.filter(
sub_entity=entity).values_list('super_entity')
subscriptions = subscriptions.filter(
Q(entity=entity, sub_en... | [
"def",
"subset_subscriptions",
"(",
"self",
",",
"subscriptions",
",",
"entity",
"=",
"None",
")",
":",
"if",
"entity",
"is",
"None",
":",
"return",
"subscriptions",
"super_entities",
"=",
"EntityRelationship",
".",
"objects",
".",
"filter",
"(",
"sub_entity",
... | Return only subscriptions the given entity is a part of. | [
"Return",
"only",
"subscriptions",
"the",
"given",
"entity",
"is",
"a",
"part",
"of",
"."
] | [
"\"\"\"Return only subscriptions the given entity is a part of.\n\n An entity is \"part of a subscription\" if either:\n\n 1. The subscription is for that entity, with no\n sub-entity-kind. That is, it is not a group subscription.\n\n 2. The subscription is for a super-entity of the give... | [
{
"param": "self",
"type": null
},
{
"param": "subscriptions",
"type": null
},
{
"param": "entity",
"type": null
}
] | {
"returns": [
{
"docstring": "A queryset of filtered subscriptions.",
"docstring_tokens": [
"A",
"queryset",
"of",
"filtered",
"subscriptions",
"."
],
"type": "QuerySet"
}
],
"raises": [],
"params": [
{
"identifier": "sel... |
4f1191a859be387f69428bed4459aeac93a643cd | Wilduck/django-entity-event | entity_event/models.py | [
"MIT"
] | Python | unsubscriptions | <not_specific> | def unsubscriptions(self):
"""Returns the unsubscribed entity IDs for each source as a dict,
keyed on source_id.
:rtype: Dictionary
:returns: A dictionary of the form ``{source_id: entities}``
where ``entities`` is a list of entities unsubscribed from
that source... | Returns the unsubscribed entity IDs for each source as a dict,
keyed on source_id.
:rtype: Dictionary
:returns: A dictionary of the form ``{source_id: entities}``
where ``entities`` is a list of entities unsubscribed from
that source for this medium.
| Returns the unsubscribed entity IDs for each source as a dict,
keyed on source_id. | [
"Returns",
"the",
"unsubscribed",
"entity",
"IDs",
"for",
"each",
"source",
"as",
"a",
"dict",
"keyed",
"on",
"source_id",
"."
] | def unsubscriptions(self):
unsubscriptions = defaultdict(list)
for unsub in Unsubscription.objects.filter(medium=self).values('entity', 'source'):
unsubscriptions[unsub['source']].append(unsub['entity'])
return unsubscriptions | [
"def",
"unsubscriptions",
"(",
"self",
")",
":",
"unsubscriptions",
"=",
"defaultdict",
"(",
"list",
")",
"for",
"unsub",
"in",
"Unsubscription",
".",
"objects",
".",
"filter",
"(",
"medium",
"=",
"self",
")",
".",
"values",
"(",
"'entity'",
",",
"'source'... | Returns the unsubscribed entity IDs for each source as a dict,
keyed on source_id. | [
"Returns",
"the",
"unsubscribed",
"entity",
"IDs",
"for",
"each",
"source",
"as",
"a",
"dict",
"keyed",
"on",
"source_id",
"."
] | [
"\"\"\"Returns the unsubscribed entity IDs for each source as a dict,\n keyed on source_id.\n\n :rtype: Dictionary\n :returns: A dictionary of the form ``{source_id: entities}``\n where ``entities`` is a list of entities unsubscribed from\n that source for this medium.\n ... | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "A dictionary of the form ``{source_id: entities}``\nwhere ``entities`` is a list of entities unsubscribed from\nthat source for this medium.",
"docstring_tokens": [
"A",
"dictionary",
"of",
"the",
"form",
"`",
"`",
... |
4f1191a859be387f69428bed4459aeac93a643cd | Wilduck/django-entity-event | entity_event/models.py | [
"MIT"
] | Python | filter_source_targets_by_unsubscription | <not_specific> | def filter_source_targets_by_unsubscription(self, source_id, targets):
"""Given a source id and targets, filter the targets by
unsubscriptions. Return the filtered list of targets.
"""
unsubscriptions = self.unsubscriptions
return [t for t in targets if t.id not in unsubscription... | Given a source id and targets, filter the targets by
unsubscriptions. Return the filtered list of targets.
| Given a source id and targets, filter the targets by
unsubscriptions. Return the filtered list of targets. | [
"Given",
"a",
"source",
"id",
"and",
"targets",
"filter",
"the",
"targets",
"by",
"unsubscriptions",
".",
"Return",
"the",
"filtered",
"list",
"of",
"targets",
"."
] | def filter_source_targets_by_unsubscription(self, source_id, targets):
unsubscriptions = self.unsubscriptions
return [t for t in targets if t.id not in unsubscriptions[source_id]] | [
"def",
"filter_source_targets_by_unsubscription",
"(",
"self",
",",
"source_id",
",",
"targets",
")",
":",
"unsubscriptions",
"=",
"self",
".",
"unsubscriptions",
"return",
"[",
"t",
"for",
"t",
"in",
"targets",
"if",
"t",
".",
"id",
"not",
"in",
"unsubscripti... | Given a source id and targets, filter the targets by
unsubscriptions. | [
"Given",
"a",
"source",
"id",
"and",
"targets",
"filter",
"the",
"targets",
"by",
"unsubscriptions",
"."
] | [
"\"\"\"Given a source id and targets, filter the targets by\n unsubscriptions. Return the filtered list of targets.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "source_id",
"type": null
},
{
"param": "targets",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "source_id",
"type": null,
"docstring": null,
"docstring_token... |
4f1191a859be387f69428bed4459aeac93a643cd | Wilduck/django-entity-event | entity_event/models.py | [
"MIT"
] | Python | followed_by | <not_specific> | def followed_by(self, entities):
"""Define what entities are followed by the entities passed to this
method.
This method can be overridden by a class that concretely
inherits ``Medium``, to define custom semantics for the
``only_following`` flag on relevant ``Subscription``
... | Define what entities are followed by the entities passed to this
method.
This method can be overridden by a class that concretely
inherits ``Medium``, to define custom semantics for the
``only_following`` flag on relevant ``Subscription``
objects. Overriding this method, and ``f... | Define what entities are followed by the entities passed to this
method.
This implementation attempts to provide a sane default. In
this implementation, the entities followed by the ``entities``
argument are the entities themselves, and their super entities.
That is, individual entities follow themselves, and the g... | [
"Define",
"what",
"entities",
"are",
"followed",
"by",
"the",
"entities",
"passed",
"to",
"this",
"method",
".",
"This",
"implementation",
"attempts",
"to",
"provide",
"a",
"sane",
"default",
".",
"In",
"this",
"implementation",
"the",
"entities",
"followed",
... | def followed_by(self, entities):
if isinstance(entities, Entity):
entities = Entity.objects.filter(id=entities.id)
super_entities = EntityRelationship.objects.filter(
sub_entity__in=entities).values_list('super_entity')
followed_by = Entity.objects.filter(
Q(i... | [
"def",
"followed_by",
"(",
"self",
",",
"entities",
")",
":",
"if",
"isinstance",
"(",
"entities",
",",
"Entity",
")",
":",
"entities",
"=",
"Entity",
".",
"objects",
".",
"filter",
"(",
"id",
"=",
"entities",
".",
"id",
")",
"super_entities",
"=",
"En... | Define what entities are followed by the entities passed to this
method. | [
"Define",
"what",
"entities",
"are",
"followed",
"by",
"the",
"entities",
"passed",
"to",
"this",
"method",
"."
] | [
"\"\"\"Define what entities are followed by the entities passed to this\n method.\n\n This method can be overridden by a class that concretely\n inherits ``Medium``, to define custom semantics for the\n ``only_following`` flag on relevant ``Subscription``\n objects. Overriding thi... | [
{
"param": "self",
"type": null
},
{
"param": "entities",
"type": null
}
] | {
"returns": [
{
"docstring": "A QuerySet of all the entities followed by any of\nthose given.",
"docstring_tokens": [
"A",
"QuerySet",
"of",
"all",
"the",
"entities",
"followed",
"by",
"any",
"of",
"those",
... |
4f1191a859be387f69428bed4459aeac93a643cd | Wilduck/django-entity-event | entity_event/models.py | [
"MIT"
] | Python | followers_of | <not_specific> | def followers_of(self, entities):
"""Define what entities are followers of the entities passed to this
method.
This method can be overridden by a class that concretely
inherits ``Medium``, to define custom semantics for the
``only_following`` flag on relevant ``Subscription``
... | Define what entities are followers of the entities passed to this
method.
This method can be overridden by a class that concretely
inherits ``Medium``, to define custom semantics for the
``only_following`` flag on relevant ``Subscription``
objects. Overriding this method, and ``... | Define what entities are followers of the entities passed to this
method.
This implementation attempts to provide a sane default. In
this implementation, the followers of the entities passed in
are defined to be the entities themselves, and their
sub-entities.
That is, the followers of individual entities are thems... | [
"Define",
"what",
"entities",
"are",
"followers",
"of",
"the",
"entities",
"passed",
"to",
"this",
"method",
".",
"This",
"implementation",
"attempts",
"to",
"provide",
"a",
"sane",
"default",
".",
"In",
"this",
"implementation",
"the",
"followers",
"of",
"the... | def followers_of(self, entities):
if isinstance(entities, Entity):
entities = Entity.objects.filter(id=entities.id)
sub_entities = EntityRelationship.objects.filter(
super_entity__in=entities).values_list('sub_entity')
followers_of = Entity.objects.filter(
Q(i... | [
"def",
"followers_of",
"(",
"self",
",",
"entities",
")",
":",
"if",
"isinstance",
"(",
"entities",
",",
"Entity",
")",
":",
"entities",
"=",
"Entity",
".",
"objects",
".",
"filter",
"(",
"id",
"=",
"entities",
".",
"id",
")",
"sub_entities",
"=",
"Ent... | Define what entities are followers of the entities passed to this
method. | [
"Define",
"what",
"entities",
"are",
"followers",
"of",
"the",
"entities",
"passed",
"to",
"this",
"method",
"."
] | [
"\"\"\"Define what entities are followers of the entities passed to this\n method.\n\n This method can be overridden by a class that concretely\n inherits ``Medium``, to define custom semantics for the\n ``only_following`` flag on relevant ``Subscription``\n objects. Overriding th... | [
{
"param": "self",
"type": null
},
{
"param": "entities",
"type": null
}
] | {
"returns": [
{
"docstring": "A QuerySet of all the entities who are followers of\nany of those given.",
"docstring_tokens": [
"A",
"QuerySet",
"of",
"all",
"the",
"entities",
"who",
"are",
"followers",
"of",
"any... |
4f1191a859be387f69428bed4459aeac93a643cd | Wilduck/django-entity-event | entity_event/models.py | [
"MIT"
] | Python | clean | null | def clean(self):
"""Validation for the model.
Check that:
- the context loader provided maps to an actual loadable function.
"""
if self.context_loader:
try:
self.get_context_loader_function()
except ImproperlyConfigured:
r... | Validation for the model.
Check that:
- the context loader provided maps to an actual loadable function.
| Validation for the model.
Check that:
the context loader provided maps to an actual loadable function. | [
"Validation",
"for",
"the",
"model",
".",
"Check",
"that",
":",
"the",
"context",
"loader",
"provided",
"maps",
"to",
"an",
"actual",
"loadable",
"function",
"."
] | def clean(self):
if self.context_loader:
try:
self.get_context_loader_function()
except ImproperlyConfigured:
raise ValidationError('Must provide a loadable context loader') | [
"def",
"clean",
"(",
"self",
")",
":",
"if",
"self",
".",
"context_loader",
":",
"try",
":",
"self",
".",
"get_context_loader_function",
"(",
")",
"except",
"ImproperlyConfigured",
":",
"raise",
"ValidationError",
"(",
"'Must provide a loadable context loader'",
")"... | Validation for the model. | [
"Validation",
"for",
"the",
"model",
"."
] | [
"\"\"\"Validation for the model.\n\n Check that:\n - the context loader provided maps to an actual loadable function.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4f1191a859be387f69428bed4459aeac93a643cd | Wilduck/django-entity-event | entity_event/models.py | [
"MIT"
] | Python | save | <not_specific> | def save(self, *args, **kwargs):
"""Save the instance to the database after validation.
"""
self.clean()
return super(Source, self).save(*args, **kwargs) | Save the instance to the database after validation.
| Save the instance to the database after validation. | [
"Save",
"the",
"instance",
"to",
"the",
"database",
"after",
"validation",
"."
] | def save(self, *args, **kwargs):
self.clean()
return super(Source, self).save(*args, **kwargs) | [
"def",
"save",
"(",
"self",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"self",
".",
"clean",
"(",
")",
"return",
"super",
"(",
"Source",
",",
"self",
")",
".",
"save",
"(",
"*",
"args",
",",
"**",
"kwargs",
")"
] | Save the instance to the database after validation. | [
"Save",
"the",
"instance",
"to",
"the",
"database",
"after",
"validation",
"."
] | [
"\"\"\"Save the instance to the database after validation.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4f1191a859be387f69428bed4459aeac93a643cd | Wilduck/django-entity-event | entity_event/models.py | [
"MIT"
] | Python | subscribed_entities | <not_specific> | def subscribed_entities(self):
"""Return a queryset of all subscribed entities.
This will be a single entity in the case of an individual
subscription, otherwise it will be all the entities in the
group subscription.
:rtype: EntityQuerySet
:returns: A QuerySet of all th... | Return a queryset of all subscribed entities.
This will be a single entity in the case of an individual
subscription, otherwise it will be all the entities in the
group subscription.
:rtype: EntityQuerySet
:returns: A QuerySet of all the entities that are a part of
... | Return a queryset of all subscribed entities.
This will be a single entity in the case of an individual
subscription, otherwise it will be all the entities in the
group subscription. | [
"Return",
"a",
"queryset",
"of",
"all",
"subscribed",
"entities",
".",
"This",
"will",
"be",
"a",
"single",
"entity",
"in",
"the",
"case",
"of",
"an",
"individual",
"subscription",
"otherwise",
"it",
"will",
"be",
"all",
"the",
"entities",
"in",
"the",
"gr... | def subscribed_entities(self):
if self.sub_entity_kind is not None:
sub_entities = self.entity.sub_relationships.filter(
sub_entity__entity_kind=self.sub_entity_kind).values_list('sub_entity')
entities = Entity.objects.filter(id__in=sub_entities)
else:
... | [
"def",
"subscribed_entities",
"(",
"self",
")",
":",
"if",
"self",
".",
"sub_entity_kind",
"is",
"not",
"None",
":",
"sub_entities",
"=",
"self",
".",
"entity",
".",
"sub_relationships",
".",
"filter",
"(",
"sub_entity__entity_kind",
"=",
"self",
".",
"sub_ent... | Return a queryset of all subscribed entities. | [
"Return",
"a",
"queryset",
"of",
"all",
"subscribed",
"entities",
"."
] | [
"\"\"\"Return a queryset of all subscribed entities.\n\n This will be a single entity in the case of an individual\n subscription, otherwise it will be all the entities in the\n group subscription.\n\n :rtype: EntityQuerySet\n :returns: A QuerySet of all the entities that are a pa... | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "A QuerySet of all the entities that are a part of\nthis subscription.",
"docstring_tokens": [
"A",
"QuerySet",
"of",
"all",
"the",
"entities",
"that",
"are",
"a",
"part",
"of",
... |
4f1191a859be387f69428bed4459aeac93a643cd | Wilduck/django-entity-event | entity_event/models.py | [
"MIT"
] | Python | mark_seen | null | def mark_seen(self, medium):
"""Creates EventSeen objects for the provided medium for every event
in the queryset.
Creating these EventSeen objects ensures they will not be
returned when passing ``seen=False`` to any of the medium
event retrieval functions, ``events``, ``entity_... | Creates EventSeen objects for the provided medium for every event
in the queryset.
Creating these EventSeen objects ensures they will not be
returned when passing ``seen=False`` to any of the medium
event retrieval functions, ``events``, ``entity_events``, or
``events_targets``.... | Creates EventSeen objects for the provided medium for every event
in the queryset.
| [
"Creates",
"EventSeen",
"objects",
"for",
"the",
"provided",
"medium",
"for",
"every",
"event",
"in",
"the",
"queryset",
"."
] | def mark_seen(self, medium):
EventSeen.objects.bulk_create([
EventSeen(event=event, medium=medium) for event in self
]) | [
"def",
"mark_seen",
"(",
"self",
",",
"medium",
")",
":",
"EventSeen",
".",
"objects",
".",
"bulk_create",
"(",
"[",
"EventSeen",
"(",
"event",
"=",
"event",
",",
"medium",
"=",
"medium",
")",
"for",
"event",
"in",
"self",
"]",
")"
] | Creates EventSeen objects for the provided medium for every event
in the queryset. | [
"Creates",
"EventSeen",
"objects",
"for",
"the",
"provided",
"medium",
"for",
"every",
"event",
"in",
"the",
"queryset",
"."
] | [
"\"\"\"Creates EventSeen objects for the provided medium for every event\n in the queryset.\n\n Creating these EventSeen objects ensures they will not be\n returned when passing ``seen=False`` to any of the medium\n event retrieval functions, ``events``, ``entity_events``, or\n ``... | [
{
"param": "self",
"type": null
},
{
"param": "medium",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "medium",
"type": null,
"docstring": null,
"docstring_tokens":... |
4f1191a859be387f69428bed4459aeac93a643cd | Wilduck/django-entity-event | entity_event/models.py | [
"MIT"
] | Python | mark_seen | <not_specific> | def mark_seen(self, medium):
"""Creates EventSeen objects for the provided medium for every event
in the queryset.
Creating these EventSeen objects ensures they will not be
returned when passing ``seen=False`` to any of the medium
event retrieval functions, ``events``, ``entity_... | Creates EventSeen objects for the provided medium for every event
in the queryset.
Creating these EventSeen objects ensures they will not be
returned when passing ``seen=False`` to any of the medium
event retrieval functions, ``events``, ``entity_events``, or
``events_targets``.... | Creates EventSeen objects for the provided medium for every event
in the queryset.
| [
"Creates",
"EventSeen",
"objects",
"for",
"the",
"provided",
"medium",
"for",
"every",
"event",
"in",
"the",
"queryset",
"."
] | def mark_seen(self, medium):
return self.get_queryset().mark_seen(medium) | [
"def",
"mark_seen",
"(",
"self",
",",
"medium",
")",
":",
"return",
"self",
".",
"get_queryset",
"(",
")",
".",
"mark_seen",
"(",
"medium",
")"
] | Creates EventSeen objects for the provided medium for every event
in the queryset. | [
"Creates",
"EventSeen",
"objects",
"for",
"the",
"provided",
"medium",
"for",
"every",
"event",
"in",
"the",
"queryset",
"."
] | [
"\"\"\"Creates EventSeen objects for the provided medium for every event\n in the queryset.\n\n Creating these EventSeen objects ensures they will not be\n returned when passing ``seen=False`` to any of the medium\n event retrieval functions, ``events``, ``entity_events``, or\n ``... | [
{
"param": "self",
"type": null
},
{
"param": "medium",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "medium",
"type": null,
"docstring": null,
"docstring_tokens":... |
4f1191a859be387f69428bed4459aeac93a643cd | Wilduck/django-entity-event | entity_event/models.py | [
"MIT"
] | Python | create_event | <not_specific> | def create_event(self, actors=None, ignore_duplicates=False, **kwargs):
"""Create events with actors.
This method can be used in place of ``Event.objects.create``
to create events, and the appropriate actors. It takes all the
same keywords as ``Event.objects.create`` for the event
... | Create events with actors.
This method can be used in place of ``Event.objects.create``
to create events, and the appropriate actors. It takes all the
same keywords as ``Event.objects.create`` for the event
creation, but additionally takes a list of actors, and can be
told to no... | Create events with actors.
This method can be used in place of ``Event.objects.create``
to create events, and the appropriate actors. It takes all the
same keywords as ``Event.objects.create`` for the event
creation, but additionally takes a list of actors, and can be
told to not attempt to create an event if a duplica... | [
"Create",
"events",
"with",
"actors",
".",
"This",
"method",
"can",
"be",
"used",
"in",
"place",
"of",
"`",
"`",
"Event",
".",
"objects",
".",
"create",
"`",
"`",
"to",
"create",
"events",
"and",
"the",
"appropriate",
"actors",
".",
"It",
"takes",
"all... | def create_event(self, actors=None, ignore_duplicates=False, **kwargs):
if ignore_duplicates and self.filter(uuid=kwargs.get('uuid', '')).exists():
return None
event = self.create(**kwargs)
actors = [
a.id if isinstance(a, Entity) else a
for a in actors
... | [
"def",
"create_event",
"(",
"self",
",",
"actors",
"=",
"None",
",",
"ignore_duplicates",
"=",
"False",
",",
"**",
"kwargs",
")",
":",
"if",
"ignore_duplicates",
"and",
"self",
".",
"filter",
"(",
"uuid",
"=",
"kwargs",
".",
"get",
"(",
"'uuid'",
",",
... | Create events with actors. | [
"Create",
"events",
"with",
"actors",
"."
] | [
"\"\"\"Create events with actors.\n\n This method can be used in place of ``Event.objects.create``\n to create events, and the appropriate actors. It takes all the\n same keywords as ``Event.objects.create`` for the event\n creation, but additionally takes a list of actors, and can be\n ... | [
{
"param": "self",
"type": null
},
{
"param": "actors",
"type": null
},
{
"param": "ignore_duplicates",
"type": null
}
] | {
"returns": [
{
"docstring": "The created event. Alternatively if a duplicate\nevent already exists and ``ignore_duplicates`` is\n``True``, it will return ``None``.",
"docstring_tokens": [
"The",
"created",
"event",
".",
"Alternatively",
"if",
"... |
4f1191a859be387f69428bed4459aeac93a643cd | Wilduck/django-entity-event | entity_event/models.py | [
"MIT"
] | Python | _unseen_event_ids | <not_specific> | def _unseen_event_ids(medium):
"""Return all events that have not been seen on this medium.
"""
query = '''
SELECT event.id
FROM entity_event_event AS event
LEFT OUTER JOIN (SELECT *
FROM entity_event_eventseen AS seen
WHERE seen.medium_id=%s... | Return all events that have not been seen on this medium.
| Return all events that have not been seen on this medium. | [
"Return",
"all",
"events",
"that",
"have",
"not",
"been",
"seen",
"on",
"this",
"medium",
"."
] | def _unseen_event_ids(medium):
query = '''
SELECT event.id
FROM entity_event_event AS event
LEFT OUTER JOIN (SELECT *
FROM entity_event_eventseen AS seen
WHERE seen.medium_id=%s) AS eventseen
ON event.id = eventseen.event_id
WHERE eve... | [
"def",
"_unseen_event_ids",
"(",
"medium",
")",
":",
"query",
"=",
"'''\n SELECT event.id\n FROM entity_event_event AS event\n LEFT OUTER JOIN (SELECT *\n FROM entity_event_eventseen AS seen\n WHERE seen.medium_id=%s) AS eventseen\n ... | Return all events that have not been seen on this medium. | [
"Return",
"all",
"events",
"that",
"have",
"not",
"been",
"seen",
"on",
"this",
"medium",
"."
] | [
"\"\"\"Return all events that have not been seen on this medium.\n \"\"\""
] | [
{
"param": "medium",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "medium",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6da5fd1978588b8f18272b4acfc45c0e4ec22108 | timgates42/django-model-report | model_report/report.py | [
"BSD-3-Clause"
] | Python | autodiscover | null | def autodiscover(module_name='reports.py'):
"""
Auto-discover INSTALLED_APPS report.py modules and fail silently when
not present. Borrowed form django.contrib.admin
"""
from importlib import import_module
from django.utils.module_loading import module_has_submodule
global reports
for... |
Auto-discover INSTALLED_APPS report.py modules and fail silently when
not present. Borrowed form django.contrib.admin
| Auto-discover INSTALLED_APPS report.py modules and fail silently when
not present. | [
"Auto",
"-",
"discover",
"INSTALLED_APPS",
"report",
".",
"py",
"modules",
"and",
"fail",
"silently",
"when",
"not",
"present",
"."
] | def autodiscover(module_name='reports.py'):
from importlib import import_module
from django.utils.module_loading import module_has_submodule
global reports
for app in settings.INSTALLED_APPS:
mod = import_module(app)
try:
before_import_registry = copy.copy(reports)
... | [
"def",
"autodiscover",
"(",
"module_name",
"=",
"'reports.py'",
")",
":",
"from",
"importlib",
"import",
"import_module",
"from",
"django",
".",
"utils",
".",
"module_loading",
"import",
"module_has_submodule",
"global",
"reports",
"for",
"app",
"in",
"settings",
... | Auto-discover INSTALLED_APPS report.py modules and fail silently when
not present. | [
"Auto",
"-",
"discover",
"INSTALLED_APPS",
"report",
".",
"py",
"modules",
"and",
"fail",
"silently",
"when",
"not",
"present",
"."
] | [
"\"\"\"\n Auto-discover INSTALLED_APPS report.py modules and fail silently when\n not present. Borrowed form django.contrib.admin\n \"\"\"",
"# Attempt to import the app's admin module.",
"# Reset the model registry to the state before the last import as",
"# this import will have to reoccur on the n... | [
{
"param": "module_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "module_name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.