From 71d94699620018ce7bdc4cdb0bfcbbe2aabd5461 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Thu, 17 Aug 2023 14:35:00 -0700 Subject: [PATCH 1/3] Enable FLY checks --- pandas/io/formats/html.py | 2 +- pandas/io/formats/string.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/io/formats/html.py b/pandas/io/formats/html.py index ce59985b8f352..b1a3504d46b27 100644 --- a/pandas/io/formats/html.py +++ b/pandas/io/formats/html.py @@ -633,7 +633,7 @@ def write_style(self) -> None: else: element_props.append(("thead th", "text-align", "right")) template_mid = "\n\n".join(template_select % t for t in element_props) - template = dedent("\n".join((template_first, template_mid, template_last))) + template = dedent(f"{template_first}\n{template_mid}\n{template_last}") self.write(template) def render(self) -> list[str]: diff --git a/pandas/io/formats/string.py b/pandas/io/formats/string.py index 769f9dee1c31a..cdad388592717 100644 --- a/pandas/io/formats/string.py +++ b/pandas/io/formats/string.py @@ -28,7 +28,7 @@ def __init__(self, fmt: DataFrameFormatter, line_width: int | None = None) -> No def to_string(self) -> str: text = self._get_string_representation() if self.fmt.should_show_dimensions: - text = "".join([text, self.fmt.dimensions_info]) + text = f"{text}{self.fmt.dimensions_info}" return text def _get_strcols(self) -> list[list[str]]: From 11b7baa1036cd25102e7c6eed0f725949207e09b Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Thu, 17 Aug 2023 14:35:09 -0700 Subject: [PATCH 2/3] Enable FLY checks --- pyproject.toml | 4 +++- scripts/tests/test_validate_docstrings.py | 4 ++-- scripts/validate_docstrings.py | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c28f9259c749c..e40d743e70dad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -252,6 +252,8 @@ select = [ "NPY002", # Perflint "PERF", + # flynt + "FLY", ] ignore = [ @@ -356,7 +358,7 @@ exclude = [ "asv_bench/*" = ["TID", "NPY002"] # to be enabled gradually "pandas/core/*" = ["PLR5501"] -"pandas/tests/*" = ["B028"] +"pandas/tests/*" = ["B028", "FLY"] "scripts/*" = ["B028"] # Keep this one enabled "pandas/_typing.py" = ["TCH"] diff --git a/scripts/tests/test_validate_docstrings.py b/scripts/tests/test_validate_docstrings.py index aab29fce89abe..ffe1e9acd1185 100644 --- a/scripts/tests/test_validate_docstrings.py +++ b/scripts/tests/test_validate_docstrings.py @@ -110,10 +110,10 @@ def _import_path(self, klass=None, func=None): base_path = "scripts.tests.test_validate_docstrings" if klass: - base_path = ".".join([base_path, klass]) + base_path = f"{base_path}.{klass}" if func: - base_path = ".".join([base_path, func]) + base_path = f"{base_path}.{func}" return base_path diff --git a/scripts/validate_docstrings.py b/scripts/validate_docstrings.py index b1b63b469ec3b..0a6a852bb0f85 100755 --- a/scripts/validate_docstrings.py +++ b/scripts/validate_docstrings.py @@ -143,7 +143,7 @@ def get_api_items(api_doc_fd): func = getattr(func, part) yield ( - ".".join([current_module, line_stripped]), + f"{current_module}.{line_stripped}", func, current_section, current_subsection, From 1ad3b8f0b6ed0289aa16aa91d595950bc98e9b71 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Thu, 17 Aug 2023 14:48:43 -0700 Subject: [PATCH 3/3] Add logging format --- pyproject.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index e40d743e70dad..0fc753debe030 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -229,7 +229,7 @@ select = [ # flake8-gettext "INT", # pylint - "PLC", "PLE", "PLR", "PLW", + "PL", # misc lints "PIE", # flake8-pyi @@ -254,6 +254,8 @@ select = [ "PERF", # flynt "FLY", + # flake8-logging-format + "G", ] ignore = [