From 2878ac5efd3fc33192e86765741c0f6ec213775b Mon Sep 17 00:00:00 2001 From: Bryant Finney Date: Wed, 23 Oct 2024 19:24:55 -0400 Subject: [PATCH] fix(mitmproxy/pdoc#753): Apply suggestion ... from @mhils during mitmproxy/pdoc#754 Signed-off-by: Bryant Finney --- pdoc/doc.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pdoc/doc.py b/pdoc/doc.py index 3e0870ae..5f8620d1 100644 --- a/pdoc/doc.py +++ b/pdoc/doc.py @@ -91,15 +91,15 @@ class Doc(Generic[T]): qualname: str """ The qualified identifier name for this object. For example, if we have the following code: - + ```python class Foo: def bar(self): pass ``` - + The qualname of `Foo`'s `bar` method is `Foo.bar`. The qualname of the `Foo` class is just `Foo`. - + See for details. """ @@ -445,7 +445,7 @@ def _taken_from(self, member_name: str, obj: Any) -> tuple[str, str]: mod = _safe_getattr(obj, "__module__", None) qual = _safe_getattr(obj, "__qualname__", None) - if mod and hasattr(qual, "__contains__") and "" not in qual: + if mod and isinstance(qual, str) and "" not in qual: return mod, qual else: # This might be wrong, but it's the best guess we have. @@ -1051,7 +1051,7 @@ class Variable(Doc[None]): ) # technically Any includes empty, but this conveys intent. """ The variable's default value. - + In some cases, no default value is known. This may either be because a variable is only defined in the constructor, or it is only declared with a type annotation without assignment (`foo: int`). To distinguish this case from a default value of `None`, `pdoc.doc_types.empty` is used as a placeholder. @@ -1060,7 +1060,7 @@ class Variable(Doc[None]): annotation: type | empty """ The variable's type annotation. - + If there is no type annotation, `pdoc.doc_types.empty` is used as a placeholder. """