Skip to content

Commit cc8cfc5

Browse files
committed
fix: After lint with ruff
1 parent c3a7d0d commit cc8cfc5

File tree

10 files changed

+543
-161
lines changed

10 files changed

+543
-161
lines changed

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
'stackql_deploy': [
2424
'templates/**/*.template', # Include template files recursively
2525
],
26-
},
26+
},
2727
include_package_data=True,
2828
install_requires=[
29-
'click',
29+
'click',
3030
'python-dotenv',
3131
'jinja2',
3232
'pystackql>=3.6.1',

stackql_deploy/cli.py

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
def print_unicode_box(message):
1919
border_color = '\033[93m' # Yellow color
2020
reset_color = '\033[0m'
21-
21+
2222
lines = message.split('\n')
2323
max_length = max(len(line) for line in lines)
2424
top_border = border_color + '┌' + '─' * (max_length + 2) + '┐' + reset_color
2525
bottom_border = border_color + '└' + '─' * (max_length + 2) + '┘' + reset_color
26-
26+
2727
click.echo(top_border)
2828
for line in lines:
2929
click.echo(border_color + '│ ' + line.ljust(max_length) + ' │' + reset_color)
@@ -88,10 +88,21 @@ def add_common_options(command):
8888
common_options = [
8989
click.option('--log-level', default='INFO', help='set the logging level.'),
9090
click.option('--env-file', default='.env', help='environment variables file.'),
91-
click.option('-e', '--env', multiple=True, callback=parse_env_var, help='set additional environment variables.'),
91+
click.option(
92+
'-e',
93+
'--env',
94+
multiple=True,
95+
callback=parse_env_var,
96+
help='set additional environment variables.'
97+
),
9298
click.option('--dry-run', is_flag=True, help='perform a dry run of the operation.'),
9399
click.option('--show-queries', is_flag=True, help='show queries run in the output logs.'),
94-
click.option('--on-failure', type=click.Choice(['rollback', 'ignore', 'error']), default='error', help='action on failure.')
100+
click.option(
101+
"--on-failure",
102+
type=click.Choice(["rollback", "ignore", "error"]),
103+
default="error",
104+
help="action on failure.",
105+
)
95106
]
96107
for option in common_options:
97108
command = option(command)
@@ -240,7 +251,7 @@ def info(ctx):
240251
)
241252

242253
click.echo(click.style("stackql-deploy CLI", fg="green", bold=True))
243-
click.echo(f" Version: {deploy_version}\n")
254+
click.echo(f" Version: {deploy_version}\n")
244255

245256
click.echo(click.style("StackQL Library", fg="green", bold=True))
246257
click.echo(f" Version: {stackql.version}")
@@ -270,7 +281,7 @@ def shell(ctx):
270281
custom_registry=ctx.obj.get('custom_registry'),
271282
download_dir=ctx.obj.get('download_dir')
272283
)
273-
284+
274285
# Find the stackql binary path
275286
stackql_binary_path = find_stackql_binary(stackql.bin_path, ctx.obj.get('download_dir'))
276287

@@ -280,7 +291,7 @@ def shell(ctx):
280291
sys.exit(1)
281292

282293
click.echo(f"Launching stackql shell from: {stackql_binary_path}")
283-
294+
284295
# Launch the stackql shell as a subprocess
285296
try:
286297
subprocess.run([stackql_binary_path, "shell", "--colorscheme", "null"], check=True)
@@ -297,7 +308,7 @@ def shell(ctx):
297308
@click.pass_context
298309
def upgrade(ctx):
299310
"""Upgrade the pystackql package and stackql binary to the latest version."""
300-
311+
301312
stackql = get_stackql_instance()
302313
orig_pkg_version = stackql.package_version
303314
orig_stackql_version = stackql.version
@@ -306,7 +317,7 @@ def upgrade(ctx):
306317
click.echo("upgrading pystackql package...")
307318
try:
308319
# Run the pip install command to upgrade pystackql
309-
result = subprocess.run(
320+
subprocess.run(
310321
[sys.executable, "-m", "pip", "install", "--upgrade", "--quiet", "pystackql"],
311322
check=True,
312323
stdout=subprocess.PIPE,
@@ -341,18 +352,22 @@ def create_project_structure(stack_name, provider=None):
341352
base_path = os.path.join(os.getcwd(), stack_name)
342353
if os.path.exists(base_path):
343354
raise click.ClickException(f"directory '{stack_name}' already exists.")
344-
355+
345356
directories = ['resources']
346357
for directory in directories:
347358
os.makedirs(os.path.join(base_path, directory), exist_ok=True)
348-
359+
349360
# Check if provider is supported
350361
if provider is None:
351362
logger.debug(f"provider not supplied, defaulting to `{DEFAULT_PROVIDER}`")
352363
provider = DEFAULT_PROVIDER
353364
elif provider not in SUPPORTED_PROVIDERS:
354365
provider = DEFAULT_PROVIDER
355-
message = f"provider '{provider}' is not supported for `init`, supported providers are: {', '.join(SUPPORTED_PROVIDERS)}, defaulting to `{DEFAULT_PROVIDER}`"
366+
message = (
367+
f"provider '{provider}' is not supported for `init`, "
368+
f"supported providers are: {', '.join(SUPPORTED_PROVIDERS)}, "
369+
f"defaulting to `{DEFAULT_PROVIDER}`"
370+
)
356371
click.secho(message, fg='yellow', err=False)
357372

358373
# set template files
@@ -373,7 +388,7 @@ def create_project_structure(stack_name, provider=None):
373388
'README.md.template': os.path.join(base_path, 'README.md'),
374389
f'resources/{sample_res_name}.iql.template': os.path.join(base_path,'resources', f'{sample_res_name}.iql'),
375390
}
376-
391+
377392
for template_name, output_name in template_files.items():
378393
logger.debug(f"template name: {template_name}")
379394
logger.debug(f"template output name: {output_name}")
@@ -384,7 +399,11 @@ def create_project_structure(stack_name, provider=None):
384399

385400
@cli.command()
386401
@click.argument('stack_name')
387-
@click.option('--provider', default=None, help='[OPTIONAL] specify a provider to start your project, supported values: aws, azure, google')
402+
@click.option(
403+
"--provider",
404+
default=None,
405+
help="[OPTIONAL] specify a provider to start your project, supported values: aws, azure, google",
406+
)
388407
def init(stack_name, provider):
389408
"""Initialize a new stackql-deploy project structure."""
390409
setup_logger("init", locals())

0 commit comments

Comments
 (0)