summaryrefslogtreecommitdiff
path: root/numpydoc/docscrape.py
Commit message (Collapse)AuthorAgeFilesLines
* MAINT: Refactoring `get_doc_object` (#452)HEADmainyuki2023-03-141-4/+12
|
* Update pre-commit (#449)Jarrod Millman2023-02-011-2/+1
| | | | | * Update pre-commit * Run pre-commit on all files
* Add cached property support (#433)Ross Barnowski2022-09-281-1/+8
| | | | | | | | | | | * TST: Add test case for cached_property. * BUG: Fix detection of cached_property attrs. Co-authored-by: Tirth Patel <tirthasheshpatel@gmail.com> * Wrap cached_property import in try/except for Python 3.7. Co-authored-by: Tirth Patel <tirthasheshpatel@gmail.com>
* BUG: Fix returns parsing no name (#429)Ross Barnowski2022-09-161-3/+7
| | | | | | | | | * TST: Add test case. * MAINT: Adjust logic for parameter lines with : char. Adjust logic in parameter line splitting to avoid bug where Returns objects containing sphinx roles are improperly parsed.
* Run black formatterJarrod Millman2022-05-071-169/+196
|
* Add pre-commit hook / linter (#374)Jarrod Millman2022-04-051-1/+1
| | | | | | | * Add pre-commit hook / linter * Run linter * Fix GH workflow
* Fix AttributeError in underline length check (#363)Ross Barnowski2022-01-261-1/+7
| | | | | | | | | | | | | | | | | * Add test for bad behavior. Fix test. * Add test for bad behavior. * Improve object name introspection Co-authored-by: Eric Larson <larson.eric.d@gmail.com> * Improve test specificity for name introspection Co-authored-by: Eric Larson <larson.eric.d@gmail.com> Co-authored-by: Eric Larson <larson.eric.d@gmail.com>
* Use fstrings (#353)Jarrod Millman2022-01-101-11/+10
| | | Convert string formatting to f-strings with flynt
* Escape newline in docstring. (#345)Matthias Bussonnier2021-12-271-1/+1
| | | Otherwise `'.` is seen as the second parameter.
* Avoid mutable default arguments (#342)Dimitri Papadopoulos Orfanos2021-12-161-5/+13
| | | | | | | While they are not always an actual bug, they are certainly a Python anti-pattern and possible the source of future bugs. In at least one case, the default mutable argument `config` is actually modified later on by the function.
* MAINT: Python3 classes do not need to inherit from object (#325)Mike Taves2021-05-191-1/+1
|
* MAINT: use super() as described by PEP 3135 (#315)Mike Taves2021-03-221-1/+1
|
* ENH: Enable validation during sphinx-build process (#302)Ross Barnowski2021-02-081-1/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * WIP: Move get_doc_obj to docscrape * WIP: mv _obj property to NumpyDocString * Proof-of-concept: Docstring attrs covered by refactor. Running the test suite on this patch demonstrates that refactoring the boundary between NumpyDocString and SphinxDocString provides the necessary info to (potentially) do away with the validate.Docstring class. * NOTE TO SELF: get_doc_object in docscrape_sphinx * Docstring -> Validator. * Activate validation during sphinx-build. Add a conf option to turn on/off. TODO: test * Replace logger.warn with warning. logger.warn is apparently deprecated * DOC: Add numpydoc_validate to conf docs. * Add mechanism for validation check selection. Adds a config option with a set to allow users to select which validation checks are used. Default is an empty set, which means none of the validation checks raise warnings during the build process. Add documentation for new option and activate in the doc build. * TST: modify how MockApp sets builder app. * TST: Add test of validation warnings. * Specify some sensible validation defaults. * Add docstring name to validation warnings. * Add all keyword to validation_check configuration. More flexibility in configuring which validation checks to run during sphinx build. If 'all' is present, treat the rest of the set as a blocklist, else an allowlist. * Fix failing test. * Make validation error mapping easier to read. * Add check for invalid error codes in configuration. plus test. * Add feature to exclude patterns from docstring validation. Modify updated config name to avoid sphinx warning. Add documentation for exclusion config value. * Be explicit about regex syntax for exclude config val Co-authored-by: Eric Larson <larson.eric.d@gmail.com> * Rm redundant numpydoc_validate config param. Co-authored-by: Eric Larson <larson.eric.d@gmail.com>
* BUG: fix an incomplete check in `Reader._error_location`Ralf Gommers2021-01-011-1/+1
| | | | | | | It's unclear why `self._obj` can be None, but that's what I'm seeing when trying numpydoc master to build SciPy master. This fix gives the right traceback.
* Improve error messages for see also parsing (#306)Ross Barnowski2020-12-091-4/+4
| | | | | | | | | * More informative error message for see also parse error. * Improve _error_location method output. * TST: Update test suite. * CI: Update sphinx==1.6.5 job from Python 3.5 to 3.6
* MAINT: minor refactoring in docscrape (#297)Ross Barnowski2020-08-191-24/+5
| | | | | | | * MAINT: rm unnecessary elses in _str methods * rm unused indent method from NDS * rm unused header method from NDS
* Fix param parsing. (#286)Matthias Bussonnier2020-08-101-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix param parsing. Closes #285 This fixes two tings: - When first sentence of the docstring is onteh first line, Parameters is not properly parse, which for example mis parsed numpy.array docstring. - many project have paremeters description list with ` :` afer the name, even if no type is present. If there is no space after the `:` the parameter name includes the ` :` which is most likely wrong. * test fixture * make doc a fixture * Update numpydoc/tests/test_docscrape.py Co-authored-by: Eric Larson <larson.eric.d@gmail.com> * Update numpydoc/tests/test_docscrape.py Co-authored-by: Eric Larson <larson.eric.d@gmail.com> Co-authored-by: Eric Larson <larson.eric.d@gmail.com>
* BUG: Properly parse See Also when summary on first line. (#283)Matthias Bussonnier2020-07-161-0/+2
| | | | | | | | | | | | | | | | in a case like: """signature See Also -------- a,b,c,d """" Numpydoc would incorrectly assign `a, b, c, d` as a description with no name, or type associated items. Closes #281
* fix spliting of parameter lines. (#279)Matthias Bussonnier2020-07-141-1/+1
| | | | if ' : ' is present twice in the line this drops any test after the second ' : ', which happens in some docstring that have the `default : stuff` idiom
* ENH: Better warning for sections. (#278)Matthias Bussonnier2020-07-141-2/+6
| | | | | | | | | | | * ENH: Better warning for sections. 1) if the number of -/= is too short/ too long warn, Especially too short it won't be detected as a section. 2) for duplicate section print the docstring to figure out where the problem is. * add warn test
* BUG: fix role regex.Matthias Bussonnier2020-07-131-1/+1
| | | | | Spyder sometime uses the full :py:meth: role, this make sure it is properly handled.
* BUG: Defer to autodoc for signatures (#221)Peter Quackenbush2020-06-271-17/+0
|
* MAINT: clean-up unused objects (#254)Mike Taves2020-04-121-1/+0
| | | | | | * F401: Add pytest.main() or clean-up unused import * F811: remove second identical 'test_returnyield' function * F821: 'tags' is a special object from sphinx-build; mark with noqa * F841: clean-up unused local variables
* Disable escaping "*" on signature (#256)Takeshi KOMIYA2020-04-121-2/+2
| | | | | | | | | | | On handling autodoc-process-signature event, it's not needed to escape "*" characters. The escaping is mainly allowed for highlighting feature of editors. So it's not necessary for generating contents by autodoc. In addition, since Sphinx-3.0, the escaping is not recommended by default (see strip_signature_backslash) refs: https://github.com/sphinx-doc/sphinx/issues/7439
* Delay import of Sphinx (#248)Christoph Gohlke2019-12-041-1/+5
| | | | | | | | * Delay import of Sphinx * ENH: do not import Sphinx unless it has already been imported * Delay import of Sphinx
* Drop Python 2.7 and 3.4 supportRoman Yurchak2019-10-231-6/+1
|
* ENH: Allow a trailing COMMA or PERIOD in a See Also function list block.Paul van Mulbregt2019-04-151-6/+6
| | | | | | Only trigger the trailing comma warning if there is also a description on the same line. Added a test that the warning is generated.
* FIX parsing of type-only return paramsTim Hoffmann2019-04-101-9/+16
|
* ENH: Added support for multiple functions+description in a See Also block (#172)Paul van Mulbregt2019-04-101-51/+86
|
* ENH: accept autoclass member options (#205)Matti Picus2019-04-091-2/+10
| | | | | | | | | | * ENH: accept autoclass member options * BUG: options can be None (from review) * MAINT: fixes from review Co-Authored-By: mattip <matti.picus@gmail.com>
* Support Receives section for generator.send(...) params (#145)Joel Nothman2019-04-091-3/+7
|
* ENH Only print the index if it is necessary. (#187)Mark Harfouche2019-04-021-2/+10
|
* FIX: Escape chars in re (#194)Eric Larson2019-01-141-4/+5
|
* MNT Fix collections.abc imports (#195)Eric Larson2019-01-141-4/+8
|
* Make parameter a namedtuple (#176)Tim Hoffmann2018-05-041-8/+12
|
* Use isdatadescriptor instead of isgetsetdescriptorJoris Van den Bossche2018-03-281-1/+1
|
* Merge branch 'master' into deflistJoel Nothman2017-11-021-1/+2
|\
| * Merge pull request #111 from jnothman/tildePauli Virtanen2017-11-011-1/+2
| |\ | | | | | | Allow see also object ref to incorporate ~ prefix
| | * Allow see also object ref to incorporate ~ prefixJoel Nothman2017-09-101-1/+2
| | | | | | | | | | | | Fixes #3
* | | Leading and trailing blank lines in parameter description should not affect ↵Joel Nothman2017-10-241-0/+10
| | | | | | | | | | | | output
* | | Stricter comparison of whitespace in testingJoel Nothman2017-10-241-1/+2
|/ /
* | Basic docs based on Numpy's HOW_TO_DOCUMENT.rst.txtJoel Nothman2017-10-231-0/+6
| |
* | refactor location code, add to warning about unknown sectionAndreas Mueller2017-07-191-14/+17
|/
* less hacky solution to duplicate section error message, added testsAndreas Mueller2017-06-181-3/+13
|
* BUG: Make docscrape ParseError Python 3 compatible.Eddie Hebert2017-04-041-1/+1
| | | | | | | | | | | | Fix `__str__` for `ParseError` in Python 3, which was resulting in error messages with `numpydoc.docscrape.ParseError: <unprintable ParseError object>` instead of the intended descriptive message. Use `args[0]` instead of `Exception`'s `message` member, which had been removed in Python 3. `args` is available to both Python 2 and 3. The `__str__` method had been failing on an `AttributeError` when using `self.message`, resulting in an unprintable Exception, which occluded the offending typo in a function name which triggered the`ParseError`.
* Merge pull request #53 from haobibo/masterStefan van der Walt2016-10-031-19/+22
|\ | | | | Allow extending NumpyDocString sections
| * change to deep copy for doc sections.Bibo Hao2016-04-071-1/+2
| |
| * allow extending NumpyDocString sectionsBibo Hao2016-04-061-19/+21
| | | | | | | | | | | | | | | | | | Current implementation of NumpyDocString define sections in `self._parsed_data` in `NumpyDocString.__init__()`, which is not convenient for developers to extend this class to add more sections. By setting section definitions as a class static variable, it will be more convenient for developers to extend more sections by changing the class static variable `sections`.
* | FIX Unknow sections should not raise an errorNelle Varoquaux2016-09-191-1/+1
| |
* | FIX raises an error if a section appears twiceNelle Varoquaux2016-09-131-0/+5
|/ | | | closes #64