Skip to content

Commit

Permalink
📝 Sundry review
Browse files Browse the repository at this point in the history
  • Loading branch information
akrherz committed Dec 2, 2024
1 parent 1a3080b commit 3f6bd54
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import datetime
from datetime import date

import pyiem

Expand Down Expand Up @@ -49,7 +49,7 @@

# General information about the project.
project = "pyIEM"
copyright = "2015-%s, daryl herzmann" % (datetime.date.today().year,)
copyright = f"2015-{date.today().year}, daryl herzmann"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down
14 changes: 5 additions & 9 deletions src/pyiem/dep.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Utilities for the Daily Erosion Project"""

import datetime
import math
import re
from datetime import date, timedelta

import numpy as np
import pandas as pd
Expand Down Expand Up @@ -80,12 +80,10 @@ def read_yld(filename):
xref[cropcode] = label # noqa
rows = []
for cropcode, doy, ofe, yld, year in YLD_DATA.findall(data):
date = datetime.date(int(year), 1, 1) + datetime.timedelta(
days=(int(doy) - 1)
)
dt = date(int(year), 1, 1) + timedelta(days=(int(doy) - 1))
rows.append(
dict(
valid=date,
valid=dt,
year=int(year),
yield_kgm2=float(yld),
crop=xref[cropcode],
Expand Down Expand Up @@ -160,9 +158,7 @@ def man2df(mandict: dict, year1: int = 1) -> pd.DataFrame:
> -1
):
doy = surfeff["mdate"]
plant_date = datetime.date(
year, 1, 1
) + datetime.timedelta(days=doy - 1)
plant_date = date(year, 1, 1) + timedelta(days=doy - 1)
rows.append(
{
"year": year,
Expand Down Expand Up @@ -446,7 +442,7 @@ def read_cli(filename, compute_rfactor=False, return_rfactor_metric=True):
dr = points[i] - points[i - 1]
maxr = max(maxr, dr / dt)
linenum += breakpoints + 1
dates.append(datetime.date(int(year), int(mo), int(da)))
dates.append(date(int(year), int(mo), int(da)))
rows.append(
{
"tmax": float(tmax),
Expand Down
10 changes: 6 additions & 4 deletions src/pyiem/htmlgen.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Utility functions that generate HTML."""
"""
Utility functions that generate HTML.
"""

from pyiem.network import Table as NetworkTable

Expand Down Expand Up @@ -43,15 +45,15 @@ def make_select(
) -> str:
"""Generate a HTML select element.
The trick here is what `data` looks like. The basic form is a ``dict``.
You can get `optgroup`s by having the dictionary keys be additional
The trick here is what ``data`` looks like. The basic form is a ``dict``.
You can get ``optgroup`` by having the dictionary keys be additional
lists or dicts.
Args:
name (str): The select name attribute to assign.
selected (mixed): The option value that should be set to selected.
data (dict): The structure to build our select from.
jscallback (str): javascript to place in the `onChange` attribute.
jscallback (str): javascript to place in the ``onChange`` attribute.
cssclass (str): CSS class to assign to the select element.
showvalue (bool): Should option label be prepended by key label.
Expand Down

0 comments on commit 3f6bd54

Please sign in to comment.