Skip to content

Commit 4274e46

Browse files
committed
Indentation of comments
1 parent e6c64d7 commit 4274e46

File tree

2 files changed

+51
-47
lines changed

2 files changed

+51
-47
lines changed

README.md

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -746,10 +746,10 @@ Inline
746746

747747
### Comprehension
748748
```python
749-
<list> = [i+1 for i in range(10)] # [1, 2, ..., 10]
750-
<set> = {i for i in range(10) if i > 5} # {6, 7, 8, 9}
751-
<iter> = (i+5 for i in range(10)) # (5, 6, ..., 14)
752-
<dict> = {i: i*2 for i in range(10)} # {0: 0, 1: 2, ..., 9: 18}
749+
<list> = [i+1 for i in range(10)] # [1, 2, ..., 10]
750+
<set> = {i for i in range(10) if i > 5} # {6, 7, 8, 9}
751+
<iter> = (i+5 for i in range(10)) # (5, 6, ..., 14)
752+
<dict> = {i: i*2 for i in range(10)} # {0: 0, 1: 2, ..., 9: 18}
753753
```
754754

755755
```python
@@ -774,8 +774,8 @@ from functools import reduce
774774

775775
### Any, All
776776
```python
777-
<bool> = any(<collection>) # False if empty.
778-
<bool> = all(el[1] for el in <collection>) # True if empty.
777+
<bool> = any(<collection>) # False if empty.
778+
<bool> = all(el[1] for el in <collection>) # True if empty.
779779
```
780780

781781
### If - Else
@@ -1589,30 +1589,33 @@ Command Execution
15891589

15901590
```python
15911591
import os
1592-
os.chdir(<path>) # Changes the current working directory.
1593-
<str> = os.getcwd() # Returns current working directory.
1592+
os.chdir(<path>) # Changes the current working directory.
1593+
<str> = os.getcwd() # Returns current working directory.
15941594
```
15951595

15961596
```python
1597-
os.remove(<path>) # Deletes the file.
1598-
os.rmdir(<path>) # Deletes empty directory.
1599-
shutil.rmtree(<path>) # Deletes an entire directory tree.
1597+
os.remove(<path>) # Deletes the file.
1598+
os.rmdir(<path>) # Deletes empty directory.
1599+
shutil.rmtree(<path>) # Deletes an entire directory tree.
16001600
```
16011601

16021602
```python
1603-
os.rename(from, to) # Renames the file or directory.
1604-
os.replace(from, to) # Same, but overwrites 'to' if it exists.
1603+
os.rename(from, to) # Renames the file or directory.
1604+
os.replace(from, to) # Same, but overwrites 'to' if it exists.
16051605
```
16061606

16071607
```python
1608-
os.mkdir(<path>, mode=0o777) # Creates a directory.
1609-
<iter> = os.scandir(path='.') # Returns os.DirEntry objects located at path.
1608+
os.mkdir(<path>, mode=0o777) # Creates a directory.
1609+
<iter> = os.scandir(path='.') # Returns os.DirEntry objects located at path.
16101610
```
16111611

16121612
#### DirEntry:
16131613
```python
1614-
<str> = <DirEntry>.name # Final component of the path.
1615-
<str> = <DirEntry>.path # Path with final component.
1614+
<str> = <DirEntry>.name # Final component of the path.
1615+
<str> = <DirEntry>.path # Path with final component.
1616+
```
1617+
1618+
```python
16161619
<bool> = <DirEntry>.is_file()
16171620
<bool> = <DirEntry>.is_dir()
16181621
<bool> = <DirEntry>.is_symlink()
@@ -1900,8 +1903,8 @@ from collections import deque
19001903
```python
19011904
<deque>.appendleft(<el>)
19021905
<el> = <deque>.popleft()
1903-
<deque>.extendleft(<collection>) # Collection gets reversed.
1904-
<deque>.rotate(n=1) # Rotates elements to the right.
1906+
<deque>.extendleft(<collection>) # Collection gets reversed.
1907+
<deque>.rotate(n=1) # Rotates elements to the right.
19051908
```
19061909

19071910
```python
@@ -2156,10 +2159,10 @@ Plot
21562159
```python
21572160
# $ pip3 install matplotlib
21582161
from matplotlib import pyplot
2159-
pyplot.plot(<data_1> [, <data_2>, ...]) # Or: hist, pie, ...
2162+
pyplot.plot(<data_1> [, <data_2>, ...]) # Or: hist(<data>).
21602163
pyplot.savefig(<filename>)
21612164
pyplot.show()
2162-
pyplot.clf() # Clears figure.
2165+
pyplot.clf() # Clears figure.
21632166
```
21642167

21652168

@@ -2321,15 +2324,15 @@ Profile
23212324
### Basic
23222325
```python
23232326
from time import time
2324-
start_time = time() # Seconds since Epoch.
2327+
start_time = time() # Seconds since Epoch.
23252328
...
23262329
duration = time() - start_time
23272330
```
23282331

23292332
### High Performance
23302333
```python
23312334
from time import perf_counter as pc
2332-
start_time = pc() # Seconds since restart.
2335+
start_time = pc() # Seconds since restart.
23332336
...
23342337
duration = pc() - start_time
23352338
```

index.html

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -745,10 +745,10 @@ <h3 id="lambda">Lambda</h3>
745745
&lt;function&gt; = <span class="hljs-keyword">lambda</span> &lt;argument_1&gt;, &lt;argument_2&gt;: &lt;return_value&gt;
746746
</code></pre>
747747
<h3 id="comprehension">Comprehension</h3>
748-
<pre><code class="python language-python hljs">&lt;list&gt; = [i+<span class="hljs-number">1</span> <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> range(<span class="hljs-number">10</span>)] <span class="hljs-comment"># [1, 2, ..., 10]</span>
749-
&lt;set&gt; = {i <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> range(<span class="hljs-number">10</span>) <span class="hljs-keyword">if</span> i &gt; <span class="hljs-number">5</span>} <span class="hljs-comment"># {6, 7, 8, 9}</span>
750-
&lt;iter&gt; = (i+<span class="hljs-number">5</span> <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> range(<span class="hljs-number">10</span>)) <span class="hljs-comment"># (5, 6, ..., 14)</span>
751-
&lt;dict&gt; = {i: i*<span class="hljs-number">2</span> <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> range(<span class="hljs-number">10</span>)} <span class="hljs-comment"># {0: 0, 1: 2, ..., 9: 18}</span>
748+
<pre><code class="python language-python hljs">&lt;list&gt; = [i+<span class="hljs-number">1</span> <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> range(<span class="hljs-number">10</span>)] <span class="hljs-comment"># [1, 2, ..., 10]</span>
749+
&lt;set&gt; = {i <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> range(<span class="hljs-number">10</span>) <span class="hljs-keyword">if</span> i &gt; <span class="hljs-number">5</span>} <span class="hljs-comment"># {6, 7, 8, 9}</span>
750+
&lt;iter&gt; = (i+<span class="hljs-number">5</span> <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> range(<span class="hljs-number">10</span>)) <span class="hljs-comment"># (5, 6, ..., 14)</span>
751+
&lt;dict&gt; = {i: i*<span class="hljs-number">2</span> <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> range(<span class="hljs-number">10</span>)} <span class="hljs-comment"># {0: 0, 1: 2, ..., 9: 18}</span>
752752
</code></pre>
753753
<pre><code class="python language-python hljs">out = [i+j <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> range(<span class="hljs-number">10</span>) <span class="hljs-keyword">for</span> j <span class="hljs-keyword">in</span> range(<span class="hljs-number">10</span>)]
754754
</code></pre>
@@ -765,8 +765,8 @@ <h3 id="mapfilterreduce">Map, Filter, Reduce</h3>
765765
&lt;int&gt; = reduce(<span class="hljs-keyword">lambda</span> out, x: out + x, range(<span class="hljs-number">10</span>)) <span class="hljs-comment"># 45</span>
766766
</code></pre>
767767
<h3 id="anyall">Any, All</h3>
768-
<pre><code class="python language-python hljs">&lt;bool&gt; = any(&lt;collection&gt;) <span class="hljs-comment"># False if empty.</span>
769-
&lt;bool&gt; = all(el[<span class="hljs-number">1</span>] <span class="hljs-keyword">for</span> el <span class="hljs-keyword">in</span> &lt;collection&gt;) <span class="hljs-comment"># True if empty.</span>
768+
<pre><code class="python language-python hljs">&lt;bool&gt; = any(&lt;collection&gt;) <span class="hljs-comment"># False if empty.</span>
769+
&lt;bool&gt; = all(el[<span class="hljs-number">1</span>] <span class="hljs-keyword">for</span> el <span class="hljs-keyword">in</span> &lt;collection&gt;) <span class="hljs-comment"># True if empty.</span>
770770
</code></pre>
771771
<h3 id="ifelse">If - Else</h3>
772772
<pre><code class="python language-python hljs">&lt;expression_if_true&gt; <span class="hljs-keyword">if</span> &lt;condition&gt; <span class="hljs-keyword">else</span> &lt;expression_if_false&gt;
@@ -1431,23 +1431,24 @@ <h3 id="filesanddirectoriescommands">Files and Directories Commands</h3>
14311431
<li><strong>All exceptions are either 'OSError' or its subclasses.</strong></li>
14321432
</ul>
14331433
<pre><code class="python language-python hljs"><span class="hljs-keyword">import</span> os
1434-
os.chdir(&lt;path&gt;) <span class="hljs-comment"># Changes the current working directory.</span>
1435-
&lt;str&gt; = os.getcwd() <span class="hljs-comment"># Returns current working directory.</span>
1434+
os.chdir(&lt;path&gt;) <span class="hljs-comment"># Changes the current working directory.</span>
1435+
&lt;str&gt; = os.getcwd() <span class="hljs-comment"># Returns current working directory.</span>
14361436
</code></pre>
1437-
<pre><code class="python language-python hljs">os.remove(&lt;path&gt;) <span class="hljs-comment"># Deletes the file.</span>
1438-
os.rmdir(&lt;path&gt;) <span class="hljs-comment"># Deletes empty directory.</span>
1439-
shutil.rmtree(&lt;path&gt;) <span class="hljs-comment"># Deletes an entire directory tree.</span>
1437+
<pre><code class="python language-python hljs">os.remove(&lt;path&gt;) <span class="hljs-comment"># Deletes the file.</span>
1438+
os.rmdir(&lt;path&gt;) <span class="hljs-comment"># Deletes empty directory.</span>
1439+
shutil.rmtree(&lt;path&gt;) <span class="hljs-comment"># Deletes an entire directory tree.</span>
14401440
</code></pre>
1441-
<pre><code class="python language-python hljs">os.rename(<span class="hljs-keyword">from</span>, to) <span class="hljs-comment"># Renames the file or directory.</span>
1442-
os.replace(<span class="hljs-keyword">from</span>, to) <span class="hljs-comment"># Same, but overwrites 'to' if it exists.</span>
1441+
<pre><code class="python language-python hljs">os.rename(<span class="hljs-keyword">from</span>, to) <span class="hljs-comment"># Renames the file or directory.</span>
1442+
os.replace(<span class="hljs-keyword">from</span>, to) <span class="hljs-comment"># Same, but overwrites 'to' if it exists.</span>
14431443
</code></pre>
1444-
<pre><code class="python language-python hljs">os.mkdir(&lt;path&gt;, mode=<span class="hljs-number">0o777</span>) <span class="hljs-comment"># Creates a directory.</span>
1445-
&lt;iter&gt; = os.scandir(path=<span class="hljs-string">'.'</span>) <span class="hljs-comment"># Returns os.DirEntry objects located at path.</span>
1444+
<pre><code class="python language-python hljs">os.mkdir(&lt;path&gt;, mode=<span class="hljs-number">0o777</span>) <span class="hljs-comment"># Creates a directory.</span>
1445+
&lt;iter&gt; = os.scandir(path=<span class="hljs-string">'.'</span>) <span class="hljs-comment"># Returns os.DirEntry objects located at path.</span>
14461446
</code></pre>
14471447
<h4 id="direntry">DirEntry:</h4>
1448-
<pre><code class="python language-python hljs">&lt;str&gt; = &lt;DirEntry&gt;.name <span class="hljs-comment"># Final component of the path.</span>
1449-
&lt;str&gt; = &lt;DirEntry&gt;.path <span class="hljs-comment"># Path with final component.</span>
1450-
&lt;bool&gt; = &lt;DirEntry&gt;.is_file()
1448+
<pre><code class="python language-python hljs">&lt;str&gt; = &lt;DirEntry&gt;.name <span class="hljs-comment"># Final component of the path.</span>
1449+
&lt;str&gt; = &lt;DirEntry&gt;.path <span class="hljs-comment"># Path with final component.</span>
1450+
</code></pre>
1451+
<pre><code class="python language-python hljs">&lt;bool&gt; = &lt;DirEntry&gt;.is_file()
14511452
&lt;bool&gt; = &lt;DirEntry&gt;.is_dir()
14521453
&lt;bool&gt; = &lt;DirEntry&gt;.is_symlink()
14531454
&lt;Path&gt; = Path(&lt;DirEntry&gt;)
@@ -1667,8 +1668,8 @@ <h2 id="deque"><a href="#deque" name="deque">#</a>Deque</h2>
16671668
</code></pre>
16681669
<pre><code class="python language-python hljs">&lt;deque&gt;.appendleft(&lt;el&gt;)
16691670
&lt;el&gt; = &lt;deque&gt;.popleft()
1670-
&lt;deque&gt;.extendleft(&lt;collection&gt;) <span class="hljs-comment"># Collection gets reversed.</span>
1671-
&lt;deque&gt;.rotate(n=<span class="hljs-number">1</span>) <span class="hljs-comment"># Rotates elements to the right.</span>
1671+
&lt;deque&gt;.extendleft(&lt;collection&gt;) <span class="hljs-comment"># Collection gets reversed.</span>
1672+
&lt;deque&gt;.rotate(n=<span class="hljs-number">1</span>) <span class="hljs-comment"># Rotates elements to the right.</span>
16721673
</code></pre>
16731674
<pre><code class="python language-python hljs"><span class="hljs-meta">&gt;&gt;&gt; </span>a = deque([<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>], maxlen=<span class="hljs-number">3</span>)
16741675
<span class="hljs-meta">&gt;&gt;&gt; </span>a.append(<span class="hljs-number">4</span>)
@@ -1854,10 +1855,10 @@ <h2 id="progressbar"><a href="#progressbar" name="progressbar">#</a>Progress Bar
18541855
<h2 id="plot"><a href="#plot" name="plot">#</a>Plot</h2>
18551856
<pre><code class="python language-python hljs"><span class="hljs-comment"># $ pip3 install matplotlib</span>
18561857
<span class="hljs-keyword">from</span> matplotlib <span class="hljs-keyword">import</span> pyplot
1857-
pyplot.plot(&lt;data_1&gt; [, &lt;data_2&gt;, ...]) <span class="hljs-comment"># Or: hist, pie, ...</span>
1858+
pyplot.plot(&lt;data_1&gt; [, &lt;data_2&gt;, ...]) <span class="hljs-comment"># Or: hist(&lt;data&gt;).</span>
18581859
pyplot.savefig(&lt;filename&gt;)
18591860
pyplot.show()
1860-
pyplot.clf() <span class="hljs-comment"># Clears figure.</span>
1861+
pyplot.clf() <span class="hljs-comment"># Clears figure.</span>
18611862
</code></pre>
18621863
<h2 id="table"><a href="#table" name="table">#</a>Table</h2>
18631864
<h4 id="printsacsvfileasanasciitable">Prints a CSV file as an ASCII table:</h4>
@@ -1982,13 +1983,13 @@ <h4 id="test">Test:</h4>
19821983
<h2 id="profile"><a href="#profile" name="profile">#</a>Profile</h2>
19831984
<h3 id="basic">Basic</h3>
19841985
<pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> time <span class="hljs-keyword">import</span> time
1985-
start_time = time() <span class="hljs-comment"># Seconds since Epoch.</span>
1986+
start_time = time() <span class="hljs-comment"># Seconds since Epoch.</span>
19861987
...
19871988
duration = time() - start_time
19881989
</code></pre>
19891990
<h3 id="highperformance">High Performance</h3>
19901991
<pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> time <span class="hljs-keyword">import</span> perf_counter <span class="hljs-keyword">as</span> pc
1991-
start_time = pc() <span class="hljs-comment"># Seconds since restart.</span>
1992+
start_time = pc() <span class="hljs-comment"># Seconds since restart.</span>
19921993
...
19931994
duration = pc() - start_time
19941995
</code></pre>

0 commit comments

Comments
 (0)