openbases.main.base package

Submodules

openbases.main.base.command module

openbases.main.base.command.init_command(self, action, flags=None)[source]

return the initial Singularity command with any added flags.

action: the main action to perform (e.g., build) flags: one or more additional flags (e.g, volumes) not implemented yet.

openbases.main.base.command.run_command(self, cmd, sudo=False, capture=True)[source]

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.

cmd: the command to run sudo: does the command require sudo? On success, returns result. Otherwise, exists on error

openbases.main.base.flags module

openbases.main.base.flags.parse_verbosity(self, args)[source]

parse_verbosity will take an argument object, and return the args passed (from a dictionary) to a list

args: the argparse argument objects

openbases.main.base.generate module

class openbases.main.base.generate.RobotNamer[source]

Bases: object

generate(delim='-', length=4, chars='0123456789')[source]
Generate a robot name. Inspiration from Haikunator, but much more
poorly implemented ;)

delim: Delimiter length: TokenLength chars: TokenChars

openbases.main.base.generate.main()[source]

openbases.main.base.logger module

openbases.main.base.logger.init_level(self, quiet=False)[source]

set the logging level based on the environment

quiet: boolean if True, set to quiet. Gets overriden by environment
setting, and only exists to define default
openbases.main.base.logger.println(self, output, quiet=False)[source]

print will print the output, given that quiet is not True. This function also serves to convert output in bytes to utf-8

output: the string to print quiet: a runtime variable to over-ride the default.

Module contents

class openbases.main.base.Client[source]

Bases: object

class BasicValidator(infile)

Bases: object

the basic validator doesn’t care about the input file extensions, and gives the user more freedom to write custom validators using it. We only validate that the file exists.

default_criteria = '/home/vanessa/Documents/Dropbox/Code/openbases/openbases-python/openbases/main/validate/criteria/dummy.yml'
load(infile)

load an input file, meaning checking for the file’s existence. It’s up to the user (if desired) to load the file in their validation functions, or write a custom _load() function.

infile: the input file to load

load_criteria(criteria=None)

load a criteria.yml file. If not specified, load (or reload) default provided by package.

criteria: a yml specification for criteria. If not provided, use
default at criteria/specification.yml. If you need help creating

a new criteria (that might be added to defaults) please open an issue

params = {}
validate_criteria(criteria=None, infile=None, params=None)

validate an infile (or already loaded one) against criteria.

infile: an input specification file criteria: a loaded (json/dict) or criteria, or html/yml file

validate_exists(infile)

determine filename of infile, validate that exists.

infile: the name of the specification / yaml file extensions: a list of valid extensions

class PaperValidator(infile, bibfile=None)

Bases: object

the spec validator can “sniff” a file based on extension, and validate the file based on the extension, or have one of the specific type validators (html, yaml) called directly. There are two steps.

Step 0. validates the file itself. Does it exist? Load without error? Step 1. validates the file against a criteria.yml, default is provided

default_criteria = '/home/vanessa/Documents/Dropbox/Code/openbases/openbases-python/openbases/main/validate/criteria/paper.yml'
folder = None
load(infile)

load an input file, meaning checking for the file’s existence, that it has a default extension, and loading it into the “spec” via the YamlManager (that can handle frontmatter in a html or standard yml/yaml

infile: the input file to load

load_bib(bibfile, envar='OPENBASESENV_BIBFILE')

load the bibfile, and derive from the paper file if it was loaded first. This means checking for the file’s existence, that it has a default extension, and loading it into the “spec”

infile: the input file to load

load_criteria(criteria=None)

load a criteria.yml file. If not specified, load (or reload) default provided by package.

criteria: a yml specification for criteria. If not provided, use
default at criteria/specification.yml. If you need help creating

a new criteria (that might be added to defaults) please open an issue

name = None
params = {}
validate_criteria(criteria=None, infile=None, params=None)

validate an infile (or already loaded one) against criteria.

infile: an input specification file criteria: a loaded (json/dict) or criteria, or html/yml file

validate_exists(infile, extensions=None)

determine filename of infile based on Specification Name (and extension). If the extension doesn’t end in yml/yaml or html, it’s not valid (and note we will need to add support for reading json). If valid, return the filename. If not, return None.

infile: the name of the specification / yaml file extensions: a list of valid extensions

RobotNamer = <openbases.main.base.generate.RobotNamer object>
badge

alias of Badge

debug = False
paper

alias of Paper

quiet = False
version()[source]

return the version of openbases python