| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2f4e69a commit 72e1c4b
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,7 +26,8 @@ jobs: | |||
| 26 | 26 | run: | | |
| 27 | 27 | python -m pip install --upgrade pip | |
| 28 | 28 | pip install -r requirements.txt | |
| 29 | - pip install pytest pytest-cov urwid twisted watchdog "jedi >=0.16" babel "sphinx >=1.5" | ||
| 29 | + pip install urwid twisted watchdog "jedi >=0.16" babel "sphinx >=1.5" | ||
| 30 | + pip install pytest pytest-cov numpy | ||
| 30 | 31 | - name: Build with Python ${{ matrix.python-version }} | |
| 31 | 32 | run: | | |
| 32 | 33 | python setup.py build | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,6 +24,7 @@ | |||
| 24 | 24 | import inspect | |
| 25 | 25 | import keyword | |
| 26 | 26 | import pydoc | |
| 27 | + import re | ||
| 27 | 28 | from collections import namedtuple | |
| 28 | 29 | ||
| 29 | 30 | from pygments.token import Token | |
@@ -173,7 +174,9 @@ def fixlongargs(f, argspec): | |||
| 173 | 174 | argspec[3] = values | |
| 174 | 175 | ||
| 175 | 176 | ||
| 176 | - getpydocspec_re = LazyReCompile(r"([a-zA-Z_][a-zA-Z0-9_]*?)\((.*?)\)") | ||
| 177 | + getpydocspec_re = LazyReCompile( | ||
| 178 | + r"([a-zA-Z_][a-zA-Z0-9_]*?)\((.*?)\)", re.DOTALL | ||
| 179 | + ) | ||
| 177 | 180 | ||
| 178 | 181 | ||
| 179 | 182 | def getpydocspec(f, func): | |
@@ -189,10 +192,10 @@ def getpydocspec(f, func): | |||
| 189 | 192 | if not hasattr_safe(f, "__name__") or s.groups()[0] != f.__name__: | |
| 190 | 193 | return None | |
| 191 | 194 | ||
| 192 | - args = list() | ||
| 193 | - defaults = list() | ||
| 195 | + args = [] | ||
| 196 | + defaults = [] | ||
| 194 | 197 | varargs = varkwargs = None | |
| 195 | - kwonly_args = list() | ||
| 198 | + kwonly_args = [] | ||
| 196 | 199 | kwonly_defaults = dict() | |
| 197 | 200 | for arg in s.group(2).split(","): | |
| 198 | 201 | arg = arg.strip() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,6 +6,11 @@ | |||
| 6 | 6 | from bpython.test.fodder import encoding_latin1 | |
| 7 | 7 | from bpython.test.fodder import encoding_utf8 | |
| 8 | 8 | ||
| 9 | + try: | ||
| 10 | + import numpy | ||
| 11 | + except ImportError: | ||
| 12 | + numpy = None | ||
| 13 | + | ||
| 9 | 14 | ||
| 10 | 15 | foo_ascii_only = '''def foo(): | |
| 11 | 16 | """Test""" | |
@@ -113,6 +118,15 @@ def test_get_source_file(self): | |||
| 113 | 118 | ) | |
| 114 | 119 | self.assertEqual(encoding, "utf-8") | |
| 115 | 120 | ||
| 121 | + @unittest.skipUnless(numpy is not None, "requires numpy") | ||
| 122 | + def test_getfuncprops_numpy_array(self): | ||
| 123 | + props = inspection.getfuncprops("array", numpy.array) | ||
| 124 | + | ||
| 125 | + self.assertEqual(props.func, "array") | ||
| 126 | + # This check might need an update in the future, but at least numpy >= 1.18 has | ||
| 127 | + # np.array(object, dtype=None, *, ...). | ||
| 128 | + self.assertEqual(props.argspec.args, ["object", "dtype"]) | ||
| 129 | + | ||
| 116 | 130 | ||
| 117 | 131 | class A: | |
| 118 | 132 | a = "a" | |
| Back | FazBrowse Home | New Git URL |
0 commit comments