You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+24-12Lines changed: 24 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -53,10 +53,10 @@ class Parent(metaclass=DocInheritMeta(style="numpy")):
53
53
----------
54
54
x: int
55
55
blah-x
56
-
56
+
57
57
y: Optional[int]
58
58
blah-y
59
-
59
+
60
60
Raises
61
61
------
62
62
NotImplementedError"""
@@ -85,7 +85,7 @@ Because we specified `style="numpy"` in `DocInheritMeta`, the inherited docstrin
85
85
----------
86
86
x: int
87
87
blah-x
88
-
88
+
89
89
y: Optional[int]
90
90
blah-y
91
91
@@ -146,15 +146,27 @@ class Parent(metaclass=DocInheritMeta(style="numpy", abstract_base_class=True)):
146
146
147
147
For the "numpy", "google", and "napoleon_numpy" inheritance styles, one then only needs to specify the "Returns" or "Yields" section in the derived class' attribute docstring for it to have a fully-detailed docstring.
148
148
149
+
Another option is to be able to decide whether to include all special methods, meaning methods that start and
150
+
end by "__" such as "__init__" method, or not in the doctstring inheritance process. Such an option can be pass
151
+
to the `DocInheritMeta` metaclass constructor:
152
+
153
+
```python
154
+
# Each child class will also merge the special methods' docstring of its parent class
Utilize a built-in style by specifying any of the following names (as a string), wherever the `style` parameter is to be specified. The built-in styles are:
152
164
153
165
-`"parent"`: Wherever the docstring for a child-class' attribute (or for the class itself) is
154
166
`None`, inherit the corresponding docstring from the parent. (Deprecated in Python 3.5)
The child's docstring sections take precedence in the case of overlap.
185
197
@@ -188,15 +200,15 @@ For the `numpy`, `numpy_with_merge`, `numpy_napoleon`, `numpy_napoleon_with_merg
188
200
Detailed documentation and example cases for the default styles can be found [here](https://github.com/meowklaski/custom_inherit/blob/master/custom_inherit/_style_store.py)
189
201
190
202
## Making New Inheritance Styles
191
-
Implementing your inheritance style is simple.
203
+
Implementing your inheritance style is simple.
192
204
193
205
- Provide an inheritance style on the fly wherever a style parameter is specified:
194
206
- Supply any function of the form: `func(prnt_doc: str, child_doc: str) -> str`
195
207
196
208
- Log an inheritance style, and refer to it by name wherever a style parameter is specified, using either:
0 commit comments