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] =?UTF-8?q?'[pre-commit.ci=20=F0=9F=A4=96]=20Apply=20code?= =?UTF-8?q?=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",