Skip to content

Commit

Permalink
Merge pull request #273 from Carreau/misc
Browse files Browse the repository at this point in the history
some fixes for Latest IPython and numpy
  • Loading branch information
Carreau authored Sep 7, 2023
2 parents 4819493 + 3bbb68b commit 5e1e671
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 44 deletions.
21 changes: 4 additions & 17 deletions examples/IPython.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,18 @@ exec_failure = "fallback"
docs_path = "~/dev/IPython/docs/source"
exec = true
execute_exclude_patterns = [
'IPython.lib.display.Audio',
'IPython.core.display_functions.display'
'IPython.lib.display:Audio',
'IPython.core.display_functions:display'
]
exclude = []
[global.expected_errors]
IncorrectInternalDocsLen = [
"IPython.core.magics.basic:BasicMagics.alias_magic",
"IPython.core.magics.script:ScriptMagics.shebang",
"IPython.core.magics.basic:BasicMagics.notebook",
"IPython.core.magics.display:DisplayMagics.html",
"IPython.core.magics.execution:ExecutionMagics.debug",
"IPython.core.magics.execution:ExecutionMagics.capture",
"IPython.core.magics.history:HistoryMagics.history",
"IPython.core.magics.namespace:NamespaceMagics.xdel",
"IPython.core.magics.osm:OSMagics.writefile",
"IPython.core.magics.pylab:PylabMagics.matplotlib",
"IPython.core.magics.pylab:PylabMagics.pylab",
"IPython.terminal.embed:EmbeddedMagics.kill_embedded",
]

[global.implied_imports]
get_ipython = 'IPython:get_ipython'

ValueError = [
"IPython.core.magics.osm:OSMagics.env",
"IPython.core.magics.osm:OSMagics.set_env",
]

[meta]
github_slug = 'IPython/IPython'
Expand Down
26 changes: 7 additions & 19 deletions examples/numpy.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
[global]
module = 'numpy'
exclude = ['numpy.distutils.misc_util:Configuration.__init__','numpy:tensordot']

execute_exclude_patterns = ['numpy._','numpy.testing._priv', 'numpy.errstate', 'numpy.seterr', 'numpy.bincount',
'numpy.core._multiarray_umath.bincount', 'numpy.core._multiarray_umath.datetime_as_string',
'numpy.core._multiarray_umath.normalize_axis_index', 'numpy.core._multiarray_umath.shares_memory',
'numpy.datetime_as_string', 'numpy.shares_memory', 'numpy.squeeze',
'numpy.average',
'numpy.ctypeslib', 'numpy.append', 'numpy.ma.core',
'numpy.core.umath_tests',

# try to create a pager that waits for input
'numpy.lookfor',
Expand All @@ -16,6 +19,8 @@ execute_exclude_patterns = ['numpy._','numpy.testing._priv', 'numpy.errstate', '
'numpy.char.multiply',
'numpy.polynomial.chebyshev.chebinterpolate',
'numpy.lib.npyio._read',
'numpy.polynomial._polybase:ABCPolyBase',
'numpy.distutils.misc_util:Configuration.__init__'
]

submodules = [
Expand Down Expand Up @@ -45,7 +50,8 @@ exec = true
narrative_exclude = [
'doc/source/reference/arrays.ndarray.rst',
'doc/source/user/how-to-how-to.rst',
'doc/source/f2py/usage.rst'
'doc/source/f2py/usage.rst',
'doc/source/_templates/',
]
exec_failure = 'fallback'
source = 'https://github.com/numpy/numpy'
Expand All @@ -63,25 +69,7 @@ docspage = 'https://numpy.org/doc/1.22/'


[global.expected_errors]
ValueError = [
"numpy.core.shape_base._concatenate_shapes",
"numpy.rollaxis",
]
NumpydocParseError = [
"numpy._from_dlpack",
"numpy.typing._nested_sequence._NestedSequence",
"numpy.polynomial._polybase.ABCPolyBase",
]
VisitCitationReferenceNotImplementedError = [
"numpy.fft",
]
VisitSubstitutionDefinitionNotImplementedError = [
]
IncorrectInternalDocsLen = [
"numpy.tensordot",
"numpy.lib._datasource.DataSource._splitzipext",
"numpy.core._internal._view_is_safe",
"numpy.distutils.misc_util.Configuration.__init__",]
AssertionError = [
]

4 changes: 1 addition & 3 deletions papyri/crosslink.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,9 +431,7 @@ def relink(self) -> None:

rev_aliases = {Cannonical(v): FullQual(k) for k, v in aliases.items()}

print(
"Relinking is safe to cancel, but some back references may be broken...."
)
print("Relinking is safe to cancel, but some back references may be broken....")
print("Press Ctrl-C to abort...")

for _, key in self.progress(
Expand Down
6 changes: 4 additions & 2 deletions papyri/gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from typing import Any, Dict, FrozenSet, List, MutableMapping, Optional, Sequence, Tuple

import jedi

try:
import tomllib
except ModuleNotFoundError:
Expand Down Expand Up @@ -1311,7 +1312,7 @@ def collect_narrative_docs(self):
p2.update(task, description=compress_user(str(p)).ljust(7))
p2.advance(task)

if any([str(p).endswith(k) for k in self.config.narrative_exclude]):
if any([k in str(p) for k in self.config.narrative_exclude]):
print_(f"Skipping {p} – excluded in config file")
continue

Expand Down Expand Up @@ -2090,7 +2091,8 @@ def collect_api_docs(self, root: str, limit_to: List[str]):
self.put_raw(name, data)
if error_collector._errors:
self.log.info(
"ERRORS:" + tomli_w.dumps(error_collector._errors).replace(",", ", \n")
"ERRORS:"
+ tomli_w.dumps(error_collector._errors).replace(",", ", \n")
)
if error_collector._expected_unseen:
self.log.info(
Expand Down
2 changes: 2 additions & 0 deletions papyri/take2.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ class Param(Node):
MList,
MParagraph,
MCode,
SubstitutionDef,
]
]

Expand Down Expand Up @@ -498,6 +499,7 @@ class DefListItem(Node):
Unimplemented,
MAdmonition,
MMath,
FieldList,
Optional[TocTree], # remove this, that should not be the case ?
]
]
Expand Down
4 changes: 2 additions & 2 deletions papyri/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -806,13 +806,13 @@ def _import_max(parts):
p = parts[0]
try:
__import__(p)
except ImportError:
except (ImportError, RuntimeError):
return
for k in parts[1:]:
p = p + "." + k
try:
__import__(p)
except ImportError:
except (ImportError, RuntimeError):
return
except Exception as e:
raise type(e)(parts)
Expand Down
2 changes: 1 addition & 1 deletion papyri/ts.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ def visit_section(self, node, prev_end=None):
# blah blah reference and new line with parenthesis
# (like a year here)
# ```
assert len(set_post_a) == 1
assert len(set_post_a) == 1, breakpoint()
post_a = next(iter(set_post_a))

assert len(post_text) >= len(self.as_text(tc)), self.as_text(tc)
Expand Down

0 comments on commit 5e1e671

Please sign in to comment.