From b7986bab022b29747c73f51b36ea98532545356d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 1 Jul 2024 17:33:10 +0000 Subject: [PATCH 1/4] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/mirrors-prettier: ffb6a759a979008c0e6dff86e39f4745a2d9eac4 → f12edd9c7be1c20cfa42420fd0e6df71e42b51ea](https://github.com/pre-commit/mirrors-prettier/compare/ffb6a759a979008c0e6dff86e39f4745a2d9eac4...f12edd9c7be1c20cfa42420fd0e6df71e42b51ea) - [github.com/astral-sh/ruff-pre-commit: f8a3f8c471fb698229face5ed7640a64900b781e → 1dc9eb131c2ea4816c708e4d85820d2cc8542683](https://github.com/astral-sh/ruff-pre-commit/compare/f8a3f8c471fb698229face5ed7640a64900b781e...1dc9eb131c2ea4816c708e4d85820d2cc8542683) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cd7c3531..93d62216 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,14 +18,14 @@ repos: - id: trailing-whitespace - repo: https://github.com/pre-commit/mirrors-prettier - rev: ffb6a759a979008c0e6dff86e39f4745a2d9eac4 # frozen: v3.1.0 + rev: f12edd9c7be1c20cfa42420fd0e6df71e42b51ea # frozen: v4.0.0-alpha.8 hooks: - id: prettier types_or: [yaml, toml, markdown, css, scss, javascript, json] args: [--prose-wrap=preserve] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "f8a3f8c471fb698229face5ed7640a64900b781e" # frozen: v0.4.4 + rev: "1dc9eb131c2ea4816c708e4d85820d2cc8542683" # frozen: v0.5.0 hooks: - id: ruff args: ["--fix", "--show-fixes", "--exit-non-zero-on-fix"] From 1c66689c1a824316e4228df2496543ba98b5c43c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 1 Jul 2024 17:33:24 +0000 Subject: [PATCH 2/4] =?UTF-8?q?'[pre-commit.ci=20=F0=9F=A4=96]=20Apply=20c?= =?UTF-8?q?ode=20format=20tools=20to=20PR'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .pre-commit-config.yaml | 4 ++-- numpydoc/docscrape_sphinx.py | 2 +- numpydoc/numpydoc.py | 6 ++++-- numpydoc/validate.py | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 93d62216..41a80e7d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,14 +18,14 @@ repos: - id: trailing-whitespace - repo: https://github.com/pre-commit/mirrors-prettier - rev: f12edd9c7be1c20cfa42420fd0e6df71e42b51ea # frozen: v4.0.0-alpha.8 + rev: f12edd9c7be1c20cfa42420fd0e6df71e42b51ea # frozen: v4.0.0-alpha.8 hooks: - id: prettier types_or: [yaml, toml, markdown, css, scss, javascript, json] args: [--prose-wrap=preserve] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "1dc9eb131c2ea4816c708e4d85820d2cc8542683" # frozen: v0.5.0 + rev: "1dc9eb131c2ea4816c708e4d85820d2cc8542683" # frozen: v0.5.0 hooks: - id: ruff args: ["--fix", "--show-fixes", "--exit-non-zero-on-fix"] diff --git a/numpydoc/docscrape_sphinx.py b/numpydoc/docscrape_sphinx.py index 64588f55..ed389fb4 100644 --- a/numpydoc/docscrape_sphinx.py +++ b/numpydoc/docscrape_sphinx.py @@ -329,7 +329,7 @@ def _str_references(self): out += [".. only:: latex", ""] items = [] for line in self["References"]: - m = re.match(r".. \[([a-z0-9._-]+)\]", line, re.I) + m = re.match(r".. \[([a-z0-9._-]+)\]", line, re.IGNORECASE) if m: items.append(m.group(1)) out += [" " + ", ".join([f"[{item}]_" for item in items]), ""] diff --git a/numpydoc/numpydoc.py b/numpydoc/numpydoc.py index 2a8e1066..a04443b3 100644 --- a/numpydoc/numpydoc.py +++ b/numpydoc/numpydoc.py @@ -58,7 +58,9 @@ def rename_references(app, what, name, obj, options, lines): references = set() for line in lines: line = line.strip() - m = re.match(r"^\.\. +\[(%s)\]" % app.config.numpydoc_citation_re, line, re.I) + m = re.match( + r"^\.\. +\[(%s)\]" % app.config.numpydoc_citation_re, line, re.IGNORECASE + ) if m: references.add(m.group(1)) @@ -185,7 +187,7 @@ def mangle_docstrings(app, what, name, obj, options, lines): if what == "module": # Strip top title pattern = "^\\s*[#*=]{4,}\\n[a-z0-9 -]+\\n[#*=]{4,}\\s*" - title_re = re.compile(pattern, re.I | re.S) + title_re = re.compile(pattern, re.IGNORECASE | re.DOTALL) lines[:] = title_re.sub("", u_NL.join(lines)).split(u_NL) else: try: diff --git a/numpydoc/validate.py b/numpydoc/validate.py index c0409c71..138e9d48 100644 --- a/numpydoc/validate.py +++ b/numpydoc/validate.py @@ -23,7 +23,7 @@ DIRECTIVES = ["versionadded", "versionchanged", "deprecated"] DIRECTIVE_PATTERN = re.compile( - r"^\s*\.\. ({})(?!::)".format("|".join(DIRECTIVES)), re.I | re.M + r"^\s*\.\. ({})(?!::)".format("|".join(DIRECTIVES)), re.IGNORECASE | re.MULTILINE ) ALLOWED_SECTIONS = [ "Parameters", From 1ca0c4e74155f6b8e98885177cfe6bf4e99e72d6 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Mon, 1 Jul 2024 13:46:16 -0400 Subject: [PATCH 3/4] FIX: Fixes --- numpydoc/docscrape.py | 17 ++++++++--------- numpydoc/hooks/utils.py | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/numpydoc/docscrape.py b/numpydoc/docscrape.py index a241dc21..f3b4a0ce 100644 --- a/numpydoc/docscrape.py +++ b/numpydoc/docscrape.py @@ -711,23 +711,22 @@ def properties(self): @staticmethod def _should_skip_member(name, klass): - if ( + return ( # Namedtuples should skip everything in their ._fields as the # docstrings for each of the members is: "Alias for field number X" issubclass(klass, tuple) and hasattr(klass, "_asdict") and hasattr(klass, "_fields") and name in klass._fields - ): - return True - return False + ) def _is_show_member(self, name): - if self.show_inherited_members: - return True # show all class members - if name not in self._cls.__dict__: - return False # class member is inherited, we do not show it - return True + return ( + # show all class members + self.show_inherited_members + # or class member is not inherited + or name in self._cls.__dict__ + ) def get_doc_object( diff --git a/numpydoc/hooks/utils.py b/numpydoc/hooks/utils.py index 448e1245..6f40c69c 100644 --- a/numpydoc/hooks/utils.py +++ b/numpydoc/hooks/utils.py @@ -31,7 +31,7 @@ def find_project_root(srcs: Sequence[str]): `Black `_. """ if not srcs: - return Path().resolve(), "current directory" + return Path.cwd(), "current directory" common_path = Path( os.path.commonpath([Path(src).expanduser().resolve() for src in srcs]) From 1246ddf52ca375f794fde1c4bd38bc927b36eb11 Mon Sep 17 00:00:00 2001 From: Jarrod Millman Date: Wed, 3 Jul 2024 10:38:58 -0700 Subject: [PATCH 4/4] Update .pre-commit-config.yaml --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 41a80e7d..425c165f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,7 +18,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/pre-commit/mirrors-prettier - rev: f12edd9c7be1c20cfa42420fd0e6df71e42b51ea # frozen: v4.0.0-alpha.8 + rev: ffb6a759a979008c0e6dff86e39f4745a2d9eac4 # frozen: v3.1.0 hooks: - id: prettier types_or: [yaml, toml, markdown, css, scss, javascript, json]