From 08df1df581949030ed913ef802a200dc030d527d Mon Sep 17 00:00:00 2001 From: akrherz Date: Fri, 28 Jun 2024 11:40:41 -0500 Subject: [PATCH 1/4] chore: bump ruff --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 688e6af..6911343 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.4.10" + rev: "v0.5.0" hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] From 36720eabb1361abc779ba385621e3381a14daccb Mon Sep 17 00:00:00 2001 From: akrherz Date: Fri, 28 Jun 2024 11:47:01 -0500 Subject: [PATCH 2/4] fix: iemapp incompat with lists --- htdocs/cscap/dl/dl.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/cscap/dl/dl.py b/htdocs/cscap/dl/dl.py index 35c15ed..d90bf8e 100644 --- a/htdocs/cscap/dl/dl.py +++ b/htdocs/cscap/dl/dl.py @@ -15,8 +15,9 @@ import numpy as np import pandas as pd +from pyiem.database import get_dbconn, get_dbconnstr from pyiem.exceptions import NoDataFound -from pyiem.util import get_dbconn, get_dbconnstr, logger +from pyiem.util import logger from pyiem.webutil import ensure_list, iemapp from pymemcache import Client from sqlalchemy import text @@ -660,14 +661,15 @@ def do_work(environ, start_response): email = environ.get("email") sites = ensure_list(environ, "sites[]") # treatments = form.getlist('treatments[]') - agronomic = redup(list(environ.get("agronomic[]", []))) - soil = redup(list(environ.get("soil[]", []))) - ghg = redup(list(environ.get("ghg[]", []))) - ipm = redup(list(environ.get("ipm[]", []))) - years = [int(x) for x in list(environ.get("year[]", []))] + agronomic = redup(ensure_list(environ, "agronomic[]")) + print(environ["ghg[]"]) + soil = redup(ensure_list(environ, "soil[]")) + ghg = redup(ensure_list(environ, "ghg[]")) + ipm = redup(ensure_list(environ, "ipm[]")) + years = [int(x) for x in ensure_list(environ, "year[]")] if not years: years = [2011, 2012, 2013, 2014, 2015] - shm = redup(list(environ.get("shm[]", []))) + shm = redup(ensure_list(environ, "shm[]")) missing = environ.get("missing", "M") if missing == "__custom__": missing = environ.get("custom_missing", "M") From 29ff499563ea85d1cf6dae4f7c6a55e756c83fe1 Mon Sep 17 00:00:00 2001 From: akrherz Date: Fri, 28 Jun 2024 12:04:41 -0500 Subject: [PATCH 3/4] mnt: address lint --- scripts/cscap/drop_column.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/cscap/drop_column.py b/scripts/cscap/drop_column.py index d3d95b7..bbffd6b 100644 --- a/scripts/cscap/drop_column.py +++ b/scripts/cscap/drop_column.py @@ -5,7 +5,7 @@ def main(): """Go Main Go.""" - config = util.get_config() + config = util.get_config("cscap") # Get me a client, stat spr_client = util.get_spreadsheet_client(config) From 2da6cb0b8d6ee217b459a1923f736f3c44e38802 Mon Sep 17 00:00:00 2001 From: akrherz Date: Fri, 28 Jun 2024 12:30:23 -0500 Subject: [PATCH 4/4] mnt: address some lint --- htdocs/admin/siteprogress.py | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/htdocs/admin/siteprogress.py b/htdocs/admin/siteprogress.py index 12ff33f..7b39545 100644 --- a/htdocs/admin/siteprogress.py +++ b/htdocs/admin/siteprogress.py @@ -4,7 +4,7 @@ from io import StringIO from pandas.io.sql import read_sql -from pyiem.util import get_dbconn +from pyiem.database import get_dbconn from pyiem.webutil import iemapp DBCONN = get_dbconn("sustainablecorn") @@ -146,17 +146,6 @@ def application(environ, start_response): if "site" in environ: do_site(sio, environ.get("site")) return - # mode = form.getfirst('mode', 'agronomic') - show_has = environ.get("has", "0") == "1" - show_period = environ.get("period", "0") == "1" - show_dnc = environ.get("dnc", "0") == "1" - show_no = environ.get("no", "0") == "1" - if environ.get("a") is None: - show_has = True - show_period = True - show_dnc = True - show_no = True - # Forget the above, we hard code things like so show_has = True show_period = True show_dnc = True