Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#570)
Browse files Browse the repository at this point in the history
  • Loading branch information
jarrodmillman authored Jul 3, 2024
2 parents 7bf3172 + 1246ddf commit 54dbc89
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ repos:
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"]
Expand Down
17 changes: 8 additions & 9 deletions numpydoc/docscrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion numpydoc/docscrape_sphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]), ""]
Expand Down
2 changes: 1 addition & 1 deletion numpydoc/hooks/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def find_project_root(srcs: Sequence[str]):
`Black <https://github.com/psf/black/blob/main/src/black/files.py>`_.
"""
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])
Expand Down
6 changes: 4 additions & 2 deletions numpydoc/numpydoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion numpydoc/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 54dbc89

Please sign in to comment.