google-docstring-parser 0.0.2__tar.gz → 0.0.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (18) hide show
  1. {google_docstring_parser-0.0.2 → google_docstring_parser-0.0.6}/PKG-INFO +49 -11
  2. {google_docstring_parser-0.0.2 → google_docstring_parser-0.0.6}/README.md +46 -9
  3. google_docstring_parser-0.0.6/google_docstring_parser/__init__.py +10 -0
  4. google_docstring_parser-0.0.6/google_docstring_parser/google_docstring_parser.py +516 -0
  5. google_docstring_parser-0.0.6/google_docstring_parser/type_validation.py +541 -0
  6. {google_docstring_parser-0.0.2 → google_docstring_parser-0.0.6}/google_docstring_parser.egg-info/PKG-INFO +49 -11
  7. {google_docstring_parser-0.0.2 → google_docstring_parser-0.0.6}/google_docstring_parser.egg-info/SOURCES.txt +1 -0
  8. {google_docstring_parser-0.0.2 → google_docstring_parser-0.0.6}/pyproject.toml +5 -1
  9. google_docstring_parser-0.0.6/tools/__init__.py +5 -0
  10. {google_docstring_parser-0.0.2 → google_docstring_parser-0.0.6}/tools/check_docstrings.py +336 -49
  11. google_docstring_parser-0.0.2/google_docstring_parser/__init__.py +0 -8
  12. google_docstring_parser-0.0.2/google_docstring_parser/google_docstring_parser.py +0 -135
  13. google_docstring_parser-0.0.2/tools/__init__.py +0 -1
  14. {google_docstring_parser-0.0.2 → google_docstring_parser-0.0.6}/LICENSE +0 -0
  15. {google_docstring_parser-0.0.2 → google_docstring_parser-0.0.6}/google_docstring_parser.egg-info/dependency_links.txt +0 -0
  16. {google_docstring_parser-0.0.2 → google_docstring_parser-0.0.6}/google_docstring_parser.egg-info/requires.txt +0 -0
  17. {google_docstring_parser-0.0.2 → google_docstring_parser-0.0.6}/google_docstring_parser.egg-info/top_level.txt +0 -0
  18. {google_docstring_parser-0.0.2 → google_docstring_parser-0.0.6}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: google-docstring-parser
3
- Version: 0.0.2
3
+ Version: 0.0.6
4
4
  Summary: A lightweight, efficient parser for Google-style Python docstrings that converts them into structured dictionaries.
5
5
  Author: Vladimir Iglovikov
6
6
  Maintainer: Vladimir Iglovikov
@@ -31,6 +31,7 @@ Requires-Dist: typing-extensions>=4.9; python_version < "3.10"
31
31
  Provides-Extra: dev
32
32
  Requires-Dist: pre-commit>=3.5; extra == "dev"
33
33
  Requires-Dist: pytest>=8.3.3; extra == "dev"
34
+ Dynamic: license-file
34
35
 
35
36
  # Google Docstring Parser
36
37
 
@@ -75,6 +76,12 @@ Args:
75
76
  Example:
76
77
  >>> import albumentations as A
77
78
  >>> transform = A.ElasticTransform(alpha=1, sigma=50, p=0.5)
79
+
80
+ References:
81
+ - Original paper: Simard, P. Y., et al. "Best practices for convolutional neural networks applied to visual document analysis." ICDAR 2003
82
+ - Implementation details: https://example.com/elastic-transform
83
+ Returns:
84
+ dict[str, Any]: Some info here
78
85
  '''
79
86
 
80
87
  parsed = parse_google_docstring(docstring)
@@ -97,7 +104,22 @@ Output:
97
104
  'description': 'Standard deviation of the Gaussian filter used to smooth the displacement\nfields. Higher values result in smoother, more global distortions. Default: 50.0'
98
105
  }
99
106
  ],
100
- 'Example': '>>> import albumentations as A\n>>> transform = A.ElasticTransform(alpha=1, sigma=50, p=0.5)'
107
+ 'Example': '>>> import albumentations as A\n>>> transform = A.ElasticTransform(alpha=1, sigma=50, p=0.5)',
108
+ 'References': [
109
+ {
110
+ 'description': 'Original paper',
111
+ 'source': 'Simard, P. Y., et al. "Best practices for convolutional neural networks applied to visual document analysis." ICDAR 2003'
112
+ },
113
+ {
114
+ 'description': 'Implementation details',
115
+ 'source': 'https://example.com/elastic-transform'
116
+ }
117
+ ],
118
+ 'Returns':
119
+ {
120
+ "type": "dict[str, Any]",
121
+ "description": "Some info here"
122
+ }
101
123
  }
102
124
  ```
103
125
 
@@ -107,7 +129,30 @@ Output:
107
129
  - Extracts parameter names, types, and descriptions
108
130
  - Preserves other sections like Examples, Notes, etc.
109
131
  - Handles multi-line descriptions and indentation properly
132
+ - Properly parses and validates References sections with special handling for URLs
133
+
134
+ ### References
110
135
 
136
+ The parser can handle reference sections in Google-style docstrings. References can be formatted in two ways:
137
+
138
+ 1. Single reference format:
139
+ ```python
140
+ """
141
+ Reference:
142
+ Paper title: https://example.com/paper
143
+ """
144
+ ```
145
+
146
+ 2. Multiple references format (requires leading dashes):
147
+ ```python
148
+ """
149
+ References:
150
+ - First paper: https://example.com/paper1
151
+ - Second paper: https://example.com/paper2
152
+ """
153
+ ```
154
+
155
+ Each reference is parsed into a dictionary with `description` and `source` keys. URLs in the source are properly handled, ensuring colons in URLs are not confused with the separator colon.
111
156
 
112
157
  ## Pre-commit Hook
113
158
 
@@ -135,14 +180,7 @@ Add a `[tool.docstring_checker]` section to your pyproject.toml:
135
180
  [tool.docstring_checker]
136
181
  paths = ["src", "tests"] # Directories or files to scan
137
182
  require_param_types = true # Require parameter types in docstrings
183
+ check_references = true # Check references for proper format
138
184
  exclude_files = ["conftest.py", "__init__.py"] # Files to exclude from checks
139
185
  verbose = false # Enable verbose output
140
186
  ```
141
-
142
- This approach has several advantages:
143
- - Keeps all your project configuration in one place
144
- - Follows modern Python tooling conventions
145
- - Makes it easier to maintain and update configuration
146
- - Provides better IDE support and documentation
147
-
148
- For more details, see the [tools README](tools/README.md).
@@ -41,6 +41,12 @@ Args:
41
41
  Example:
42
42
  >>> import albumentations as A
43
43
  >>> transform = A.ElasticTransform(alpha=1, sigma=50, p=0.5)
44
+
45
+ References:
46
+ - Original paper: Simard, P. Y., et al. "Best practices for convolutional neural networks applied to visual document analysis." ICDAR 2003
47
+ - Implementation details: https://example.com/elastic-transform
48
+ Returns:
49
+ dict[str, Any]: Some info here
44
50
  '''
45
51
 
46
52
  parsed = parse_google_docstring(docstring)
@@ -63,7 +69,22 @@ Output:
63
69
  'description': 'Standard deviation of the Gaussian filter used to smooth the displacement\nfields. Higher values result in smoother, more global distortions. Default: 50.0'
64
70
  }
65
71
  ],
66
- 'Example': '>>> import albumentations as A\n>>> transform = A.ElasticTransform(alpha=1, sigma=50, p=0.5)'
72
+ 'Example': '>>> import albumentations as A\n>>> transform = A.ElasticTransform(alpha=1, sigma=50, p=0.5)',
73
+ 'References': [
74
+ {
75
+ 'description': 'Original paper',
76
+ 'source': 'Simard, P. Y., et al. "Best practices for convolutional neural networks applied to visual document analysis." ICDAR 2003'
77
+ },
78
+ {
79
+ 'description': 'Implementation details',
80
+ 'source': 'https://example.com/elastic-transform'
81
+ }
82
+ ],
83
+ 'Returns':
84
+ {
85
+ "type": "dict[str, Any]",
86
+ "description": "Some info here"
87
+ }
67
88
  }
68
89
  ```
69
90
 
@@ -73,7 +94,30 @@ Output:
73
94
  - Extracts parameter names, types, and descriptions
74
95
  - Preserves other sections like Examples, Notes, etc.
75
96
  - Handles multi-line descriptions and indentation properly
97
+ - Properly parses and validates References sections with special handling for URLs
98
+
99
+ ### References
76
100
 
101
+ The parser can handle reference sections in Google-style docstrings. References can be formatted in two ways:
102
+
103
+ 1. Single reference format:
104
+ ```python
105
+ """
106
+ Reference:
107
+ Paper title: https://example.com/paper
108
+ """
109
+ ```
110
+
111
+ 2. Multiple references format (requires leading dashes):
112
+ ```python
113
+ """
114
+ References:
115
+ - First paper: https://example.com/paper1
116
+ - Second paper: https://example.com/paper2
117
+ """
118
+ ```
119
+
120
+ Each reference is parsed into a dictionary with `description` and `source` keys. URLs in the source are properly handled, ensuring colons in URLs are not confused with the separator colon.
77
121
 
78
122
  ## Pre-commit Hook
79
123
 
@@ -101,14 +145,7 @@ Add a `[tool.docstring_checker]` section to your pyproject.toml:
101
145
  [tool.docstring_checker]
102
146
  paths = ["src", "tests"] # Directories or files to scan
103
147
  require_param_types = true # Require parameter types in docstrings
148
+ check_references = true # Check references for proper format
104
149
  exclude_files = ["conftest.py", "__init__.py"] # Files to exclude from checks
105
150
  verbose = false # Enable verbose output
106
151
  ```
107
-
108
- This approach has several advantages:
109
- - Keeps all your project configuration in one place
110
- - Follows modern Python tooling conventions
111
- - Makes it easier to maintain and update configuration
112
- - Provides better IDE support and documentation
113
-
114
- For more details, see the [tools README](tools/README.md).
@@ -0,0 +1,10 @@
1
+ """Google Docstring Parser package.
2
+
3
+ A lightweight, efficient parser for Google-style Python docstrings that converts them into structured dictionaries.
4
+
5
+ """
6
+
7
+ from google_docstring_parser.google_docstring_parser import ReferenceFormatError, parse_google_docstring
8
+ from google_docstring_parser.type_validation import InvalidTypeAnnotationError
9
+
10
+ __all__ = ["InvalidTypeAnnotationError", "ReferenceFormatError", "parse_google_docstring"]