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 | download_task | download an image layer (.tar.gz) to a specified download folder.
This task is done by using local versions of the same download functions
that are used for the client.
core stream/download functions of the parent client.
Parameters
==========
image_id: the shasum id of the la... | sregistry/main/workers/tasks.py | def download_task(url, headers, destination, download_type='layer'):
'''download an image layer (.tar.gz) to a specified download folder.
This task is done by using local versions of the same download functions
that are used for the client.
core stream/download functions of the parent client.
... | def download_task(url, headers, destination, download_type='layer'):
'''download an image layer (.tar.gz) to a specified download folder.
This task is done by using local versions of the same download functions
that are used for the client.
core stream/download functions of the parent client.
... | [
"download",
"an",
"image",
"layer",
"(",
".",
"tar",
".",
"gz",
")",
"to",
"a",
"specified",
"download",
"folder",
".",
"This",
"task",
"is",
"done",
"by",
"using",
"local",
"versions",
"of",
"the",
"same",
"download",
"functions",
"that",
"are",
"used",... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/workers/tasks.py#L28-L59 | [
"def",
"download_task",
"(",
"url",
",",
"headers",
",",
"destination",
",",
"download_type",
"=",
"'layer'",
")",
":",
"# Update the user what we are doing",
"bot",
".",
"verbose",
"(",
"\"Downloading %s from %s\"",
"%",
"(",
"download_type",
",",
"url",
")",
")"... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | post | post will use requests to get a particular url | sregistry/main/workers/tasks.py | def post(url,data=None,return_json=True):
'''post will use requests to get a particular url
'''
bot.debug("POST %s" %url)
return call(url,
headers=headers,
func=requests.post,
data=data,
return_json=return_json) | def post(url,data=None,return_json=True):
'''post will use requests to get a particular url
'''
bot.debug("POST %s" %url)
return call(url,
headers=headers,
func=requests.post,
data=data,
return_json=return_json) | [
"post",
"will",
"use",
"requests",
"to",
"get",
"a",
"particular",
"url"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/workers/tasks.py#L73-L81 | [
"def",
"post",
"(",
"url",
",",
"data",
"=",
"None",
",",
"return_json",
"=",
"True",
")",
":",
"bot",
".",
"debug",
"(",
"\"POST %s\"",
"%",
"url",
")",
"return",
"call",
"(",
"url",
",",
"headers",
"=",
"headers",
",",
"func",
"=",
"requests",
".... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get | get will use requests to get a particular url | sregistry/main/workers/tasks.py | def get(url,headers=None,token=None,data=None,return_json=True):
'''get will use requests to get a particular url
'''
bot.debug("GET %s" %url)
return call(url,
headers=headers,
func=requests.get,
data=data,
return_json=return_json) | def get(url,headers=None,token=None,data=None,return_json=True):
'''get will use requests to get a particular url
'''
bot.debug("GET %s" %url)
return call(url,
headers=headers,
func=requests.get,
data=data,
return_json=return_json) | [
"get",
"will",
"use",
"requests",
"to",
"get",
"a",
"particular",
"url"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/workers/tasks.py#L84-L92 | [
"def",
"get",
"(",
"url",
",",
"headers",
"=",
"None",
",",
"token",
"=",
"None",
",",
"data",
"=",
"None",
",",
"return_json",
"=",
"True",
")",
":",
"bot",
".",
"debug",
"(",
"\"GET %s\"",
"%",
"url",
")",
"return",
"call",
"(",
"url",
",",
"he... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | call | call will issue the call, and issue a refresh token
given a 401 response, and if the client has a _update_token function
Parameters
==========
func: the function (eg, post, get) to call
url: the url to send file to
headers: headers for the request
data: additional data to add to the request... | sregistry/main/workers/tasks.py | def call(url, func, data=None, headers=None,
return_json=True, stream=False,
retry=True):
'''call will issue the call, and issue a refresh token
given a 401 response, and if the client has a _update_token function
Parameters
==========
func: the function (... | def call(url, func, data=None, headers=None,
return_json=True, stream=False,
retry=True):
'''call will issue the call, and issue a refresh token
given a 401 response, and if the client has a _update_token function
Parameters
==========
func: the function (... | [
"call",
"will",
"issue",
"the",
"call",
"and",
"issue",
"a",
"refresh",
"token",
"given",
"a",
"401",
"response",
"and",
"if",
"the",
"client",
"has",
"a",
"_update_token",
"function"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/workers/tasks.py#L178-L247 | [
"def",
"call",
"(",
"url",
",",
"func",
",",
"data",
"=",
"None",
",",
"headers",
"=",
"None",
",",
"return_json",
"=",
"True",
",",
"stream",
"=",
"False",
",",
"retry",
"=",
"True",
")",
":",
"if",
"DISABLE_SSL_CHECK",
"is",
"True",
":",
"bot",
"... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | require_secrets | require secrets ensures that the client has the secrets file, and
specifically has one or more parameters defined. If params is None,
only a check is done for the file.
Parameters
==========
params: a list of keys to lookup in the client secrets, eg:
secrets[client_name][p... | sregistry/main/base/auth.py | def require_secrets(self, params=None):
'''require secrets ensures that the client has the secrets file, and
specifically has one or more parameters defined. If params is None,
only a check is done for the file.
Parameters
==========
params: a list of keys to lookup in the client... | def require_secrets(self, params=None):
'''require secrets ensures that the client has the secrets file, and
specifically has one or more parameters defined. If params is None,
only a check is done for the file.
Parameters
==========
params: a list of keys to lookup in the client... | [
"require",
"secrets",
"ensures",
"that",
"the",
"client",
"has",
"the",
"secrets",
"file",
"and",
"specifically",
"has",
"one",
"or",
"more",
"parameters",
"defined",
".",
"If",
"params",
"is",
"None",
"only",
"a",
"check",
"is",
"done",
"for",
"the",
"fil... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/base/auth.py#L17-L75 | [
"def",
"require_secrets",
"(",
"self",
",",
"params",
"=",
"None",
")",
":",
"name",
"=",
"self",
".",
"client_name",
"# Check 1: the client must have secrets, period",
"has_secrets",
"=",
"True",
"# Secrets file not asked for (incorrectly) but still wanted",
"# The client sh... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | auth_flow | auth flow is a function to present the user with a url to retrieve
some token/code, and then copy paste it back in the terminal.
Parameters
==========
url should be a url that is generated for the user to go to and accept
getting a credential in the browser. | sregistry/main/base/auth.py | def auth_flow(self, url):
'''auth flow is a function to present the user with a url to retrieve
some token/code, and then copy paste it back in the terminal.
Parameters
==========
url should be a url that is generated for the user to go to and accept
getting a credential in t... | def auth_flow(self, url):
'''auth flow is a function to present the user with a url to retrieve
some token/code, and then copy paste it back in the terminal.
Parameters
==========
url should be a url that is generated for the user to go to and accept
getting a credential in t... | [
"auth",
"flow",
"is",
"a",
"function",
"to",
"present",
"the",
"user",
"with",
"a",
"url",
"to",
"retrieve",
"some",
"token",
"/",
"code",
"and",
"then",
"copy",
"paste",
"it",
"back",
"in",
"the",
"terminal",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/base/auth.py#L78-L92 | [
"def",
"auth_flow",
"(",
"self",
",",
"url",
")",
":",
"print",
"(",
"'Please go to this URL and login: {0}'",
".",
"format",
"(",
"url",
")",
")",
"get_input",
"=",
"getattr",
"(",
"__builtins__",
",",
"'raw_input'",
",",
"input",
")",
"message",
"=",
"'Ple... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | download | stream to a temporary file, rename on successful completion
Parameters
==========
file_name: the file name to stream to
url: the url to stream from
headers: additional headers to add | sregistry/main/workers/aws.py | def download(url, file_name, headers=None, show_progress=True):
'''stream to a temporary file, rename on successful completion
Parameters
==========
file_name: the file name to stream to
url: the url to stream from
headers: additional headers to add
'''
fd, tmp_file... | def download(url, file_name, headers=None, show_progress=True):
'''stream to a temporary file, rename on successful completion
Parameters
==========
file_name: the file name to stream to
url: the url to stream from
headers: additional headers to add
'''
fd, tmp_file... | [
"stream",
"to",
"a",
"temporary",
"file",
"rename",
"on",
"successful",
"completion"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/workers/aws.py#L75-L94 | [
"def",
"download",
"(",
"url",
",",
"file_name",
",",
"headers",
"=",
"None",
",",
"show_progress",
"=",
"True",
")",
":",
"fd",
",",
"tmp_file",
"=",
"tempfile",
".",
"mkstemp",
"(",
"prefix",
"=",
"(",
"\"%s.tmp.\"",
"%",
"file_name",
")",
")",
"os",... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | stream | stream is a get that will stream to file_name. Since this is a worker
task, it differs from the client provided version in that it requires
headers. | sregistry/main/workers/aws.py | def stream(url, headers, stream_to=None, retry=True):
'''stream is a get that will stream to file_name. Since this is a worker
task, it differs from the client provided version in that it requires
headers.
'''
bot.debug("GET %s" % url)
if DISABLE_SSL_CHECK is True:
bot.warning('Ve... | def stream(url, headers, stream_to=None, retry=True):
'''stream is a get that will stream to file_name. Since this is a worker
task, it differs from the client provided version in that it requires
headers.
'''
bot.debug("GET %s" % url)
if DISABLE_SSL_CHECK is True:
bot.warning('Ve... | [
"stream",
"is",
"a",
"get",
"that",
"will",
"stream",
"to",
"file_name",
".",
"Since",
"this",
"is",
"a",
"worker",
"task",
"it",
"differs",
"from",
"the",
"client",
"provided",
"version",
"in",
"that",
"it",
"requires",
"headers",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/workers/aws.py#L97-L145 | [
"def",
"stream",
"(",
"url",
",",
"headers",
",",
"stream_to",
"=",
"None",
",",
"retry",
"=",
"True",
")",
":",
"bot",
".",
"debug",
"(",
"\"GET %s\"",
"%",
"url",
")",
"if",
"DISABLE_SSL_CHECK",
"is",
"True",
":",
"bot",
".",
"warning",
"(",
"'Veri... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | update_token | update_token uses HTTP basic authentication to attempt to authenticate
given a 401 response. We take as input previous headers, and update
them.
Parameters
==========
response: the http request response to parse for the challenge. | sregistry/main/workers/aws.py | def update_token(headers):
'''update_token uses HTTP basic authentication to attempt to authenticate
given a 401 response. We take as input previous headers, and update
them.
Parameters
==========
response: the http request response to parse for the challenge.
'''
try:
fro... | def update_token(headers):
'''update_token uses HTTP basic authentication to attempt to authenticate
given a 401 response. We take as input previous headers, and update
them.
Parameters
==========
response: the http request response to parse for the challenge.
'''
try:
fro... | [
"update_token",
"uses",
"HTTP",
"basic",
"authentication",
"to",
"attempt",
"to",
"authenticate",
"given",
"a",
"401",
"response",
".",
"We",
"take",
"as",
"input",
"previous",
"headers",
"and",
"update",
"them",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/workers/aws.py#L149-L177 | [
"def",
"update_token",
"(",
"headers",
")",
":",
"try",
":",
"from",
"awscli",
".",
"clidriver",
"import",
"create_clidriver",
"except",
":",
"bot",
".",
"exit",
"(",
"'Please install pip install sregistry[aws]'",
")",
"driver",
"=",
"create_clidriver",
"(",
")",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_or_create_folder | create a folder at the drive root. If the folder already exists,
it is simply returned.
folder = self._get_or_create_folder(self._base)
$ folder
{'id': '1pXR5S8wufELh9Q-jDkhCoYu-BL1NqN9y'} | sregistry/main/google_drive/utils.py | def get_or_create_folder(self, folder):
'''create a folder at the drive root. If the folder already exists,
it is simply returned.
folder = self._get_or_create_folder(self._base)
$ folder
{'id': '1pXR5S8wufELh9Q-jDkhCoYu-BL1NqN9y'}
'''
q = "mimeType='application/v... | def get_or_create_folder(self, folder):
'''create a folder at the drive root. If the folder already exists,
it is simply returned.
folder = self._get_or_create_folder(self._base)
$ folder
{'id': '1pXR5S8wufELh9Q-jDkhCoYu-BL1NqN9y'}
'''
q = "mimeType='application/v... | [
"create",
"a",
"folder",
"at",
"the",
"drive",
"root",
".",
"If",
"the",
"folder",
"already",
"exists",
"it",
"is",
"simply",
"returned",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_drive/utils.py#L13-L31 | [
"def",
"get_or_create_folder",
"(",
"self",
",",
"folder",
")",
":",
"q",
"=",
"\"mimeType='application/vnd.google-apps.folder' and name='%s'\"",
"%",
"folder",
"response",
"=",
"self",
".",
"_service",
".",
"files",
"(",
")",
".",
"list",
"(",
"q",
"=",
"q",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | create_folder | create a folder with a particular name. Be careful, if the folder
already exists you can still create one (a different one) with
the equivalent name! | sregistry/main/google_drive/utils.py | def create_folder(self, folder):
'''create a folder with a particular name. Be careful, if the folder
already exists you can still create one (a different one) with
the equivalent name!
'''
folder_metadata = {
'name': os.path.basename(folder),
'mimeType': 'application/... | def create_folder(self, folder):
'''create a folder with a particular name. Be careful, if the folder
already exists you can still create one (a different one) with
the equivalent name!
'''
folder_metadata = {
'name': os.path.basename(folder),
'mimeType': 'application/... | [
"create",
"a",
"folder",
"with",
"a",
"particular",
"name",
".",
"Be",
"careful",
"if",
"the",
"folder",
"already",
"exists",
"you",
"can",
"still",
"create",
"one",
"(",
"a",
"different",
"one",
")",
"with",
"the",
"equivalent",
"name!"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_drive/utils.py#L34-L45 | [
"def",
"create_folder",
"(",
"self",
",",
"folder",
")",
":",
"folder_metadata",
"=",
"{",
"'name'",
":",
"os",
".",
"path",
".",
"basename",
"(",
"folder",
")",
",",
"'mimeType'",
":",
"'application/vnd.google-apps.folder'",
"}",
"created",
"=",
"self",
"."... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | Client._read_response | attempt to read the detail provided by the response. If none,
default to using the reason | sregistry/main/s3/__init__.py | def _read_response(self,response, field="detail"):
'''attempt to read the detail provided by the response. If none,
default to using the reason'''
try:
message = json.loads(response._content.decode('utf-8'))[field]
except:
message = response.reason
retur... | def _read_response(self,response, field="detail"):
'''attempt to read the detail provided by the response. If none,
default to using the reason'''
try:
message = json.loads(response._content.decode('utf-8'))[field]
except:
message = response.reason
retur... | [
"attempt",
"to",
"read",
"the",
"detail",
"provided",
"by",
"the",
"response",
".",
"If",
"none",
"default",
"to",
"using",
"the",
"reason"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/s3/__init__.py#L42-L50 | [
"def",
"_read_response",
"(",
"self",
",",
"response",
",",
"field",
"=",
"\"detail\"",
")",
":",
"try",
":",
"message",
"=",
"json",
".",
"loads",
"(",
"response",
".",
"_content",
".",
"decode",
"(",
"'utf-8'",
")",
")",
"[",
"field",
"]",
"except",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | Client.get_bucket_name | get or return the s3 bucket name. If not yet defined via an environment
variable or setting, we create a name with the pattern.
sregistry-<robotnamer>-<1234>
You can use the following environment variables to determine
interaction with the bucket:
... | sregistry/main/s3/__init__.py | def get_bucket_name(self):
'''get or return the s3 bucket name. If not yet defined via an environment
variable or setting, we create a name with the pattern.
sregistry-<robotnamer>-<1234>
You can use the following environment variables to determine
interacti... | def get_bucket_name(self):
'''get or return the s3 bucket name. If not yet defined via an environment
variable or setting, we create a name with the pattern.
sregistry-<robotnamer>-<1234>
You can use the following environment variables to determine
interacti... | [
"get",
"or",
"return",
"the",
"s3",
"bucket",
"name",
".",
"If",
"not",
"yet",
"defined",
"via",
"an",
"environment",
"variable",
"or",
"setting",
"we",
"create",
"a",
"name",
"with",
"the",
"pattern",
".",
"sregistry",
"-",
"<robotnamer",
">",
"-",
"<12... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/s3/__init__.py#L53-L67 | [
"def",
"get_bucket_name",
"(",
"self",
")",
":",
"# Get bucket name",
"bucket_name",
"=",
"'sregistry-%s'",
"%",
"RobotNamer",
"(",
")",
".",
"generate",
"(",
")",
"self",
".",
"bucket_name",
"=",
"self",
".",
"_get_and_update_setting",
"(",
"'SREGISTRY_S3_BUCKET'... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | Client.get_bucket | given a bucket name and a client that is initialized, get or
create the bucket. | sregistry/main/s3/__init__.py | def get_bucket(self):
'''given a bucket name and a client that is initialized, get or
create the bucket.
'''
for attr in ['bucket_name', 's3']:
if not hasattr(self, attr):
bot.exit('client is missing attribute %s' %(attr))
# See if the bucket is al... | def get_bucket(self):
'''given a bucket name and a client that is initialized, get or
create the bucket.
'''
for attr in ['bucket_name', 's3']:
if not hasattr(self, attr):
bot.exit('client is missing attribute %s' %(attr))
# See if the bucket is al... | [
"given",
"a",
"bucket",
"name",
"and",
"a",
"client",
"that",
"is",
"initialized",
"get",
"or",
"create",
"the",
"bucket",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/s3/__init__.py#L70-L89 | [
"def",
"get_bucket",
"(",
"self",
")",
":",
"for",
"attr",
"in",
"[",
"'bucket_name'",
",",
"'s3'",
"]",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"attr",
")",
":",
"bot",
".",
"exit",
"(",
"'client is missing attribute %s'",
"%",
"(",
"attr",
")"... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | Client.get_resource | use the user provided endpoint and keys (from environment) to
connect to the resource. We can share the aws environment
variables:
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html | sregistry/main/s3/__init__.py | def get_resource(self):
'''use the user provided endpoint and keys (from environment) to
connect to the resource. We can share the aws environment
variables:
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
https://docs.aws.amazon.com/cli/latest/userguide/cli-conf... | def get_resource(self):
'''use the user provided endpoint and keys (from environment) to
connect to the resource. We can share the aws environment
variables:
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
https://docs.aws.amazon.com/cli/latest/userguide/cli-conf... | [
"use",
"the",
"user",
"provided",
"endpoint",
"and",
"keys",
"(",
"from",
"environment",
")",
"to",
"connect",
"to",
"the",
"resource",
".",
"We",
"can",
"share",
"the",
"aws",
"environment",
"variables",
":"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/s3/__init__.py#L92-L114 | [
"def",
"get_resource",
"(",
"self",
")",
":",
"# If base is not defined, assume using aws client",
"if",
"self",
".",
"base",
"!=",
"None",
":",
"# s3.ServiceResource()",
"self",
".",
"s3",
"=",
"boto3",
".",
"resource",
"(",
"'s3'",
",",
"endpoint_url",
"=",
"s... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | Client._update_secrets | update secrets will update/get the base for the server, along
with the bucket name, defaulting to sregistry. | sregistry/main/s3/__init__.py | def _update_secrets(self, base=None):
'''update secrets will update/get the base for the server, along
with the bucket name, defaulting to sregistry.
'''
# We are required to have a base, either from environment or terminal
self.base = self._get_and_update_setting('SREGISTRY_S... | def _update_secrets(self, base=None):
'''update secrets will update/get the base for the server, along
with the bucket name, defaulting to sregistry.
'''
# We are required to have a base, either from environment or terminal
self.base = self._get_and_update_setting('SREGISTRY_S... | [
"update",
"secrets",
"will",
"update",
"/",
"get",
"the",
"base",
"for",
"the",
"server",
"along",
"with",
"the",
"bucket",
"name",
"defaulting",
"to",
"sregistry",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/s3/__init__.py#L118-L141 | [
"def",
"_update_secrets",
"(",
"self",
",",
"base",
"=",
"None",
")",
":",
"# We are required to have a base, either from environment or terminal",
"self",
".",
"base",
"=",
"self",
".",
"_get_and_update_setting",
"(",
"'SREGISTRY_S3_BASE'",
",",
"self",
".",
"base",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | Client._add_https | for push, pull, and other api interactions, the user can optionally
define a custom registry. If the registry name doesn't include http
or https, add it.
Parameters
==========
q: the parsed image query (names), including the original | sregistry/main/registry/__init__.py | def _add_https(self, q):
'''for push, pull, and other api interactions, the user can optionally
define a custom registry. If the registry name doesn't include http
or https, add it.
Parameters
==========
q: the parsed image query (names), including the or... | def _add_https(self, q):
'''for push, pull, and other api interactions, the user can optionally
define a custom registry. If the registry name doesn't include http
or https, add it.
Parameters
==========
q: the parsed image query (names), including the or... | [
"for",
"push",
"pull",
"and",
"other",
"api",
"interactions",
"the",
"user",
"can",
"optionally",
"define",
"a",
"custom",
"registry",
".",
"If",
"the",
"registry",
"name",
"doesn",
"t",
"include",
"http",
"or",
"https",
"add",
"it",
".",
"Parameters",
"==... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/registry/__init__.py#L49-L79 | [
"def",
"_add_https",
"(",
"self",
",",
"q",
")",
":",
"# If image uses http or https, add back",
"if",
"not",
"q",
"[",
"'registry'",
"]",
".",
"startswith",
"(",
"'http'",
")",
":",
"if",
"q",
"[",
"'original'",
"]",
".",
"startswith",
"(",
"'http:'",
")"... | 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. | sregistry/main/registry/__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.
'''
self.secrets = read_client_sec... | 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.
'''
self.secrets = read_client_sec... | [
"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/registry/__init__.py#L82-L93 | [
"def",
"_update_secrets",
"(",
"self",
")",
":",
"self",
".",
"secrets",
"=",
"read_client_secrets",
"(",
")",
"if",
"self",
".",
"secrets",
"is",
"not",
"None",
":",
"if",
"\"registry\"",
"in",
"self",
".",
"secrets",
":",
"if",
"\"base\"",
"in",
"self"... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | Client._init_clients | init_ cliends will obtain the tranfer and access tokens, and then
use them to create a transfer client. | sregistry/main/globus/__init__.py | def _init_clients(self):
'''init_ cliends will obtain the tranfer and access tokens, and then
use them to create a transfer client.
'''
self._client = globus_sdk.NativeAppAuthClient(self._client_id)
self._load_secrets() | def _init_clients(self):
'''init_ cliends will obtain the tranfer and access tokens, and then
use them to create a transfer client.
'''
self._client = globus_sdk.NativeAppAuthClient(self._client_id)
self._load_secrets() | [
"init_",
"cliends",
"will",
"obtain",
"the",
"tranfer",
"and",
"access",
"tokens",
"and",
"then",
"use",
"them",
"to",
"create",
"a",
"transfer",
"client",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/globus/__init__.py#L57-L63 | [
"def",
"_init_clients",
"(",
"self",
")",
":",
"self",
".",
"_client",
"=",
"globus_sdk",
".",
"NativeAppAuthClient",
"(",
"self",
".",
"_client_id",
")",
"self",
".",
"_load_secrets",
"(",
")"
] | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | Client._load_secrets | load the secrets credentials file with the Globus OAuthTokenResponse | sregistry/main/globus/__init__.py | def _load_secrets(self):
'''load the secrets credentials file with the Globus OAuthTokenResponse
'''
# Second priority: load from cache
self.auth = self._get_and_update_setting('GLOBUS_AUTH_RESPONSE')
self.transfer = self._get_and_update_setting('GLOBUS_TRANSFER_RESPONSE... | def _load_secrets(self):
'''load the secrets credentials file with the Globus OAuthTokenResponse
'''
# Second priority: load from cache
self.auth = self._get_and_update_setting('GLOBUS_AUTH_RESPONSE')
self.transfer = self._get_and_update_setting('GLOBUS_TRANSFER_RESPONSE... | [
"load",
"the",
"secrets",
"credentials",
"file",
"with",
"the",
"Globus",
"OAuthTokenResponse"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/globus/__init__.py#L66-L73 | [
"def",
"_load_secrets",
"(",
"self",
")",
":",
"# Second priority: load from cache",
"self",
".",
"auth",
"=",
"self",
".",
"_get_and_update_setting",
"(",
"'GLOBUS_AUTH_RESPONSE'",
")",
"self",
".",
"transfer",
"=",
"self",
".",
"_get_and_update_setting",
"(",
"'GL... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | Client._tokens_need_update | return boolean True or False if the client tokens (self._auth and
self._transfer) need updating. | sregistry/main/globus/__init__.py | def _tokens_need_update(self):
'''return boolean True or False if the client tokens (self._auth and
self._transfer) need updating.
'''
# Assumes that auth and transfer have same refresh time
needs_update = True
if self.auth is not None:
if self.auth['expi... | def _tokens_need_update(self):
'''return boolean True or False if the client tokens (self._auth and
self._transfer) need updating.
'''
# Assumes that auth and transfer have same refresh time
needs_update = True
if self.auth is not None:
if self.auth['expi... | [
"return",
"boolean",
"True",
"or",
"False",
"if",
"the",
"client",
"tokens",
"(",
"self",
".",
"_auth",
"and",
"self",
".",
"_transfer",
")",
"need",
"updating",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/globus/__init__.py#L78-L89 | [
"def",
"_tokens_need_update",
"(",
"self",
")",
":",
"# Assumes that auth and transfer have same refresh time",
"needs_update",
"=",
"True",
"if",
"self",
".",
"auth",
"is",
"not",
"None",
":",
"if",
"self",
".",
"auth",
"[",
"'expires_at_seconds'",
"]",
">",
"tim... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | Client._update_tokens | Present the client with authentication flow to get tokens from code.
This simply updates the client _response to be used to get tokens
for auth and transfer (both use access_token as index). We call
this not on client initialization, but when the client is actually
needed. | sregistry/main/globus/__init__.py | def _update_tokens(self):
'''Present the client with authentication flow to get tokens from code.
This simply updates the client _response to be used to get tokens
for auth and transfer (both use access_token as index). We call
this not on client initialization, but when the cli... | def _update_tokens(self):
'''Present the client with authentication flow to get tokens from code.
This simply updates the client _response to be used to get tokens
for auth and transfer (both use access_token as index). We call
this not on client initialization, but when the cli... | [
"Present",
"the",
"client",
"with",
"authentication",
"flow",
"to",
"get",
"tokens",
"from",
"code",
".",
"This",
"simply",
"updates",
"the",
"client",
"_response",
"to",
"be",
"used",
"to",
"get",
"tokens",
"for",
"auth",
"and",
"transfer",
"(",
"both",
"... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/globus/__init__.py#L92-L113 | [
"def",
"_update_tokens",
"(",
"self",
")",
":",
"self",
".",
"_client",
".",
"oauth2_start_flow",
"(",
"refresh_tokens",
"=",
"True",
")",
"authorize_url",
"=",
"self",
".",
"_client",
".",
"oauth2_get_authorize_url",
"(",
")",
"print",
"(",
"'Please go to this ... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | logs | return logs for a particular container. The logs file is equivalent to
the name, but with extension .log. If there is no name, the most recent
log is returned.
Parameters
==========
name: the container name to print logs for. | sregistry/main/google_build/logs.py | def logs(self, name=None):
'''return logs for a particular container. The logs file is equivalent to
the name, but with extension .log. If there is no name, the most recent
log is returned.
Parameters
==========
name: the container name to print logs for.
'''
content = N... | def logs(self, name=None):
'''return logs for a particular container. The logs file is equivalent to
the name, but with extension .log. If there is no name, the most recent
log is returned.
Parameters
==========
name: the container name to print logs for.
'''
content = N... | [
"return",
"logs",
"for",
"a",
"particular",
"container",
".",
"The",
"logs",
"file",
"is",
"equivalent",
"to",
"the",
"name",
"but",
"with",
"extension",
".",
"log",
".",
"If",
"there",
"is",
"no",
"name",
"the",
"most",
"recent",
"log",
"is",
"returned"... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_build/logs.py#L19-L63 | [
"def",
"logs",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"content",
"=",
"None",
"results",
"=",
"self",
".",
"_list_logs",
"(",
")",
"print",
"(",
"results",
")",
"# If we are searching for a name",
"if",
"name",
"is",
"not",
"None",
":",
"for",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | list_logs | return a list of logs. We return any file that ends in .log | sregistry/main/google_build/logs.py | def list_logs(self):
'''return a list of logs. We return any file that ends in .log
'''
results = []
for image in self._bucket.list_blobs():
if image.name.endswith('log'):
results.append(image)
if len(results) == 0:
bot.info("No containers found, based on extension .log"... | def list_logs(self):
'''return a list of logs. We return any file that ends in .log
'''
results = []
for image in self._bucket.list_blobs():
if image.name.endswith('log'):
results.append(image)
if len(results) == 0:
bot.info("No containers found, based on extension .log"... | [
"return",
"a",
"list",
"of",
"logs",
".",
"We",
"return",
"any",
"file",
"that",
"ends",
"in",
".",
"log"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_build/logs.py#L67-L78 | [
"def",
"list_logs",
"(",
"self",
")",
":",
"results",
"=",
"[",
"]",
"for",
"image",
"in",
"self",
".",
"_bucket",
".",
"list_blobs",
"(",
")",
":",
"if",
"image",
".",
"name",
".",
"endswith",
"(",
"'log'",
")",
":",
"results",
".",
"append",
"(",... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | print_log | helper function to retrieve a particular log, and print.
Parameters
==========
name: the name of the log to retrieve | sregistry/main/google_build/logs.py | def print_log(self, logname):
'''helper function to retrieve a particular log, and print.
Parameters
==========
name: the name of the log to retrieve
'''
content = None
# Try to retrieve the blob (log) if exists
logfile = self._bucket.get_blob(logname)
print(lognam... | def print_log(self, logname):
'''helper function to retrieve a particular log, and print.
Parameters
==========
name: the name of the log to retrieve
'''
content = None
# Try to retrieve the blob (log) if exists
logfile = self._bucket.get_blob(logname)
print(lognam... | [
"helper",
"function",
"to",
"retrieve",
"a",
"particular",
"log",
"and",
"print",
".",
"Parameters",
"==========",
"name",
":",
"the",
"name",
"of",
"the",
"log",
"to",
"retrieve"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_build/logs.py#L82-L100 | [
"def",
"print_log",
"(",
"self",
",",
"logname",
")",
":",
"content",
"=",
"None",
"# Try to retrieve the blob (log) if exists",
"logfile",
"=",
"self",
".",
"_bucket",
".",
"get_blob",
"(",
"logname",
")",
"print",
"(",
"logname",
")",
"if",
"logfile",
":",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | parse_endpoint_name | split an endpoint name by colon, as the user can provide an
endpoint name separated from a path:
Parameters
==========
endpoint 12345:/path/on/remote | sregistry/main/globus/utils.py | def parse_endpoint_name(self, endpoint):
'''split an endpoint name by colon, as the user can provide an
endpoint name separated from a path:
Parameters
==========
endpoint 12345:/path/on/remote
'''
parts = [x for x in endpoint.split(':') if x]
endpoint = parts[0]
if... | def parse_endpoint_name(self, endpoint):
'''split an endpoint name by colon, as the user can provide an
endpoint name separated from a path:
Parameters
==========
endpoint 12345:/path/on/remote
'''
parts = [x for x in endpoint.split(':') if x]
endpoint = parts[0]
if... | [
"split",
"an",
"endpoint",
"name",
"by",
"colon",
"as",
"the",
"user",
"can",
"provide",
"an",
"endpoint",
"name",
"separated",
"from",
"a",
"path",
":"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/globus/utils.py#L20-L36 | [
"def",
"parse_endpoint_name",
"(",
"self",
",",
"endpoint",
")",
":",
"parts",
"=",
"[",
"x",
"for",
"x",
"in",
"endpoint",
".",
"split",
"(",
"':'",
")",
"if",
"x",
"]",
"endpoint",
"=",
"parts",
"[",
"0",
"]",
"if",
"len",
"(",
"parts",
")",
"=... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | create_endpoint_folder | create an endpoint folder, catching the error if it exists.
Parameters
==========
endpoint_id: the endpoint id parameters
folder: the relative path of the folder to create | sregistry/main/globus/utils.py | def create_endpoint_folder(self, endpoint_id, folder):
'''create an endpoint folder, catching the error if it exists.
Parameters
==========
endpoint_id: the endpoint id parameters
folder: the relative path of the folder to create
'''
try:
res = self.transfer_client.oper... | def create_endpoint_folder(self, endpoint_id, folder):
'''create an endpoint folder, catching the error if it exists.
Parameters
==========
endpoint_id: the endpoint id parameters
folder: the relative path of the folder to create
'''
try:
res = self.transfer_client.oper... | [
"create",
"an",
"endpoint",
"folder",
"catching",
"the",
"error",
"if",
"it",
"exists",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/globus/utils.py#L57-L70 | [
"def",
"create_endpoint_folder",
"(",
"self",
",",
"endpoint_id",
",",
"folder",
")",
":",
"try",
":",
"res",
"=",
"self",
".",
"transfer_client",
".",
"operation_mkdir",
"(",
"endpoint_id",
",",
"folder",
")",
"bot",
".",
"info",
"(",
"\"%s --> %s\"",
"%",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_endpoint_path | return the first fullpath to a folder in the endpoint based on
expanding the user's home from the globus config file. This
function is fragile but I don't see any other way to do it.
Parameters
==========
endpoint_id: the endpoint id to look up the path for | sregistry/main/globus/utils.py | def get_endpoint_path(self, endpoint_id):
'''return the first fullpath to a folder in the endpoint based on
expanding the user's home from the globus config file. This
function is fragile but I don't see any other way to do it.
Parameters
==========
endpoint_id: the endpoint ... | def get_endpoint_path(self, endpoint_id):
'''return the first fullpath to a folder in the endpoint based on
expanding the user's home from the globus config file. This
function is fragile but I don't see any other way to do it.
Parameters
==========
endpoint_id: the endpoint ... | [
"return",
"the",
"first",
"fullpath",
"to",
"a",
"folder",
"in",
"the",
"endpoint",
"based",
"on",
"expanding",
"the",
"user",
"s",
"home",
"from",
"the",
"globus",
"config",
"file",
".",
"This",
"function",
"is",
"fragile",
"but",
"I",
"don",
"t",
"see"... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/globus/utils.py#L73-L103 | [
"def",
"get_endpoint_path",
"(",
"self",
",",
"endpoint_id",
")",
":",
"config",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"\"~/.globusonline/lta/config-paths\"",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"config",
")",
":",
"bot",
"."... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | init_transfer_client | return a transfer client for the user | sregistry/main/globus/utils.py | def init_transfer_client(self):
'''return a transfer client for the user'''
if self._tokens_need_update():
self._update_tokens()
access_token = self.transfer['access_token']
# Createe Refresh Token Authorizer
authorizer = globus_sdk.RefreshTokenAuthorizer(
... | def init_transfer_client(self):
'''return a transfer client for the user'''
if self._tokens_need_update():
self._update_tokens()
access_token = self.transfer['access_token']
# Createe Refresh Token Authorizer
authorizer = globus_sdk.RefreshTokenAuthorizer(
... | [
"return",
"a",
"transfer",
"client",
"for",
"the",
"user"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/globus/utils.py#L107-L123 | [
"def",
"init_transfer_client",
"(",
"self",
")",
":",
"if",
"self",
".",
"_tokens_need_update",
"(",
")",
":",
"self",
".",
"_update_tokens",
"(",
")",
"access_token",
"=",
"self",
".",
"transfer",
"[",
"'access_token'",
"]",
"# Createe Refresh Token Authorizer",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_endpoint | use a transfer client to get a specific endpoint based on an endpoint id.
Parameters
==========
endpoint_id: the endpoint_id to retrieve | sregistry/main/globus/utils.py | def get_endpoint(self, endpoint_id):
'''use a transfer client to get a specific endpoint based on an endpoint id.
Parameters
==========
endpoint_id: the endpoint_id to retrieve
'''
endpoint = None
if not hasattr(self, 'transfer_client'):
self._init_transfer_cl... | def get_endpoint(self, endpoint_id):
'''use a transfer client to get a specific endpoint based on an endpoint id.
Parameters
==========
endpoint_id: the endpoint_id to retrieve
'''
endpoint = None
if not hasattr(self, 'transfer_client'):
self._init_transfer_cl... | [
"use",
"a",
"transfer",
"client",
"to",
"get",
"a",
"specific",
"endpoint",
"based",
"on",
"an",
"endpoint",
"id",
".",
"Parameters",
"==========",
"endpoint_id",
":",
"the",
"endpoint_id",
"to",
"retrieve"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/globus/utils.py#L126-L144 | [
"def",
"get_endpoint",
"(",
"self",
",",
"endpoint_id",
")",
":",
"endpoint",
"=",
"None",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'transfer_client'",
")",
":",
"self",
".",
"_init_transfer_client",
"(",
")",
"try",
":",
"endpoint",
"=",
"self",
".",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_endpoints | use a transfer client to get endpoints. If a search term is included,
we use it to search a scope of "all" in addition to personal and shared
endpoints. Endpoints are organized
by type (my-endpoints, shared-with-me, optionally all) and then id.
Parameters
==========
query: an ... | sregistry/main/globus/utils.py | def get_endpoints(self, query=None):
'''use a transfer client to get endpoints. If a search term is included,
we use it to search a scope of "all" in addition to personal and shared
endpoints. Endpoints are organized
by type (my-endpoints, shared-with-me, optionally all) and then id.
Pa... | def get_endpoints(self, query=None):
'''use a transfer client to get endpoints. If a search term is included,
we use it to search a scope of "all" in addition to personal and shared
endpoints. Endpoints are organized
by type (my-endpoints, shared-with-me, optionally all) and then id.
Pa... | [
"use",
"a",
"transfer",
"client",
"to",
"get",
"endpoints",
".",
"If",
"a",
"search",
"term",
"is",
"included",
"we",
"use",
"it",
"to",
"search",
"a",
"scope",
"of",
"all",
"in",
"addition",
"to",
"personal",
"and",
"shared",
"endpoints",
".",
"Endpoint... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/globus/utils.py#L147-L186 | [
"def",
"get_endpoints",
"(",
"self",
",",
"query",
"=",
"None",
")",
":",
"self",
".",
"endpoints",
"=",
"{",
"}",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'transfer_client'",
")",
":",
"self",
".",
"_init_transfer_client",
"(",
")",
"# We assume the use... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | list_containers | return a list of containers. Since Google Drive definitely has other
kinds of files, we look for containers in a special sregistry folder,
(meaning the parent folder is sregistry) and with properties of type
as container. | sregistry/main/google_drive/query.py | def list_containers(self):
'''return a list of containers. Since Google Drive definitely has other
kinds of files, we look for containers in a special sregistry folder,
(meaning the parent folder is sregistry) and with properties of type
as container.
'''
# Get or create the base
fo... | def list_containers(self):
'''return a list of containers. Since Google Drive definitely has other
kinds of files, we look for containers in a special sregistry folder,
(meaning the parent folder is sregistry) and with properties of type
as container.
'''
# Get or create the base
fo... | [
"return",
"a",
"list",
"of",
"containers",
".",
"Since",
"Google",
"Drive",
"definitely",
"has",
"other",
"kinds",
"of",
"files",
"we",
"look",
"for",
"containers",
"in",
"a",
"special",
"sregistry",
"folder",
"(",
"meaning",
"the",
"parent",
"folder",
"is",... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_drive/query.py#L30-L63 | [
"def",
"list_containers",
"(",
"self",
")",
":",
"# Get or create the base",
"folder",
"=",
"self",
".",
"_get_or_create_folder",
"(",
"self",
".",
"_base",
")",
"next_page",
"=",
"None",
"containers",
"=",
"[",
"]",
"# Parse the base for all containers, possibly over... | 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 properties value type set to
container, which is set when the image is pushed.
IMPORTANT: the upload function adds this metadata. For a container to
be found by the client, it must hav... | sregistry/main/google_drive/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 properties value type set to
container, which is set when the image is pushed.
IMPORTANT: the upload function adds this metadata. For a container to
be fou... | 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 properties value type set to
container, which is set when the image is pushed.
IMPORTANT: the upload function adds this metadata. For a container to
be fou... | [
"a",
"list",
"all",
"search",
"that",
"doesn",
"t",
"require",
"a",
"query",
".",
"Here",
"we",
"return",
"to",
"the",
"user",
"all",
"objects",
"that",
"have",
"custom",
"properties",
"value",
"type",
"set",
"to",
"container",
"which",
"is",
"set",
"whe... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_drive/query.py#L66-L103 | [
"def",
"search_all",
"(",
"self",
")",
":",
"results",
"=",
"self",
".",
"_list_containers",
"(",
")",
"matches",
"=",
"[",
"]",
"bot",
".",
"info",
"(",
"\"[drive://%s] Containers\"",
"%",
"self",
".",
"_base",
")",
"rows",
"=",
"[",
"]",
"for",
"i",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | container_query | search for a specific container.
This function is the same as the search all, but instead of showing all
results, filters them down based on user criteria (the query) | sregistry/main/google_drive/query.py | def container_query(self, query, quiet=False):
'''search for a specific container.
This function is the same as the search all, but instead of showing all
results, filters them down based on user criteria (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 is the same as the search all, but instead of showing all
results, filters them down based on user criteria (the query)
'''
results = self._list_containers()
matches = []
for result in results:... | [
"search",
"for",
"a",
"specific",
"container",
".",
"This",
"function",
"is",
"the",
"same",
"as",
"the",
"search",
"all",
"but",
"instead",
"of",
"showing",
"all",
"results",
"filters",
"them",
"down",
"based",
"on",
"user",
"criteria",
"(",
"the",
"query... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_drive/query.py#L107-L150 | [
"def",
"container_query",
"(",
"self",
",",
"query",
",",
"quiet",
"=",
"False",
")",
":",
"results",
"=",
"self",
".",
"_list_containers",
"(",
")",
"matches",
"=",
"[",
"]",
"for",
"result",
"in",
"results",
":",
"is_match",
"=",
"False",
"if",
"quer... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | status | print the status for all or one of the backends. | sregistry/client/backend.py | def status(backend):
'''print the status for all or one of the backends.
'''
print('[backend status]')
settings = read_client_secrets()
print('There are %s clients found in secrets.' %len(settings))
if 'SREGISTRY_CLIENT' in settings:
print('active: %s' %settings['SREGISTRY_CLIENT'])
... | def status(backend):
'''print the status for all or one of the backends.
'''
print('[backend status]')
settings = read_client_secrets()
print('There are %s clients found in secrets.' %len(settings))
if 'SREGISTRY_CLIENT' in settings:
print('active: %s' %settings['SREGISTRY_CLIENT'])
... | [
"print",
"the",
"status",
"for",
"all",
"or",
"one",
"of",
"the",
"backends",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/client/backend.py#L94-L104 | [
"def",
"status",
"(",
"backend",
")",
":",
"print",
"(",
"'[backend status]'",
")",
"settings",
"=",
"read_client_secrets",
"(",
")",
"print",
"(",
"'There are %s clients found in secrets.'",
"%",
"len",
"(",
"settings",
")",
")",
"if",
"'SREGISTRY_CLIENT'",
"in",... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | add | add the variable to the config | sregistry/client/backend.py | def add(backend, variable, value, force=False):
'''add the variable to the config
'''
print('[add]')
settings = read_client_secrets()
# If the variable begins with the SREGISTRY_<CLIENT> don't add it
prefix = 'SREGISTRY_%s_' %backend.upper()
if not variable.startswith(prefix):
varia... | def add(backend, variable, value, force=False):
'''add the variable to the config
'''
print('[add]')
settings = read_client_secrets()
# If the variable begins with the SREGISTRY_<CLIENT> don't add it
prefix = 'SREGISTRY_%s_' %backend.upper()
if not variable.startswith(prefix):
varia... | [
"add",
"the",
"variable",
"to",
"the",
"config"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/client/backend.py#L107-L134 | [
"def",
"add",
"(",
"backend",
",",
"variable",
",",
"value",
",",
"force",
"=",
"False",
")",
":",
"print",
"(",
"'[add]'",
")",
"settings",
"=",
"read_client_secrets",
"(",
")",
"# If the variable begins with the SREGISTRY_<CLIENT> don't add it",
"prefix",
"=",
"... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | remove | remove a variable from the config, if found. | sregistry/client/backend.py | def remove(backend, variable):
'''remove a variable from the config, if found.
'''
print('[remove]')
settings = read_client_secrets()
# If the variable begins with the SREGISTRY_<CLIENT> don't add it
prefixed = variable
prefix = 'SREGISTRY_%s_' %backend.upper()
if not variable.startswit... | def remove(backend, variable):
'''remove a variable from the config, if found.
'''
print('[remove]')
settings = read_client_secrets()
# If the variable begins with the SREGISTRY_<CLIENT> don't add it
prefixed = variable
prefix = 'SREGISTRY_%s_' %backend.upper()
if not variable.startswit... | [
"remove",
"a",
"variable",
"from",
"the",
"config",
"if",
"found",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/client/backend.py#L138-L160 | [
"def",
"remove",
"(",
"backend",
",",
"variable",
")",
":",
"print",
"(",
"'[remove]'",
")",
"settings",
"=",
"read_client_secrets",
"(",
")",
"# If the variable begins with the SREGISTRY_<CLIENT> don't add it",
"prefixed",
"=",
"variable",
"prefix",
"=",
"'SREGISTRY_%s... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | activate | activate a backend by adding it to the .sregistry configuration file. | sregistry/client/backend.py | def activate(backend):
'''activate a backend by adding it to the .sregistry configuration file.
'''
settings = read_client_secrets()
if backend is not None:
settings['SREGISTRY_CLIENT'] = backend
update_secrets(settings)
print('[activate] %s' %backend) | def activate(backend):
'''activate a backend by adding it to the .sregistry configuration file.
'''
settings = read_client_secrets()
if backend is not None:
settings['SREGISTRY_CLIENT'] = backend
update_secrets(settings)
print('[activate] %s' %backend) | [
"activate",
"a",
"backend",
"by",
"adding",
"it",
"to",
"the",
".",
"sregistry",
"configuration",
"file",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/client/backend.py#L163-L170 | [
"def",
"activate",
"(",
"backend",
")",
":",
"settings",
"=",
"read_client_secrets",
"(",
")",
"if",
"backend",
"is",
"not",
"None",
":",
"settings",
"[",
"'SREGISTRY_CLIENT'",
"]",
"=",
"backend",
"update_secrets",
"(",
"settings",
")",
"print",
"(",
"'[act... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | delete_backend | delete a backend, and update the secrets file | sregistry/client/backend.py | def delete_backend(backend):
'''delete a backend, and update the secrets file
'''
settings = read_client_secrets()
if backend in settings:
del settings[backend]
# If the backend was the active client, remove too
if 'SREGISTRY_CLIENT' in settings:
if settings['SREGIST... | def delete_backend(backend):
'''delete a backend, and update the secrets file
'''
settings = read_client_secrets()
if backend in settings:
del settings[backend]
# If the backend was the active client, remove too
if 'SREGISTRY_CLIENT' in settings:
if settings['SREGIST... | [
"delete",
"a",
"backend",
"and",
"update",
"the",
"secrets",
"file"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/client/backend.py#L178-L196 | [
"def",
"delete_backend",
"(",
"backend",
")",
":",
"settings",
"=",
"read_client_secrets",
"(",
")",
"if",
"backend",
"in",
"settings",
":",
"del",
"settings",
"[",
"backend",
"]",
"# If the backend was the active client, remove too",
"if",
"'SREGISTRY_CLIENT'",
"in",... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | list_backends | return a list of backends installed for the user, which is based on
the config file keys found present
Parameters
==========
backend: a specific backend to list. If defined, just list parameters. | sregistry/client/backend.py | def list_backends(backend=None):
'''return a list of backends installed for the user, which is based on
the config file keys found present
Parameters
==========
backend: a specific backend to list. If defined, just list parameters.
'''
settings = read_client_secrets()
# B... | def list_backends(backend=None):
'''return a list of backends installed for the user, which is based on
the config file keys found present
Parameters
==========
backend: a specific backend to list. If defined, just list parameters.
'''
settings = read_client_secrets()
# B... | [
"return",
"a",
"list",
"of",
"backends",
"installed",
"for",
"the",
"user",
"which",
"is",
"based",
"on",
"the",
"config",
"file",
"keys",
"found",
"present",
"Parameters",
"==========",
"backend",
":",
"a",
"specific",
"backend",
"to",
"list",
".",
"If",
... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/client/backend.py#L212-L234 | [
"def",
"list_backends",
"(",
"backend",
"=",
"None",
")",
":",
"settings",
"=",
"read_client_secrets",
"(",
")",
"# Backend names are the keys",
"backends",
"=",
"list",
"(",
"settings",
".",
"keys",
"(",
")",
")",
"backends",
"=",
"[",
"b",
"for",
"b",
"i... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | pull | pull an image from a dropbox. 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 this uri.... | sregistry/main/dropbox/pull.py | def pull(self, images, file_name=None, save=True, **kwargs):
'''pull an image from a dropbox. 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 tha... | def pull(self, images, file_name=None, save=True, **kwargs):
'''pull an image from a dropbox. 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 tha... | [
"pull",
"an",
"image",
"from",
"a",
"dropbox",
".",
"The",
"image",
"is",
"found",
"based",
"on",
"the",
"storage",
"uri",
"Parameters",
"==========",
"images",
":",
"refers",
"to",
"the",
"uri",
"given",
"by",
"the",
"user",
"to",
"pull",
"in",
"the",
... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/dropbox/pull.py#L16-L92 | [
"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 your Dropbox
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 tag. This is provided to mirror Docker
if the ima... | sregistry/main/dropbox/push.py | def push(self, path, name, tag=None):
'''push an image to your Dropbox
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 tag. This is... | def push(self, path, name, tag=None):
'''push an image to your Dropbox
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 tag. This is... | [
"push",
"an",
"image",
"to",
"your",
"Dropbox",
"Parameters",
"==========",
"path",
":",
"should",
"correspond",
"to",
"an",
"absolute",
"image",
"path",
"(",
"or",
"derive",
"it",
")",
"name",
":",
"should",
"be",
"the",
"complete",
"uri",
"that",
"the",
... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/dropbox/push.py#L23-L103 | [
"def",
"push",
"(",
"self",
",",
"path",
",",
"name",
",",
"tag",
"=",
"None",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"path",
")",
"bot",
".",
"debug",
"(",
"\"PUSH %s\"",
"%",
"path",
")",
"if",
"not",
"os",
".",
"path"... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | Client._update_base | update a base based on an image name, meaning detecting a particular
registry and if necessary, updating the self.base. When the image
name is parsed, the base will be given to remove the registry. | sregistry/main/docker/__init__.py | def _update_base(self, image):
''' update a base based on an image name, meaning detecting a particular
registry and if necessary, updating the self.base. When the image
name is parsed, the base will be given to remove the registry.
'''
base = None
# Google Conta... | def _update_base(self, image):
''' update a base based on an image name, meaning detecting a particular
registry and if necessary, updating the self.base. When the image
name is parsed, the base will be given to remove the registry.
'''
base = None
# Google Conta... | [
"update",
"a",
"base",
"based",
"on",
"an",
"image",
"name",
"meaning",
"detecting",
"a",
"particular",
"registry",
"and",
"if",
"necessary",
"updating",
"the",
"self",
".",
"base",
".",
"When",
"the",
"image",
"name",
"is",
"parsed",
"the",
"base",
"will"... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/docker/__init__.py#L66-L79 | [
"def",
"_update_base",
"(",
"self",
",",
"image",
")",
":",
"base",
"=",
"None",
"# Google Container Cloud",
"if",
"\"gcr.io\"",
"in",
"image",
":",
"base",
"=",
"'gcr.io'",
"self",
".",
"_set_base",
"(",
"default_base",
"=",
"base",
")",
"self",
".",
"_up... | 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_DOCKERHUB_BASE: defaults to index.docker.io
SREGISTRY_DOCKERHUB_VERSION: defaults to v1
SREGISTRY_DO... | sregistry/main/docker/__init__.py | def _set_base(self, default_base=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:
SREGISTRY_DOCKERHUB_BASE: defaults to index.docker.io
SREGISTRY_DOCKER... | def _set_base(self, default_base=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:
SREGISTRY_DOCKERHUB_BASE: defaults to index.docker.io
SREGISTRY_DOCKER... | [
"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/docker/__init__.py#L82-L116 | [
"def",
"_set_base",
"(",
"self",
",",
"default_base",
"=",
"None",
")",
":",
"base",
"=",
"self",
".",
"_get_setting",
"(",
"'SREGISTRY_DOCKERHUB_BASE'",
")",
"version",
"=",
"self",
".",
"_get_setting",
"(",
"'SREGISTRY_DOCKERHUB_VERSION'",
")",
"# If we re-set t... | 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/docker/__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/docker/__init__.py#L119-L163 | [
"def",
"_update_secrets",
"(",
"self",
")",
":",
"# If the user has defined secrets, use them",
"credentials",
"=",
"self",
".",
"_get_setting",
"(",
"'SREGISTRY_DOCKERHUB_SECRETS'",
")",
"# First try for SINGULARITY exported, then try sregistry",
"username",
"=",
"self",
".",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | share | share will use the client to get an image based on a query, and then
the link with an email or endpoint (share_to) of choice. | sregistry/main/google_drive/share.py | def share(self, query, share_to):
'''share will use the client to get an image based on a query, and then
the link with an email or endpoint (share_to) of choice.
'''
images = self._container_query(query, quiet=True)
if len(images) == 0:
bot.error('Cannot find a remote image matching %s'... | def share(self, query, share_to):
'''share will use the client to get an image based on a query, and then
the link with an email or endpoint (share_to) of choice.
'''
images = self._container_query(query, quiet=True)
if len(images) == 0:
bot.error('Cannot find a remote image matching %s'... | [
"share",
"will",
"use",
"the",
"client",
"to",
"get",
"an",
"image",
"based",
"on",
"a",
"query",
"and",
"then",
"the",
"link",
"with",
"an",
"email",
"or",
"endpoint",
"(",
"share_to",
")",
"of",
"choice",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_drive/share.py#L17-L51 | [
"def",
"share",
"(",
"self",
",",
"query",
",",
"share_to",
")",
":",
"images",
"=",
"self",
".",
"_container_query",
"(",
"query",
",",
"quiet",
"=",
"True",
")",
"if",
"len",
"(",
"images",
")",
"==",
"0",
":",
"bot",
".",
"error",
"(",
"'Cannot ... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | pull | pull an image from google drive, based on a query (uri or id)
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 requeste... | sregistry/main/google_drive/pull.py | def pull(self, images, file_name=None, save=True, **kwargs):
'''pull an image from google drive, based on a query (uri or id)
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 con... | def pull(self, images, file_name=None, save=True, **kwargs):
'''pull an image from google drive, based on a query (uri or id)
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 con... | [
"pull",
"an",
"image",
"from",
"google",
"drive",
"based",
"on",
"a",
"query",
"(",
"uri",
"or",
"id",
")",
"Parameters",
"==========",
"images",
":",
"refers",
"to",
"the",
"uri",
"given",
"by",
"the",
"user",
"to",
"pull",
"in",
"the",
"format",
"<co... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_drive/pull.py#L18-L109 | [
"def",
"pull",
"(",
"self",
",",
"images",
",",
"file_name",
"=",
"None",
",",
"save",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"images",
",",
"list",
")",
":",
"images",
"=",
"[",
"images",
"]",
"bot",
".",... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | basic_auth_header | generate a base64 encoded header to ask for a token. This means
base64 encoding a username and password and adding to the
Authorization header to identify the client.
Parameters
==========
username: the username
password: the password | sregistry/auth/utils.py | def basic_auth_header(username, password):
'''generate a base64 encoded header to ask for a token. This means
base64 encoding a username and password and adding to the
Authorization header to identify the client.
Parameters
==========
username: the username
password:... | def basic_auth_header(username, password):
'''generate a base64 encoded header to ask for a token. This means
base64 encoding a username and password and adding to the
Authorization header to identify the client.
Parameters
==========
username: the username
password:... | [
"generate",
"a",
"base64",
"encoded",
"header",
"to",
"ask",
"for",
"a",
"token",
".",
"This",
"means",
"base64",
"encoding",
"a",
"username",
"and",
"password",
"and",
"adding",
"to",
"the",
"Authorization",
"header",
"to",
"identify",
"the",
"client",
"."
... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/auth/utils.py#L17-L35 | [
"def",
"basic_auth_header",
"(",
"username",
",",
"password",
")",
":",
"s",
"=",
"\"%s:%s\"",
"%",
"(",
"username",
",",
"password",
")",
"if",
"sys",
".",
"version_info",
"[",
"0",
"]",
">=",
"3",
":",
"s",
"=",
"bytes",
"(",
"s",
",",
"'utf-8'",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | generate_signature | use an endpoint specific payload and client secret to generate
a signature for the request | sregistry/main/registry/utils.py | def generate_signature(payload, secret):
'''use an endpoint specific payload and client secret to generate
a signature for the request'''
payload = _encode(payload)
secret = _encode(secret)
return hmac.new(secret, digestmod=hashlib.sha256,
msg=payload).hexdigest() | def generate_signature(payload, secret):
'''use an endpoint specific payload and client secret to generate
a signature for the request'''
payload = _encode(payload)
secret = _encode(secret)
return hmac.new(secret, digestmod=hashlib.sha256,
msg=payload).hexdigest() | [
"use",
"an",
"endpoint",
"specific",
"payload",
"and",
"client",
"secret",
"to",
"generate",
"a",
"signature",
"for",
"the",
"request"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/registry/utils.py#L26-L32 | [
"def",
"generate_signature",
"(",
"payload",
",",
"secret",
")",
":",
"payload",
"=",
"_encode",
"(",
"payload",
")",
"secret",
"=",
"_encode",
"(",
"secret",
")",
"return",
"hmac",
".",
"new",
"(",
"secret",
",",
"digestmod",
"=",
"hashlib",
".",
"sha25... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | generate_credential | basic_auth_header will return a base64 encoded header object to
:param username: the username | sregistry/main/registry/utils.py | def generate_credential(s):
'''basic_auth_header will return a base64 encoded header object to
:param username: the username
'''
if sys.version_info[0] >= 3:
s = bytes(s, 'utf-8')
credentials = base64.b64encode(s).decode('utf-8')
else:
credentials = base64.b64encode(s)
re... | def generate_credential(s):
'''basic_auth_header will return a base64 encoded header object to
:param username: the username
'''
if sys.version_info[0] >= 3:
s = bytes(s, 'utf-8')
credentials = base64.b64encode(s).decode('utf-8')
else:
credentials = base64.b64encode(s)
re... | [
"basic_auth_header",
"will",
"return",
"a",
"base64",
"encoded",
"header",
"object",
"to",
":",
"param",
"username",
":",
"the",
"username"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/registry/utils.py#L40-L49 | [
"def",
"generate_credential",
"(",
"s",
")",
":",
"if",
"sys",
".",
"version_info",
"[",
"0",
"]",
">=",
"3",
":",
"s",
"=",
"bytes",
"(",
"s",
",",
"'utf-8'",
")",
"credentials",
"=",
"base64",
".",
"b64encode",
"(",
"s",
")",
".",
"decode",
"(",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | generate_header_signature | Authorize a client based on encrypting the payload with the client
secret, timestamp, and other metadata | sregistry/main/registry/utils.py | def generate_header_signature(secret, payload, request_type):
'''Authorize a client based on encrypting the payload with the client
secret, timestamp, and other metadata
'''
# Use the payload to generate a digest push|collection|name|tag|user
timestamp = generate_timestamp()
credential = ... | def generate_header_signature(secret, payload, request_type):
'''Authorize a client based on encrypting the payload with the client
secret, timestamp, and other metadata
'''
# Use the payload to generate a digest push|collection|name|tag|user
timestamp = generate_timestamp()
credential = ... | [
"Authorize",
"a",
"client",
"based",
"on",
"encrypting",
"the",
"payload",
"with",
"the",
"client",
"secret",
"timestamp",
"and",
"other",
"metadata"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/registry/utils.py#L52-L62 | [
"def",
"generate_header_signature",
"(",
"secret",
",",
"payload",
",",
"request_type",
")",
":",
"# Use the payload to generate a digest push|collection|name|tag|user",
"timestamp",
"=",
"generate_timestamp",
"(",
")",
"credential",
"=",
"\"%s/%s\"",
"%",
"(",
"request_t... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | delete | delete request, use with caution | sregistry/main/base/http.py | def delete(self, url,
headers=None,
return_json=True,
default_headers=True):
'''delete request, use with caution
'''
bot.debug('DELETE %s' %url)
return self._call(url,
headers=headers,
func=requests.delete,
... | def delete(self, url,
headers=None,
return_json=True,
default_headers=True):
'''delete request, use with caution
'''
bot.debug('DELETE %s' %url)
return self._call(url,
headers=headers,
func=requests.delete,
... | [
"delete",
"request",
"use",
"with",
"caution"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/base/http.py#L25-L37 | [
"def",
"delete",
"(",
"self",
",",
"url",
",",
"headers",
"=",
"None",
",",
"return_json",
"=",
"True",
",",
"default_headers",
"=",
"True",
")",
":",
"bot",
".",
"debug",
"(",
"'DELETE %s'",
"%",
"url",
")",
"return",
"self",
".",
"_call",
"(",
"url... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | head | head request, typically used for status code retrieval, etc. | sregistry/main/base/http.py | def head(self, url):
'''head request, typically used for status code retrieval, etc.
'''
bot.debug('HEAD %s' %url)
return self._call(url, func=requests.head) | def head(self, url):
'''head request, typically used for status code retrieval, etc.
'''
bot.debug('HEAD %s' %url)
return self._call(url, func=requests.head) | [
"head",
"request",
"typically",
"used",
"for",
"status",
"code",
"retrieval",
"etc",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/base/http.py#L40-L44 | [
"def",
"head",
"(",
"self",
",",
"url",
")",
":",
"bot",
".",
"debug",
"(",
"'HEAD %s'",
"%",
"url",
")",
"return",
"self",
".",
"_call",
"(",
"url",
",",
"func",
"=",
"requests",
".",
"head",
")"
] | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | healthy | determine if a resource is healthy based on an accepted response (200)
or redirect (301)
Parameters
==========
url: the URL to check status for, based on the status_code of HEAD | sregistry/main/base/http.py | def healthy(self, url):
'''determine if a resource is healthy based on an accepted response (200)
or redirect (301)
Parameters
==========
url: the URL to check status for, based on the status_code of HEAD
'''
response = requests.get(url)
status_code = response.status_code
... | def healthy(self, url):
'''determine if a resource is healthy based on an accepted response (200)
or redirect (301)
Parameters
==========
url: the URL to check status for, based on the status_code of HEAD
'''
response = requests.get(url)
status_code = response.status_code
... | [
"determine",
"if",
"a",
"resource",
"is",
"healthy",
"based",
"on",
"an",
"accepted",
"response",
"(",
"200",
")",
"or",
"redirect",
"(",
"301",
")"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/base/http.py#L47-L61 | [
"def",
"healthy",
"(",
"self",
",",
"url",
")",
":",
"response",
"=",
"requests",
".",
"get",
"(",
"url",
")",
"status_code",
"=",
"response",
".",
"status_code",
"if",
"status_code",
"!=",
"200",
":",
"bot",
".",
"error",
"(",
"'%s, response status code %... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | post | post will use requests to get a particular url | sregistry/main/base/http.py | def post(self,url,
headers=None,
data=None,
return_json=True,
default_headers=True):
'''post will use requests to get a particular url
'''
bot.debug("POST %s" %url)
return self._call(url,
headers=headers,
... | def post(self,url,
headers=None,
data=None,
return_json=True,
default_headers=True):
'''post will use requests to get a particular url
'''
bot.debug("POST %s" %url)
return self._call(url,
headers=headers,
... | [
"post",
"will",
"use",
"requests",
"to",
"get",
"a",
"particular",
"url"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/base/http.py#L81-L96 | [
"def",
"post",
"(",
"self",
",",
"url",
",",
"headers",
"=",
"None",
",",
"data",
"=",
"None",
",",
"return_json",
"=",
"True",
",",
"default_headers",
"=",
"True",
")",
":",
"bot",
".",
"debug",
"(",
"\"POST %s\"",
"%",
"url",
")",
"return",
"self",... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get | get will use requests to get a particular url | sregistry/main/base/http.py | def get(self,url,
headers=None,
token=None,
data=None,
return_json=True,
default_headers=True,
quiet=False):
'''get will use requests to get a particular url
'''
bot.debug("GET %s" %url)
return self._call(url,
... | def get(self,url,
headers=None,
token=None,
data=None,
return_json=True,
default_headers=True,
quiet=False):
'''get will use requests to get a particular url
'''
bot.debug("GET %s" %url)
return self._call(url,
... | [
"get",
"will",
"use",
"requests",
"to",
"get",
"a",
"particular",
"url"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/base/http.py#L99-L116 | [
"def",
"get",
"(",
"self",
",",
"url",
",",
"headers",
"=",
"None",
",",
"token",
"=",
"None",
",",
"data",
"=",
"None",
",",
"return_json",
"=",
"True",
",",
"default_headers",
"=",
"True",
",",
"quiet",
"=",
"False",
")",
":",
"bot",
".",
"debug"... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | paginate_get | paginate_call is a wrapper for get to paginate results | sregistry/main/base/http.py | def paginate_get(self, url,
headers=None,
return_json=True,
start_page=None):
'''paginate_call is a wrapper for get to paginate results
'''
geturl = '%s&page=1' %(url)
if start_page is not None:
geturl = '%s&page=%s' %(url,start_page)
re... | def paginate_get(self, url,
headers=None,
return_json=True,
start_page=None):
'''paginate_call is a wrapper for get to paginate results
'''
geturl = '%s&page=1' %(url)
if start_page is not None:
geturl = '%s&page=%s' %(url,start_page)
re... | [
"paginate_call",
"is",
"a",
"wrapper",
"for",
"get",
"to",
"paginate",
"results"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/base/http.py#L118-L140 | [
"def",
"paginate_get",
"(",
"self",
",",
"url",
",",
"headers",
"=",
"None",
",",
"return_json",
"=",
"True",
",",
"start_page",
"=",
"None",
")",
":",
"geturl",
"=",
"'%s&page=1'",
"%",
"(",
"url",
")",
"if",
"start_page",
"is",
"not",
"None",
":",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | verify | verify will return a True or False to determine to verify the
requests call or not. If False, we should the user a warning message,
as this should not be done in production! | sregistry/main/base/http.py | def verify(self):
'''
verify will return a True or False to determine to verify the
requests call or not. If False, we should the user a warning message,
as this should not be done in production!
'''
from sregistry.defaults import DISABLE_SSL_CHECK
if DISABLE_SSL_CHECK is True:
... | def verify(self):
'''
verify will return a True or False to determine to verify the
requests call or not. If False, we should the user a warning message,
as this should not be done in production!
'''
from sregistry.defaults import DISABLE_SSL_CHECK
if DISABLE_SSL_CHECK is True:
... | [
"verify",
"will",
"return",
"a",
"True",
"or",
"False",
"to",
"determine",
"to",
"verify",
"the",
"requests",
"call",
"or",
"not",
".",
"If",
"False",
"we",
"should",
"the",
"user",
"a",
"warning",
"message",
"as",
"this",
"should",
"not",
"be",
"done",
... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/base/http.py#L143-L155 | [
"def",
"verify",
"(",
"self",
")",
":",
"from",
"sregistry",
".",
"defaults",
"import",
"DISABLE_SSL_CHECK",
"if",
"DISABLE_SSL_CHECK",
"is",
"True",
":",
"bot",
".",
"warning",
"(",
"'Verify of certificates disabled! ::TESTING USE ONLY::'",
")",
"return",
"not",
"D... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | call | call will issue the call, and issue a refresh token
given a 401 response, and if the client has a _update_token function
Parameters
==========
func: the function (eg, post, get) to call
url: the url to send file to
headers: if not None, update the client self.headers with dict... | sregistry/main/base/http.py | def call(self, url, func, data=None,
headers=None,
return_json=True,
stream=False,
retry=True,
default_headers=True,
quiet=False):
'''call will issue the cal... | def call(self, url, func, data=None,
headers=None,
return_json=True,
stream=False,
retry=True,
default_headers=True,
quiet=False):
'''call will issue the cal... | [
"call",
"will",
"issue",
"the",
"call",
"and",
"issue",
"a",
"refresh",
"token",
"given",
"a",
"401",
"response",
"and",
"if",
"the",
"client",
"has",
"a",
"_update_token",
"function"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/base/http.py#L297-L380 | [
"def",
"call",
"(",
"self",
",",
"url",
",",
"func",
",",
"data",
"=",
"None",
",",
"headers",
"=",
"None",
",",
"return_json",
"=",
"True",
",",
"stream",
"=",
"False",
",",
"retry",
"=",
"True",
",",
"default_headers",
"=",
"True",
",",
"quiet",
... | 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/registry/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/registry/pull.py#L21-L135 | [
"def",
"pull",
"(",
"self",
",",
"images",
",",
"file_name",
"=",
"None",
",",
"save",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"images",
",",
"list",
")",
":",
"images",
"=",
"[",
"images",
"]",
"# Interactio... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | pull | pull an image from a s3 storage
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 ... | sregistry/main/s3/pull.py | def pull(self, images, file_name=None, save=True, **kwargs):
'''pull an image from a s3 storage
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 bas... | def pull(self, images, file_name=None, save=True, **kwargs):
'''pull an image from a s3 storage
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 bas... | [
"pull",
"an",
"image",
"from",
"a",
"s3",
"storage",
"Parameters",
"==========",
"images",
":",
"refers",
"to",
"the",
"uri",
"given",
"by",
"the",
"user",
"to",
"pull",
"in",
"the",
"format",
"<collection",
">",
"/",
"<namespace",
">",
".",
"You",
"shou... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/s3/pull.py#L18-L106 | [
"def",
"pull",
"(",
"self",
",",
"images",
",",
"file_name",
"=",
"None",
",",
"save",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"images",
",",
"list",
")",
":",
"images",
"=",
"[",
"images",
"]",
"bot",
".",... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | remove | delete an image to Singularity Registry | sregistry/main/registry/delete.py | def remove(self, image, force=False):
'''delete an image to Singularity Registry'''
q = parse_image_name(remove_uri(image))
# If the registry is provided in the uri, use it
if q['registry'] == None:
q['registry'] = self.base
# If the base doesn't start with http or https, add it
q = s... | def remove(self, image, force=False):
'''delete an image to Singularity Registry'''
q = parse_image_name(remove_uri(image))
# If the registry is provided in the uri, use it
if q['registry'] == None:
q['registry'] = self.base
# If the base doesn't start with http or https, add it
q = s... | [
"delete",
"an",
"image",
"to",
"Singularity",
"Registry"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/registry/delete.py#L14-L49 | [
"def",
"remove",
"(",
"self",
",",
"image",
",",
"force",
"=",
"False",
")",
":",
"q",
"=",
"parse_image_name",
"(",
"remove_uri",
"(",
"image",
")",
")",
"# If the registry is provided in the uri, use it",
"if",
"q",
"[",
"'registry'",
"]",
"==",
"None",
":... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_lookup | get version by way of sregistry.version, returns a
lookup dictionary with several global variables without
needing to import singularity | setup.py | def get_lookup():
'''get version by way of sregistry.version, returns a
lookup dictionary with several global variables without
needing to import singularity
'''
lookup = dict()
version_file = os.path.join('sregistry', 'version.py')
with open(version_file) as filey:
exec(filey.read(... | def get_lookup():
'''get version by way of sregistry.version, returns a
lookup dictionary with several global variables without
needing to import singularity
'''
lookup = dict()
version_file = os.path.join('sregistry', 'version.py')
with open(version_file) as filey:
exec(filey.read(... | [
"get",
"version",
"by",
"way",
"of",
"sregistry",
".",
"version",
"returns",
"a",
"lookup",
"dictionary",
"with",
"several",
"global",
"variables",
"without",
"needing",
"to",
"import",
"singularity"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/setup.py#L9-L18 | [
"def",
"get_lookup",
"(",
")",
":",
"lookup",
"=",
"dict",
"(",
")",
"version_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"'sregistry'",
",",
"'version.py'",
")",
"with",
"open",
"(",
"version_file",
")",
"as",
"filey",
":",
"exec",
"(",
"filey",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_reqs | get requirements, mean reading in requirements and versions from
the lookup obtained with get_lookup | setup.py | def get_reqs(lookup=None, key='INSTALL_REQUIRES'):
'''get requirements, mean reading in requirements and versions from
the lookup obtained with get_lookup'''
if lookup == None:
lookup = get_lookup()
install_requires = []
for module in lookup[key]:
module_name = module[0]
mo... | def get_reqs(lookup=None, key='INSTALL_REQUIRES'):
'''get requirements, mean reading in requirements and versions from
the lookup obtained with get_lookup'''
if lookup == None:
lookup = get_lookup()
install_requires = []
for module in lookup[key]:
module_name = module[0]
mo... | [
"get",
"requirements",
"mean",
"reading",
"in",
"requirements",
"and",
"versions",
"from",
"the",
"lookup",
"obtained",
"with",
"get_lookup"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/setup.py#L22-L41 | [
"def",
"get_reqs",
"(",
"lookup",
"=",
"None",
",",
"key",
"=",
"'INSTALL_REQUIRES'",
")",
":",
"if",
"lookup",
"==",
"None",
":",
"lookup",
"=",
"get_lookup",
"(",
")",
"install_requires",
"=",
"[",
"]",
"for",
"module",
"in",
"lookup",
"[",
"key",
"]... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_singularity_version | get_singularity_version will determine the singularity version for a
build first, an environmental variable is looked at, followed by
using the system version.
Parameters
==========
singularity_version: if not defined, look for in environment. If still
not find, try finding v... | sregistry/utils/terminal.py | def get_singularity_version(singularity_version=None):
'''get_singularity_version will determine the singularity version for a
build first, an environmental variable is looked at, followed by
using the system version.
Parameters
==========
singularity_version: if not defined, lo... | def get_singularity_version(singularity_version=None):
'''get_singularity_version will determine the singularity version for a
build first, an environmental variable is looked at, followed by
using the system version.
Parameters
==========
singularity_version: if not defined, lo... | [
"get_singularity_version",
"will",
"determine",
"the",
"singularity",
"version",
"for",
"a",
"build",
"first",
"an",
"environmental",
"variable",
"is",
"looked",
"at",
"followed",
"by",
"using",
"the",
"system",
"version",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/utils/terminal.py#L25-L54 | [
"def",
"get_singularity_version",
"(",
"singularity_version",
"=",
"None",
")",
":",
"if",
"singularity_version",
"is",
"None",
":",
"singularity_version",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"\"SINGULARITY_VERSION\"",
")",
"if",
"singularity_version",
"is",... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | check_install | check_install will attempt to run the singularity command, and
return True if installed. The command line utils will not run
without this check.
Parameters
==========
software: the software to check if installed
quiet: should we be quiet? (default True) | sregistry/utils/terminal.py | def check_install(software=None, quiet=True):
'''check_install will attempt to run the singularity command, and
return True if installed. The command line utils will not run
without this check.
Parameters
==========
software: the software to check if installed
quiet: shou... | def check_install(software=None, quiet=True):
'''check_install will attempt to run the singularity command, and
return True if installed. The command line utils will not run
without this check.
Parameters
==========
software: the software to check if installed
quiet: shou... | [
"check_install",
"will",
"attempt",
"to",
"run",
"the",
"singularity",
"command",
"and",
"return",
"True",
"if",
"installed",
".",
"The",
"command",
"line",
"utils",
"will",
"not",
"run",
"without",
"this",
"check",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/utils/terminal.py#L74-L96 | [
"def",
"check_install",
"(",
"software",
"=",
"None",
",",
"quiet",
"=",
"True",
")",
":",
"if",
"software",
"is",
"None",
":",
"software",
"=",
"\"singularity\"",
"cmd",
"=",
"[",
"software",
",",
"'--version'",
"]",
"try",
":",
"version",
"=",
"run_com... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_installdir | get_installdir returns the installation directory of the application | sregistry/utils/terminal.py | def get_installdir():
'''get_installdir returns the installation directory of the application
'''
return os.path.abspath(os.path.dirname(os.path.dirname(__file__))) | def get_installdir():
'''get_installdir returns the installation directory of the application
'''
return os.path.abspath(os.path.dirname(os.path.dirname(__file__))) | [
"get_installdir",
"returns",
"the",
"installation",
"directory",
"of",
"the",
"application"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/utils/terminal.py#L99-L102 | [
"def",
"get_installdir",
"(",
")",
":",
"return",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
")",
")"
] | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_thumbnail | return the robot.png thumbnail from the database folder.
if the user has exported a different image, use that instead. | sregistry/utils/terminal.py | def get_thumbnail():
'''return the robot.png thumbnail from the database folder.
if the user has exported a different image, use that instead.
'''
from sregistry.defaults import SREGISTRY_THUMBNAIL
if SREGISTRY_THUMBNAIL is not None:
if os.path.exists(SREGISTRY_THUMBNAIL):
ret... | def get_thumbnail():
'''return the robot.png thumbnail from the database folder.
if the user has exported a different image, use that instead.
'''
from sregistry.defaults import SREGISTRY_THUMBNAIL
if SREGISTRY_THUMBNAIL is not None:
if os.path.exists(SREGISTRY_THUMBNAIL):
ret... | [
"return",
"the",
"robot",
".",
"png",
"thumbnail",
"from",
"the",
"database",
"folder",
".",
"if",
"the",
"user",
"has",
"exported",
"a",
"different",
"image",
"use",
"that",
"instead",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/utils/terminal.py#L105-L113 | [
"def",
"get_thumbnail",
"(",
")",
":",
"from",
"sregistry",
".",
"defaults",
"import",
"SREGISTRY_THUMBNAIL",
"if",
"SREGISTRY_THUMBNAIL",
"is",
"not",
"None",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"SREGISTRY_THUMBNAIL",
")",
":",
"return",
"SREGIS... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | run_command | run_command uses subprocess to send a command to the terminal.
Parameters
==========
cmd: the command to send, should be a list for subprocess
error_message: the error message to give to user if fails,
if none specified, will alert that command failed. | sregistry/utils/terminal.py | def run_command(cmd, sudo=False):
'''run_command uses subprocess to send a command to the terminal.
Parameters
==========
cmd: the command to send, should be a list for subprocess
error_message: the error message to give to user if fails,
if none specified, will alert that command failed.
... | def run_command(cmd, sudo=False):
'''run_command uses subprocess to send a command to the terminal.
Parameters
==========
cmd: the command to send, should be a list for subprocess
error_message: the error message to give to user if fails,
if none specified, will alert that command failed.
... | [
"run_command",
"uses",
"subprocess",
"to",
"send",
"a",
"command",
"to",
"the",
"terminal",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/utils/terminal.py#L116-L143 | [
"def",
"run_command",
"(",
"cmd",
",",
"sudo",
"=",
"False",
")",
":",
"if",
"sudo",
"is",
"True",
":",
"cmd",
"=",
"[",
"'sudo'",
"]",
"+",
"cmd",
"try",
":",
"output",
"=",
"Popen",
"(",
"cmd",
",",
"stderr",
"=",
"STDOUT",
",",
"stdout",
"=",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | Client._speak | if you want to add an extra print (of a parameter, for example)
for the user when the client initalizes, write it here, eg:
bot.info('[setting] value') | sregistry/main/dropbox/__init__.py | def _speak(self):
'''if you want to add an extra print (of a parameter, for example)
for the user when the client initalizes, write it here, eg:
bot.info('[setting] value')
'''
if hasattr(self, 'account'):
bot.info('connected to %s' %self.account.name.display_na... | def _speak(self):
'''if you want to add an extra print (of a parameter, for example)
for the user when the client initalizes, write it here, eg:
bot.info('[setting] value')
'''
if hasattr(self, 'account'):
bot.info('connected to %s' %self.account.name.display_na... | [
"if",
"you",
"want",
"to",
"add",
"an",
"extra",
"print",
"(",
"of",
"a",
"parameter",
"for",
"example",
")",
"for",
"the",
"user",
"when",
"the",
"client",
"initalizes",
"write",
"it",
"here",
"eg",
":",
"bot",
".",
"info",
"(",
"[",
"setting",
"]",... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/dropbox/__init__.py#L31-L37 | [
"def",
"_speak",
"(",
"self",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'account'",
")",
":",
"bot",
".",
"info",
"(",
"'connected to %s'",
"%",
"self",
".",
"account",
".",
"name",
".",
"display_name",
")"
] | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | Client._get_metadata | this is a wrapper around the main client.get_metadata to first parse
a Dropbox FileMetadata into a dicionary, then pass it on to the
primary get_metadata function.
Parameters
==========
image_file: the full path to the image file that had metadata
... | sregistry/main/dropbox/__init__.py | def _get_metadata(self, image_file=None, dbx_metadata=None):
'''this is a wrapper around the main client.get_metadata to first parse
a Dropbox FileMetadata into a dicionary, then pass it on to the
primary get_metadata function.
Parameters
==========
image... | def _get_metadata(self, image_file=None, dbx_metadata=None):
'''this is a wrapper around the main client.get_metadata to first parse
a Dropbox FileMetadata into a dicionary, then pass it on to the
primary get_metadata function.
Parameters
==========
image... | [
"this",
"is",
"a",
"wrapper",
"around",
"the",
"main",
"client",
".",
"get_metadata",
"to",
"first",
"parse",
"a",
"Dropbox",
"FileMetadata",
"into",
"a",
"dicionary",
"then",
"pass",
"it",
"on",
"to",
"the",
"primary",
"get_metadata",
"function",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/dropbox/__init__.py#L40-L60 | [
"def",
"_get_metadata",
"(",
"self",
",",
"image_file",
"=",
"None",
",",
"dbx_metadata",
"=",
"None",
")",
":",
"metadata",
"=",
"dict",
"(",
")",
"if",
"dbx_metadata",
"is",
"not",
"None",
":",
"for",
"key",
"in",
"dbx_metadata",
".",
"__dir__",
"(",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | Client._update_secrets | update secrets will look for a dropbox token in the environment at
SREGISTRY_DROPBOX_TOKEN and if found, create a client. If not,
an error message is returned and the client exits. | sregistry/main/dropbox/__init__.py | def _update_secrets(self):
'''update secrets will look for a dropbox token in the environment at
SREGISTRY_DROPBOX_TOKEN and if found, create a client. If not,
an error message is returned and the client exits.
'''
# Retrieve the user token. Exit if not found
toke... | def _update_secrets(self):
'''update secrets will look for a dropbox token in the environment at
SREGISTRY_DROPBOX_TOKEN and if found, create a client. If not,
an error message is returned and the client exits.
'''
# Retrieve the user token. Exit if not found
toke... | [
"update",
"secrets",
"will",
"look",
"for",
"a",
"dropbox",
"token",
"in",
"the",
"environment",
"at",
"SREGISTRY_DROPBOX_TOKEN",
"and",
"if",
"found",
"create",
"a",
"client",
".",
"If",
"not",
"an",
"error",
"message",
"is",
"returned",
"and",
"the",
"clie... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/dropbox/__init__.py#L63-L80 | [
"def",
"_update_secrets",
"(",
"self",
")",
":",
"# Retrieve the user token. Exit if not found ",
"token",
"=",
"self",
".",
"_required_get_and_update",
"(",
"'SREGISTRY_DROPBOX_TOKEN'",
")",
"# Create the dropbox client",
"self",
".",
"dbx",
"=",
"Dropbox",
"(",
"token",... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | print_output | print the output to the console for the user. If the user wants the content
also printed to an output file, do that.
Parameters
==========
response: the response from the builder, with metadata added
output_file: if defined, write output also to file | sregistry/client/build.py | def print_output(response, output_file=None):
'''print the output to the console for the user. If the user wants the content
also printed to an output file, do that.
Parameters
==========
response: the response from the builder, with metadata added
output_file: if defined, write ... | def print_output(response, output_file=None):
'''print the output to the console for the user. If the user wants the content
also printed to an output file, do that.
Parameters
==========
response: the response from the builder, with metadata added
output_file: if defined, write ... | [
"print",
"the",
"output",
"to",
"the",
"console",
"for",
"the",
"user",
".",
"If",
"the",
"user",
"wants",
"the",
"content",
"also",
"printed",
"to",
"an",
"output",
"file",
"do",
"that",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/client/build.py#L94-L130 | [
"def",
"print_output",
"(",
"response",
",",
"output_file",
"=",
"None",
")",
":",
"# If successful built, show container uri",
"if",
"response",
"[",
"'status'",
"]",
"==",
"'SUCCESS'",
":",
"bucket",
"=",
"response",
"[",
"'artifacts'",
"]",
"[",
"'objects'",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | kill | kill is a helper function to call the "kill" function of the client,
meaning we bring down an instance. | sregistry/client/build.py | def kill(args):
'''kill is a helper function to call the "kill" function of the client,
meaning we bring down an instance.
'''
from sregistry.main import Client as cli
if len(args.commands) > 0:
for name in args.commands:
cli.destroy(name)
sys.exit(0) | def kill(args):
'''kill is a helper function to call the "kill" function of the client,
meaning we bring down an instance.
'''
from sregistry.main import Client as cli
if len(args.commands) > 0:
for name in args.commands:
cli.destroy(name)
sys.exit(0) | [
"kill",
"is",
"a",
"helper",
"function",
"to",
"call",
"the",
"kill",
"function",
"of",
"the",
"client",
"meaning",
"we",
"bring",
"down",
"an",
"instance",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/client/build.py#L133-L141 | [
"def",
"kill",
"(",
"args",
")",
":",
"from",
"sregistry",
".",
"main",
"import",
"Client",
"as",
"cli",
"if",
"len",
"(",
"args",
".",
"commands",
")",
">",
"0",
":",
"for",
"name",
"in",
"args",
".",
"commands",
":",
"cli",
".",
"destroy",
"(",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | templates | list a specific template (if a name is provided) or all templates
available.
Parameters
==========
args: the argparse object to look for a template name
template_name: if not set, show all | sregistry/client/build.py | def templates(args, template_name=None):
'''list a specific template (if a name is provided) or all templates
available.
Parameters
==========
args: the argparse object to look for a template name
template_name: if not set, show all
'''
from sregistry.main import get_cli... | def templates(args, template_name=None):
'''list a specific template (if a name is provided) or all templates
available.
Parameters
==========
args: the argparse object to look for a template name
template_name: if not set, show all
'''
from sregistry.main import get_cli... | [
"list",
"a",
"specific",
"template",
"(",
"if",
"a",
"name",
"is",
"provided",
")",
"or",
"all",
"templates",
"available",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/client/build.py#L152-L170 | [
"def",
"templates",
"(",
"args",
",",
"template_name",
"=",
"None",
")",
":",
"from",
"sregistry",
".",
"main",
"import",
"get_client",
"# We don't need storage/compute connections",
"cli",
"=",
"get_client",
"(",
"init",
"=",
"False",
")",
"if",
"len",
"(",
"... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | list_logs | list a specific log for a builder, or the latest log if none provided
Parameters
==========
args: the argparse object to look for a container name
container_name: a default container name set to be None (show latest log) | sregistry/client/build.py | def list_logs(args, container_name=None):
'''list a specific log for a builder, or the latest log if none provided
Parameters
==========
args: the argparse object to look for a container name
container_name: a default container name set to be None (show latest log)
'''
from sre... | def list_logs(args, container_name=None):
'''list a specific log for a builder, or the latest log if none provided
Parameters
==========
args: the argparse object to look for a container name
container_name: a default container name set to be None (show latest log)
'''
from sre... | [
"list",
"a",
"specific",
"log",
"for",
"a",
"builder",
"or",
"the",
"latest",
"log",
"if",
"none",
"provided"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/client/build.py#L173-L186 | [
"def",
"list_logs",
"(",
"args",
",",
"container_name",
"=",
"None",
")",
":",
"from",
"sregistry",
".",
"main",
"import",
"Client",
"as",
"cli",
"if",
"len",
"(",
"args",
".",
"commands",
")",
">",
"0",
":",
"container_name",
"=",
"args",
".",
"comman... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | Client.get_collections | get a listing of collections that the user has access to. | sregistry/main/swift/__init__.py | def get_collections(self):
'''get a listing of collections that the user has access to.
'''
collections = []
for container in self.conn.get_account()[1]:
collections.append(container['name'])
return collections | def get_collections(self):
'''get a listing of collections that the user has access to.
'''
collections = []
for container in self.conn.get_account()[1]:
collections.append(container['name'])
return collections | [
"get",
"a",
"listing",
"of",
"collections",
"that",
"the",
"user",
"has",
"access",
"to",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/swift/__init__.py#L37-L43 | [
"def",
"get_collections",
"(",
"self",
")",
":",
"collections",
"=",
"[",
"]",
"for",
"container",
"in",
"self",
".",
"conn",
".",
"get_account",
"(",
")",
"[",
"1",
"]",
":",
"collections",
".",
"append",
"(",
"container",
"[",
"'name'",
"]",
")",
"... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | Client._get_or_create_collection | get or create a collection, meaning that if the get returns
None, create and return the response to the user.
Parameters
==========
name: the name of the collection to get (and create) | sregistry/main/swift/__init__.py | def _get_or_create_collection(self, name):
'''get or create a collection, meaning that if the get returns
None, create and return the response to the user.
Parameters
==========
name: the name of the collection to get (and create)
'''
try:
... | def _get_or_create_collection(self, name):
'''get or create a collection, meaning that if the get returns
None, create and return the response to the user.
Parameters
==========
name: the name of the collection to get (and create)
'''
try:
... | [
"get",
"or",
"create",
"a",
"collection",
"meaning",
"that",
"if",
"the",
"get",
"returns",
"None",
"create",
"and",
"return",
"the",
"response",
"to",
"the",
"user",
".",
"Parameters",
"==========",
"name",
":",
"the",
"name",
"of",
"the",
"collection",
"... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/swift/__init__.py#L53-L66 | [
"def",
"_get_or_create_collection",
"(",
"self",
",",
"name",
")",
":",
"try",
":",
"collection",
"=",
"self",
".",
"_get_collection",
"(",
"name",
")",
"except",
":",
"bot",
".",
"info",
"(",
"'Creating collection %s...'",
"%",
"name",
")",
"collection",
"=... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | Client._update_secrets | update secrets will look for a user and token in the environment
If we find the values, cache and continue. Otherwise, exit with error | sregistry/main/swift/__init__.py | def _update_secrets(self):
'''update secrets will look for a user and token in the environment
If we find the values, cache and continue. Otherwise, exit with error
'''
# Get the swift authentication type first. That will determine what we
# will need to collect for proper a... | def _update_secrets(self):
'''update secrets will look for a user and token in the environment
If we find the values, cache and continue. Otherwise, exit with error
'''
# Get the swift authentication type first. That will determine what we
# will need to collect for proper a... | [
"update",
"secrets",
"will",
"look",
"for",
"a",
"user",
"and",
"token",
"in",
"the",
"environment",
"If",
"we",
"find",
"the",
"values",
"cache",
"and",
"continue",
".",
"Otherwise",
"exit",
"with",
"error"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/swift/__init__.py#L69-L163 | [
"def",
"_update_secrets",
"(",
"self",
")",
":",
"# Get the swift authentication type first. That will determine what we",
"# will need to collect for proper authentication",
"self",
".",
"config",
"[",
"'SREGISTRY_SWIFT_AUTHTYPE'",
"]",
"=",
"self",
".",
"_required_get_and_update... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | Client._update_secrets | The user is required to have an application secrets file in his
or her environment. The information isn't saved to the secrets
file, but the client exists with error if the variable isn't found. | sregistry/main/google_build/__init__.py | def _update_secrets(self):
'''The user is required to have an application secrets file in his
or her environment. The information isn't saved to the secrets
file, but the client exists with error if the variable isn't found.
'''
env = 'GOOGLE_APPLICATION_CREDENTIALS'
... | def _update_secrets(self):
'''The user is required to have an application secrets file in his
or her environment. The information isn't saved to the secrets
file, but the client exists with error if the variable isn't found.
'''
env = 'GOOGLE_APPLICATION_CREDENTIALS'
... | [
"The",
"user",
"is",
"required",
"to",
"have",
"an",
"application",
"secrets",
"file",
"in",
"his",
"or",
"her",
"environment",
".",
"The",
"information",
"isn",
"t",
"saved",
"to",
"the",
"secrets",
"file",
"but",
"the",
"client",
"exists",
"with",
"error... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/google_build/__init__.py#L53-L62 | [
"def",
"_update_secrets",
"(",
"self",
")",
":",
"env",
"=",
"'GOOGLE_APPLICATION_CREDENTIALS'",
"self",
".",
"_secrets",
"=",
"self",
".",
"_get_and_update_setting",
"(",
"env",
")",
"if",
"self",
".",
"_secrets",
"is",
"None",
":",
"bot",
".",
"error",
"("... | 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_build/__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_build/__init__.py#L65-L86 | [
"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_bucket | get a bucket based on a bucket name. If it doesn't exist, create it.
Parameters
==========
bucket_name: the name of the bucket to get (or create). It should
not contain google, and should be all lowercase with -
or underscores. | sregistry/main/google_build/__init__.py | def _get_bucket(self, bucket_name):
'''get a bucket based on a bucket name. If it doesn't exist, create it.
Parameters
==========
bucket_name: the name of the bucket to get (or create). It should
not contain google, and should be all lowercase with -
... | def _get_bucket(self, bucket_name):
'''get a bucket based on a bucket name. If it doesn't exist, create it.
Parameters
==========
bucket_name: the name of the bucket to get (or create). It should
not contain google, and should be all lowercase with -
... | [
"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_build/__init__.py#L102-L125 | [
"def",
"_get_bucket",
"(",
"self",
",",
"bucket_name",
")",
":",
"# Case 1: The bucket already exists",
"try",
":",
"bucket",
"=",
"self",
".",
"_bucket_service",
".",
"get_bucket",
"(",
"bucket_name",
")",
"# Case 2: The bucket needs to be created",
"except",
"google",... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_client | get the correct client depending on the driver of interest. The
selected client can be chosen based on the environment variable
SREGISTRY_CLIENT, and later changed based on the image uri parsed
If there is no preference, the default is to load the singularity
hub client.
Parameters
... | sregistry/main/__init__.py | def get_client(image=None, quiet=False, **kwargs):
'''
get the correct client depending on the driver of interest. The
selected client can be chosen based on the environment variable
SREGISTRY_CLIENT, and later changed based on the image uri parsed
If there is no preference, the default ... | def get_client(image=None, quiet=False, **kwargs):
'''
get the correct client depending on the driver of interest. The
selected client can be chosen based on the environment variable
SREGISTRY_CLIENT, and later changed based on the image uri parsed
If there is no preference, the default ... | [
"get",
"the",
"correct",
"client",
"depending",
"on",
"the",
"driver",
"of",
"interest",
".",
"The",
"selected",
"client",
"can",
"be",
"chosen",
"based",
"on",
"the",
"environment",
"variable",
"SREGISTRY_CLIENT",
"and",
"later",
"changed",
"based",
"on",
"th... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/__init__.py#L26-L116 | [
"def",
"get_client",
"(",
"image",
"=",
"None",
",",
"quiet",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"sregistry",
".",
"defaults",
"import",
"SREGISTRY_CLIENT",
"# Give the user a warning:",
"if",
"not",
"check_install",
"(",
")",
":",
"bot... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | pull | pull an image from an endpoint
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 ... | sregistry/main/hub/pull.py | def pull(self, images, file_name=None, save=True, force=False, **kwargs):
''' pull an image from an endpoint
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 ... | def pull(self, images, file_name=None, save=True, force=False, **kwargs):
''' pull an image from an endpoint
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 ... | [
"pull",
"an",
"image",
"from",
"an",
"endpoint",
"Parameters",
"==========",
"images",
":",
"refers",
"to",
"the",
"uri",
"given",
"by",
"the",
"user",
"to",
"pull",
"in",
"the",
"format",
"<collection",
">",
"/",
"<namespace",
">",
".",
"You",
"should",
... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/hub/pull.py#L16-L94 | [
"def",
"pull",
"(",
"self",
",",
"images",
",",
"file_name",
"=",
"None",
",",
"save",
"=",
"True",
",",
"force",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"images",
",",
"list",
")",
":",
"images",
"=",
"["... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | ipython | give the user an ipython shell, optionally with an endpoint of choice. | sregistry/client/shell.py | def ipython(args):
'''give the user an ipython shell, optionally with an endpoint of choice.
'''
# The client will announce itself (backend/database) unless it's get
from sregistry.main import get_client
client = get_client(args.endpoint)
client.announce(args.command)
from IPython import em... | def ipython(args):
'''give the user an ipython shell, optionally with an endpoint of choice.
'''
# The client will announce itself (backend/database) unless it's get
from sregistry.main import get_client
client = get_client(args.endpoint)
client.announce(args.command)
from IPython import em... | [
"give",
"the",
"user",
"an",
"ipython",
"shell",
"optionally",
"with",
"an",
"endpoint",
"of",
"choice",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/client/shell.py#L47-L56 | [
"def",
"ipython",
"(",
"args",
")",
":",
"# The client will announce itself (backend/database) unless it's get",
"from",
"sregistry",
".",
"main",
"import",
"get_client",
"client",
"=",
"get_client",
"(",
"args",
".",
"endpoint",
")",
"client",
".",
"announce",
"(",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | update_token | update_token uses HTTP basic authentication to get a token for
Docker registry API V2 operations. We get here if a 401 is
returned for a request.
Parameters
==========
response: the http request response to parse for the challenge.
https://docs.docker.com/registry/spec/auth/token/ | sregistry/main/docker/api.py | def update_token(self, response):
'''update_token uses HTTP basic authentication to get a token for
Docker registry API V2 operations. We get here if a 401 is
returned for a request.
Parameters
==========
response: the http request response to parse for the challenge.
https://docs.dock... | def update_token(self, response):
'''update_token uses HTTP basic authentication to get a token for
Docker registry API V2 operations. We get here if a 401 is
returned for a request.
Parameters
==========
response: the http request response to parse for the challenge.
https://docs.dock... | [
"update_token",
"uses",
"HTTP",
"basic",
"authentication",
"to",
"get",
"a",
"token",
"for",
"Docker",
"registry",
"API",
"V2",
"operations",
".",
"We",
"get",
"here",
"if",
"a",
"401",
"is",
"returned",
"for",
"a",
"request",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/docker/api.py#L32-L73 | [
"def",
"update_token",
"(",
"self",
",",
"response",
")",
":",
"not_asking_auth",
"=",
"\"Www-Authenticate\"",
"not",
"in",
"response",
".",
"headers",
"if",
"response",
".",
"status_code",
"!=",
"401",
"or",
"not_asking_auth",
":",
"bot",
".",
"error",
"(",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_manifests | get_manifests calls get_manifest for each of the schema versions,
including v2 and v1. Version 1 includes image layers and metadata,
and version 2 must be parsed for a specific manifest, and the 2nd
call includes the layers. If a digest is not provided
latest is used.
Parameters
... | sregistry/main/docker/api.py | def get_manifests(self, repo_name, digest=None):
'''get_manifests calls get_manifest for each of the schema versions,
including v2 and v1. Version 1 includes image layers and metadata,
and version 2 must be parsed for a specific manifest, and the 2nd
call includes the layers. If a digest is not... | def get_manifests(self, repo_name, digest=None):
'''get_manifests calls get_manifest for each of the schema versions,
including v2 and v1. Version 1 includes image layers and metadata,
and version 2 must be parsed for a specific manifest, and the 2nd
call includes the layers. If a digest is not... | [
"get_manifests",
"calls",
"get_manifest",
"for",
"each",
"of",
"the",
"schema",
"versions",
"including",
"v2",
"and",
"v1",
".",
"Version",
"1",
"includes",
"image",
"layers",
"and",
"metadata",
"and",
"version",
"2",
"must",
"be",
"parsed",
"for",
"a",
"spe... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/docker/api.py#L77-L110 | [
"def",
"get_manifests",
"(",
"self",
",",
"repo_name",
",",
"digest",
"=",
"None",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'manifests'",
")",
":",
"self",
".",
"manifests",
"=",
"{",
"}",
"# Obtain schema version 1 (metadata) and 2, and image config... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_manifest_selfLink | get a selfLink for the manifest, for use by the client get_manifest
function, along with the parents pull
Parameters
==========
repo_name: reference to the <username>/<repository>:<tag> to obtain
digest: a tag or shasum version | sregistry/main/docker/api.py | def get_manifest_selfLink(self, repo_name, digest=None):
''' get a selfLink for the manifest, for use by the client get_manifest
function, along with the parents pull
Parameters
==========
repo_name: reference to the <username>/<repository>:<tag> to obtain
digest: a tag or shas... | def get_manifest_selfLink(self, repo_name, digest=None):
''' get a selfLink for the manifest, for use by the client get_manifest
function, along with the parents pull
Parameters
==========
repo_name: reference to the <username>/<repository>:<tag> to obtain
digest: a tag or shas... | [
"get",
"a",
"selfLink",
"for",
"the",
"manifest",
"for",
"use",
"by",
"the",
"client",
"get_manifest",
"function",
"along",
"with",
"the",
"parents",
"pull",
"Parameters",
"==========",
"repo_name",
":",
"reference",
"to",
"the",
"<username",
">",
"/",
"<repos... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/docker/api.py#L113-L128 | [
"def",
"get_manifest_selfLink",
"(",
"self",
",",
"repo_name",
",",
"digest",
"=",
"None",
")",
":",
"url",
"=",
"\"%s/%s/manifests\"",
"%",
"(",
"self",
".",
"base",
",",
"repo_name",
")",
"# Add a digest - a tag or hash (version)",
"if",
"digest",
"is",
"None"... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_manifest | get_manifest should return an image manifest
for a particular repo and tag. The image details
are extracted when the client is generated.
Parameters
==========
repo_name: reference to the <username>/<repository>:<tag> to obtain
digest: a tag or shasum version
version: ... | sregistry/main/docker/api.py | def get_manifest(self, repo_name, digest=None, version="v1"):
'''
get_manifest should return an image manifest
for a particular repo and tag. The image details
are extracted when the client is generated.
Parameters
==========
repo_name: reference to the <username>/<reposi... | def get_manifest(self, repo_name, digest=None, version="v1"):
'''
get_manifest should return an image manifest
for a particular repo and tag. The image details
are extracted when the client is generated.
Parameters
==========
repo_name: reference to the <username>/<reposi... | [
"get_manifest",
"should",
"return",
"an",
"image",
"manifest",
"for",
"a",
"particular",
"repo",
"and",
"tag",
".",
"The",
"image",
"details",
"are",
"extracted",
"when",
"the",
"client",
"is",
"generated",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/docker/api.py#L131-L160 | [
"def",
"get_manifest",
"(",
"self",
",",
"repo_name",
",",
"digest",
"=",
"None",
",",
"version",
"=",
"\"v1\"",
")",
":",
"accepts",
"=",
"{",
"'config'",
":",
"\"application/vnd.docker.container.image.v1+json\"",
",",
"'v1'",
":",
"\"application/vnd.docker.distrib... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | download_layers | download layers is a wrapper to do the following for a client loaded
with a manifest for an image:
1. use the manifests to retrieve list of digests (get_digests)
2. atomically download the list to destination (get_layers)
This function uses the MultiProcess client to download lay... | sregistry/main/docker/api.py | def download_layers(self, repo_name, digest=None, destination=None):
''' download layers is a wrapper to do the following for a client loaded
with a manifest for an image:
1. use the manifests to retrieve list of digests (get_digests)
2. atomically download the list to destination (ge... | def download_layers(self, repo_name, digest=None, destination=None):
''' download layers is a wrapper to do the following for a client loaded
with a manifest for an image:
1. use the manifests to retrieve list of digests (get_digests)
2. atomically download the list to destination (ge... | [
"download",
"layers",
"is",
"a",
"wrapper",
"to",
"do",
"the",
"following",
"for",
"a",
"client",
"loaded",
"with",
"a",
"manifest",
"for",
"an",
"image",
":",
"1",
".",
"use",
"the",
"manifests",
"to",
"retrieve",
"list",
"of",
"digests",
"(",
"get_dige... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/docker/api.py#L164-L210 | [
"def",
"download_layers",
"(",
"self",
",",
"repo_name",
",",
"digest",
"=",
"None",
",",
"destination",
"=",
"None",
")",
":",
"from",
"sregistry",
".",
"main",
".",
"workers",
"import",
"(",
"Workers",
",",
"download_task",
")",
"# 1. Get manifests if not re... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_download_cache | determine the user preference for atomic download of layers. If
the user has set a singularity cache directory, honor it. Otherwise,
use the Singularity default. | sregistry/main/docker/api.py | def get_download_cache(self, destination, subfolder='docker'):
'''determine the user preference for atomic download of layers. If
the user has set a singularity cache directory, honor it. Otherwise,
use the Singularity default.
'''
# First priority after user specification is Singularity Cache... | def get_download_cache(self, destination, subfolder='docker'):
'''determine the user preference for atomic download of layers. If
the user has set a singularity cache directory, honor it. Otherwise,
use the Singularity default.
'''
# First priority after user specification is Singularity Cache... | [
"determine",
"the",
"user",
"preference",
"for",
"atomic",
"download",
"of",
"layers",
".",
"If",
"the",
"user",
"has",
"set",
"a",
"singularity",
"cache",
"directory",
"honor",
"it",
".",
"Otherwise",
"use",
"the",
"Singularity",
"default",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/docker/api.py#L213-L231 | [
"def",
"get_download_cache",
"(",
"self",
",",
"destination",
",",
"subfolder",
"=",
"'docker'",
")",
":",
"# First priority after user specification is Singularity Cache",
"if",
"destination",
"is",
"None",
":",
"destination",
"=",
"self",
".",
"_get_setting",
"(",
"... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_digests | return a list of layers from a manifest.
The function is intended to work with both version
1 and 2 of the schema. All layers (including redundant)
are returned. By default, we try version 2 first,
then fall back to version 1.
For version 1 manifests: extraction is reversed
P... | sregistry/main/docker/api.py | def get_digests(self):
'''return a list of layers from a manifest.
The function is intended to work with both version
1 and 2 of the schema. All layers (including redundant)
are returned. By default, we try version 2 first,
then fall back to version 1.
For version 1 manifests: ex... | def get_digests(self):
'''return a list of layers from a manifest.
The function is intended to work with both version
1 and 2 of the schema. All layers (including redundant)
are returned. By default, we try version 2 first,
then fall back to version 1.
For version 1 manifests: ex... | [
"return",
"a",
"list",
"of",
"layers",
"from",
"a",
"manifest",
".",
"The",
"function",
"is",
"intended",
"to",
"work",
"with",
"both",
"version",
"1",
"and",
"2",
"of",
"the",
"schema",
".",
"All",
"layers",
"(",
"including",
"redundant",
")",
"are",
... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/docker/api.py#L234-L299 | [
"def",
"get_digests",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'manifests'",
")",
":",
"bot",
".",
"error",
"(",
"'Please retrieve manifests for an image first.'",
")",
"sys",
".",
"exit",
"(",
"1",
")",
"digests",
"=",
"[",
"]",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_layer | download an image layer (.tar.gz) to a specified download folder.
Parameters
==========
download_folder: download to this folder. If not set, uses temp.
repo_name: the image name (library/ubuntu) to retrieve | sregistry/main/docker/api.py | def get_layer(self, image_id, repo_name, download_folder=None):
'''download an image layer (.tar.gz) to a specified download folder.
Parameters
==========
download_folder: download to this folder. If not set, uses temp.
repo_name: the image name (library/ubuntu) to retrieve
'''
... | def get_layer(self, image_id, repo_name, download_folder=None):
'''download an image layer (.tar.gz) to a specified download folder.
Parameters
==========
download_folder: download to this folder. If not set, uses temp.
repo_name: the image name (library/ubuntu) to retrieve
'''
... | [
"download",
"an",
"image",
"layer",
"(",
".",
"tar",
".",
"gz",
")",
"to",
"a",
"specified",
"download",
"folder",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/docker/api.py#L316-L348 | [
"def",
"get_layer",
"(",
"self",
",",
"image_id",
",",
"repo_name",
",",
"download_folder",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_get_layerLink",
"(",
"repo_name",
",",
"image_id",
")",
"bot",
".",
"verbose",
"(",
"\"Downloading layers from %s\"",
... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_size | get_size will return the image size (must use v.2.0 manifest)
Parameters
==========
add_padding: if true, return reported size * 5
round_up: if true, round up to nearest integer
return_mb: if true, defaults bytes are converted to MB | sregistry/main/docker/api.py | def get_size(self, add_padding=True, round_up=True, return_mb=True):
'''get_size will return the image size (must use v.2.0 manifest)
Parameters
==========
add_padding: if true, return reported size * 5
round_up: if true, round up to nearest integer
return_mb: if true, de... | def get_size(self, add_padding=True, round_up=True, return_mb=True):
'''get_size will return the image size (must use v.2.0 manifest)
Parameters
==========
add_padding: if true, return reported size * 5
round_up: if true, round up to nearest integer
return_mb: if true, de... | [
"get_size",
"will",
"return",
"the",
"image",
"size",
"(",
"must",
"use",
"v",
".",
"2",
".",
"0",
"manifest",
")",
"Parameters",
"==========",
"add_padding",
":",
"if",
"true",
"return",
"reported",
"size",
"*",
"5",
"round_up",
":",
"if",
"true",
"roun... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/docker/api.py#L351-L383 | [
"def",
"get_size",
"(",
"self",
",",
"add_padding",
"=",
"True",
",",
"round_up",
"=",
"True",
",",
"return_mb",
"=",
"True",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'manifests'",
")",
":",
"bot",
".",
"error",
"(",
"'Please retrieve manifes... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_config | get_config returns a particular key (default is Entrypoint)
from a VERSION 1 manifest obtained with get_manifest.
Parameters
==========
key: the key to return from the manifest config
delim: Given a list, the delim to use to join the entries.
Default is newline | sregistry/main/docker/api.py | def get_config(self, key="Entrypoint", delim=None):
'''get_config returns a particular key (default is Entrypoint)
from a VERSION 1 manifest obtained with get_manifest.
Parameters
==========
key: the key to return from the manifest config
delim: Given a list, the delim to us... | def get_config(self, key="Entrypoint", delim=None):
'''get_config returns a particular key (default is Entrypoint)
from a VERSION 1 manifest obtained with get_manifest.
Parameters
==========
key: the key to return from the manifest config
delim: Given a list, the delim to us... | [
"get_config",
"returns",
"a",
"particular",
"key",
"(",
"default",
"is",
"Entrypoint",
")",
"from",
"a",
"VERSION",
"1",
"manifest",
"obtained",
"with",
"get_manifest",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/docker/api.py#L391-L433 | [
"def",
"get_config",
"(",
"self",
",",
"key",
"=",
"\"Entrypoint\"",
",",
"delim",
"=",
"None",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'manifests'",
")",
":",
"bot",
".",
"error",
"(",
"'Please retrieve manifests for an image first.'",
")",
"sy... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | get_environment_tar | return the environment.tar generated with the Singularity software.
We first try the Linux Filesystem expected location in /usr/libexec
If not found, we detect the system archicture
dirname $(singularity selftest 2>&1 | grep 'lib' | awk '{print $4}' | sed -e 's@\(.*/singularity\).*@\1@') | sregistry/main/docker/api.py | def get_environment_tar(self):
'''return the environment.tar generated with the Singularity software.
We first try the Linux Filesystem expected location in /usr/libexec
If not found, we detect the system archicture
dirname $(singularity selftest 2>&1 | grep 'lib' | awk '{print $4}' | sed -e '... | def get_environment_tar(self):
'''return the environment.tar generated with the Singularity software.
We first try the Linux Filesystem expected location in /usr/libexec
If not found, we detect the system archicture
dirname $(singularity selftest 2>&1 | grep 'lib' | awk '{print $4}' | sed -e '... | [
"return",
"the",
"environment",
".",
"tar",
"generated",
"with",
"the",
"Singularity",
"software",
".",
"We",
"first",
"try",
"the",
"Linux",
"Filesystem",
"expected",
"location",
"in",
"/",
"usr",
"/",
"libexec",
"If",
"not",
"found",
"we",
"detect",
"the",... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/docker/api.py#L436-L466 | [
"def",
"get_environment_tar",
"(",
"self",
")",
":",
"from",
"sregistry",
".",
"utils",
"import",
"(",
"which",
",",
"run_command",
")",
"# First attempt - look at File System Hierarchy Standard (FHS)",
"res",
"=",
"which",
"(",
"'singularity'",
")",
"[",
"'message'",... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | create_metadata_tar | create a metadata tar (runscript and environment) to add to the
downloaded image. This function uses all functions in this section
to obtain key--> values from the manifest config, and write
to a .tar.gz
Parameters
==========
metadata_folder: the metadata folder in the singula... | sregistry/main/docker/api.py | def create_metadata_tar(self, destination=None, metadata_folder=".singularity.d"):
'''create a metadata tar (runscript and environment) to add to the
downloaded image. This function uses all functions in this section
to obtain key--> values from the manifest config, and write
to a .tar.gz
... | def create_metadata_tar(self, destination=None, metadata_folder=".singularity.d"):
'''create a metadata tar (runscript and environment) to add to the
downloaded image. This function uses all functions in this section
to obtain key--> values from the manifest config, and write
to a .tar.gz
... | [
"create",
"a",
"metadata",
"tar",
"(",
"runscript",
"and",
"environment",
")",
"to",
"add",
"to",
"the",
"downloaded",
"image",
".",
"This",
"function",
"uses",
"all",
"functions",
"in",
"this",
"section",
"to",
"obtain",
"key",
"--",
">",
"values",
"from"... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/docker/api.py#L469-L518 | [
"def",
"create_metadata_tar",
"(",
"self",
",",
"destination",
"=",
"None",
",",
"metadata_folder",
"=",
"\".singularity.d\"",
")",
":",
"tar_file",
"=",
"None",
"# We will add these files to it",
"files",
"=",
"[",
"]",
"# Extract and add environment",
"environ",
"="... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | extract_env | extract the environment from the manifest, or return None.
Used by functions env_extract_image, and env_extract_tar | sregistry/main/docker/api.py | def extract_env(self):
'''extract the environment from the manifest, or return None.
Used by functions env_extract_image, and env_extract_tar
'''
environ = self._get_config('Env')
if environ is not None:
if not isinstance(environ, list):
environ = [environ]
lines = []... | def extract_env(self):
'''extract the environment from the manifest, or return None.
Used by functions env_extract_image, and env_extract_tar
'''
environ = self._get_config('Env')
if environ is not None:
if not isinstance(environ, list):
environ = [environ]
lines = []... | [
"extract",
"the",
"environment",
"from",
"the",
"manifest",
"or",
"return",
"None",
".",
"Used",
"by",
"functions",
"env_extract_image",
"and",
"env_extract_tar"
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/docker/api.py#L521-L538 | [
"def",
"extract_env",
"(",
"self",
")",
":",
"environ",
"=",
"self",
".",
"_get_config",
"(",
"'Env'",
")",
"if",
"environ",
"is",
"not",
"None",
":",
"if",
"not",
"isinstance",
"(",
"environ",
",",
"list",
")",
":",
"environ",
"=",
"[",
"environ",
"... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | extract_runscript | extract the runscript (EntryPoint) as first priority, unless the
user has specified to use the CMD. If Entrypoint is not defined,
we default to None:
1. IF SREGISTRY_DOCKERHUB_CMD is set, use Cmd
2. If not set, or Cmd is None/blank, try Entrypoint
3. If Entrypoint is not set, use de... | sregistry/main/docker/api.py | def extract_runscript(self):
'''extract the runscript (EntryPoint) as first priority, unless the
user has specified to use the CMD. If Entrypoint is not defined,
we default to None:
1. IF SREGISTRY_DOCKERHUB_CMD is set, use Cmd
2. If not set, or Cmd is None/blank, try Entrypoint
... | def extract_runscript(self):
'''extract the runscript (EntryPoint) as first priority, unless the
user has specified to use the CMD. If Entrypoint is not defined,
we default to None:
1. IF SREGISTRY_DOCKERHUB_CMD is set, use Cmd
2. If not set, or Cmd is None/blank, try Entrypoint
... | [
"extract",
"the",
"runscript",
"(",
"EntryPoint",
")",
"as",
"first",
"priority",
"unless",
"the",
"user",
"has",
"specified",
"to",
"use",
"the",
"CMD",
".",
"If",
"Entrypoint",
"is",
"not",
"defined",
"we",
"default",
"to",
"None",
":",
"1",
".",
"IF",... | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/docker/api.py#L541-L581 | [
"def",
"extract_runscript",
"(",
"self",
")",
":",
"use_cmd",
"=",
"self",
".",
"_get_setting",
"(",
"'SREGISTRY_DOCKER_CMD'",
")",
"# Does the user want to use the CMD instead of ENTRYPOINT?",
"commands",
"=",
"[",
"\"Entrypoint\"",
",",
"\"Cmd\"",
"]",
"if",
"use_cmd"... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
test | Client._update_base | update the base, including the URL for GitLab and the API endpoint. | sregistry/main/gitlab/__init__.py | def _update_base(self):
'''update the base, including the URL for GitLab and the API endpoint.
'''
self.base = self._get_and_update_setting('SREGISTRY_GITLAB_BASE',
"https://gitlab.com/")
self.api_base = "%s/api/v4" % self.base.strip('/')
... | def _update_base(self):
'''update the base, including the URL for GitLab and the API endpoint.
'''
self.base = self._get_and_update_setting('SREGISTRY_GITLAB_BASE',
"https://gitlab.com/")
self.api_base = "%s/api/v4" % self.base.strip('/')
... | [
"update",
"the",
"base",
"including",
"the",
"URL",
"for",
"GitLab",
"and",
"the",
"API",
"endpoint",
"."
] | singularityhub/sregistry-cli | python | https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/gitlab/__init__.py#L28-L41 | [
"def",
"_update_base",
"(",
"self",
")",
":",
"self",
".",
"base",
"=",
"self",
".",
"_get_and_update_setting",
"(",
"'SREGISTRY_GITLAB_BASE'",
",",
"\"https://gitlab.com/\"",
")",
"self",
".",
"api_base",
"=",
"\"%s/api/v4\"",
"%",
"self",
".",
"base",
".",
"... | abc96140a1d15b5e96d83432e1e0e1f4f8f36331 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.