From e1825d7104281dc2753160578d4f0c814bccbca8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 2 Jul 2024 01:25:10 +0000 Subject: [PATCH 1/3] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/python-jsonschema/check-jsonschema: 0.27.3 → 0.28.6](https://github.com/python-jsonschema/check-jsonschema/compare/0.27.3...0.28.6) - [github.com/psf/black-pre-commit-mirror: 23.12.1 → 24.4.2](https://github.com/psf/black-pre-commit-mirror/compare/23.12.1...24.4.2) - [github.com/asottile/blacken-docs: 1.16.0 → 1.18.0](https://github.com/asottile/blacken-docs/compare/1.16.0...1.18.0) - [github.com/pre-commit/pre-commit-hooks: v4.5.0 → v4.6.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.5.0...v4.6.0) - [github.com/pre-commit/mirrors-prettier: v3.0.2 → v4.0.0-alpha.8](https://github.com/pre-commit/mirrors-prettier/compare/v3.0.2...v4.0.0-alpha.8) - [github.com/astral-sh/ruff-pre-commit: v0.1.9 → v0.5.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.9...v0.5.0) - [github.com/codespell-project/codespell: v2.2.6 → v2.3.0](https://github.com/codespell-project/codespell/compare/v2.2.6...v2.3.0) --- .pre-commit-config.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ab349682..e6ec051e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,7 @@ ci: repos: - repo: "https://github.com/python-jsonschema/check-jsonschema" - rev: "0.27.3" + rev: "0.28.6" hooks: - id: "check-github-workflows" # TODO: Re-enable. The checker and the docs say `build.tools` is @@ -16,20 +16,20 @@ repos: # - id: "check-readthedocs" - repo: https://github.com/psf/black-pre-commit-mirror - rev: "23.12.1" + rev: "24.4.2" hooks: # With notebook support: # - id: black-jupyter - id: black - repo: https://github.com/asottile/blacken-docs - rev: "1.16.0" + rev: "1.18.0" hooks: - id: blacken-docs additional_dependencies: [black==23.9.1] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: "v4.5.0" + rev: "v4.6.0" hooks: - id: check-added-large-files - id: check-case-conflict @@ -53,7 +53,7 @@ repos: - id: rst-inline-touching-normal - repo: https://github.com/pre-commit/mirrors-prettier - rev: "v3.0.2" + rev: "v4.0.0-alpha.8" hooks: - id: prettier types_or: [json] @@ -62,7 +62,7 @@ repos: args: [--prose-wrap=always] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.1.9" + rev: "v0.5.0" hooks: - id: ruff args: ["--fix", "--show-fixes", "--exit-non-zero-on-fix"] @@ -80,7 +80,7 @@ repos: # TODO: Configure in pyproject.toml - repo: https://github.com/codespell-project/codespell - rev: "v2.2.6" + rev: "v2.3.0" hooks: - id: codespell exclude: > From 5245a40c7dd82b6015c0dd4a195a6dc140886022 Mon Sep 17 00:00:00 2001 From: Matt Fisher Date: Mon, 1 Jul 2024 23:13:52 -0600 Subject: [PATCH 2/3] Use prettier 3.x series --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e6ec051e..5713bec0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -52,8 +52,8 @@ repos: - id: rst-directive-colons - id: rst-inline-touching-normal - - repo: https://github.com/pre-commit/mirrors-prettier - rev: "v4.0.0-alpha.8" + - repo: "https://github.com/rbubley/mirrors-prettier" + rev: "v3.3.2" hooks: - id: prettier types_or: [json] From b10bfe1f1089987606039fa95226f5264f89bb52 Mon Sep 17 00:00:00 2001 From: Matt Fisher Date: Mon, 1 Jul 2024 23:16:53 -0600 Subject: [PATCH 3/3] Apply linter fixes --- CODE_OF_CONDUCT.md | 2 +- snow_today_webapp_ingest/cli.py | 1 + snow_today_webapp_ingest/data_classes.py | 1 + snow_today_webapp_ingest/ingest/cogs.py | 1 + snow_today_webapp_ingest/ingest/swe_json.py | 1 + snow_today_webapp_ingest/types_/plot.py | 4 ++-- .../types_/subregion_hierarchy.py | 11 +++++++---- snow_today_webapp_ingest/util/field_transformers.py | 1 + 8 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index c8919a88..18557f9f 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -6,7 +6,7 @@ In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, -level of experience, education, socio-economic status, nationality, personal +level of experience, education, socioeconomic status, nationality, personal appearance, race, religion, or sexual identity and orientation. ## Our Standards diff --git a/snow_today_webapp_ingest/cli.py b/snow_today_webapp_ingest/cli.py index 26db57b3..d6cc8a41 100644 --- a/snow_today_webapp_ingest/cli.py +++ b/snow_today_webapp_ingest/cli.py @@ -3,6 +3,7 @@ NOTE: imports are done in functions to avoid needing to evaluate code within those imports when doing `--help`. """ + from pathlib import Path from shutil import rmtree from tempfile import mkdtemp diff --git a/snow_today_webapp_ingest/data_classes.py b/snow_today_webapp_ingest/data_classes.py index 5c6041c3..217f5d18 100644 --- a/snow_today_webapp_ingest/data_classes.py +++ b/snow_today_webapp_ingest/data_classes.py @@ -4,6 +4,7 @@ TODO: Better name! "Data types" isn't much better. "Data kinds"? """ + import re from dataclasses import dataclass from functools import partial diff --git a/snow_today_webapp_ingest/ingest/cogs.py b/snow_today_webapp_ingest/ingest/cogs.py index 8fa84b1a..0775d129 100644 --- a/snow_today_webapp_ingest/ingest/cogs.py +++ b/snow_today_webapp_ingest/ingest/cogs.py @@ -1,4 +1,5 @@ """Convert non-CO GeoTIFFs to Cloud-Optimized GeoTIFFs.""" + import subprocess from pathlib import Path from pprint import pformat diff --git a/snow_today_webapp_ingest/ingest/swe_json.py b/snow_today_webapp_ingest/ingest/swe_json.py index c264d726..267de37d 100644 --- a/snow_today_webapp_ingest/ingest/swe_json.py +++ b/snow_today_webapp_ingest/ingest/swe_json.py @@ -5,6 +5,7 @@ CRITICAL: This code currently only expects and handles a single region of SWE data. """ + import csv import io from pathlib import Path diff --git a/snow_today_webapp_ingest/types_/plot.py b/snow_today_webapp_ingest/types_/plot.py index 86d5ac3b..8e461251 100644 --- a/snow_today_webapp_ingest/types_/plot.py +++ b/snow_today_webapp_ingest/types_/plot.py @@ -51,13 +51,13 @@ class PlotData(BaseModel): year_to_date: PlotPointColumn = Field( description="Observed values for the current water year to date", ) - min: PlotPointColumn = Field( # noqa: A003 + min: PlotPointColumn = Field( description=( "Observed values for the minimum water year (as specified in" " `metadata.minYear`)" ), ) - max: PlotPointColumn = Field( # noqa: A003 + max: PlotPointColumn = Field( description=( "Observed values for the maximum water year (as specified in" " `metadata.maxYear`)" diff --git a/snow_today_webapp_ingest/types_/subregion_hierarchy.py b/snow_today_webapp_ingest/types_/subregion_hierarchy.py index 21a2a69c..c35dfe20 100644 --- a/snow_today_webapp_ingest/types_/subregion_hierarchy.py +++ b/snow_today_webapp_ingest/types_/subregion_hierarchy.py @@ -15,10 +15,13 @@ class SubRegionsHierarchyCollectionRegionsIndex(RootModel): class SubRegionsHierarchyCollectionRegion(BaseModel): # TODO: Will this output as {} or null? - collections: None | dict[ - SubRegionCollectionIdentifier, - SubRegionsHierarchyCollectionRegionsIndex, - ] = None + collections: ( + None + | dict[ + SubRegionCollectionIdentifier, + SubRegionsHierarchyCollectionRegionsIndex, + ] + ) = None class SubRegionsHierarchyCollection(BaseModel): diff --git a/snow_today_webapp_ingest/util/field_transformers.py b/snow_today_webapp_ingest/util/field_transformers.py index 42d61b8e..01796b12 100644 --- a/snow_today_webapp_ingest/util/field_transformers.py +++ b/snow_today_webapp_ingest/util/field_transformers.py @@ -2,6 +2,7 @@ Currently for SWE JSON only. """ + import math