Skip to content

Commit

Permalink
Fix code style and string quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
MarekSuchanek committed Nov 13, 2024
1 parent bc8be48 commit 15b4269
Show file tree
Hide file tree
Showing 5 changed files with 231 additions and 290 deletions.
14 changes: 1 addition & 13 deletions src/dsw_seed_maker/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,11 @@ def example():
' locales, document_templates, projects, documents)')
def list_resources(output, resource_type):
Config.check()
# TODO: Implement list command (do it in logic, import & use here)
resources = list_logic(resource_type)
json_output = json.dumps(resources, indent=4)
output.write(json_output)


# just for testing the download
# @cli.command(help='List all available seed resources', name='download')
# def download_resources():
# Config.check()
# # TODO: Implement list command (do it in logic, import & use here)
# download_file_logic("documents/1034a4b0-d867-4b4b-b2a0-a3956b43cf95", "test.pdf")


@cli.command(help='Create a seed package from input', name='make-seed')
@click.option('-i', '--input', 'input_fp',
type=click.File('r', encoding=DEFAULT_ENCODING), default='-',
Expand All @@ -83,7 +74,4 @@ def list_resources(output, resource_type):
def make_seed(input_fp, output_dir):
Config.check()
data = json.load(input_fp)
out_dir = pathlib.Path(output_dir)
out_dir.mkdir(parents=True, exist_ok=True)
# TODO: Implement list command (do it in logic, import & use here)
process_input(data, output_dir)
process_input(data, pathlib.Path(output_dir))
24 changes: 15 additions & 9 deletions src/dsw_seed_maker/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,18 @@


class Config:
API_ROOT_PATH = os.getenv('API_ROOT_PATH', '')
DSW_DB_CONN_STR = os.getenv('DSW_DB_CONN_STR')
DSW_S3_URL = os.getenv('DSW_S3_URL')
DSW_S3_USERNAME = os.getenv('DSW_S3_USERNAME')
DSW_S3_PASSWORD = os.getenv('DSW_S3_PASSWORD')
DSW_S3_BUCKET = os.getenv('DSW_S3_BUCKET')
DSW_S3_REGION = os.getenv('DSW_S3_REGION', 'eu-central-1')
API_ROOT_PATH: str = os.getenv('API_ROOT_PATH', '')
DSW_DB_CONN_STR: str = os.getenv('DSW_DB_CONN_STR', '')
DSW_S3_URL: str = os.getenv('DSW_S3_URL', '')
DSW_S3_USERNAME: str = os.getenv('DSW_S3_USERNAME', '')
DSW_S3_PASSWORD: str = os.getenv('DSW_S3_PASSWORD', '')
DSW_S3_BUCKET: str = os.getenv('DSW_S3_BUCKET', '')
DSW_S3_REGION: str = os.getenv('DSW_S3_REGION', 'eu-central-1')

LOG_LEVEL = os.getenv('LOG_LEVEL', DEFAULT_LOG_LEVEL)
LOG_FORMAT = os.getenv('LOG_FORMAT', DEFAULT_LOG_FORMAT)
OUT_DIR: pathlib.Path = pathlib.Path.cwd() / 'out'

LOG_LEVEL: str = os.getenv('LOG_LEVEL', DEFAULT_LOG_LEVEL)
LOG_FORMAT: str = os.getenv('LOG_FORMAT', DEFAULT_LOG_FORMAT)

@classmethod
def check(cls):
Expand All @@ -48,3 +50,7 @@ def apply_logging(cls):
format=cls.LOG_FORMAT,
)
LOG.debug('Logging configured with level: %s', cls.LOG_LEVEL)

@classmethod
def ensure_out_dir(cls):
cls.OUT_DIR.mkdir(parents=True, exist_ok=True)
Loading

0 comments on commit 15b4269

Please sign in to comment.