MCPcopy Index your code
hub / github.com/sphinx-doc/sphinx / for_module

Method for_module

sphinx/pycode/__init__.py:106–123  ·  view source on GitHub ↗
(cls: type[ModuleAnalyzer], modname: str)

Source from the content-addressed store, hash-verified

104
105 @classmethod
106 def for_module(cls: type[ModuleAnalyzer], modname: str) -> ModuleAnalyzer:
107 if ('module', modname) in cls.cache:
108 entry = cls.cache['module', modname]
109 if isinstance(entry, PycodeError):
110 raise entry
111 return entry
112
113 try:
114 filename, source = cls.get_module_source(modname)
115 if source is not None:
116 obj = cls.for_string(source, modname, filename or '<string>')
117 elif filename is not None:
118 obj = cls.for_file(filename, modname)
119 except PycodeError as err:
120 cls.cache['module', modname] = err
121 raise
122 cls.cache['module', modname] = obj
123 return obj
124
125 def __init__(
126 self, source: str, modname: str, srcname: str | os.PathLike[str]

Callers 15

has_tagFunction · 0.80
_generate_directivesFunction · 0.80
_body_alias_linesFunction · 0.80
get_class_membersFunction · 0.80
_get_members_to_documentFunction · 0.80
_attr_docs_for_propsFunction · 0.80
_get_docstring_linesFunction · 0.80
_class_variable_commentFunction · 0.80
_get_attribute_commentFunction · 0.80
_format_signaturesFunction · 0.80

Calls 3

get_module_sourceMethod · 0.80
for_stringMethod · 0.80
for_fileMethod · 0.80

Tested by 1