hunterMakesPy 0.4.3__tar.gz → 0.4.4__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 (93) hide show
  1. huntermakespy-0.4.4/.github/HH-docstrings.md +519 -0
  2. huntermakespy-0.4.4/.github/HH-formatting.md +256 -0
  3. huntermakespy-0.4.4/.github/HH-identifiers.md +196 -0
  4. huntermakespy-0.4.4/.github/HH-post-defensive.md +179 -0
  5. huntermakespy-0.4.4/.github/HH-status-messages.md +156 -0
  6. huntermakespy-0.4.4/.github/HH-syntactic-clarity.md +448 -0
  7. huntermakespy-0.4.4/.github/HH-type-annotations.md +417 -0
  8. huntermakespy-0.4.4/.vscode/code-spell-dictionary-workspace.txt +14 -0
  9. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/.vscode/settings.json +0 -3
  10. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/CITATION.cff +7 -7
  11. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/PKG-INFO +3 -1
  12. huntermakespy-0.4.4/Z0Z_transform/factory.py +91 -0
  13. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/citations/CITATION.cff +7 -7
  14. huntermakespy-0.4.4/humpy_tlz/Notice_of_Copyright.txt +32 -0
  15. huntermakespy-0.4.4/humpy_tlz/__init__.py +9 -0
  16. huntermakespy-0.4.4/humpy_tlz/_build_tlz.py +82 -0
  17. huntermakespy-0.4.4/humpy_toolz/Notice_of_Copyright.txt +32 -0
  18. huntermakespy-0.4.4/humpy_toolz/__init__.py +24 -0
  19. huntermakespy-0.4.4/humpy_toolz/_signatures.py +199 -0
  20. huntermakespy-0.4.4/humpy_toolz/compatibility.py +22 -0
  21. huntermakespy-0.4.4/humpy_toolz/curried/__init__.py +78 -0
  22. huntermakespy-0.4.4/humpy_toolz/curried/exceptions.py +13 -0
  23. huntermakespy-0.4.4/humpy_toolz/curried/operator.py +8 -0
  24. huntermakespy-0.4.4/humpy_toolz/dicttoolz.py +314 -0
  25. huntermakespy-0.4.4/humpy_toolz/functoolz.py +837 -0
  26. huntermakespy-0.4.4/humpy_toolz/itertoolz.py +982 -0
  27. huntermakespy-0.4.4/humpy_toolz/recipes.py +43 -0
  28. huntermakespy-0.4.4/humpy_toolz/sandbox/__init__.py +3 -0
  29. huntermakespy-0.4.4/humpy_toolz/sandbox/core.py +121 -0
  30. huntermakespy-0.4.4/humpy_toolz/sandbox/parallel.py +71 -0
  31. huntermakespy-0.4.4/humpy_toolz/sandbox/tests/test_core.py +82 -0
  32. huntermakespy-0.4.4/humpy_toolz/sandbox/tests/test_parallel.py +22 -0
  33. huntermakespy-0.4.4/humpy_toolz/tests/__init__.py +1 -0
  34. huntermakespy-0.4.4/humpy_toolz/tests/test_compatibility.py +7 -0
  35. huntermakespy-0.4.4/humpy_toolz/tests/test_curried.py +89 -0
  36. huntermakespy-0.4.4/humpy_toolz/tests/test_curried_doctests.py +10 -0
  37. huntermakespy-0.4.4/humpy_toolz/tests/test_dicttoolz.py +224 -0
  38. huntermakespy-0.4.4/humpy_toolz/tests/test_functoolz.py +619 -0
  39. huntermakespy-0.4.4/humpy_toolz/tests/test_inspect_args.py +439 -0
  40. huntermakespy-0.4.4/humpy_toolz/tests/test_itertoolz.py +415 -0
  41. huntermakespy-0.4.4/humpy_toolz/tests/test_package.py +6 -0
  42. huntermakespy-0.4.4/humpy_toolz/tests/test_recipes.py +16 -0
  43. huntermakespy-0.4.4/humpy_toolz/tests/test_serialization.py +138 -0
  44. huntermakespy-0.4.4/humpy_toolz/tests/test_signatures.py +74 -0
  45. huntermakespy-0.4.4/humpy_toolz/tests/test_tlz.py +52 -0
  46. huntermakespy-0.4.4/humpy_toolz/tests/test_utils.py +5 -0
  47. huntermakespy-0.4.4/humpy_toolz/utils.py +7 -0
  48. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/hunterMakesPy/dataStructures.py +1 -1
  49. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/hunterMakesPy/filesystemToolkit.py +2 -2
  50. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/hunterMakesPy/parseParameters.py +1 -0
  51. huntermakespy-0.4.4/hunterMakesPy/py.typed +0 -0
  52. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/hunterMakesPy/theTypesCallableFunction.py +2 -2
  53. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/hunterMakesPy.egg-info/PKG-INFO +3 -1
  54. huntermakespy-0.4.4/hunterMakesPy.egg-info/SOURCES.txt +88 -0
  55. huntermakespy-0.4.4/hunterMakesPy.egg-info/dependency_links.txt +1 -0
  56. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/hunterMakesPy.egg-info/requires.txt +3 -0
  57. huntermakespy-0.4.4/hunterMakesPy.egg-info/top_level.txt +3 -0
  58. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/pyproject.toml +14 -5
  59. huntermakespy-0.4.3/.vscode/code-spell-dictionary-workspace.txt +0 -7
  60. huntermakespy-0.4.3/hunterMakesPy.egg-info/SOURCES.txt +0 -44
  61. huntermakespy-0.4.3/hunterMakesPy.egg-info/top_level.txt +0 -3
  62. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/.editorconfig +0 -0
  63. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/.github/CC-BY-NC-4.0.png +0 -0
  64. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/.github/FUNDING.yml +0 -0
  65. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/.github/workflows/githubRelease.yml +0 -0
  66. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/.github/workflows/pypiRelease.yml +0 -0
  67. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/.github/workflows/pythonTests.yml +0 -0
  68. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/.github/workflows/updateCitation.yml +0 -0
  69. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/.gitignore +0 -0
  70. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/.isort.cfg +0 -0
  71. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/.vscode/identifiers.code-snippets +0 -0
  72. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/LICENSE +0 -0
  73. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/README.md +0 -0
  74. /huntermakespy-0.4.3/hunterMakesPy/py.typed → /huntermakespy-0.4.4/Z0Z_transform/__init__.py +0 -0
  75. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/context7.json +0 -0
  76. /huntermakespy-0.4.3/hunterMakesPy.egg-info/dependency_links.txt → /huntermakespy-0.4.4/humpy_toolz/sandbox/tests/__init__.py +0 -0
  77. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/hunterMakesPy/__init__.py +0 -0
  78. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/hunterMakesPy/_theSSOT.py +0 -0
  79. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/hunterMakesPy/coping.py +0 -0
  80. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/hunterMakesPy/semiotics.py +0 -0
  81. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/hunterMakesPy/tests/__init__.py +0 -0
  82. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/hunterMakesPy/tests/conftest.py +0 -0
  83. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/hunterMakesPy/tests/test_coping.py +0 -0
  84. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/hunterMakesPy/tests/test_dataStructures.py +0 -0
  85. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/hunterMakesPy/tests/test_filesystemToolkit.py +0 -0
  86. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/hunterMakesPy/tests/test_parseParameters.py +0 -0
  87. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/hunterMakesPy/tests/test_theTypes.py +0 -0
  88. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/hunterMakesPy/theTypes.py +0 -0
  89. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/hunterMakesPy.code-workspace +0 -0
  90. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/pyrightconfig.json +0 -0
  91. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/ruff.toml +0 -0
  92. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/setup.cfg +0 -0
  93. {huntermakespy-0.4.3 → huntermakespy-0.4.4}/ty.toml +0 -0
@@ -0,0 +1,519 @@
1
+ ---
2
+ name: Docstring Standards
3
+ description: Standards for Python docstrings conforming to NumPy style with enhanced precision, international accessibility, and machine parseability.
4
+ ---
5
+ # Python Docstring Standards
6
+
7
+ Standards for Python docstrings conforming to NumPy style with enhanced precision, international accessibility, and machine parseability.
8
+
9
+ ## Docstring Format Standards
10
+
11
+ ### Summary Line: Voice and Mood
12
+
13
+ **For public identifiers** (functions, classes, methods, variables without leading underscore):
14
+
15
+ The summary line must be written as **a second-person declarative clause expressing dynamic modality with an implied subject**.
16
+
17
+ **What this means:**
18
+
19
+ - **Second person with implied subject**: Address the reader as "you" implicitly, omitting the explicit subject pronoun.
20
+ - **Declarative**: State a fact or capability, not issue a command.
21
+ - **Dynamic modality**: Express ability, possibility, or permission using modal verbs like "can", "may", "will", or present tense with capability implications.
22
+ - **Terse**: Keep the summary line concise by using Subject-Verb-Object structure with the subject implied.
23
+
24
+ **Summary line structure:**
25
+
26
+ - Start with the verb directly (implied "you can" or "you may").
27
+ - Follow with the object and any essential modifiers.
28
+ - End with a full stop.
29
+
30
+ **Examples:**
31
+
32
+ - ✅ **Correct**: "Express descending iteration or a reverse direction."
33
+ - ✅ **Correct**: "Compute the total number of distinct map foldings for a given shape."
34
+ - ✅ **Correct**: "Convert a pile range to an iterator of individual leaves."
35
+ - ✅ **Correct**: "Validate folding constraints before computation."
36
+
37
+ - ❌ **Incorrect**: "You can express descending iteration." (explicit subject - too verbose for summary)
38
+ - ❌ **Incorrect**: "Compute the total number of distinct map foldings." (imperative mood without modal - sounds commanding)
39
+ - ❌ **Incorrect**: "Computes foldings." (third person, not second person)
40
+ - ❌ **Incorrect**: "Returns the iterator." (too passive, not focused on reader capability)
41
+
42
+ **Why this matters:**
43
+
44
+ - Implied subject keeps the summary line concise and scannable.
45
+ - Dynamic modality (even when implied) respects the reader's autonomy.
46
+ - The tone remains informative and empowering without verbosity.
47
+
48
+ **Body text (extended description):**
49
+ After the terse summary line, start the body text with an **explicit subject** ("You can...", "The identifier...", "This function...") to provide context and smooth the transition from the concise summary to the detailed explanation.
50
+
51
+ **For private identifiers** (functions, classes, methods, variables with leading underscore):
52
+
53
+ The summary line must be written in **first-person descriptive voice** explaining how the identifier functions within the codebase architecture.
54
+
55
+ **What this means:**
56
+
57
+ - **First person**: Use "I use this..." from the developer's perspective.
58
+ - **Descriptive**: Explain the identifier's role in relation to other code, such as control flow, shared subroutines, or something else.
59
+ - **Architectural focus**: Clarify how this private component fits into the larger system.
60
+
61
+ **Examples:**
62
+
63
+ - ✅ **Correct**: "I use this shared subroutine for validating input across multiple public methods."
64
+ - ✅ **Correct**: "I use this to manage control flow between the preprocessing and computation phases."
65
+ - ✅ **Correct**: "I use this to cache intermediate results during recursive folding operations."
66
+
67
+ - ❌ **Incorrect**: "You can validate input." (second person - implies public API)
68
+ - ❌ **Incorrect**: "Validates input." (third person - too passive, doesn't explain architectural role)
69
+ - ❌ **Incorrect**: "Validate input before processing." (imperative - doesn't explain usage context)
70
+
71
+ **Why this matters:**
72
+
73
+ - Descriptive tone explains *how* and *why* this code exists in relation to the system, not just *what* it does.
74
+ - The purpose remains informative - helping the reader understand the codebase architecture.
75
+
76
+ ### Opening and Closing
77
+
78
+ - Start the summary on the same line as the opening triple quotes.
79
+ - Use a full stop to end every sentence.
80
+
81
+ ### AI-Generated Marker
82
+
83
+ When creating a new docstring, structure it as follows:
84
+
85
+ ```python
86
+ def exampleFunction(parameterFirst: int, parameterSecond: str = "default") -> bool:
87
+ """Validate input parameters and return success status.
88
+
89
+ (AI generated docstring)
90
+
91
+ You can use this function to validate input parameters before processing. The function
92
+ checks each parameter against defined constraints and returns success status. Extended
93
+ description uses explicit subjects to provide context. Cite references in text [1].
94
+
95
+ Parameters
96
+ ----------
97
+ parameterFirst : int
98
+ Description of the parameter.
99
+ parameterSecond : str = "default"
100
+ Description with default value noted after the type.
101
+
102
+ Returns
103
+ -------
104
+ isValid : bool
105
+ Description of the return value.
106
+
107
+ References
108
+ ----------
109
+ [1] Relevant documentation or concept being referenced
110
+ https://example.com/documentation
111
+
112
+ """
113
+ ```
114
+
115
+ When reformatting an existing docstring, do NOT add or remove "(AI generated docstring)".
116
+
117
+ ### Mathematical Notation
118
+
119
+ - **No LaTeX**: Use Unicode characters for mathematical symbols in all sections.
120
+ - **Mathematical Basis Section**: For functions with a strong mathematical foundation, create a dedicated `Mathematical Basis` section.
121
+ - **Audience**: Academic experts.
122
+ - **Content**: Use precise, academic terms and standard notation (Unicode).
123
+ - **Establishing Statements**: Use statements like "Let p be..." to bridge the gap between code identifiers and academic nomenclature.
124
+ - **Constraint**: Do not simplify explanations in this section.
125
+ - **General Documentation**: Do not include complex mathematical derivations or dense notation in the general docstring sections (Summary, Parameters, etc.). Keep the general explanation accessible to a wider audience.
126
+
127
+ ### Section Formatting (NumPy Style)
128
+
129
+ Use this exact structure:
130
+
131
+ ```text
132
+ [blank line]
133
+ Section Name
134
+ ------------
135
+ entry : datatype
136
+ Definition or description.
137
+ entry : datatype = defaultValue
138
+ Definition or description.
139
+ [blank line]
140
+ ```
141
+
142
+ **Standard section names** (use exactly these):
143
+
144
+ - `Parameters` (never "Args" or "Arguments")
145
+ - `Returns`
146
+ - `Raises`
147
+ - `Yields`
148
+ - `Attributes`
149
+ - `Examples`
150
+ - `See Also`
151
+ - `References`
152
+
153
+ **Custom section names for specific content:**
154
+
155
+ - Never use a generic "Notes" section.
156
+ - Name sections based on their actual content:
157
+ - `Mathematical Basis` (see Mathematical Notation section)
158
+ - `Performance Considerations`
159
+ - `Thread Safety`
160
+ - `Memory Usage`
161
+ - `Algorithm Details`
162
+ - `Implementation Notes`
163
+ - `Compatibility`
164
+ - etc.
165
+
166
+ This specificity helps readers quickly find relevant information.
167
+
168
+ ### Parameters Section
169
+
170
+ - Use the parameter name exactly as it appears in the signature.
171
+ - Include the type annotation from the signature.
172
+ - If a default value exists (in signature or logic), append `= defaultValue` after the type.
173
+ - Use four-space indentation for the description.
174
+
175
+ ### Returns Section
176
+
177
+ - Use a meaningful identifier, not just the type.
178
+ - Format: `meaningfulName : returnType`
179
+
180
+ ### References Section
181
+
182
+ Docstrings must provide navigation to related code and external resources. All references should be collected in a `References` section at the end of the docstring, numbered sequentially, and cited in the text using `[1]`, `[2]`, etc.
183
+
184
+ **What needs a reference:**
185
+
186
+ 1. **External packages and APIs**: Any mention of third-party libraries or their components
187
+ - `pandas.DataFrame`, `numpy.ndarray`, `requests.Session`
188
+ - Use Context7 links when available for well-documented packages
189
+ - Use official documentation links as fallback
190
+
191
+ 2. **Standard library items** (selective):
192
+ - Rarely used modules or functions
193
+ - Edge cases or subtle behaviors
194
+ - Complex APIs (e.g., `asyncio`, `collections.abc`, `operator`)
195
+ - Skip universally known items (e.g., `list`, `dict`, `str`, `int`)
196
+
197
+ 3. **Same-package references**:
198
+ - Functions, classes, or methods defined elsewhere in the package
199
+ - Related utilities
200
+ - Algorithms or data structures used internally
201
+
202
+ 4. **Theoretical foundations**:
203
+ - Mathematical concepts (group theory, graph theory, combinatorics)
204
+ - Algorithms (sorting, searching, optimization)
205
+ - Academic papers or textbooks
206
+ - Wikipedia articles for established concepts
207
+
208
+ 5. **Standards and specifications**:
209
+ - IETF RFCs, W3C specifications, PEPs
210
+ - File formats (JSON, CSV, HDF5)
211
+ - Protocols (HTTP, TCP, MQTT)
212
+
213
+ **Backticks are a heuristic**: Backticked identifiers often need references, but not always (skip if in signature). Conversely, some concepts need references even without backticks (e.g., "Chinese numerals" refers to a cultural/linguistic system).
214
+
215
+ **Reference format:**
216
+
217
+ ```python
218
+ def exampleFunction(data: list[int]) -> int:
219
+ """Compute the sum using this positional notation system [1].
220
+
221
+ This function implements the algorithm described in [2] using `gmpy2` [3]
222
+ for arbitrary-precision arithmetic. The approach is related to
223
+ `mapFolding.basecamp.countFolds` [4].
224
+
225
+ Parameters
226
+ ----------
227
+ data : list[int]
228
+ Input values in positional notation.
229
+
230
+ Returns
231
+ -------
232
+ total : int
233
+ Sum of input values.
234
+
235
+ References
236
+ ----------
237
+ [1] Positional notation - Wikipedia
238
+ https://en.wikipedia.org/wiki/Positional_notation
239
+ [2] Knuth, D. E. (1997). The Art of Computer Programming, Volume 2:
240
+ Seminumerical Algorithms (3rd ed.). Addison-Wesley.
241
+ [3] gmpy2 - Context7
242
+ https://gmpy2.readthedocs.io/en/latest/
243
+ [4] mapFolding.basecamp.countFolds
244
+ Internal package reference
245
+
246
+ """
247
+ ```
248
+
249
+ **Reference citation guidelines:**
250
+
251
+ - **Verification Required**: You must verify every external link you add. When modifying an existing docstring, verify all existing links as a maintenance task.
252
+ - Cite references in the text using `[1]`, `[2]`, etc., immediately after the relevant term or concept
253
+ - Multiple references for one concept: `[1, 2]` or `[1][2]` (be consistent within a docstring)
254
+ - List references in order of first citation
255
+ - Include both title/description and URL for web resources
256
+ - For packages: prefer Context7 links when available
257
+ - For academic papers: include full citation (author, year, title, publication)
258
+ - For internal package references: use module path, note "Internal package reference"
259
+
260
+ **Common external packages:**
261
+
262
+ - `hunterMakesPy`: <https://context7.com/hunterhogan/huntermakespy>
263
+ - `astToolkit`: <https://context7.com/hunterhogan/asttoolkit>
264
+ - `numpy`: <https://numpy.org/doc/stable/reference/index.html>
265
+ - `pandas`: <https://pandas.pydata.org/docs/reference/index.html>
266
+ - `gmpy2`: <https://gmpy2.readthedocs.io/en/latest/>
267
+ - `numba`: <https://numba.readthedocs.io/en/stable/>
268
+
269
+ ### Examples Section
270
+
271
+ **Private Identifiers**: Private identifiers (starting with `_`) do not require an `Examples` section.
272
+
273
+ **Real code only**: Examples must be drawn from actual usage in the codebase.
274
+
275
+ **Workflow for finding examples**:
276
+
277
+ 1. Use code search to find real invocations of the documented function/class.
278
+ 2. Select representative usage that demonstrates typical or important patterns.
279
+ 3. Simplify if needed, but preserve the identifier style and conventions of the codebase.
280
+ 4. If no real usage exists in the codebase, note this limitation.
281
+
282
+ **Never create contrived examples**. Real code demonstrates actual patterns and validates that the function works as documented.
283
+
284
+ - Examples must follow the identifier and style conventions of the codebase.
285
+ - Include context if needed for clarity (imports, setup, etc.).
286
+
287
+ ## Terminology and Semiotic Rules
288
+
289
+ ### Docstrings Are Not Prose
290
+
291
+ **Critical distinction**: Literary prose avoids repetition through synonyms and pronouns. Technical documentation requires consistency and precision.
292
+
293
+ **In docstrings:**
294
+
295
+ - **Repeat nouns instead of using pronouns**: Write "`parameterFirst`" every time, not "it" or "the parameter".
296
+ - **Repeat exact identifiers**: Don't vary between "`handler`", "the handler", or "this callback".
297
+ - **Avoid synonyms for precision**: Don't alternate between "function" and "routine", or "list" and "sequence" unless they mean different things.
298
+ - **Consistency aids comprehension**: Non-native speakers and machine translation tools rely on consistent terminology.
299
+
300
+ **Why this matters:**
301
+
302
+ - Pronouns create ambiguity: "it" can refer to multiple prior nouns.
303
+ - Synonyms suggest false distinctions: readers wonder if "handler" and "callback" mean different things.
304
+ - Repetition in technical writing establishes clear, unambiguous reference chains.
305
+
306
+ **Example:**
307
+
308
+ ❌ **Bad** (prose-style with pronouns and synonyms):
309
+
310
+ > Process the data using the handler. It will transform the input
311
+ and pass the result to the callback, which processes it further.
312
+
313
+ ✅ **Good** (technical style with repetition):
314
+
315
+ > Process `data` using `handler`. The `handler` transforms `data`
316
+ and passes `data` to `handler`, which processes `data` further.
317
+
318
+ ### Backtick Usage
319
+
320
+ - Always use backticks when referring to:
321
+ - Identifiers and other labels: `parameterName`, `className`
322
+ - Python keywords: `try`, `except`, `class`
323
+ - Types: `Exception`, `None`, `bool`
324
+ - Code elements: `self`, `cls`
325
+ - Natural language discussing concepts uses standard English without backticks.
326
+ - Never write lowercase technical terms: write `Exception`, never "exception" when referring to the Python type.
327
+
328
+ ### Vocabulary Prohibitions
329
+
330
+ - Never use "pipeline". Use "assembly line" if describing a sequence of transformations.
331
+ - Avoid end-of-line colons in prose (machine parsers interpret them as syntax).
332
+
333
+ ### Technical Complexity Separation
334
+
335
+ - **General Sections (Summary, Parameters, Returns)**: Write for a competent developer who may not be a domain expert. Avoid implementation-specific jargon (e.g., "mutable object", "thread-safe", "atomic") unless it is the primary function of the code.
336
+ - **Technical Detail Sections**: Put implementation details, hardware constraints, or expert-level warnings in well-named custom sections (e.g., `Concurrency`, `Memory Management`, `Algorithm Details`).
337
+ - **Audience**: Experts who need to know.
338
+ - **Tone**: Efficient, precise, technical.
339
+ - **Constraint**: Do not explain standard concepts (like "don't share mutable objects between threads") to experts. Only document non-obvious behaviors or critical constraints.
340
+
341
+ ### Plurality and Identifiers
342
+
343
+ - **Do not force English plurality on identifiers**: `keyword` not `keywords` or `keyword`s.
344
+ - **Preserve parameter names exactly**: `handlers` (the field) not "the handlers parameter".
345
+ - **Use generalized nouns to avoid plurality**: Do not pluralize identifiers or add possessives to them. Instead, precede the strict identifier with a generalized noun or quantifier.
346
+ - ❌ Incorrect: "Returns the `iterator`'s `leaves`." (Modified identifiers)
347
+ - ✅ Correct: "Returns the `iterator` of `type` `int` `leaf`." (Noun "type int" precedes `leaf`)
348
+ - ❌ Incorrect: "Enumerate `dimensionIndices`." (Pluralized identifier)
349
+ - ✅ Correct: "Enumerate each `dimensionIndex`." (Quantifier "each" precedes `dimensionIndex`)
350
+ - **Reinforce meaning through context** rather than breaking identifiers for prose.
351
+
352
+ ### Disambiguation
353
+
354
+ - Qualify ambiguous terms: "Python keyword `try`" not just "`try`".
355
+ - Maintain precision: "`class` `Exception`" rather than "the `Exception` `class`".
356
+ - Avoid compound hyphenation with technical terms: not "`Exception`-free" but "successful completion".
357
+
358
+ ### Writing for International and Machine Translation Audiences
359
+
360
+ **Assume your audience:**
361
+
362
+ - Two-thirds of the humans are non-native English speakers
363
+ - Half will use machine translation tools to some degree (Google Translate, DeepL, etc.)
364
+ - Future readers will use the docstring to generate new code
365
+
366
+ **Guidelines:**
367
+
368
+ - **Use simple sentence structures**: Avoid complex subordinate clauses when possible.
369
+ - **Prefer active voice**: "This function returns X" rather than "X is returned by this function".
370
+ - **Avoid idioms and colloquialisms**: "fails quickly" not "bails out", "prevents errors" not "catches issues".
371
+ - **Use consistent terminology**: Machine translation works better with repeated exact phrases.
372
+ - **Minimize ambiguity**: Pronouns confuse both humans and translation systems.
373
+ - **Be explicit**: Don't rely on cultural context or implied knowledge.
374
+ - **Short, complete sentences**: Better for parsing and translation than long, flowing prose.
375
+
376
+ **Test your writing**: If a sentence would be difficult to translate word-by-word, rewrite it more explicitly.
377
+
378
+ ## Scope-Specific Standards
379
+
380
+ ### Module-Level Docstrings
381
+
382
+ Place at the very top of the file, before imports.
383
+
384
+ **Required components:**
385
+
386
+ 1. Summary (second-person declarative with dynamic modality and implied subject)
387
+ 2. Extended description of module purpose
388
+ 3. **Table of contents listing all public identifiers**
389
+
390
+ **Format:**
391
+
392
+ ```python
393
+ """Perform map-folding computations and analysis.
394
+
395
+ (AI generated docstring)
396
+
397
+ You can use this module to compute distinct foldings of multi-dimensional maps. The module
398
+ provides the core algorithms and orchestrates computation workflows. Extended description
399
+ of module purpose and organization.
400
+
401
+ Contents
402
+ --------
403
+ Functions
404
+ functionAlpha
405
+ One-line description of functionAlpha.
406
+ functionBeta
407
+ One-line description of functionBeta.
408
+
409
+ Classes
410
+ ClassAlpha
411
+ One-line description of ClassAlpha.
412
+
413
+ """
414
+ import ...
415
+ ```
416
+
417
+ **Table of contents requirements:**
418
+
419
+ - List all public functions, classes, and other exported identifiers.
420
+ - If there are sections (`#======== Boolean filters ====`) and subsections (`#---- Specific filters ----`), reflect that hierarchy.
421
+ - Maintain alphabetical order within each section.
422
+ - Provide one-line descriptions for each item.
423
+ - Omit private identifiers (those starting with `_`).
424
+
425
+ ### Package `__init__.py` Docstrings
426
+
427
+ Document what the package exposes and its organizational purpose.
428
+
429
+ **Required components:**
430
+
431
+ 1. Summary (second-person declarative with dynamic modality and implied subject)
432
+ 2. Extended description
433
+ 3. **Table of contents of public modules and subpackages**
434
+
435
+ **Format:**
436
+
437
+ ```python
438
+ """Access map-folding algorithms and utilities.
439
+
440
+ (AI generated docstring)
441
+
442
+ You can use this package to compute distinct foldings of multi-dimensional maps. This package
443
+ provides implementations of various map-folding counting algorithms, state management for
444
+ parallel computations, and interfaces to OEIS sequences.
445
+
446
+ Modules
447
+ -------
448
+ basecamp
449
+ Entry point for map-folding computations with algorithm selection.
450
+ dataBaskets
451
+ State containers and data structures for folding computations.
452
+ filesystemToolkit
453
+ Utilities for result persistence and caching.
454
+
455
+ Subpackages
456
+ -----------
457
+ algorithms
458
+ Collection of map-folding algorithm implementations.
459
+ _e
460
+ Experimental elimination-based algorithms (internal research code).
461
+
462
+ """
463
+ ```
464
+
465
+ **Table of contents requirements:**
466
+
467
+ - List public modules with brief descriptions
468
+ - List subpackages with brief descriptions
469
+ - Use section headers (`Modules`, `Subpackages`) with dashed underlines
470
+ - Omit private modules (starting with `_`) unless they are documented internal APIs
471
+
472
+ ### Class Docstrings
473
+
474
+ ```python
475
+ class ExampleClass:
476
+ """Manage map folding computation state.
477
+
478
+ (AI generated docstring)
479
+
480
+ You can use this class to encapsulate and manage the state needed for parallel
481
+ map-folding computations. Extended description of behavior and usage.
482
+
483
+ Attributes
484
+ ----------
485
+ attributeName : type
486
+ Description of the attribute.
487
+
488
+ """
489
+ ```
490
+
491
+ ### Class and Instance Variable Docstrings
492
+
493
+ For class-level or instance-level variables that need documentation:
494
+
495
+ ```python
496
+ class Configuration:
497
+ """Store and manage configuration settings.
498
+
499
+ (AI generated docstring)
500
+
501
+ You can use this class to maintain configuration values across the application.
502
+
503
+ Attributes
504
+ ----------
505
+ settingDefault : int
506
+ The default setting value applied when no override is provided.
507
+
508
+ """
509
+
510
+ settingDefault: int = 42
511
+ """The default setting value applied when no override is provided."""
512
+ ```
513
+
514
+ ## Type Annotation Requirements
515
+
516
+ While the primary task is docstrings, observe these rules when type annotations are encountered:
517
+
518
+ - Always use PEP 585 style (`list[int]`, not `List[int]`).
519
+ - Use PEP 604 style (`int | None`, not `Optional[int]`; `int | str`, not `Union[int, str]`).