Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def main(args):
project = get_project()
for state_point in state_points:
project.job_queue.submit(run_job, state_point)
def show_log(args):
formatter = logging.Formatter(
fmt = args.format,
#datefmt = "%Y-%m-%d %H:%M:%S",
style = '{')
project = get_project()
showed_log = False
for record in project.get_logs(
level = args.level, limit = args.lines):
print(formatter.format(record))
showed_log = True
if not showed_log:
print("No logs available.")
def check_for_existing_project(args):
try:
project = get_project()
root_dir = project.root_directory()
except (LookupError, FileNotFoundError, NotADirectoryError, KeyError):
pass
else:
if os.path.abspath(root_dir) == os.path.abspath(args.directory):
print("Project in directory '{}' already exists. "
"Use '-f' or '--force' argument to ignore this warning and "
"create a project anyways. This will lead to potential "
"data loss!".format(os.path.abspath(args.directory)))
return True
return False
def main():
project = get_project()
docs = project.find()
for doc in docs:
print(doc)
def run_checks(args):
project = get_project()
encountered_error = False
checks = [
('global configuration',
check.check_global_config),
('database connection',
check.check_database_connection)]
try:
project_id = project.get_id()
except LookupError:
print("Current working directory is not configured as a project directory.")
else:
print("Found project: '{}'.".format(project_id))
checks.extend([
('project configuration (offline)',
check.check_project_config_offline)])
checks.extend([
def check_project_config_online_readonly():
project = get_project()
project.get_id()
list(project.find(limit=1))
return True
def get_project_(args):
return get_project()