File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -29,3 +29,8 @@ def greeting_with_type(name): # type: (str) -> str
2929 return ' Hello ' + name
3030
3131```
32+
33+
34+ ---
35+
36+ It depends on the ` Python ` plugin of intellij, and I think Pycharm also works.
Original file line number Diff line number Diff line change 55 <vendor email =" aristotll.good@gmail.com" >aristotll</vendor >
66
77 <description ><![CDATA[
8-
8+ <article class="markdown-body entry-content" itemprop="text"><h1><a id="user-content-readme" class="anchor" href="#readme" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>README</h1>
9+ <hr>
10+ <p>Using intellij to infer Python typing and</p>
11+ <p>add type comments using the <code>typing</code> module.</p>
12+ <p>See more from <a href="https://www.jetbrains.com/help/pycharm/2017.1/type-hinting-in-pycharm.html">https://www.jetbrains.com/help/pycharm/2017.1/type-hinting-in-pycharm.html</a></p>
13+ <hr>
14+ <p>Move cursor to the element, and press <code>ctrl shift Y</code> to add the type comments.</p>
15+ <p><a href="/aristotll/python-typing-adder/blob/master/imgs/typing-comments-added.gif" target="_blank"><img src="https://raw.githubusercontent.com/aristotll/python-typing-adder/master/imgs/typing-comments-added.gif" alt="typing-comments-added" style="max-width:100%;"></a></p>
16+ <hr>
17+ <p>Before:</p>
18+ <div class="highlight highlight-source-python"><pre><span class="pl-k">def</span> <span class="pl-en">greeting_with_type</span>(<span class="pl-smi">name</span>):
19+ <span class="pl-k">return</span> <span class="pl-s"><span class="pl-pds">'</span>Hello <span class="pl-pds">'</span></span> <span class="pl-k">+</span> name</pre></div>
20+ <p>After:</p>
21+ <div class="highlight highlight-source-python"><pre><span class="pl-k">def</span> <span class="pl-en">greeting_with_type</span>(<span class="pl-smi">name</span>): <span class="pl-c"># <span class="pl-c">type:</span> <span class="pl-c">(</span><span class="pl-c">str</span><span class="pl-c">)</span> <span class="pl-c">-></span> <span class="pl-c">str</span></span>
22+ <span class="pl-k">return</span> <span class="pl-s"><span class="pl-pds">'</span>Hello <span class="pl-pds">'</span></span> <span class="pl-k">+</span> name
23+ </pre></div>
24+ </article>
925
1026 ]]> </description >
1127
You can’t perform that action at this time.
0 commit comments