From 88d8567055f04ca466f945567cb540fe809b7b9d Mon Sep 17 00:00:00 2001 From: Adam Gagorik Date: Tue, 30 Apr 2024 19:56:28 -0400 Subject: [PATCH] Update pre commit (#108) * Update config * Update pre-commit config --- .pre-commit-config.yaml | 10 +++++----- bany/__main__.py | 1 + bany/cmd/extract/app.py | 1 + bany/cmd/extract/extractors/base.py | 1 + bany/cmd/extract/extractors/pdf.py | 1 + bany/cmd/extract/rules.py | 1 + bany/cmd/solve/app.py | 1 + bany/cmd/solve/network/algo.py | 1 + bany/cmd/solve/network/attrs.py | 1 + bany/cmd/solve/network/loader.py | 1 + bany/cmd/solve/network/validate.py | 1 + bany/cmd/solve/network/visualize.py | 1 + bany/cmd/solve/solvers/basesolver.py | 1 + bany/cmd/solve/solvers/bucketdata.py | 1 + bany/cmd/solve/solvers/constrained.py | 1 + bany/cmd/solve/solvers/graphsolver.py | 1 + bany/cmd/solve/solvers/montecarlo.py | 1 + bany/cmd/solve/solvers/unconstrained.py | 1 + bany/cmd/split/app.py | 1 + bany/cmd/split/splitter.py | 1 + bany/core/cache.py | 1 + bany/core/money.py | 1 + tests/bany/cmd/cookbook.py | 1 + tests/bany/cmd/solve/network/test_algo.py | 1 + tests/bany/cmd/solve/network/test_attrs.py | 1 + tests/bany/cmd/solve/network/test_loader.py | 1 + tests/bany/cmd/solve/network/test_validate.py | 1 + tests/bany/cmd/solve/network/test_visualize.py | 1 + tests/bany/cmd/solve/solvers/test_basesolver.py | 1 + tests/bany/cmd/solve/solvers/test_bucketdata.py | 1 + tests/bany/cmd/solve/solvers/test_constrained.py | 1 + tests/bany/cmd/solve/solvers/test_graphsolver.py | 1 + tests/bany/cmd/solve/solvers/test_montecarlo.py | 1 + tests/bany/cmd/solve/solvers/test_unconstrained.py | 1 + tests/bany/cmd/split/test_splitter.py | 1 + tests/bany/core/test_money.py | 1 + 36 files changed, 40 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 22acad9..dacb0f5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - 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-ast @@ -37,13 +37,13 @@ repos: - id: sort-simple-yaml - id: trailing-whitespace - repo: https://github.com/asottile/pyupgrade - rev: v3.15.0 + rev: v3.15.2 hooks: - id: pyupgrade args: - --py310-plus - repo: https://github.com/PyCQA/autoflake - rev: v2.2.1 + rev: v2.3.1 hooks: - id: autoflake - repo: https://github.com/asottile/reorder_python_imports @@ -55,11 +55,11 @@ repos: hooks: - id: yesqa - repo: https://github.com/psf/black - rev: 23.12.1 + rev: 24.4.2 hooks: - id: black - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks - rev: v2.12.0 + rev: v2.13.0 hooks: - id: pretty-format-yaml exclude: | diff --git a/bany/__main__.py b/bany/__main__.py index 817ee3e..b101749 100644 --- a/bany/__main__.py +++ b/bany/__main__.py @@ -1,6 +1,7 @@ """ Command line scripts for dealing with budgets. """ + import logging from functools import partial from pathlib import Path diff --git a/bany/cmd/extract/app.py b/bany/cmd/extract/app.py index f8efd63..314ae71 100644 --- a/bany/cmd/extract/app.py +++ b/bany/cmd/extract/app.py @@ -1,6 +1,7 @@ """ Parse an input file and create transactions in YNAB. """ + import pathlib import re from pathlib import Path diff --git a/bany/cmd/extract/extractors/base.py b/bany/cmd/extract/extractors/base.py index 642e7b8..196f650 100644 --- a/bany/cmd/extract/extractors/base.py +++ b/bany/cmd/extract/extractors/base.py @@ -1,6 +1,7 @@ """ Extract transactions from a file. """ + import dataclasses import pathlib from collections.abc import Iterator diff --git a/bany/cmd/extract/extractors/pdf.py b/bany/cmd/extract/extractors/pdf.py index ef92a6f..b7975ba 100644 --- a/bany/cmd/extract/extractors/pdf.py +++ b/bany/cmd/extract/extractors/pdf.py @@ -1,6 +1,7 @@ """ Extract transactions from a PDF file using regular expressions. """ + import dataclasses import logging import pathlib diff --git a/bany/cmd/extract/rules.py b/bany/cmd/extract/rules.py index 974c9f3..dba561c 100644 --- a/bany/cmd/extract/rules.py +++ b/bany/cmd/extract/rules.py @@ -1,6 +1,7 @@ """ Rules for extraction information from a PDF. """ + import calendar import itertools import pathlib diff --git a/bany/cmd/solve/app.py b/bany/cmd/solve/app.py index 33deb98..3bd7f9b 100644 --- a/bany/cmd/solve/app.py +++ b/bany/cmd/solve/app.py @@ -2,6 +2,7 @@ Parse an input file and create transactions in YNAB. """ + from pathlib import Path import networkx as nx diff --git a/bany/cmd/solve/network/algo.py b/bany/cmd/solve/network/algo.py index 468cb52..b435aed 100644 --- a/bany/cmd/solve/network/algo.py +++ b/bany/cmd/solve/network/algo.py @@ -1,6 +1,7 @@ """ Methods for creating a graph representation of the problem. """ + import copy import functools import inspect diff --git a/bany/cmd/solve/network/attrs.py b/bany/cmd/solve/network/attrs.py index d020962..069dc3e 100644 --- a/bany/cmd/solve/network/attrs.py +++ b/bany/cmd/solve/network/attrs.py @@ -1,6 +1,7 @@ """ The data associated with each node or column when representing the problem. """ + import dataclasses import typing from functools import partial diff --git a/bany/cmd/solve/network/loader.py b/bany/cmd/solve/network/loader.py index 8d46de1..13a0479 100644 --- a/bany/cmd/solve/network/loader.py +++ b/bany/cmd/solve/network/loader.py @@ -1,6 +1,7 @@ """ Methods for loading input into a DataFrame. """ + import logging import os import re diff --git a/bany/cmd/solve/network/validate.py b/bany/cmd/solve/network/validate.py index b085a1c..74a56a9 100644 --- a/bany/cmd/solve/network/validate.py +++ b/bany/cmd/solve/network/validate.py @@ -1,6 +1,7 @@ """ Methods for creating a graph representation of the problem. """ + import logging import networkx as nx diff --git a/bany/cmd/solve/network/visualize.py b/bany/cmd/solve/network/visualize.py index 7522fb3..e095e16 100644 --- a/bany/cmd/solve/network/visualize.py +++ b/bany/cmd/solve/network/visualize.py @@ -1,6 +1,7 @@ """ Methods for creating a graph representation of the problem. """ + import dataclasses import io diff --git a/bany/cmd/solve/solvers/basesolver.py b/bany/cmd/solve/solvers/basesolver.py index b597121..bf6c9ec 100644 --- a/bany/cmd/solve/solvers/basesolver.py +++ b/bany/cmd/solve/solvers/basesolver.py @@ -1,6 +1,7 @@ """ A base class for solutions to the bucket problem. """ + import dataclasses from bany.cmd.solve.solvers.bucketdata import BucketData diff --git a/bany/cmd/solve/solvers/bucketdata.py b/bany/cmd/solve/solvers/bucketdata.py index e5983b5..42a6f4a 100644 --- a/bany/cmd/solve/solvers/bucketdata.py +++ b/bany/cmd/solve/solvers/bucketdata.py @@ -1,6 +1,7 @@ """ Data structures for solvers for the bucket problem. """ + import dataclasses import logging diff --git a/bany/cmd/solve/solvers/constrained.py b/bany/cmd/solve/solvers/constrained.py index 5a83bf5..90eaaf2 100644 --- a/bany/cmd/solve/solvers/constrained.py +++ b/bany/cmd/solve/solvers/constrained.py @@ -2,6 +2,7 @@ Solve the bucket problem, but do not allow moving values between buckets. In this version of the problem, we can only add to buckets and an optimal solution may not exist. """ + import dataclasses import logging import typing diff --git a/bany/cmd/solve/solvers/graphsolver.py b/bany/cmd/solve/solvers/graphsolver.py index 8a03f10..fae8545 100644 --- a/bany/cmd/solve/solvers/graphsolver.py +++ b/bany/cmd/solve/solvers/graphsolver.py @@ -15,6 +15,7 @@ ├─1 level=[1] results_value=[ 1,250.00] results_ratio=[0.250] amount_to_add=[ 250.00] └─2 level=[1] results_value=[ 1,250.00] results_ratio=[0.250] amount_to_add=[ 250.00] """ + import copy import typing from collections.abc import Callable diff --git a/bany/cmd/solve/solvers/montecarlo.py b/bany/cmd/solve/solvers/montecarlo.py index dbffe38..c0fc624 100644 --- a/bany/cmd/solve/solvers/montecarlo.py +++ b/bany/cmd/solve/solvers/montecarlo.py @@ -3,6 +3,7 @@ In this version of the problem, we can only add to buckets and an optimal solution may not exist. This solution uses Monte Carlo and may not offer the optimal allocation of amounts into buckets, but gets close. """ + import dataclasses import numpy as np diff --git a/bany/cmd/solve/solvers/unconstrained.py b/bany/cmd/solve/solvers/unconstrained.py index 3d380b7..836c899 100644 --- a/bany/cmd/solve/solvers/unconstrained.py +++ b/bany/cmd/solve/solvers/unconstrained.py @@ -2,6 +2,7 @@ Solve the bucket problem, allowing amounts to be removed from existing buckets. This is a pretty straight forward solution and places no major constrains on the problem. """ + import dataclasses import numpy as np diff --git a/bany/cmd/split/app.py b/bany/cmd/split/app.py index df404bf..3d77132 100644 --- a/bany/cmd/split/app.py +++ b/bany/cmd/split/app.py @@ -1,6 +1,7 @@ """ Itemize and split a receipt between people. """ + import functools import re import sys diff --git a/bany/cmd/split/splitter.py b/bany/cmd/split/splitter.py index 5c8be40..b13f80f 100644 --- a/bany/cmd/split/splitter.py +++ b/bany/cmd/split/splitter.py @@ -1,6 +1,7 @@ """ A class to managed split expenses. """ + import dataclasses import functools import itertools diff --git a/bany/core/cache.py b/bany/core/cache.py index c78fe78..6edc1df 100644 --- a/bany/core/cache.py +++ b/bany/core/cache.py @@ -1,6 +1,7 @@ """ This module defines a decorator for caching the results of an API call. """ + import functools import itertools import pathlib diff --git a/bany/core/money.py b/bany/core/money.py index bc48584..04b953f 100644 --- a/bany/core/money.py +++ b/bany/core/money.py @@ -1,6 +1,7 @@ """ Helper functions for Money. """ + import decimal import itertools diff --git a/tests/bany/cmd/cookbook.py b/tests/bany/cmd/cookbook.py index 7eed626..7c8c16e 100644 --- a/tests/bany/cmd/cookbook.py +++ b/tests/bany/cmd/cookbook.py @@ -1,6 +1,7 @@ """ Unit test utilities. """ + import logging import networkx as nx diff --git a/tests/bany/cmd/solve/network/test_algo.py b/tests/bany/cmd/solve/network/test_algo.py index cfd057f..9b21018 100644 --- a/tests/bany/cmd/solve/network/test_algo.py +++ b/tests/bany/cmd/solve/network/test_algo.py @@ -1,6 +1,7 @@ """ Unit tests for module. """ + import logging import typing diff --git a/tests/bany/cmd/solve/network/test_attrs.py b/tests/bany/cmd/solve/network/test_attrs.py index a2592b2..5e17f9a 100644 --- a/tests/bany/cmd/solve/network/test_attrs.py +++ b/tests/bany/cmd/solve/network/test_attrs.py @@ -1,6 +1,7 @@ """ Unit tests for module. """ + import dataclasses import pytest diff --git a/tests/bany/cmd/solve/network/test_loader.py b/tests/bany/cmd/solve/network/test_loader.py index db231c3..b1bc7be 100644 --- a/tests/bany/cmd/solve/network/test_loader.py +++ b/tests/bany/cmd/solve/network/test_loader.py @@ -1,6 +1,7 @@ """ Unit tests for module. """ + import builtins import io import textwrap diff --git a/tests/bany/cmd/solve/network/test_validate.py b/tests/bany/cmd/solve/network/test_validate.py index dfd2edc..5410881 100644 --- a/tests/bany/cmd/solve/network/test_validate.py +++ b/tests/bany/cmd/solve/network/test_validate.py @@ -1,6 +1,7 @@ """ Unit tests for module. """ + import unittest.mock import networkx as nx diff --git a/tests/bany/cmd/solve/network/test_visualize.py b/tests/bany/cmd/solve/network/test_visualize.py index a2bdf1f..eae3edb 100644 --- a/tests/bany/cmd/solve/network/test_visualize.py +++ b/tests/bany/cmd/solve/network/test_visualize.py @@ -1,6 +1,7 @@ """ Unit tests for module. """ + import logging import networkx as nx diff --git a/tests/bany/cmd/solve/solvers/test_basesolver.py b/tests/bany/cmd/solve/solvers/test_basesolver.py index 65a0876..3e616ba 100644 --- a/tests/bany/cmd/solve/solvers/test_basesolver.py +++ b/tests/bany/cmd/solve/solvers/test_basesolver.py @@ -1,6 +1,7 @@ """ Unit tests for module. """ + import pytest import bany.cmd.solve.solvers.basesolver diff --git a/tests/bany/cmd/solve/solvers/test_bucketdata.py b/tests/bany/cmd/solve/solvers/test_bucketdata.py index 70ca057..d6d5555 100644 --- a/tests/bany/cmd/solve/solvers/test_bucketdata.py +++ b/tests/bany/cmd/solve/solvers/test_bucketdata.py @@ -1,6 +1,7 @@ """ Unit tests for module. """ + import logging import pytest diff --git a/tests/bany/cmd/solve/solvers/test_constrained.py b/tests/bany/cmd/solve/solvers/test_constrained.py index 3e092dc..af1fc4e 100644 --- a/tests/bany/cmd/solve/solvers/test_constrained.py +++ b/tests/bany/cmd/solve/solvers/test_constrained.py @@ -1,6 +1,7 @@ """ Unit tests for module. """ + import logging import numpy as np diff --git a/tests/bany/cmd/solve/solvers/test_graphsolver.py b/tests/bany/cmd/solve/solvers/test_graphsolver.py index 741f1dd..723d76c 100644 --- a/tests/bany/cmd/solve/solvers/test_graphsolver.py +++ b/tests/bany/cmd/solve/solvers/test_graphsolver.py @@ -1,6 +1,7 @@ """ Unit tests for module. """ + import logging import networkx as nx diff --git a/tests/bany/cmd/solve/solvers/test_montecarlo.py b/tests/bany/cmd/solve/solvers/test_montecarlo.py index cd7a8d8..f82f08c 100644 --- a/tests/bany/cmd/solve/solvers/test_montecarlo.py +++ b/tests/bany/cmd/solve/solvers/test_montecarlo.py @@ -1,6 +1,7 @@ """ Unit tests for module. """ + import logging import numpy as np diff --git a/tests/bany/cmd/solve/solvers/test_unconstrained.py b/tests/bany/cmd/solve/solvers/test_unconstrained.py index fa37614..82c3047 100644 --- a/tests/bany/cmd/solve/solvers/test_unconstrained.py +++ b/tests/bany/cmd/solve/solvers/test_unconstrained.py @@ -1,6 +1,7 @@ """ Unit tests for module. """ + import logging import pandas as pd diff --git a/tests/bany/cmd/split/test_splitter.py b/tests/bany/cmd/split/test_splitter.py index 2115e39..3bd9f6a 100644 --- a/tests/bany/cmd/split/test_splitter.py +++ b/tests/bany/cmd/split/test_splitter.py @@ -1,6 +1,7 @@ """ Unit tests for module. """ + import dataclasses import logging diff --git a/tests/bany/core/test_money.py b/tests/bany/core/test_money.py index 52726bd..fc555bf 100644 --- a/tests/bany/core/test_money.py +++ b/tests/bany/core/test_money.py @@ -1,6 +1,7 @@ """ Unit tests for module. """ + import pytest import bany.core.money