Skip to content

Commit 3ed950c

Browse files
committed
Handle pylint warnings
1 parent 0ceafa0 commit 3ed950c

File tree

4 files changed

+36
-27
lines changed

4 files changed

+36
-27
lines changed

climateset/download/constants/input4mips.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# TODO add VAR_SOURCE_LOOKUP with raw variables
22
# TODO add supported experiments
33
# TODO do we really need emission endings, meta_endings_prc, meta_endings_shar?? how is this used so far?
4+
# pylint: disable=C0103
45
from dataclasses import dataclass
56
from typing import Final
67

climateset/download/downloader_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ def _generate_plain_emission_vars(self):
199199
for b in self.biomass_vars:
200200
try:
201201
self.variables.remove(b)
202-
except Exception as error:
202+
except Exception as error: # pylint: disable=W0718
203203
self.logger.warning(f"Caught the following exception but continuing : {error}")
204204

205205
self.meta_vars_percentage = [

climateset/download/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def infer_nominal_resolution(ds: xr.Dataset, nominal_resolution: str, logger: lo
9393
degree = abs(ds.lon[0].item() - ds.lon[1].item())
9494
nom_res = int(degree * 100)
9595
logger.info(f"Inferring nominal resolution: {nom_res}")
96-
except Exception as error:
96+
except Exception as error: # pylint: disable=W0718
9797
logger.warning(f"Caught the following exception but continuing : {error}")
9898
return nom_res
9999

pyproject.toml

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pre-commit = "^3.7.0"
3939
flake8-pyproject = "^1.2.3"
4040
black = "^24.4.2"
4141
nox = "^2024.4.15"
42-
docformatter = {extras = ["tomli"], version = "^1.7.5"}
42+
docformatter = { extras = ["tomli"], version = "^1.7.5" }
4343
autoflake = "^2.3.1"
4444
autopep8 = "^2.3.2"
4545
ruff = "^0.11.11"
@@ -101,7 +101,15 @@ replace = '''
101101
'''
102102

103103
[tool.pylint]
104-
disable = "C0114,C0115,C0116,R0903,R1710,W1203"
104+
disable = [
105+
"C0114",
106+
"C0115",
107+
"C0116",
108+
"R0903",
109+
"R1710",
110+
"W1203",
111+
"W0511", # TO DO warnings
112+
]
105113
max-line-length = 120
106114
max-locals = 20
107115
max-args = 16
@@ -160,49 +168,49 @@ line-length = 120
160168
target-version = "py311"
161169

162170
exclude = [
163-
".git",
164-
"migrations",
165-
"__pycache__",
171+
".git",
172+
"migrations",
173+
"__pycache__",
166174
]
167175

168176
[tool.ruff.lint]
169177
select = [
170-
"A", # Flake8 Built ins
171-
"E", # Error (Flake8)
172-
"F", # Pyflakes (Flake8)
173-
"W", # Warning (Flake8)
174-
"I", # isort (import sorting)
175-
"N", # Naming conventions (Pylint, etc.)
178+
"A", # Flake8 Built ins
179+
"E", # Error (Flake8)
180+
"F", # Pyflakes (Flake8)
181+
"W", # Warning (Flake8)
182+
"I", # isort (import sorting)
183+
"N", # Naming conventions (Pylint, etc.)
176184
"C90", # mccabe complexity (replaces flake8 --max-complexity and mccabe)
177-
"B", # Bugbear (common linting issues)
178-
"UP", # pyupgrade (suggests modern Python syntax)
185+
"B", # Bugbear (common linting issues)
186+
"UP", # pyupgrade (suggests modern Python syntax)
179187
"PLR", # Pylint refactor
180188
"PLE", # Pylint error (specific Pylint error rules)
181189
"PLW", # Pylint warning (specific Pylint warning rules)
182190
"PLC", # Pylint convention (specific Pylint convention rules)
183-
"R", # Refactor (Pylint refactoring suggestions)
191+
"R", # Refactor (Pylint refactoring suggestions)
184192
"TID", # TO DO comments
185-
"FAST",# FastAPI
186-
"C4", # List and dict comprehensions
187-
"DJ", # Django
193+
"FAST", # FastAPI
194+
"C4", # List and dict comprehensions
195+
"DJ", # Django
188196
"PIE", # Returns and unecessary returns
189-
"Q", # Double quotes
197+
"Q", # Double quotes
190198
"RET", # Fix return statements
191199
"PTH", # Enforce pathlib
192200
"ARG", # Unused argument
193201
"FLY", # Flynt
194202
"NPY", # Numpy specific
195-
"PD", # Pandas specific
203+
"PD", # Pandas specific
196204
"RUF", # Ruff specific
197205
]
198206

199207
ignore = [
200-
"E203", # whitespace before ':', Black already handles this
201-
"E266", # too many leading '#' for comments
202-
"E501", # line too long (we enforce via line-length instead)
203-
"RET504",
204-
"RUF013",
205-
"PTH123"
208+
"E203", # whitespace before ':', Black already handles this
209+
"E266", # too many leading '#' for comments
210+
"E501", # line too long (we enforce via line-length instead)
211+
"RET504",
212+
"RUF013",
213+
"PTH123"
206214
]
207215

208216
[tool.ruff.lint.pydocstyle]

0 commit comments

Comments
 (0)