repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_documentation_string
stringlengths
1
47.2k
func_code_url
stringlengths
85
339
echonest/pyechonest
pyechonest/artist.py
Artist.get_familiarity
def get_familiarity(self, cache=True): """Get our numerical estimation of how familiar an artist currently is to the world Args: Kwargs: cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True. ...
python
def get_familiarity(self, cache=True): """Get our numerical estimation of how familiar an artist currently is to the world Args: Kwargs: cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True. ...
Get our numerical estimation of how familiar an artist currently is to the world Args: Kwargs: cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True. Returns: A float representing fami...
https://github.com/echonest/pyechonest/blob/d8c7af6c1da699b50b2f4b1bd3c0febe72e7f1ee/pyechonest/artist.py#L206-L229
echonest/pyechonest
pyechonest/artist.py
Artist.get_foreign_id
def get_foreign_id(self, idspace='musicbrainz', cache=True): """Get the foreign id for this artist for a specific id space Args: Kwargs: idspace (str): A string indicating the idspace to fetch a foreign id for. Returns: A foreign ID stri...
python
def get_foreign_id(self, idspace='musicbrainz', cache=True): """Get the foreign id for this artist for a specific id space Args: Kwargs: idspace (str): A string indicating the idspace to fetch a foreign id for. Returns: A foreign ID stri...
Get the foreign id for this artist for a specific id space Args: Kwargs: idspace (str): A string indicating the idspace to fetch a foreign id for. Returns: A foreign ID string Example: >>> a = artist.Artist('fab...
https://github.com/echonest/pyechonest/blob/d8c7af6c1da699b50b2f4b1bd3c0febe72e7f1ee/pyechonest/artist.py#L233-L257
echonest/pyechonest
pyechonest/artist.py
Artist.get_twitter_id
def get_twitter_id(self, cache=True): """Get the twitter id for this artist if it exists Args: Kwargs: Returns: A twitter ID string Example: >>> a = artist.Artist('big boi') >>> a.get_twitter_id() u'BigBoi' >>> """ ...
python
def get_twitter_id(self, cache=True): """Get the twitter id for this artist if it exists Args: Kwargs: Returns: A twitter ID string Example: >>> a = artist.Artist('big boi') >>> a.get_twitter_id() u'BigBoi' >>> """ ...
Get the twitter id for this artist if it exists Args: Kwargs: Returns: A twitter ID string Example: >>> a = artist.Artist('big boi') >>> a.get_twitter_id() u'BigBoi' >>>
https://github.com/echonest/pyechonest/blob/d8c7af6c1da699b50b2f4b1bd3c0febe72e7f1ee/pyechonest/artist.py#L259-L279
echonest/pyechonest
pyechonest/artist.py
Artist.get_hotttnesss
def get_hotttnesss(self, cache=True): """Get our numerical description of how hottt an artist currently is Args: Kwargs: cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True. Returns:...
python
def get_hotttnesss(self, cache=True): """Get our numerical description of how hottt an artist currently is Args: Kwargs: cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True. Returns:...
Get our numerical description of how hottt an artist currently is Args: Kwargs: cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True. Returns: float: the hotttnesss value ...
https://github.com/echonest/pyechonest/blob/d8c7af6c1da699b50b2f4b1bd3c0febe72e7f1ee/pyechonest/artist.py#L281-L304
echonest/pyechonest
pyechonest/artist.py
Artist.get_images
def get_images(self, results=15, start=0, license=None, cache=True): """Get a list of artist images Args: cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True. results (int): An integer number of ...
python
def get_images(self, results=15, start=0, license=None, cache=True): """Get a list of artist images Args: cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True. results (int): An integer number of ...
Get a list of artist images Args: cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True. results (int): An integer number of results to return start (int): An integer starting valu...
https://github.com/echonest/pyechonest/blob/d8c7af6c1da699b50b2f4b1bd3c0febe72e7f1ee/pyechonest/artist.py#L308-L341
echonest/pyechonest
pyechonest/artist.py
Artist.get_news
def get_news(self, results=15, start=0, cache=True, high_relevance=False): """Get a list of news articles found on the web related to an artist Args: cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True. ...
python
def get_news(self, results=15, start=0, cache=True, high_relevance=False): """Get a list of news articles found on the web related to an artist Args: cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True. ...
Get a list of news articles found on the web related to an artist Args: cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True. results (int): An integer number of results to return ...
https://github.com/echonest/pyechonest/blob/d8c7af6c1da699b50b2f4b1bd3c0febe72e7f1ee/pyechonest/artist.py#L345-L375
echonest/pyechonest
pyechonest/artist.py
Artist.get_similar
def get_similar(self, results=15, start=0, buckets=None, limit=False, cache=True, max_familiarity=None, min_familiarity=None, \ max_hotttnesss=None, min_hotttnesss=None, min_results=None, reverse=False, artist_start_year_before=None, \ artist_start_year_after=None,artist_end_year...
python
def get_similar(self, results=15, start=0, buckets=None, limit=False, cache=True, max_familiarity=None, min_familiarity=None, \ max_hotttnesss=None, min_hotttnesss=None, min_results=None, reverse=False, artist_start_year_before=None, \ artist_start_year_after=None,artist_end_year...
Return similar artists to this one Args: Kwargs: cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True. results (int): An integer number of results to return start...
https://github.com/echonest/pyechonest/blob/d8c7af6c1da699b50b2f4b1bd3c0febe72e7f1ee/pyechonest/artist.py#L417-L486
echonest/pyechonest
pyechonest/artist.py
Artist.get_songs
def get_songs(self, cache=True, results=15, start=0): """Get the songs associated with an artist Args: Kwargs: cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True. results (int):...
python
def get_songs(self, cache=True, results=15, start=0): """Get the songs associated with an artist Args: Kwargs: cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True. results (int):...
Get the songs associated with an artist Args: Kwargs: cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True. results (int): An integer number of results to return ...
https://github.com/echonest/pyechonest/blob/d8c7af6c1da699b50b2f4b1bd3c0febe72e7f1ee/pyechonest/artist.py#L490-L530
echonest/pyechonest
pyechonest/artist.py
Artist.get_terms
def get_terms(self, sort='weight', cache=True): """Get the terms associated with an artist Args: Kwargs: cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True. sort (str): A string...
python
def get_terms(self, sort='weight', cache=True): """Get the terms associated with an artist Args: Kwargs: cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True. sort (str): A string...
Get the terms associated with an artist Args: Kwargs: cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True. sort (str): A string specifying the desired sorting type (weight or frequency) ...
https://github.com/echonest/pyechonest/blob/d8c7af6c1da699b50b2f4b1bd3c0febe72e7f1ee/pyechonest/artist.py#L534-L591
echonest/pyechonest
pyechonest/artist.py
Artist.get_urls
def get_urls(self, cache=True): """Get the urls for an artist Args: Kwargs: cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True. Results: A url document dict ...
python
def get_urls(self, cache=True): """Get the urls for an artist Args: Kwargs: cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True. Results: A url document dict ...
Get the urls for an artist Args: Kwargs: cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True. Results: A url document dict Example: >>> a = artist.A...
https://github.com/echonest/pyechonest/blob/d8c7af6c1da699b50b2f4b1bd3c0febe72e7f1ee/pyechonest/artist.py#L595-L622
echonest/pyechonest
pyechonest/artist.py
Artist.get_video
def get_video(self, results=15, start=0, cache=True): """Get a list of video documents found on the web related to an artist Args: Kwargs: cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True. ...
python
def get_video(self, results=15, start=0, cache=True): """Get a list of video documents found on the web related to an artist Args: Kwargs: cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True. ...
Get a list of video documents found on the web related to an artist Args: Kwargs: cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True. results (int): An integer number of results to retu...
https://github.com/echonest/pyechonest/blob/d8c7af6c1da699b50b2f4b1bd3c0febe72e7f1ee/pyechonest/artist.py#L626-L660
echonest/pyechonest
pyechonest/artist.py
Artist.get_years_active
def get_years_active(self, cache=True): """Get a list of years active dictionaries for an artist Args: Kwargs: cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True. Returns: A...
python
def get_years_active(self, cache=True): """Get a list of years active dictionaries for an artist Args: Kwargs: cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True. Returns: A...
Get a list of years active dictionaries for an artist Args: Kwargs: cache (bool): A boolean indicating whether or not the cached value should be used (if available). Defaults to True. Returns: A list of years active dictionaries; list contains a...
https://github.com/echonest/pyechonest/blob/d8c7af6c1da699b50b2f4b1bd3c0febe72e7f1ee/pyechonest/artist.py#L664-L688
echonest/pyechonest
pyechonest/artist.py
Artist.get_doc_counts
def get_doc_counts(self, cache=True): """ Get the number of related documents of various types for the artist. The types include audio, biographies, blogs, images, news, reviews, songs, videos. Note that these documents can be retrieved by calling artist.<document type>, for exa...
python
def get_doc_counts(self, cache=True): """ Get the number of related documents of various types for the artist. The types include audio, biographies, blogs, images, news, reviews, songs, videos. Note that these documents can be retrieved by calling artist.<document type>, for exa...
Get the number of related documents of various types for the artist. The types include audio, biographies, blogs, images, news, reviews, songs, videos. Note that these documents can be retrieved by calling artist.<document type>, for example, artist.biographies. Args: ...
https://github.com/echonest/pyechonest/blob/d8c7af6c1da699b50b2f4b1bd3c0febe72e7f1ee/pyechonest/artist.py#L692-L727
singularityhub/singularity-cli
spython/oci/cmd/actions.py
run
def run(self, bundle, container_id=None, log_path=None, pid_file=None, log_format="kubernetes"): ''' run is a wrapper to create, start, attach, and delete a container. Equivalent command line example: singularity oci run -b ~/bundle m...
python
def run(self, bundle, container_id=None, log_path=None, pid_file=None, log_format="kubernetes"): ''' run is a wrapper to create, start, attach, and delete a container. Equivalent command line example: singularity oci run -b ~/bundle m...
run is a wrapper to create, start, attach, and delete a container. Equivalent command line example: singularity oci run -b ~/bundle mycontainer Parameters ========== bundle: the full path to the bundle folder container_id: an optional container_id. If not provid...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/oci/cmd/actions.py#L12-L37
singularityhub/singularity-cli
spython/oci/cmd/actions.py
create
def create(self, bundle, container_id=None, empty_process=False, log_path=None, pid_file=None, sync_socket=None, log_format="kubernetes"): ''' use the client to create a container from a bundle directory. The bun...
python
def create(self, bundle, container_id=None, empty_process=False, log_path=None, pid_file=None, sync_socket=None, log_format="kubernetes"): ''' use the client to create a container from a bundle directory. The bun...
use the client to create a container from a bundle directory. The bundle directory should have a config.json. You must be the root user to create a runtime. Equivalent command line example: singularity oci create [create options...] <container_ID> Parameters ==...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/oci/cmd/actions.py#L40-L75
singularityhub/singularity-cli
spython/oci/cmd/actions.py
_run
def _run(self, bundle, container_id=None, empty_process=False, log_path=None, pid_file=None, sync_socket=None, command="run", log_format="kubernetes"): ''' _run is the base function for run and create, the onl...
python
def _run(self, bundle, container_id=None, empty_process=False, log_path=None, pid_file=None, sync_socket=None, command="run", log_format="kubernetes"): ''' _run is the base function for run and create, the onl...
_run is the base function for run and create, the only difference between the two being that run does not have an option for sync_socket. Equivalent command line example: singularity oci create [create options...] <container_ID> Parameters ========== bundle: th...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/oci/cmd/actions.py#L78-L140
singularityhub/singularity-cli
spython/oci/cmd/actions.py
delete
def delete(self, container_id=None, sudo=None): '''delete an instance based on container_id. Parameters ========== container_id: the container_id to delete sudo: whether to issue the command with sudo (or not) a container started with sudo will belong to the root user ...
python
def delete(self, container_id=None, sudo=None): '''delete an instance based on container_id. Parameters ========== container_id: the container_id to delete sudo: whether to issue the command with sudo (or not) a container started with sudo will belong to the root user ...
delete an instance based on container_id. Parameters ========== container_id: the container_id to delete sudo: whether to issue the command with sudo (or not) a container started with sudo will belong to the root user If started by a user, the user needs to control...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/oci/cmd/actions.py#L143-L169
singularityhub/singularity-cli
spython/oci/cmd/actions.py
attach
def attach(self, container_id=None, sudo=False): '''attach to a container instance based on container_id Parameters ========== container_id: the container_id to delete sudo: whether to issue the command with sudo (or not) a container started with sudo will belong to the roo...
python
def attach(self, container_id=None, sudo=False): '''attach to a container instance based on container_id Parameters ========== container_id: the container_id to delete sudo: whether to issue the command with sudo (or not) a container started with sudo will belong to the roo...
attach to a container instance based on container_id Parameters ========== container_id: the container_id to delete sudo: whether to issue the command with sudo (or not) a container started with sudo will belong to the root user If started by a user, the user needs...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/oci/cmd/actions.py#L173-L198
singularityhub/singularity-cli
spython/oci/cmd/actions.py
execute
def execute(self, command=None, container_id=None, sudo=False, stream=False): '''execute a command to a container instance based on container_id Parameters ========== container_id: the container_id to delete command: the command to execute to the container sudo: whether to issue ...
python
def execute(self, command=None, container_id=None, sudo=False, stream=False): '''execute a command to a container instance based on container_id Parameters ========== container_id: the container_id to delete command: the command to execute to the container sudo: whether to issue ...
execute a command to a container instance based on container_id Parameters ========== container_id: the container_id to delete command: the command to execute to the container sudo: whether to issue the command with sudo (or not) a container started with sudo will belong...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/oci/cmd/actions.py#L201-L237
singularityhub/singularity-cli
spython/oci/cmd/actions.py
update
def update(self, container_id, from_file=None): '''update container cgroup resources for a specific container_id, The container must have state "running" or "created." Singularity Example: singularity oci update [update options...] <container_ID> singularity oci update --from-fi...
python
def update(self, container_id, from_file=None): '''update container cgroup resources for a specific container_id, The container must have state "running" or "created." Singularity Example: singularity oci update [update options...] <container_ID> singularity oci update --from-fi...
update container cgroup resources for a specific container_id, The container must have state "running" or "created." Singularity Example: singularity oci update [update options...] <container_ID> singularity oci update --from-file cgroups-update.json mycontainer Parameters ...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/oci/cmd/actions.py#L239-L265
singularityhub/singularity-cli
spython/main/__init__.py
get_client
def get_client(quiet=False, debug=False): ''' get the client and perform imports not on init, in case there are any initialization or import errors. Parameters ========== quiet: if True, suppress most output about the client debug: turn on debugging mode ''' from...
python
def get_client(quiet=False, debug=False): ''' get the client and perform imports not on init, in case there are any initialization or import errors. Parameters ========== quiet: if True, suppress most output about the client debug: turn on debugging mode ''' from...
get the client and perform imports not on init, in case there are any initialization or import errors. Parameters ========== quiet: if True, suppress most output about the client debug: turn on debugging mode
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/__init__.py#L9-L76
singularityhub/singularity-cli
spython/main/build.py
build
def build(self, recipe=None, image=None, isolated=False, sandbox=False, writable=False, build_folder=None, robot_name=False, ext='simg', sudo=True, stream=False): '''bui...
python
def build(self, recipe=None, image=None, isolated=False, sandbox=False, writable=False, build_folder=None, robot_name=False, ext='simg', sudo=True, stream=False): '''bui...
build a singularity image, optionally for an isolated build (requires sudo). If you specify to stream, expect the image name and an iterator to be returned. image, builder = Client.build(...) Parameters ========== recipe: the path to the recipe file (or source to buil...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/build.py#L14-L99
singularityhub/singularity-cli
spython/instance/cmd/start.py
start
def start(self, image=None, name=None, args=None, sudo=False, options=[], capture=False): '''start an instance. This is done by default when an instance is created. Parameters ========== image: optionally, an image uri (if called as a command from Client) name: a name for the instance ...
python
def start(self, image=None, name=None, args=None, sudo=False, options=[], capture=False): '''start an instance. This is done by default when an instance is created. Parameters ========== image: optionally, an image uri (if called as a command from Client) name: a name for the instance ...
start an instance. This is done by default when an instance is created. Parameters ========== image: optionally, an image uri (if called as a command from Client) name: a name for the instance sudo: if the user wants to run the command with sudo capture: capture output, defaul...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/instance/cmd/start.py#L11-L80
singularityhub/singularity-cli
spython/image/cmd/importcmd.py
importcmd
def importcmd(self, image_path, input_source): '''import will import (stdin) to the image Parameters ========== image_path: path to image to import to. input_source: input source or file import_type: if not specified, imports whatever function is given ''' from s...
python
def importcmd(self, image_path, input_source): '''import will import (stdin) to the image Parameters ========== image_path: path to image to import to. input_source: input source or file import_type: if not specified, imports whatever function is given ''' from s...
import will import (stdin) to the image Parameters ========== image_path: path to image to import to. input_source: input source or file import_type: if not specified, imports whatever function is given
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/image/cmd/importcmd.py#L11-L27
singularityhub/singularity-cli
spython/main/inspect.py
inspect
def inspect(self, image=None, json=True, app=None, quiet=True): '''inspect will show labels, defile, runscript, and tests for an image Parameters ========== image: path of image to inspect json: print json instead of raw text (default True) quiet: Don't print result to the sc...
python
def inspect(self, image=None, json=True, app=None, quiet=True): '''inspect will show labels, defile, runscript, and tests for an image Parameters ========== image: path of image to inspect json: print json instead of raw text (default True) quiet: Don't print result to the sc...
inspect will show labels, defile, runscript, and tests for an image Parameters ========== image: path of image to inspect json: print json instead of raw text (default True) quiet: Don't print result to the screen (default True) app: if defined, return help in context of a...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/inspect.py#L16-L61
singularityhub/singularity-cli
spython/main/inspect.py
parse_labels
def parse_labels(result): '''fix up the labels, meaning parse to json if needed, and return original updated object Parameters ========== result: the json object to parse from inspect ''' if "data" in result: labels = result['data']['attributes'].get('labels') or {} ...
python
def parse_labels(result): '''fix up the labels, meaning parse to json if needed, and return original updated object Parameters ========== result: the json object to parse from inspect ''' if "data" in result: labels = result['data']['attributes'].get('labels') or {} ...
fix up the labels, meaning parse to json if needed, and return original updated object Parameters ========== result: the json object to parse from inspect
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/inspect.py#L64-L91
singularityhub/singularity-cli
spython/client/shell.py
ipython
def ipython(image): '''give the user an ipython shell ''' # The client will announce itself (backend/database) unless it's get from spython.main import get_client from spython.main.parse import ( DockerRecipe, SingularityRecipe ) client = get_client() client.load(image) # Add recipe p...
python
def ipython(image): '''give the user an ipython shell ''' # The client will announce itself (backend/database) unless it's get from spython.main import get_client from spython.main.parse import ( DockerRecipe, SingularityRecipe ) client = get_client() client.load(image) # Add recipe p...
give the user an ipython shell
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/client/shell.py#L34-L50
singularityhub/singularity-cli
spython/main/parse/environment.py
parse_env
def parse_env(envlist): '''parse_env will parse a single line (with prefix like ENV removed) to a list of commands in the format KEY=VALUE For example: ENV PYTHONBUFFER 1 --> [PYTHONBUFFER=1] ::Notes Docker: https://docs.docker.com/engine/reference/builder/#env ''' if not isinstance...
python
def parse_env(envlist): '''parse_env will parse a single line (with prefix like ENV removed) to a list of commands in the format KEY=VALUE For example: ENV PYTHONBUFFER 1 --> [PYTHONBUFFER=1] ::Notes Docker: https://docs.docker.com/engine/reference/builder/#env ''' if not isinstance...
parse_env will parse a single line (with prefix like ENV removed) to a list of commands in the format KEY=VALUE For example: ENV PYTHONBUFFER 1 --> [PYTHONBUFFER=1] ::Notes Docker: https://docs.docker.com/engine/reference/builder/#env
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/environment.py#L11-L64
singularityhub/singularity-cli
spython/main/parse/singularity.py
SingularityRecipe._setup
def _setup(self, lines): '''setup required adding content from the host to the rootfs, so we try to capture with with ADD. ''' bot.warning('SETUP is error prone, please check output.') for line in lines: # For all lines, replace rootfs with actual root / ...
python
def _setup(self, lines): '''setup required adding content from the host to the rootfs, so we try to capture with with ADD. ''' bot.warning('SETUP is error prone, please check output.') for line in lines: # For all lines, replace rootfs with actual root / ...
setup required adding content from the host to the rootfs, so we try to capture with with ADD.
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/singularity.py#L38-L61
singularityhub/singularity-cli
spython/main/parse/singularity.py
SingularityRecipe._from
def _from(self, line): ''' get the FROM container image name from a FROM line! Parameters ========== line: the line from the recipe file to parse for FROM ''' self.fromHeader = line bot.debug('FROM %s' %self.fromHeader)
python
def _from(self, line): ''' get the FROM container image name from a FROM line! Parameters ========== line: the line from the recipe file to parse for FROM ''' self.fromHeader = line bot.debug('FROM %s' %self.fromHeader)
get the FROM container image name from a FROM line! Parameters ========== line: the line from the recipe file to parse for FROM
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/singularity.py#L66-L75
singularityhub/singularity-cli
spython/main/parse/singularity.py
SingularityRecipe._env
def _env(self, lines): '''env will parse a list of environment lines and simply remove any blank lines, or those with export. Dockerfiles don't usually have exports. Parameters ========== lines: A list of environment pair lines. ''' envir...
python
def _env(self, lines): '''env will parse a list of environment lines and simply remove any blank lines, or those with export. Dockerfiles don't usually have exports. Parameters ========== lines: A list of environment pair lines. ''' envir...
env will parse a list of environment lines and simply remove any blank lines, or those with export. Dockerfiles don't usually have exports. Parameters ========== lines: A list of environment pair lines.
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/singularity.py#L97-L108
singularityhub/singularity-cli
spython/main/parse/singularity.py
SingularityRecipe._comments
def _comments(self, lines): ''' comments is a wrapper for comment, intended to be given a list of comments. Parameters ========== lines: the list of lines to parse ''' for line in lines: comment = self._comment(line) ...
python
def _comments(self, lines): ''' comments is a wrapper for comment, intended to be given a list of comments. Parameters ========== lines: the list of lines to parse ''' for line in lines: comment = self._comment(line) ...
comments is a wrapper for comment, intended to be given a list of comments. Parameters ========== lines: the list of lines to parse
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/singularity.py#L127-L138
singularityhub/singularity-cli
spython/main/parse/singularity.py
SingularityRecipe._run
def _run(self, lines): '''_parse the runscript to be the Docker CMD. If we have one line, call it directly. If not, write the entrypoint into a script. Parameters ========== lines: the line from the recipe file to parse for CMD ''' lines = [x for x ...
python
def _run(self, lines): '''_parse the runscript to be the Docker CMD. If we have one line, call it directly. If not, write the entrypoint into a script. Parameters ========== lines: the line from the recipe file to parse for CMD ''' lines = [x for x ...
_parse the runscript to be the Docker CMD. If we have one line, call it directly. If not, write the entrypoint into a script. Parameters ========== lines: the line from the recipe file to parse for CMD
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/singularity.py#L155-L177
singularityhub/singularity-cli
spython/main/parse/singularity.py
SingularityRecipe._get_mapping
def _get_mapping(self, section): '''mapping will take the section name from a Singularity recipe and return a map function to add it to the appropriate place. Any lines that don't cleanly map are assumed to be comments. Parameters ========== section: the...
python
def _get_mapping(self, section): '''mapping will take the section name from a Singularity recipe and return a map function to add it to the appropriate place. Any lines that don't cleanly map are assumed to be comments. Parameters ========== section: the...
mapping will take the section name from a Singularity recipe and return a map function to add it to the appropriate place. Any lines that don't cleanly map are assumed to be comments. Parameters ========== section: the name of the Singularity recipe section ...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/singularity.py#L207-L238
singularityhub/singularity-cli
spython/main/parse/singularity.py
SingularityRecipe._parse
def _parse(self): '''parse is the base function for parsing the recipe, and extracting elements into the correct data structures. Everything is parsed into lists or dictionaries that can be assembled again on demand. Singularity: we parse files/labels first, then install. ...
python
def _parse(self): '''parse is the base function for parsing the recipe, and extracting elements into the correct data structures. Everything is parsed into lists or dictionaries that can be assembled again on demand. Singularity: we parse files/labels first, then install. ...
parse is the base function for parsing the recipe, and extracting elements into the correct data structures. Everything is parsed into lists or dictionaries that can be assembled again on demand. Singularity: we parse files/labels first, then install. cd f...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/singularity.py#L241-L263
singularityhub/singularity-cli
spython/main/parse/singularity.py
SingularityRecipe._load_from
def _load_from(self, line): '''load the From section of the recipe for the Dockerfile. ''' # Remove any comments line = line.split('#',1)[0] line = re.sub('(F|f)(R|r)(O|o)(M|m):','', line).strip() bot.info('FROM %s' %line) self.config['from'] = line
python
def _load_from(self, line): '''load the From section of the recipe for the Dockerfile. ''' # Remove any comments line = line.split('#',1)[0] line = re.sub('(F|f)(R|r)(O|o)(M|m):','', line).strip() bot.info('FROM %s' %line) self.config['from'] = line
load the From section of the recipe for the Dockerfile.
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/singularity.py#L269-L276
singularityhub/singularity-cli
spython/main/parse/singularity.py
SingularityRecipe._load_section
def _load_section(self, lines, section): '''read in a section to a list, and stop when we hit the next section ''' members = [] while True: if len(lines) == 0: break next_line = lines[0] # The end of a section ...
python
def _load_section(self, lines, section): '''read in a section to a list, and stop when we hit the next section ''' members = [] while True: if len(lines) == 0: break next_line = lines[0] # The end of a section ...
read in a section to a list, and stop when we hit the next section
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/singularity.py#L288-L312
singularityhub/singularity-cli
spython/main/parse/singularity.py
SingularityRecipe.load_recipe
def load_recipe(self): '''load will return a loaded in singularity recipe. The idea is that these sections can then be parsed into a Dockerfile, or printed back into their original form. Returns ======= config: a parsed recipe Singularity recipe ''...
python
def load_recipe(self): '''load will return a loaded in singularity recipe. The idea is that these sections can then be parsed into a Dockerfile, or printed back into their original form. Returns ======= config: a parsed recipe Singularity recipe ''...
load will return a loaded in singularity recipe. The idea is that these sections can then be parsed into a Dockerfile, or printed back into their original form. Returns ======= config: a parsed recipe Singularity recipe
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/singularity.py#L315-L365
singularityhub/singularity-cli
spython/main/parse/singularity.py
SingularityRecipe._add_section
def _add_section(self, line, section=None): '''parse a line for a section, and return the parsed section (if not None) Parameters ========== line: the line to parse section: the current (or previous) section Resulting data structure is: ...
python
def _add_section(self, line, section=None): '''parse a line for a section, and return the parsed section (if not None) Parameters ========== line: the line to parse section: the current (or previous) section Resulting data structure is: ...
parse a line for a section, and return the parsed section (if not None) Parameters ========== line: the line to parse section: the current (or previous) section Resulting data structure is: config['post'] (in lowercase)
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/singularity.py#L368-L394
singularityhub/singularity-cli
spython/oci/__init__.py
OciImage.get_container_id
def get_container_id(self, container_id=None): ''' a helper function shared between functions that will return a container_id. First preference goes to a container_id provided by the user at runtime. Second preference goes to the container_id instantiated with the client. ...
python
def get_container_id(self, container_id=None): ''' a helper function shared between functions that will return a container_id. First preference goes to a container_id provided by the user at runtime. Second preference goes to the container_id instantiated with the client. ...
a helper function shared between functions that will return a container_id. First preference goes to a container_id provided by the user at runtime. Second preference goes to the container_id instantiated with the client. Parameters ========== co...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/oci/__init__.py#L47-L64
singularityhub/singularity-cli
spython/oci/__init__.py
OciImage._run_and_return
def _run_and_return(self, cmd, sudo=None): ''' Run a command, show the message to the user if quiet isn't set, and return the return code. This is a wrapper for the OCI client to run a command and easily return the return code value (what the user is ultimately interested in)...
python
def _run_and_return(self, cmd, sudo=None): ''' Run a command, show the message to the user if quiet isn't set, and return the return code. This is a wrapper for the OCI client to run a command and easily return the return code value (what the user is ultimately interested in)...
Run a command, show the message to the user if quiet isn't set, and return the return code. This is a wrapper for the OCI client to run a command and easily return the return code value (what the user is ultimately interested in). Parameters ========== ...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/oci/__init__.py#L100-L127
singularityhub/singularity-cli
spython/oci/__init__.py
OciImage._init_command
def _init_command(self, action, flags=None): ''' a wrapper to the base init_command, ensuring that "oci" is added to each command Parameters ========== action: the main action to perform (e.g., build) flags: one or more additional flags (e.g, volumes)...
python
def _init_command(self, action, flags=None): ''' a wrapper to the base init_command, ensuring that "oci" is added to each command Parameters ========== action: the main action to perform (e.g., build) flags: one or more additional flags (e.g, volumes)...
a wrapper to the base init_command, ensuring that "oci" is added to each command Parameters ========== action: the main action to perform (e.g., build) flags: one or more additional flags (e.g, volumes) not implemented yet.
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/oci/__init__.py#L130-L145
singularityhub/singularity-cli
spython/image/cmd/export.py
export
def export(self, image_path, tmptar=None): '''export will export an image, sudo must be used. Parameters ========== image_path: full path to image tmptar: if defined, use custom temporary path for tar export ''' from spython.utils import check_install check_install() ...
python
def export(self, image_path, tmptar=None): '''export will export an image, sudo must be used. Parameters ========== image_path: full path to image tmptar: if defined, use custom temporary path for tar export ''' from spython.utils import check_install check_install() ...
export will export an image, sudo must be used. Parameters ========== image_path: full path to image tmptar: if defined, use custom temporary path for tar export
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/image/cmd/export.py#L12-L30
singularityhub/singularity-cli
spython/utils/fileio.py
write_json
def write_json(json_obj, filename, mode="w", print_pretty=True): '''write_json will (optionally,pretty print) a json object to file :param json_obj: the dict to print to json :param filename: the output file to write to :param pretty_print: if True, will use nicer formatting ''' with open(filena...
python
def write_json(json_obj, filename, mode="w", print_pretty=True): '''write_json will (optionally,pretty print) a json object to file :param json_obj: the dict to print to json :param filename: the output file to write to :param pretty_print: if True, will use nicer formatting ''' with open(filena...
write_json will (optionally,pretty print) a json object to file :param json_obj: the dict to print to json :param filename: the output file to write to :param pretty_print: if True, will use nicer formatting
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/utils/fileio.py#L57-L74
singularityhub/singularity-cli
spython/main/execute.py
execute
def execute(self, image = None, command = None, app = None, writable = False, contain = False, bind = None, stream = False, nv = False, return_result=False): ''' execute: send a command to a container ...
python
def execute(self, image = None, command = None, app = None, writable = False, contain = False, bind = None, stream = False, nv = False, return_result=False): ''' execute: send a command to a container ...
execute: send a command to a container Parameters ========== image: full path to singularity image command: command to send to container app: if not None, execute a command in context of an app writable: This option makes the file system accessible as read/write ...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/execute.py#L15-L92
singularityhub/singularity-cli
spython/instance/cmd/iutils.py
parse_table
def parse_table(table_string, header, remove_rows=1): '''parse a table to json from a string, where a header is expected by default. Return a jsonified table. Parameters ========== table_string: the string table, ideally with a header header: header of expected table, must match ...
python
def parse_table(table_string, header, remove_rows=1): '''parse a table to json from a string, where a header is expected by default. Return a jsonified table. Parameters ========== table_string: the string table, ideally with a header header: header of expected table, must match ...
parse a table to json from a string, where a header is expected by default. Return a jsonified table. Parameters ========== table_string: the string table, ideally with a header header: header of expected table, must match dimension (number columns) remove_rows: an integer to ...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/instance/cmd/iutils.py#L9-L33
singularityhub/singularity-cli
spython/instance/cmd/iutils.py
get
def get(self, name, return_json=False, quiet=False): '''get is a list for a single instance. It is assumed to be running, and we need to look up the PID, etc. ''' from spython.utils import check_install check_install() # Ensure compatible for singularity prior to 3.0, and after 3.0 subgr...
python
def get(self, name, return_json=False, quiet=False): '''get is a list for a single instance. It is assumed to be running, and we need to look up the PID, etc. ''' from spython.utils import check_install check_install() # Ensure compatible for singularity prior to 3.0, and after 3.0 subgr...
get is a list for a single instance. It is assumed to be running, and we need to look up the PID, etc.
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/instance/cmd/iutils.py#L36-L92
singularityhub/singularity-cli
spython/client/__init__.py
set_verbosity
def set_verbosity(args): '''determine the message level in the environment to set based on args. ''' level = "INFO" if args.debug is True: level = "DEBUG" elif args.quiet is True: level = "QUIET" os.environ['MESSAGELEVEL'] = level os.putenv('MESSAGELEVEL', level) os.env...
python
def set_verbosity(args): '''determine the message level in the environment to set based on args. ''' level = "INFO" if args.debug is True: level = "DEBUG" elif args.quiet is True: level = "QUIET" os.environ['MESSAGELEVEL'] = level os.putenv('MESSAGELEVEL', level) os.env...
determine the message level in the environment to set based on args.
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/client/__init__.py#L83-L103
singularityhub/singularity-cli
spython/image/cmd/__init__.py
generate_image_commands
def generate_image_commands(): ''' The Image client holds the Singularity image command group, mainly deprecated commands (image.import) and additional command helpers that are commonly use but not provided by Singularity The levels of verbosity (debug and quiet) are passed from the main ...
python
def generate_image_commands(): ''' The Image client holds the Singularity image command group, mainly deprecated commands (image.import) and additional command helpers that are commonly use but not provided by Singularity The levels of verbosity (debug and quiet) are passed from the main ...
The Image client holds the Singularity image command group, mainly deprecated commands (image.import) and additional command helpers that are commonly use but not provided by Singularity The levels of verbosity (debug and quiet) are passed from the main client via the environment variab...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/image/cmd/__init__.py#L9-L47
singularityhub/singularity-cli
spython/main/base/command.py
init_command
def init_command(self, action, flags=None): '''return the initial Singularity command with any added flags. Parameters ========== action: the main action to perform (e.g., build) flags: one or more additional flags (e.g, volumes) not implemented yet. ''' ...
python
def init_command(self, action, flags=None): '''return the initial Singularity command with any added flags. Parameters ========== action: the main action to perform (e.g., build) flags: one or more additional flags (e.g, volumes) not implemented yet. ''' ...
return the initial Singularity command with any added flags. Parameters ========== action: the main action to perform (e.g., build) flags: one or more additional flags (e.g, volumes) not implemented yet.
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/base/command.py#L25-L44
singularityhub/singularity-cli
spython/main/base/command.py
generate_bind_list
def generate_bind_list(self, bindlist=None): '''generate bind string will take a single string or list of binds, and return a list that can be added to an exec or run command. For example, the following map as follows: ['/host:/container', '/both'] --> ["--bind", "/host:/container","--bind","/b...
python
def generate_bind_list(self, bindlist=None): '''generate bind string will take a single string or list of binds, and return a list that can be added to an exec or run command. For example, the following map as follows: ['/host:/container', '/both'] --> ["--bind", "/host:/container","--bind","/b...
generate bind string will take a single string or list of binds, and return a list that can be added to an exec or run command. For example, the following map as follows: ['/host:/container', '/both'] --> ["--bind", "/host:/container","--bind","/both" ] ['/both'] --> ["--b...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/base/command.py#L47-L88
singularityhub/singularity-cli
spython/main/base/command.py
send_command
def send_command(self, cmd, sudo=False, stderr=None, stdout=None): '''send command is a non interactive version of run_command, meaning that we execute the command and return the return value, but don't attempt to stream any content (text from the screen) back to the user. This is useful for co...
python
def send_command(self, cmd, sudo=False, stderr=None, stdout=None): '''send command is a non interactive version of run_command, meaning that we execute the command and return the return value, but don't attempt to stream any content (text from the screen) back to the user. This is useful for co...
send command is a non interactive version of run_command, meaning that we execute the command and return the return value, but don't attempt to stream any content (text from the screen) back to the user. This is useful for commands interacting with OCI bundles. Parameters ========== ...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/base/command.py#L91-L108
singularityhub/singularity-cli
spython/main/base/command.py
run_command
def run_command(self, cmd, sudo=False, capture=True, quiet=None, return_result=False): '''run_command is a wrapper for the global run_command, checking first for sudo and exiting on error if needed. The message is retur...
python
def run_command(self, cmd, sudo=False, capture=True, quiet=None, return_result=False): '''run_command is a wrapper for the global run_command, checking first for sudo and exiting on error if needed. The message is retur...
run_command is a wrapper for the global run_command, checking first for sudo and exiting on error if needed. The message is returned as a list of lines for the calling function to parse, and stdout uses the parent process so it appears for the user. Parameters ========== cmd: ...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/base/command.py#L111-L149
singularityhub/singularity-cli
spython/main/parse/recipe.py
Recipe.load
def load(self, recipe): '''load a recipe file into the client, first performing checks, and then parsing the file. Parameters ========== recipe: the original recipe file, parsed by the subclass either DockerRecipe or SingularityRecipe ''' ...
python
def load(self, recipe): '''load a recipe file into the client, first performing checks, and then parsing the file. Parameters ========== recipe: the original recipe file, parsed by the subclass either DockerRecipe or SingularityRecipe ''' ...
load a recipe file into the client, first performing checks, and then parsing the file. Parameters ========== recipe: the original recipe file, parsed by the subclass either DockerRecipe or SingularityRecipe
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/recipe.py#L41-L53
singularityhub/singularity-cli
spython/main/parse/recipe.py
Recipe._run_checks
def _run_checks(self): '''basic sanity checks for the file name (and others if needed) before attempting parsing. ''' if self.recipe is not None: # Does the recipe provided exist? if not os.path.exists(self.recipe): bot.error("Cannot find %s, i...
python
def _run_checks(self): '''basic sanity checks for the file name (and others if needed) before attempting parsing. ''' if self.recipe is not None: # Does the recipe provided exist? if not os.path.exists(self.recipe): bot.error("Cannot find %s, i...
basic sanity checks for the file name (and others if needed) before attempting parsing.
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/recipe.py#L72-L84
singularityhub/singularity-cli
spython/main/parse/recipe.py
Recipe.parse
def parse(self): '''parse is the base function for parsing the recipe, whether it be a Dockerfile or Singularity recipe. The recipe is read in as lines, and saved to a list if needed for the future. If the client has it, the recipe type specific _parse function is called. ...
python
def parse(self): '''parse is the base function for parsing the recipe, whether it be a Dockerfile or Singularity recipe. The recipe is read in as lines, and saved to a list if needed for the future. If the client has it, the recipe type specific _parse function is called. ...
parse is the base function for parsing the recipe, whether it be a Dockerfile or Singularity recipe. The recipe is read in as lines, and saved to a list if needed for the future. If the client has it, the recipe type specific _parse function is called. Instructions for makin...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/recipe.py#L89-L128
singularityhub/singularity-cli
spython/main/parse/recipe.py
Recipe.save
def save(self, output_file=None, convert_to=None, runscript="/bin/bash", force=False): '''save will convert a recipe to a specified format (defaults to the opposite of the recipe type originally loaded, (e.g., docker--> singularit...
python
def save(self, output_file=None, convert_to=None, runscript="/bin/bash", force=False): '''save will convert a recipe to a specified format (defaults to the opposite of the recipe type originally loaded, (e.g., docker--> singularit...
save will convert a recipe to a specified format (defaults to the opposite of the recipe type originally loaded, (e.g., docker--> singularity and singularity-->docker) and write to an output file, if specified. If not specified, a temporary file is used. Parameters ...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/recipe.py#L134-L157
singularityhub/singularity-cli
spython/main/parse/recipe.py
Recipe.convert
def convert(self, convert_to=None, runscript="/bin/bash", force=False): '''This is a convenience function for the user to easily call to get the most likely desired result, conversion to the opposite format. We choose the selection based on th...
python
def convert(self, convert_to=None, runscript="/bin/bash", force=False): '''This is a convenience function for the user to easily call to get the most likely desired result, conversion to the opposite format. We choose the selection based on th...
This is a convenience function for the user to easily call to get the most likely desired result, conversion to the opposite format. We choose the selection based on the recipe name - meaning that we perform conversion with default based on recipe name. If the recipe object i...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/recipe.py#L160-L180
singularityhub/singularity-cli
spython/main/parse/recipe.py
Recipe._get_converter
def _get_converter(self, convert_to=None): '''see convert and save. This is a helper function that returns the proper conversion function, but doesn't call it. We do this so that in the case of convert, we do the conversion and return a string. In the case of save, we save the ...
python
def _get_converter(self, convert_to=None): '''see convert and save. This is a helper function that returns the proper conversion function, but doesn't call it. We do this so that in the case of convert, we do the conversion and return a string. In the case of save, we save the ...
see convert and save. This is a helper function that returns the proper conversion function, but doesn't call it. We do this so that in the case of convert, we do the conversion and return a string. In the case of save, we save the recipe to file for the user. P...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/recipe.py#L187-L208
singularityhub/singularity-cli
spython/main/parse/recipe.py
Recipe._get_conversion_outfile
def _get_conversion_outfile(self, convert_to=None): '''a helper function to return a conversion temporary output file based on kind of conversion Parameters ========== convert_to: a string either docker or singularity, if a different ''' conversion =...
python
def _get_conversion_outfile(self, convert_to=None): '''a helper function to return a conversion temporary output file based on kind of conversion Parameters ========== convert_to: a string either docker or singularity, if a different ''' conversion =...
a helper function to return a conversion temporary output file based on kind of conversion Parameters ========== convert_to: a string either docker or singularity, if a different
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/recipe.py#L212-L226
singularityhub/singularity-cli
spython/main/parse/recipe.py
Recipe._get_conversion_type
def _get_conversion_type(self, convert_to=None): '''a helper function to return the conversion type based on user preference and input recipe. Parameters ========== convert_to: a string either docker or singularity (default None) ''' acceptable = ['...
python
def _get_conversion_type(self, convert_to=None): '''a helper function to return the conversion type based on user preference and input recipe. Parameters ========== convert_to: a string either docker or singularity (default None) ''' acceptable = ['...
a helper function to return the conversion type based on user preference and input recipe. Parameters ========== convert_to: a string either docker or singularity (default None)
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/recipe.py#L230-L249
singularityhub/singularity-cli
spython/main/parse/recipe.py
Recipe._write_script
def _write_script(path, lines, chmod=True): '''write a script with some lines content to path in the image. This is done by way of adding echo statements to the install section. Parameters ========== path: the path to the file to write lines: the lines to ...
python
def _write_script(path, lines, chmod=True): '''write a script with some lines content to path in the image. This is done by way of adding echo statements to the install section. Parameters ========== path: the path to the file to write lines: the lines to ...
write a script with some lines content to path in the image. This is done by way of adding echo statements to the install section. Parameters ========== path: the path to the file to write lines: the lines to echo to the file chmod: If true, change perm...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/recipe.py#L287-L305
singularityhub/singularity-cli
spython/oci/cmd/states.py
state
def state(self, container_id=None, sudo=None, sync_socket=None): ''' get the state of an OciImage, if it exists. The optional states that can be returned are created, running, stopped or (not existing). Equivalent command line example: singularity oci state <container_ID> ...
python
def state(self, container_id=None, sudo=None, sync_socket=None): ''' get the state of an OciImage, if it exists. The optional states that can be returned are created, running, stopped or (not existing). Equivalent command line example: singularity oci state <container_ID> ...
get the state of an OciImage, if it exists. The optional states that can be returned are created, running, stopped or (not existing). Equivalent command line example: singularity oci state <container_ID> Parameters ========== container_id: the id to g...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/oci/cmd/states.py#L13-L52
singularityhub/singularity-cli
spython/oci/cmd/states.py
_state_command
def _state_command(self, container_id=None, command='start', sudo=None): ''' A generic state command to wrap pause, resume, kill, etc., where the only difference is the command. This function will be unwrapped if the child functions get more complicated (with additional arguments). Equival...
python
def _state_command(self, container_id=None, command='start', sudo=None): ''' A generic state command to wrap pause, resume, kill, etc., where the only difference is the command. This function will be unwrapped if the child functions get more complicated (with additional arguments). Equival...
A generic state command to wrap pause, resume, kill, etc., where the only difference is the command. This function will be unwrapped if the child functions get more complicated (with additional arguments). Equivalent command line example: singularity oci <command> <container_ID...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/oci/cmd/states.py#L55-L85
singularityhub/singularity-cli
spython/oci/cmd/states.py
kill
def kill(self, container_id=None, sudo=None, signal=None): ''' stop (kill) a started OciImage container, if it exists Equivalent command line example: singularity oci kill <container_ID> Parameters ========== container_id: the id to stop. signal...
python
def kill(self, container_id=None, sudo=None, signal=None): ''' stop (kill) a started OciImage container, if it exists Equivalent command line example: singularity oci kill <container_ID> Parameters ========== container_id: the id to stop. signal...
stop (kill) a started OciImage container, if it exists Equivalent command line example: singularity oci kill <container_ID> Parameters ========== container_id: the id to stop. signal: signal sent to the container (default SIGTERM) sudo: Add s...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/oci/cmd/states.py#L109-L141
singularityhub/singularity-cli
spython/oci/cmd/states.py
resume
def resume(self, container_id=None, sudo=None): ''' resume a stopped OciImage container, if it exists Equivalent command line example: singularity oci resume <container_ID> Parameters ========== container_id: the id to stop. sudo: Add sudo to the...
python
def resume(self, container_id=None, sudo=None): ''' resume a stopped OciImage container, if it exists Equivalent command line example: singularity oci resume <container_ID> Parameters ========== container_id: the id to stop. sudo: Add sudo to the...
resume a stopped OciImage container, if it exists Equivalent command line example: singularity oci resume <container_ID> Parameters ========== container_id: the id to stop. sudo: Add sudo to the command. If the container was created by root, ...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/oci/cmd/states.py#L144-L160
singularityhub/singularity-cli
spython/oci/cmd/states.py
pause
def pause(self, container_id=None, sudo=None): ''' pause a running OciImage container, if it exists Equivalent command line example: singularity oci pause <container_ID> Parameters ========== container_id: the id to stop. sudo: Add sudo to the co...
python
def pause(self, container_id=None, sudo=None): ''' pause a running OciImage container, if it exists Equivalent command line example: singularity oci pause <container_ID> Parameters ========== container_id: the id to stop. sudo: Add sudo to the co...
pause a running OciImage container, if it exists Equivalent command line example: singularity oci pause <container_ID> Parameters ========== container_id: the id to stop. sudo: Add sudo to the command. If the container was created by root, ...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/oci/cmd/states.py#L163-L179
singularityhub/singularity-cli
spython/main/instances.py
stopall
def stopall(self, sudo=False, quiet=True): '''stop ALL instances. This command is only added to the command group as it doesn't make sense to call from a single instance Parameters ========== sudo: if the command should be done with sudo (exposes different set of instances)...
python
def stopall(self, sudo=False, quiet=True): '''stop ALL instances. This command is only added to the command group as it doesn't make sense to call from a single instance Parameters ========== sudo: if the command should be done with sudo (exposes different set of instances)...
stop ALL instances. This command is only added to the command group as it doesn't make sense to call from a single instance Parameters ========== sudo: if the command should be done with sudo (exposes different set of instances)
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/instances.py#L99-L127
singularityhub/singularity-cli
spython/main/base/logger.py
init_level
def init_level(self, quiet=False): '''set the logging level based on the environment Parameters ========== quiet: boolean if True, set to quiet. Gets overriden by environment setting, and only exists to define default ''' if os.environ.get('MESSAGELEVEL'...
python
def init_level(self, quiet=False): '''set the logging level based on the environment Parameters ========== quiet: boolean if True, set to quiet. Gets overriden by environment setting, and only exists to define default ''' if os.environ.get('MESSAGELEVEL'...
set the logging level based on the environment Parameters ========== quiet: boolean if True, set to quiet. Gets overriden by environment setting, and only exists to define default
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/base/logger.py#L11-L24
singularityhub/singularity-cli
spython/main/base/logger.py
println
def println(self, output, quiet=False): '''print will print the output, given that quiet is not True. This function also serves to convert output in bytes to utf-8 Parameters ========== output: the string to print quiet: a runtime variable to over-ride the default. ''' i...
python
def println(self, output, quiet=False): '''print will print the output, given that quiet is not True. This function also serves to convert output in bytes to utf-8 Parameters ========== output: the string to print quiet: a runtime variable to over-ride the default. ''' i...
print will print the output, given that quiet is not True. This function also serves to convert output in bytes to utf-8 Parameters ========== output: the string to print quiet: a runtime variable to over-ride the default.
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/base/logger.py#L28-L41
singularityhub/singularity-cli
spython/main/help.py
help
def help(self, command=None): '''help prints the general function help, or help for a specific command Parameters ========== command: the command to get help for, if none, prints general help ''' from spython.utils import check_install check_install() cmd = ['singularit...
python
def help(self, command=None): '''help prints the general function help, or help for a specific command Parameters ========== command: the command to get help for, if none, prints general help ''' from spython.utils import check_install check_install() cmd = ['singularit...
help prints the general function help, or help for a specific command Parameters ========== command: the command to get help for, if none, prints general help
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/help.py#L9-L24
singularityhub/singularity-cli
spython/instance/cmd/__init__.py
generate_instance_commands
def generate_instance_commands(): ''' The Instance client holds the Singularity Instance command group The levels of verbosity (debug and quiet) are passed from the main client via the environment variable MESSAGELEVEL. ''' from spython.instance import Instance from spython.main.base.l...
python
def generate_instance_commands(): ''' The Instance client holds the Singularity Instance command group The levels of verbosity (debug and quiet) are passed from the main client via the environment variable MESSAGELEVEL. ''' from spython.instance import Instance from spython.main.base.l...
The Instance client holds the Singularity Instance command group The levels of verbosity (debug and quiet) are passed from the main client via the environment variable MESSAGELEVEL.
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/instance/cmd/__init__.py#L9-L39
singularityhub/singularity-cli
spython/image/cmd/utils.py
compress
def compress(self, image_path): '''compress will (properly) compress an image''' if os.path.exists(image_path): compressed_image = "%s.gz" %image_path os.system('gzip -c -6 %s > %s' %(image_path, compressed_image)) return compressed_image bot.exit("Cannot find image %s" %image_path)
python
def compress(self, image_path): '''compress will (properly) compress an image''' if os.path.exists(image_path): compressed_image = "%s.gz" %image_path os.system('gzip -c -6 %s > %s' %(image_path, compressed_image)) return compressed_image bot.exit("Cannot find image %s" %image_path)
compress will (properly) compress an image
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/image/cmd/utils.py#L11-L18
singularityhub/singularity-cli
spython/image/cmd/utils.py
decompress
def decompress(self, image_path, quiet=True): '''decompress will (properly) decompress an image''' if not os.path.exists(image_path): bot.exit("Cannot find image %s" %image_path) extracted_file = image_path.replace('.gz','') cmd = ['gzip','-d','-f', image_path] result = self.run_co...
python
def decompress(self, image_path, quiet=True): '''decompress will (properly) decompress an image''' if not os.path.exists(image_path): bot.exit("Cannot find image %s" %image_path) extracted_file = image_path.replace('.gz','') cmd = ['gzip','-d','-f', image_path] result = self.run_co...
decompress will (properly) decompress an image
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/image/cmd/utils.py#L21-L30
singularityhub/singularity-cli
spython/instance/__init__.py
Instance.generate_name
def generate_name(self, name=None): '''generate a Robot Name for the instance to use, if the user doesn't supply one. ''' # If no name provided, use robot name if name == None: name = self.RobotNamer.generate() self.name = name.replace('-','_')
python
def generate_name(self, name=None): '''generate a Robot Name for the instance to use, if the user doesn't supply one. ''' # If no name provided, use robot name if name == None: name = self.RobotNamer.generate() self.name = name.replace('-','_')
generate a Robot Name for the instance to use, if the user doesn't supply one.
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/instance/__init__.py#L40-L47
singularityhub/singularity-cli
spython/instance/__init__.py
Instance._update_metadata
def _update_metadata(self, kwargs=None): '''Extract any additional attributes to hold with the instance from kwargs ''' # If not given metadata, use instance.list to get it for container if kwargs == None and hasattr(self, 'name'): kwargs = self._list(self.name, q...
python
def _update_metadata(self, kwargs=None): '''Extract any additional attributes to hold with the instance from kwargs ''' # If not given metadata, use instance.list to get it for container if kwargs == None and hasattr(self, 'name'): kwargs = self._list(self.name, q...
Extract any additional attributes to hold with the instance from kwargs
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/instance/__init__.py#L71-L90
singularityhub/singularity-cli
spython/main/run.py
run
def run(self, image = None, args = None, app = None, sudo = False, writable = False, contain = False, bind = None, stream = False, nv = False, return_result=False): ''' run will run the container, with or withour arguments (wh...
python
def run(self, image = None, args = None, app = None, sudo = False, writable = False, contain = False, bind = None, stream = False, nv = False, return_result=False): ''' run will run the container, with or withour arguments (wh...
run will run the container, with or withour arguments (which should be provided in a list) Parameters ========== image: full path to singularity image args: args to include with the run app: if not None, execute a command in context of an app writable: This ...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/run.py#L13-L101
singularityhub/singularity-cli
spython/oci/cmd/mounts.py
mount
def mount(self, image, sudo=None): '''create an OCI bundle from SIF image Parameters ========== image: the container (sif) to mount ''' return self._state_command(image, command="mount", sudo=sudo)
python
def mount(self, image, sudo=None): '''create an OCI bundle from SIF image Parameters ========== image: the container (sif) to mount ''' return self._state_command(image, command="mount", sudo=sudo)
create an OCI bundle from SIF image Parameters ========== image: the container (sif) to mount
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/oci/cmd/mounts.py#L14-L21
singularityhub/singularity-cli
spython/client/recipe.py
main
def main(args, options, parser): '''This function serves as a wrapper around the DockerRecipe and SingularityRecipe converters. We can either save to file if args.outfile is defined, or print to the console if not. ''' from spython.main.parse import ( DockerRecipe, SingularityRecipe ) # ...
python
def main(args, options, parser): '''This function serves as a wrapper around the DockerRecipe and SingularityRecipe converters. We can either save to file if args.outfile is defined, or print to the console if not. ''' from spython.main.parse import ( DockerRecipe, SingularityRecipe ) # ...
This function serves as a wrapper around the DockerRecipe and SingularityRecipe converters. We can either save to file if args.outfile is defined, or print to the console if not.
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/client/recipe.py#L11-L57
singularityhub/singularity-cli
spython/main/parse/docker.py
DockerRecipe._setup
def _setup(self, action, line): ''' replace the command name from the group, alert the user of content, and clean up empty spaces ''' bot.debug('[in] %s' % line) # Replace ACTION at beginning line = re.sub('^%s' % action, '', line) # Handle continuation lin...
python
def _setup(self, action, line): ''' replace the command name from the group, alert the user of content, and clean up empty spaces ''' bot.debug('[in] %s' % line) # Replace ACTION at beginning line = re.sub('^%s' % action, '', line) # Handle continuation lin...
replace the command name from the group, alert the user of content, and clean up empty spaces
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/docker.py#L35-L48
singularityhub/singularity-cli
spython/main/parse/docker.py
DockerRecipe._from
def _from(self, line): ''' get the FROM container image name from a FROM line! Parameters ========== line: the line from the recipe file to parse for FROM ''' fromHeader = self._setup('FROM', line) # Singularity does not support AS level self.f...
python
def _from(self, line): ''' get the FROM container image name from a FROM line! Parameters ========== line: the line from the recipe file to parse for FROM ''' fromHeader = self._setup('FROM', line) # Singularity does not support AS level self.f...
get the FROM container image name from a FROM line! Parameters ========== line: the line from the recipe file to parse for FROM
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/docker.py#L53-L68
singularityhub/singularity-cli
spython/main/parse/docker.py
DockerRecipe._run
def _run(self, line): ''' everything from RUN goes into the install list Parameters ========== line: the line from the recipe file to parse for FROM ''' line = self._setup('RUN', line) self.install += line
python
def _run(self, line): ''' everything from RUN goes into the install list Parameters ========== line: the line from the recipe file to parse for FROM ''' line = self._setup('RUN', line) self.install += line
everything from RUN goes into the install list Parameters ========== line: the line from the recipe file to parse for FROM
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/docker.py#L73-L82
singularityhub/singularity-cli
spython/main/parse/docker.py
DockerRecipe._arg
def _arg(self, line): '''singularity doesn't have support for ARG, so instead will issue a warning to the console for the user to export the variable with SINGULARITY prefixed at build. Parameters ========== line: the line from the recipe file to parse fo...
python
def _arg(self, line): '''singularity doesn't have support for ARG, so instead will issue a warning to the console for the user to export the variable with SINGULARITY prefixed at build. Parameters ========== line: the line from the recipe file to parse fo...
singularity doesn't have support for ARG, so instead will issue a warning to the console for the user to export the variable with SINGULARITY prefixed at build. Parameters ========== line: the line from the recipe file to parse for ARG
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/docker.py#L98-L110
singularityhub/singularity-cli
spython/main/parse/docker.py
DockerRecipe._env
def _env(self, line): '''env will parse a line that beings with ENV, indicative of one or more environment variables. Parameters ========== line: the line from the recipe file to parse for ADD ''' line = self._setup('ENV', line) # Extrac...
python
def _env(self, line): '''env will parse a line that beings with ENV, indicative of one or more environment variables. Parameters ========== line: the line from the recipe file to parse for ADD ''' line = self._setup('ENV', line) # Extrac...
env will parse a line that beings with ENV, indicative of one or more environment variables. Parameters ========== line: the line from the recipe file to parse for ADD
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/docker.py#L114-L132
singularityhub/singularity-cli
spython/main/parse/docker.py
DockerRecipe._copy
def _copy(self, lines): '''parse_add will copy multiple files from one location to another. This likely will need tweaking, as the files might need to be mounted from some location before adding to the image. The add command is done for an entire directory. It is also ...
python
def _copy(self, lines): '''parse_add will copy multiple files from one location to another. This likely will need tweaking, as the files might need to be mounted from some location before adding to the image. The add command is done for an entire directory. It is also ...
parse_add will copy multiple files from one location to another. This likely will need tweaking, as the files might need to be mounted from some location before adding to the image. The add command is done for an entire directory. It is also possible to have more than one ...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/docker.py#L138-L153
singularityhub/singularity-cli
spython/main/parse/docker.py
DockerRecipe._add
def _add(self, lines): '''Add can also handle https, and compressed files. Parameters ========== line: the line from the recipe file to parse for ADD ''' lines = self._setup('ADD', lines) for line in lines: values = line.split(" ") ...
python
def _add(self, lines): '''Add can also handle https, and compressed files. Parameters ========== line: the line from the recipe file to parse for ADD ''' lines = self._setup('ADD', lines) for line in lines: values = line.split(" ") ...
Add can also handle https, and compressed files. Parameters ========== line: the line from the recipe file to parse for ADD
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/docker.py#L156-L185
singularityhub/singularity-cli
spython/main/parse/docker.py
DockerRecipe._add_files
def _add_files(self, source, dest): '''add files is the underlying function called to add files to the list, whether originally called from the functions to parse archives, or https. We make sure that any local references are changed to actual file locations before adding to the...
python
def _add_files(self, source, dest): '''add files is the underlying function called to add files to the list, whether originally called from the functions to parse archives, or https. We make sure that any local references are changed to actual file locations before adding to the...
add files is the underlying function called to add files to the list, whether originally called from the functions to parse archives, or https. We make sure that any local references are changed to actual file locations before adding to the files list. Parameters ...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/docker.py#L190-L216
singularityhub/singularity-cli
spython/main/parse/docker.py
DockerRecipe._parse_http
def _parse_http(self, url, dest): '''will get the filename of an http address, and return a statement to download it to some location Parameters ========== url: the source url to retrieve with curl dest: the destination folder to put it in the image ...
python
def _parse_http(self, url, dest): '''will get the filename of an http address, and return a statement to download it to some location Parameters ========== url: the source url to retrieve with curl dest: the destination folder to put it in the image ...
will get the filename of an http address, and return a statement to download it to some location Parameters ========== url: the source url to retrieve with curl dest: the destination folder to put it in the image
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/docker.py#L219-L232
singularityhub/singularity-cli
spython/main/parse/docker.py
DockerRecipe._parse_archive
def _parse_archive(self, targz, dest): '''parse_targz will add a line to the install script to extract a targz to a location, and also add it to the files. Parameters ========== targz: the targz to extract dest: the location to extract it to ''' ...
python
def _parse_archive(self, targz, dest): '''parse_targz will add a line to the install script to extract a targz to a location, and also add it to the files. Parameters ========== targz: the targz to extract dest: the location to extract it to ''' ...
parse_targz will add a line to the install script to extract a targz to a location, and also add it to the files. Parameters ========== targz: the targz to extract dest: the location to extract it to
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/docker.py#L235-L250
singularityhub/singularity-cli
spython/main/parse/docker.py
DockerRecipe._default
def _default(self, line): '''the default action assumes a line that is either a command (a continuation of a previous, for example) or a comment. Parameters ========== line: the line from the recipe file to parse to INSTALL ''' if line.stri...
python
def _default(self, line): '''the default action assumes a line that is either a command (a continuation of a previous, for example) or a comment. Parameters ========== line: the line from the recipe file to parse to INSTALL ''' if line.stri...
the default action assumes a line that is either a command (a continuation of a previous, for example) or a comment. Parameters ========== line: the line from the recipe file to parse to INSTALL
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/docker.py#L268-L278
singularityhub/singularity-cli
spython/main/parse/docker.py
DockerRecipe._volume
def _volume(self, line): '''We don't have logic for volume for Singularity, so we add as a comment in the install, and a metadata value for the recipe object Parameters ========== line: the line from the recipe file to parse to INSTALL ''' ...
python
def _volume(self, line): '''We don't have logic for volume for Singularity, so we add as a comment in the install, and a metadata value for the recipe object Parameters ========== line: the line from the recipe file to parse to INSTALL ''' ...
We don't have logic for volume for Singularity, so we add as a comment in the install, and a metadata value for the recipe object Parameters ========== line: the line from the recipe file to parse to INSTALL
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/docker.py#L283-L296
singularityhub/singularity-cli
spython/main/parse/docker.py
DockerRecipe._expose
def _expose(self, line): '''Again, just add to metadata, and comment in install. Parameters ========== line: the line from the recipe file to parse to INSTALL ''' ports = self._setup('EXPOSE', line) if len(ports) > 0: self.ports += ports ...
python
def _expose(self, line): '''Again, just add to metadata, and comment in install. Parameters ========== line: the line from the recipe file to parse to INSTALL ''' ports = self._setup('EXPOSE', line) if len(ports) > 0: self.ports += ports ...
Again, just add to metadata, and comment in install. Parameters ========== line: the line from the recipe file to parse to INSTALL
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/docker.py#L299-L310
singularityhub/singularity-cli
spython/main/parse/docker.py
DockerRecipe._workdir
def _workdir(self, line): '''A Docker WORKDIR command simply implies to cd to that location Parameters ========== line: the line from the recipe file to parse for WORKDIR ''' workdir = self._setup('WORKDIR', line) line = "cd %s" %(''.join(workdir)) ...
python
def _workdir(self, line): '''A Docker WORKDIR command simply implies to cd to that location Parameters ========== line: the line from the recipe file to parse for WORKDIR ''' workdir = self._setup('WORKDIR', line) line = "cd %s" %(''.join(workdir)) ...
A Docker WORKDIR command simply implies to cd to that location Parameters ========== line: the line from the recipe file to parse for WORKDIR
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/docker.py#L315-L325
singularityhub/singularity-cli
spython/main/parse/docker.py
DockerRecipe._label
def _label(self, line): '''_label will parse a Dockerfile label Parameters ========== line: the line from the recipe file to parse for CMD ''' label = self._setup('LABEL', line) self.labels += [ label ]
python
def _label(self, line): '''_label will parse a Dockerfile label Parameters ========== line: the line from the recipe file to parse for CMD ''' label = self._setup('LABEL', line) self.labels += [ label ]
_label will parse a Dockerfile label Parameters ========== line: the line from the recipe file to parse for CMD
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/docker.py#L357-L366
singularityhub/singularity-cli
spython/main/parse/docker.py
DockerRecipe._get_mapping
def _get_mapping(self, line, parser=None, previous=None): '''mapping will take the command from a Dockerfile and return a map function to add it to the appropriate place. Any lines that don't cleanly map are assumed to be comments. Parameters ========== li...
python
def _get_mapping(self, line, parser=None, previous=None): '''mapping will take the command from a Dockerfile and return a map function to add it to the appropriate place. Any lines that don't cleanly map are assumed to be comments. Parameters ========== li...
mapping will take the command from a Dockerfile and return a map function to add it to the appropriate place. Any lines that don't cleanly map are assumed to be comments. Parameters ========== line: the list that has been parsed into parts with _split_line ...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/docker.py#L372-L425
singularityhub/singularity-cli
spython/main/parse/docker.py
DockerRecipe._parse
def _parse(self): '''parse is the base function for parsing the Dockerfile, and extracting elements into the correct data structures. Everything is parsed into lists or dictionaries that can be assembled again on demand. Environment: Since Docker also exports environment as we...
python
def _parse(self): '''parse is the base function for parsing the Dockerfile, and extracting elements into the correct data structures. Everything is parsed into lists or dictionaries that can be assembled again on demand. Environment: Since Docker also exports environment as we...
parse is the base function for parsing the Dockerfile, and extracting elements into the correct data structures. Everything is parsed into lists or dictionaries that can be assembled again on demand. Environment: Since Docker also exports environment as we go, ...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/docker.py#L428-L454
singularityhub/singularity-cli
spython/image/__init__.py
ImageBase.get_uri
def get_uri(self, image): '''get the uri of an image, or the string (optional) that appears before ://. Optional. If none found, returns '' ''' image = image or '' uri = '' match = re.match("^(?P<uri>.+)://", image) if match: uri = match.group('uri...
python
def get_uri(self, image): '''get the uri of an image, or the string (optional) that appears before ://. Optional. If none found, returns '' ''' image = image or '' uri = '' match = re.match("^(?P<uri>.+)://", image) if match: uri = match.group('uri...
get the uri of an image, or the string (optional) that appears before ://. Optional. If none found, returns ''
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/image/__init__.py#L26-L37
singularityhub/singularity-cli
spython/image/__init__.py
ImageBase.remove_uri
def remove_uri(self, image): '''remove_image_uri will return just the image name. this will also remove all spaces from the uri. ''' image = image or '' uri = self.get_uri(image) or '' image = image.replace('%s://' %uri,'', 1) return image.strip('-').rstrip('/'...
python
def remove_uri(self, image): '''remove_image_uri will return just the image name. this will also remove all spaces from the uri. ''' image = image or '' uri = self.get_uri(image) or '' image = image.replace('%s://' %uri,'', 1) return image.strip('-').rstrip('/'...
remove_image_uri will return just the image name. this will also remove all spaces from the uri.
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/image/__init__.py#L40-L47
singularityhub/singularity-cli
spython/image/__init__.py
ImageBase.parse_image_name
def parse_image_name(self, image): ''' simply split the uri from the image. Singularity handles parsing of registry, namespace, image. Parameters ========== image: the complete image uri to load (e.g., docker://ubuntu) ''' ...
python
def parse_image_name(self, image): ''' simply split the uri from the image. Singularity handles parsing of registry, namespace, image. Parameters ========== image: the complete image uri to load (e.g., docker://ubuntu) ''' ...
simply split the uri from the image. Singularity handles parsing of registry, namespace, image. Parameters ========== image: the complete image uri to load (e.g., docker://ubuntu)
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/image/__init__.py#L50-L62
singularityhub/singularity-cli
spython/image/__init__.py
Image.get_hash
def get_hash(self, image=None): '''return an md5 hash of the file based on a criteria level. This is intended to give the file a reasonable version. This only is useful for actual image files. Parameters ========== image: the image path to get hash for...
python
def get_hash(self, image=None): '''return an md5 hash of the file based on a criteria level. This is intended to give the file a reasonable version. This only is useful for actual image files. Parameters ========== image: the image path to get hash for...
return an md5 hash of the file based on a criteria level. This is intended to give the file a reasonable version. This only is useful for actual image files. Parameters ========== image: the image path to get hash for (first priority). Second ...
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/image/__init__.py#L82-L102