Skip to content

Commit

Permalink
Enable currently-ignored linting rules E721, E722, F403 (#573)
Browse files Browse the repository at this point in the history
  • Loading branch information
cclauss authored Aug 19, 2024
1 parent 118d49a commit 687766d
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 19 deletions.
2 changes: 1 addition & 1 deletion icepyx/quest/dataset_scripts/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .dataset import *
from .dataset import * # noqa: F403
2 changes: 1 addition & 1 deletion icepyx/quest/dataset_scripts/argo.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ def download(self, params=None, presRange=None, keep_existing=True) -> pd.DataFr
profile_data = self._download_profile(i)
profile_df = self._parse_into_df(profile_data[0])
merged_df = pd.concat([merged_df, profile_df], sort=False)
except:
except Exception:
print("\tError processing profile {0}. Skipping.".format(i))

# now that we have a df from this round of downloads, we can add it to any existing dataframe
Expand Down
4 changes: 2 additions & 2 deletions icepyx/quest/quest.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def search_all(self, **kwargs):
except KeyError:
v.search_data()

except:
except Exception:
dataset_name = type(v).__name__
print("Error querying data from {0}".format(dataset_name))

Expand Down Expand Up @@ -226,7 +226,7 @@ def download_all(self, path="", **kwargs):
except KeyError:
msg = v.download()
print(msg)
except:
except Exception:
dataset_name = type(v).__name__
print("Error downloading data from {0}".format(dataset_name))

Expand Down
2 changes: 1 addition & 1 deletion icepyx/tests/test_Earthdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def earthdata_login(uid=None, pwd=None, email=None, s3token=False) -> bool:
try:
url = "urs.earthdata.nasa.gov"
mock_uid, _, mock_pwd = netrc.netrc(netrc).authenticators(url)
except:
except Exception:
mock_uid = os.environ.get("EARTHDATA_USERNAME")
mock_pwd = os.environ.get("EARTHDATA_PASSWORD")

Expand Down
8 changes: 4 additions & 4 deletions icepyx/tests/test_quest.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ def test_add_is2(quest_instance):

obs = quest_instance.datasets

assert type(obs) == dict
assert type(obs) is dict
assert exp_key in obs.keys()
assert type(obs[exp_key]) == exp_type
assert type(obs[exp_key]) is exp_type
assert quest_instance.datasets[exp_key].product == prod


Expand All @@ -40,9 +40,9 @@ def test_add_argo(quest_instance):

obs = quest_instance.datasets

assert type(obs) == dict
assert type(obs) is dict
assert exp_key in obs.keys()
assert type(obs[exp_key]) == exp_type
assert type(obs[exp_key]) is exp_type
assert set(quest_instance.datasets[exp_key].params) == set(params)


Expand Down
12 changes: 2 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ version_file_template = 'version = "{version}"'
local_scheme = "node-and-date"
fallback_version = "unknown"

[tool.codespell]
ignore-words-list = "aas,socio-economic,toi"

[tool.ruff]
# DevGoal: Lint and format all Jupyter Notebooks, remove below.
Expand All @@ -71,9 +73,6 @@ extend-exclude = ["*.ipynb"]
# docstring-code-format = true
# docstring-code-line-length = "dynamic"

[tool.codespell]
ignore-words-list = "aas,socio-economic,toi"

[tool.ruff.lint]
select = [
"E", # pycodestyle
Expand All @@ -87,13 +86,6 @@ ignore = [
# overlong comments.
# See: https://github.com/psf/black/issues/1713#issuecomment-1357045092
"E501",
# TODO: remove ignores below this line
# comparison syntax in tests
"E721",
# bare except
"E722",
# unable to detect undefined names
"F403",
]

[tool.ruff.lint.per-file-ignores]
Expand Down

0 comments on commit 687766d

Please sign in to comment.