Skip to content

Commit

Permalink
Resolve useless-option-value pylint errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
samsrabin committed Mar 4, 2025
1 parent 2c3d3a5 commit 3c23c96
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 85 deletions.
70 changes: 1 addition & 69 deletions python/ctsm/.pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,9 @@ confidence=
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use "--disable=all --enable=classes
# --disable=W".
disable=print-statement,
parameter-unpacking,
unpacking-in-except,
old-raise-syntax,
backtick,
long-suffix,
disable=long-suffix,
old-ne-operator,
old-octal-literal,
import-star-module-level,
non-ascii-bytes-literal,
raw-checker-failed,
bad-inline-option,
Expand All @@ -79,74 +73,12 @@ disable=print-statement,
useless-suppression,
deprecated-pragma,
use-symbolic-message-instead,
apply-builtin,
basestring-builtin,
buffer-builtin,
cmp-builtin,
coerce-builtin,
execfile-builtin,
file-builtin,
long-builtin,
raw_input-builtin,
reduce-builtin,
standarderror-builtin,
unicode-builtin,
xrange-builtin,
coerce-method,
delslice-method,
getslice-method,
setslice-method,
no-absolute-import,
old-division,
dict-iter-method,
dict-view-method,
next-method-called,
metaclass-assignment,
indexing-exception,
raising-string,
reload-builtin,
oct-method,
hex-method,
nonzero-method,
cmp-method,
input-builtin,
round-builtin,
intern-builtin,
unichr-builtin,
map-builtin-not-iterating,
zip-builtin-not-iterating,
range-builtin-not-iterating,
filter-builtin-not-iterating,
using-cmp-argument,
eq-without-hash,
div-method,
idiv-method,
rdiv-method,
exception-message-attribute,
invalid-str-codec,
sys-max-int,
bad-python3-import,
deprecated-string-function,
deprecated-str-translate-call,
deprecated-itertools-function,
deprecated-types-field,
next-method-defined,
dict-items-not-iterating,
dict-keys-not-iterating,
dict-values-not-iterating,
deprecated-operator-function,
deprecated-urllib-function,
xreadlines-attribute,
deprecated-sys-function,
exception-escape,
comprehension-escape,
R0801, # This option to the end are options required to use black formatter
W1515,
W1514,
R1732,
C0209,
C0326, # This and the next are the two options that black documentation tells us to ignore
C0330, # This is an option that the formatter "black" requires us to disable
# --- default list is above here, our own list is below here ---
# While pylint's recommendations to keep the number of arguments, local
# variables and branches low is generally a good one, I don't want it to
Expand Down
1 change: 0 additions & 1 deletion python/ctsm/site_and_regional/tower_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ def build_base_case(
# update case_path to be the full path to the base case
return case_path

# pylint: disable=no-self-use
def get_batch_query(self, case):
"""
Function for querying the batch queue query command for a case, depending on the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ def test_simple_jobscript_multi(self):
"""
Test that a standard simple namelist works
"""
# pylint: disable=no-self-use
self.createJS(nodes="4", tasks_per_node="12", scenario="crop-global-present")


Expand Down
6 changes: 0 additions & 6 deletions python/ctsm/test/test_sys_gen_mksurfdata_jobscript_single.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,38 +72,33 @@ def test_simple_jobscript_single(self):
"""
Test that a standard simple namelist works
"""
# pylint: disable=no-self-use
self.createJS(nodes="4", tasks_per_node="12")

def test_casper_jobscript_single(self):
"""
Test that a standard simple namelist works for casper
"""
# pylint: disable=no-self-use
opt_list = ["--machine", "casper"]
self.createJS(nodes="4", tasks_per_node="12", option_list=opt_list)

def test_izumi_jobscript_single(self):
"""
Test that a standard simple namelist works for asper
"""
# pylint: disable=no-self-use
opt_list = ["--machine", "izumi"]
self.createJS(nodes="4", tasks_per_node="12", option_list=opt_list)

def test_bad_bld_path(self):
"""
Test aborts if the input bld-path does NOT exist
"""
# pylint: disable=no-self-use
with self.assertRaisesRegex(SystemExit, "Input Build path"):
self.createJS(nodes="4", tasks_per_node="12", option_list=["--bld-path", "zztop"])

def test_neg_nodes(self):
"""
Test aborts if the input node count is negative
"""
# pylint: disable=no-self-use
with self.assertRaisesRegex(
SystemExit,
"Input argument --number_of_nodes is zero or negative and needs to be positive",
Expand All @@ -114,7 +109,6 @@ def test_neg_tasks(self):
"""
Test aborts if the input tasks_per_node is zero or negative
"""
# pylint: disable=no-self-use
with self.assertRaisesRegex(
SystemExit,
"Input argument --tasks_per_node is zero or negative and needs to be positive",
Expand Down
5 changes: 0 additions & 5 deletions python/ctsm/test/test_sys_gen_mksurfdata_namelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ def test_simple_namelist(self):
"""
Test that a standard simple namelist works
"""
# pylint: disable=no-self-use
sys.argv.extend(
[
"--start-year",
Expand All @@ -64,7 +63,6 @@ def test_nocrop_inlandwet_glc_namelist(self):
"""
Test a namelist with several options on
"""
# pylint: disable=no-self-use
sys.argv.extend(
[
"--start-year",
Expand All @@ -85,7 +83,6 @@ def test_hires_namelist(self):
"""
Test that a high resolution namelist works
"""
# pylint: disable=no-self-use
sys.argv.extend(
[
"--start-year",
Expand All @@ -106,7 +103,6 @@ def test_ssp_transient_namelist(self):
"""
Test that a SSP transient namelist works
"""
# pylint: disable=no-self-use
sys.argv.extend(
[
"--start-year",
Expand All @@ -127,7 +123,6 @@ def test_potveg_namelist(self):
"""
Test that a potential vegetation namelist works
"""
# pylint: disable=no-self-use
sys.argv.extend(
[
"--start-year",
Expand Down
3 changes: 0 additions & 3 deletions python/ctsm/test/test_unit_lilac_build_ctsm.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class TestBuildCtsm(unittest.TestCase):

def test_commandlineArgs_rebuild_valid(self):
"""Test _commandline_args with --rebuild, with a valid argument list (no disallowed args)"""
# pylint: disable=no-self-use
_ = _commandline_args(args_to_parse=["build/directory", "--rebuild"])

@patch("sys.stderr", new_callable=StringIO)
Expand Down Expand Up @@ -101,7 +100,6 @@ def test_commandlineArgs_noRebuild_valid(self):
(all required things present)
"""
# pylint: disable=no-self-use
_ = _commandline_args(
args_to_parse=[
"build/directory",
Expand Down Expand Up @@ -221,7 +219,6 @@ def test_commandlineArgs_machine_valid(self):
(all required things present)
"""
# pylint: disable=no-self-use
_ = _commandline_args(
args_to_parse=[
"build/directory",
Expand Down

0 comments on commit 3c23c96

Please sign in to comment.