Skip to content

Commit

Permalink
[autofix.ci] apply automated fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
autofix-ci[bot] authored Dec 13, 2023
1 parent 00f9e1b commit 1139db7
Showing 1 changed file with 37 additions and 35 deletions.
72 changes: 37 additions & 35 deletions test/testdata/type_checking_imports.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,40 +60,42 @@ <h1 class="modulename">
</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a>
</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">import</span> <span class="nn">typing</span>
</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">TYPE_CHECKING</span>
</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="kn">import</span> <span class="nn">type_checking_imports2</span>
</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a>
</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="k">if</span> <span class="n">typing</span><span class="o">.</span><span class="n">TYPE_CHECKING</span><span class="p">:</span>
</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a> <span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">Sequence</span>
</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a>
</span><span id="L-10"><a href="#L-10"><span class="linenos">10</span></a><span class="k">if</span> <span class="n">TYPE_CHECKING</span><span class="p">:</span>
</span><span id="L-11"><a href="#L-11"><span class="linenos">11</span></a> <span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">Dict</span>
</span><span id="L-12"><a href="#L-12"><span class="linenos">12</span></a> <span class="kn">from</span> <span class="nn">type_checking_imports2</span> <span class="kn">import</span> <span class="n">StrOrInt</span> <span class="c1"># in module cache</span>
</span><span id="L-13"><a href="#L-13"><span class="linenos">13</span></a> <span class="kn">from</span> <span class="nn">type_checking_imports4</span> <span class="kn">import</span> <span class="n">StrOrBool</span> <span class="c1"># not in module cache</span>
</span><span id="L-14"><a href="#L-14"><span class="linenos">14</span></a>
</span><span id="L-15"><a href="#L-15"><span class="linenos">15</span></a><span class="k">assert</span> <span class="n">type_checking_imports2</span>
</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a>
</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a><span class="kn">import</span> <span class="nn">type_checking_imports2</span>
</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a>
</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a><span class="k">if</span> <span class="n">typing</span><span class="o">.</span><span class="n">TYPE_CHECKING</span><span class="p">:</span>
</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a> <span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">Sequence</span>
</span><span id="L-10"><a href="#L-10"><span class="linenos">10</span></a>
</span><span id="L-11"><a href="#L-11"><span class="linenos">11</span></a><span class="k">if</span> <span class="n">TYPE_CHECKING</span><span class="p">:</span>
</span><span id="L-12"><a href="#L-12"><span class="linenos">12</span></a> <span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">Dict</span>
</span><span id="L-13"><a href="#L-13"><span class="linenos">13</span></a>
</span><span id="L-14"><a href="#L-14"><span class="linenos">14</span></a> <span class="kn">from</span> <span class="nn">type_checking_imports2</span> <span class="kn">import</span> <span class="n">StrOrInt</span> <span class="c1"># in module cache</span>
</span><span id="L-15"><a href="#L-15"><span class="linenos">15</span></a> <span class="kn">from</span> <span class="nn">type_checking_imports4</span> <span class="kn">import</span> <span class="n">StrOrBool</span> <span class="c1"># not in module cache</span>
</span><span id="L-16"><a href="#L-16"><span class="linenos">16</span></a>
</span><span id="L-17"><a href="#L-17"><span class="linenos">17</span></a>
</span><span id="L-18"><a href="#L-18"><span class="linenos">18</span></a><span class="k">def</span> <span class="nf">foo</span><span class="p">(</span><span class="n">a</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="nb">str</span><span class="p">],</span> <span class="n">b</span><span class="p">:</span> <span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">]):</span>
</span><span id="L-19"><a href="#L-19"><span class="linenos">19</span></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;A method with TYPE_CHECKING type annotations.&quot;&quot;&quot;</span>
</span><span id="L-20"><a href="#L-20"><span class="linenos">20</span></a>
</span><span id="L-21"><a href="#L-21"><span class="linenos">21</span></a>
</span><span id="L-22"><a href="#L-22"><span class="linenos">22</span></a><span class="n">var</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="nb">int</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
</span><span id="L-23"><a href="#L-23"><span class="linenos">23</span></a><span class="sd">&quot;&quot;&quot;A variable with TYPE_CHECKING type annotations.&quot;&quot;&quot;</span>
</span><span id="L-24"><a href="#L-24"><span class="linenos">24</span></a>
</span><span id="L-25"><a href="#L-25"><span class="linenos">25</span></a>
</span><span id="L-26"><a href="#L-26"><span class="linenos">26</span></a><span class="n">imported_from_cached_module</span><span class="p">:</span> <span class="n">StrOrInt</span> <span class="o">=</span> <span class="mi">42</span>
</span><span id="L-27"><a href="#L-27"><span class="linenos">27</span></a><span class="sd">&quot;&quot;&quot;</span>
</span><span id="L-28"><a href="#L-28"><span class="linenos">28</span></a><span class="sd">A variable with a type annotation that&#39;s imported from another file&#39;s TYPE_CHECKING block.</span>
</span><span id="L-29"><a href="#L-29"><span class="linenos">29</span></a>
</span><span id="L-30"><a href="#L-30"><span class="linenos">30</span></a><span class="sd">https://github.com/mitmproxy/pdoc/issues/648</span>
</span><span id="L-31"><a href="#L-31"><span class="linenos">31</span></a><span class="sd">&quot;&quot;&quot;</span>
</span><span id="L-32"><a href="#L-32"><span class="linenos">32</span></a>
</span><span id="L-33"><a href="#L-33"><span class="linenos">33</span></a><span class="n">imported_from_uncached_module</span><span class="p">:</span> <span class="n">StrOrBool</span> <span class="o">=</span> <span class="kc">True</span>
</span><span id="L-34"><a href="#L-34"><span class="linenos">34</span></a><span class="sd">&quot;&quot;&quot;</span>
</span><span id="L-35"><a href="#L-35"><span class="linenos">35</span></a><span class="sd">A variable with a type annotation that&#39;s imported from another file&#39;s TYPE_CHECKING block.</span>
</span><span id="L-36"><a href="#L-36"><span class="linenos">36</span></a>
</span><span id="L-37"><a href="#L-37"><span class="linenos">37</span></a><span class="sd">In this case, the module is not in sys.modules outside of TYPE_CHECKING.</span>
</span><span id="L-38"><a href="#L-38"><span class="linenos">38</span></a><span class="sd">&quot;&quot;&quot;</span>
</span><span id="L-17"><a href="#L-17"><span class="linenos">17</span></a><span class="k">assert</span> <span class="n">type_checking_imports2</span>
</span><span id="L-18"><a href="#L-18"><span class="linenos">18</span></a>
</span><span id="L-19"><a href="#L-19"><span class="linenos">19</span></a>
</span><span id="L-20"><a href="#L-20"><span class="linenos">20</span></a><span class="k">def</span> <span class="nf">foo</span><span class="p">(</span><span class="n">a</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="nb">str</span><span class="p">],</span> <span class="n">b</span><span class="p">:</span> <span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">]):</span>
</span><span id="L-21"><a href="#L-21"><span class="linenos">21</span></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;A method with TYPE_CHECKING type annotations.&quot;&quot;&quot;</span>
</span><span id="L-22"><a href="#L-22"><span class="linenos">22</span></a>
</span><span id="L-23"><a href="#L-23"><span class="linenos">23</span></a>
</span><span id="L-24"><a href="#L-24"><span class="linenos">24</span></a><span class="n">var</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="nb">int</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
</span><span id="L-25"><a href="#L-25"><span class="linenos">25</span></a><span class="sd">&quot;&quot;&quot;A variable with TYPE_CHECKING type annotations.&quot;&quot;&quot;</span>
</span><span id="L-26"><a href="#L-26"><span class="linenos">26</span></a>
</span><span id="L-27"><a href="#L-27"><span class="linenos">27</span></a>
</span><span id="L-28"><a href="#L-28"><span class="linenos">28</span></a><span class="n">imported_from_cached_module</span><span class="p">:</span> <span class="n">StrOrInt</span> <span class="o">=</span> <span class="mi">42</span>
</span><span id="L-29"><a href="#L-29"><span class="linenos">29</span></a><span class="sd">&quot;&quot;&quot;</span>
</span><span id="L-30"><a href="#L-30"><span class="linenos">30</span></a><span class="sd">A variable with a type annotation that&#39;s imported from another file&#39;s TYPE_CHECKING block.</span>
</span><span id="L-31"><a href="#L-31"><span class="linenos">31</span></a>
</span><span id="L-32"><a href="#L-32"><span class="linenos">32</span></a><span class="sd">https://github.com/mitmproxy/pdoc/issues/648</span>
</span><span id="L-33"><a href="#L-33"><span class="linenos">33</span></a><span class="sd">&quot;&quot;&quot;</span>
</span><span id="L-34"><a href="#L-34"><span class="linenos">34</span></a>
</span><span id="L-35"><a href="#L-35"><span class="linenos">35</span></a><span class="n">imported_from_uncached_module</span><span class="p">:</span> <span class="n">StrOrBool</span> <span class="o">=</span> <span class="kc">True</span>
</span><span id="L-36"><a href="#L-36"><span class="linenos">36</span></a><span class="sd">&quot;&quot;&quot;</span>
</span><span id="L-37"><a href="#L-37"><span class="linenos">37</span></a><span class="sd">A variable with a type annotation that&#39;s imported from another file&#39;s TYPE_CHECKING block.</span>
</span><span id="L-38"><a href="#L-38"><span class="linenos">38</span></a>
</span><span id="L-39"><a href="#L-39"><span class="linenos">39</span></a><span class="sd">In this case, the module is not in sys.modules outside of TYPE_CHECKING.</span>
</span><span id="L-40"><a href="#L-40"><span class="linenos">40</span></a><span class="sd">&quot;&quot;&quot;</span>
</span></pre></div>


Expand All @@ -109,8 +111,8 @@ <h1 class="modulename">

</div>
<a class="headerlink" href="#foo"></a>
<div class="pdoc-code codehilite"><pre><span></span><span id="foo-19"><a href="#foo-19"><span class="linenos">19</span></a><span class="k">def</span> <span class="nf">foo</span><span class="p">(</span><span class="n">a</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="nb">str</span><span class="p">],</span> <span class="n">b</span><span class="p">:</span> <span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">]):</span>
</span><span id="foo-20"><a href="#foo-20"><span class="linenos">20</span></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;A method with TYPE_CHECKING type annotations.&quot;&quot;&quot;</span>
<div class="pdoc-code codehilite"><pre><span></span><span id="foo-21"><a href="#foo-21"><span class="linenos">21</span></a><span class="k">def</span> <span class="nf">foo</span><span class="p">(</span><span class="n">a</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="nb">str</span><span class="p">],</span> <span class="n">b</span><span class="p">:</span> <span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">]):</span>
</span><span id="foo-22"><a href="#foo-22"><span class="linenos">22</span></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;A method with TYPE_CHECKING type annotations.&quot;&quot;&quot;</span>
</span></pre></div>


Expand Down

0 comments on commit 1139db7

Please sign in to comment.