Skip to content

Commit

Permalink
more pylint cleanup!
Browse files Browse the repository at this point in the history
more snake case enforcement.
variables appearing unused to pylint b.c. of click conventions ignored in more places
some unnecessary returns/passes/if-else conditions removed/rewritten
a doc string here and there
  • Loading branch information
ilaflott committed Aug 12, 2024
1 parent 73a9286 commit ac5b30c
Show file tree
Hide file tree
Showing 14 changed files with 113 additions and 294 deletions.
4 changes: 2 additions & 2 deletions fre/app/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
''' for fre.app imports '''
from .maskAtmosPlevel import maskAtmosPlevel_subtool
from .mask_atmos_plevel import mask_atmos_plevel_subtool
from .freapp import app_cli

__all__ = ["maskAtmosPlevel_subtool", "app_cli"]
__all__ = ["mask_atmos_plevel_subtool", "app_cli"]
4 changes: 2 additions & 2 deletions fre/app/freapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import click

from .maskAtmosPlevel import maskAtmosPlevel_subtool
from .mask_atmos_plevel import mask_atmos_plevel_subtool
from .generate_time_averages.generate_time_averages import generate

@click.group(help=click.style(" - access fre app subcommands", fg=(250,154,90)))
Expand All @@ -29,7 +29,7 @@ def app_cli():
def mask_atmos_plevel(context, infile, outfile, psfile):
# pylint: disable=unused-argument
"""Mask out pressure level diagnostic output below land surface"""
context.forward(maskAtmosPlevel_subtool)
context.forward(mask_atmos_plevel_subtool)


@app_cli.command()
Expand Down
154 changes: 0 additions & 154 deletions fre/app/maskAtmosPlevel.py

This file was deleted.

9 changes: 7 additions & 2 deletions fre/catalog/frecatalog.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
'''
entry point for fre catalog subcommands
'''

import click
import catalogbuilder
#import catalogbuilder
from catalogbuilder.scripts import gen_intake_gfdl
from catalogbuilder.scripts import test_catalog

Expand Down Expand Up @@ -33,7 +37,8 @@ def builder(context, input_path = None, output_path = None, config = None, filte
@catalog_cli.command()
@click.argument('json_path', nargs = 1 , required = True)
@click.argument('json_template_path', nargs = 1 , required = False)
@click.option('-tf', '--test-failure', is_flag=True, default = False, help="Errors are only printed. Program will not exit.")
@click.option('-tf', '--test-failure', is_flag=True, default = False,
help="Errors are only printed. Program will not exit.")
@click.pass_context
def validate(context, json_path, json_template_path, test_failure):
# pylint: disable=unused-argument
Expand Down
4 changes: 4 additions & 0 deletions fre/check/frecheck.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
''' fre check '''

import click

from .frecheckexample import check_test_function

@click.group(help=click.style(" - access fre check subcommands", fg=(162,91,232)))
Expand All @@ -9,6 +12,7 @@ def check_cli():
@click.option('--uppercase', '-u', is_flag=True, help = 'Print statement in uppercase.')
@click.pass_context
def function(context, uppercase):
# pylint: disable=unused-argument
""" - Execute fre check test """
context.forward(check_test_function)

Expand Down
2 changes: 1 addition & 1 deletion fre/check/frecheckexample.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import click

@click.command()
def check_test_function(uppercase):
def check_test_function(uppercase=None):
"""Execute fre list testfunction2."""
statement = "testingtestingtestingtesting"
if uppercase:
Expand Down
4 changes: 4 additions & 0 deletions fre/cmor/frecmor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
''' fre cmor '''

import click

from .CMORmixer import cmor_run_subtool

@click.group(help=click.style(" - access fre cmor subcommands", fg=(232,91,204)))
Expand Down Expand Up @@ -28,6 +31,7 @@ def cmor_cli():
required=True)
@click.pass_context
def run(context, indir, outdir, varlist, table_config, exp_config):
# pylint: disable=unused-argument
"""Rewrite climate model output"""
context.forward(cmor_run_subtool)

Expand Down
6 changes: 5 additions & 1 deletion fre/list/frelist.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
''' fre list '''

import click

from .frelistexample import list_test_function

@click.group(help=click.style(" - access fre list subcommands", fg=(232,204,91)))
def list_cli():
pass
''' entry point to fre list click commands '''

@list_cli.command()
@click.option('--uppercase', '-u', is_flag=True, help = 'Print statement in uppercase.')
@click.pass_context
def function(context, uppercase):
# pylint: disable=unused-argument
""" - Execute fre list test """
context.forward(list_test_function)

Expand Down
2 changes: 1 addition & 1 deletion fre/list/frelistexample.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import click

@click.command()
def list_test_function(uppercase):
def list_test_function(uppercase=None):
"""Execute fre list testfunction2."""
statement = "testingtestingtestingtesting"
if uppercase:
Expand Down
Loading

0 comments on commit ac5b30c

Please sign in to comment.