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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
test | Client._update_secrets | update secrets will update metadata needed for pull and search | sregistry/main/gitlab/__init__.py | def _update_secrets(self):
'''update secrets will update metadata needed for pull and search
'''
self.token = self._required_get_and_update('SREGISTRY_GITLAB_TOKEN')
self.headers["Private-Token"] = self.token | def _update_secrets(self):
'''update secrets will update metadata needed for pull and search
'''
self.token = self._required_get_and_update('SREGISTRY_GITLAB_TOKEN')
self.headers["Private-Token"] = self.token | [
"update",
"secrets",
"will",
"update",
"metadata",
"needed",
"for",
"pull",
"and",
"search"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/gitlab/__init__.py#L43-L47 | [
"def",
"_update_secrets",
"(",
"self",
")",
":",
"self",
".",
"token",
"=",
"self",
".",
"_required_get_and_update",
"(",
"'SREGISTRY_GITLAB_TOKEN'",
")",
"self",
".",
"headers",
"[",
"\"Private-Token\"",
"]",
"=",
"self",
".",
"token"
] | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | Client._get_metadata | since the user needs a job id and other parameters, save this
for them. | sregistry/main/gitlab/__init__.py | def _get_metadata(self):
'''since the user needs a job id and other parameters, save this
for them.
'''
metadata = {'SREGISTRY_GITLAB_FOLDER': self.artifacts,
'api_base': self.api_base,
'SREGISTRY_GITLAB_BASE': self.base,
'SR... | def _get_metadata(self):
'''since the user needs a job id and other parameters, save this
for them.
'''
metadata = {'SREGISTRY_GITLAB_FOLDER': self.artifacts,
'api_base': self.api_base,
'SREGISTRY_GITLAB_BASE': self.base,
'SR... | [
"since",
"the",
"user",
"needs",
"a",
"job",
"id",
"and",
"other",
"parameters",
"save",
"this",
"for",
"them",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/gitlab/__init__.py#L52-L60 | [
"def",
"_get_metadata",
"(",
"self",
")",
":",
"metadata",
"=",
"{",
"'SREGISTRY_GITLAB_FOLDER'",
":",
"self",
".",
"artifacts",
",",
"'api_base'",
":",
"self",
".",
"api_base",
",",
"'SREGISTRY_GITLAB_BASE'",
":",
"self",
".",
"base",
",",
"'SREGISTRY_GITLAB_JO... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | Client._parse_image_name | starting with an image string in either of the following formats:
job_id|collection
job_id|collection|job_name
Parse the job_name, job_id, and collection uri from it. If the user
provides the first option, we use the job_name set by the client
(default is build).... | sregistry/main/gitlab/__init__.py | def _parse_image_name(self, image, retry=True):
'''starting with an image string in either of the following formats:
job_id|collection
job_id|collection|job_name
Parse the job_name, job_id, and collection uri from it. If the user
provides the first option, we use th... | def _parse_image_name(self, image, retry=True):
'''starting with an image string in either of the following formats:
job_id|collection
job_id|collection|job_name
Parse the job_name, job_id, and collection uri from it. If the user
provides the first option, we use th... | [
"starting",
"with",
"an",
"image",
"string",
"in",
"either",
"of",
"the",
"following",
"formats",
":",
"job_id|collection",
"job_id|collection|job_name",
"Parse",
"the",
"job_name",
"job_id",
"and",
"collection",
"uri",
"from",
"it",
".",
"If",
"the",
"user",
"p... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/gitlab/__init__.py#L76-L104 | [
"def",
"_parse_image_name",
"(",
"self",
",",
"image",
",",
"retry",
"=",
"True",
")",
":",
"try",
":",
"job_id",
",",
"collection",
",",
"job_name",
"=",
"image",
".",
"split",
"(",
"','",
")",
"except",
":",
"# Retry and add job_name",
"if",
"retry",
"... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_settings | get all settings, either for a particular client if a name is provided,
or across clients.
Parameters
==========
client_name: the client name to return settings for (optional) | sregistry/main/base/settings.py | def get_settings(self, client_name=None):
'''get all settings, either for a particular client if a name is provided,
or across clients.
Parameters
==========
client_name: the client name to return settings for (optional)
'''
settings = read_client_secrets()
if client_name i... | def get_settings(self, client_name=None):
'''get all settings, either for a particular client if a name is provided,
or across clients.
Parameters
==========
client_name: the client name to return settings for (optional)
'''
settings = read_client_secrets()
if client_name i... | [
"get",
"all",
"settings",
"either",
"for",
"a",
"particular",
"client",
"if",
"a",
"name",
"is",
"provided",
"or",
"across",
"clients",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/base/settings.py#L21-L33 | [
"def",
"get_settings",
"(",
"self",
",",
"client_name",
"=",
"None",
")",
":",
"settings",
"=",
"read_client_secrets",
"(",
")",
"if",
"client_name",
"is",
"not",
"None",
"and",
"client_name",
"in",
"settings",
":",
"return",
"settings",
"[",
"client_name",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_setting | return a setting from the environment (first priority) and then
secrets (second priority) if one can be found. If not, return None.
Parameters
==========
name: they key (index) of the setting to look up
default: (optional) if not found, return default instead. | sregistry/main/base/settings.py | def get_setting(self, name, default=None):
'''return a setting from the environment (first priority) and then
secrets (second priority) if one can be found. If not, return None.
Parameters
==========
name: they key (index) of the setting to look up
default: (optional) if not foun... | def get_setting(self, name, default=None):
'''return a setting from the environment (first priority) and then
secrets (second priority) if one can be found. If not, return None.
Parameters
==========
name: they key (index) of the setting to look up
default: (optional) if not foun... | [
"return",
"a",
"setting",
"from",
"the",
"environment",
"(",
"first",
"priority",
")",
"and",
"then",
"secrets",
"(",
"second",
"priority",
")",
"if",
"one",
"can",
"be",
"found",
".",
"If",
"not",
"return",
"None",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/base/settings.py#L36-L59 | [
"def",
"get_setting",
"(",
"self",
",",
"name",
",",
"default",
"=",
"None",
")",
":",
"# First priority is the environment",
"setting",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"name",
")",
"# Second priority is the secrets file",
"if",
"setting",
"is",
"Non... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_and_update_setting | Look for a setting in the environment (first priority) and then
the settings file (second). If something is found, the settings
file is updated. The order of operations works as follows:
1. The .sregistry settings file is used as a cache for the variable
2. the environment variable always t... | sregistry/main/base/settings.py | def get_and_update_setting(self, name, default=None):
'''Look for a setting in the environment (first priority) and then
the settings file (second). If something is found, the settings
file is updated. The order of operations works as follows:
1. The .sregistry settings file is used as a cache... | def get_and_update_setting(self, name, default=None):
'''Look for a setting in the environment (first priority) and then
the settings file (second). If something is found, the settings
file is updated. The order of operations works as follows:
1. The .sregistry settings file is used as a cache... | [
"Look",
"for",
"a",
"setting",
"in",
"the",
"environment",
"(",
"first",
"priority",
")",
"and",
"then",
"the",
"settings",
"file",
"(",
"second",
")",
".",
"If",
"something",
"is",
"found",
"the",
"settings",
"file",
"is",
"updated",
".",
"The",
"order"... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/base/settings.py#L62-L89 | [
"def",
"get_and_update_setting",
"(",
"self",
",",
"name",
",",
"default",
"=",
"None",
")",
":",
"setting",
"=",
"self",
".",
"_get_setting",
"(",
"name",
")",
"if",
"setting",
"is",
"None",
"and",
"default",
"is",
"not",
"None",
":",
"setting",
"=",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | required_get_and_update | a wrapper to get_and_update, but if not successful, will print an
error and exit. | sregistry/main/base/settings.py | def required_get_and_update(self, name, default=None):
'''a wrapper to get_and_update, but if not successful, will print an
error and exit.
'''
setting = self._get_and_update_setting(name, default=None)
if setting in [None, ""]:
bot.exit('You must export %s' % name)
return setting | def required_get_and_update(self, name, default=None):
'''a wrapper to get_and_update, but if not successful, will print an
error and exit.
'''
setting = self._get_and_update_setting(name, default=None)
if setting in [None, ""]:
bot.exit('You must export %s' % name)
return setting | [
"a",
"wrapper",
"to",
"get_and_update",
"but",
"if",
"not",
"successful",
"will",
"print",
"an",
"error",
"and",
"exit",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/base/settings.py#L92-L99 | [
"def",
"required_get_and_update",
"(",
"self",
",",
"name",
",",
"default",
"=",
"None",
")",
":",
"setting",
"=",
"self",
".",
"_get_and_update_setting",
"(",
"name",
",",
"default",
"=",
"None",
")",
"if",
"setting",
"in",
"[",
"None",
",",
"\"\"",
"]"... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | update_setting | Just update a setting, doesn't need to be returned. | sregistry/main/base/settings.py | def update_setting(self, name, value):
'''Just update a setting, doesn't need to be returned.
'''
if value is not None:
updates = {name : value}
update_client_secrets(backend=self.client_name,
updates=updates) | def update_setting(self, name, value):
'''Just update a setting, doesn't need to be returned.
'''
if value is not None:
updates = {name : value}
update_client_secrets(backend=self.client_name,
updates=updates) | [
"Just",
"update",
"a",
"setting",
"doesn",
"t",
"need",
"to",
"be",
"returned",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/base/settings.py#L102-L109 | [
"def",
"update_setting",
"(",
"self",
",",
"name",
",",
"value",
")",
":",
"if",
"value",
"is",
"not",
"None",
":",
"updates",
"=",
"{",
"name",
":",
"value",
"}",
"update_client_secrets",
"(",
"backend",
"=",
"self",
".",
"client_name",
",",
"updates",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_storage_name | use a parsed names dictionary from get_image_name (above) to return
the path in storage based on the user's preferences
Parameters
==========
names: the output from parse_image_name | sregistry/main/base/settings.py | def get_storage_name(self, names, remove_dir=False):
'''use a parsed names dictionary from get_image_name (above) to return
the path in storage based on the user's preferences
Parameters
==========
names: the output from parse_image_name
'''
storage_folder = os.path.dirname(name... | def get_storage_name(self, names, remove_dir=False):
'''use a parsed names dictionary from get_image_name (above) to return
the path in storage based on the user's preferences
Parameters
==========
names: the output from parse_image_name
'''
storage_folder = os.path.dirname(name... | [
"use",
"a",
"parsed",
"names",
"dictionary",
"from",
"get_image_name",
"(",
"above",
")",
"to",
"return",
"the",
"path",
"in",
"storage",
"based",
"on",
"the",
"user",
"s",
"preferences"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/base/settings.py#L112-L132 | [
"def",
"get_storage_name",
"(",
"self",
",",
"names",
",",
"remove_dir",
"=",
"False",
")",
":",
"storage_folder",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"names",
"[",
"'storage'",
"]",
")",
"# If the client doesn't have a database, default to PWD",
"if",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | authorize | Authorize a client based on encrypting the payload with the client
token, which should be matched on the receiving server | sregistry/main/registry/auth.py | def authorize(self, names, payload=None, request_type="push"):
'''Authorize a client based on encrypting the payload with the client
token, which should be matched on the receiving server'''
if self.secrets is not None:
if "registry" in self.secrets:
# Use the payload to generate a... | def authorize(self, names, payload=None, request_type="push"):
'''Authorize a client based on encrypting the payload with the client
token, which should be matched on the receiving server'''
if self.secrets is not None:
if "registry" in self.secrets:
# Use the payload to generate a... | [
"Authorize",
"a",
"client",
"based",
"on",
"encrypting",
"the",
"payload",
"with",
"the",
"client",
"token",
"which",
"should",
"be",
"matched",
"on",
"the",
"receiving",
"server"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/registry/auth.py#L19-L40 | [
"def",
"authorize",
"(",
"self",
",",
"names",
",",
"payload",
"=",
"None",
",",
"request_type",
"=",
"\"push\"",
")",
":",
"if",
"self",
".",
"secrets",
"is",
"not",
"None",
":",
"if",
"\"registry\"",
"in",
"self",
".",
"secrets",
":",
"# Use the payloa... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | push | push an image to your Storage. If the collection doesn't exist,
it is created.
Parameters
==========
path: should correspond to an absolute image path (or derive it)
name: should be the complete uri that the user has requested to push.
tag: should correspond with an image t... | sregistry/main/swift/push.py | def push(self, path, name, tag=None):
'''push an image to your Storage. If the collection doesn't exist,
it is created.
Parameters
==========
path: should correspond to an absolute image path (or derive it)
name: should be the complete uri that the user has requested to push.
... | def push(self, path, name, tag=None):
'''push an image to your Storage. If the collection doesn't exist,
it is created.
Parameters
==========
path: should correspond to an absolute image path (or derive it)
name: should be the complete uri that the user has requested to push.
... | [
"push",
"an",
"image",
"to",
"your",
"Storage",
".",
"If",
"the",
"collection",
"doesn",
"t",
"exist",
"it",
"is",
"created",
".",
"Parameters",
"==========",
"path",
":",
"should",
"correspond",
"to",
"an",
"absolute",
"image",
"path",
"(",
"or",
"derive"... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/swift/push.py#L21-L70 | [
"def",
"push",
"(",
"self",
",",
"path",
",",
"name",
",",
"tag",
"=",
"None",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"path",
")",
"bot",
".",
"debug",
"(",
"\"PUSH %s\"",
"%",
"path",
")",
"if",
"not",
"os",
".",
"path"... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | build | trigger a build on Google Cloud (storage then compute) given a name
recipe, and Github URI where the recipe can be found.
Parameters
==========
name: should be the complete uri that the user has requested to push.
commit: a commit to use, not required, and can be parsed from URI
... | sregistry/main/google_storage/build.py | def build(self, repo,
config=None,
name=None,
commit=None,
tag="latest",
recipe="Singularity",
preview=False):
'''trigger a build on Google Cloud (storage then compute) given a name
recipe, and Github URI where... | def build(self, repo,
config=None,
name=None,
commit=None,
tag="latest",
recipe="Singularity",
preview=False):
'''trigger a build on Google Cloud (storage then compute) given a name
recipe, and Github URI where... | [
"trigger",
"a",
"build",
"on",
"Google",
"Cloud",
"(",
"storage",
"then",
"compute",
")",
"given",
"a",
"name",
"recipe",
"and",
"Github",
"URI",
"where",
"the",
"recipe",
"can",
"be",
"found",
".",
"Parameters",
"==========",
"name",
":",
"should",
"be",
... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_storage/build.py#L33-L92 | [
"def",
"build",
"(",
"self",
",",
"repo",
",",
"config",
"=",
"None",
",",
"name",
"=",
"None",
",",
"commit",
"=",
"None",
",",
"tag",
"=",
"\"latest\"",
",",
"recipe",
"=",
"\"Singularity\"",
",",
"preview",
"=",
"False",
")",
":",
"bot",
".",
"d... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | list_builders | list builders, or instances for the project. They should start with
sregistry-builder
Parameters
==========
project: specify a project, will default to environment first
zone: the zone to use, defaults to us-west1-a if environment not set | sregistry/main/google_storage/build.py | def list_builders(self, project=None, zone='us-west1-a'):
'''list builders, or instances for the project. They should start with
sregistry-builder
Parameters
==========
project: specify a project, will default to environment first
zone: the zone to use, defaults to us-west1-a if ... | def list_builders(self, project=None, zone='us-west1-a'):
'''list builders, or instances for the project. They should start with
sregistry-builder
Parameters
==========
project: specify a project, will default to environment first
zone: the zone to use, defaults to us-west1-a if ... | [
"list",
"builders",
"or",
"instances",
"for",
"the",
"project",
".",
"They",
"should",
"start",
"with",
"sregistry",
"-",
"builder"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_storage/build.py#L96-L114 | [
"def",
"list_builders",
"(",
"self",
",",
"project",
"=",
"None",
",",
"zone",
"=",
"'us-west1-a'",
")",
":",
"builders",
"=",
"[",
"]",
"instances",
"=",
"self",
".",
"_get_instances",
"(",
"project",
",",
"zone",
")",
"for",
"instance",
"in",
"instance... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | list_templates | list templates in the builder bundle library. If a name is provided,
look it up
Parameters
==========
name: the name of a template to look up | sregistry/main/google_storage/build.py | def list_templates(self, name=None):
'''list templates in the builder bundle library. If a name is provided,
look it up
Parameters
==========
name: the name of a template to look up
'''
configs = self._get_templates()
rows = []
# DETAIL: The user wants to retrieve a par... | def list_templates(self, name=None):
'''list templates in the builder bundle library. If a name is provided,
look it up
Parameters
==========
name: the name of a template to look up
'''
configs = self._get_templates()
rows = []
# DETAIL: The user wants to retrieve a par... | [
"list",
"templates",
"in",
"the",
"builder",
"bundle",
"library",
".",
"If",
"a",
"name",
"is",
"provided",
"look",
"it",
"up"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_storage/build.py#L118-L140 | [
"def",
"list_templates",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"configs",
"=",
"self",
".",
"_get_templates",
"(",
")",
"rows",
"=",
"[",
"]",
"# DETAIL: The user wants to retrieve a particular configuration",
"if",
"name",
":",
"matches",
"=",
"self"... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_templates | list templates in the builder bundle library. If a name is provided,
look it up | sregistry/main/google_storage/build.py | def get_templates(self):
'''list templates in the builder bundle library. If a name is provided,
look it up
'''
base = 'https://singularityhub.github.io/builders'
base = self._get_and_update_setting('SREGISTRY_BUILDER_REPO', base)
base = "%s/configs.json" %base
return self._get(base) | def get_templates(self):
'''list templates in the builder bundle library. If a name is provided,
look it up
'''
base = 'https://singularityhub.github.io/builders'
base = self._get_and_update_setting('SREGISTRY_BUILDER_REPO', base)
base = "%s/configs.json" %base
return self._get(base) | [
"list",
"templates",
"in",
"the",
"builder",
"bundle",
"library",
".",
"If",
"a",
"name",
"is",
"provided",
"look",
"it",
"up"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_storage/build.py#L144-L153 | [
"def",
"get_templates",
"(",
"self",
")",
":",
"base",
"=",
"'https://singularityhub.github.io/builders'",
"base",
"=",
"self",
".",
"_get_and_update_setting",
"(",
"'SREGISTRY_BUILDER_REPO'",
",",
"base",
")",
"base",
"=",
"\"%s/configs.json\"",
"%",
"base",
"return"... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | load_templates | load a particular template based on a name. We look for a name IN data,
so the query name can be a partial string of the full name.
Parameters
==========
name: the name of a template to look up | sregistry/main/google_storage/build.py | def load_templates(self, name):
'''load a particular template based on a name. We look for a name IN data,
so the query name can be a partial string of the full name.
Parameters
==========
name: the name of a template to look up
'''
configs = self._get_templates()
templates ... | def load_templates(self, name):
'''load a particular template based on a name. We look for a name IN data,
so the query name can be a partial string of the full name.
Parameters
==========
name: the name of a template to look up
'''
configs = self._get_templates()
templates ... | [
"load",
"a",
"particular",
"template",
"based",
"on",
"a",
"name",
".",
"We",
"look",
"for",
"a",
"name",
"IN",
"data",
"so",
"the",
"query",
"name",
"can",
"be",
"a",
"partial",
"string",
"of",
"the",
"full",
"name",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_storage/build.py#L157-L176 | [
"def",
"load_templates",
"(",
"self",
",",
"name",
")",
":",
"configs",
"=",
"self",
".",
"_get_templates",
"(",
")",
"templates",
"=",
"[",
"]",
"# The user wants to retrieve a particular configuration",
"matches",
"=",
"[",
"x",
"for",
"x",
"in",
"configs",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_instances | get instances will return the (unparsed) list of instances, for
functions for the user. This is primarily used by get_builders
to print a list of builder instances.
Parameters
==========
project: specify a project, will default to environment first
zone: the zone to use, defau... | sregistry/main/google_storage/build.py | def get_instances(self, project=None, zone='us-west1-a'):
'''get instances will return the (unparsed) list of instances, for
functions for the user. This is primarily used by get_builders
to print a list of builder instances.
Parameters
==========
project: specify a project, will... | def get_instances(self, project=None, zone='us-west1-a'):
'''get instances will return the (unparsed) list of instances, for
functions for the user. This is primarily used by get_builders
to print a list of builder instances.
Parameters
==========
project: specify a project, will... | [
"get",
"instances",
"will",
"return",
"the",
"(",
"unparsed",
")",
"list",
"of",
"instances",
"for",
"functions",
"for",
"the",
"user",
".",
"This",
"is",
"primarily",
"used",
"by",
"get_builders",
"to",
"print",
"a",
"list",
"of",
"builder",
"instances",
... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_storage/build.py#L179-L194 | [
"def",
"get_instances",
"(",
"self",
",",
"project",
"=",
"None",
",",
"zone",
"=",
"'us-west1-a'",
")",
":",
"project",
"=",
"self",
".",
"_get_project",
"(",
"project",
")",
"zone",
"=",
"self",
".",
"_get_zone",
"(",
"zone",
")",
"return",
"self",
"... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_ipaddress | get the ip_address of an inserted instance. Will try three times with
delay to give the instance time to start up.
Parameters
==========
name: the name of the instance to get the ip address for.
retries: the number of retries before giving up
delay: the delay between retry
... | sregistry/main/google_storage/build.py | def get_ipaddress(self, name, retries=3, delay=3):
'''get the ip_address of an inserted instance. Will try three times with
delay to give the instance time to start up.
Parameters
==========
name: the name of the instance to get the ip address for.
retries: the number of retries ... | def get_ipaddress(self, name, retries=3, delay=3):
'''get the ip_address of an inserted instance. Will try three times with
delay to give the instance time to start up.
Parameters
==========
name: the name of the instance to get the ip address for.
retries: the number of retries ... | [
"get",
"the",
"ip_address",
"of",
"an",
"inserted",
"instance",
".",
"Will",
"try",
"three",
"times",
"with",
"delay",
"to",
"give",
"the",
"instance",
"time",
"to",
"start",
"up",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_storage/build.py#L197-L229 | [
"def",
"get_ipaddress",
"(",
"self",
",",
"name",
",",
"retries",
"=",
"3",
",",
"delay",
"=",
"3",
")",
":",
"for",
"rr",
"in",
"range",
"(",
"retries",
")",
":",
"# Retrieve list of instances",
"instances",
"=",
"self",
".",
"_get_instances",
"(",
")",... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | load_build_config | load a google compute config, meaning that we have the following cases:
1. the user has not provided a config file directly, we look in env.
2. the environment is not set, so we use a reasonable default
3. if the final string is not found as a file, we look for it in library
4. we load the ... | sregistry/main/google_storage/build.py | def load_build_config(self, config=None):
'''load a google compute config, meaning that we have the following cases:
1. the user has not provided a config file directly, we look in env.
2. the environment is not set, so we use a reasonable default
3. if the final string is not found as a file,... | def load_build_config(self, config=None):
'''load a google compute config, meaning that we have the following cases:
1. the user has not provided a config file directly, we look in env.
2. the environment is not set, so we use a reasonable default
3. if the final string is not found as a file,... | [
"load",
"a",
"google",
"compute",
"config",
"meaning",
"that",
"we",
"have",
"the",
"following",
"cases",
":"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_storage/build.py#L233-L269 | [
"def",
"load_build_config",
"(",
"self",
",",
"config",
"=",
"None",
")",
":",
"# If the config is already a dictionary, it's loaded",
"if",
"isinstance",
"(",
"config",
",",
"dict",
")",
":",
"bot",
".",
"debug",
"(",
"'Config is already loaded.'",
")",
"return",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | setup_build | setup the build based on the selected configuration file, meaning
producing the configuration file filled in based on the user's input
Parameters
==========
config: the complete configuration file provided by the client
template: an optional custom start script to use
tag: a ... | sregistry/main/google_storage/build.py | def setup_build(self, name, repo, config, tag=None, commit=None,
recipe="Singularity", startup_script=None):
'''setup the build based on the selected configuration file, meaning
producing the configuration file filled in based on the user's input
Parameters
==========
... | def setup_build(self, name, repo, config, tag=None, commit=None,
recipe="Singularity", startup_script=None):
'''setup the build based on the selected configuration file, meaning
producing the configuration file filled in based on the user's input
Parameters
==========
... | [
"setup",
"the",
"build",
"based",
"on",
"the",
"selected",
"configuration",
"file",
"meaning",
"producing",
"the",
"configuration",
"file",
"filled",
"in",
"based",
"on",
"the",
"user",
"s",
"input",
"Parameters",
"==========",
"config",
":",
"the",
"complete",
... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_storage/build.py#L273-L430 | [
"def",
"setup_build",
"(",
"self",
",",
"name",
",",
"repo",
",",
"config",
",",
"tag",
"=",
"None",
",",
"commit",
"=",
"None",
",",
"recipe",
"=",
"\"Singularity\"",
",",
"startup_script",
"=",
"None",
")",
":",
"manager",
"=",
"self",
".",
"_get_and... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | setconfig | setconfig will update a lookup to give priority based on the following:
1. If both values are None, we set the value to None
2. If the currently set (the config.json) is set but not runtime, use config
3. If the runtime is set but not config.json, we use runtime
4. If both are set, we use ... | sregistry/main/google_storage/build.py | def setconfig(lookup, key, value=None):
'''setconfig will update a lookup to give priority based on the following:
1. If both values are None, we set the value to None
2. If the currently set (the config.json) is set but not runtime, use config
3. If the runtime is set but not config.json, we... | def setconfig(lookup, key, value=None):
'''setconfig will update a lookup to give priority based on the following:
1. If both values are None, we set the value to None
2. If the currently set (the config.json) is set but not runtime, use config
3. If the runtime is set but not config.json, we... | [
"setconfig",
"will",
"update",
"a",
"lookup",
"to",
"give",
"priority",
"based",
"on",
"the",
"following",
":",
"1",
".",
"If",
"both",
"values",
"are",
"None",
"we",
"set",
"the",
"value",
"to",
"None",
"2",
".",
"If",
"the",
"currently",
"set",
"(",
... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_storage/build.py#L433-L443 | [
"def",
"setconfig",
"(",
"lookup",
",",
"key",
",",
"value",
"=",
"None",
")",
":",
"lookup",
"[",
"key",
"]",
"=",
"value",
"or",
"lookup",
".",
"get",
"(",
"key",
")",
"return",
"lookup"
] | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | run_build | run a build, meaning inserting an instance. Retry if there is failure
Parameters
==========
config: the configuration dictionary generated by setup_build | sregistry/main/google_storage/build.py | def run_build(self, config):
'''run a build, meaning inserting an instance. Retry if there is failure
Parameters
==========
config: the configuration dictionary generated by setup_build
'''
project = self._get_project()
zone = self._get_zone()
bot.custom(prefix='INSTANCE', me... | def run_build(self, config):
'''run a build, meaning inserting an instance. Retry if there is failure
Parameters
==========
config: the configuration dictionary generated by setup_build
'''
project = self._get_project()
zone = self._get_zone()
bot.custom(prefix='INSTANCE', me... | [
"run",
"a",
"build",
"meaning",
"inserting",
"an",
"instance",
".",
"Retry",
"if",
"there",
"is",
"failure"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_storage/build.py#L452-L474 | [
"def",
"run_build",
"(",
"self",
",",
"config",
")",
":",
"project",
"=",
"self",
".",
"_get_project",
"(",
")",
"zone",
"=",
"self",
".",
"_get_zone",
"(",
")",
"bot",
".",
"custom",
"(",
"prefix",
"=",
"'INSTANCE'",
",",
"message",
"=",
"config",
"... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | search_all | a "show all" search that doesn't require a query | sregistry/main/swift/query.py | def search_all(self):
'''a "show all" search that doesn't require a query'''
results = set()
# Here we get names of collections, and then look up containers
for container in self.conn.get_account()[1]:
# The result here is just the name
for result in self.conn.get_container(container[... | def search_all(self):
'''a "show all" search that doesn't require a query'''
results = set()
# Here we get names of collections, and then look up containers
for container in self.conn.get_account()[1]:
# The result here is just the name
for result in self.conn.get_container(container[... | [
"a",
"show",
"all",
"search",
"that",
"doesn",
"t",
"require",
"a",
"query"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/swift/query.py#L38-L56 | [
"def",
"search_all",
"(",
"self",
")",
":",
"results",
"=",
"set",
"(",
")",
"# Here we get names of collections, and then look up containers",
"for",
"container",
"in",
"self",
".",
"conn",
".",
"get_account",
"(",
")",
"[",
"1",
"]",
":",
"# The result here is j... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | container_query | search for a specific container.
This function would likely be similar to the above, but have different
filter criteria from the user (based on the query) | sregistry/main/swift/query.py | def container_query(self, query):
'''search for a specific container.
This function would likely be similar to the above, but have different
filter criteria from the user (based on the query)
'''
results = set()
query = remove_uri(query)
# Here we get names of collections, and then look u... | def container_query(self, query):
'''search for a specific container.
This function would likely be similar to the above, but have different
filter criteria from the user (based on the query)
'''
results = set()
query = remove_uri(query)
# Here we get names of collections, and then look u... | [
"search",
"for",
"a",
"specific",
"container",
".",
"This",
"function",
"would",
"likely",
"be",
"similar",
"to",
"the",
"above",
"but",
"have",
"different",
"filter",
"criteria",
"from",
"the",
"user",
"(",
"based",
"on",
"the",
"query",
")"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/swift/query.py#L59-L83 | [
"def",
"container_query",
"(",
"self",
",",
"query",
")",
":",
"results",
"=",
"set",
"(",
")",
"query",
"=",
"remove_uri",
"(",
"query",
")",
"# Here we get names of collections, and then look up containers",
"for",
"container",
"in",
"self",
".",
"conn",
".",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | list_containers | return a list of containers, determined by finding the metadata field
"type" with value "container." We alert the user to no containers
if results is empty, and exit
{'metadata': {'items':
[
{'key': 'type', 'value': 'container'}, ...
... | sregistry/main/google_build/query.py | def list_containers(self):
'''return a list of containers, determined by finding the metadata field
"type" with value "container." We alert the user to no containers
if results is empty, and exit
{'metadata': {'items':
[
{'key': 't... | def list_containers(self):
'''return a list of containers, determined by finding the metadata field
"type" with value "container." We alert the user to no containers
if results is empty, and exit
{'metadata': {'items':
[
{'key': 't... | [
"return",
"a",
"list",
"of",
"containers",
"determined",
"by",
"finding",
"the",
"metadata",
"field",
"type",
"with",
"value",
"container",
".",
"We",
"alert",
"the",
"user",
"to",
"no",
"containers",
"if",
"results",
"is",
"empty",
"and",
"exit"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_build/query.py#L30-L53 | [
"def",
"list_containers",
"(",
"self",
")",
":",
"results",
"=",
"[",
"]",
"for",
"image",
"in",
"self",
".",
"_bucket",
".",
"list_blobs",
"(",
")",
":",
"if",
"image",
".",
"metadata",
"is",
"not",
"None",
":",
"if",
"\"type\"",
"in",
"image",
".",... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | search_all | a "list all" search that doesn't require a query. Here we return to
the user all objects that have custom metadata value of "container"
IMPORTANT: the upload function adds this metadata. For a container to
be found by the client, it must have the type as container in metadata. | sregistry/main/google_build/query.py | def search_all(self):
'''a "list all" search that doesn't require a query. Here we return to
the user all objects that have custom metadata value of "container"
IMPORTANT: the upload function adds this metadata. For a container to
be found by the client, it must have the type as container in m... | def search_all(self):
'''a "list all" search that doesn't require a query. Here we return to
the user all objects that have custom metadata value of "container"
IMPORTANT: the upload function adds this metadata. For a container to
be found by the client, it must have the type as container in m... | [
"a",
"list",
"all",
"search",
"that",
"doesn",
"t",
"require",
"a",
"query",
".",
"Here",
"we",
"return",
"to",
"the",
"user",
"all",
"objects",
"that",
"have",
"custom",
"metadata",
"value",
"of",
"container"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_build/query.py#L56-L75 | [
"def",
"search_all",
"(",
"self",
")",
":",
"results",
"=",
"self",
".",
"_list_containers",
"(",
")",
"bot",
".",
"info",
"(",
"\"[gs://%s] Containers\"",
"%",
"self",
".",
"_bucket_name",
")",
"rows",
"=",
"[",
"]",
"for",
"i",
"in",
"results",
":",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | container_query | search for a specific container.
This function would likely be similar to the above, but have different
filter criteria from the user (based on the query) | sregistry/main/google_build/query.py | def container_query(self, query, quiet=False):
'''search for a specific container.
This function would likely be similar to the above, but have different
filter criteria from the user (based on the query)
'''
results = self._list_containers()
matches = []
for result in results:
... | def container_query(self, query, quiet=False):
'''search for a specific container.
This function would likely be similar to the above, but have different
filter criteria from the user (based on the query)
'''
results = self._list_containers()
matches = []
for result in results:
... | [
"search",
"for",
"a",
"specific",
"container",
".",
"This",
"function",
"would",
"likely",
"be",
"similar",
"to",
"the",
"above",
"but",
"have",
"different",
"filter",
"criteria",
"from",
"the",
"user",
"(",
"based",
"on",
"the",
"query",
")"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_build/query.py#L78-L105 | [
"def",
"container_query",
"(",
"self",
",",
"query",
",",
"quiet",
"=",
"False",
")",
":",
"results",
"=",
"self",
".",
"_list_containers",
"(",
")",
"matches",
"=",
"[",
"]",
"for",
"result",
"in",
"results",
":",
"for",
"key",
",",
"val",
"in",
"re... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | search_all | a "show all" search that doesn't require a query | sregistry/main/dropbox/query.py | def search_all(self):
'''a "show all" search that doesn't require a query'''
results = []
# Parse through folders (collections):
for entry in self.dbx.files_list_folder('').entries:
# Parse through containers
for item in self.dbx.files_list_folder(entry.path_lower).entries:
... | def search_all(self):
'''a "show all" search that doesn't require a query'''
results = []
# Parse through folders (collections):
for entry in self.dbx.files_list_folder('').entries:
# Parse through containers
for item in self.dbx.files_list_folder(entry.path_lower).entries:
... | [
"a",
"show",
"all",
"search",
"that",
"doesn",
"t",
"require",
"a",
"query"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/dropbox/query.py#L38-L58 | [
"def",
"search_all",
"(",
"self",
")",
":",
"results",
"=",
"[",
"]",
"# Parse through folders (collections):",
"for",
"entry",
"in",
"self",
".",
"dbx",
".",
"files_list_folder",
"(",
"''",
")",
".",
"entries",
":",
"# Parse through containers",
"for",
"item",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | main | the list command corresponds with listing images for an external
resource. This is different from listing images that are local to the
database, which should be done with "images" | sregistry/client/list.py | def main(args,parser,subparser):
'''the list command corresponds with listing images for an external
resource. This is different from listing images that are local to the
database, which should be done with "images"
'''
from sregistry.main import get_client
cli = get_client(quiet=args.quie... | def main(args,parser,subparser):
'''the list command corresponds with listing images for an external
resource. This is different from listing images that are local to the
database, which should be done with "images"
'''
from sregistry.main import get_client
cli = get_client(quiet=args.quie... | [
"the",
"list",
"command",
"corresponds",
"with",
"listing",
"images",
"for",
"an",
"external",
"resource",
".",
"This",
"is",
"different",
"from",
"listing",
"images",
"that",
"are",
"local",
"to",
"the",
"database",
"which",
"should",
"be",
"done",
"with",
... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/client/list.py#L12-L24 | [
"def",
"main",
"(",
"args",
",",
"parser",
",",
"subparser",
")",
":",
"from",
"sregistry",
".",
"main",
"import",
"get_client",
"cli",
"=",
"get_client",
"(",
"quiet",
"=",
"args",
".",
"quiet",
")",
"for",
"query",
"in",
"args",
".",
"query",
":",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | pull | pull an image from google storage, based on the identifier
Parameters
==========
images: refers to the uri given by the user to pull in the format
<collection>/<namespace>. You should have an API that is able to
retrieve a container based on parsing this uri.
... | sregistry/main/google_build/pull.py | def pull(self, images, file_name=None, save=True, **kwargs):
'''pull an image from google storage, based on the identifier
Parameters
==========
images: refers to the uri given by the user to pull in the format
<collection>/<namespace>. You should have an API that is able to
... | def pull(self, images, file_name=None, save=True, **kwargs):
'''pull an image from google storage, based on the identifier
Parameters
==========
images: refers to the uri given by the user to pull in the format
<collection>/<namespace>. You should have an API that is able to
... | [
"pull",
"an",
"image",
"from",
"google",
"storage",
"based",
"on",
"the",
"identifier",
"Parameters",
"==========",
"images",
":",
"refers",
"to",
"the",
"uri",
"given",
"by",
"the",
"user",
"to",
"pull",
"in",
"the",
"format",
"<collection",
">",
"/",
"<n... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_build/pull.py#L17-L93 | [
"def",
"pull",
"(",
"self",
",",
"images",
",",
"file_name",
"=",
"None",
",",
"save",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"images",
",",
"list",
")",
":",
"images",
"=",
"[",
"images",
"]",
"bot",
".",... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | main | sharing an image means sending a remote share from an image you
control to a contact, usually an email. | sregistry/client/share.py | def main(args, parser, subparser):
'''sharing an image means sending a remote share from an image you
control to a contact, usually an email.
'''
from sregistry.main import get_client
images = args.image
if not isinstance(images,list):
images = [images]
for image in images:
... | def main(args, parser, subparser):
'''sharing an image means sending a remote share from an image you
control to a contact, usually an email.
'''
from sregistry.main import get_client
images = args.image
if not isinstance(images,list):
images = [images]
for image in images:
... | [
"sharing",
"an",
"image",
"means",
"sending",
"a",
"remote",
"share",
"from",
"an",
"image",
"you",
"control",
"to",
"a",
"contact",
"usually",
"an",
"email",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/client/share.py#L12-L28 | [
"def",
"main",
"(",
"args",
",",
"parser",
",",
"subparser",
")",
":",
"from",
"sregistry",
".",
"main",
"import",
"get_client",
"images",
"=",
"args",
".",
"image",
"if",
"not",
"isinstance",
"(",
"images",
",",
"list",
")",
":",
"images",
"=",
"[",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | init_db | initialize the database, with the default database path or custom of
the format sqlite:////scif/data/expfactory.db
The custom path can be set with the environment variable SREGISTRY_DATABASE
when a user creates the client, we must initialize this db
the database should use the .singularity cache fo... | sregistry/database/models.py | def init_db(self, db_path):
'''initialize the database, with the default database path or custom of
the format sqlite:////scif/data/expfactory.db
The custom path can be set with the environment variable SREGISTRY_DATABASE
when a user creates the client, we must initialize this db
the database s... | def init_db(self, db_path):
'''initialize the database, with the default database path or custom of
the format sqlite:////scif/data/expfactory.db
The custom path can be set with the environment variable SREGISTRY_DATABASE
when a user creates the client, we must initialize this db
the database s... | [
"initialize",
"the",
"database",
"with",
"the",
"default",
"database",
"path",
"or",
"custom",
"of"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/database/models.py#L133-L160 | [
"def",
"init_db",
"(",
"self",
",",
"db_path",
")",
":",
"# Database Setup, use default if uri not provided",
"self",
".",
"database",
"=",
"'sqlite:///%s'",
"%",
"db_path",
"self",
".",
"storage",
"=",
"SREGISTRY_STORAGE",
"bot",
".",
"debug",
"(",
"\"Database loca... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | Container.get_uri | generate a uri on the fly from database parameters if one is not
saved with the initial model (it should be, but might not be possible) | sregistry/database/models.py | def get_uri(self):
'''generate a uri on the fly from database parameters if one is not
saved with the initial model (it should be, but might not be possible)
'''
uri = "%s/%s:%s" %(self.collection.name, self.name, self.tag)
if self.version not in [None,'']:
uri = "%s@... | def get_uri(self):
'''generate a uri on the fly from database parameters if one is not
saved with the initial model (it should be, but might not be possible)
'''
uri = "%s/%s:%s" %(self.collection.name, self.name, self.tag)
if self.version not in [None,'']:
uri = "%s@... | [
"generate",
"a",
"uri",
"on",
"the",
"fly",
"from",
"database",
"parameters",
"if",
"one",
"is",
"not",
"saved",
"with",
"the",
"initial",
"model",
"(",
"it",
"should",
"be",
"but",
"might",
"not",
"be",
"possible",
")"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/database/models.py#L122-L129 | [
"def",
"get_uri",
"(",
"self",
")",
":",
"uri",
"=",
"\"%s/%s:%s\"",
"%",
"(",
"self",
".",
"collection",
".",
"name",
",",
"self",
".",
"name",
",",
"self",
".",
"tag",
")",
"if",
"self",
".",
"version",
"not",
"in",
"[",
"None",
",",
"''",
"]",... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_build_template | get default build template. | sregistry/main/google_build/utils.py | def get_build_template():
'''get default build template.
'''
base = get_installdir()
name = "%s/main/templates/build/singularity-cloudbuild.json" % base
if os.path.exists(name):
bot.debug("Found template %s" %name)
return read_json(name)
bot.warning("Template %s not found." % n... | def get_build_template():
'''get default build template.
'''
base = get_installdir()
name = "%s/main/templates/build/singularity-cloudbuild.json" % base
if os.path.exists(name):
bot.debug("Found template %s" %name)
return read_json(name)
bot.warning("Template %s not found." % n... | [
"get",
"default",
"build",
"template",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_build/utils.py#L17-L27 | [
"def",
"get_build_template",
"(",
")",
":",
"base",
"=",
"get_installdir",
"(",
")",
"name",
"=",
"\"%s/main/templates/build/singularity-cloudbuild.json\"",
"%",
"base",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"name",
")",
":",
"bot",
".",
"debug",
"(",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | search | query will show images determined by the extension of img
or simg.
Parameters
==========
query: the container name (path) or uri to search for
args.endpoint: can be an endpoint id and optional path, e.g.:
--endpoint 6881ae2e-db26-11e5-9772-22000b9da45e:.singularity'
... | sregistry/main/globus/query.py | def search(self, query=None, args=None):
'''query will show images determined by the extension of img
or simg.
Parameters
==========
query: the container name (path) or uri to search for
args.endpoint: can be an endpoint id and optional path, e.g.:
--endpoint 6881a... | def search(self, query=None, args=None):
'''query will show images determined by the extension of img
or simg.
Parameters
==========
query: the container name (path) or uri to search for
args.endpoint: can be an endpoint id and optional path, e.g.:
--endpoint 6881a... | [
"query",
"will",
"show",
"images",
"determined",
"by",
"the",
"extension",
"of",
"img",
"or",
"simg",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/globus/query.py#L19-L62 | [
"def",
"search",
"(",
"self",
",",
"query",
"=",
"None",
",",
"args",
"=",
"None",
")",
":",
"# No query is defined",
"if",
"query",
"is",
"None",
":",
"# Option 1: No query or endpoints lists all shared and personal",
"if",
"args",
".",
"endpoint",
"is",
"None",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | list_endpoints | list all endpoints, providing a list of endpoints to the user to
better filter the search. This function takes no arguments,
as the user has not provided an endpoint id or query. | sregistry/main/globus/query.py | def list_endpoints(self, query=None):
'''list all endpoints, providing a list of endpoints to the user to
better filter the search. This function takes no arguments,
as the user has not provided an endpoint id or query.
'''
bot.info('Please select an endpoint id to query from')
endpoints... | def list_endpoints(self, query=None):
'''list all endpoints, providing a list of endpoints to the user to
better filter the search. This function takes no arguments,
as the user has not provided an endpoint id or query.
'''
bot.info('Please select an endpoint id to query from')
endpoints... | [
"list",
"all",
"endpoints",
"providing",
"a",
"list",
"of",
"endpoints",
"to",
"the",
"user",
"to",
"better",
"filter",
"the",
"search",
".",
"This",
"function",
"takes",
"no",
"arguments",
"as",
"the",
"user",
"has",
"not",
"provided",
"an",
"endpoint",
"... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/globus/query.py#L67-L85 | [
"def",
"list_endpoints",
"(",
"self",
",",
"query",
"=",
"None",
")",
":",
"bot",
".",
"info",
"(",
"'Please select an endpoint id to query from'",
")",
"endpoints",
"=",
"self",
".",
"_get_endpoints",
"(",
"query",
")",
"# Iterate through endpoints to provide user a ... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | list_endpoint | An endpoint is required here to list files within. Optionally, we can
take a path relative to the endpoint root.
Parameters
==========
endpoint: a single endpoint ID or an endpoint id and relative path.
If no path is provided, we use '', which defaults to scratch.
q... | sregistry/main/globus/query.py | def list_endpoint(self, endpoint, query=None):
'''An endpoint is required here to list files within. Optionally, we can
take a path relative to the endpoint root.
Parameters
==========
endpoint: a single endpoint ID or an endpoint id and relative path.
If no path is pro... | def list_endpoint(self, endpoint, query=None):
'''An endpoint is required here to list files within. Optionally, we can
take a path relative to the endpoint root.
Parameters
==========
endpoint: a single endpoint ID or an endpoint id and relative path.
If no path is pro... | [
"An",
"endpoint",
"is",
"required",
"here",
"to",
"list",
"files",
"within",
".",
"Optionally",
"we",
"can",
"take",
"a",
"path",
"relative",
"to",
"the",
"endpoint",
"root",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/globus/query.py#L88-L137 | [
"def",
"list_endpoint",
"(",
"self",
",",
"endpoint",
",",
"query",
"=",
"None",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'transfer_client'",
")",
":",
"self",
".",
"_init_transfer_client",
"(",
")",
"# Separate endpoint id from the desired path",
"e... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | share | share will use the client to get a shareable link for an image of choice.
the functions returns a url of choice to send to a recipient. | sregistry/main/dropbox/share.py | def share(self, query, share_to=None):
'''share will use the client to get a shareable link for an image of choice.
the functions returns a url of choice to send to a recipient.
'''
names = parse_image_name(remove_uri(query))
# Dropbox path is the path in storage with a slash
dropbox_path =... | def share(self, query, share_to=None):
'''share will use the client to get a shareable link for an image of choice.
the functions returns a url of choice to send to a recipient.
'''
names = parse_image_name(remove_uri(query))
# Dropbox path is the path in storage with a slash
dropbox_path =... | [
"share",
"will",
"use",
"the",
"client",
"to",
"get",
"a",
"shareable",
"link",
"for",
"an",
"image",
"of",
"choice",
".",
"the",
"functions",
"returns",
"a",
"url",
"of",
"choice",
"to",
"send",
"to",
"a",
"recipient",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/dropbox/share.py#L16-L38 | [
"def",
"share",
"(",
"self",
",",
"query",
",",
"share_to",
"=",
"None",
")",
":",
"names",
"=",
"parse_image_name",
"(",
"remove_uri",
"(",
"query",
")",
")",
"# Dropbox path is the path in storage with a slash",
"dropbox_path",
"=",
"'/%s'",
"%",
"names",
"[",... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | Client._set_base | set the API base or default to use Docker Hub. The user is able
to set the base, api version, and protocol via a settings file
of environment variables:
SREGISTRY_NVIDIA_BASE: defaults to nvcr.io
SREGISTRY_NVIDIA_TOKEN: defaults to $oauthtoken
SREGISTRY_NVIDIA_VE... | sregistry/main/nvidia/__init__.py | def _set_base(self):
'''set the API base or default to use Docker Hub. The user is able
to set the base, api version, and protocol via a settings file
of environment variables:
SREGISTRY_NVIDIA_BASE: defaults to nvcr.io
SREGISTRY_NVIDIA_TOKEN: defaults to $oauthtoke... | def _set_base(self):
'''set the API base or default to use Docker Hub. The user is able
to set the base, api version, and protocol via a settings file
of environment variables:
SREGISTRY_NVIDIA_BASE: defaults to nvcr.io
SREGISTRY_NVIDIA_TOKEN: defaults to $oauthtoke... | [
"set",
"the",
"API",
"base",
"or",
"default",
"to",
"use",
"Docker",
"Hub",
".",
"The",
"user",
"is",
"able",
"to",
"set",
"the",
"base",
"api",
"version",
"and",
"protocol",
"via",
"a",
"settings",
"file",
"of",
"environment",
"variables",
":",
"SREGIST... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/nvidia/__init__.py#L83-L110 | [
"def",
"_set_base",
"(",
"self",
")",
":",
"base",
"=",
"self",
".",
"_get_setting",
"(",
"'SREGISTRY_NVIDIA_BASE'",
")",
"version",
"=",
"self",
".",
"_get_setting",
"(",
"'SREGISTRY_NVIDIA_VERSION'",
")",
"if",
"base",
"is",
"None",
":",
"base",
"=",
"\"nv... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | Client._update_secrets | update secrets will take a secrets credential file
either located at .sregistry or the environment variable
SREGISTRY_CLIENT_SECRETS and update the current client
secrets as well as the associated API base. For the case of
using Docker Hub, if we find a .docker secrets file,... | sregistry/main/nvidia/__init__.py | def _update_secrets(self):
'''update secrets will take a secrets credential file
either located at .sregistry or the environment variable
SREGISTRY_CLIENT_SECRETS and update the current client
secrets as well as the associated API base. For the case of
using Docker H... | def _update_secrets(self):
'''update secrets will take a secrets credential file
either located at .sregistry or the environment variable
SREGISTRY_CLIENT_SECRETS and update the current client
secrets as well as the associated API base. For the case of
using Docker H... | [
"update",
"secrets",
"will",
"take",
"a",
"secrets",
"credential",
"file",
"either",
"located",
"at",
".",
"sregistry",
"or",
"the",
"environment",
"variable",
"SREGISTRY_CLIENT_SECRETS",
"and",
"update",
"the",
"current",
"client",
"secrets",
"as",
"well",
"as",
... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/nvidia/__init__.py#L113-L131 | [
"def",
"_update_secrets",
"(",
"self",
")",
":",
"# If the user has defined secrets, use them",
"token",
"=",
"self",
".",
"_required_get_and_update",
"(",
"'SREGISTRY_NVIDIA_TOKEN'",
")",
"username",
"=",
"self",
".",
"_get_and_update_setting",
"(",
"'SREGISTRY_NVIDIA_USER... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | pull | pull an image from a Globus endpoint. The user must have the default
local endpoint set up. For example:
6881ae2e-db26-11e5-9772-22000b9da45e:.singularity/shub/sherlock_vep.simg
Parameters
==========
images: refers to the globus endpoint id and image path.
file_name: the user's requested... | sregistry/main/globus/pull.py | def pull(self, images, file_name=None, save=True, **kwargs):
'''pull an image from a Globus endpoint. The user must have the default
local endpoint set up. For example:
6881ae2e-db26-11e5-9772-22000b9da45e:.singularity/shub/sherlock_vep.simg
Parameters
==========
images: refers to the gl... | def pull(self, images, file_name=None, save=True, **kwargs):
'''pull an image from a Globus endpoint. The user must have the default
local endpoint set up. For example:
6881ae2e-db26-11e5-9772-22000b9da45e:.singularity/shub/sherlock_vep.simg
Parameters
==========
images: refers to the gl... | [
"pull",
"an",
"image",
"from",
"a",
"Globus",
"endpoint",
".",
"The",
"user",
"must",
"have",
"the",
"default",
"local",
"endpoint",
"set",
"up",
".",
"For",
"example",
":"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/globus/pull.py#L25-L109 | [
"def",
"pull",
"(",
"self",
",",
"images",
",",
"file_name",
"=",
"None",
",",
"save",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"# Ensure we have a transfer client",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'transfer_client'",
")",
":",
"self",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_credential_cache | if the user has specified settings to provide a cache for credentials
files, initialize it. The root for the folder is created if it doesn't
exist. The path for the specific client is returned, and it's
not assumed to be either a folder or a file (this is up to the
developer of the client). | sregistry/auth/secrets.py | def get_credential_cache():
'''if the user has specified settings to provide a cache for credentials
files, initialize it. The root for the folder is created if it doesn't
exist. The path for the specific client is returned, and it's
not assumed to be either a folder or a file (this is up to th... | def get_credential_cache():
'''if the user has specified settings to provide a cache for credentials
files, initialize it. The root for the folder is created if it doesn't
exist. The path for the specific client is returned, and it's
not assumed to be either a folder or a file (this is up to th... | [
"if",
"the",
"user",
"has",
"specified",
"settings",
"to",
"provide",
"a",
"cache",
"for",
"credentials",
"files",
"initialize",
"it",
".",
"The",
"root",
"for",
"the",
"folder",
"is",
"created",
"if",
"it",
"doesn",
"t",
"exist",
".",
"The",
"path",
"fo... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/auth/secrets.py#L23-L48 | [
"def",
"get_credential_cache",
"(",
")",
":",
"from",
"sregistry",
".",
"defaults",
"import",
"(",
"CREDENTIAL_CACHE",
",",
"SREGISTRY_CLIENT",
")",
"client_credential_cache",
"=",
"None",
"# Check 1: user can disable a credential cache on the client level",
"if",
"CREDENTIAL... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | update_client_secrets | update client secrets will update the data structure for a particular
authentication. This should only be used for a (quasi permanent) token
or similar. The secrets file, if found, is updated and saved by default. | sregistry/auth/secrets.py | def update_client_secrets(backend, updates, secrets=None, save=True):
'''update client secrets will update the data structure for a particular
authentication. This should only be used for a (quasi permanent) token
or similar. The secrets file, if found, is updated and saved by default.
'''
if ... | def update_client_secrets(backend, updates, secrets=None, save=True):
'''update client secrets will update the data structure for a particular
authentication. This should only be used for a (quasi permanent) token
or similar. The secrets file, if found, is updated and saved by default.
'''
if ... | [
"update",
"client",
"secrets",
"will",
"update",
"the",
"data",
"structure",
"for",
"a",
"particular",
"authentication",
".",
"This",
"should",
"only",
"be",
"used",
"for",
"a",
"(",
"quasi",
"permanent",
")",
"token",
"or",
"similar",
".",
"The",
"secrets",... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/auth/secrets.py#L58-L75 | [
"def",
"update_client_secrets",
"(",
"backend",
",",
"updates",
",",
"secrets",
"=",
"None",
",",
"save",
"=",
"True",
")",
":",
"if",
"secrets",
"is",
"None",
":",
"secrets",
"=",
"read_client_secrets",
"(",
")",
"if",
"backend",
"not",
"in",
"secrets",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | read_client_secrets | for private or protected registries, a client secrets file is required
to be located at .sregistry. If no secrets are found, we use default
of Singularity Hub, and return a dummy secrets. | sregistry/auth/secrets.py | def read_client_secrets():
'''for private or protected registries, a client secrets file is required
to be located at .sregistry. If no secrets are found, we use default
of Singularity Hub, and return a dummy secrets.
'''
client_secrets = _default_client_secrets()
# If token file not prov... | def read_client_secrets():
'''for private or protected registries, a client secrets file is required
to be located at .sregistry. If no secrets are found, we use default
of Singularity Hub, and return a dummy secrets.
'''
client_secrets = _default_client_secrets()
# If token file not prov... | [
"for",
"private",
"or",
"protected",
"registries",
"a",
"client",
"secrets",
"file",
"is",
"required",
"to",
"be",
"located",
"at",
".",
"sregistry",
".",
"If",
"no",
"secrets",
"are",
"found",
"we",
"use",
"default",
"of",
"Singularity",
"Hub",
"and",
"re... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/auth/secrets.py#L77-L96 | [
"def",
"read_client_secrets",
"(",
")",
":",
"client_secrets",
"=",
"_default_client_secrets",
"(",
")",
"# If token file not provided, check environment",
"secrets",
"=",
"get_secrets_file",
"(",
")",
"# If exists, load",
"if",
"secrets",
"is",
"not",
"None",
":",
"cli... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | Client._init_client | init client will check if the user has defined a bucket that
differs from the default, use the application credentials to
get the bucket, and then instantiate the client. | sregistry/main/google_storage/__init__.py | def _init_client(self):
'''init client will check if the user has defined a bucket that
differs from the default, use the application credentials to
get the bucket, and then instantiate the client.
'''
# Get storage and compute services
self._get_services()
... | def _init_client(self):
'''init client will check if the user has defined a bucket that
differs from the default, use the application credentials to
get the bucket, and then instantiate the client.
'''
# Get storage and compute services
self._get_services()
... | [
"init",
"client",
"will",
"check",
"if",
"the",
"user",
"has",
"defined",
"a",
"bucket",
"that",
"differs",
"from",
"the",
"default",
"use",
"the",
"application",
"credentials",
"to",
"get",
"the",
"bucket",
"and",
"then",
"instantiate",
"the",
"client",
"."... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_storage/__init__.py#L72-L88 | [
"def",
"_init_client",
"(",
"self",
")",
":",
"# Get storage and compute services",
"self",
".",
"_get_services",
"(",
")",
"env",
"=",
"'SREGISTRY_GOOGLE_STORAGE_BUCKET'",
"self",
".",
"_bucket_name",
"=",
"self",
".",
"_get_and_update_setting",
"(",
"env",
")",
"#... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | Client._get_services | get version 1 of the google compute and storage service
Parameters
==========
version: version to use (default is v1) | sregistry/main/google_storage/__init__.py | def _get_services(self, version='v1'):
'''get version 1 of the google compute and storage service
Parameters
==========
version: version to use (default is v1)
'''
self._bucket_service = storage.Client()
creds = GoogleCredentials.get_application_default()
... | def _get_services(self, version='v1'):
'''get version 1 of the google compute and storage service
Parameters
==========
version: version to use (default is v1)
'''
self._bucket_service = storage.Client()
creds = GoogleCredentials.get_application_default()
... | [
"get",
"version",
"1",
"of",
"the",
"google",
"compute",
"and",
"storage",
"service"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_storage/__init__.py#L91-L101 | [
"def",
"_get_services",
"(",
"self",
",",
"version",
"=",
"'v1'",
")",
":",
"self",
".",
"_bucket_service",
"=",
"storage",
".",
"Client",
"(",
")",
"creds",
"=",
"GoogleCredentials",
".",
"get_application_default",
"(",
")",
"self",
".",
"_storage_service",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | Client._get_bucket | get a bucket based on a bucket name. If it doesn't exist, create it. | sregistry/main/google_storage/__init__.py | def _get_bucket(self):
'''get a bucket based on a bucket name. If it doesn't exist, create it.
'''
# Case 1: The bucket already exists
try:
self._bucket = self._bucket_service.get_bucket(self._bucket_name)
# Case 2: The bucket needs to be created
except goog... | def _get_bucket(self):
'''get a bucket based on a bucket name. If it doesn't exist, create it.
'''
# Case 1: The bucket already exists
try:
self._bucket = self._bucket_service.get_bucket(self._bucket_name)
# Case 2: The bucket needs to be created
except goog... | [
"get",
"a",
"bucket",
"based",
"on",
"a",
"bucket",
"name",
".",
"If",
"it",
"doesn",
"t",
"exist",
"create",
"it",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_storage/__init__.py#L104-L121 | [
"def",
"_get_bucket",
"(",
"self",
")",
":",
"# Case 1: The bucket already exists",
"try",
":",
"self",
".",
"_bucket",
"=",
"self",
".",
"_bucket_service",
".",
"get_bucket",
"(",
"self",
".",
"_bucket_name",
")",
"# Case 2: The bucket needs to be created",
"except",... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | delete_object | delete object will delete a file from a bucket
Parameters
==========
storage_service: the service obtained with get_storage_service
bucket_name: the name of the bucket
object_name: the "name" parameter of the object. | sregistry/main/google_build/delete.py | def delete_object(service, bucket_name, object_name):
'''delete object will delete a file from a bucket
Parameters
==========
storage_service: the service obtained with get_storage_service
bucket_name: the name of the bucket
object_name: the "name" parameter of the object.
'... | def delete_object(service, bucket_name, object_name):
'''delete object will delete a file from a bucket
Parameters
==========
storage_service: the service obtained with get_storage_service
bucket_name: the name of the bucket
object_name: the "name" parameter of the object.
'... | [
"delete",
"object",
"will",
"delete",
"a",
"file",
"from",
"a",
"bucket"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_build/delete.py#L23-L39 | [
"def",
"delete_object",
"(",
"service",
",",
"bucket_name",
",",
"object_name",
")",
":",
"try",
":",
"operation",
"=",
"service",
".",
"objects",
"(",
")",
".",
"delete",
"(",
"bucket",
"=",
"bucket_name",
",",
"object",
"=",
"object_name",
")",
".",
"e... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | delete | delete an image from Google Storage.
Parameters
==========
name: the name of the file (or image) to delete | sregistry/main/google_build/delete.py | def delete(self, name):
'''delete an image from Google Storage.
Parameters
==========
name: the name of the file (or image) to delete
'''
bot.debug("DELETE %s" % name)
for file_object in files:
if isinstance(file_object, dict):
if "kind" in file_object:
... | def delete(self, name):
'''delete an image from Google Storage.
Parameters
==========
name: the name of the file (or image) to delete
'''
bot.debug("DELETE %s" % name)
for file_object in files:
if isinstance(file_object, dict):
if "kind" in file_object:
... | [
"delete",
"an",
"image",
"from",
"Google",
"Storage",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_build/delete.py#L42-L62 | [
"def",
"delete",
"(",
"self",
",",
"name",
")",
":",
"bot",
".",
"debug",
"(",
"\"DELETE %s\"",
"%",
"name",
")",
"for",
"file_object",
"in",
"files",
":",
"if",
"isinstance",
"(",
"file_object",
",",
"dict",
")",
":",
"if",
"\"kind\"",
"in",
"file_obj... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | destroy | destroy an instance, meaning take down the instance and stop the build.
Parameters
==========
name: the name of the instance to stop building. | sregistry/main/google_build/delete.py | def destroy(self, name):
'''destroy an instance, meaning take down the instance and stop the build.
Parameters
==========
name: the name of the instance to stop building.
'''
instances = self._get_instances()
project = self._get_project()
zone = self._get_zone()
found = Fa... | def destroy(self, name):
'''destroy an instance, meaning take down the instance and stop the build.
Parameters
==========
name: the name of the instance to stop building.
'''
instances = self._get_instances()
project = self._get_project()
zone = self._get_zone()
found = Fa... | [
"destroy",
"an",
"instance",
"meaning",
"take",
"down",
"the",
"instance",
"and",
"stop",
"the",
"build",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_build/delete.py#L70-L93 | [
"def",
"destroy",
"(",
"self",
",",
"name",
")",
":",
"instances",
"=",
"self",
".",
"_get_instances",
"(",
")",
"project",
"=",
"self",
".",
"_get_project",
"(",
")",
"zone",
"=",
"self",
".",
"_get_zone",
"(",
")",
"found",
"=",
"False",
"if",
"'it... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_subparsers | get_subparser will get a dictionary of subparsers, to help with printing help | sregistry/client/__init__.py | def get_subparsers(parser):
'''get_subparser will get a dictionary of subparsers, to help with printing help
'''
actions = [action for action in parser._actions
if isinstance(action, argparse._SubParsersAction)]
subparsers = dict()
for action in actions:
# get all subparser... | def get_subparsers(parser):
'''get_subparser will get a dictionary of subparsers, to help with printing help
'''
actions = [action for action in parser._actions
if isinstance(action, argparse._SubParsersAction)]
subparsers = dict()
for action in actions:
# get all subparser... | [
"get_subparser",
"will",
"get",
"a",
"dictionary",
"of",
"subparsers",
"to",
"help",
"with",
"printing",
"help"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/client/__init__.py#L280-L293 | [
"def",
"get_subparsers",
"(",
"parser",
")",
":",
"actions",
"=",
"[",
"action",
"for",
"action",
"in",
"parser",
".",
"_actions",
"if",
"isinstance",
"(",
"action",
",",
"argparse",
".",
"_SubParsersAction",
")",
"]",
"subparsers",
"=",
"dict",
"(",
")",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | main | main is the entrypoint to the sregistry client. The flow works to first
to determine the subparser in use based on the command. The command then
imports the correct main (files imported in this folder) associated with
the action of choice. When the client is imported, it is actually importing
a return o... | sregistry/client/__init__.py | def main():
'''main is the entrypoint to the sregistry client. The flow works to first
to determine the subparser in use based on the command. The command then
imports the correct main (files imported in this folder) associated with
the action of choice. When the client is imported, it is actually impor... | def main():
'''main is the entrypoint to the sregistry client. The flow works to first
to determine the subparser in use based on the command. The command then
imports the correct main (files imported in this folder) associated with
the action of choice. When the client is imported, it is actually impor... | [
"main",
"is",
"the",
"entrypoint",
"to",
"the",
"sregistry",
"client",
".",
"The",
"flow",
"works",
"to",
"first",
"to",
"determine",
"the",
"subparser",
"in",
"use",
"based",
"on",
"the",
"command",
".",
"The",
"command",
"then",
"imports",
"the",
"correc... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/client/__init__.py#L297-L373 | [
"def",
"main",
"(",
")",
":",
"from",
"sregistry",
".",
"main",
"import",
"Client",
"as",
"cli",
"parser",
"=",
"get_parser",
"(",
")",
"subparsers",
"=",
"get_subparsers",
"(",
"parser",
")",
"def",
"help",
"(",
"return_code",
"=",
"0",
")",
":",
"'''... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | RobotNamer.generate | Generate a robot name. Inspiration from Haikunator, but much more
poorly implemented ;)
Parameters
==========
delim: Delimiter
length: TokenLength
chars: TokenChars | sregistry/logger/namer.py | def generate(self, delim='-', length=4, chars='0123456789'):
'''
Generate a robot name. Inspiration from Haikunator, but much more
poorly implemented ;)
Parameters
==========
delim: Delimiter
length: TokenLength
chars: TokenChars
'''
... | def generate(self, delim='-', length=4, chars='0123456789'):
'''
Generate a robot name. Inspiration from Haikunator, but much more
poorly implemented ;)
Parameters
==========
delim: Delimiter
length: TokenLength
chars: TokenChars
'''
... | [
"Generate",
"a",
"robot",
"name",
".",
"Inspiration",
"from",
"Haikunator",
"but",
"much",
"more",
"poorly",
"implemented",
";",
")"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/logger/namer.py#L50-L65 | [
"def",
"generate",
"(",
"self",
",",
"delim",
"=",
"'-'",
",",
"length",
"=",
"4",
",",
"chars",
"=",
"'0123456789'",
")",
":",
"descriptor",
"=",
"self",
".",
"_select",
"(",
"self",
".",
"_descriptors",
")",
"noun",
"=",
"self",
".",
"_select",
"("... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | mkdir_p | mkdir_p attempts to get the same functionality as mkdir -p
:param path: the path to create. | sregistry/utils/fileio.py | def mkdir_p(path):
'''mkdir_p attempts to get the same functionality as mkdir -p
:param path: the path to create.
'''
try:
os.makedirs(path)
except OSError as e:
if e.errno == errno.EEXIST and os.path.isdir(path):
pass
else:
bot.error("Error creating p... | def mkdir_p(path):
'''mkdir_p attempts to get the same functionality as mkdir -p
:param path: the path to create.
'''
try:
os.makedirs(path)
except OSError as e:
if e.errno == errno.EEXIST and os.path.isdir(path):
pass
else:
bot.error("Error creating p... | [
"mkdir_p",
"attempts",
"to",
"get",
"the",
"same",
"functionality",
"as",
"mkdir",
"-",
"p",
":",
"param",
"path",
":",
"the",
"path",
"to",
"create",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/utils/fileio.py#L34-L45 | [
"def",
"mkdir_p",
"(",
"path",
")",
":",
"try",
":",
"os",
".",
"makedirs",
"(",
"path",
")",
"except",
"OSError",
"as",
"e",
":",
"if",
"e",
".",
"errno",
"==",
"errno",
".",
"EEXIST",
"and",
"os",
".",
"path",
".",
"isdir",
"(",
"path",
")",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_tmpfile | get a temporary file with an optional prefix. By default will be
created in /tmp unless SREGISTRY_TMPDIR is set. By default, the file
is closed (and just a name returned).
Parameters
==========
requested_tmpdir: an optional requested temporary directory, first
priority as is c... | sregistry/utils/fileio.py | def get_tmpfile(requested_tmpdir=None, prefix=""):
'''get a temporary file with an optional prefix. By default will be
created in /tmp unless SREGISTRY_TMPDIR is set. By default, the file
is closed (and just a name returned).
Parameters
==========
requested_tmpdir: an optional re... | def get_tmpfile(requested_tmpdir=None, prefix=""):
'''get a temporary file with an optional prefix. By default will be
created in /tmp unless SREGISTRY_TMPDIR is set. By default, the file
is closed (and just a name returned).
Parameters
==========
requested_tmpdir: an optional re... | [
"get",
"a",
"temporary",
"file",
"with",
"an",
"optional",
"prefix",
".",
"By",
"default",
"will",
"be",
"created",
"in",
"/",
"tmp",
"unless",
"SREGISTRY_TMPDIR",
"is",
"set",
".",
"By",
"default",
"the",
"file",
"is",
"closed",
"(",
"and",
"just",
"a",... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/utils/fileio.py#L48-L71 | [
"def",
"get_tmpfile",
"(",
"requested_tmpdir",
"=",
"None",
",",
"prefix",
"=",
"\"\"",
")",
":",
"# First priority for the base goes to the user requested.",
"tmpdir",
"=",
"get_tmpdir",
"(",
"requested_tmpdir",
")",
"# If tmpdir is set, add to prefix",
"if",
"tmpdir",
"... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_tmpdir | get a temporary directory for an operation. If SREGISTRY_TMPDIR
is set, return that. Otherwise, return the output of tempfile.mkdtemp
Parameters
==========
requested_tmpdir: an optional requested temporary directory, first
priority as is coming from calling function.
prefix: G... | sregistry/utils/fileio.py | def get_tmpdir(requested_tmpdir=None, prefix="", create=True):
'''get a temporary directory for an operation. If SREGISTRY_TMPDIR
is set, return that. Otherwise, return the output of tempfile.mkdtemp
Parameters
==========
requested_tmpdir: an optional requested temporary directory, firs... | def get_tmpdir(requested_tmpdir=None, prefix="", create=True):
'''get a temporary directory for an operation. If SREGISTRY_TMPDIR
is set, return that. Otherwise, return the output of tempfile.mkdtemp
Parameters
==========
requested_tmpdir: an optional requested temporary directory, firs... | [
"get",
"a",
"temporary",
"directory",
"for",
"an",
"operation",
".",
"If",
"SREGISTRY_TMPDIR",
"is",
"set",
"return",
"that",
".",
"Otherwise",
"return",
"the",
"output",
"of",
"tempfile",
".",
"mkdtemp"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/utils/fileio.py#L74-L98 | [
"def",
"get_tmpdir",
"(",
"requested_tmpdir",
"=",
"None",
",",
"prefix",
"=",
"\"\"",
",",
"create",
"=",
"True",
")",
":",
"from",
"sregistry",
".",
"defaults",
"import",
"SREGISTRY_TMPDIR",
"# First priority for the base goes to the user requested.",
"tmpdir",
"=",... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | extract_tar | extract a tar archive to a specified output folder
Parameters
==========
archive: the archive file to extract
output_folder: the output folder to extract to
handle_whiteout: use docker2oci variation to handle whiteout files | sregistry/utils/fileio.py | def extract_tar(archive, output_folder, handle_whiteout=False):
'''extract a tar archive to a specified output folder
Parameters
==========
archive: the archive file to extract
output_folder: the output folder to extract to
handle_whiteout: use docker2oci variation to handle... | def extract_tar(archive, output_folder, handle_whiteout=False):
'''extract a tar archive to a specified output folder
Parameters
==========
archive: the archive file to extract
output_folder: the output folder to extract to
handle_whiteout: use docker2oci variation to handle... | [
"extract",
"a",
"tar",
"archive",
"to",
"a",
"specified",
"output",
"folder"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/utils/fileio.py#L110-L136 | [
"def",
"extract_tar",
"(",
"archive",
",",
"output_folder",
",",
"handle_whiteout",
"=",
"False",
")",
":",
"from",
".",
"terminal",
"import",
"run_command",
"# Do we want to remove whiteout files?",
"if",
"handle_whiteout",
"is",
"True",
":",
"return",
"_extract_tar"... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | _extract_tar | use blob2oci to handle whiteout files for extraction. Credit for this
script goes to docker2oci by Olivier Freyermouth, and see script
folder for license.
Parameters
==========
archive: the archive to extract
output_folder the output folder (sandbox) to extract to | sregistry/utils/fileio.py | def _extract_tar(archive, output_folder):
'''use blob2oci to handle whiteout files for extraction. Credit for this
script goes to docker2oci by Olivier Freyermouth, and see script
folder for license.
Parameters
==========
archive: the archive to extract
output_folder the o... | def _extract_tar(archive, output_folder):
'''use blob2oci to handle whiteout files for extraction. Credit for this
script goes to docker2oci by Olivier Freyermouth, and see script
folder for license.
Parameters
==========
archive: the archive to extract
output_folder the o... | [
"use",
"blob2oci",
"to",
"handle",
"whiteout",
"files",
"for",
"extraction",
".",
"Credit",
"for",
"this",
"script",
"goes",
"to",
"docker2oci",
"by",
"Olivier",
"Freyermouth",
"and",
"see",
"script",
"folder",
"for",
"license",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/utils/fileio.py#L139-L163 | [
"def",
"_extract_tar",
"(",
"archive",
",",
"output_folder",
")",
":",
"from",
".",
"terminal",
"import",
"(",
"run_command",
",",
"which",
")",
"result",
"=",
"which",
"(",
"'blob2oci'",
")",
"if",
"result",
"[",
"'return_code'",
"]",
"!=",
"0",
":",
"b... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | create_tar | create_memory_tar will take a list of files (each a dictionary
with name, permission, and content) and write the tarfile
(a sha256 sum name is used) to the output_folder.
If there is no output folde specified, the
tar is written to a temporary folder. | sregistry/utils/fileio.py | def create_tar(files, output_folder=None):
'''create_memory_tar will take a list of files (each a dictionary
with name, permission, and content) and write the tarfile
(a sha256 sum name is used) to the output_folder.
If there is no output folde specified, the
tar is written to a temp... | def create_tar(files, output_folder=None):
'''create_memory_tar will take a list of files (each a dictionary
with name, permission, and content) and write the tarfile
(a sha256 sum name is used) to the output_folder.
If there is no output folde specified, the
tar is written to a temp... | [
"create_memory_tar",
"will",
"take",
"a",
"list",
"of",
"files",
"(",
"each",
"a",
"dictionary",
"with",
"name",
"permission",
"and",
"content",
")",
"and",
"write",
"the",
"tarfile",
"(",
"a",
"sha256",
"sum",
"name",
"is",
"used",
")",
"to",
"the",
"ou... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/utils/fileio.py#L166-L228 | [
"def",
"create_tar",
"(",
"files",
",",
"output_folder",
"=",
"None",
")",
":",
"if",
"output_folder",
"is",
"None",
":",
"output_folder",
"=",
"tempfile",
".",
"mkdtemp",
"(",
")",
"finished_tar",
"=",
"None",
"additions",
"=",
"[",
"]",
"contents",
"=",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_content_hash | get_content_hash will return a hash for a list of content (bytes/other) | sregistry/utils/fileio.py | def get_content_hash(contents):
'''get_content_hash will return a hash for a list of content (bytes/other)
'''
hasher = hashlib.sha256()
for content in contents:
if isinstance(content, io.BytesIO):
content = content.getvalue()
if not isinstance(content, bytes):
co... | def get_content_hash(contents):
'''get_content_hash will return a hash for a list of content (bytes/other)
'''
hasher = hashlib.sha256()
for content in contents:
if isinstance(content, io.BytesIO):
content = content.getvalue()
if not isinstance(content, bytes):
co... | [
"get_content_hash",
"will",
"return",
"a",
"hash",
"for",
"a",
"list",
"of",
"content",
"(",
"bytes",
"/",
"other",
")"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/utils/fileio.py#L231-L241 | [
"def",
"get_content_hash",
"(",
"contents",
")",
":",
"hasher",
"=",
"hashlib",
".",
"sha256",
"(",
")",
"for",
"content",
"in",
"contents",
":",
"if",
"isinstance",
"(",
"content",
",",
"io",
".",
"BytesIO",
")",
":",
"content",
"=",
"content",
".",
"... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_file_hash | find the SHA256 hash string of a file | sregistry/utils/fileio.py | def get_file_hash(filename):
'''find the SHA256 hash string of a file
'''
hasher = hashlib.sha256()
with open(filename, "rb") as f:
for chunk in iter(lambda: f.read(4096), b""):
hasher.update(chunk)
return hasher.hexdigest() | def get_file_hash(filename):
'''find the SHA256 hash string of a file
'''
hasher = hashlib.sha256()
with open(filename, "rb") as f:
for chunk in iter(lambda: f.read(4096), b""):
hasher.update(chunk)
return hasher.hexdigest() | [
"find",
"the",
"SHA256",
"hash",
"string",
"of",
"a",
"file"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/utils/fileio.py#L244-L251 | [
"def",
"get_file_hash",
"(",
"filename",
")",
":",
"hasher",
"=",
"hashlib",
".",
"sha256",
"(",
")",
"with",
"open",
"(",
"filename",
",",
"\"rb\"",
")",
"as",
"f",
":",
"for",
"chunk",
"in",
"iter",
"(",
"lambda",
":",
"f",
".",
"read",
"(",
"409... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | write_json | write_json will (optionally,pretty print) a json object to file
Parameters
==========
json_obj: the dict to print to json
filename: the output file to write to
pretty_print: if True, will use nicer formatting | sregistry/utils/fileio.py | def write_json(json_obj, filename, mode="w", print_pretty=True):
'''write_json will (optionally,pretty print) a json object to file
Parameters
==========
json_obj: the dict to print to json
filename: the output file to write to
pretty_print: if True, will use nicer formatting
... | def write_json(json_obj, filename, mode="w", print_pretty=True):
'''write_json will (optionally,pretty print) a json object to file
Parameters
==========
json_obj: the dict to print to json
filename: the output file to write to
pretty_print: if True, will use nicer formatting
... | [
"write_json",
"will",
"(",
"optionally",
"pretty",
"print",
")",
"a",
"json",
"object",
"to",
"file"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/utils/fileio.py#L283-L297 | [
"def",
"write_json",
"(",
"json_obj",
",",
"filename",
",",
"mode",
"=",
"\"w\"",
",",
"print_pretty",
"=",
"True",
")",
":",
"with",
"open",
"(",
"filename",
",",
"mode",
")",
"as",
"filey",
":",
"if",
"print_pretty",
":",
"filey",
".",
"writelines",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | read_file | write_file will open a file, "filename" and write content, "content"
and properly close the file | sregistry/utils/fileio.py | def read_file(filename, mode="r", readlines=True):
'''write_file will open a file, "filename" and write content, "content"
and properly close the file
'''
with open(filename, mode) as filey:
if readlines is True:
content = filey.readlines()
else:
content = file... | def read_file(filename, mode="r", readlines=True):
'''write_file will open a file, "filename" and write content, "content"
and properly close the file
'''
with open(filename, mode) as filey:
if readlines is True:
content = filey.readlines()
else:
content = file... | [
"write_file",
"will",
"open",
"a",
"file",
"filename",
"and",
"write",
"content",
"content",
"and",
"properly",
"close",
"the",
"file"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/utils/fileio.py#L311-L320 | [
"def",
"read_file",
"(",
"filename",
",",
"mode",
"=",
"\"r\"",
",",
"readlines",
"=",
"True",
")",
":",
"with",
"open",
"(",
"filename",
",",
"mode",
")",
"as",
"filey",
":",
"if",
"readlines",
"is",
"True",
":",
"content",
"=",
"filey",
".",
"readl... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | read_json | read_json reads in a json file and returns
the data structure as dict. | sregistry/utils/fileio.py | def read_json(filename, mode='r'):
'''read_json reads in a json file and returns
the data structure as dict.
'''
with open(filename, mode) as filey:
data = json.load(filey)
return data | def read_json(filename, mode='r'):
'''read_json reads in a json file and returns
the data structure as dict.
'''
with open(filename, mode) as filey:
data = json.load(filey)
return data | [
"read_json",
"reads",
"in",
"a",
"json",
"file",
"and",
"returns",
"the",
"data",
"structure",
"as",
"dict",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/utils/fileio.py#L323-L329 | [
"def",
"read_json",
"(",
"filename",
",",
"mode",
"=",
"'r'",
")",
":",
"with",
"open",
"(",
"filename",
",",
"mode",
")",
"as",
"filey",
":",
"data",
"=",
"json",
".",
"load",
"(",
"filey",
")",
"return",
"data"
] | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | clean_up | clean up will delete a list of files, only if they exist | sregistry/utils/fileio.py | def clean_up(files):
'''clean up will delete a list of files, only if they exist
'''
if not isinstance(files, list):
files = [files]
for f in files:
if os.path.exists(f):
bot.verbose3("Cleaning up %s" % f)
os.remove(f) | def clean_up(files):
'''clean up will delete a list of files, only if they exist
'''
if not isinstance(files, list):
files = [files]
for f in files:
if os.path.exists(f):
bot.verbose3("Cleaning up %s" % f)
os.remove(f) | [
"clean",
"up",
"will",
"delete",
"a",
"list",
"of",
"files",
"only",
"if",
"they",
"exist"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/utils/fileio.py#L332-L341 | [
"def",
"clean_up",
"(",
"files",
")",
":",
"if",
"not",
"isinstance",
"(",
"files",
",",
"list",
")",
":",
"files",
"=",
"[",
"files",
"]",
"for",
"f",
"in",
"files",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"f",
")",
":",
"bot",
".",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | pull | pull an image from a docker hub. This is a (less than ideal) workaround
that actually does the following:
- creates a sandbox folder
- adds docker layers, metadata folder, and custom metadata to it
- converts to a squashfs image with build
the docker manifests are stored with registry ... | sregistry/main/aws/pull.py | def pull(self, images, file_name=None, save=True, force=False, **kwargs):
'''pull an image from a docker hub. This is a (less than ideal) workaround
that actually does the following:
- creates a sandbox folder
- adds docker layers, metadata folder, and custom metadata to it
- converts t... | def pull(self, images, file_name=None, save=True, force=False, **kwargs):
'''pull an image from a docker hub. This is a (less than ideal) workaround
that actually does the following:
- creates a sandbox folder
- adds docker layers, metadata folder, and custom metadata to it
- converts t... | [
"pull",
"an",
"image",
"from",
"a",
"docker",
"hub",
".",
"This",
"is",
"a",
"(",
"less",
"than",
"ideal",
")",
"workaround",
"that",
"actually",
"does",
"the",
"following",
":"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/aws/pull.py#L25-L73 | [
"def",
"pull",
"(",
"self",
",",
"images",
",",
"file_name",
"=",
"None",
",",
"save",
"=",
"True",
",",
"force",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"images",
",",
"list",
")",
":",
"images",
"=",
"["... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | pull | pull an image from a singularity registry
Parameters
==========
images: refers to the uri given by the user to pull in the format
<collection>/<namespace>. You should have an API that is able to
retrieve a container based on parsing this uri.
file_name: the user's requested name for the file.... | sregistry/main/__template__/pull.py | def pull(self, images, file_name=None, save=True, **kwargs):
'''pull an image from a singularity registry
Parameters
==========
images: refers to the uri given by the user to pull in the format
<collection>/<namespace>. You should have an API that is able to
retrieve a container based on pars... | def pull(self, images, file_name=None, save=True, **kwargs):
'''pull an image from a singularity registry
Parameters
==========
images: refers to the uri given by the user to pull in the format
<collection>/<namespace>. You should have an API that is able to
retrieve a container based on pars... | [
"pull",
"an",
"image",
"from",
"a",
"singularity",
"registry",
"Parameters",
"==========",
"images",
":",
"refers",
"to",
"the",
"uri",
"given",
"by",
"the",
"user",
"to",
"pull",
"in",
"the",
"format",
"<collection",
">",
"/",
"<namespace",
">",
".",
"You... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/__template__/pull.py#L16-L98 | [
"def",
"pull",
"(",
"self",
",",
"images",
",",
"file_name",
"=",
"None",
",",
"save",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"# Here we take an entire list or a single image by ensuring we have a list",
"# This makes the client flexible to command line or internal... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | push | push an image to an S3 endpoint | sregistry/main/s3/push.py | def push(self, path, name, tag=None):
'''push an image to an S3 endpoint'''
path = os.path.abspath(path)
image = os.path.basename(path)
bot.debug("PUSH %s" % path)
if not os.path.exists(path):
bot.error('%s does not exist.' %path)
sys.exit(1)
# Extract the metadata
names =... | def push(self, path, name, tag=None):
'''push an image to an S3 endpoint'''
path = os.path.abspath(path)
image = os.path.basename(path)
bot.debug("PUSH %s" % path)
if not os.path.exists(path):
bot.error('%s does not exist.' %path)
sys.exit(1)
# Extract the metadata
names =... | [
"push",
"an",
"image",
"to",
"an",
"S3",
"endpoint"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/s3/push.py#L21-L42 | [
"def",
"push",
"(",
"self",
",",
"path",
",",
"name",
",",
"tag",
"=",
"None",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"path",
")",
"image",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"path",
")",
"bot",
".",
"debug",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_or_create_collection | get a collection if it exists. If it doesn't exist, create it first.
Parameters
==========
name: the collection name, usually parsed from get_image_names()['name'] | sregistry/database/sqlite.py | def get_or_create_collection(self, name):
'''get a collection if it exists. If it doesn't exist, create it first.
Parameters
==========
name: the collection name, usually parsed from get_image_names()['name']
'''
from sregistry.database.models import Collection
collection = self.get_collec... | def get_or_create_collection(self, name):
'''get a collection if it exists. If it doesn't exist, create it first.
Parameters
==========
name: the collection name, usually parsed from get_image_names()['name']
'''
from sregistry.database.models import Collection
collection = self.get_collec... | [
"get",
"a",
"collection",
"if",
"it",
"exists",
".",
"If",
"it",
"doesn",
"t",
"exist",
"create",
"it",
"first",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/database/sqlite.py#L29-L46 | [
"def",
"get_or_create_collection",
"(",
"self",
",",
"name",
")",
":",
"from",
"sregistry",
".",
"database",
".",
"models",
"import",
"Collection",
"collection",
"=",
"self",
".",
"get_collection",
"(",
"name",
")",
"# If it doesn't exist, create it",
"if",
"colle... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_collection | get a collection, if it exists, otherwise return None. | sregistry/database/sqlite.py | def get_collection(self, name):
'''get a collection, if it exists, otherwise return None.
'''
from sregistry.database.models import Collection
return Collection.query.filter(Collection.name == name).first() | def get_collection(self, name):
'''get a collection, if it exists, otherwise return None.
'''
from sregistry.database.models import Collection
return Collection.query.filter(Collection.name == name).first() | [
"get",
"a",
"collection",
"if",
"it",
"exists",
"otherwise",
"return",
"None",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/database/sqlite.py#L49-L53 | [
"def",
"get_collection",
"(",
"self",
",",
"name",
")",
":",
"from",
"sregistry",
".",
"database",
".",
"models",
"import",
"Collection",
"return",
"Collection",
".",
"query",
".",
"filter",
"(",
"Collection",
".",
"name",
"==",
"name",
")",
".",
"first",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_container | get a container, otherwise return None. | sregistry/database/sqlite.py | def get_container(self, name, collection_id, tag="latest", version=None):
'''get a container, otherwise return None.
'''
from sregistry.database.models import Container
if version is None:
container = Container.query.filter_by(collection_id = collection_id,
... | def get_container(self, name, collection_id, tag="latest", version=None):
'''get a container, otherwise return None.
'''
from sregistry.database.models import Container
if version is None:
container = Container.query.filter_by(collection_id = collection_id,
... | [
"get",
"a",
"container",
"otherwise",
"return",
"None",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/database/sqlite.py#L56-L69 | [
"def",
"get_container",
"(",
"self",
",",
"name",
",",
"collection_id",
",",
"tag",
"=",
"\"latest\"",
",",
"version",
"=",
"None",
")",
":",
"from",
"sregistry",
".",
"database",
".",
"models",
"import",
"Container",
"if",
"version",
"is",
"None",
":",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get | Do a get for a container, and then a collection, and then return None
if no result is found.
Parameters
==========
name: should coincide with either the collection name, or the container
name with the collection. A query is done first for the collection,
and then the container, an... | sregistry/database/sqlite.py | def get(self, name, quiet=False):
'''Do a get for a container, and then a collection, and then return None
if no result is found.
Parameters
==========
name: should coincide with either the collection name, or the container
name with the collection. A query is done first for the collect... | def get(self, name, quiet=False):
'''Do a get for a container, and then a collection, and then return None
if no result is found.
Parameters
==========
name: should coincide with either the collection name, or the container
name with the collection. A query is done first for the collect... | [
"Do",
"a",
"get",
"for",
"a",
"container",
"and",
"then",
"a",
"collection",
"and",
"then",
"return",
"None",
"if",
"no",
"result",
"is",
"found",
".",
"Parameters",
"==========",
"name",
":",
"should",
"coincide",
"with",
"either",
"the",
"collection",
"n... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/database/sqlite.py#L76-L110 | [
"def",
"get",
"(",
"self",
",",
"name",
",",
"quiet",
"=",
"False",
")",
":",
"from",
"sregistry",
".",
"database",
".",
"models",
"import",
"Collection",
",",
"Container",
"names",
"=",
"parse_image_name",
"(",
"remove_uri",
"(",
"name",
")",
")",
"# Fi... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | images | List local images in the database, optionally with a query.
Paramters
=========
query: a string to search for in the container or collection name|tag|uri | sregistry/database/sqlite.py | def images(self, query=None):
'''List local images in the database, optionally with a query.
Paramters
=========
query: a string to search for in the container or collection name|tag|uri
'''
from sregistry.database.models import Collection, Container
rows = []
if query is not... | def images(self, query=None):
'''List local images in the database, optionally with a query.
Paramters
=========
query: a string to search for in the container or collection name|tag|uri
'''
from sregistry.database.models import Collection, Container
rows = []
if query is not... | [
"List",
"local",
"images",
"in",
"the",
"database",
"optionally",
"with",
"a",
"query",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/database/sqlite.py#L113-L141 | [
"def",
"images",
"(",
"self",
",",
"query",
"=",
"None",
")",
":",
"from",
"sregistry",
".",
"database",
".",
"models",
"import",
"Collection",
",",
"Container",
"rows",
"=",
"[",
"]",
"if",
"query",
"is",
"not",
"None",
":",
"like",
"=",
"\"%\"",
"+... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | inspect | Inspect a local image in the database, which typically includes the
basic fields in the model. | sregistry/database/sqlite.py | def inspect(self, name):
'''Inspect a local image in the database, which typically includes the
basic fields in the model.
'''
print(name)
container = self.get(name)
if container is not None:
collection = container.collection.name
fields = container.__dict__.copy()
fi... | def inspect(self, name):
'''Inspect a local image in the database, which typically includes the
basic fields in the model.
'''
print(name)
container = self.get(name)
if container is not None:
collection = container.collection.name
fields = container.__dict__.copy()
fi... | [
"Inspect",
"a",
"local",
"image",
"in",
"the",
"database",
"which",
"typically",
"includes",
"the",
"basic",
"fields",
"in",
"the",
"model",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/database/sqlite.py#L144-L159 | [
"def",
"inspect",
"(",
"self",
",",
"name",
")",
":",
"print",
"(",
"name",
")",
"container",
"=",
"self",
".",
"get",
"(",
"name",
")",
"if",
"container",
"is",
"not",
"None",
":",
"collection",
"=",
"container",
".",
"collection",
".",
"name",
"fie... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | rename | rename performs a move, but ensures the path is maintained in storage
Parameters
==========
image_name: the image name (uri) to rename to.
path: the name to rename (basename is taken) | sregistry/database/sqlite.py | def rename(self, image_name, path):
'''rename performs a move, but ensures the path is maintained in storage
Parameters
==========
image_name: the image name (uri) to rename to.
path: the name to rename (basename is taken)
'''
container = self.get(image_name, quiet=True)
i... | def rename(self, image_name, path):
'''rename performs a move, but ensures the path is maintained in storage
Parameters
==========
image_name: the image name (uri) to rename to.
path: the name to rename (basename is taken)
'''
container = self.get(image_name, quiet=True)
i... | [
"rename",
"performs",
"a",
"move",
"but",
"ensures",
"the",
"path",
"is",
"maintained",
"in",
"storage"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/database/sqlite.py#L162-L204 | [
"def",
"rename",
"(",
"self",
",",
"image_name",
",",
"path",
")",
":",
"container",
"=",
"self",
".",
"get",
"(",
"image_name",
",",
"quiet",
"=",
"True",
")",
"if",
"container",
"is",
"not",
"None",
":",
"if",
"container",
".",
"image",
"is",
"not"... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | mv | Move an image from it's current location to a new path.
Removing the image from organized storage is not the recommended approach
however is still a function wanted by some.
Parameters
==========
image_name: the parsed image name.
path: the location to move the image to | sregistry/database/sqlite.py | def mv(self, image_name, path):
'''Move an image from it's current location to a new path.
Removing the image from organized storage is not the recommended approach
however is still a function wanted by some.
Parameters
==========
image_name: the parsed image name.
path: t... | def mv(self, image_name, path):
'''Move an image from it's current location to a new path.
Removing the image from organized storage is not the recommended approach
however is still a function wanted by some.
Parameters
==========
image_name: the parsed image name.
path: t... | [
"Move",
"an",
"image",
"from",
"it",
"s",
"current",
"location",
"to",
"a",
"new",
"path",
".",
"Removing",
"the",
"image",
"from",
"organized",
"storage",
"is",
"not",
"the",
"recommended",
"approach",
"however",
"is",
"still",
"a",
"function",
"wanted",
... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/database/sqlite.py#L208-L249 | [
"def",
"mv",
"(",
"self",
",",
"image_name",
",",
"path",
")",
":",
"container",
"=",
"self",
".",
"get",
"(",
"image_name",
",",
"quiet",
"=",
"True",
")",
"if",
"container",
"is",
"not",
"None",
":",
"name",
"=",
"container",
".",
"uri",
"or",
"c... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | cp | _cp is the shared function between mv (move) and rename, and performs
the move, and returns the updated container
Parameters
==========
image_name: an image_uri to look up a container in the database
container: the container object to move (must have a container.image
move... | sregistry/database/sqlite.py | def cp(self, move_to, image_name=None, container=None, command="copy"):
'''_cp is the shared function between mv (move) and rename, and performs
the move, and returns the updated container
Parameters
==========
image_name: an image_uri to look up a container in the database
c... | def cp(self, move_to, image_name=None, container=None, command="copy"):
'''_cp is the shared function between mv (move) and rename, and performs
the move, and returns the updated container
Parameters
==========
image_name: an image_uri to look up a container in the database
c... | [
"_cp",
"is",
"the",
"shared",
"function",
"between",
"mv",
"(",
"move",
")",
"and",
"rename",
"and",
"performs",
"the",
"move",
"and",
"returns",
"the",
"updated",
"container",
"Parameters",
"==========",
"image_name",
":",
"an",
"image_uri",
"to",
"look",
"... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/database/sqlite.py#L252-L305 | [
"def",
"cp",
"(",
"self",
",",
"move_to",
",",
"image_name",
"=",
"None",
",",
"container",
"=",
"None",
",",
"command",
"=",
"\"copy\"",
")",
":",
"if",
"container",
"is",
"None",
"and",
"image_name",
"is",
"None",
":",
"bot",
".",
"error",
"(",
"'A... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | rmi | Remove an image from the database and filesystem. | sregistry/database/sqlite.py | def rmi(self, image_name):
'''Remove an image from the database and filesystem.
'''
container = self.rm(image_name, delete=True)
if container is not None:
bot.info("[rmi] %s" % container) | def rmi(self, image_name):
'''Remove an image from the database and filesystem.
'''
container = self.rm(image_name, delete=True)
if container is not None:
bot.info("[rmi] %s" % container) | [
"Remove",
"an",
"image",
"from",
"the",
"database",
"and",
"filesystem",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/database/sqlite.py#L308-L313 | [
"def",
"rmi",
"(",
"self",
",",
"image_name",
")",
":",
"container",
"=",
"self",
".",
"rm",
"(",
"image_name",
",",
"delete",
"=",
"True",
")",
"if",
"container",
"is",
"not",
"None",
":",
"bot",
".",
"info",
"(",
"\"[rmi] %s\"",
"%",
"container",
"... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | rm | Remove an image from the database, akin to untagging the image. This
does not delete the file from the cache, unless delete is set to True
(as called by rmi). | sregistry/database/sqlite.py | def rm(self, image_name, delete=False):
'''Remove an image from the database, akin to untagging the image. This
does not delete the file from the cache, unless delete is set to True
(as called by rmi).
'''
container = self.get(image_name)
if container is not None:
name = container.uri or... | def rm(self, image_name, delete=False):
'''Remove an image from the database, akin to untagging the image. This
does not delete the file from the cache, unless delete is set to True
(as called by rmi).
'''
container = self.get(image_name)
if container is not None:
name = container.uri or... | [
"Remove",
"an",
"image",
"from",
"the",
"database",
"akin",
"to",
"untagging",
"the",
"image",
".",
"This",
"does",
"not",
"delete",
"the",
"file",
"from",
"the",
"cache",
"unless",
"delete",
"is",
"set",
"to",
"True",
"(",
"as",
"called",
"by",
"rmi",
... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/database/sqlite.py#L316-L331 | [
"def",
"rm",
"(",
"self",
",",
"image_name",
",",
"delete",
"=",
"False",
")",
":",
"container",
"=",
"self",
".",
"get",
"(",
"image_name",
")",
"if",
"container",
"is",
"not",
"None",
":",
"name",
"=",
"container",
".",
"uri",
"or",
"container",
".... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | add | get or create a container, including the collection to add it to.
This function can be used from a file on the local system, or via a URL
that has been downloaded. Either way, if one of url, version, or image_file
is not provided, the model is created without it. If a version is not
provided but a file ... | sregistry/database/sqlite.py | def add(self, image_path=None,
image_uri=None,
image_name=None,
url=None,
metadata=None,
save=True,
copy=False):
'''get or create a container, including the collection to add it to.
This function can be used from a file on the... | def add(self, image_path=None,
image_uri=None,
image_name=None,
url=None,
metadata=None,
save=True,
copy=False):
'''get or create a container, including the collection to add it to.
This function can be used from a file on the... | [
"get",
"or",
"create",
"a",
"container",
"including",
"the",
"collection",
"to",
"add",
"it",
"to",
".",
"This",
"function",
"can",
"be",
"used",
"from",
"a",
"file",
"on",
"the",
"local",
"system",
"or",
"via",
"a",
"URL",
"that",
"has",
"been",
"down... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/database/sqlite.py#L334-L458 | [
"def",
"add",
"(",
"self",
",",
"image_path",
"=",
"None",
",",
"image_uri",
"=",
"None",
",",
"image_name",
"=",
"None",
",",
"url",
"=",
"None",
",",
"metadata",
"=",
"None",
",",
"save",
"=",
"True",
",",
"copy",
"=",
"False",
")",
":",
"from",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | push | push an image to Singularity Registry | sregistry/main/registry/push.py | def push(self, path, name, tag=None):
'''push an image to Singularity Registry'''
path = os.path.abspath(path)
image = os.path.basename(path)
bot.debug("PUSH %s" % path)
if not os.path.exists(path):
bot.error('%s does not exist.' %path)
sys.exit(1)
# Interaction with a registr... | def push(self, path, name, tag=None):
'''push an image to Singularity Registry'''
path = os.path.abspath(path)
image = os.path.basename(path)
bot.debug("PUSH %s" % path)
if not os.path.exists(path):
bot.error('%s does not exist.' %path)
sys.exit(1)
# Interaction with a registr... | [
"push",
"an",
"image",
"to",
"Singularity",
"Registry"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/registry/push.py#L31-L114 | [
"def",
"push",
"(",
"self",
",",
"path",
",",
"name",
",",
"tag",
"=",
"None",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"path",
")",
"image",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"path",
")",
"bot",
".",
"debug",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | parse_header | take a recipe, and return the complete header, line. If
remove_header is True, only return the value.
Parameters
==========
recipe: the recipe file
headers: the header key to find and parse
remove_header: if true, remove the key | sregistry/utils/recipes.py | def parse_header(recipe, header="from", remove_header=True):
'''take a recipe, and return the complete header, line. If
remove_header is True, only return the value.
Parameters
==========
recipe: the recipe file
headers: the header key to find and parse
remove_header: if t... | def parse_header(recipe, header="from", remove_header=True):
'''take a recipe, and return the complete header, line. If
remove_header is True, only return the value.
Parameters
==========
recipe: the recipe file
headers: the header key to find and parse
remove_header: if t... | [
"take",
"a",
"recipe",
"and",
"return",
"the",
"complete",
"header",
"line",
".",
"If",
"remove_header",
"is",
"True",
"only",
"return",
"the",
"value",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/utils/recipes.py#L32-L58 | [
"def",
"parse_header",
"(",
"recipe",
",",
"header",
"=",
"\"from\"",
",",
"remove_header",
"=",
"True",
")",
":",
"parsed_header",
"=",
"None",
"fromline",
"=",
"[",
"x",
"for",
"x",
"in",
"recipe",
".",
"split",
"(",
"'\\n'",
")",
"if",
"\"%s:\"",
"%... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | find_recipes | find recipes will use a list of base folders, files,
or patterns over a subset of content to find recipe files
(indicated by Starting with Singularity
Parameters
==========
base: if defined, consider folders recursively below this level. | sregistry/utils/recipes.py | def find_recipes(folders, pattern=None, base=None):
'''find recipes will use a list of base folders, files,
or patterns over a subset of content to find recipe files
(indicated by Starting with Singularity
Parameters
==========
base: if defined, consider folders recursively ... | def find_recipes(folders, pattern=None, base=None):
'''find recipes will use a list of base folders, files,
or patterns over a subset of content to find recipe files
(indicated by Starting with Singularity
Parameters
==========
base: if defined, consider folders recursively ... | [
"find",
"recipes",
"will",
"use",
"a",
"list",
"of",
"base",
"folders",
"files",
"or",
"patterns",
"over",
"a",
"subset",
"of",
"content",
"to",
"find",
"recipe",
"files",
"(",
"indicated",
"by",
"Starting",
"with",
"Singularity",
"Parameters",
"==========",
... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/utils/recipes.py#L62-L101 | [
"def",
"find_recipes",
"(",
"folders",
",",
"pattern",
"=",
"None",
",",
"base",
"=",
"None",
")",
":",
"# If the user doesn't provide a list of folders, use $PWD",
"if",
"folders",
"is",
"None",
":",
"folders",
"=",
"os",
".",
"getcwd",
"(",
")",
"if",
"not",... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | find_folder_recipes | find folder recipes will find recipes based on a particular pattern.
Parameters
==========
base_folder: the base folder to recursively walk
pattern: a default pattern to search for
manifest: an already started manifest
base: if defined, consider folders under this level... | sregistry/utils/recipes.py | def find_folder_recipes(base_folder,
pattern="Singularity",
manifest=None,
base=None):
'''find folder recipes will find recipes based on a particular pattern.
Parameters
==========
base_folder: the base folder to r... | def find_folder_recipes(base_folder,
pattern="Singularity",
manifest=None,
base=None):
'''find folder recipes will find recipes based on a particular pattern.
Parameters
==========
base_folder: the base folder to r... | [
"find",
"folder",
"recipes",
"will",
"find",
"recipes",
"based",
"on",
"a",
"particular",
"pattern",
".",
"Parameters",
"==========",
"base_folder",
":",
"the",
"base",
"folder",
"to",
"recursively",
"walk",
"pattern",
":",
"a",
"default",
"pattern",
"to",
"se... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/utils/recipes.py#L104-L148 | [
"def",
"find_folder_recipes",
"(",
"base_folder",
",",
"pattern",
"=",
"\"Singularity\"",
",",
"manifest",
"=",
"None",
",",
"base",
"=",
"None",
")",
":",
"# The user is not appending to an existing manifest",
"if",
"manifest",
"is",
"None",
":",
"manifest",
"=",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | find_single_recipe | find_single_recipe will parse a single file, and if valid,
return an updated manifest
Parameters
==========
filename: the filename to assess for a recipe
pattern: a default pattern to search for
manifest: an already started manifest | sregistry/utils/recipes.py | def find_single_recipe(filename, pattern="Singularity", manifest=None):
'''find_single_recipe will parse a single file, and if valid,
return an updated manifest
Parameters
==========
filename: the filename to assess for a recipe
pattern: a default pattern to search for
man... | def find_single_recipe(filename, pattern="Singularity", manifest=None):
'''find_single_recipe will parse a single file, and if valid,
return an updated manifest
Parameters
==========
filename: the filename to assess for a recipe
pattern: a default pattern to search for
man... | [
"find_single_recipe",
"will",
"parse",
"a",
"single",
"file",
"and",
"if",
"valid",
"return",
"an",
"updated",
"manifest"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/utils/recipes.py#L151-L182 | [
"def",
"find_single_recipe",
"(",
"filename",
",",
"pattern",
"=",
"\"Singularity\"",
",",
"manifest",
"=",
"None",
")",
":",
"if",
"pattern",
"is",
"None",
":",
"pattern",
"=",
"\"Singularity*\"",
"recipe",
"=",
"None",
"file_basename",
"=",
"os",
".",
"pat... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | build | trigger a build on Google Cloud (builder then storage) given a name
recipe, and Github URI where the recipe can be found.
Parameters
==========
recipe: the local recipe to build.
name: should be the complete uri that the user has requested to push.
context: the dependency ... | sregistry/main/google_build/build.py | def build(self, name,
recipe="Singularity",
context=None,
preview=False):
'''trigger a build on Google Cloud (builder then storage) given a name
recipe, and Github URI where the recipe can be found.
Parameters
==========
recipe: the ... | def build(self, name,
recipe="Singularity",
context=None,
preview=False):
'''trigger a build on Google Cloud (builder then storage) given a name
recipe, and Github URI where the recipe can be found.
Parameters
==========
recipe: the ... | [
"trigger",
"a",
"build",
"on",
"Google",
"Cloud",
"(",
"builder",
"then",
"storage",
")",
"given",
"a",
"name",
"recipe",
"and",
"Github",
"URI",
"where",
"the",
"recipe",
"can",
"be",
"found",
".",
"Parameters",
"==========",
"recipe",
":",
"the",
"local"... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_build/build.py#L33-L102 | [
"def",
"build",
"(",
"self",
",",
"name",
",",
"recipe",
"=",
"\"Singularity\"",
",",
"context",
"=",
"None",
",",
"preview",
"=",
"False",
")",
":",
"bot",
".",
"debug",
"(",
"\"BUILD %s\"",
"%",
"recipe",
")",
"# This returns a data structure with collection... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | create_build_package | given a list of files, copy them to a temporary folder,
compress into a .tar.gz, and rename based on the file hash.
Return the full path to the .tar.gz in the temporary folder.
Parameters
==========
package_files: a list of files to include in the tar.gz | sregistry/main/google_build/build.py | def create_build_package(package_files):
'''given a list of files, copy them to a temporary folder,
compress into a .tar.gz, and rename based on the file hash.
Return the full path to the .tar.gz in the temporary folder.
Parameters
==========
package_files: a list of files to inc... | def create_build_package(package_files):
'''given a list of files, copy them to a temporary folder,
compress into a .tar.gz, and rename based on the file hash.
Return the full path to the .tar.gz in the temporary folder.
Parameters
==========
package_files: a list of files to inc... | [
"given",
"a",
"list",
"of",
"files",
"copy",
"them",
"to",
"a",
"temporary",
"folder",
"compress",
"into",
"a",
".",
"tar",
".",
"gz",
"and",
"rename",
"based",
"on",
"the",
"file",
"hash",
".",
"Return",
"the",
"full",
"path",
"to",
"the",
".",
"tar... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_build/build.py#L106-L135 | [
"def",
"create_build_package",
"(",
"package_files",
")",
":",
"# Ensure package files all exist",
"for",
"package_file",
"in",
"package_files",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"package_file",
")",
":",
"bot",
".",
"exit",
"(",
"'Cannot ... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | load_build_config | load a google compute config, meaning that we start with a template,
and mimic the following example cloudbuild.yaml:
steps:
- name: "singularityware/singularity:${_SINGULARITY_VERSION}"
args: ['build', 'julia-centos-another.sif', 'julia.def']
artifacts:
objects:
... | sregistry/main/google_build/build.py | def load_build_config(self, name, recipe):
'''load a google compute config, meaning that we start with a template,
and mimic the following example cloudbuild.yaml:
steps:
- name: "singularityware/singularity:${_SINGULARITY_VERSION}"
args: ['build', 'julia-centos-another.sif', 'juli... | def load_build_config(self, name, recipe):
'''load a google compute config, meaning that we start with a template,
and mimic the following example cloudbuild.yaml:
steps:
- name: "singularityware/singularity:${_SINGULARITY_VERSION}"
args: ['build', 'julia-centos-another.sif', 'juli... | [
"load",
"a",
"google",
"compute",
"config",
"meaning",
"that",
"we",
"start",
"with",
"a",
"template",
"and",
"mimic",
"the",
"following",
"example",
"cloudbuild",
".",
"yaml",
":"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_build/build.py#L138-L171 | [
"def",
"load_build_config",
"(",
"self",
",",
"name",
",",
"recipe",
")",
":",
"version_envar",
"=",
"'SREGISTRY_GOOGLE_BUILD_SINGULARITY_VERSION'",
"version",
"=",
"self",
".",
"_get_and_update_setting",
"(",
"version_envar",
",",
"'3.0.2-slim'",
")",
"config",
"=",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | run_build | run a build, meaning creating a build. Retry if there is failure | sregistry/main/google_build/build.py | def run_build(self, config, bucket, names):
'''run a build, meaning creating a build. Retry if there is failure
'''
project = self._get_project()
# prefix, message, color
bot.custom('PROJECT', project, "CYAN")
bot.custom('BUILD ', config['steps'][0]['name'], "CYAN")
response ... | def run_build(self, config, bucket, names):
'''run a build, meaning creating a build. Retry if there is failure
'''
project = self._get_project()
# prefix, message, color
bot.custom('PROJECT', project, "CYAN")
bot.custom('BUILD ', config['steps'][0]['name'], "CYAN")
response ... | [
"run",
"a",
"build",
"meaning",
"creating",
"a",
"build",
".",
"Retry",
"if",
"there",
"is",
"failure"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_build/build.py#L174-L222 | [
"def",
"run_build",
"(",
"self",
",",
"config",
",",
"bucket",
",",
"names",
")",
":",
"project",
"=",
"self",
".",
"_get_project",
"(",
")",
"# prefix, message, color",
"bot",
".",
"custom",
"(",
"'PROJECT'",
",",
"project",
",",
"\"CYAN\"",
")"... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | update_blob_metadata | a specific function to take a blob, along with a SUCCESS response
from Google build, the original config, and update the blob
metadata with the artifact file name, dependencies, and image hash. | sregistry/main/google_build/build.py | def update_blob_metadata(blob, response, config, bucket, names):
'''a specific function to take a blob, along with a SUCCESS response
from Google build, the original config, and update the blob
metadata with the artifact file name, dependencies, and image hash.
'''
manifest = os.path.basenam... | def update_blob_metadata(blob, response, config, bucket, names):
'''a specific function to take a blob, along with a SUCCESS response
from Google build, the original config, and update the blob
metadata with the artifact file name, dependencies, and image hash.
'''
manifest = os.path.basenam... | [
"a",
"specific",
"function",
"to",
"take",
"a",
"blob",
"along",
"with",
"a",
"SUCCESS",
"response",
"from",
"Google",
"build",
"the",
"original",
"config",
"and",
"update",
"the",
"blob",
"metadata",
"with",
"the",
"artifact",
"file",
"name",
"dependencies",
... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_build/build.py#L226-L250 | [
"def",
"update_blob_metadata",
"(",
"blob",
",",
"response",
",",
"config",
",",
"bucket",
",",
"names",
")",
":",
"manifest",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"response",
"[",
"'results'",
"]",
"[",
"'artifactManifest'",
"]",
")",
"manifest",... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | search | query a Singularity registry for a list of images.
If query is None, collections are listed.
EXAMPLE QUERIES: | sregistry/main/__template__/query.py | def search(self, query=None, args=None):
'''query a Singularity registry for a list of images.
If query is None, collections are listed.
EXAMPLE QUERIES:
'''
# You can optionally better parse the image uri (query), but not
# necessary
# names = parse_image_name(remove_uri(query))
... | def search(self, query=None, args=None):
'''query a Singularity registry for a list of images.
If query is None, collections are listed.
EXAMPLE QUERIES:
'''
# You can optionally better parse the image uri (query), but not
# necessary
# names = parse_image_name(remove_uri(query))
... | [
"query",
"a",
"Singularity",
"registry",
"for",
"a",
"list",
"of",
"images",
".",
"If",
"query",
"is",
"None",
"collections",
"are",
"listed",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/__template__/query.py#L18-L37 | [
"def",
"search",
"(",
"self",
",",
"query",
"=",
"None",
",",
"args",
"=",
"None",
")",
":",
"# You can optionally better parse the image uri (query), but not",
"# necessary",
"# names = parse_image_name(remove_uri(query))",
"if",
"query",
"is",
"not",
"None",
":",
"# H... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | search_all | a "show all" search that doesn't require a query | sregistry/main/__template__/query.py | def search_all(self):
'''a "show all" search that doesn't require a query'''
# This should be your apis url for a search
url = '...'
# paginte get is what it sounds like, and what you want for multiple
# pages of results
results = self._paginate_get(url)
if len(results) == 0:
b... | def search_all(self):
'''a "show all" search that doesn't require a query'''
# This should be your apis url for a search
url = '...'
# paginte get is what it sounds like, and what you want for multiple
# pages of results
results = self._paginate_get(url)
if len(results) == 0:
b... | [
"a",
"show",
"all",
"search",
"that",
"doesn",
"t",
"require",
"a",
"query"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/__template__/query.py#L46-L73 | [
"def",
"search_all",
"(",
"self",
")",
":",
"# This should be your apis url for a search",
"url",
"=",
"'...'",
"# paginte get is what it sounds like, and what you want for multiple",
"# pages of results",
"results",
"=",
"self",
".",
"_paginate_get",
"(",
"url",
")",
"if",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | parse_image_name | return a collection and repo name and tag
for an image file.
Parameters
=========
image_name: a user provided string indicating a collection,
image, and optionally a tag.
tag: optionally specify tag as its own argument
over-rides parsed image tag
defaults: use defau... | sregistry/utils/names.py | def parse_image_name(image_name,
tag=None,
version=None,
defaults=True,
ext="sif",
default_collection="library",
default_tag="latest",
base=None,
lowe... | def parse_image_name(image_name,
tag=None,
version=None,
defaults=True,
ext="sif",
default_collection="library",
default_tag="latest",
base=None,
lowe... | [
"return",
"a",
"collection",
"and",
"repo",
"name",
"and",
"tag",
"for",
"an",
"image",
"file",
".",
"Parameters",
"=========",
"image_name",
":",
"a",
"user",
"provided",
"string",
"indicating",
"a",
"collection",
"image",
"and",
"optionally",
"a",
"tag",
"... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/utils/names.py#L70-L180 | [
"def",
"parse_image_name",
"(",
"image_name",
",",
"tag",
"=",
"None",
",",
"version",
"=",
"None",
",",
"defaults",
"=",
"True",
",",
"ext",
"=",
"\"sif\"",
",",
"default_collection",
"=",
"\"library\"",
",",
"default_tag",
"=",
"\"latest\"",
",",
"base",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | format_container_name | format_container_name will take a name supplied by the user,
remove all special characters (except for those defined by "special-characters"
and return the new image name. | sregistry/utils/names.py | def format_container_name(name, special_characters=None):
'''format_container_name will take a name supplied by the user,
remove all special characters (except for those defined by "special-characters"
and return the new image name.
'''
if special_characters is None:
special_characters = []
... | def format_container_name(name, special_characters=None):
'''format_container_name will take a name supplied by the user,
remove all special characters (except for those defined by "special-characters"
and return the new image name.
'''
if special_characters is None:
special_characters = []
... | [
"format_container_name",
"will",
"take",
"a",
"name",
"supplied",
"by",
"the",
"user",
"remove",
"all",
"special",
"characters",
"(",
"except",
"for",
"those",
"defined",
"by",
"special",
"-",
"characters",
"and",
"return",
"the",
"new",
"image",
"name",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/utils/names.py#L183-L191 | [
"def",
"format_container_name",
"(",
"name",
",",
"special_characters",
"=",
"None",
")",
":",
"if",
"special_characters",
"is",
"None",
":",
"special_characters",
"=",
"[",
"]",
"return",
"''",
".",
"join",
"(",
"e",
".",
"lower",
"(",
")",
"for",
"e",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_uri | get the uri for an image, if within acceptable
Parameters
==========
image: the image uri, in the format <uri>://<registry>/<namespace>:<tag> | sregistry/utils/names.py | def get_uri(image):
'''get the uri for an image, if within acceptable
Parameters
==========
image: the image uri, in the format <uri>://<registry>/<namespace>:<tag>
'''
# Ensure we have a string
image = image or ''
# Find uri prefix, including ://
regexp = re.compile('^.... | def get_uri(image):
'''get the uri for an image, if within acceptable
Parameters
==========
image: the image uri, in the format <uri>://<registry>/<namespace>:<tag>
'''
# Ensure we have a string
image = image or ''
# Find uri prefix, including ://
regexp = re.compile('^.... | [
"get",
"the",
"uri",
"for",
"an",
"image",
"if",
"within",
"acceptable",
"Parameters",
"==========",
"image",
":",
"the",
"image",
"uri",
"in",
"the",
"format",
"<uri",
">",
":",
"//",
"<registry",
">",
"/",
"<namespace",
">",
":",
"<tag",
">"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/utils/names.py#L194-L236 | [
"def",
"get_uri",
"(",
"image",
")",
":",
"# Ensure we have a string",
"image",
"=",
"image",
"or",
"''",
"# Find uri prefix, including ://",
"regexp",
"=",
"re",
".",
"compile",
"(",
"'^.+://'",
")",
"uri",
"=",
"regexp",
".",
"match",
"(",
"image",
")",
"i... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | pull | pull an image from storage using Swift. The image is found based on the
storage uri
Parameters
==========
images: refers to the uri given by the user to pull in the format
<collection>/<namespace>. You should have an API that is able to
retrieve a container based on parsing ... | sregistry/main/swift/pull.py | def pull(self, images, file_name=None, save=True, **kwargs):
'''pull an image from storage using Swift. The image is found based on the
storage uri
Parameters
==========
images: refers to the uri given by the user to pull in the format
<collection>/<namespace>. You should have a... | def pull(self, images, file_name=None, save=True, **kwargs):
'''pull an image from storage using Swift. The image is found based on the
storage uri
Parameters
==========
images: refers to the uri given by the user to pull in the format
<collection>/<namespace>. You should have a... | [
"pull",
"an",
"image",
"from",
"storage",
"using",
"Swift",
".",
"The",
"image",
"is",
"found",
"based",
"on",
"the",
"storage",
"uri",
"Parameters",
"==========",
"images",
":",
"refers",
"to",
"the",
"uri",
"given",
"by",
"the",
"user",
"to",
"pull",
"... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/swift/pull.py#L17-L108 | [
"def",
"pull",
"(",
"self",
",",
"images",
",",
"file_name",
"=",
"None",
",",
"save",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"force",
"=",
"False",
"if",
"\"force\"",
"in",
"kwargs",
":",
"force",
"=",
"kwargs",
"[",
"'force'",
"]",
"if",... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | push | push an image to Google Cloud Drive, meaning uploading it
path: should correspond to an absolte image path (or derive it)
name: should be the complete uri that the user has requested to push.
tag: should correspond with an image tag. This is provided to mirror Docker | sregistry/main/google_drive/push.py | def push(self, path, name, tag=None):
'''push an image to Google Cloud Drive, meaning uploading it
path: should correspond to an absolte image path (or derive it)
name: should be the complete uri that the user has requested to push.
tag: should correspond with an image tag. This is provided to mirr... | def push(self, path, name, tag=None):
'''push an image to Google Cloud Drive, meaning uploading it
path: should correspond to an absolte image path (or derive it)
name: should be the complete uri that the user has requested to push.
tag: should correspond with an image tag. This is provided to mirr... | [
"push",
"an",
"image",
"to",
"Google",
"Cloud",
"Drive",
"meaning",
"uploading",
"it",
"path",
":",
"should",
"correspond",
"to",
"an",
"absolte",
"image",
"path",
"(",
"or",
"derive",
"it",
")",
"name",
":",
"should",
"be",
"the",
"complete",
"uri",
"th... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_drive/push.py#L28-L90 | [
"def",
"push",
"(",
"self",
",",
"path",
",",
"name",
",",
"tag",
"=",
"None",
")",
":",
"# The root of the drive for containers (the parent folder)",
"parent",
"=",
"self",
".",
"_get_or_create_folder",
"(",
"self",
".",
"_base",
")",
"image",
"=",
"None",
"p... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | Client._set_base | set the API base or default to use Docker Hub. The user is able
to set the base, api version, and protocol via a settings file
of environment variables: | sregistry/main/aws/__init__.py | def _set_base(self, zone=None):
'''set the API base or default to use Docker Hub. The user is able
to set the base, api version, and protocol via a settings file
of environment variables:
'''
if hasattr(self.aws._client_config, 'region_name'):
zone = self.aws._c... | def _set_base(self, zone=None):
'''set the API base or default to use Docker Hub. The user is able
to set the base, api version, and protocol via a settings file
of environment variables:
'''
if hasattr(self.aws._client_config, 'region_name'):
zone = self.aws._c... | [
"set",
"the",
"API",
"base",
"or",
"default",
"to",
"use",
"Docker",
"Hub",
".",
"The",
"user",
"is",
"able",
"to",
"set",
"the",
"base",
"api",
"version",
"and",
"protocol",
"via",
"a",
"settings",
"file",
"of",
"environment",
"variables",
":"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/aws/__init__.py#L70-L93 | [
"def",
"_set_base",
"(",
"self",
",",
"zone",
"=",
"None",
")",
":",
"if",
"hasattr",
"(",
"self",
".",
"aws",
".",
"_client_config",
",",
"'region_name'",
")",
":",
"zone",
"=",
"self",
".",
"aws",
".",
"_client_config",
".",
"region_name",
"aws_id",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | Client._update_secrets | update secrets will take a secrets credential file
either located at .sregistry or the environment variable
SREGISTRY_CLIENT_SECRETS and update the current client
secrets as well as the associated API base. For the case of
using Docker Hub, if we find a .docker secrets file,... | sregistry/main/aws/__init__.py | def _update_secrets(self):
'''update secrets will take a secrets credential file
either located at .sregistry or the environment variable
SREGISTRY_CLIENT_SECRETS and update the current client
secrets as well as the associated API base. For the case of
using Docker H... | def _update_secrets(self):
'''update secrets will take a secrets credential file
either located at .sregistry or the environment variable
SREGISTRY_CLIENT_SECRETS and update the current client
secrets as well as the associated API base. For the case of
using Docker H... | [
"update",
"secrets",
"will",
"take",
"a",
"secrets",
"credential",
"file",
"either",
"located",
"at",
".",
"sregistry",
"or",
"the",
"environment",
"variable",
"SREGISTRY_CLIENT_SECRETS",
"and",
"update",
"the",
"current",
"client",
"secrets",
"as",
"well",
"as",
... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/aws/__init__.py#L95-L110 | [
"def",
"_update_secrets",
"(",
"self",
")",
":",
"bot",
".",
"debug",
"(",
"'Creating aws client...'",
")",
"try",
":",
"from",
"awscli",
".",
"clidriver",
"import",
"create_clidriver",
"except",
":",
"bot",
".",
"exit",
"(",
"'Please install pip install sregistry... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_logging_level | get_logging_level will configure a logging to standard out based on the user's
selected level, which should be in an environment variable called
MESSAGELEVEL. if MESSAGELEVEL is not set, the maximum level
(5) is assumed (all messages). | sregistry/logger/message.py | def get_logging_level():
'''get_logging_level will configure a logging to standard out based on the user's
selected level, which should be in an environment variable called
MESSAGELEVEL. if MESSAGELEVEL is not set, the maximum level
(5) is assumed (all messages).
'''
level = os.environ.get("MESS... | def get_logging_level():
'''get_logging_level will configure a logging to standard out based on the user's
selected level, which should be in an environment variable called
MESSAGELEVEL. if MESSAGELEVEL is not set, the maximum level
(5) is assumed (all messages).
'''
level = os.environ.get("MESS... | [
"get_logging_level",
"will",
"configure",
"a",
"logging",
"to",
"standard",
"out",
"based",
"on",
"the",
"user",
"s",
"selected",
"level",
"which",
"should",
"be",
"in",
"an",
"environment",
"variable",
"called",
"MESSAGELEVEL",
".",
"if",
"MESSAGELEVEL",
"is",
... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/logger/message.py#L294-L328 | [
"def",
"get_logging_level",
"(",
")",
":",
"level",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"\"MESSAGELEVEL\"",
",",
"INFO",
")",
"# User knows logging levels and set one",
"if",
"isinstance",
"(",
"level",
",",
"int",
")",
":",
"return",
"level",
"# Other... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.