From e462b76201544e5e3585045ebe748d12358f43c0 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:23:14 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .github/workflows/main.yaml | 10 +++++----- .github/workflows/pypi-release.yaml | 4 ++-- .pre-commit-config.yaml | 6 +++--- .readthedocs.yaml | 2 +- cmip6_downscaling/config.py | 1 + docs/running-flows.md | 2 +- flows/catalogs/web_catalog.py | 12 ++++++------ flows/cmip6_raw_pyramids.py | 5 +++-- 8 files changed, 22 insertions(+), 20 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 4c6f423f..d6bdc88a 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -1,12 +1,12 @@ name: CI on: push: - branches: ['main'] + branches: ["main"] pull_request: - branches: ['main'] + branches: ["main"] workflow_dispatch: schedule: - - cron: '0 0 * * 0' # Weekly “At 00:00” + - cron: "0 0 * * 0" # Weekly “At 00:00” # concurrency: # group: ${{ github.workflow }}-${{ github.ref }} @@ -22,7 +22,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.9', '3.10', '3.11'] + python-version: ["3.9", "3.10", "3.11"] timeout-minutes: 20 defaults: run: @@ -40,7 +40,7 @@ jobs: python=${{ matrix.python-version }} # now called cache-environment cache-environment: true - post-cleanup: 'none' + post-cleanup: "none" cache-downloads: false - name: Install package diff --git a/.github/workflows/pypi-release.yaml b/.github/workflows/pypi-release.yaml index 81620099..229c4d30 100644 --- a/.github/workflows/pypi-release.yaml +++ b/.github/workflows/pypi-release.yaml @@ -22,7 +22,7 @@ jobs: - uses: actions/setup-python@v5.0.0 name: Install Python with: - python-version: '3.11' + python-version: "3.11" - name: Install dependencies run: | @@ -70,7 +70,7 @@ jobs: - uses: actions/setup-python@v5.0.0 name: Install Python with: - python-version: '3.11' + python-version: "3.11" - uses: actions/download-artifact@v4 with: name: releases diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f1040f64..1c9087d5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,7 +19,7 @@ repos: hooks: - id: pyupgrade args: - - '--py38-plus' + - "--py38-plus" - repo: https://github.com/psf/black rev: 24.4.2 @@ -33,10 +33,10 @@ repos: - id: blackdoc - repo: https://github.com/astral-sh/ruff-pre-commit - rev: 'v0.5.0' + rev: "v0.5.0" hooks: - id: ruff - args: ['--fix'] + args: ["--fix"] - repo: https://github.com/pre-commit/mirrors-prettier rev: v4.0.0-alpha.8 diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 6ab8bedc..5b1d4476 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -8,7 +8,7 @@ version: 2 build: os: ubuntu-20.04 tools: - python: 'mambaforge-4.10' + python: "mambaforge-4.10" # Build documentation in the doc/ directory with Sphinx sphinx: diff --git a/cmip6_downscaling/config.py b/cmip6_downscaling/config.py index 2e9548b8..762b00d9 100644 --- a/cmip6_downscaling/config.py +++ b/cmip6_downscaling/config.py @@ -1,4 +1,5 @@ """Config file used by donfig""" + from __future__ import annotations _defaults = { diff --git a/docs/running-flows.md b/docs/running-flows.md index 349c140f..e15b8c9f 100644 --- a/docs/running-flows.md +++ b/docs/running-flows.md @@ -44,7 +44,7 @@ config.set({'runtime': 'cloud'}) ```yaml run_options: -runtime: 'cloud' +runtime: "cloud" ``` ### Environment Variables diff --git a/flows/catalogs/web_catalog.py b/flows/catalogs/web_catalog.py index c780b9bc..b56558ab 100644 --- a/flows/catalogs/web_catalog.py +++ b/flows/catalogs/web_catalog.py @@ -284,9 +284,9 @@ def parse_cmip6_downscaled_pyramid( query = { 'source_id': parameters['model'], 'member_id': parameters['member'], - 'experiment_id': 'historical' - if parameters['scenario'] == 'hist' - else parameters['scenario'], + 'experiment_id': ( + 'historical' if parameters['scenario'] == 'hist' else parameters['scenario'] + ), 'variable_id': parameters['variable'], } @@ -389,9 +389,9 @@ def parse_cmip6_downscaled_pyramid( downscaling_method=attrs['method'], root_path=root_path, ) - attrs[ - 'name' - ] = f"{targets['destination_name']}.{attrs['timescale']}" # make sure the name is unique + attrs['name'] = ( + f"{targets['destination_name']}.{attrs['timescale']}" # make sure the name is unique + ) attrs['destination_path'] = targets['destination_path'] attrs['source_path'] = from_az_to_https(attrs['daily_downscaled_data_uri'], root_path) diff --git a/flows/cmip6_raw_pyramids.py b/flows/cmip6_raw_pyramids.py index 3e693763..5e1c55ed 100644 --- a/flows/cmip6_raw_pyramids.py +++ b/flows/cmip6_raw_pyramids.py @@ -93,8 +93,9 @@ def preprocess(ds) -> xr.Dataset: def _compute_summary_helper(path, freq, chunks): import xarray as xr - with xr.set_options(keep_attrs=True), dask.config.set( - **{'array.slicing.split_large_chunks': False} + with ( + xr.set_options(keep_attrs=True), + dask.config.set(**{'array.slicing.split_large_chunks': False}), ): ds = xr.open_zarr(path).pipe(preprocess) if ds.attrs['variable_id'] in {'tasmax', 'tasmin'}: