Team Ai
Apppublic

parthtamu/rag-code-assistant

sourceHugging Faceupdated 7mo agoView on Hugging Face
0likes
modulefinder.html471 linesDownload Raw Back to docs
1<!DOCTYPE html>2 3<html lang="en" data-content_root="../">4  <head>5    <meta charset="utf-8" />6    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />7<meta property="og:title" content="modulefinder — Find modules used by a script" />8<meta property="og:type" content="website" />9<meta property="og:url" content="https://docs.python.org/3/library/modulefinder.html" />10<meta property="og:site_name" content="Python documentation" />11<meta property="og:description" content="Source code: Lib/modulefinder.py This module provides a ModuleFinder class that can be used to determine the set of modules imported by a script. modulefinder.py can also be run as a script, giving..." />12<meta property="og:image:width" content="1146" />13<meta property="og:image:height" content="600" />14<meta property="og:image" content="https://docs.python.org/3.15/_images/social_previews/summary_library_modulefinder_97a1a445.png" />15<meta property="og:image:alt" content="Source code: Lib/modulefinder.py This module provides a ModuleFinder class that can be used to determine the set of modules imported by a script. modulefinder.py can also be run as a script, giving..." />16<meta name="description" content="Source code: Lib/modulefinder.py This module provides a ModuleFinder class that can be used to determine the set of modules imported by a script. modulefinder.py can also be run as a script, giving..." />17<meta name="twitter:card" content="summary_large_image" />18<meta name="theme-color" content="#3776ab">19 20    <title>modulefinder — Find modules used by a script &#8212; Python 3.15.0a6 documentation</title><meta name="viewport" content="width=device-width, initial-scale=1.0">21    22    <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=b86133f3" />23    <link rel="stylesheet" type="text/css" href="../_static/classic.css?v=234b1a7c" />24    <link rel="stylesheet" type="text/css" href="../_static/pydoctheme.css?v=89a2f22a" />25    <link rel="stylesheet" type="text/css" href="../_static/profiling-sampling-visualization.css?v=0c2600ae" />26    <link id="pygments_dark_css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css" href="../_static/pygments_dark.css?v=5349f25f" />27    28    <script src="../_static/documentation_options.js?v=6b7c9ff5"></script>29    <script src="../_static/doctools.js?v=9bcbadda"></script>30    <script src="../_static/sphinx_highlight.js?v=dc90522c"></script>31    <script src="../_static/profiling-sampling-visualization.js?v=9811ed04"></script>32    33    <script src="../_static/sidebar.js"></script>34    35    <link rel="search" type="application/opensearchdescription+xml"36          title="Search within Python 3.15.0a6 documentation"37          href="../_static/opensearch.xml"/>38    <link rel="author" title="About these documents" href="../about.html" />39    <link rel="index" title="Index" href="../genindex.html" />40    <link rel="search" title="Search" href="../search.html" />41    <link rel="copyright" title="Copyright" href="../copyright.html" />42    <link rel="next" title="runpy — Locating and executing Python modules" href="runpy.html" />43    <link rel="prev" title="pkgutil — Package extension utility" href="pkgutil.html" />44    45      46      <script defer file-types="bz2,epub,zip" data-domain="docs.python.org" src="https://analytics.python.org/js/script.file-downloads.outbound-links.js"></script>47      48      <link rel="canonical" href="https://docs.python.org/3/library/modulefinder.html">49      50    51 52    53    <style>54      @media only screen {55        table.full-width-table {56            width: 100%;57        }58      }59    </style>60<link rel="stylesheet" href="../_static/pydoctheme_dark.css" media="(prefers-color-scheme: dark)" id="pydoctheme_dark_css">61    <link rel="shortcut icon" type="image/png" href="../_static/py.svg">62            <script type="text/javascript" src="../_static/copybutton.js"></script>63            <script type="text/javascript" src="../_static/menu.js"></script>64            <script type="text/javascript" src="../_static/search-focus.js"></script>65            <script type="text/javascript" src="../_static/themetoggle.js"></script> 66            <script type="text/javascript" src="../_static/rtd_switcher.js"></script>67            <meta name="readthedocs-addons-api-version" content="1">68 69  </head>70<body>71<div class="mobile-nav">72    <input type="checkbox" id="menuToggler" class="toggler__input" aria-controls="navigation"73           aria-pressed="false" aria-expanded="false" role="button" aria-label="Menu">74    <nav class="nav-content" role="navigation">75        <label for="menuToggler" class="toggler__label">76            <span></span>77        </label>78        <span class="nav-items-wrapper">79            <a href="https://www.python.org/" class="nav-logo">80                <img src="../_static/py.svg" alt="Python logo">81            </a>82            <span class="version_switcher_placeholder"></span>83            <form role="search" class="search" action="../search.html" method="get">84                <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" class="search-icon">85                    <path fill-rule="nonzero" fill="currentColor" d="M15.5 14h-.79l-.28-.27a6.5 6.5 0 001.48-5.34c-.47-2.78-2.79-5-5.59-5.34a6.505 6.505 0 00-7.27 7.27c.34 2.8 2.56 5.12 5.34 5.59a6.5 6.5 0 005.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path>86                </svg>87                <input placeholder="Quick search" aria-label="Quick search" type="search" name="q">88                <input type="submit" value="Go">89            </form>90        </span>91    </nav>92    <div class="menu-wrapper">93        <nav class="menu" role="navigation" aria-label="main navigation">94            <div class="language_switcher_placeholder"></div>95            96<label class="theme-selector-label">97    Theme98    <select class="theme-selector" oninput="activateTheme(this.value)">99        <option value="auto" selected>Auto</option>100        <option value="light">Light</option>101        <option value="dark">Dark</option>102    </select>103</label>104  <div>105    <h3><a href="../contents.html">Table of Contents</a></h3>106    <ul>107<li><a class="reference internal" href="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">modulefinder</span></code> — Find modules used by a script</a><ul>108<li><a class="reference internal" href="#example-usage-of-modulefinder">Example usage of <code class="xref py py-class docutils literal notranslate"><span class="pre">ModuleFinder</span></code></a></li>109</ul>110</li>111</ul>112 113  </div>114  <div>115    <h4>Previous topic</h4>116    <p class="topless"><a href="pkgutil.html"117                          title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pkgutil</span></code> — Package extension utility</a></p>118  </div>119  <div>120    <h4>Next topic</h4>121    <p class="topless"><a href="runpy.html"122                          title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">runpy</span></code> — Locating and executing Python modules</a></p>123  </div>124  <script>125    document.addEventListener('DOMContentLoaded', () => {126        const title = document.querySelector('meta[property="og:title"]').content;127        const elements = document.querySelectorAll('.improvepage');128        const pageurl = window.location.href.split('?')[0];129        elements.forEach(element => {130            const url = new URL(element.href.split('?')[0].replace("-nojs", ""));131            url.searchParams.set('pagetitle', title);132            url.searchParams.set('pageurl', pageurl);133            url.searchParams.set('pagesource', "library/modulefinder.rst");134            element.href = url.toString();135        });136    });137  </script>138  <div role="note" aria-label="source link">139    <h3>This page</h3>140    <ul class="this-page-menu">141      <li><a href="../bugs.html">Report a bug</a></li>142      <li><a class="improvepage" href="../improve-page-nojs.html">Improve this page</a></li>143      <li>144        <a href="https://github.com/python/cpython/blob/main/Doc/library/modulefinder.rst?plain=1"145            rel="nofollow">Show source146        </a>147      </li>148      149    </ul>150  </div>151        </nav>152    </div>153</div>154 155  156    <div class="related" role="navigation" aria-label="Related">157      <h3>Navigation</h3>158      <ul>159        <li class="right" style="margin-right: 10px">160          <a href="../genindex.html" title="General Index"161             accesskey="I">index</a></li>162        <li class="right" >163          <a href="../py-modindex.html" title="Python Module Index"164             >modules</a> |</li>165        <li class="right" >166          <a href="runpy.html" title="runpy — Locating and executing Python modules"167             accesskey="N">next</a> |</li>168        <li class="right" >169          <a href="pkgutil.html" title="pkgutil — Package extension utility"170             accesskey="P">previous</a> |</li>171 172          <li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"></li>173          <li><a href="https://www.python.org/">Python</a> &#187;</li>174          <li class="switchers">175            <div class="language_switcher_placeholder"></div>176            <div class="version_switcher_placeholder"></div>177          </li>178          <li>179              180          </li>181    <li id="cpython-language-and-version">182      <a href="../index.html">3.15.0a6 Documentation</a> &#187;183    </li>184 185          <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>186          <li class="nav-item nav-item-2"><a href="modules.html" accesskey="U">Importing Modules</a> &#187;</li>187        <li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">modulefinder</span></code> — Find modules used by a script</a></li>188                <li class="right">189                    190 191    <div class="inline-search" role="search">192        <form class="inline-search" action="../search.html" method="get">193          <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box">194          <input type="submit" value="Go">195        </form>196    </div>197                     |198                </li>199            <li class="right">200<label class="theme-selector-label">201    Theme202    <select class="theme-selector" oninput="activateTheme(this.value)">203        <option value="auto" selected>Auto</option>204        <option value="light">Light</option>205        <option value="dark">Dark</option>206    </select>207</label> |</li>208            209      </ul>210    </div>    211 212    <div class="document">213      <div class="documentwrapper">214        <div class="bodywrapper">215          <div class="body" role="main">216            217  <section id="module-modulefinder">218<span id="modulefinder-find-modules-used-by-a-script"></span><h1><code class="xref py py-mod docutils literal notranslate"><span class="pre">modulefinder</span></code> — Find modules used by a script<a class="headerlink" href="#module-modulefinder" title="Link to this heading">¶</a></h1>219<p><strong>Source code:</strong> <a class="extlink-source reference external" href="https://github.com/python/cpython/tree/main/Lib/modulefinder.py">Lib/modulefinder.py</a></p>220<hr class="docutils" />221<p>This module provides a <a class="reference internal" href="#modulefinder.ModuleFinder" title="modulefinder.ModuleFinder"><code class="xref py py-class docutils literal notranslate"><span class="pre">ModuleFinder</span></code></a> class that can be used to determine222the set of modules imported by a script. <code class="docutils literal notranslate"><span class="pre">modulefinder.py</span></code> can also be run as223a script, giving the filename of a Python script as its argument, after which a224report of the imported modules will be printed.</p>225<dl class="py function">226<dt class="sig sig-object py" id="modulefinder.AddPackagePath">227<span class="sig-prename descclassname"><span class="pre">modulefinder.</span></span><span class="sig-name descname"><span class="pre">AddPackagePath</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pkg_name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#modulefinder.AddPackagePath" title="Link to this definition">¶</a></dt>228<dd><p>Record that the package named <em>pkg_name</em> can be found in the specified <em>path</em>.</p>229</dd></dl>230 231<dl class="py function">232<dt class="sig sig-object py" id="modulefinder.ReplacePackage">233<span class="sig-prename descclassname"><span class="pre">modulefinder.</span></span><span class="sig-name descname"><span class="pre">ReplacePackage</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">oldname</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">newname</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#modulefinder.ReplacePackage" title="Link to this definition">¶</a></dt>234<dd><p>Allows specifying that the module named <em>oldname</em> is in fact the package named235<em>newname</em>.</p>236</dd></dl>237 238<dl class="py class">239<dt class="sig sig-object py" id="modulefinder.ModuleFinder">240<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">modulefinder.</span></span><span class="sig-name descname"><span class="pre">ModuleFinder</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">debug</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">excludes</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">[]</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">replace_paths</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">[]</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#modulefinder.ModuleFinder" title="Link to this definition">¶</a></dt>241<dd><p>This class provides <a class="reference internal" href="#modulefinder.ModuleFinder.run_script" title="modulefinder.ModuleFinder.run_script"><code class="xref py py-meth docutils literal notranslate"><span class="pre">run_script()</span></code></a> and <a class="reference internal" href="#modulefinder.ModuleFinder.report" title="modulefinder.ModuleFinder.report"><code class="xref py py-meth docutils literal notranslate"><span class="pre">report()</span></code></a> methods to determine242the set of modules imported by a script. <em>path</em> can be a list of directories to243search for modules; if not specified, <code class="docutils literal notranslate"><span class="pre">sys.path</span></code> is used.  <em>debug</em> sets the244debugging level; higher values make the class print debugging messages about245what it’s doing. <em>excludes</em> is a list of module names to exclude from the246analysis. <em>replace_paths</em> is a list of <code class="docutils literal notranslate"><span class="pre">(oldpath,</span> <span class="pre">newpath)</span></code> tuples that will247be replaced in module paths.</p>248<dl class="py method">249<dt class="sig sig-object py" id="modulefinder.ModuleFinder.report">250<span class="sig-name descname"><span class="pre">report</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#modulefinder.ModuleFinder.report" title="Link to this definition">¶</a></dt>251<dd><p>Print a report to standard output that lists the modules imported by the252script and their paths, as well as modules that are missing or seem to be253missing.</p>254</dd></dl>255 256<dl class="py method">257<dt class="sig sig-object py" id="modulefinder.ModuleFinder.run_script">258<span class="sig-name descname"><span class="pre">run_script</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pathname</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#modulefinder.ModuleFinder.run_script" title="Link to this definition">¶</a></dt>259<dd><p>Analyze the contents of the <em>pathname</em> file, which must contain Python260code.</p>261</dd></dl>262 263<dl class="py attribute">264<dt class="sig sig-object py" id="modulefinder.ModuleFinder.modules">265<span class="sig-name descname"><span class="pre">modules</span></span><a class="headerlink" href="#modulefinder.ModuleFinder.modules" title="Link to this definition">¶</a></dt>266<dd><p>A dictionary mapping module names to modules. See267<a class="reference internal" href="#modulefinder-example"><span class="std std-ref">Example usage of ModuleFinder</span></a>.</p>268</dd></dl>269 270</dd></dl>271 272<section id="example-usage-of-modulefinder">273<span id="modulefinder-example"></span><h2>Example usage of <a class="reference internal" href="#modulefinder.ModuleFinder" title="modulefinder.ModuleFinder"><code class="xref py py-class docutils literal notranslate"><span class="pre">ModuleFinder</span></code></a><a class="headerlink" href="#example-usage-of-modulefinder" title="Link to this heading">¶</a></h2>274<p>The script that is going to get analyzed later on (bacon.py):</p>275<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span><span class="w"> </span><span class="nn">re</span><span class="o">,</span><span class="w"> </span><span class="nn">itertools</span>276 277<span class="k">try</span><span class="p">:</span>278    <span class="kn">import</span><span class="w"> </span><span class="nn">baconhameggs</span>279<span class="k">except</span> <span class="ne">ImportError</span><span class="p">:</span>280    <span class="k">pass</span>281 282<span class="k">try</span><span class="p">:</span>283    <span class="kn">import</span><span class="w"> </span><span class="nn">guido.python.ham</span>284<span class="k">except</span> <span class="ne">ImportError</span><span class="p">:</span>285    <span class="k">pass</span>286</pre></div>287</div>288<p>The script that will output the report of bacon.py:</p>289<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span><span class="w"> </span><span class="nn">modulefinder</span><span class="w"> </span><span class="kn">import</span> <span class="n">ModuleFinder</span>290 291<span class="n">finder</span> <span class="o">=</span> <span class="n">ModuleFinder</span><span class="p">()</span>292<span class="n">finder</span><span class="o">.</span><span class="n">run_script</span><span class="p">(</span><span class="s1">&#39;bacon.py&#39;</span><span class="p">)</span>293 294<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Loaded modules:&#39;</span><span class="p">)</span>295<span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">mod</span> <span class="ow">in</span> <span class="n">finder</span><span class="o">.</span><span class="n">modules</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>296    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;</span><span class="si">%s</span><span class="s1">: &#39;</span> <span class="o">%</span> <span class="n">name</span><span class="p">,</span> <span class="n">end</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">)</span>297    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;,&#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="nb">list</span><span class="p">(</span><span class="n">mod</span><span class="o">.</span><span class="n">globalnames</span><span class="o">.</span><span class="n">keys</span><span class="p">())[:</span><span class="mi">3</span><span class="p">]))</span>298 299<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;-&#39;</span><span class="o">*</span><span class="mi">50</span><span class="p">)</span>300<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Modules not imported:&#39;</span><span class="p">)</span>301<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;</span><span class="se">\n</span><span class="s1">&#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">finder</span><span class="o">.</span><span class="n">badmodules</span><span class="o">.</span><span class="n">keys</span><span class="p">()))</span>302</pre></div>303</div>304<p>Sample output (may vary depending on the architecture):</p>305<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="n">Loaded</span> <span class="n">modules</span><span class="p">:</span>306<span class="n">_types</span><span class="p">:</span>307<span class="n">copyreg</span><span class="p">:</span>  <span class="n">_inverted_registry</span><span class="p">,</span><span class="n">_slotnames</span><span class="p">,</span><span class="n">__all__</span>308<span class="n">re</span><span class="o">.</span><span class="n">_compiler</span><span class="p">:</span>  <span class="n">isstring</span><span class="p">,</span><span class="n">_sre</span><span class="p">,</span><span class="n">_optimize_unicode</span>309<span class="n">_sre</span><span class="p">:</span>310<span class="n">re</span><span class="o">.</span><span class="n">_constants</span><span class="p">:</span>  <span class="n">REPEAT_ONE</span><span class="p">,</span><span class="n">makedict</span><span class="p">,</span><span class="n">AT_END_LINE</span>311<span class="n">sys</span><span class="p">:</span>312<span class="n">re</span><span class="p">:</span>  <span class="vm">__module__</span><span class="p">,</span><span class="n">finditer</span><span class="p">,</span><span class="n">_expand</span>313<span class="n">itertools</span><span class="p">:</span>314<span class="n">__main__</span><span class="p">:</span>  <span class="n">re</span><span class="p">,</span><span class="n">itertools</span><span class="p">,</span><span class="n">baconhameggs</span>315<span class="n">re</span><span class="o">.</span><span class="n">_parser</span><span class="p">:</span>  <span class="n">_PATTERNENDERS</span><span class="p">,</span><span class="n">SRE_FLAG_UNICODE</span>316<span class="n">array</span><span class="p">:</span>317<span class="n">types</span><span class="p">:</span>  <span class="vm">__module__</span><span class="p">,</span><span class="n">IntType</span><span class="p">,</span><span class="n">TypeType</span>318<span class="o">---------------------------------------------------</span>319<span class="n">Modules</span> <span class="ow">not</span> <span class="n">imported</span><span class="p">:</span>320<span class="n">guido</span><span class="o">.</span><span class="n">python</span><span class="o">.</span><span class="n">ham</span>321<span class="n">baconhameggs</span>322</pre></div>323</div>324</section>325</section>326 327 328            <div class="clearer"></div>329          </div>330        </div>331      </div>332      <div class="sphinxsidebar" role="navigation" aria-label="Main">333        <div class="sphinxsidebarwrapper">334  <div>335    <h3><a href="../contents.html">Table of Contents</a></h3>336    <ul>337<li><a class="reference internal" href="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">modulefinder</span></code> — Find modules used by a script</a><ul>338<li><a class="reference internal" href="#example-usage-of-modulefinder">Example usage of <code class="xref py py-class docutils literal notranslate"><span class="pre">ModuleFinder</span></code></a></li>339</ul>340</li>341</ul>342 343  </div>344  <div>345    <h4>Previous topic</h4>346    <p class="topless"><a href="pkgutil.html"347                          title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pkgutil</span></code> — Package extension utility</a></p>348  </div>349  <div>350    <h4>Next topic</h4>351    <p class="topless"><a href="runpy.html"352                          title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">runpy</span></code> — Locating and executing Python modules</a></p>353  </div>354  <script>355    document.addEventListener('DOMContentLoaded', () => {356        const title = document.querySelector('meta[property="og:title"]').content;357        const elements = document.querySelectorAll('.improvepage');358        const pageurl = window.location.href.split('?')[0];359        elements.forEach(element => {360            const url = new URL(element.href.split('?')[0].replace("-nojs", ""));361            url.searchParams.set('pagetitle', title);362            url.searchParams.set('pageurl', pageurl);363            url.searchParams.set('pagesource', "library/modulefinder.rst");364            element.href = url.toString();365        });366    });367  </script>368  <div role="note" aria-label="source link">369    <h3>This page</h3>370    <ul class="this-page-menu">371      <li><a href="../bugs.html">Report a bug</a></li>372      <li><a class="improvepage" href="../improve-page-nojs.html">Improve this page</a></li>373      <li>374        <a href="https://github.com/python/cpython/blob/main/Doc/library/modulefinder.rst?plain=1"375            rel="nofollow">Show source376        </a>377      </li>378      379    </ul>380  </div>381        </div>382<div id="sidebarbutton" title="Collapse sidebar">383<span>«</span>384</div>385 386      </div>387      <div class="clearer"></div>388    </div>  389    <div class="related" role="navigation" aria-label="Related">390      <h3>Navigation</h3>391      <ul>392        <li class="right" style="margin-right: 10px">393          <a href="../genindex.html" title="General Index"394             >index</a></li>395        <li class="right" >396          <a href="../py-modindex.html" title="Python Module Index"397             >modules</a> |</li>398        <li class="right" >399          <a href="runpy.html" title="runpy — Locating and executing Python modules"400             >next</a> |</li>401        <li class="right" >402          <a href="pkgutil.html" title="pkgutil — Package extension utility"403             >previous</a> |</li>404 405          <li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"></li>406          <li><a href="https://www.python.org/">Python</a> &#187;</li>407          <li class="switchers">408            <div class="language_switcher_placeholder"></div>409            <div class="version_switcher_placeholder"></div>410          </li>411          <li>412              413          </li>414    <li id="cpython-language-and-version">415      <a href="../index.html">3.15.0a6 Documentation</a> &#187;416    </li>417 418          <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>419          <li class="nav-item nav-item-2"><a href="modules.html" >Importing Modules</a> &#187;</li>420        <li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">modulefinder</span></code> — Find modules used by a script</a></li>421                <li class="right">422                    423 424    <div class="inline-search" role="search">425        <form class="inline-search" action="../search.html" method="get">426          <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box">427          <input type="submit" value="Go">428        </form>429    </div>430                     |431                </li>432            <li class="right">433<label class="theme-selector-label">434    Theme435    <select class="theme-selector" oninput="activateTheme(this.value)">436        <option value="auto" selected>Auto</option>437        <option value="light">Light</option>438        <option value="dark">Dark</option>439    </select>440</label> |</li>441            442      </ul>443    </div>  444    <div class="footer">445    &copy; <a href="../copyright.html">Copyright</a> 2001 Python Software Foundation.446    <br>447    This page is licensed under the Python Software Foundation License Version 2.448    <br>449    Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.450    <br>451    452      See <a href="/license.html">History and License</a> for more information.<br>453    454    455    <br>456 457    The Python Software Foundation is a non-profit corporation.458<a href="https://www.python.org/psf/donations/">Please donate.</a>459<br>460    <br>461      Last updated on Mar 10, 2026 (08:58 UTC).462    463      <a href="/bugs.html">Found a bug</a>?464    465    <br>466 467    Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.2.3.468    </div>469 470  </body>471</html>