Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def from_pdoc(cls, element):
is_class = isinstance(element, pdoc.Class)
method = cls(element.refname, element.name, is_class)
components = element.refname.split('.')
mod = __import__(components[0])
for comp in components[1:]:
mod = getattr(mod, comp)
# Get method line number.
method.add_source_line(get_source_line_number(mod))
# Get method Examples.
examples = get_examples_from_docstring(element.docstring)
if examples:
method.add_example(examples)
if element.docstring:
@classmethod
def from_pdoc(cls, element):
is_class = isinstance(element, pdoc.Class)
method = cls(element.refname, element.name, is_class)
components = element.refname.split('.')
mod = __import__(components[0])
for comp in components[1:]:
mod = getattr(mod, comp)
build_source(mod, method)
if element.docstring:
if not isinstance(element, pdoc.Class) and element.cls:
cls = element.cls.cls
elif element.cls:
cls = element.cls
else:
def docfilter(o):
rname = o.refname
if rname.find(search) > -1 or search.find(o.name) > -1:
return True
if isinstance(o, pdoc.Class):
return search in o.doc or search in o.doc_init
return False