From 096f4f8f70e5fdaa47bf55c235e995f2853213ca Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 29 Apr 2024 21:10:23 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/pandas_profiling/config.py | 1 + src/pandas_profiling/controller/console.py | 1 + src/pandas_profiling/controller/pandas_decorator.py | 1 + src/pandas_profiling/model/correlations.py | 1 + src/pandas_profiling/model/describe.py | 1 + src/pandas_profiling/model/messages.py | 1 + src/pandas_profiling/model/summary_algorithms.py | 2 +- src/pandas_profiling/report/__init__.py | 1 + src/pandas_profiling/report/formatters.py | 1 + .../report/presentation/flavours/html/templates.py | 1 + .../report/presentation/flavours/widget/notebook.py | 1 + src/pandas_profiling/report/structure/report.py | 1 + src/pandas_profiling/utils/cache.py | 1 + src/pandas_profiling/utils/common.py | 3 ++- src/pandas_profiling/utils/dataframe.py | 1 + src/pandas_profiling/utils/paths.py | 1 + src/pandas_profiling/visualisation/missing.py | 1 + src/pandas_profiling/visualisation/plot.py | 1 + src/pandas_profiling/visualisation/utils.py | 1 + tests/issues/test_issue100.py | 1 + tests/issues/test_issue120.py | 1 + tests/issues/test_issue147.py | 1 + tests/issues/test_issue169.py | 1 + tests/issues/test_issue200.py | 1 + tests/issues/test_issue215.py | 1 + tests/issues/test_issue243.py | 1 + tests/issues/test_issue249.py | 1 + tests/issues/test_issue282.py | 1 + tests/issues/test_issue353.py | 1 + tests/issues/test_issue377.py | 1 + tests/issues/test_issue388.py | 1 + tests/issues/test_issue397.py | 1 + tests/issues/test_issue416.py | 1 + tests/issues/test_issue437.py | 1 + tests/issues/test_issue502.py | 1 + tests/issues/test_issue51.py | 1 + tests/issues/test_issue523.py | 1 + tests/issues/test_issue613.py | 1 + tests/issues/test_issue664.py | 1 + tests/issues/test_issue671.py | 1 + tests/issues/test_issue72.py | 1 + tests/issues/test_issue94.py | 1 + tests/issues/test_issueXXX.py | 1 + tests/unit/test_formatters.py | 6 +++--- 44 files changed, 47 insertions(+), 5 deletions(-) diff --git a/src/pandas_profiling/config.py b/src/pandas_profiling/config.py index 2a5fe78cb..6e95b2db5 100644 --- a/src/pandas_profiling/config.py +++ b/src/pandas_profiling/config.py @@ -1,4 +1,5 @@ """Configuration for the package is handled in this wrapper for confuse.""" + import argparse from pathlib import Path from typing import Union diff --git a/src/pandas_profiling/controller/console.py b/src/pandas_profiling/controller/console.py index 702b51fc7..fb6daea5e 100644 --- a/src/pandas_profiling/controller/console.py +++ b/src/pandas_profiling/controller/console.py @@ -1,4 +1,5 @@ """This file add the console interface to the package.""" + import argparse from pathlib import Path from typing import Union diff --git a/src/pandas_profiling/controller/pandas_decorator.py b/src/pandas_profiling/controller/pandas_decorator.py index d98bd763c..1210a6f30 100644 --- a/src/pandas_profiling/controller/pandas_decorator.py +++ b/src/pandas_profiling/controller/pandas_decorator.py @@ -1,4 +1,5 @@ """This file add the decorator on the DataFrame object.""" + from pandas import DataFrame from pandas_profiling.profile_report import ProfileReport diff --git a/src/pandas_profiling/model/correlations.py b/src/pandas_profiling/model/correlations.py index 99756ed71..2d9424ad6 100644 --- a/src/pandas_profiling/model/correlations.py +++ b/src/pandas_profiling/model/correlations.py @@ -1,4 +1,5 @@ """Correlations between variables.""" + import itertools import warnings from typing import Dict, List, Optional diff --git a/src/pandas_profiling/model/describe.py b/src/pandas_profiling/model/describe.py index 80b53d253..3970f6463 100644 --- a/src/pandas_profiling/model/describe.py +++ b/src/pandas_profiling/model/describe.py @@ -1,4 +1,5 @@ """Organize the calculation of statistics for each series in this DataFrame.""" + import warnings from datetime import datetime from typing import Optional diff --git a/src/pandas_profiling/model/messages.py b/src/pandas_profiling/model/messages.py index 3330c049e..03bd1cbba 100644 --- a/src/pandas_profiling/model/messages.py +++ b/src/pandas_profiling/model/messages.py @@ -1,5 +1,6 @@ """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant values, high correlations).""" + from enum import Enum, auto, unique from typing import Dict, List, Optional, Set, Union diff --git a/src/pandas_profiling/model/summary_algorithms.py b/src/pandas_profiling/model/summary_algorithms.py index 0f7d2c0f8..c498b3a27 100644 --- a/src/pandas_profiling/model/summary_algorithms.py +++ b/src/pandas_profiling/model/summary_algorithms.py @@ -265,7 +265,7 @@ def describe_date_1d(series: pd.Series, summary: dict) -> Tuple[pd.Series, dict] summary["range"] = summary["max"] - summary["min"] - values = series.values.astype(np.int64) // 10 ** 9 + values = series.values.astype(np.int64) // 10**9 if chi_squared_threshold > 0.0: summary["chi_squared"] = chi_square(values) diff --git a/src/pandas_profiling/report/__init__.py b/src/pandas_profiling/report/__init__.py index 1a41fec98..917ef83d0 100644 --- a/src/pandas_profiling/report/__init__.py +++ b/src/pandas_profiling/report/__init__.py @@ -1,2 +1,3 @@ """All functionality concerned with presentation to the user.""" + from pandas_profiling.report.structure.report import get_report_structure diff --git a/src/pandas_profiling/report/formatters.py b/src/pandas_profiling/report/formatters.py index 6a29e8bdd..f49129825 100644 --- a/src/pandas_profiling/report/formatters.py +++ b/src/pandas_profiling/report/formatters.py @@ -1,4 +1,5 @@ """Formatters are mappings from object(s) to a string.""" + from typing import Callable, Dict import numpy as np diff --git a/src/pandas_profiling/report/presentation/flavours/html/templates.py b/src/pandas_profiling/report/presentation/flavours/html/templates.py index 12312bbae..14e1b2979 100644 --- a/src/pandas_profiling/report/presentation/flavours/html/templates.py +++ b/src/pandas_profiling/report/presentation/flavours/html/templates.py @@ -1,4 +1,5 @@ """Contains all templates used for generating the HTML profile report""" + import re import shutil from pathlib import Path diff --git a/src/pandas_profiling/report/presentation/flavours/widget/notebook.py b/src/pandas_profiling/report/presentation/flavours/widget/notebook.py index 5f3bb9d55..020b09f25 100644 --- a/src/pandas_profiling/report/presentation/flavours/widget/notebook.py +++ b/src/pandas_profiling/report/presentation/flavours/widget/notebook.py @@ -1,4 +1,5 @@ """Functionality related to displaying the profile report in Jupyter notebooks.""" + import html from pathlib import Path diff --git a/src/pandas_profiling/report/structure/report.py b/src/pandas_profiling/report/structure/report.py index e28cba851..9464aa9d6 100644 --- a/src/pandas_profiling/report/structure/report.py +++ b/src/pandas_profiling/report/structure/report.py @@ -1,4 +1,5 @@ """Generate the report.""" + from typing import List import pandas as pd diff --git a/src/pandas_profiling/utils/cache.py b/src/pandas_profiling/utils/cache.py index 1699b2c22..de1f217c9 100644 --- a/src/pandas_profiling/utils/cache.py +++ b/src/pandas_profiling/utils/cache.py @@ -1,4 +1,5 @@ """Dataset cache utility functions""" + from pathlib import Path import requests diff --git a/src/pandas_profiling/utils/common.py b/src/pandas_profiling/utils/common.py index 5ac592560..0be19ba22 100644 --- a/src/pandas_profiling/utils/common.py +++ b/src/pandas_profiling/utils/common.py @@ -1,4 +1,5 @@ """Common util functions (e.g. missing in Python).""" + import collections import zipfile from datetime import datetime, timedelta @@ -20,7 +21,7 @@ def update(d: dict, u: Mapping) -> dict: The merged dictionary. """ for k, v in u.items(): - if isinstance(v, collections.Mapping): + if isinstance(v, collections.abc.Mapping): d[k] = update(d.get(k, {}), v) else: d[k] = v diff --git a/src/pandas_profiling/utils/dataframe.py b/src/pandas_profiling/utils/dataframe.py index 1388f7f31..cba5142c9 100644 --- a/src/pandas_profiling/utils/dataframe.py +++ b/src/pandas_profiling/utils/dataframe.py @@ -1,4 +1,5 @@ """Utils for pandas DataFrames.""" + import re import unicodedata import warnings diff --git a/src/pandas_profiling/utils/paths.py b/src/pandas_profiling/utils/paths.py index 46e62f1f5..b76d8f453 100644 --- a/src/pandas_profiling/utils/paths.py +++ b/src/pandas_profiling/utils/paths.py @@ -1,4 +1,5 @@ """Paths that are useful throughout the project.""" + from pathlib import Path diff --git a/src/pandas_profiling/visualisation/missing.py b/src/pandas_profiling/visualisation/missing.py index df78de489..0b6c71b54 100644 --- a/src/pandas_profiling/visualisation/missing.py +++ b/src/pandas_profiling/visualisation/missing.py @@ -1,4 +1,5 @@ """Plotting functions for the missing values diagrams""" + import pandas as pd from matplotlib import pyplot as plt from missingno import missingno diff --git a/src/pandas_profiling/visualisation/plot.py b/src/pandas_profiling/visualisation/plot.py index f8d2c55a1..4d2215fc6 100644 --- a/src/pandas_profiling/visualisation/plot.py +++ b/src/pandas_profiling/visualisation/plot.py @@ -1,4 +1,5 @@ """Plot functions for the profiling report.""" + import copy from typing import Optional, Union diff --git a/src/pandas_profiling/visualisation/utils.py b/src/pandas_profiling/visualisation/utils.py index d5b5fd6f1..a58c5f6cb 100644 --- a/src/pandas_profiling/visualisation/utils.py +++ b/src/pandas_profiling/visualisation/utils.py @@ -1,4 +1,5 @@ """Plotting utility functions.""" + import base64 import uuid from io import BytesIO, StringIO diff --git a/tests/issues/test_issue100.py b/tests/issues/test_issue100.py index 0978a220c..e6ceda957 100644 --- a/tests/issues/test_issue100.py +++ b/tests/issues/test_issue100.py @@ -2,6 +2,7 @@ Test for issue 100: https://github.com/pandas-profiling/pandas-profiling/issues/100 """ + import numpy as np import pandas as pd diff --git a/tests/issues/test_issue120.py b/tests/issues/test_issue120.py index 325368033..be4f242d3 100644 --- a/tests/issues/test_issue120.py +++ b/tests/issues/test_issue120.py @@ -2,6 +2,7 @@ Test for issue 120: https://github.com/pandas-profiling/pandas-profiling/issues/120 """ + import pandas as pd from pandas_profiling import ProfileReport diff --git a/tests/issues/test_issue147.py b/tests/issues/test_issue147.py index 324ba99d0..8ae46b8d9 100644 --- a/tests/issues/test_issue147.py +++ b/tests/issues/test_issue147.py @@ -2,6 +2,7 @@ Test for issue 147: https://github.com/pandas-profiling/pandas-profiling/issues/147 """ + import pandas as pd from pandas_profiling import ProfileReport diff --git a/tests/issues/test_issue169.py b/tests/issues/test_issue169.py index 1e22c6bc8..486999a32 100644 --- a/tests/issues/test_issue169.py +++ b/tests/issues/test_issue169.py @@ -2,6 +2,7 @@ Test for issue 169: https://github.com/pandas-profiling/pandas-profiling/issues/169 """ + from io import StringIO import pandas as pd diff --git a/tests/issues/test_issue200.py b/tests/issues/test_issue200.py index 8e946905b..eec029aba 100644 --- a/tests/issues/test_issue200.py +++ b/tests/issues/test_issue200.py @@ -2,6 +2,7 @@ Test for issue 200: https://github.com/pandas-profiling/pandas-profiling/issues/200 """ + import pandas as pd import pandas_profiling diff --git a/tests/issues/test_issue215.py b/tests/issues/test_issue215.py index 5104bff9b..6117d9ebf 100644 --- a/tests/issues/test_issue215.py +++ b/tests/issues/test_issue215.py @@ -2,6 +2,7 @@ Test for issue 215: https://github.com/pandas-profiling/pandas-profiling/issues/215 """ + import pytest from pandas_profiling.report.formatters import fmt_percent diff --git a/tests/issues/test_issue243.py b/tests/issues/test_issue243.py index 27e6ed26e..dc038a563 100644 --- a/tests/issues/test_issue243.py +++ b/tests/issues/test_issue243.py @@ -2,6 +2,7 @@ Test for issue 243: https://github.com/pandas-profiling/pandas-profiling/issues/243 """ + import pandas as pd import pandas_profiling diff --git a/tests/issues/test_issue249.py b/tests/issues/test_issue249.py index 259a5fa6b..95b9261b5 100644 --- a/tests/issues/test_issue249.py +++ b/tests/issues/test_issue249.py @@ -2,6 +2,7 @@ Test for issue 249: https://github.com/pandas-profiling/pandas-profiling/issues/249 """ + import pandas as pd import pandas_profiling diff --git a/tests/issues/test_issue282.py b/tests/issues/test_issue282.py index 5563b1f07..2c48f41f0 100644 --- a/tests/issues/test_issue282.py +++ b/tests/issues/test_issue282.py @@ -2,6 +2,7 @@ Test for issue 282: https://github.com/pandas-profiling/pandas-profiling/issues/282 """ + import pandas as pd from pandas_profiling import ProfileReport diff --git a/tests/issues/test_issue353.py b/tests/issues/test_issue353.py index b323c6262..72141aaeb 100644 --- a/tests/issues/test_issue353.py +++ b/tests/issues/test_issue353.py @@ -2,6 +2,7 @@ Test for issue 353: https://github.com/pandas-profiling/pandas-profiling/issues/353 """ + import numpy as np import pandas as pd diff --git a/tests/issues/test_issue377.py b/tests/issues/test_issue377.py index 2ffa39a92..cad213cda 100644 --- a/tests/issues/test_issue377.py +++ b/tests/issues/test_issue377.py @@ -2,6 +2,7 @@ Test for issue 377: https://github.com/pandas-profiling/pandas-profiling/issues/377 """ + import sys import pandas as pd diff --git a/tests/issues/test_issue388.py b/tests/issues/test_issue388.py index 9612b3fcc..79b40b273 100644 --- a/tests/issues/test_issue388.py +++ b/tests/issues/test_issue388.py @@ -2,6 +2,7 @@ Test for issue 388: https://github.com/pandas-profiling/pandas-profiling/issues/388 """ + import pytest from pandas_profiling.controller import console diff --git a/tests/issues/test_issue397.py b/tests/issues/test_issue397.py index 6af98988b..886281801 100644 --- a/tests/issues/test_issue397.py +++ b/tests/issues/test_issue397.py @@ -2,6 +2,7 @@ Test for issue 397 (actually a PR, but ok): https://github.com/pandas-profiling/pandas-profiling/pull/397 """ + import numpy as np import pandas as pd diff --git a/tests/issues/test_issue416.py b/tests/issues/test_issue416.py index 52abcaf47..a4ce0a39f 100644 --- a/tests/issues/test_issue416.py +++ b/tests/issues/test_issue416.py @@ -2,6 +2,7 @@ Test for issue 416: https://github.com/pandas-profiling/pandas-profiling/issues/416 """ + import pandas as pd import pandas_profiling diff --git a/tests/issues/test_issue437.py b/tests/issues/test_issue437.py index dc2c0728c..e427cdb9c 100644 --- a/tests/issues/test_issue437.py +++ b/tests/issues/test_issue437.py @@ -2,6 +2,7 @@ Test for issue 437: https://github.com/pandas-profiling/pandas-profiling/issues/437 """ + import numpy as np import pandas as pd diff --git a/tests/issues/test_issue502.py b/tests/issues/test_issue502.py index 54a4ed208..f5e81c30c 100644 --- a/tests/issues/test_issue502.py +++ b/tests/issues/test_issue502.py @@ -2,6 +2,7 @@ Test for issue 502: https://github.com/pandas-profiling/pandas-profiling/issues/502 """ + import pandas as pd from pandas_profiling.model.summary import describe_1d diff --git a/tests/issues/test_issue51.py b/tests/issues/test_issue51.py index 50617ca81..e8f8ddf52 100644 --- a/tests/issues/test_issue51.py +++ b/tests/issues/test_issue51.py @@ -2,6 +2,7 @@ Test for issue 51: https://github.com/pandas-profiling/pandas-profiling/issues/51 """ + import numpy as np import pandas as pd diff --git a/tests/issues/test_issue523.py b/tests/issues/test_issue523.py index d111b7ac2..321eb7cd1 100644 --- a/tests/issues/test_issue523.py +++ b/tests/issues/test_issue523.py @@ -2,6 +2,7 @@ Test for issue 523: https://github.com/pandas-profiling/pandas-profiling/issues/XXX """ + import pandas as pd import pytest diff --git a/tests/issues/test_issue613.py b/tests/issues/test_issue613.py index f964d36ae..eebd306b2 100644 --- a/tests/issues/test_issue613.py +++ b/tests/issues/test_issue613.py @@ -2,6 +2,7 @@ Test for issue 613: https://github.com/pandas-profiling/pandas-profiling/issues/613 """ + import numpy as np import pandas as pd diff --git a/tests/issues/test_issue664.py b/tests/issues/test_issue664.py index d5d5a38a4..3464e406b 100644 --- a/tests/issues/test_issue664.py +++ b/tests/issues/test_issue664.py @@ -2,6 +2,7 @@ Test for issue 664: https://github.com/pandas-profiling/pandas-profiling/issues/664 """ + import numpy as np import pandas as pd diff --git a/tests/issues/test_issue671.py b/tests/issues/test_issue671.py index d356afb27..076dc002f 100644 --- a/tests/issues/test_issue671.py +++ b/tests/issues/test_issue671.py @@ -2,6 +2,7 @@ Test for issue 671: https://github.com/pandas-profiling/pandas-profiling/issues/671 """ + import numpy as np import pandas as pd diff --git a/tests/issues/test_issue72.py b/tests/issues/test_issue72.py index 27a96c6c2..515053be9 100644 --- a/tests/issues/test_issue72.py +++ b/tests/issues/test_issue72.py @@ -2,6 +2,7 @@ Test for issue 72: https://github.com/pandas-profiling/pandas-profiling/issues/72 """ + import numpy as np import pandas as pd diff --git a/tests/issues/test_issue94.py b/tests/issues/test_issue94.py index a0ab39c9e..c40d55610 100644 --- a/tests/issues/test_issue94.py +++ b/tests/issues/test_issue94.py @@ -5,6 +5,7 @@ Test based on: https://stackoverflow.com/questions/52926527/pandas-profiling-1-4-1-throws-zerodivisionerror-for-valid-data-set-which-pandas """ + from pathlib import Path import pandas as pd diff --git a/tests/issues/test_issueXXX.py b/tests/issues/test_issueXXX.py index edeed012f..fe626bfda 100644 --- a/tests/issues/test_issueXXX.py +++ b/tests/issues/test_issueXXX.py @@ -2,6 +2,7 @@ Test for issue XXX: https://github.com/pandas-profiling/pandas-profiling/issues/XXX """ + import pandas as pd import pandas_profiling diff --git a/tests/unit/test_formatters.py b/tests/unit/test_formatters.py index 09711cd47..40d442b01 100644 --- a/tests/unit/test_formatters.py +++ b/tests/unit/test_formatters.py @@ -39,9 +39,9 @@ def test_fmt_class(text, cls, expected): (100, "Bytes", "100.0 Bytes"), (1024, None, "1.0 KiB"), (1024.0, None, "1.0 KiB"), - (1024 ** 4, "Bytes", "1.0 TiBytes"), - (1024 ** 3 * 7.5, None, "7.5 GiB"), - (1024 ** 8, None, "1.0 YiB"), + (1024**4, "Bytes", "1.0 TiBytes"), + (1024**3 * 7.5, None, "7.5 GiB"), + (1024**8, None, "1.0 YiB"), ], ) def test_fmt_bytesize(num, fmt, expected):