Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
repos:
# Misc commit checks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0
# ref: https://github.com/pre-commit/pre-commit-hooks#hooks-available
hooks:
# Autoformat: Makes sure files end in a newline and only a newline.
Expand All @@ -25,7 +25,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/codespell-project/codespell
rev: v2.4.2
rev: 2ccb47ff45ad361a21071a7eedda4c37e6ae8c5a # frozen: v2.4.2
hooks:
- id: codespell
additional_dependencies:
Expand All @@ -36,12 +36,12 @@ repos:
)$

- repo: https://github.com/errata-ai/vale
rev: v3.14.1
rev: 41f3b223e8cc669d1309a2104e5b70df2ae6a5a8 # frozen: v3.14.1
hooks:
- id: vale

- repo: https://github.com/rbubley/mirrors-prettier
rev: v3.8.3
rev: 515f543f5718ebfd6ce22e16708bb32c68ff96e1 # frozen: v3.8.3
hooks:
- id: prettier
types_or: [yaml, html, css, scss, javascript, json, toml]
Expand Down
12 changes: 6 additions & 6 deletions examples/pure-hatch/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
repos:
- repo: https://github.com/PyCQA/isort
rev: 5.11.4
rev: dac090ce4d9ee313d086e2e89ab1acb8c2664fa1 # frozen: 9.0.0a3
hooks:
- id: isort
files: \.py$
# Misc commit checks using built in pre-commit checks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0
# ref: https://github.com/pre-commit/pre-commit-hooks#hooks-available
hooks:
# Autoformat: Makes sure files end in a newline and only a newline.
Expand All @@ -17,16 +17,16 @@ repos:
- id: trailing-whitespace
# Linting: Python code (see the file .flake8)
- repo: https://github.com/PyCQA/flake8
rev: "6.0.0"
rev: c48217e1fc006c2dddd14df54e83b67da15de5cd # frozen: 7.3.0
hooks:
- id: flake8
# Black for auto code formatting
- repo: https://github.com/psf/black
rev: 22.12.0
rev: c6755bb741b6481d6b3d3bb563c83fa060db96c9 # frozen: 26.3.1
hooks:
- id: black
language_version: python3.8
# Tell precommit.ci bot to update codoe format tools listed in the file
language_version: python3.10
# Tell precommit.ci bot to update code format tools listed in the file
# versions every quarter
# The default it so update weekly which is too many new pr's for many
# maintainers (remove these lines if you aren't using the bot!)
Expand Down
4 changes: 2 additions & 2 deletions examples/pure-hatch/src/examplePy/temperature.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def celsius_to_fahrenheit(celsius):
Returns:
float: Temperature in Fahrenheit.
"""
fahrenheit = (celsius * 9/5) + 32
fahrenheit = (celsius * 9 / 5) + 32
return fahrenheit


Expand All @@ -22,5 +22,5 @@ def fahrenheit_to_celsius(fahrenheit):
Returns:
float: Temperature in Celsius.
"""
celsius = (fahrenheit - 32) * 5/9
celsius = (fahrenheit - 32) * 5 / 9
return celsius
9 changes: 6 additions & 3 deletions examples/pure-hatch/src/examplePy/temporal-raw.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
from examplePy.temperature import fahrenheit_to_celsius
import pandas
from typing import Sequence

import pandas

from examplePy.temperature import fahrenheit_to_celsius


def calc_annual_mean(df: pandas.DataFrame):
"""Function to calculate the mean temperature for each year and the final mean"""
# TODO: make this a bit more robust so we can write integration test examples??
# Calculate the mean temperature for each year
yearly_means = df.groupby('Year').mean()
yearly_means = df.groupby("Year").mean()

# Calculate the final mean temperature across all years
final_mean = yearly_means.mean()
Expand Down
3 changes: 2 additions & 1 deletion examples/pure-hatch/src/examplePy/temporal.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

from examplePy.temperature import fahrenheit_to_celsius


def calc_annual_mean(df: pandas.DataFrame):
"""Function to calculate the mean temperature for each year and the final mean"""
# TODO: make this a bit more robust so we can write integration test examples??
# Calculate the mean temperature for each year
yearly_means = df.groupby('Year').mean()
yearly_means = df.groupby("Year").mean()

# Calculate the final mean temperature across all years
final_mean = yearly_means.mean()
Expand Down
1 change: 1 addition & 0 deletions examples/pure-hatch/tests/examplePy/test_temperature.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Pytest-based unit test examples for the temperature module"""

import math

from examplePy import temperature
Expand Down
4 changes: 2 additions & 2 deletions examples/pure-hatch/tests/examplePy/test_temporal.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Pytest-based unit test examples for the temporal module"""

import pathlib

import numpy
Expand Down Expand Up @@ -28,8 +29,7 @@ def test_calc_annual_mean(temperatures):
df_mean, df_final = temporal.calc_annual_mean(temperatures)

# Compare specific means to validate the calculations
assert numpy.isclose(
df_mean.loc[[1988], "Temperature"].iloc[0], expected_mean_1988)
assert numpy.isclose(df_mean.loc[[1988], "Temperature"].iloc[0], expected_mean_1988)
assert numpy.isclose(df_final.loc["Temperature"], expected_mean_final)


Expand Down
Loading