Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 90a72f8

Browse files
committed
Add documentation for getmoduleinfo() and getmodulename().
1 parent 75ebb29 commit 90a72f8

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

Doc/lib/libinspect.tex

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,29 @@ \subsection{Types and members
9393
only members for which the predicate returns a true value are included.
9494
\end{funcdesc}
9595

96+
\begin{funcdesc}{getmoduleinfo}{path}
97+
Return a tuple of values that describe how Python will interpret the
98+
file identified by \var{path} if it is a module, or \code{None} if
99+
it would not be identified as a module. The return tuple is
100+
\code{(\var{name}, \var{suffix}, \var{mode}, \var{mtype})}, where
101+
\var{name} is the name of the module without the name of any
102+
enclosing package, \var{suffix} is the trailing part of the file
103+
name (which may not be a dot-delimited extension), \var{mode} is the
104+
\function{open()} mode that would be used (\code{'r'} or
105+
\code{'rb'}), and \var{mtype} is an integer giving the type of the
106+
module. \var{mtype} will have a value which can be compared to the
107+
constants defined in the \refmodule{imp} module; see the
108+
documentation for that module for more information on module types.
109+
\end{funcdesc}
110+
111+
\begin{funcdesc}{getmodulename}{path}
112+
Return the name of the module named by the file \var{path}, without
113+
including the names of enclosing packages. This uses the same
114+
algortihm as the interpreter uses when searching for modules. If
115+
the name cannot be matched according to the interpreter's rules,
116+
\code{None} is returned.
117+
\end{funcdesc}
118+
96119
\begin{funcdesc}{ismodule}{object}
97120
Return true if the object is a module.
98121
\end{funcdesc}

0 commit comments

Comments
 (0)