generated from jCloud/repository-template
Add feature to parse Python docstrings
This commit is contained in:
@@ -3,27 +3,33 @@ Third-Party Notices
|
||||
|
||||
This software uses the following third-party libraries. Full license texts are available in the 'licenses/' directory.
|
||||
|
||||
1. iniconfig 2.3.0
|
||||
1. docstring-parser 0.17.0
|
||||
Author: Marcin Kurczewski
|
||||
License: MIT License
|
||||
See licenses/docstring-parser.txt for full license text.
|
||||
|
||||
2. iniconfig 2.3.0
|
||||
Author: Holger Krekel and others
|
||||
License: MIT License
|
||||
See licenses/iniconfig.txt for full license text.
|
||||
|
||||
2. packaging 26.0
|
||||
3. packaging 26.0
|
||||
Author: Donald Stufft and individual contributors
|
||||
License: Apache License 2.0
|
||||
License: Apache License 2.0
|
||||
URL: None
|
||||
See licenses/packaging.txt for full license text.
|
||||
|
||||
3. pluggy 1.6.0
|
||||
Author: Holger rekel
|
||||
4. pluggy 1.6.0
|
||||
Author: Holger Krekel
|
||||
License: MIT License
|
||||
See licenses/pluggy.txt for full license text.
|
||||
|
||||
4. pygments 2.18.0
|
||||
5. pygments 2.18.0
|
||||
Author: Georg Brandl, Tim Hatch, Armin Ronacher, Others
|
||||
License: BSD-2-Clause
|
||||
See licenses/pygments.txt for full license text.
|
||||
|
||||
5. pytest 9.0.2
|
||||
Author: Holger Krekel, Bruno Oliveira, Ronny Pfannschmidt, Floris Bruynooghe, Brianna Laugher, Florian Bruhin, Others (See AUTHORS)
|
||||
6. pytest 9.0.2
|
||||
Author: Holger Krekel, Bruno Oliveira, Ronny Pfannschmidt, Floris Bruynooghe, Brianna Laugher, Florian Bruhin, Others
|
||||
License: MIT License
|
||||
See licenses/pytest.txt for full license text.
|
||||
+2
-1
@@ -20,4 +20,5 @@
|
||||
- Add classes for Python definitions
|
||||
- Add class for Python modules
|
||||
- Add feature to get the signature representation of a Python function argument
|
||||
- Add class for Python docstrings
|
||||
- Add class for Python docstrings
|
||||
- Add feature to parse Python docstrings
|
||||
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 Marcin Kurczewski
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
+1
-1
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
|
||||
name = "jcloud-docsgen"
|
||||
version = "0.1.0"
|
||||
description = "A project documentation generator"
|
||||
dependencies = []
|
||||
dependencies = ["docstring-parser"]
|
||||
license = "Apache-2.0"
|
||||
|
||||
[project.scripts]
|
||||
|
||||
@@ -12,10 +12,19 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from enum import Enum
|
||||
import docstring_parser
|
||||
|
||||
__all__ = [
|
||||
'PythonDocstringStyle',
|
||||
'PythonDocstring'
|
||||
]
|
||||
|
||||
class PythonDocstringStyle(Enum):
|
||||
SPHINX = 'sphinx'
|
||||
NUMPY = 'numpy'
|
||||
GOOGLE = 'google'
|
||||
|
||||
class PythonDocstring:
|
||||
'''
|
||||
Represents a Python docstring.
|
||||
@@ -33,4 +42,14 @@ class PythonDocstring:
|
||||
def __eq__(self, value) -> bool:
|
||||
if not isinstance(value, type(self)):
|
||||
return False
|
||||
return self.docstring == value.docstring
|
||||
return self.docstring == value.docstring
|
||||
|
||||
def parse(self) -> docstring_parser.Docstring:
|
||||
'''
|
||||
Parses the docstring.
|
||||
|
||||
:return: The parsed docstring.
|
||||
:rtype: docstring_parser.Docstring
|
||||
'''
|
||||
|
||||
return docstring_parser.parse(self.docstring)
|
||||
Reference in New Issue
Block a user