partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
valid | statuses | Get job statuses.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
\b
```bash
$ polyaxon job -j 2 statuses
``` | polyaxon_cli/cli/job.py | def statuses(ctx, page):
"""Get job statuses.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
\b
```bash
$ polyaxon job -j 2 statuses
```
"""
user, project_name, _job = get_job_or_local(ctx.obj.get('project'), ctx.obj.get('job'))
page = page or 1
try:
r... | def statuses(ctx, page):
"""Get job statuses.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
\b
```bash
$ polyaxon job -j 2 statuses
```
"""
user, project_name, _job = get_job_or_local(ctx.obj.get('project'), ctx.obj.get('job'))
page = page or 1
try:
r... | [
"Get",
"job",
"statuses",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/job.py#L304-L339 | [
"def",
"statuses",
"(",
"ctx",
",",
"page",
")",
":",
"user",
",",
"project_name",
",",
"_job",
"=",
"get_job_or_local",
"(",
"ctx",
".",
"obj",
".",
"get",
"(",
"'project'",
")",
",",
"ctx",
".",
"obj",
".",
"get",
"(",
"'job'",
")",
")",
"page",
... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | resources | Get job resources.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
\b
```bash
$ polyaxon job -j 2 resources
```
For GPU resources
\b
```bash
$ polyaxon job -j 2 resources --gpu
``` | polyaxon_cli/cli/job.py | def resources(ctx, gpu):
"""Get job resources.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
\b
```bash
$ polyaxon job -j 2 resources
```
For GPU resources
\b
```bash
$ polyaxon job -j 2 resources --gpu
```
"""
user, project_name, _job = get_job... | def resources(ctx, gpu):
"""Get job resources.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
\b
```bash
$ polyaxon job -j 2 resources
```
For GPU resources
\b
```bash
$ polyaxon job -j 2 resources --gpu
```
"""
user, project_name, _job = get_job... | [
"Get",
"job",
"resources",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/job.py#L346-L375 | [
"def",
"resources",
"(",
"ctx",
",",
"gpu",
")",
":",
"user",
",",
"project_name",
",",
"_job",
"=",
"get_job_or_local",
"(",
"ctx",
".",
"obj",
".",
"get",
"(",
"'project'",
")",
",",
"ctx",
".",
"obj",
".",
"get",
"(",
"'job'",
")",
")",
"try",
... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | logs | Get job logs.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
\b
```bash
$ polyaxon job -j 2 logs
```
\b
```bash
$ polyaxon job logs
``` | polyaxon_cli/cli/job.py | def logs(ctx, past, follow, hide_time):
"""Get job logs.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
\b
```bash
$ polyaxon job -j 2 logs
```
\b
```bash
$ polyaxon job logs
```
"""
user, project_name, _job = get_job_or_local(ctx.obj.get('project'), ... | def logs(ctx, past, follow, hide_time):
"""Get job logs.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
\b
```bash
$ polyaxon job -j 2 logs
```
\b
```bash
$ polyaxon job logs
```
"""
user, project_name, _job = get_job_or_local(ctx.obj.get('project'), ... | [
"Get",
"job",
"logs",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/job.py#L386-L431 | [
"def",
"logs",
"(",
"ctx",
",",
"past",
",",
"follow",
",",
"hide_time",
")",
":",
"user",
",",
"project_name",
",",
"_job",
"=",
"get_job_or_local",
"(",
"ctx",
".",
"obj",
".",
"get",
"(",
"'project'",
")",
",",
"ctx",
".",
"obj",
".",
"get",
"("... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | outputs | Download outputs for job.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
\b
```bash
$ polyaxon job -j 1 outputs
``` | polyaxon_cli/cli/job.py | def outputs(ctx):
"""Download outputs for job.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
\b
```bash
$ polyaxon job -j 1 outputs
```
"""
user, project_name, _job = get_job_or_local(ctx.obj.get('project'), ctx.obj.get('job'))
try:
PolyaxonClient().job.d... | def outputs(ctx):
"""Download outputs for job.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
\b
```bash
$ polyaxon job -j 1 outputs
```
"""
user, project_name, _job = get_job_or_local(ctx.obj.get('project'), ctx.obj.get('job'))
try:
PolyaxonClient().job.d... | [
"Download",
"outputs",
"for",
"job",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/job.py#L437-L456 | [
"def",
"outputs",
"(",
"ctx",
")",
":",
"user",
",",
"project_name",
",",
"_job",
"=",
"get_job_or_local",
"(",
"ctx",
".",
"obj",
".",
"get",
"(",
"'project'",
")",
",",
"ctx",
".",
"obj",
".",
"get",
"(",
"'job'",
")",
")",
"try",
":",
"PolyaxonC... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | pprint | Prints as formatted JSON | polyaxon_cli/utils/formatting.py | def pprint(value):
"""Prints as formatted JSON"""
click.echo(
json.dumps(value,
sort_keys=True,
indent=4,
separators=(',', ': '))) | def pprint(value):
"""Prints as formatted JSON"""
click.echo(
json.dumps(value,
sort_keys=True,
indent=4,
separators=(',', ': '))) | [
"Prints",
"as",
"formatted",
"JSON"
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/utils/formatting.py#L51-L57 | [
"def",
"pprint",
"(",
"value",
")",
":",
"click",
".",
"echo",
"(",
"json",
".",
"dumps",
"(",
"value",
",",
"sort_keys",
"=",
"True",
",",
"indent",
"=",
"4",
",",
"separators",
"=",
"(",
"','",
",",
"': '",
")",
")",
")"
] | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | login | Login to Polyaxon. | polyaxon_cli/cli/auth.py | def login(token, username, password):
"""Login to Polyaxon."""
auth_client = PolyaxonClient().auth
if username:
# Use username / password login
if not password:
password = click.prompt('Please enter your password', type=str, hide_input=True)
password = password.strip(... | def login(token, username, password):
"""Login to Polyaxon."""
auth_client = PolyaxonClient().auth
if username:
# Use username / password login
if not password:
password = click.prompt('Please enter your password', type=str, hide_input=True)
password = password.strip(... | [
"Login",
"to",
"Polyaxon",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/auth.py#L24-L86 | [
"def",
"login",
"(",
"token",
",",
"username",
",",
"password",
")",
":",
"auth_client",
"=",
"PolyaxonClient",
"(",
")",
".",
"auth",
"if",
"username",
":",
"# Use username / password login",
"if",
"not",
"password",
":",
"password",
"=",
"click",
".",
"pro... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | whoami | Show current logged Polyaxon user. | polyaxon_cli/cli/auth.py | def whoami():
"""Show current logged Polyaxon user."""
try:
user = PolyaxonClient().auth.get_user()
except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:
Printer.print_error('Could not load user info.')
Printer.print_error('Error message `{}`.'.format(e))... | def whoami():
"""Show current logged Polyaxon user."""
try:
user = PolyaxonClient().auth.get_user()
except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:
Printer.print_error('Could not load user info.')
Printer.print_error('Error message `{}`.'.format(e))... | [
"Show",
"current",
"logged",
"Polyaxon",
"user",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/auth.py#L100-L108 | [
"def",
"whoami",
"(",
")",
":",
"try",
":",
"user",
"=",
"PolyaxonClient",
"(",
")",
".",
"auth",
".",
"get_user",
"(",
")",
"except",
"(",
"PolyaxonHTTPError",
",",
"PolyaxonShouldExitError",
",",
"PolyaxonClientException",
")",
"as",
"e",
":",
"Printer",
... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | build | Commands for build jobs. | polyaxon_cli/cli/build.py | def build(ctx, project, build): # pylint:disable=redefined-outer-name
"""Commands for build jobs."""
ctx.obj = ctx.obj or {}
ctx.obj['project'] = project
ctx.obj['build'] = build | def build(ctx, project, build): # pylint:disable=redefined-outer-name
"""Commands for build jobs."""
ctx.obj = ctx.obj or {}
ctx.obj['project'] = project
ctx.obj['build'] = build | [
"Commands",
"for",
"build",
"jobs",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/build.py#L49-L53 | [
"def",
"build",
"(",
"ctx",
",",
"project",
",",
"build",
")",
":",
"# pylint:disable=redefined-outer-name",
"ctx",
".",
"obj",
"=",
"ctx",
".",
"obj",
"or",
"{",
"}",
"ctx",
".",
"obj",
"[",
"'project'",
"]",
"=",
"project",
"ctx",
".",
"obj",
"[",
... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | get | Get build job.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
\b
```bash
$ polyaxon build -b 1 get
```
\b
```bash
$ polyaxon build --build=1 --project=project_name get
``` | polyaxon_cli/cli/build.py | def get(ctx):
"""Get build job.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
\b
```bash
$ polyaxon build -b 1 get
```
\b
```bash
$ polyaxon build --build=1 --project=project_name get
```
"""
user, project_name, _build = get_build_or_local(ctx.obj.ge... | def get(ctx):
"""Get build job.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
\b
```bash
$ polyaxon build -b 1 get
```
\b
```bash
$ polyaxon build --build=1 --project=project_name get
```
"""
user, project_name, _build = get_build_or_local(ctx.obj.ge... | [
"Get",
"build",
"job",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/build.py#L59-L85 | [
"def",
"get",
"(",
"ctx",
")",
":",
"user",
",",
"project_name",
",",
"_build",
"=",
"get_build_or_local",
"(",
"ctx",
".",
"obj",
".",
"get",
"(",
"'project'",
")",
",",
"ctx",
".",
"obj",
".",
"get",
"(",
"'build'",
")",
")",
"try",
":",
"respons... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | delete | Delete build job.
Uses [Caching](/references/polyaxon-cli/#caching)
Example:
\b
```bash
$ polyaxon build delete
```
\b
```bash
$ polyaxon build -b 2 delete
``` | polyaxon_cli/cli/build.py | def delete(ctx):
"""Delete build job.
Uses [Caching](/references/polyaxon-cli/#caching)
Example:
\b
```bash
$ polyaxon build delete
```
\b
```bash
$ polyaxon build -b 2 delete
```
"""
user, project_name, _build = get_build_or_local(ctx.obj.get('project'), ctx.obj.... | def delete(ctx):
"""Delete build job.
Uses [Caching](/references/polyaxon-cli/#caching)
Example:
\b
```bash
$ polyaxon build delete
```
\b
```bash
$ polyaxon build -b 2 delete
```
"""
user, project_name, _build = get_build_or_local(ctx.obj.get('project'), ctx.obj.... | [
"Delete",
"build",
"job",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/build.py#L91-L124 | [
"def",
"delete",
"(",
"ctx",
")",
":",
"user",
",",
"project_name",
",",
"_build",
"=",
"get_build_or_local",
"(",
"ctx",
".",
"obj",
".",
"get",
"(",
"'project'",
")",
",",
"ctx",
".",
"obj",
".",
"get",
"(",
"'build'",
")",
")",
"if",
"not",
"cli... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | update | Update build.
Uses [Caching](/references/polyaxon-cli/#caching)
Example:
\b
```bash
$ polyaxon build -b 2 update --description="new description for my build"
``` | polyaxon_cli/cli/build.py | def update(ctx, name, description, tags):
"""Update build.
Uses [Caching](/references/polyaxon-cli/#caching)
Example:
\b
```bash
$ polyaxon build -b 2 update --description="new description for my build"
```
"""
user, project_name, _build = get_build_or_local(ctx.obj.get('project')... | def update(ctx, name, description, tags):
"""Update build.
Uses [Caching](/references/polyaxon-cli/#caching)
Example:
\b
```bash
$ polyaxon build -b 2 update --description="new description for my build"
```
"""
user, project_name, _build = get_build_or_local(ctx.obj.get('project')... | [
"Update",
"build",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/build.py#L134-L172 | [
"def",
"update",
"(",
"ctx",
",",
"name",
",",
"description",
",",
"tags",
")",
":",
"user",
",",
"project_name",
",",
"_build",
"=",
"get_build_or_local",
"(",
"ctx",
".",
"obj",
".",
"get",
"(",
"'project'",
")",
",",
"ctx",
".",
"obj",
".",
"get",... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | stop | Stop build job.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
\b
```bash
$ polyaxon build stop
```
\b
```bash
$ polyaxon build -b 2 stop
``` | polyaxon_cli/cli/build.py | def stop(ctx, yes):
"""Stop build job.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
\b
```bash
$ polyaxon build stop
```
\b
```bash
$ polyaxon build -b 2 stop
```
"""
user, project_name, _build = get_build_or_local(ctx.obj.get('project'), ctx.obj.ge... | def stop(ctx, yes):
"""Stop build job.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
\b
```bash
$ polyaxon build stop
```
\b
```bash
$ polyaxon build -b 2 stop
```
"""
user, project_name, _build = get_build_or_local(ctx.obj.get('project'), ctx.obj.ge... | [
"Stop",
"build",
"job",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/build.py#L181-L211 | [
"def",
"stop",
"(",
"ctx",
",",
"yes",
")",
":",
"user",
",",
"project_name",
",",
"_build",
"=",
"get_build_or_local",
"(",
"ctx",
".",
"obj",
".",
"get",
"(",
"'project'",
")",
",",
"ctx",
".",
"obj",
".",
"get",
"(",
"'build'",
")",
")",
"if",
... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | bookmark | Bookmark build job.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
\b
```bash
$ polyaxon build bookmark
```
\b
```bash
$ polyaxon build -b 2 bookmark
``` | polyaxon_cli/cli/build.py | def bookmark(ctx):
"""Bookmark build job.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
\b
```bash
$ polyaxon build bookmark
```
\b
```bash
$ polyaxon build -b 2 bookmark
```
"""
user, project_name, _build = get_build_or_local(ctx.obj.get('project'),... | def bookmark(ctx):
"""Bookmark build job.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
\b
```bash
$ polyaxon build bookmark
```
\b
```bash
$ polyaxon build -b 2 bookmark
```
"""
user, project_name, _build = get_build_or_local(ctx.obj.get('project'),... | [
"Bookmark",
"build",
"job",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/build.py#L217-L242 | [
"def",
"bookmark",
"(",
"ctx",
")",
":",
"user",
",",
"project_name",
",",
"_build",
"=",
"get_build_or_local",
"(",
"ctx",
".",
"obj",
".",
"get",
"(",
"'project'",
")",
",",
"ctx",
".",
"obj",
".",
"get",
"(",
"'build'",
")",
")",
"try",
":",
"Po... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | resources | Get build job resources.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
\b
```bash
$ polyaxon build -b 2 resources
```
For GPU resources
\b
```bash
$ polyaxon build -b 2 resources --gpu
``` | polyaxon_cli/cli/build.py | def resources(ctx, gpu):
"""Get build job resources.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
\b
```bash
$ polyaxon build -b 2 resources
```
For GPU resources
\b
```bash
$ polyaxon build -b 2 resources --gpu
```
"""
user, project_name, _bui... | def resources(ctx, gpu):
"""Get build job resources.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
\b
```bash
$ polyaxon build -b 2 resources
```
For GPU resources
\b
```bash
$ polyaxon build -b 2 resources --gpu
```
"""
user, project_name, _bui... | [
"Get",
"build",
"job",
"resources",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/build.py#L322-L351 | [
"def",
"resources",
"(",
"ctx",
",",
"gpu",
")",
":",
"user",
",",
"project_name",
",",
"_build",
"=",
"get_build_or_local",
"(",
"ctx",
".",
"obj",
".",
"get",
"(",
"'project'",
")",
",",
"ctx",
".",
"obj",
".",
"get",
"(",
"'build'",
")",
")",
"t... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | init | Initialize a new polyaxonfile specification. | polyaxon_cli/cli/init.py | def init(project, polyaxonfile):
"""Initialize a new polyaxonfile specification."""
user, project_name = get_project_or_local(project)
try:
project_config = PolyaxonClient().project.get_project(user, project_name)
except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:... | def init(project, polyaxonfile):
"""Initialize a new polyaxonfile specification."""
user, project_name = get_project_or_local(project)
try:
project_config = PolyaxonClient().project.get_project(user, project_name)
except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:... | [
"Initialize",
"a",
"new",
"polyaxonfile",
"specification",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/init.py#L49-L97 | [
"def",
"init",
"(",
"project",
",",
"polyaxonfile",
")",
":",
"user",
",",
"project_name",
"=",
"get_project_or_local",
"(",
"project",
")",
"try",
":",
"project_config",
"=",
"PolyaxonClient",
"(",
")",
".",
"project",
".",
"get_project",
"(",
"user",
",",
... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | run | Run polyaxonfile specification.
Examples:
\b
```bash
$ polyaxon run -f file -f file_override ...
```
Upload before running
\b
```bash
$ polyaxon run -f file -u
```
Run and set description and tags for this run
\b
```bash
$ polyaxon run -f file -u --descripti... | polyaxon_cli/cli/run.py | def run(ctx, project, file, name, tags, description, ttl, u, l): # pylint:disable=redefined-builtin
"""Run polyaxonfile specification.
Examples:
\b
```bash
$ polyaxon run -f file -f file_override ...
```
Upload before running
\b
```bash
$ polyaxon run -f file -u
```
... | def run(ctx, project, file, name, tags, description, ttl, u, l): # pylint:disable=redefined-builtin
"""Run polyaxonfile specification.
Examples:
\b
```bash
$ polyaxon run -f file -f file_override ...
```
Upload before running
\b
```bash
$ polyaxon run -f file -u
```
... | [
"Run",
"polyaxonfile",
"specification",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/run.py#L48-L211 | [
"def",
"run",
"(",
"ctx",
",",
"project",
",",
"file",
",",
"name",
",",
"tags",
",",
"description",
",",
"ttl",
",",
"u",
",",
"l",
")",
":",
"# pylint:disable=redefined-builtin",
"if",
"not",
"file",
":",
"file",
"=",
"PolyaxonFile",
".",
"check_defaul... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | bookmark | Commands for bookmarks. | polyaxon_cli/cli/bookmark.py | def bookmark(ctx, username): # pylint:disable=redefined-outer-name
"""Commands for bookmarks."""
ctx.obj = ctx.obj or {}
ctx.obj['username'] = username | def bookmark(ctx, username): # pylint:disable=redefined-outer-name
"""Commands for bookmarks."""
ctx.obj = ctx.obj or {}
ctx.obj['username'] = username | [
"Commands",
"for",
"bookmarks",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/bookmark.py#L25-L28 | [
"def",
"bookmark",
"(",
"ctx",
",",
"username",
")",
":",
"# pylint:disable=redefined-outer-name",
"ctx",
".",
"obj",
"=",
"ctx",
".",
"obj",
"or",
"{",
"}",
"ctx",
".",
"obj",
"[",
"'username'",
"]",
"=",
"username"
] | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | projects | List bookmarked projects for user.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
\b
```bash
$ polyaxon bookmark projects
```
\b
```bash
$ polyaxon bookmark -u adam projects
``` | polyaxon_cli/cli/bookmark.py | def projects(ctx, page):
"""List bookmarked projects for user.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
\b
```bash
$ polyaxon bookmark projects
```
\b
```bash
$ polyaxon bookmark -u adam projects
```
"""
user = get_username_or_local(ctx.obj.get(... | def projects(ctx, page):
"""List bookmarked projects for user.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
\b
```bash
$ polyaxon bookmark projects
```
\b
```bash
$ polyaxon bookmark -u adam projects
```
"""
user = get_username_or_local(ctx.obj.get(... | [
"List",
"bookmarked",
"projects",
"for",
"user",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/bookmark.py#L35-L76 | [
"def",
"projects",
"(",
"ctx",
",",
"page",
")",
":",
"user",
"=",
"get_username_or_local",
"(",
"ctx",
".",
"obj",
".",
"get",
"(",
"'username'",
")",
")",
"page",
"=",
"page",
"or",
"1",
"try",
":",
"response",
"=",
"PolyaxonClient",
"(",
")",
".",... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | IgnoreManager._remove_trailing_spaces | Remove trailing spaces unless they are quoted with a backslash. | polyaxon_cli/managers/ignore.py | def _remove_trailing_spaces(line):
"""Remove trailing spaces unless they are quoted with a backslash."""
while line.endswith(' ') and not line.endswith('\\ '):
line = line[:-1]
return line.replace('\\ ', ' ') | def _remove_trailing_spaces(line):
"""Remove trailing spaces unless they are quoted with a backslash."""
while line.endswith(' ') and not line.endswith('\\ '):
line = line[:-1]
return line.replace('\\ ', ' ') | [
"Remove",
"trailing",
"spaces",
"unless",
"they",
"are",
"quoted",
"with",
"a",
"backslash",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/managers/ignore.py#L105-L109 | [
"def",
"_remove_trailing_spaces",
"(",
"line",
")",
":",
"while",
"line",
".",
"endswith",
"(",
"' '",
")",
"and",
"not",
"line",
".",
"endswith",
"(",
"'\\\\ '",
")",
":",
"line",
"=",
"line",
"[",
":",
"-",
"1",
"]",
"return",
"line",
".",
"replace... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | IgnoreManager.find_matching | Yield all matching patterns for path. | polyaxon_cli/managers/ignore.py | def find_matching(cls, path, patterns):
"""Yield all matching patterns for path."""
for pattern in patterns:
if pattern.match(path):
yield pattern | def find_matching(cls, path, patterns):
"""Yield all matching patterns for path."""
for pattern in patterns:
if pattern.match(path):
yield pattern | [
"Yield",
"all",
"matching",
"patterns",
"for",
"path",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/managers/ignore.py#L116-L120 | [
"def",
"find_matching",
"(",
"cls",
",",
"path",
",",
"patterns",
")",
":",
"for",
"pattern",
"in",
"patterns",
":",
"if",
"pattern",
".",
"match",
"(",
"path",
")",
":",
"yield",
"pattern"
] | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | IgnoreManager.is_ignored | Check whether a path is ignored. For directories, include a trailing slash. | polyaxon_cli/managers/ignore.py | def is_ignored(cls, path, patterns):
"""Check whether a path is ignored. For directories, include a trailing slash."""
status = None
for pattern in cls.find_matching(path, patterns):
status = pattern.is_exclude
return status | def is_ignored(cls, path, patterns):
"""Check whether a path is ignored. For directories, include a trailing slash."""
status = None
for pattern in cls.find_matching(path, patterns):
status = pattern.is_exclude
return status | [
"Check",
"whether",
"a",
"path",
"is",
"ignored",
".",
"For",
"directories",
"include",
"a",
"trailing",
"slash",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/managers/ignore.py#L123-L128 | [
"def",
"is_ignored",
"(",
"cls",
",",
"path",
",",
"patterns",
")",
":",
"status",
"=",
"None",
"for",
"pattern",
"in",
"cls",
".",
"find_matching",
"(",
"path",
",",
"patterns",
")",
":",
"status",
"=",
"pattern",
".",
"is_exclude",
"return",
"status"
] | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | IgnoreManager._matches_patterns | Given a list of patterns, returns a if a path matches any pattern. | polyaxon_cli/managers/ignore.py | def _matches_patterns(path, patterns):
"""Given a list of patterns, returns a if a path matches any pattern."""
for glob in patterns:
try:
if PurePath(path).match(glob):
return True
except TypeError:
pass
return False | def _matches_patterns(path, patterns):
"""Given a list of patterns, returns a if a path matches any pattern."""
for glob in patterns:
try:
if PurePath(path).match(glob):
return True
except TypeError:
pass
return False | [
"Given",
"a",
"list",
"of",
"patterns",
"returns",
"a",
"if",
"a",
"path",
"matches",
"any",
"pattern",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/managers/ignore.py#L178-L186 | [
"def",
"_matches_patterns",
"(",
"path",
",",
"patterns",
")",
":",
"for",
"glob",
"in",
"patterns",
":",
"try",
":",
"if",
"PurePath",
"(",
"path",
")",
".",
"match",
"(",
"glob",
")",
":",
"return",
"True",
"except",
"TypeError",
":",
"pass",
"return... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | IgnoreManager._ignore_path | Returns a whether a path should be ignored or not. | polyaxon_cli/managers/ignore.py | def _ignore_path(cls, path, ignore_list=None, white_list=None):
"""Returns a whether a path should be ignored or not."""
ignore_list = ignore_list or []
white_list = white_list or []
return (cls._matches_patterns(path, ignore_list) and
not cls._matches_patterns(path, whit... | def _ignore_path(cls, path, ignore_list=None, white_list=None):
"""Returns a whether a path should be ignored or not."""
ignore_list = ignore_list or []
white_list = white_list or []
return (cls._matches_patterns(path, ignore_list) and
not cls._matches_patterns(path, whit... | [
"Returns",
"a",
"whether",
"a",
"path",
"should",
"be",
"ignored",
"or",
"not",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/managers/ignore.py#L189-L194 | [
"def",
"_ignore_path",
"(",
"cls",
",",
"path",
",",
"ignore_list",
"=",
"None",
",",
"white_list",
"=",
"None",
")",
":",
"ignore_list",
"=",
"ignore_list",
"or",
"[",
"]",
"white_list",
"=",
"white_list",
"or",
"[",
"]",
"return",
"(",
"cls",
".",
"_... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | group | Commands for experiment groups. | polyaxon_cli/cli/experiment_group.py | def group(ctx, project, group): # pylint:disable=redefined-outer-name
"""Commands for experiment groups."""
ctx.obj = ctx.obj or {}
ctx.obj['project'] = project
ctx.obj['group'] = group | def group(ctx, project, group): # pylint:disable=redefined-outer-name
"""Commands for experiment groups."""
ctx.obj = ctx.obj or {}
ctx.obj['project'] = project
ctx.obj['group'] = group | [
"Commands",
"for",
"experiment",
"groups",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/experiment_group.py#L44-L48 | [
"def",
"group",
"(",
"ctx",
",",
"project",
",",
"group",
")",
":",
"# pylint:disable=redefined-outer-name",
"ctx",
".",
"obj",
"=",
"ctx",
".",
"obj",
"or",
"{",
"}",
"ctx",
".",
"obj",
"[",
"'project'",
"]",
"=",
"project",
"ctx",
".",
"obj",
"[",
... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | get | Get experiment group by uuid.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
\b
```bash
$ polyaxon group -g 13 get
``` | polyaxon_cli/cli/experiment_group.py | def get(ctx):
"""Get experiment group by uuid.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
\b
```bash
$ polyaxon group -g 13 get
```
"""
user, project_name, _group = get_project_group_or_local(ctx.obj.get('project'),
... | def get(ctx):
"""Get experiment group by uuid.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
\b
```bash
$ polyaxon group -g 13 get
```
"""
user, project_name, _group = get_project_group_or_local(ctx.obj.get('project'),
... | [
"Get",
"experiment",
"group",
"by",
"uuid",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/experiment_group.py#L54-L77 | [
"def",
"get",
"(",
"ctx",
")",
":",
"user",
",",
"project_name",
",",
"_group",
"=",
"get_project_group_or_local",
"(",
"ctx",
".",
"obj",
".",
"get",
"(",
"'project'",
")",
",",
"ctx",
".",
"obj",
".",
"get",
"(",
"'group'",
")",
")",
"try",
":",
... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | delete | Delete experiment group.
Uses [Caching](/references/polyaxon-cli/#caching) | polyaxon_cli/cli/experiment_group.py | def delete(ctx):
"""Delete experiment group.
Uses [Caching](/references/polyaxon-cli/#caching)
"""
user, project_name, _group = get_project_group_or_local(ctx.obj.get('project'),
ctx.obj.get('group'))
if not click.confirm("Are sure you wa... | def delete(ctx):
"""Delete experiment group.
Uses [Caching](/references/polyaxon-cli/#caching)
"""
user, project_name, _group = get_project_group_or_local(ctx.obj.get('project'),
ctx.obj.get('group'))
if not click.confirm("Are sure you wa... | [
"Delete",
"experiment",
"group",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/experiment_group.py#L83-L106 | [
"def",
"delete",
"(",
"ctx",
")",
":",
"user",
",",
"project_name",
",",
"_group",
"=",
"get_project_group_or_local",
"(",
"ctx",
".",
"obj",
".",
"get",
"(",
"'project'",
")",
",",
"ctx",
".",
"obj",
".",
"get",
"(",
"'group'",
")",
")",
"if",
"not"... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | update | Update experiment group.
Uses [Caching](/references/polyaxon-cli/#caching)
Example:
\b
```bash
$ polyaxon group -g 2 update --description="new description for this group"
```
\b
```bash
$ polyaxon update --tags="foo, bar"
``` | polyaxon_cli/cli/experiment_group.py | def update(ctx, name, description, tags):
"""Update experiment group.
Uses [Caching](/references/polyaxon-cli/#caching)
Example:
\b
```bash
$ polyaxon group -g 2 update --description="new description for this group"
```
\b
```bash
$ polyaxon update --tags="foo, bar"
```
... | def update(ctx, name, description, tags):
"""Update experiment group.
Uses [Caching](/references/polyaxon-cli/#caching)
Example:
\b
```bash
$ polyaxon group -g 2 update --description="new description for this group"
```
\b
```bash
$ polyaxon update --tags="foo, bar"
```
... | [
"Update",
"experiment",
"group",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/experiment_group.py#L116-L160 | [
"def",
"update",
"(",
"ctx",
",",
"name",
",",
"description",
",",
"tags",
")",
":",
"user",
",",
"project_name",
",",
"_group",
"=",
"get_project_group_or_local",
"(",
"ctx",
".",
"obj",
".",
"get",
"(",
"'project'",
")",
",",
"ctx",
".",
"obj",
".",
... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | stop | Stop experiments in the group.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples: stop only pending experiments
\b
```bash
$ polyaxon group stop --pending
```
Examples: stop all unfinished
\b
```bash
$ polyaxon group stop
```
\b
```bash
$ polyaxon g... | polyaxon_cli/cli/experiment_group.py | def stop(ctx, yes, pending):
"""Stop experiments in the group.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples: stop only pending experiments
\b
```bash
$ polyaxon group stop --pending
```
Examples: stop all unfinished
\b
```bash
$ polyaxon group stop
```
... | def stop(ctx, yes, pending):
"""Stop experiments in the group.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples: stop only pending experiments
\b
```bash
$ polyaxon group stop --pending
```
Examples: stop all unfinished
\b
```bash
$ polyaxon group stop
```
... | [
"Stop",
"experiments",
"in",
"the",
"group",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/experiment_group.py#L227-L266 | [
"def",
"stop",
"(",
"ctx",
",",
"yes",
",",
"pending",
")",
":",
"user",
",",
"project_name",
",",
"_group",
"=",
"get_project_group_or_local",
"(",
"ctx",
".",
"obj",
".",
"get",
"(",
"'project'",
")",
",",
"ctx",
".",
"obj",
".",
"get",
"(",
"'grou... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | bookmark | Bookmark group.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
\b
```bash
$ polyaxon group bookmark
```
\b
```bash
$ polyaxon group -g 2 bookmark
``` | polyaxon_cli/cli/experiment_group.py | def bookmark(ctx):
"""Bookmark group.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
\b
```bash
$ polyaxon group bookmark
```
\b
```bash
$ polyaxon group -g 2 bookmark
```
"""
user, project_name, _group = get_project_group_or_local(ctx.obj.get('projec... | def bookmark(ctx):
"""Bookmark group.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
\b
```bash
$ polyaxon group bookmark
```
\b
```bash
$ polyaxon group -g 2 bookmark
```
"""
user, project_name, _group = get_project_group_or_local(ctx.obj.get('projec... | [
"Bookmark",
"group",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/experiment_group.py#L318-L345 | [
"def",
"bookmark",
"(",
"ctx",
")",
":",
"user",
",",
"project_name",
",",
"_group",
"=",
"get_project_group_or_local",
"(",
"ctx",
".",
"obj",
".",
"get",
"(",
"'project'",
")",
",",
"ctx",
".",
"obj",
".",
"get",
"(",
"'group'",
")",
")",
"try",
":... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | config | Set and get the global configurations. | polyaxon_cli/cli/config.py | def config(list): # pylint:disable=redefined-builtin
"""Set and get the global configurations."""
if list:
_config = GlobalConfigManager.get_config_or_default()
Printer.print_header('Current config:')
dict_tabulate(_config.to_dict()) | def config(list): # pylint:disable=redefined-builtin
"""Set and get the global configurations."""
if list:
_config = GlobalConfigManager.get_config_or_default()
Printer.print_header('Current config:')
dict_tabulate(_config.to_dict()) | [
"Set",
"and",
"get",
"the",
"global",
"configurations",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/config.py#L23-L28 | [
"def",
"config",
"(",
"list",
")",
":",
"# pylint:disable=redefined-builtin",
"if",
"list",
":",
"_config",
"=",
"GlobalConfigManager",
".",
"get_config_or_default",
"(",
")",
"Printer",
".",
"print_header",
"(",
"'Current config:'",
")",
"dict_tabulate",
"(",
"_con... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | get | Get the global config values by keys.
Example:
\b
```bash
$ polyaxon config get host http_port
``` | polyaxon_cli/cli/config.py | def get(keys):
"""Get the global config values by keys.
Example:
\b
```bash
$ polyaxon config get host http_port
```
"""
_config = GlobalConfigManager.get_config_or_default()
if not keys:
return
print_values = {}
for key in keys:
if hasattr(_config, key):
... | def get(keys):
"""Get the global config values by keys.
Example:
\b
```bash
$ polyaxon config get host http_port
```
"""
_config = GlobalConfigManager.get_config_or_default()
if not keys:
return
print_values = {}
for key in keys:
if hasattr(_config, key):
... | [
"Get",
"the",
"global",
"config",
"values",
"by",
"keys",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/config.py#L34-L56 | [
"def",
"get",
"(",
"keys",
")",
":",
"_config",
"=",
"GlobalConfigManager",
".",
"get_config_or_default",
"(",
")",
"if",
"not",
"keys",
":",
"return",
"print_values",
"=",
"{",
"}",
"for",
"key",
"in",
"keys",
":",
"if",
"hasattr",
"(",
"_config",
",",
... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | set | Set the global config values.
Example:
\b
```bash
$ polyaxon config set --hots=localhost http_port=80
``` | polyaxon_cli/cli/config.py | def set(verbose, # pylint:disable=redefined-builtin
host,
http_port,
ws_port,
use_https,
verify_ssl):
"""Set the global config values.
Example:
\b
```bash
$ polyaxon config set --hots=localhost http_port=80
```
"""
_config = GlobalConfigManager.... | def set(verbose, # pylint:disable=redefined-builtin
host,
http_port,
ws_port,
use_https,
verify_ssl):
"""Set the global config values.
Example:
\b
```bash
$ polyaxon config set --hots=localhost http_port=80
```
"""
_config = GlobalConfigManager.... | [
"Set",
"the",
"global",
"config",
"values",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/config.py#L68-L106 | [
"def",
"set",
"(",
"verbose",
",",
"# pylint:disable=redefined-builtin",
"host",
",",
"http_port",
",",
"ws_port",
",",
"use_https",
",",
"verify_ssl",
")",
":",
"_config",
"=",
"GlobalConfigManager",
".",
"get_config_or_default",
"(",
")",
"if",
"verbose",
"is",
... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | activate | Activate a user.
Example:
\b
```bash
$ polyaxon user activate david
``` | polyaxon_cli/cli/user.py | def activate(username):
"""Activate a user.
Example:
\b
```bash
$ polyaxon user activate david
```
"""
try:
PolyaxonClient().user.activate_user(username)
except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:
Printer.print_error('Could no... | def activate(username):
"""Activate a user.
Example:
\b
```bash
$ polyaxon user activate david
```
"""
try:
PolyaxonClient().user.activate_user(username)
except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:
Printer.print_error('Could no... | [
"Activate",
"a",
"user",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/user.py#L24-L41 | [
"def",
"activate",
"(",
"username",
")",
":",
"try",
":",
"PolyaxonClient",
"(",
")",
".",
"user",
".",
"activate_user",
"(",
"username",
")",
"except",
"(",
"PolyaxonHTTPError",
",",
"PolyaxonShouldExitError",
",",
"PolyaxonClientException",
")",
"as",
"e",
"... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | delete | Delete a user.
Example:
\b
```bash
$ polyaxon user delete david
``` | polyaxon_cli/cli/user.py | def delete(username):
"""Delete a user.
Example:
\b
```bash
$ polyaxon user delete david
```
"""
try:
PolyaxonClient().user.delete_user(username)
except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:
Printer.print_error('Could not delete... | def delete(username):
"""Delete a user.
Example:
\b
```bash
$ polyaxon user delete david
```
"""
try:
PolyaxonClient().user.delete_user(username)
except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:
Printer.print_error('Could not delete... | [
"Delete",
"a",
"user",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/user.py#L47-L64 | [
"def",
"delete",
"(",
"username",
")",
":",
"try",
":",
"PolyaxonClient",
"(",
")",
".",
"user",
".",
"delete_user",
"(",
"username",
")",
"except",
"(",
"PolyaxonHTTPError",
",",
"PolyaxonShouldExitError",
",",
"PolyaxonClientException",
")",
"as",
"e",
":",
... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | deploy | Deploy polyaxon. | polyaxon_cli/cli/admin.py | def deploy(file, manager_path, check, dry_run): # pylint:disable=redefined-builtin
"""Deploy polyaxon."""
config = read_deployment_config(file)
manager = DeployManager(config=config,
filepath=file,
manager_path=manager_path,
... | def deploy(file, manager_path, check, dry_run): # pylint:disable=redefined-builtin
"""Deploy polyaxon."""
config = read_deployment_config(file)
manager = DeployManager(config=config,
filepath=file,
manager_path=manager_path,
... | [
"Deploy",
"polyaxon",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/admin.py#L52-L71 | [
"def",
"deploy",
"(",
"file",
",",
"manager_path",
",",
"check",
",",
"dry_run",
")",
":",
"# pylint:disable=redefined-builtin",
"config",
"=",
"read_deployment_config",
"(",
"file",
")",
"manager",
"=",
"DeployManager",
"(",
"config",
"=",
"config",
",",
"filep... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | teardown | Teardown a polyaxon deployment given a config file. | polyaxon_cli/cli/admin.py | def teardown(file): # pylint:disable=redefined-builtin
"""Teardown a polyaxon deployment given a config file."""
config = read_deployment_config(file)
manager = DeployManager(config=config, filepath=file)
exception = None
try:
if click.confirm('Would you like to execute pre-delete hooks?', ... | def teardown(file): # pylint:disable=redefined-builtin
"""Teardown a polyaxon deployment given a config file."""
config = read_deployment_config(file)
manager = DeployManager(config=config, filepath=file)
exception = None
try:
if click.confirm('Would you like to execute pre-delete hooks?', ... | [
"Teardown",
"a",
"polyaxon",
"deployment",
"given",
"a",
"config",
"file",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/admin.py#L110-L125 | [
"def",
"teardown",
"(",
"file",
")",
":",
"# pylint:disable=redefined-builtin",
"config",
"=",
"read_deployment_config",
"(",
"file",
")",
"manager",
"=",
"DeployManager",
"(",
"config",
"=",
"config",
",",
"filepath",
"=",
"file",
")",
"exception",
"=",
"None",... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | create_tarfile | Create a tar file based on the list of files passed | polyaxon_cli/utils/files.py | def create_tarfile(files, project_name):
"""Create a tar file based on the list of files passed"""
fd, filename = tempfile.mkstemp(prefix="polyaxon_{}".format(project_name), suffix='.tar.gz')
with tarfile.open(filename, "w:gz") as tar:
for f in files:
tar.add(f)
yield filename
... | def create_tarfile(files, project_name):
"""Create a tar file based on the list of files passed"""
fd, filename = tempfile.mkstemp(prefix="polyaxon_{}".format(project_name), suffix='.tar.gz')
with tarfile.open(filename, "w:gz") as tar:
for f in files:
tar.add(f)
yield filename
... | [
"Create",
"a",
"tar",
"file",
"based",
"on",
"the",
"list",
"of",
"files",
"passed"
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/utils/files.py#L47-L58 | [
"def",
"create_tarfile",
"(",
"files",
",",
"project_name",
")",
":",
"fd",
",",
"filename",
"=",
"tempfile",
".",
"mkstemp",
"(",
"prefix",
"=",
"\"polyaxon_{}\"",
".",
"format",
"(",
"project_name",
")",
",",
"suffix",
"=",
"'.tar.gz'",
")",
"with",
"tar... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | url | Prints the tensorboard url for project/experiment/experiment group.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples for project tensorboards:
\b
```bash
$ polyaxon tensorboard url
```
\b
```bash
$ polyaxon tensorboard -p mnist url
```
Examples for experiment t... | polyaxon_cli/cli/tensorboard.py | def url(ctx):
"""Prints the tensorboard url for project/experiment/experiment group.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples for project tensorboards:
\b
```bash
$ polyaxon tensorboard url
```
\b
```bash
$ polyaxon tensorboard -p mnist url
```
Exam... | def url(ctx):
"""Prints the tensorboard url for project/experiment/experiment group.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples for project tensorboards:
\b
```bash
$ polyaxon tensorboard url
```
\b
```bash
$ polyaxon tensorboard -p mnist url
```
Exam... | [
"Prints",
"the",
"tensorboard",
"url",
"for",
"project",
"/",
"experiment",
"/",
"experiment",
"group",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/tensorboard.py#L52-L126 | [
"def",
"url",
"(",
"ctx",
")",
":",
"user",
",",
"project_name",
"=",
"get_project_or_local",
"(",
"ctx",
".",
"obj",
".",
"get",
"(",
"'project'",
")",
")",
"group",
"=",
"ctx",
".",
"obj",
".",
"get",
"(",
"'group'",
")",
"experiment",
"=",
"ctx",
... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | start | Start a tensorboard deployment for project/experiment/experiment group.
Project tensorboard will aggregate all experiments under the project.
Experiment group tensorboard will aggregate all experiments under the group.
Experiment tensorboard will show all metrics for an experiment.
Uses [Caching](/r... | polyaxon_cli/cli/tensorboard.py | def start(ctx, file): # pylint:disable=redefined-builtin
"""Start a tensorboard deployment for project/experiment/experiment group.
Project tensorboard will aggregate all experiments under the project.
Experiment group tensorboard will aggregate all experiments under the group.
Experiment tensorboar... | def start(ctx, file): # pylint:disable=redefined-builtin
"""Start a tensorboard deployment for project/experiment/experiment group.
Project tensorboard will aggregate all experiments under the project.
Experiment group tensorboard will aggregate all experiments under the group.
Experiment tensorboar... | [
"Start",
"a",
"tensorboard",
"deployment",
"for",
"project",
"/",
"experiment",
"/",
"experiment",
"group",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/tensorboard.py#L134-L238 | [
"def",
"start",
"(",
"ctx",
",",
"file",
")",
":",
"# pylint:disable=redefined-builtin",
"specification",
"=",
"None",
"job_config",
"=",
"None",
"if",
"file",
":",
"specification",
"=",
"check_polyaxonfile",
"(",
"file",
",",
"log",
"=",
"False",
")",
".",
... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | stop | Stops the tensorboard deployment for project/experiment/experiment group if it exists.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples: stopping project tensorboard
\b
```bash
$ polyaxon tensorboard stop
```
Examples: stopping experiment group tensorboard
\b
```bash
... | polyaxon_cli/cli/tensorboard.py | def stop(ctx, yes):
"""Stops the tensorboard deployment for project/experiment/experiment group if it exists.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples: stopping project tensorboard
\b
```bash
$ polyaxon tensorboard stop
```
Examples: stopping experiment group tensor... | def stop(ctx, yes):
"""Stops the tensorboard deployment for project/experiment/experiment group if it exists.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples: stopping project tensorboard
\b
```bash
$ polyaxon tensorboard stop
```
Examples: stopping experiment group tensor... | [
"Stops",
"the",
"tensorboard",
"deployment",
"for",
"project",
"/",
"experiment",
"/",
"experiment",
"group",
"if",
"it",
"exists",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/tensorboard.py#L247-L320 | [
"def",
"stop",
"(",
"ctx",
",",
"yes",
")",
":",
"user",
",",
"project_name",
"=",
"get_project_or_local",
"(",
"ctx",
".",
"obj",
".",
"get",
"(",
"'project'",
")",
")",
"group",
"=",
"ctx",
".",
"obj",
".",
"get",
"(",
"'group'",
")",
"experiment",... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | check_cli_version | Check if the current cli version satisfies the server requirements | polyaxon_cli/cli/version.py | def check_cli_version():
"""Check if the current cli version satisfies the server requirements"""
if not CliConfigManager.should_check():
return
server_version = get_server_version()
current_version = get_current_version()
CliConfigManager.reset(current_version=current_version,
... | def check_cli_version():
"""Check if the current cli version satisfies the server requirements"""
if not CliConfigManager.should_check():
return
server_version = get_server_version()
current_version = get_current_version()
CliConfigManager.reset(current_version=current_version,
... | [
"Check",
"if",
"the",
"current",
"cli",
"version",
"satisfies",
"the",
"server",
"requirements"
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/version.py#L75-L110 | [
"def",
"check_cli_version",
"(",
")",
":",
"if",
"not",
"CliConfigManager",
".",
"should_check",
"(",
")",
":",
"return",
"server_version",
"=",
"get_server_version",
"(",
")",
"current_version",
"=",
"get_current_version",
"(",
")",
"CliConfigManager",
".",
"rese... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | version | Print the current version of the cli and platform. | polyaxon_cli/cli/version.py | def version(cli, platform):
"""Print the current version of the cli and platform."""
version_client = PolyaxonClient().version
cli = cli or not any([cli, platform])
if cli:
try:
server_version = version_client.get_cli_version()
except AuthorizationError:
session_e... | def version(cli, platform):
"""Print the current version of the cli and platform."""
version_client = PolyaxonClient().version
cli = cli or not any([cli, platform])
if cli:
try:
server_version = version_client.get_cli_version()
except AuthorizationError:
session_e... | [
"Print",
"the",
"current",
"version",
"of",
"the",
"cli",
"and",
"platform",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/version.py#L117-L149 | [
"def",
"version",
"(",
"cli",
",",
"platform",
")",
":",
"version_client",
"=",
"PolyaxonClient",
"(",
")",
".",
"version",
"cli",
"=",
"cli",
"or",
"not",
"any",
"(",
"[",
"cli",
",",
"platform",
"]",
")",
"if",
"cli",
":",
"try",
":",
"server_versi... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | dashboard | Open dashboard in browser. | polyaxon_cli/cli/dashboard.py | def dashboard(yes, url):
"""Open dashboard in browser."""
dashboard_url = "{}/app".format(PolyaxonClient().api_config.http_host)
if url:
click.echo(dashboard_url)
sys.exit(0)
if not yes:
click.confirm('Dashboard page will now open in your browser. Continue?',
... | def dashboard(yes, url):
"""Open dashboard in browser."""
dashboard_url = "{}/app".format(PolyaxonClient().api_config.http_host)
if url:
click.echo(dashboard_url)
sys.exit(0)
if not yes:
click.confirm('Dashboard page will now open in your browser. Continue?',
... | [
"Open",
"dashboard",
"in",
"browser",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/dashboard.py#L19-L29 | [
"def",
"dashboard",
"(",
"yes",
",",
"url",
")",
":",
"dashboard_url",
"=",
"\"{}/app\"",
".",
"format",
"(",
"PolyaxonClient",
"(",
")",
".",
"api_config",
".",
"http_host",
")",
"if",
"url",
":",
"click",
".",
"echo",
"(",
"dashboard_url",
")",
"sys",
... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | grant | Grant superuser role to a user.
Example:
\b
```bash
$ polyaxon superuser grant david
``` | polyaxon_cli/cli/superuser.py | def grant(username):
"""Grant superuser role to a user.
Example:
\b
```bash
$ polyaxon superuser grant david
```
"""
try:
PolyaxonClient().user.grant_superuser(username)
except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:
Printer.print... | def grant(username):
"""Grant superuser role to a user.
Example:
\b
```bash
$ polyaxon superuser grant david
```
"""
try:
PolyaxonClient().user.grant_superuser(username)
except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:
Printer.print... | [
"Grant",
"superuser",
"role",
"to",
"a",
"user",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/superuser.py#L24-L42 | [
"def",
"grant",
"(",
"username",
")",
":",
"try",
":",
"PolyaxonClient",
"(",
")",
".",
"user",
".",
"grant_superuser",
"(",
"username",
")",
"except",
"(",
"PolyaxonHTTPError",
",",
"PolyaxonShouldExitError",
",",
"PolyaxonClientException",
")",
"as",
"e",
":... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | revoke | Revoke superuser role to a user.
Example:
\b
```bash
$ polyaxon superuser revoke david
``` | polyaxon_cli/cli/superuser.py | def revoke(username):
"""Revoke superuser role to a user.
Example:
\b
```bash
$ polyaxon superuser revoke david
```
"""
try:
PolyaxonClient().user.revoke_superuser(username)
except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:
Printer.p... | def revoke(username):
"""Revoke superuser role to a user.
Example:
\b
```bash
$ polyaxon superuser revoke david
```
"""
try:
PolyaxonClient().user.revoke_superuser(username)
except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:
Printer.p... | [
"Revoke",
"superuser",
"role",
"to",
"a",
"user",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/superuser.py#L48-L66 | [
"def",
"revoke",
"(",
"username",
")",
":",
"try",
":",
"PolyaxonClient",
"(",
")",
".",
"user",
".",
"revoke_superuser",
"(",
"username",
")",
"except",
"(",
"PolyaxonHTTPError",
",",
"PolyaxonShouldExitError",
",",
"PolyaxonClientException",
")",
"as",
"e",
... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | url | Prints the notebook url for this project.
Uses [Caching](/references/polyaxon-cli/#caching)
Example:
\b
```bash
$ polyaxon notebook url
``` | polyaxon_cli/cli/notebook.py | def url(ctx):
"""Prints the notebook url for this project.
Uses [Caching](/references/polyaxon-cli/#caching)
Example:
\b
```bash
$ polyaxon notebook url
```
"""
user, project_name = get_project_or_local(ctx.obj.get('project'))
try:
response = PolyaxonClient().project.g... | def url(ctx):
"""Prints the notebook url for this project.
Uses [Caching](/references/polyaxon-cli/#caching)
Example:
\b
```bash
$ polyaxon notebook url
```
"""
user, project_name = get_project_or_local(ctx.obj.get('project'))
try:
response = PolyaxonClient().project.g... | [
"Prints",
"the",
"notebook",
"url",
"for",
"this",
"project",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/notebook.py#L35-L60 | [
"def",
"url",
"(",
"ctx",
")",
":",
"user",
",",
"project_name",
"=",
"get_project_or_local",
"(",
"ctx",
".",
"obj",
".",
"get",
"(",
"'project'",
")",
")",
"try",
":",
"response",
"=",
"PolyaxonClient",
"(",
")",
".",
"project",
".",
"get_project",
"... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | start | Start a notebook deployment for this project.
Uses [Caching](/references/polyaxon-cli/#caching)
Example:
\b
```bash
$ polyaxon notebook start -f file -f file_override ...
```
Example: upload before running
\b
```bash
$ polyaxon -p user12/mnist notebook start -f file -u
`... | polyaxon_cli/cli/notebook.py | def start(ctx, file, u): # pylint:disable=redefined-builtin
"""Start a notebook deployment for this project.
Uses [Caching](/references/polyaxon-cli/#caching)
Example:
\b
```bash
$ polyaxon notebook start -f file -f file_override ...
```
Example: upload before running
\b
``... | def start(ctx, file, u): # pylint:disable=redefined-builtin
"""Start a notebook deployment for this project.
Uses [Caching](/references/polyaxon-cli/#caching)
Example:
\b
```bash
$ polyaxon notebook start -f file -f file_override ...
```
Example: upload before running
\b
``... | [
"Start",
"a",
"notebook",
"deployment",
"for",
"this",
"project",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/notebook.py#L70-L123 | [
"def",
"start",
"(",
"ctx",
",",
"file",
",",
"u",
")",
":",
"# pylint:disable=redefined-builtin",
"specification",
"=",
"None",
"job_config",
"=",
"None",
"if",
"file",
":",
"specification",
"=",
"check_polyaxonfile",
"(",
"file",
",",
"log",
"=",
"False",
... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | stop | Stops the notebook deployment for this project if it exists.
Uses [Caching](/references/polyaxon-cli/#caching) | polyaxon_cli/cli/notebook.py | def stop(ctx, commit, yes):
"""Stops the notebook deployment for this project if it exists.
Uses [Caching](/references/polyaxon-cli/#caching)
"""
user, project_name = get_project_or_local(ctx.obj.get('project'))
if not yes and not click.confirm("Are sure you want to stop notebook "
... | def stop(ctx, commit, yes):
"""Stops the notebook deployment for this project if it exists.
Uses [Caching](/references/polyaxon-cli/#caching)
"""
user, project_name = get_project_or_local(ctx.obj.get('project'))
if not yes and not click.confirm("Are sure you want to stop notebook "
... | [
"Stops",
"the",
"notebook",
"deployment",
"for",
"this",
"project",
"if",
"it",
"exists",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/notebook.py#L134-L155 | [
"def",
"stop",
"(",
"ctx",
",",
"commit",
",",
"yes",
")",
":",
"user",
",",
"project_name",
"=",
"get_project_or_local",
"(",
"ctx",
".",
"obj",
".",
"get",
"(",
"'project'",
")",
")",
"if",
"not",
"yes",
"and",
"not",
"click",
".",
"confirm",
"(",
... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | cli | Polyaxon CLI tool to:
* Parse, Validate, and Check Polyaxonfiles.
* Interact with Polyaxon server.
* Run and Monitor experiments.
Check the help available for each command listed below. | polyaxon_cli/main.py | def cli(context, verbose):
""" Polyaxon CLI tool to:
* Parse, Validate, and Check Polyaxonfiles.
* Interact with Polyaxon server.
* Run and Monitor experiments.
Check the help available for each command listed below.
"""
configure_logger(verbose or GlobalConfigManager.get_val... | def cli(context, verbose):
""" Polyaxon CLI tool to:
* Parse, Validate, and Check Polyaxonfiles.
* Interact with Polyaxon server.
* Run and Monitor experiments.
Check the help available for each command listed below.
"""
configure_logger(verbose or GlobalConfigManager.get_val... | [
"Polyaxon",
"CLI",
"tool",
"to",
":"
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/main.py#L35-L49 | [
"def",
"cli",
"(",
"context",
",",
"verbose",
")",
":",
"configure_logger",
"(",
"verbose",
"or",
"GlobalConfigManager",
".",
"get_value",
"(",
"'verbose'",
")",
")",
"non_check_cmds",
"=",
"[",
"'config'",
",",
"'version'",
",",
"'login'",
",",
"'logout'",
... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | DeployManager.check | Add platform specific checks | polyaxon_cli/managers/deploy.py | def check(self):
"""Add platform specific checks"""
if not self.is_valid:
raise PolyaxonDeploymentConfigError(
'Deployment type `{}` not supported'.format(self.deployment_type))
check = False
if self.is_kubernetes:
check = self.check_for_kubernetes... | def check(self):
"""Add platform specific checks"""
if not self.is_valid:
raise PolyaxonDeploymentConfigError(
'Deployment type `{}` not supported'.format(self.deployment_type))
check = False
if self.is_kubernetes:
check = self.check_for_kubernetes... | [
"Add",
"platform",
"specific",
"checks"
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/managers/deploy.py#L119-L135 | [
"def",
"check",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_valid",
":",
"raise",
"PolyaxonDeploymentConfigError",
"(",
"'Deployment type `{}` not supported'",
".",
"format",
"(",
"self",
".",
"deployment_type",
")",
")",
"check",
"=",
"False",
"if",
... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | DeployManager.install | Install polyaxon using the current config to the correct platform. | polyaxon_cli/managers/deploy.py | def install(self):
"""Install polyaxon using the current config to the correct platform."""
if not self.is_valid:
raise PolyaxonDeploymentConfigError(
'Deployment type `{}` not supported'.format(self.deployment_type))
if self.is_kubernetes:
self.install_o... | def install(self):
"""Install polyaxon using the current config to the correct platform."""
if not self.is_valid:
raise PolyaxonDeploymentConfigError(
'Deployment type `{}` not supported'.format(self.deployment_type))
if self.is_kubernetes:
self.install_o... | [
"Install",
"polyaxon",
"using",
"the",
"current",
"config",
"to",
"the",
"correct",
"platform",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/managers/deploy.py#L194-L207 | [
"def",
"install",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_valid",
":",
"raise",
"PolyaxonDeploymentConfigError",
"(",
"'Deployment type `{}` not supported'",
".",
"format",
"(",
"self",
".",
"deployment_type",
")",
")",
"if",
"self",
".",
"is_kubern... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | DeployManager.upgrade | Upgrade deployment. | polyaxon_cli/managers/deploy.py | def upgrade(self):
"""Upgrade deployment."""
if not self.is_valid:
raise PolyaxonDeploymentConfigError(
'Deployment type `{}` not supported'.format(self.deployment_type))
if self.is_kubernetes:
self.upgrade_on_kubernetes()
elif self.is_docker_comp... | def upgrade(self):
"""Upgrade deployment."""
if not self.is_valid:
raise PolyaxonDeploymentConfigError(
'Deployment type `{}` not supported'.format(self.deployment_type))
if self.is_kubernetes:
self.upgrade_on_kubernetes()
elif self.is_docker_comp... | [
"Upgrade",
"deployment",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/managers/deploy.py#L235-L248 | [
"def",
"upgrade",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_valid",
":",
"raise",
"PolyaxonDeploymentConfigError",
"(",
"'Deployment type `{}` not supported'",
".",
"format",
"(",
"self",
".",
"deployment_type",
")",
")",
"if",
"self",
".",
"is_kubern... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | DeployManager.teardown | Teardown Polyaxon. | polyaxon_cli/managers/deploy.py | def teardown(self, hooks=True):
"""Teardown Polyaxon."""
if not self.is_valid:
raise PolyaxonDeploymentConfigError(
'Deployment type `{}` not supported'.format(self.deployment_type))
if self.is_kubernetes:
self.teardown_on_kubernetes(hooks=hooks)
... | def teardown(self, hooks=True):
"""Teardown Polyaxon."""
if not self.is_valid:
raise PolyaxonDeploymentConfigError(
'Deployment type `{}` not supported'.format(self.deployment_type))
if self.is_kubernetes:
self.teardown_on_kubernetes(hooks=hooks)
... | [
"Teardown",
"Polyaxon",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/managers/deploy.py#L269-L282 | [
"def",
"teardown",
"(",
"self",
",",
"hooks",
"=",
"True",
")",
":",
"if",
"not",
"self",
".",
"is_valid",
":",
"raise",
"PolyaxonDeploymentConfigError",
"(",
"'Deployment type `{}` not supported'",
".",
"format",
"(",
"self",
".",
"deployment_type",
")",
")",
... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | project | Commands for projects. | polyaxon_cli/cli/project.py | def project(ctx, project): # pylint:disable=redefined-outer-name
"""Commands for projects."""
if ctx.invoked_subcommand not in ['create', 'list']:
ctx.obj = ctx.obj or {}
ctx.obj['project'] = project | def project(ctx, project): # pylint:disable=redefined-outer-name
"""Commands for projects."""
if ctx.invoked_subcommand not in ['create', 'list']:
ctx.obj = ctx.obj or {}
ctx.obj['project'] = project | [
"Commands",
"for",
"projects",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/project.py#L47-L51 | [
"def",
"project",
"(",
"ctx",
",",
"project",
")",
":",
"# pylint:disable=redefined-outer-name",
"if",
"ctx",
".",
"invoked_subcommand",
"not",
"in",
"[",
"'create'",
",",
"'list'",
"]",
":",
"ctx",
".",
"obj",
"=",
"ctx",
".",
"obj",
"or",
"{",
"}",
"ct... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | create | Create a new project.
Uses [Caching](/references/polyaxon-cli/#caching)
Example:
\b
```bash
$ polyaxon project create --name=cats-vs-dogs --description="Image Classification with DL"
``` | polyaxon_cli/cli/project.py | def create(ctx, name, description, tags, private, init):
"""Create a new project.
Uses [Caching](/references/polyaxon-cli/#caching)
Example:
\b
```bash
$ polyaxon project create --name=cats-vs-dogs --description="Image Classification with DL"
```
"""
try:
tags = tags.split... | def create(ctx, name, description, tags, private, init):
"""Create a new project.
Uses [Caching](/references/polyaxon-cli/#caching)
Example:
\b
```bash
$ polyaxon project create --name=cats-vs-dogs --description="Image Classification with DL"
```
"""
try:
tags = tags.split... | [
"Create",
"a",
"new",
"project",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/project.py#L63-L94 | [
"def",
"create",
"(",
"ctx",
",",
"name",
",",
"description",
",",
"tags",
",",
"private",
",",
"init",
")",
":",
"try",
":",
"tags",
"=",
"tags",
".",
"split",
"(",
"','",
")",
"if",
"tags",
"else",
"None",
"project_dict",
"=",
"dict",
"(",
"name"... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | list | List projects.
Uses [Caching](/references/polyaxon-cli/#caching) | polyaxon_cli/cli/project.py | def list(page): # pylint:disable=redefined-builtin
"""List projects.
Uses [Caching](/references/polyaxon-cli/#caching)
"""
user = AuthConfigManager.get_value('username')
if not user:
Printer.print_error('Please login first. `polyaxon login --help`')
page = page or 1
try:
r... | def list(page): # pylint:disable=redefined-builtin
"""List projects.
Uses [Caching](/references/polyaxon-cli/#caching)
"""
user = AuthConfigManager.get_value('username')
if not user:
Printer.print_error('Please login first. `polyaxon login --help`')
page = page or 1
try:
r... | [
"List",
"projects",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/project.py#L100-L134 | [
"def",
"list",
"(",
"page",
")",
":",
"# pylint:disable=redefined-builtin",
"user",
"=",
"AuthConfigManager",
".",
"get_value",
"(",
"'username'",
")",
"if",
"not",
"user",
":",
"Printer",
".",
"print_error",
"(",
"'Please login first. `polyaxon login --help`'",
")",
... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | get | Get info for current project, by project_name, or user/project_name.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
To get current project:
\b
```bash
$ polyaxon project get
```
To get a project by name
\b
```bash
$ polyaxon project get user/project
``` | polyaxon_cli/cli/project.py | def get(ctx):
"""Get info for current project, by project_name, or user/project_name.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
To get current project:
\b
```bash
$ polyaxon project get
```
To get a project by name
\b
```bash
$ polyaxon project get... | def get(ctx):
"""Get info for current project, by project_name, or user/project_name.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
To get current project:
\b
```bash
$ polyaxon project get
```
To get a project by name
\b
```bash
$ polyaxon project get... | [
"Get",
"info",
"for",
"current",
"project",
"by",
"project_name",
"or",
"user",
"/",
"project_name",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/project.py#L140-L170 | [
"def",
"get",
"(",
"ctx",
")",
":",
"user",
",",
"project_name",
"=",
"get_project_or_local",
"(",
"ctx",
".",
"obj",
".",
"get",
"(",
"'project'",
")",
")",
"try",
":",
"response",
"=",
"PolyaxonClient",
"(",
")",
".",
"project",
".",
"get_project",
"... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | delete | Delete project.
Uses [Caching](/references/polyaxon-cli/#caching) | polyaxon_cli/cli/project.py | def delete(ctx):
"""Delete project.
Uses [Caching](/references/polyaxon-cli/#caching)
"""
user, project_name = get_project_or_local(ctx.obj.get('project'))
if not click.confirm("Are sure you want to delete project `{}/{}`".format(user, project_name)):
click.echo('Existing without deleting ... | def delete(ctx):
"""Delete project.
Uses [Caching](/references/polyaxon-cli/#caching)
"""
user, project_name = get_project_or_local(ctx.obj.get('project'))
if not click.confirm("Are sure you want to delete project `{}/{}`".format(user, project_name)):
click.echo('Existing without deleting ... | [
"Delete",
"project",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/project.py#L176-L199 | [
"def",
"delete",
"(",
"ctx",
")",
":",
"user",
",",
"project_name",
"=",
"get_project_or_local",
"(",
"ctx",
".",
"obj",
".",
"get",
"(",
"'project'",
")",
")",
"if",
"not",
"click",
".",
"confirm",
"(",
"\"Are sure you want to delete project `{}/{}`\"",
".",
... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | update | Update project.
Uses [Caching](/references/polyaxon-cli/#caching)
Example:
\b
```bash
$ polyaxon update foobar --description="Image Classification with DL using TensorFlow"
```
\b
```bash
$ polyaxon update mike1/foobar --description="Image Classification with DL using TensorFlow"... | polyaxon_cli/cli/project.py | def update(ctx, name, description, tags, private):
"""Update project.
Uses [Caching](/references/polyaxon-cli/#caching)
Example:
\b
```bash
$ polyaxon update foobar --description="Image Classification with DL using TensorFlow"
```
\b
```bash
$ polyaxon update mike1/foobar --d... | def update(ctx, name, description, tags, private):
"""Update project.
Uses [Caching](/references/polyaxon-cli/#caching)
Example:
\b
```bash
$ polyaxon update foobar --description="Image Classification with DL using TensorFlow"
```
\b
```bash
$ polyaxon update mike1/foobar --d... | [
"Update",
"project",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/project.py#L210-L260 | [
"def",
"update",
"(",
"ctx",
",",
"name",
",",
"description",
",",
"tags",
",",
"private",
")",
":",
"user",
",",
"project_name",
"=",
"get_project_or_local",
"(",
"ctx",
".",
"obj",
".",
"get",
"(",
"'project'",
")",
")",
"update_dict",
"=",
"{",
"}",... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | groups | List experiment groups for this project.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
Get all groups:
\b
```bash
$ polyaxon project groups
```
Get all groups with with status {created or running}, and
creation date between 2018-01-01 and 2018-01-02,
and search... | polyaxon_cli/cli/project.py | def groups(ctx, query, sort, page):
"""List experiment groups for this project.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
Get all groups:
\b
```bash
$ polyaxon project groups
```
Get all groups with with status {created or running}, and
creation date betwee... | def groups(ctx, query, sort, page):
"""List experiment groups for this project.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
Get all groups:
\b
```bash
$ polyaxon project groups
```
Get all groups with with status {created or running}, and
creation date betwee... | [
"List",
"experiment",
"groups",
"for",
"this",
"project",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/project.py#L270-L332 | [
"def",
"groups",
"(",
"ctx",
",",
"query",
",",
"sort",
",",
"page",
")",
":",
"user",
",",
"project_name",
"=",
"get_project_or_local",
"(",
"ctx",
".",
"obj",
".",
"get",
"(",
"'project'",
")",
")",
"page",
"=",
"page",
"or",
"1",
"try",
":",
"re... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | experiments | List experiments for this project.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
Get all experiments:
\b
```bash
$ polyaxon project experiments
```
Get all experiments with with status {created or running}, and
creation date between 2018-01-01 and 2018-01-02, and d... | polyaxon_cli/cli/project.py | def experiments(ctx, metrics, declarations, independent, group, query, sort, page):
"""List experiments for this project.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
Get all experiments:
\b
```bash
$ polyaxon project experiments
```
Get all experiments with with ... | def experiments(ctx, metrics, declarations, independent, group, query, sort, page):
"""List experiments for this project.
Uses [Caching](/references/polyaxon-cli/#caching)
Examples:
Get all experiments:
\b
```bash
$ polyaxon project experiments
```
Get all experiments with with ... | [
"List",
"experiments",
"for",
"this",
"project",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/project.py#L422-L491 | [
"def",
"experiments",
"(",
"ctx",
",",
"metrics",
",",
"declarations",
",",
"independent",
",",
"group",
",",
"query",
",",
"sort",
",",
"page",
")",
":",
"user",
",",
"project_name",
"=",
"get_project_or_local",
"(",
"ctx",
".",
"obj",
".",
"get",
"(",
... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | git | Set/Sync git repo on this project.
Uses [Caching](/references/polyaxon-cli/#caching)
Example:
\b
```bash
$ polyaxon project git --url=https://github.com/polyaxon/polyaxon-quick-start
```
\b
```bash
$ polyaxon project git --url=https://github.com/polyaxon/polyaxon-quick-start --pr... | polyaxon_cli/cli/project.py | def git(ctx, url, private, sync): # pylint:disable=assign-to-new-keyword
"""Set/Sync git repo on this project.
Uses [Caching](/references/polyaxon-cli/#caching)
Example:
\b
```bash
$ polyaxon project git --url=https://github.com/polyaxon/polyaxon-quick-start
```
\b
```bash
$... | def git(ctx, url, private, sync): # pylint:disable=assign-to-new-keyword
"""Set/Sync git repo on this project.
Uses [Caching](/references/polyaxon-cli/#caching)
Example:
\b
```bash
$ polyaxon project git --url=https://github.com/polyaxon/polyaxon-quick-start
```
\b
```bash
$... | [
"Set",
"/",
"Sync",
"git",
"repo",
"on",
"this",
"project",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/project.py#L618-L668 | [
"def",
"git",
"(",
"ctx",
",",
"url",
",",
"private",
",",
"sync",
")",
":",
"# pylint:disable=assign-to-new-keyword",
"user",
",",
"project_name",
"=",
"get_project_or_local",
"(",
"ctx",
".",
"obj",
".",
"get",
"(",
"'project'",
")",
")",
"def",
"git_set_u... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | ci | Enable/Disable CI on this project.
Uses [Caching](/references/polyaxon-cli/#caching)
Example:
\b
```bash
$ polyaxon project ci --enable
```
\b
```bash
$ polyaxon project ci --disable
``` | polyaxon_cli/cli/project.py | def ci(ctx, enable, disable): # pylint:disable=assign-to-new-keyword
"""Enable/Disable CI on this project.
Uses [Caching](/references/polyaxon-cli/#caching)
Example:
\b
```bash
$ polyaxon project ci --enable
```
\b
```bash
$ polyaxon project ci --disable
```
"""
... | def ci(ctx, enable, disable): # pylint:disable=assign-to-new-keyword
"""Enable/Disable CI on this project.
Uses [Caching](/references/polyaxon-cli/#caching)
Example:
\b
```bash
$ polyaxon project ci --enable
```
\b
```bash
$ polyaxon project ci --disable
```
"""
... | [
"Enable",
"/",
"Disable",
"CI",
"on",
"this",
"project",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/project.py#L676-L720 | [
"def",
"ci",
"(",
"ctx",
",",
"enable",
",",
"disable",
")",
":",
"# pylint:disable=assign-to-new-keyword",
"user",
",",
"project_name",
"=",
"get_project_or_local",
"(",
"ctx",
".",
"obj",
".",
"get",
"(",
"'project'",
")",
")",
"def",
"enable_ci",
"(",
")"... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | download | Download code of the current project. | polyaxon_cli/cli/project.py | def download(ctx):
"""Download code of the current project."""
user, project_name = get_project_or_local(ctx.obj.get('project'))
try:
PolyaxonClient().project.download_repo(user, project_name)
except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:
Printer.prin... | def download(ctx):
"""Download code of the current project."""
user, project_name = get_project_or_local(ctx.obj.get('project'))
try:
PolyaxonClient().project.download_repo(user, project_name)
except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:
Printer.prin... | [
"Download",
"code",
"of",
"the",
"current",
"project",
"."
] | polyaxon/polyaxon-cli | python | https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/project.py#L726-L735 | [
"def",
"download",
"(",
"ctx",
")",
":",
"user",
",",
"project_name",
"=",
"get_project_or_local",
"(",
"ctx",
".",
"obj",
".",
"get",
"(",
"'project'",
")",
")",
"try",
":",
"PolyaxonClient",
"(",
")",
".",
"project",
".",
"download_repo",
"(",
"user",
... | a7f5eed74d4d909cad79059f3c21c58606881449 |
valid | DXclass.write | write the 'object' line; additional args are packed in string | gridData/OpenDX.py | def write(self,file,optstring="",quote=False):
"""write the 'object' line; additional args are packed in string"""
classid = str(self.id)
if quote: classid = '"'+classid+'"'
# Only use a *single* space between tokens; both chimera's and pymol's DX parser
# does not properly imple... | def write(self,file,optstring="",quote=False):
"""write the 'object' line; additional args are packed in string"""
classid = str(self.id)
if quote: classid = '"'+classid+'"'
# Only use a *single* space between tokens; both chimera's and pymol's DX parser
# does not properly imple... | [
"write",
"the",
"object",
"line",
";",
"additional",
"args",
"are",
"packed",
"in",
"string"
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/OpenDX.py#L180-L188 | [
"def",
"write",
"(",
"self",
",",
"file",
",",
"optstring",
"=",
"\"\"",
",",
"quote",
"=",
"False",
")",
":",
"classid",
"=",
"str",
"(",
"self",
".",
"id",
")",
"if",
"quote",
":",
"classid",
"=",
"'\"'",
"+",
"classid",
"+",
"'\"'",
"# Only use ... | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
valid | gridpositions.edges | Edges of the grid cells, origin at centre of 0,0,..,0 grid cell.
Only works for regular, orthonormal grids. | gridData/OpenDX.py | def edges(self):
"""Edges of the grid cells, origin at centre of 0,0,..,0 grid cell.
Only works for regular, orthonormal grids.
"""
return [self.delta[d,d] * numpy.arange(self.shape[d]+1) + self.origin[d]\
- 0.5*self.delta[d,d] for d in range(self.rank)] | def edges(self):
"""Edges of the grid cells, origin at centre of 0,0,..,0 grid cell.
Only works for regular, orthonormal grids.
"""
return [self.delta[d,d] * numpy.arange(self.shape[d]+1) + self.origin[d]\
- 0.5*self.delta[d,d] for d in range(self.rank)] | [
"Edges",
"of",
"the",
"grid",
"cells",
"origin",
"at",
"centre",
"of",
"0",
"0",
"..",
"0",
"grid",
"cell",
"."
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/OpenDX.py#L236-L242 | [
"def",
"edges",
"(",
"self",
")",
":",
"return",
"[",
"self",
".",
"delta",
"[",
"d",
",",
"d",
"]",
"*",
"numpy",
".",
"arange",
"(",
"self",
".",
"shape",
"[",
"d",
"]",
"+",
"1",
")",
"+",
"self",
".",
"origin",
"[",
"d",
"]",
"-",
"0.5"... | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
valid | array.write | Write the *class array* section.
Parameters
----------
file : file
Raises
------
ValueError
If the `dxtype` is not a valid type, :exc:`ValueError` is
raised. | gridData/OpenDX.py | def write(self, file):
"""Write the *class array* section.
Parameters
----------
file : file
Raises
------
ValueError
If the `dxtype` is not a valid type, :exc:`ValueError` is
raised.
"""
if self.type not in self.dx_typ... | def write(self, file):
"""Write the *class array* section.
Parameters
----------
file : file
Raises
------
ValueError
If the `dxtype` is not a valid type, :exc:`ValueError` is
raised.
"""
if self.type not in self.dx_typ... | [
"Write",
"the",
"*",
"class",
"array",
"*",
"section",
"."
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/OpenDX.py#L353-L393 | [
"def",
"write",
"(",
"self",
",",
"file",
")",
":",
"if",
"self",
".",
"type",
"not",
"in",
"self",
".",
"dx_types",
":",
"raise",
"ValueError",
"(",
"(",
"\"DX type {} is not supported in the DX format. \\n\"",
"\"Supported valus are: {}\\n\"",
"\"Use the type=<type>... | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
valid | field.write | Write the complete dx object to the file.
This is the simple OpenDX format which includes the data into
the header via the 'object array ... data follows' statement.
Only simple regular arrays are supported.
The format should be compatible with VMD's dx reader plugin. | gridData/OpenDX.py | def write(self, filename):
"""Write the complete dx object to the file.
This is the simple OpenDX format which includes the data into
the header via the 'object array ... data follows' statement.
Only simple regular arrays are supported.
The format should be compatible with VM... | def write(self, filename):
"""Write the complete dx object to the file.
This is the simple OpenDX format which includes the data into
the header via the 'object array ... data follows' statement.
Only simple regular arrays are supported.
The format should be compatible with VM... | [
"Write",
"the",
"complete",
"dx",
"object",
"to",
"the",
"file",
"."
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/OpenDX.py#L462-L484 | [
"def",
"write",
"(",
"self",
",",
"filename",
")",
":",
"# comments (VMD chokes on lines of len > 80, so truncate)",
"maxcol",
"=",
"80",
"with",
"open",
"(",
"filename",
",",
"'w'",
")",
"as",
"outfile",
":",
"for",
"line",
"in",
"self",
".",
"comments",
":",... | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
valid | field.read | Read DX field from file.
dx = OpenDX.field.read(dxfile)
The classid is discarded and replaced with the one from the file. | gridData/OpenDX.py | def read(self,file):
"""Read DX field from file.
dx = OpenDX.field.read(dxfile)
The classid is discarded and replaced with the one from the file.
"""
DXfield = self
p = DXParser(file)
p.parse(DXfield) | def read(self,file):
"""Read DX field from file.
dx = OpenDX.field.read(dxfile)
The classid is discarded and replaced with the one from the file.
"""
DXfield = self
p = DXParser(file)
p.parse(DXfield) | [
"Read",
"DX",
"field",
"from",
"file",
"."
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/OpenDX.py#L486-L495 | [
"def",
"read",
"(",
"self",
",",
"file",
")",
":",
"DXfield",
"=",
"self",
"p",
"=",
"DXParser",
"(",
"file",
")",
"p",
".",
"parse",
"(",
"DXfield",
")"
] | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
valid | field.sorted_components | iterator that returns (component,object) in id order | gridData/OpenDX.py | def sorted_components(self):
"""iterator that returns (component,object) in id order"""
for component, object in \
sorted(self.components.items(),
key=lambda comp_obj: comp_obj[1].id):
yield component, object | def sorted_components(self):
"""iterator that returns (component,object) in id order"""
for component, object in \
sorted(self.components.items(),
key=lambda comp_obj: comp_obj[1].id):
yield component, object | [
"iterator",
"that",
"returns",
"(",
"component",
"object",
")",
"in",
"id",
"order"
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/OpenDX.py#L505-L510 | [
"def",
"sorted_components",
"(",
"self",
")",
":",
"for",
"component",
",",
"object",
"in",
"sorted",
"(",
"self",
".",
"components",
".",
"items",
"(",
")",
",",
"key",
"=",
"lambda",
"comp_obj",
":",
"comp_obj",
"[",
"1",
"]",
".",
"id",
")",
":",
... | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
valid | field.histogramdd | Return array data as (edges,grid), i.e. a numpy nD histogram. | gridData/OpenDX.py | def histogramdd(self):
"""Return array data as (edges,grid), i.e. a numpy nD histogram."""
shape = self.components['positions'].shape
edges = self.components['positions'].edges()
hist = self.components['data'].array.reshape(shape)
return (hist,edges) | def histogramdd(self):
"""Return array data as (edges,grid), i.e. a numpy nD histogram."""
shape = self.components['positions'].shape
edges = self.components['positions'].edges()
hist = self.components['data'].array.reshape(shape)
return (hist,edges) | [
"Return",
"array",
"data",
"as",
"(",
"edges",
"grid",
")",
"i",
".",
"e",
".",
"a",
"numpy",
"nD",
"histogram",
"."
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/OpenDX.py#L512-L517 | [
"def",
"histogramdd",
"(",
"self",
")",
":",
"shape",
"=",
"self",
".",
"components",
"[",
"'positions'",
"]",
".",
"shape",
"edges",
"=",
"self",
".",
"components",
"[",
"'positions'",
"]",
".",
"edges",
"(",
")",
"hist",
"=",
"self",
".",
"components... | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
valid | Token.value | Return text cast to the correct type or the selected type | gridData/OpenDX.py | def value(self,ascode=None):
"""Return text cast to the correct type or the selected type"""
if ascode is None:
ascode = self.code
return self.cast[ascode](self.text) | def value(self,ascode=None):
"""Return text cast to the correct type or the selected type"""
if ascode is None:
ascode = self.code
return self.cast[ascode](self.text) | [
"Return",
"text",
"cast",
"to",
"the",
"correct",
"type",
"or",
"the",
"selected",
"type"
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/OpenDX.py#L565-L569 | [
"def",
"value",
"(",
"self",
",",
"ascode",
"=",
"None",
")",
":",
"if",
"ascode",
"is",
"None",
":",
"ascode",
"=",
"self",
".",
"code",
"return",
"self",
".",
"cast",
"[",
"ascode",
"]",
"(",
"self",
".",
"text",
")"
] | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
valid | DXInitObject.initialize | Initialize the corresponding DXclass from the data.
class = DXInitObject.initialize() | gridData/OpenDX.py | def initialize(self):
"""Initialize the corresponding DXclass from the data.
class = DXInitObject.initialize()
"""
return self.DXclasses[self.type](self.id,**self.args) | def initialize(self):
"""Initialize the corresponding DXclass from the data.
class = DXInitObject.initialize()
"""
return self.DXclasses[self.type](self.id,**self.args) | [
"Initialize",
"the",
"corresponding",
"DXclass",
"from",
"the",
"data",
"."
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/OpenDX.py#L589-L594 | [
"def",
"initialize",
"(",
"self",
")",
":",
"return",
"self",
".",
"DXclasses",
"[",
"self",
".",
"type",
"]",
"(",
"self",
".",
"id",
",",
"*",
"*",
"self",
".",
"args",
")"
] | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
valid | DXParser.parse | Parse the dx file and construct a DX field object with component classes.
A :class:`field` instance *DXfield* must be provided to be
filled by the parser::
DXfield_object = OpenDX.field(*args)
parse(DXfield_object)
A tokenizer turns the dx file into a stream of tokens. A... | gridData/OpenDX.py | def parse(self,DXfield):
"""Parse the dx file and construct a DX field object with component classes.
A :class:`field` instance *DXfield* must be provided to be
filled by the parser::
DXfield_object = OpenDX.field(*args)
parse(DXfield_object)
A tokenizer turns th... | def parse(self,DXfield):
"""Parse the dx file and construct a DX field object with component classes.
A :class:`field` instance *DXfield* must be provided to be
filled by the parser::
DXfield_object = OpenDX.field(*args)
parse(DXfield_object)
A tokenizer turns th... | [
"Parse",
"the",
"dx",
"file",
"and",
"construct",
"a",
"DX",
"field",
"object",
"with",
"component",
"classes",
"."
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/OpenDX.py#L655-L699 | [
"def",
"parse",
"(",
"self",
",",
"DXfield",
")",
":",
"self",
".",
"DXfield",
"=",
"DXfield",
"# OpenDX.field (used by comment parser)",
"self",
".",
"currentobject",
"=",
"None",
"# containers for data",
"self",
".",
"objects",
"=",
"[",
"]",
"# |",
"self",
... | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
valid | DXParser.__general | Level-0 parser and main loop.
Look for a token that matches a level-1 parser and hand over control. | gridData/OpenDX.py | def __general(self):
"""Level-0 parser and main loop.
Look for a token that matches a level-1 parser and hand over control."""
while 1: # main loop
try:
tok = self.__peek() # only peek, apply_parser() will consume
except... | def __general(self):
"""Level-0 parser and main loop.
Look for a token that matches a level-1 parser and hand over control."""
while 1: # main loop
try:
tok = self.__peek() # only peek, apply_parser() will consume
except... | [
"Level",
"-",
"0",
"parser",
"and",
"main",
"loop",
"."
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/OpenDX.py#L703-L731 | [
"def",
"__general",
"(",
"self",
")",
":",
"while",
"1",
":",
"# main loop",
"try",
":",
"tok",
"=",
"self",
".",
"__peek",
"(",
")",
"# only peek, apply_parser() will consume",
"except",
"DXParserNoTokens",
":",
"# save previous DXInitObject",
"# (kludge in here as t... | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
valid | DXParser.__comment | Level-1 parser for comments.
pattern: #.*
Append comment (with initial '# ' stripped) to all comments. | gridData/OpenDX.py | def __comment(self):
"""Level-1 parser for comments.
pattern: #.*
Append comment (with initial '# ' stripped) to all comments.
"""
tok = self.__consume()
self.DXfield.add_comment(tok.value())
self.set_parser('general') | def __comment(self):
"""Level-1 parser for comments.
pattern: #.*
Append comment (with initial '# ' stripped) to all comments.
"""
tok = self.__consume()
self.DXfield.add_comment(tok.value())
self.set_parser('general') | [
"Level",
"-",
"1",
"parser",
"for",
"comments",
"."
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/OpenDX.py#L735-L743 | [
"def",
"__comment",
"(",
"self",
")",
":",
"tok",
"=",
"self",
".",
"__consume",
"(",
")",
"self",
".",
"DXfield",
".",
"add_comment",
"(",
"tok",
".",
"value",
"(",
")",
")",
"self",
".",
"set_parser",
"(",
"'general'",
")"
] | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
valid | DXParser.__object | Level-1 parser for objects.
pattern: 'object' id 'class' type ...
id ::= integer|string|'"'white space string'"'
type ::= string | gridData/OpenDX.py | def __object(self):
"""Level-1 parser for objects.
pattern: 'object' id 'class' type ...
id ::= integer|string|'"'white space string'"'
type ::= string
"""
self.__consume() # 'object'
classid = self.__consume().text
word = self.__con... | def __object(self):
"""Level-1 parser for objects.
pattern: 'object' id 'class' type ...
id ::= integer|string|'"'white space string'"'
type ::= string
"""
self.__consume() # 'object'
classid = self.__consume().text
word = self.__con... | [
"Level",
"-",
"1",
"parser",
"for",
"objects",
"."
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/OpenDX.py#L745-L765 | [
"def",
"__object",
"(",
"self",
")",
":",
"self",
".",
"__consume",
"(",
")",
"# 'object'",
"classid",
"=",
"self",
".",
"__consume",
"(",
")",
".",
"text",
"word",
"=",
"self",
".",
"__consume",
"(",
")",
".",
"text",
"if",
"word",
"!=",
"\"class\""... | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
valid | DXParser.__gridpositions | Level-2 parser for gridpositions.
pattern:
object 1 class gridpositions counts 97 93 99
origin -46.5 -45.5 -48.5
delta 1 0 0
delta 0 1 0
delta 0 0 1 | gridData/OpenDX.py | def __gridpositions(self):
"""Level-2 parser for gridpositions.
pattern:
object 1 class gridpositions counts 97 93 99
origin -46.5 -45.5 -48.5
delta 1 0 0
delta 0 1 0
delta 0 0 1
"""
try:
tok = self.__consume()
except DXParserN... | def __gridpositions(self):
"""Level-2 parser for gridpositions.
pattern:
object 1 class gridpositions counts 97 93 99
origin -46.5 -45.5 -48.5
delta 1 0 0
delta 0 1 0
delta 0 0 1
"""
try:
tok = self.__consume()
except DXParserN... | [
"Level",
"-",
"2",
"parser",
"for",
"gridpositions",
"."
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/OpenDX.py#L768-L824 | [
"def",
"__gridpositions",
"(",
"self",
")",
":",
"try",
":",
"tok",
"=",
"self",
".",
"__consume",
"(",
")",
"except",
"DXParserNoTokens",
":",
"return",
"if",
"tok",
".",
"equals",
"(",
"'counts'",
")",
":",
"shape",
"=",
"[",
"]",
"try",
":",
"whil... | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
valid | DXParser.__gridconnections | Level-2 parser for gridconnections.
pattern:
object 2 class gridconnections counts 97 93 99 | gridData/OpenDX.py | def __gridconnections(self):
"""Level-2 parser for gridconnections.
pattern:
object 2 class gridconnections counts 97 93 99
"""
try:
tok = self.__consume()
except DXParserNoTokens:
return
if tok.equals('counts'):
shape = []
... | def __gridconnections(self):
"""Level-2 parser for gridconnections.
pattern:
object 2 class gridconnections counts 97 93 99
"""
try:
tok = self.__consume()
except DXParserNoTokens:
return
if tok.equals('counts'):
shape = []
... | [
"Level",
"-",
"2",
"parser",
"for",
"gridconnections",
"."
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/OpenDX.py#L827-L852 | [
"def",
"__gridconnections",
"(",
"self",
")",
":",
"try",
":",
"tok",
"=",
"self",
".",
"__consume",
"(",
")",
"except",
"DXParserNoTokens",
":",
"return",
"if",
"tok",
".",
"equals",
"(",
"'counts'",
")",
":",
"shape",
"=",
"[",
"]",
"try",
":",
"wh... | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
valid | DXParser.__array | Level-2 parser for arrays.
pattern:
object 3 class array type double rank 0 items 12 data follows
0 2 0
0 0 3.6
0 -2.0 1e-12
+4.534e+01 .34534 0.43654
attribute "dep" string "positions" | gridData/OpenDX.py | def __array(self):
"""Level-2 parser for arrays.
pattern:
object 3 class array type double rank 0 items 12 data follows
0 2 0
0 0 3.6
0 -2.0 1e-12
+4.534e+01 .34534 0.43654
attribute "dep" string "positions"
"""
try:
tok = self... | def __array(self):
"""Level-2 parser for arrays.
pattern:
object 3 class array type double rank 0 items 12 data follows
0 2 0
0 0 3.6
0 -2.0 1e-12
+4.534e+01 .34534 0.43654
attribute "dep" string "positions"
"""
try:
tok = self... | [
"Level",
"-",
"2",
"parser",
"for",
"arrays",
"."
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/OpenDX.py#L855-L922 | [
"def",
"__array",
"(",
"self",
")",
":",
"try",
":",
"tok",
"=",
"self",
".",
"__consume",
"(",
")",
"except",
"DXParserNoTokens",
":",
"return",
"if",
"tok",
".",
"equals",
"(",
"'type'",
")",
":",
"tok",
"=",
"self",
".",
"__consume",
"(",
")",
"... | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
valid | DXParser.__field | Level-2 parser for a DX field object.
pattern:
object "site map 1" class field
component "positions" value 1
component "connections" value 2
component "data" value 3 | gridData/OpenDX.py | def __field(self):
"""Level-2 parser for a DX field object.
pattern:
object "site map 1" class field
component "positions" value 1
component "connections" value 2
component "data" value 3
"""
try:
tok = self.__consume()
except DXParser... | def __field(self):
"""Level-2 parser for a DX field object.
pattern:
object "site map 1" class field
component "positions" value 1
component "connections" value 2
component "data" value 3
"""
try:
tok = self.__consume()
except DXParser... | [
"Level",
"-",
"2",
"parser",
"for",
"a",
"DX",
"field",
"object",
"."
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/OpenDX.py#L924-L948 | [
"def",
"__field",
"(",
"self",
")",
":",
"try",
":",
"tok",
"=",
"self",
".",
"__consume",
"(",
")",
"except",
"DXParserNoTokens",
":",
"return",
"if",
"tok",
".",
"equals",
"(",
"'component'",
")",
":",
"component",
"=",
"self",
".",
"__consume",
"(",... | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
valid | DXParser.use_parser | Set parsername as the current parser and apply it. | gridData/OpenDX.py | def use_parser(self,parsername):
"""Set parsername as the current parser and apply it."""
self.__parser = self.parsers[parsername]
self.__parser() | def use_parser(self,parsername):
"""Set parsername as the current parser and apply it."""
self.__parser = self.parsers[parsername]
self.__parser() | [
"Set",
"parsername",
"as",
"the",
"current",
"parser",
"and",
"apply",
"it",
"."
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/OpenDX.py#L954-L957 | [
"def",
"use_parser",
"(",
"self",
",",
"parsername",
")",
":",
"self",
".",
"__parser",
"=",
"self",
".",
"parsers",
"[",
"parsername",
"]",
"self",
".",
"__parser",
"(",
")"
] | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
valid | DXParser.__tokenize | Split s into tokens and update the token buffer.
__tokenize(string)
New tokens are appended to the token buffer, discarding white
space. Based on http://effbot.org/zone/xml-scanner.htm | gridData/OpenDX.py | def __tokenize(self,string):
"""Split s into tokens and update the token buffer.
__tokenize(string)
New tokens are appended to the token buffer, discarding white
space. Based on http://effbot.org/zone/xml-scanner.htm
"""
for m in self.dx_regex.finditer(string.strip()):... | def __tokenize(self,string):
"""Split s into tokens and update the token buffer.
__tokenize(string)
New tokens are appended to the token buffer, discarding white
space. Based on http://effbot.org/zone/xml-scanner.htm
"""
for m in self.dx_regex.finditer(string.strip()):... | [
"Split",
"s",
"into",
"tokens",
"and",
"update",
"the",
"token",
"buffer",
"."
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/OpenDX.py#L965-L978 | [
"def",
"__tokenize",
"(",
"self",
",",
"string",
")",
":",
"for",
"m",
"in",
"self",
".",
"dx_regex",
".",
"finditer",
"(",
"string",
".",
"strip",
"(",
")",
")",
":",
"code",
"=",
"m",
".",
"lastgroup",
"text",
"=",
"m",
".",
"group",
"(",
"m",
... | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
valid | DXParser.__refill_tokenbuffer | Add a new tokenized line from the file to the token buffer.
__refill_tokenbuffer()
Only reads a new line if the buffer is empty. It is safe to
call it repeatedly.
At end of file, method returns empty strings and it is up to
__peek and __consume to flag the end of the stream. | gridData/OpenDX.py | def __refill_tokenbuffer(self):
"""Add a new tokenized line from the file to the token buffer.
__refill_tokenbuffer()
Only reads a new line if the buffer is empty. It is safe to
call it repeatedly.
At end of file, method returns empty strings and it is up to
__peek and... | def __refill_tokenbuffer(self):
"""Add a new tokenized line from the file to the token buffer.
__refill_tokenbuffer()
Only reads a new line if the buffer is empty. It is safe to
call it repeatedly.
At end of file, method returns empty strings and it is up to
__peek and... | [
"Add",
"a",
"new",
"tokenized",
"line",
"from",
"the",
"file",
"to",
"the",
"token",
"buffer",
"."
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/OpenDX.py#L981-L993 | [
"def",
"__refill_tokenbuffer",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"tokens",
")",
"==",
"0",
":",
"self",
".",
"__tokenize",
"(",
"self",
".",
"dxfile",
".",
"readline",
"(",
")",
")"
] | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
valid | Plt.read | Populate the instance from the plt file *filename*. | gridData/gOpenMol.py | def read(self, filename):
"""Populate the instance from the plt file *filename*."""
from struct import calcsize, unpack
if not filename is None:
self.filename = filename
with open(self.filename, 'rb') as plt:
h = self.header = self._read_header(plt)
ne... | def read(self, filename):
"""Populate the instance from the plt file *filename*."""
from struct import calcsize, unpack
if not filename is None:
self.filename = filename
with open(self.filename, 'rb') as plt:
h = self.header = self._read_header(plt)
ne... | [
"Populate",
"the",
"instance",
"from",
"the",
"plt",
"file",
"*",
"filename",
"*",
"."
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/gOpenMol.py#L208-L223 | [
"def",
"read",
"(",
"self",
",",
"filename",
")",
":",
"from",
"struct",
"import",
"calcsize",
",",
"unpack",
"if",
"not",
"filename",
"is",
"None",
":",
"self",
".",
"filename",
"=",
"filename",
"with",
"open",
"(",
"self",
".",
"filename",
",",
"'rb'... | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
valid | Plt._read_header | Read header bytes, try all possibilities for byte order/size/alignment. | gridData/gOpenMol.py | def _read_header(self, pltfile):
"""Read header bytes, try all possibilities for byte order/size/alignment."""
nheader = struct.calcsize(self._headerfmt)
names = [r.key for r in self._header_struct]
binheader = pltfile.read(nheader)
def decode_header(bsaflag='@'):
h =... | def _read_header(self, pltfile):
"""Read header bytes, try all possibilities for byte order/size/alignment."""
nheader = struct.calcsize(self._headerfmt)
names = [r.key for r in self._header_struct]
binheader = pltfile.read(nheader)
def decode_header(bsaflag='@'):
h =... | [
"Read",
"header",
"bytes",
"try",
"all",
"possibilities",
"for",
"byte",
"order",
"/",
"size",
"/",
"alignment",
"."
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/gOpenMol.py#L245-L265 | [
"def",
"_read_header",
"(",
"self",
",",
"pltfile",
")",
":",
"nheader",
"=",
"struct",
".",
"calcsize",
"(",
"self",
".",
"_headerfmt",
")",
"names",
"=",
"[",
"r",
".",
"key",
"for",
"r",
"in",
"self",
".",
"_header_struct",
"]",
"binheader",
"=",
... | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
valid | ndmeshgrid | Return a mesh grid for N dimensions.
The input are N arrays, each of which contains the values along one axis of
the coordinate system. The arrays do not have to have the same number of
entries. The function returns arrays that can be fed into numpy functions
so that they produce values for *all* point... | gridData/core.py | def ndmeshgrid(*arrs):
"""Return a mesh grid for N dimensions.
The input are N arrays, each of which contains the values along one axis of
the coordinate system. The arrays do not have to have the same number of
entries. The function returns arrays that can be fed into numpy functions
so that they ... | def ndmeshgrid(*arrs):
"""Return a mesh grid for N dimensions.
The input are N arrays, each of which contains the values along one axis of
the coordinate system. The arrays do not have to have the same number of
entries. The function returns arrays that can be fed into numpy functions
so that they ... | [
"Return",
"a",
"mesh",
"grid",
"for",
"N",
"dimensions",
"."
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/core.py#L694-L726 | [
"def",
"ndmeshgrid",
"(",
"*",
"arrs",
")",
":",
"#arrs = tuple(reversed(arrs)) <-- wrong on stackoverflow.com",
"arrs",
"=",
"tuple",
"(",
"arrs",
")",
"lens",
"=",
"list",
"(",
"map",
"(",
"len",
",",
"arrs",
")",
")",
"dim",
"=",
"len",
"(",
"arrs",
")"... | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
valid | Grid.resample | Resample data to a new grid with edges *edges*.
This method creates a new grid with the data from the current
grid resampled to a regular grid specified by *edges*. The
order of the interpolation is set by
:attr:`Grid.interpolation_spline_order`: change the value
*before* calli... | gridData/core.py | def resample(self, edges):
"""Resample data to a new grid with edges *edges*.
This method creates a new grid with the data from the current
grid resampled to a regular grid specified by *edges*. The
order of the interpolation is set by
:attr:`Grid.interpolation_spline_order`: c... | def resample(self, edges):
"""Resample data to a new grid with edges *edges*.
This method creates a new grid with the data from the current
grid resampled to a regular grid specified by *edges*. The
order of the interpolation is set by
:attr:`Grid.interpolation_spline_order`: c... | [
"Resample",
"data",
"to",
"a",
"new",
"grid",
"with",
"edges",
"*",
"edges",
"*",
"."
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/core.py#L189-L235 | [
"def",
"resample",
"(",
"self",
",",
"edges",
")",
":",
"try",
":",
"edges",
"=",
"edges",
".",
"edges",
"# can also supply another Grid",
"except",
"AttributeError",
":",
"pass",
"midpoints",
"=",
"self",
".",
"_midpoints",
"(",
"edges",
")",
"coordinates",
... | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
valid | Grid.resample_factor | Resample to a new regular grid.
Parameters
----------
factor : float
The number of grid cells are scaled with `factor` in each
dimension, i.e., ``factor * N_i`` cells along each
dimension i.
Returns
-------
Grid
See Also
... | gridData/core.py | def resample_factor(self, factor):
"""Resample to a new regular grid.
Parameters
----------
factor : float
The number of grid cells are scaled with `factor` in each
dimension, i.e., ``factor * N_i`` cells along each
dimension i.
Returns
... | def resample_factor(self, factor):
"""Resample to a new regular grid.
Parameters
----------
factor : float
The number of grid cells are scaled with `factor` in each
dimension, i.e., ``factor * N_i`` cells along each
dimension i.
Returns
... | [
"Resample",
"to",
"a",
"new",
"regular",
"grid",
"."
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/core.py#L237-L264 | [
"def",
"resample_factor",
"(",
"self",
",",
"factor",
")",
":",
"# new number of edges N' = (N-1)*f + 1",
"newlengths",
"=",
"[",
"(",
"N",
"-",
"1",
")",
"*",
"float",
"(",
"factor",
")",
"+",
"1",
"for",
"N",
"in",
"self",
".",
"_len_edges",
"(",
")",
... | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
valid | Grid._update | compute/update all derived data
Can be called without harm and is idem-potent.
Updates these attributes and methods:
:attr:`origin`
the center of the cell with index 0,0,0
:attr:`midpoints`
centre coordinate of each grid cell
:meth:`interpol... | gridData/core.py | def _update(self):
"""compute/update all derived data
Can be called without harm and is idem-potent.
Updates these attributes and methods:
:attr:`origin`
the center of the cell with index 0,0,0
:attr:`midpoints`
centre coordinate of each grid c... | def _update(self):
"""compute/update all derived data
Can be called without harm and is idem-potent.
Updates these attributes and methods:
:attr:`origin`
the center of the cell with index 0,0,0
:attr:`midpoints`
centre coordinate of each grid c... | [
"compute",
"/",
"update",
"all",
"derived",
"data"
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/core.py#L266-L286 | [
"def",
"_update",
"(",
"self",
")",
":",
"self",
".",
"delta",
"=",
"numpy",
".",
"array",
"(",
"list",
"(",
"map",
"(",
"lambda",
"e",
":",
"(",
"e",
"[",
"-",
"1",
"]",
"-",
"e",
"[",
"0",
"]",
")",
"/",
"(",
"len",
"(",
"e",
")",
"-",
... | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
valid | Grid.interpolated | B-spline function over the data grid(x,y,z).
The :func:`interpolated` function allows one to obtain data
values for any values of the coordinates::
interpolated([x1,x2,...],[y1,y2,...],[z1,z2,...]) -> F[x1,y1,z1],F[x2,y2,z2],...
The interpolation order is set in
:attr:`Grid... | gridData/core.py | def interpolated(self):
"""B-spline function over the data grid(x,y,z).
The :func:`interpolated` function allows one to obtain data
values for any values of the coordinates::
interpolated([x1,x2,...],[y1,y2,...],[z1,z2,...]) -> F[x1,y1,z1],F[x2,y2,z2],...
The interpolation ... | def interpolated(self):
"""B-spline function over the data grid(x,y,z).
The :func:`interpolated` function allows one to obtain data
values for any values of the coordinates::
interpolated([x1,x2,...],[y1,y2,...],[z1,z2,...]) -> F[x1,y1,z1],F[x2,y2,z2],...
The interpolation ... | [
"B",
"-",
"spline",
"function",
"over",
"the",
"data",
"grid",
"(",
"x",
"y",
"z",
")",
"."
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/core.py#L289-L325 | [
"def",
"interpolated",
"(",
"self",
")",
":",
"if",
"self",
".",
"__interpolated",
"is",
"None",
":",
"self",
".",
"__interpolated",
"=",
"self",
".",
"_interpolationFunctionFactory",
"(",
")",
"return",
"self",
".",
"__interpolated"
] | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
valid | Grid.load | Load saved (pickled or dx) grid and edges from <filename>.pickle
Grid.load(<filename>.pickle)
Grid.load(<filename>.dx)
The load() method calls the class's constructor method and
completely resets all values, based on the loaded data. | gridData/core.py | def load(self, filename, file_format=None):
"""Load saved (pickled or dx) grid and edges from <filename>.pickle
Grid.load(<filename>.pickle)
Grid.load(<filename>.dx)
The load() method calls the class's constructor method and
completely resets all values, based on the load... | def load(self, filename, file_format=None):
"""Load saved (pickled or dx) grid and edges from <filename>.pickle
Grid.load(<filename>.pickle)
Grid.load(<filename>.dx)
The load() method calls the class's constructor method and
completely resets all values, based on the load... | [
"Load",
"saved",
"(",
"pickled",
"or",
"dx",
")",
"grid",
"and",
"edges",
"from",
"<filename",
">",
".",
"pickle"
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/core.py#L370-L380 | [
"def",
"load",
"(",
"self",
",",
"filename",
",",
"file_format",
"=",
"None",
")",
":",
"loader",
"=",
"self",
".",
"_get_loader",
"(",
"filename",
",",
"file_format",
"=",
"file_format",
")",
"loader",
"(",
"filename",
")"
] | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
valid | Grid._load_cpp4 | Initializes Grid from a CCP4 file. | gridData/core.py | def _load_cpp4(self, filename):
"""Initializes Grid from a CCP4 file."""
ccp4 = CCP4.CCP4()
ccp4.read(filename)
grid, edges = ccp4.histogramdd()
self.__init__(grid=grid, edges=edges, metadata=self.metadata) | def _load_cpp4(self, filename):
"""Initializes Grid from a CCP4 file."""
ccp4 = CCP4.CCP4()
ccp4.read(filename)
grid, edges = ccp4.histogramdd()
self.__init__(grid=grid, edges=edges, metadata=self.metadata) | [
"Initializes",
"Grid",
"from",
"a",
"CCP4",
"file",
"."
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/core.py#L389-L394 | [
"def",
"_load_cpp4",
"(",
"self",
",",
"filename",
")",
":",
"ccp4",
"=",
"CCP4",
".",
"CCP4",
"(",
")",
"ccp4",
".",
"read",
"(",
"filename",
")",
"grid",
",",
"edges",
"=",
"ccp4",
".",
"histogramdd",
"(",
")",
"self",
".",
"__init__",
"(",
"grid... | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
valid | Grid._load_dx | Initializes Grid from a OpenDX file. | gridData/core.py | def _load_dx(self, filename):
"""Initializes Grid from a OpenDX file."""
dx = OpenDX.field(0)
dx.read(filename)
grid, edges = dx.histogramdd()
self.__init__(grid=grid, edges=edges, metadata=self.metadata) | def _load_dx(self, filename):
"""Initializes Grid from a OpenDX file."""
dx = OpenDX.field(0)
dx.read(filename)
grid, edges = dx.histogramdd()
self.__init__(grid=grid, edges=edges, metadata=self.metadata) | [
"Initializes",
"Grid",
"from",
"a",
"OpenDX",
"file",
"."
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/core.py#L396-L401 | [
"def",
"_load_dx",
"(",
"self",
",",
"filename",
")",
":",
"dx",
"=",
"OpenDX",
".",
"field",
"(",
"0",
")",
"dx",
".",
"read",
"(",
"filename",
")",
"grid",
",",
"edges",
"=",
"dx",
".",
"histogramdd",
"(",
")",
"self",
".",
"__init__",
"(",
"gr... | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
valid | Grid._load_plt | Initialize Grid from gOpenMol plt file. | gridData/core.py | def _load_plt(self, filename):
"""Initialize Grid from gOpenMol plt file."""
g = gOpenMol.Plt()
g.read(filename)
grid, edges = g.histogramdd()
self.__init__(grid=grid, edges=edges, metadata=self.metadata) | def _load_plt(self, filename):
"""Initialize Grid from gOpenMol plt file."""
g = gOpenMol.Plt()
g.read(filename)
grid, edges = g.histogramdd()
self.__init__(grid=grid, edges=edges, metadata=self.metadata) | [
"Initialize",
"Grid",
"from",
"gOpenMol",
"plt",
"file",
"."
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/core.py#L403-L408 | [
"def",
"_load_plt",
"(",
"self",
",",
"filename",
")",
":",
"g",
"=",
"gOpenMol",
".",
"Plt",
"(",
")",
"g",
".",
"read",
"(",
"filename",
")",
"grid",
",",
"edges",
"=",
"g",
".",
"histogramdd",
"(",
")",
"self",
".",
"__init__",
"(",
"grid",
"=... | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
valid | Grid.export | export density to file using the given format.
The format can also be deduced from the suffix of the filename
though the *format* keyword takes precedence.
The default format for export() is 'dx'. Use 'dx' for
visualization.
Implemented formats:
dx
:mod:`... | gridData/core.py | def export(self, filename, file_format=None, type=None, typequote='"'):
"""export density to file using the given format.
The format can also be deduced from the suffix of the filename
though the *format* keyword takes precedence.
The default format for export() is 'dx'. Use 'dx' for
... | def export(self, filename, file_format=None, type=None, typequote='"'):
"""export density to file using the given format.
The format can also be deduced from the suffix of the filename
though the *format* keyword takes precedence.
The default format for export() is 'dx'. Use 'dx' for
... | [
"export",
"density",
"to",
"file",
"using",
"the",
"given",
"format",
"."
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/core.py#L410-L454 | [
"def",
"export",
"(",
"self",
",",
"filename",
",",
"file_format",
"=",
"None",
",",
"type",
"=",
"None",
",",
"typequote",
"=",
"'\"'",
")",
":",
"exporter",
"=",
"self",
".",
"_get_exporter",
"(",
"filename",
",",
"file_format",
"=",
"file_format",
")"... | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
valid | Grid._export_python | Pickle the Grid object
The object is dumped as a dictionary with grid and edges: This
is sufficient to recreate the grid object with __init__(). | gridData/core.py | def _export_python(self, filename, **kwargs):
"""Pickle the Grid object
The object is dumped as a dictionary with grid and edges: This
is sufficient to recreate the grid object with __init__().
"""
data = dict(grid=self.grid, edges=self.edges, metadata=self.metadata)
wit... | def _export_python(self, filename, **kwargs):
"""Pickle the Grid object
The object is dumped as a dictionary with grid and edges: This
is sufficient to recreate the grid object with __init__().
"""
data = dict(grid=self.grid, edges=self.edges, metadata=self.metadata)
wit... | [
"Pickle",
"the",
"Grid",
"object"
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/core.py#L460-L468 | [
"def",
"_export_python",
"(",
"self",
",",
"filename",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"dict",
"(",
"grid",
"=",
"self",
".",
"grid",
",",
"edges",
"=",
"self",
".",
"edges",
",",
"metadata",
"=",
"self",
".",
"metadata",
")",
"with... | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
valid | Grid._export_dx | Export the density grid to an OpenDX file.
The file format is the simplest regular grid array and it is
also understood by VMD's and Chimera's DX reader; PyMOL
requires the dx `type` to be set to "double".
For the file format see
http://opendx.sdsc.edu/docs/html/pages/usrgu068.... | gridData/core.py | def _export_dx(self, filename, type=None, typequote='"', **kwargs):
"""Export the density grid to an OpenDX file.
The file format is the simplest regular grid array and it is
also understood by VMD's and Chimera's DX reader; PyMOL
requires the dx `type` to be set to "double".
F... | def _export_dx(self, filename, type=None, typequote='"', **kwargs):
"""Export the density grid to an OpenDX file.
The file format is the simplest regular grid array and it is
also understood by VMD's and Chimera's DX reader; PyMOL
requires the dx `type` to be set to "double".
F... | [
"Export",
"the",
"density",
"grid",
"to",
"an",
"OpenDX",
"file",
"."
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/core.py#L470-L507 | [
"def",
"_export_dx",
"(",
"self",
",",
"filename",
",",
"type",
"=",
"None",
",",
"typequote",
"=",
"'\"'",
",",
"*",
"*",
"kwargs",
")",
":",
"root",
",",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"filename",
")",
"filename",
"=",
"root... | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
valid | Grid.centers | Returns the coordinates of the centers of all grid cells as an
iterator. | gridData/core.py | def centers(self):
"""Returns the coordinates of the centers of all grid cells as an
iterator."""
for idx in numpy.ndindex(self.grid.shape):
yield self.delta * numpy.array(idx) + self.origin | def centers(self):
"""Returns the coordinates of the centers of all grid cells as an
iterator."""
for idx in numpy.ndindex(self.grid.shape):
yield self.delta * numpy.array(idx) + self.origin | [
"Returns",
"the",
"coordinates",
"of",
"the",
"centers",
"of",
"all",
"grid",
"cells",
"as",
"an",
"iterator",
"."
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/core.py#L527-L531 | [
"def",
"centers",
"(",
"self",
")",
":",
"for",
"idx",
"in",
"numpy",
".",
"ndindex",
"(",
"self",
".",
"grid",
".",
"shape",
")",
":",
"yield",
"self",
".",
"delta",
"*",
"numpy",
".",
"array",
"(",
"idx",
")",
"+",
"self",
".",
"origin"
] | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
valid | Grid.check_compatible | Check if *other* can be used in an arithmetic operation.
1) *other* is a scalar
2) *other* is a grid defined on the same edges
:Raises: :exc:`TypeError` if not compatible. | gridData/core.py | def check_compatible(self, other):
"""Check if *other* can be used in an arithmetic operation.
1) *other* is a scalar
2) *other* is a grid defined on the same edges
:Raises: :exc:`TypeError` if not compatible.
"""
if not (numpy.isreal(other) or self == other):
... | def check_compatible(self, other):
"""Check if *other* can be used in an arithmetic operation.
1) *other* is a scalar
2) *other* is a grid defined on the same edges
:Raises: :exc:`TypeError` if not compatible.
"""
if not (numpy.isreal(other) or self == other):
... | [
"Check",
"if",
"*",
"other",
"*",
"can",
"be",
"used",
"in",
"an",
"arithmetic",
"operation",
"."
] | MDAnalysis/GridDataFormats | python | https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/core.py#L533-L547 | [
"def",
"check_compatible",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"(",
"numpy",
".",
"isreal",
"(",
"other",
")",
"or",
"self",
"==",
"other",
")",
":",
"raise",
"TypeError",
"(",
"\"The argument can not be arithmetically combined with the grid. \"",
... | 3eeb0432f8cf856912436e4f3e7aba99d3c916be |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.