Skip to content

Commit 649c2f4

Browse files
[pre-commit.ci] pre-commit autoupdate (#666)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/psf/black: 23.3.0 → 23.7.0](psf/black@23.3.0...23.7.0) - [github.com/codespell-project/codespell: v2.2.4 → v2.2.5](codespell-project/codespell@v2.2.4...v2.2.5) - [github.com/PyCQA/flake8: 6.0.0 → 6.1.0](PyCQA/flake8@6.0.0...6.1.0) * DOC: Sync sphinxext with upstream --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Ghislain Vaillant <[email protected]>
1 parent 6062274 commit 649c2f4

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ repos:
99
- id: check-yaml
1010
- id: check-added-large-files
1111
- repo: https://github.com/psf/black
12-
rev: 23.3.0
12+
rev: 23.7.0
1313
hooks:
1414
- id: black
1515
- repo: https://github.com/codespell-project/codespell
16-
rev: v2.2.4
16+
rev: v2.2.5
1717
hooks:
1818
- id: codespell
1919
additional_dependencies:
2020
- tomli
2121
- repo: https://github.com/PyCQA/flake8
22-
rev: 6.0.0
22+
rev: 6.1.0
2323
hooks:
2424
- id: flake8

docs/sphinxext/github_link.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
This script comes from scikit-learn:
33
https://github.com/scikit-learn/scikit-learn/blob/master/doc/sphinxext/github_link.py
44
"""
5-
from operator import attrgetter
65
import inspect
7-
import subprocess
86
import os
7+
import subprocess
98
import sys
109
from functools import partial
10+
from operator import attrgetter
1111

1212
REVISION_CMD = "git rev-parse --short HEAD"
1313

@@ -44,14 +44,12 @@ def _linkcode_resolve(domain, info, package, url_fmt, revision):
4444
return
4545

4646
class_name = info["fullname"].split(".")[0]
47-
if type(class_name) != str:
48-
# Python 2 only
49-
class_name = class_name.encode("utf-8")
5047
module = __import__(info["module"], fromlist=[class_name])
51-
try:
52-
obj = attrgetter(info["fullname"])(module)
53-
except AttributeError:
54-
return
48+
obj = attrgetter(info["fullname"])(module)
49+
50+
# Unwrap the object to get the correct source
51+
# file in case that is wrapped by a decorator
52+
obj = inspect.unwrap(obj)
5553

5654
try:
5755
fn = inspect.getsourcefile(obj)

0 commit comments

Comments
 (0)