pdoc 14.3.0__py3-none-any.whl → 14.4.0__py3-none-any.whl

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.
pdoc/__init__.py CHANGED
@@ -176,18 +176,21 @@ class GoldenRetriever(Dog):
176
176
 
177
177
  The public interface of a module is determined through one of two
178
178
  ways.
179
-
180
179
  - If `__all__` is defined in the module, then all identifiers in that list will be considered public.
181
180
  No other identifiers will be considered public.
182
- - If `__all__` is not defined, then pdoc will consider all members public that
183
- 1. do not start with an underscore,
184
- 2. don't have `@private` in their docstring,
185
- 2. and are defined in the current module (i.e. they are not imported).
181
+ - If `__all__` is not defined, then pdoc will consider all items public that do not start with an
182
+ underscore and that are defined in the current module (i.e. they are not imported).
183
+
184
+ If you want to override the default behavior for a particular item,
185
+ you can do so by including an annotation in its docstring:
186
+
187
+ - `@private` hides an item unconditionally.
188
+ - <code>&#64;public</code> shows an item unconditionally.
186
189
 
187
- In general, we recommend keeping these conventions:
190
+ In general, we recommend keeping the following conventions:
188
191
 
189
192
  - If you want to document a private member, consider making it public.
190
- - If you want to hide a public member, consider making it private or add `@private` to their docstring,
193
+ - If you want to hide a public member, consider making it private.
191
194
  - If you want to document a special `__dunder__` method, the recommended way to do so is
192
195
  to not document the dunder method specifically, but to add some usage examples in the class documentation.
193
196
 
@@ -462,7 +465,7 @@ You can find an example in [`examples/library-usage`](https://github.com/mitmpro
462
465
  from __future__ import annotations
463
466
 
464
467
  __docformat__ = "markdown" # explicitly disable rST processing in the examples above.
465
- __version__ = "14.3.0" # this is read from setup.py
468
+ __version__ = "14.4.0" # this is read from setup.py
466
469
 
467
470
  from pathlib import Path
468
471
  from typing import overload
pdoc/doc.py CHANGED
@@ -887,6 +887,8 @@ class Function(Doc[types.FunctionType]):
887
887
  unwrapped = func.__func__ # type: ignore
888
888
  elif isinstance(func, singledispatchmethod):
889
889
  unwrapped = func.func # type: ignore
890
+ elif hasattr(func, "__wrapped__"):
891
+ unwrapped = func.__wrapped__
890
892
  else:
891
893
  unwrapped = func
892
894
  super().__init__(modulename, qualname, unwrapped, taken_from)
@@ -1139,7 +1141,7 @@ class Variable(Doc[None]):
1139
1141
  warnings.warn(f"repr({self.fullname}) raised an exception ({e!r})")
1140
1142
  return ""
1141
1143
 
1142
- pretty = re.sub(r" at 0x[0-9a-fA-F]+(?=>)", "", pretty)
1144
+ pretty = _remove_memory_addresses(pretty)
1143
1145
  return pretty
1144
1146
 
1145
1147
  @cached_property
@@ -1180,7 +1182,8 @@ class _PrettySignature(inspect.Signature):
1180
1182
  render_pos_only_separator = False
1181
1183
  render_kw_only_separator = True
1182
1184
  for param in self.parameters.values():
1183
- formatted = re.sub(r" at 0x[0-9a-fA-F]+(?=>$)", "", str(param))
1185
+ formatted = str(param)
1186
+ formatted = _remove_memory_addresses(formatted)
1184
1187
 
1185
1188
  kind = param.kind
1186
1189
 
@@ -1298,3 +1301,8 @@ def _safe_getdoc(obj: Any) -> str:
1298
1301
  return ""
1299
1302
  else:
1300
1303
  return doc.strip()
1304
+
1305
+
1306
+ def _remove_memory_addresses(x: str) -> str:
1307
+ """Remove memory addresses from repr() output"""
1308
+ return re.sub(r" at 0x[0-9a-fA-F]+(?=>)", "", x)
pdoc/doc_ast.py CHANGED
@@ -32,7 +32,6 @@ if TYPE_CHECKING:
32
32
  def get_source(obj: Any) -> str:
33
33
  """
34
34
  Returns the source code of the Python object `obj` as a str.
35
- This tries to first unwrap the method if it is wrapped and then calls `inspect.getsource`.
36
35
 
37
36
  If this fails, an empty string is returned.
38
37
  """
@@ -209,7 +209,7 @@ See https://pdoc.dev/docs/pdoc/render_helpers.html#DefaultMacroExtension for an
209
209
  {% enddefaultmacro %}
210
210
  {% defaultmacro docstring(var) %}
211
211
  {% if var.docstring %}
212
- <div class="docstring">{{ var.docstring | to_markdown | to_html | linkify(namespace=var.qualname) }}</div>
212
+ <div class="docstring">{{ var.docstring | replace("@public", "") | to_markdown | to_html | linkify(namespace=var.qualname) }}</div>
213
213
  {% endif %}
214
214
  {% enddefaultmacro %}
215
215
  {% defaultmacro nav_members(members) %}
@@ -239,10 +239,13 @@ See https://pdoc.dev/docs/pdoc/render_helpers.html#DefaultMacroExtension for an
239
239
  Implementing this as a macro makes it very easy to override with a custom template, see
240
240
  https://github.com/mitmproxy/pdoc/tree/main/examples/custom-template.
241
241
  #}
242
- {% if not include_undocumented and not doc.docstring %}
243
- {# hide members that are undocumented if include_undocumented has been toggled off. #}
244
- {% elif doc.docstring and "@private" in doc.docstring %}
242
+ {% if "@private" in doc.docstring %}
245
243
  {# hide members explicitly marked as @private #}
244
+ {% elif "@public" in doc.docstring %}
245
+ {# show members explicitly marked as @public #}
246
+ true
247
+ {% elif not include_undocumented and not doc.docstring %}
248
+ {# hide members that are undocumented if include_undocumented has been toggled off. #}
246
249
  {% elif doc.name == "__init__" and (doc.docstring or (doc.kind == "function" and doc.signature_without_self.parameters)) %}
247
250
  {# show constructors that have a docstring or at least one extra argument #}
248
251
  true
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pdoc
3
- Version: 14.3.0
3
+ Version: 14.4.0
4
4
  Summary: API Documentation for Python Projects
5
5
  Author-email: Maximilian Hils <pdoc@maximilianhils.com>
6
6
  License: Unlicense
@@ -1,8 +1,8 @@
1
- pdoc/__init__.py,sha256=2Cl2ahFG3zMihIq86U4SGMy8K9dolked9-3UPveH-X8,20792
1
+ pdoc/__init__.py,sha256=Bu6WuxUPvQzuWM79MxWtx_h82cUpSO5uOvjsW0bdyKg,20937
2
2
  pdoc/__main__.py,sha256=79uLvuQ8eHvU_tzXy4akpKMdDF2DN0xg5VPgv4pmyGo,8418
3
3
  pdoc/_compat.py,sha256=wKGKTxTTxfNjEcKPwvtuvNeOyiozPfL52h8PArKky-0,3843
4
- pdoc/doc.py,sha256=5eY1B-7omEG61Tev_fSY75bTCkvFICXYda229_VTNvs,48141
5
- pdoc/doc_ast.py,sha256=LBYx8NuXsoxqD_MsmDsI9ShMvOK0tnCDvu0Hv1hBies,11405
4
+ pdoc/doc.py,sha256=hPv_SpWmIzjlCpePXNGEj-gyEHrHq48mk_oSKyRAPmM,48383
5
+ pdoc/doc_ast.py,sha256=-xwmklfpIku2PDT_KUylN0y9mk83hmp7VmRRSrtHVvc,11310
6
6
  pdoc/doc_pyi.py,sha256=SJ5Mx7OU4WNnxSNkom79xct0P9eqH3KgObW_6ZxG6Y4,4203
7
7
  pdoc/doc_types.py,sha256=P6HwAIKotcE7iKJtKpZPvbok7LpeqYEtrgUcknuMcek,8467
8
8
  pdoc/docstrings.py,sha256=F_knLP93uD5RiHUN1Ha7mGTxzadiG1880-Go0dXmdh0,14990
@@ -30,7 +30,7 @@ pdoc/templates/theme.css,sha256=yjnbtPVmqaifTINsA5sK2a3e1aoFO0UlOMgOSKUgLvI,397
30
30
  pdoc/templates/default/error.html.jinja2,sha256=RqH14o6ZV79uBO14gKSjwObXFKKczkcLTMe1orurEJk,970
31
31
  pdoc/templates/default/frame.html.jinja2,sha256=Qp5zlts8Bl-O2f0cxJHH_QdmAkMtJJjNVA0ZU2Mbwl8,2164
32
32
  pdoc/templates/default/index.html.jinja2,sha256=MkzVYMWUuJgscty3jVbDtcEfB1vz-bp3v_sMa5MzevU,2381
33
- pdoc/templates/default/module.html.jinja2,sha256=KuBvhTefUteJ1unUA5DVedbjTTqkfA86nU4s_CF23aA,13123
33
+ pdoc/templates/default/module.html.jinja2,sha256=8IfopEB0v7b24EmNGYbuUSO4zpXmRj0-_YL1YtWB7lE,13241
34
34
  pdoc/templates/deprecated/README.md,sha256=8HPj4Bu6EPAdHbH5CQVYgcD580zpkhqbwiSFoLAVB1Q,339
35
35
  pdoc/templates/deprecated/bootstrap-reboot.min.css,sha256=-u1DTWljwtvjAc8X-ihFhIixKaPcs4w_uZ_CYvvP9-o,207
36
36
  pdoc/templates/deprecated/box-arrow-in-left.svg,sha256=-u1DTWljwtvjAc8X-ihFhIixKaPcs4w_uZ_CYvvP9-o,207
@@ -47,9 +47,9 @@ pdoc/templates/resources/info-circle-fill.svg,sha256=kO3AMXfWtacpJPzC8Pvihf46OZd
47
47
  pdoc/templates/resources/lightning-fill.svg,sha256=XEyCtbgxeAlwCezdsf7N0NFd5aMjwqyJJDpaFbYYTFA,265
48
48
  pdoc/templates/resources/navtoggle.svg,sha256=WVR0BJIucX0MgwwEawmfX0qYD1i_dSbUhoGnqPef3jw,187
49
49
  pdoc/templates/resources/pdoc-logo.svg,sha256=w5OsMmytDaA2Fr9CobeQQFxBNx4-wFFHtLvkORj0gjk,6989
50
- pdoc-14.3.0.dist-info/LICENSE,sha256=fhLl30uuEsshWBuhV87SDhmGoFCN0Q0Oikq5pM-U6Fw,1211
51
- pdoc-14.3.0.dist-info/METADATA,sha256=fOSc9hiwpiWC6PoYpEjUksQaLo1IyhDJEK1G-SnY2as,7470
52
- pdoc-14.3.0.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
53
- pdoc-14.3.0.dist-info/entry_points.txt,sha256=-bK-S1ZvmqCWqi1hGnsl5nayWkzXB1BEs-Cynh5QZaI,43
54
- pdoc-14.3.0.dist-info/top_level.txt,sha256=rg5eIToBHzwTfZZi1E7NVHgie5joQuSuU1rWV0qKS9k,5
55
- pdoc-14.3.0.dist-info/RECORD,,
50
+ pdoc-14.4.0.dist-info/LICENSE,sha256=fhLl30uuEsshWBuhV87SDhmGoFCN0Q0Oikq5pM-U6Fw,1211
51
+ pdoc-14.4.0.dist-info/METADATA,sha256=RLpOyhI-cajuuNMwe5xxfdpGzaOtcdr0Z8aWc6C2c8g,7470
52
+ pdoc-14.4.0.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
53
+ pdoc-14.4.0.dist-info/entry_points.txt,sha256=-bK-S1ZvmqCWqi1hGnsl5nayWkzXB1BEs-Cynh5QZaI,43
54
+ pdoc-14.4.0.dist-info/top_level.txt,sha256=rg5eIToBHzwTfZZi1E7NVHgie5joQuSuU1rWV0qKS9k,5
55
+ pdoc-14.4.0.dist-info/RECORD,,
File without changes
File without changes