Skip to content

Commit f36224c

Browse files
committed
Small fixes
1 parent b3c223e commit f36224c

File tree

2 files changed

+38
-38
lines changed

2 files changed

+38
-38
lines changed

README.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -379,9 +379,9 @@ import re
379379
* **By default digits, whitespaces and alphanumerics from all alphabets are matched, unless `'flags=re.ASCII'` argument is used.**
380380
* **Use capital letter for negation.**
381381
```python
382-
'\d' == '[0-9]' # Digit
383-
'\s' == '[ \t\n\r\f\v]' # Whitespace
384-
'\w' == '[a-zA-Z0-9_]' # Alphanumeric
382+
'\d' == '[0-9]' # Matches any digit.
383+
'\s' == '[ \t\n\r\f\v]' # Matches any whitespace.
384+
'\w' == '[a-zA-Z0-9_]' # Matches any alphanumeric.
385385
```
386386

387387

@@ -1303,11 +1303,11 @@ class <enum_name>(Enum):
13031303
* **Otherwise it returns an increment of the last numeric value.**
13041304

13051305
```python
1306-
<member> = <enum>.<member_name> # Returns a member.
1307-
<member> = <enum>['<member_name>'] # Returns a member or raises KeyError.
1308-
<member> = <enum>(<value>) # Returns a member or raises ValueError.
1309-
name = <member>.name
1310-
value = <member>.value
1306+
<member> = <enum>.<member_name> # Returns a member.
1307+
<member> = <enum>['<member_name>'] # Returns a member or raises KeyError.
1308+
<member> = <enum>(<value>) # Returns a member or raises ValueError.
1309+
<str> = <member>.name # Returns member's name.
1310+
<obj> = <member>.value # Returns member's value.
13111311
```
13121312

13131313
```python
@@ -2094,9 +2094,9 @@ Introspection
20942094

20952095
### Variables
20962096
```python
2097-
<list> = dir() # Names of variables in current scope.
2098-
<dict> = locals() # Dict of local variables. Also vars().
2099-
<dict> = globals() # Dict of global variables.
2097+
<list> = dir() # Returns names of variables in current scope.
2098+
<dict> = locals() # Returns dict of local variables. Also vars().
2099+
<dict> = globals() # Returns dict of global variables.
21002100
```
21012101

21022102
### Attributes
@@ -2168,8 +2168,8 @@ class MyClass(metaclass=MyMetaClass):
21682168

21692169
### Type Diagram
21702170
```python
2171-
type(MyClass) == MyMetaClass # MyClass is an instance of MyMetaClass.
2172-
type(MyMetaClass) == type # MyMetaClass is an instance of type.
2171+
type(MyClass) == MyMetaClass # MyClass is an instance of MyMetaClass.
2172+
type(MyMetaClass) == type # MyMetaClass is an instance of type.
21732173
```
21742174

21752175
```text
@@ -2186,8 +2186,8 @@ type(MyMetaClass) == type # MyMetaClass is an instance of type.
21862186

21872187
### Inheritance Diagram
21882188
```python
2189-
MyClass.__base__ == object # MyClass is a subclass of object.
2190-
MyMetaClass.__base__ == type # MyMetaClass is a subclass of type.
2189+
MyClass.__base__ == object # MyClass is a subclass of object.
2190+
MyMetaClass.__base__ == type # MyMetaClass is a subclass of type.
21912191
```
21922192

21932193
```text
@@ -2575,14 +2575,14 @@ indexes = <array>.argmin(axis)
25752575
**Broadcasting is a set of rules by which NumPy functions operate on arrays of different sizes and/or dimensions.**
25762576

25772577
```python
2578-
left = [[0.1], [0.6], [0.8]] # Shape: (3, 1)
2579-
right = [ 0.1 , 0.6 , 0.8 ] # Shape: (3)
2578+
left = [[0.1], [0.6], [0.8]] # Shape: (3, 1)
2579+
right = [ 0.1 , 0.6 , 0.8 ] # Shape: (3)
25802580
```
25812581

25822582
#### 1. If array shapes differ in length, left-pad the shorter shape with ones:
25832583
```python
2584-
left = [[0.1], [0.6], [0.8]] # Shape: (3, 1)
2585-
right = [[0.1 , 0.6 , 0.8]] # Shape: (1, 3) <- !
2584+
left = [[0.1], [0.6], [0.8]] # Shape: (3, 1)
2585+
right = [[0.1 , 0.6 , 0.8]] # Shape: (1, 3) <- !
25862586
```
25872587

25882588
#### 2. If any dimensions differ in size, expand the ones that have size 1 by duplicating their elements:

index.html

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -483,9 +483,9 @@
483483
<div><h3 id="specialsequences">Special Sequences</h3><ul>
484484
<li><strong>By default digits, whitespaces and alphanumerics from all alphabets are matched, unless <code class="python hljs"><span class="hljs-string">'flags=re.ASCII'</span></code> argument is used.</strong></li>
485485
<li><strong>Use capital letter for negation.</strong></li>
486-
</ul><pre><code class="python language-python hljs"><span class="hljs-string">'\d'</span> == <span class="hljs-string">'[0-9]'</span> <span class="hljs-comment"># Digit</span>
487-
<span class="hljs-string">'\s'</span> == <span class="hljs-string">'[ \t\n\r\f\v]'</span> <span class="hljs-comment"># Whitespace</span>
488-
<span class="hljs-string">'\w'</span> == <span class="hljs-string">'[a-zA-Z0-9_]'</span> <span class="hljs-comment"># Alphanumeric</span>
486+
</ul><pre><code class="python language-python hljs"><span class="hljs-string">'\d'</span> == <span class="hljs-string">'[0-9]'</span> <span class="hljs-comment"># Matches any digit.</span>
487+
<span class="hljs-string">'\s'</span> == <span class="hljs-string">'[ \t\n\r\f\v]'</span> <span class="hljs-comment"># Matches any whitespace.</span>
488+
<span class="hljs-string">'\w'</span> == <span class="hljs-string">'[a-zA-Z0-9_]'</span> <span class="hljs-comment"># Matches any alphanumeric.</span>
489489
</code></pre></div>
490490

491491

@@ -1232,11 +1232,11 @@
12321232
<li><strong>If there are no numeric values before auto(), it returns 1.</strong></li>
12331233
<li><strong>Otherwise it returns an increment of the last numeric value.</strong></li>
12341234
</ul>
1235-
<pre><code class="python language-python hljs">&lt;member&gt; = &lt;enum&gt;.&lt;member_name&gt; <span class="hljs-comment"># Returns a member.</span>
1236-
&lt;member&gt; = &lt;enum&gt;[<span class="hljs-string">'&lt;member_name&gt;'</span>] <span class="hljs-comment"># Returns a member or raises KeyError.</span>
1237-
&lt;member&gt; = &lt;enum&gt;(&lt;value&gt;) <span class="hljs-comment"># Returns a member or raises ValueError.</span>
1238-
name = &lt;member&gt;.name
1239-
value = &lt;member&gt;.value
1235+
<pre><code class="python language-python hljs">&lt;member&gt; = &lt;enum&gt;.&lt;member_name&gt; <span class="hljs-comment"># Returns a member.</span>
1236+
&lt;member&gt; = &lt;enum&gt;[<span class="hljs-string">'&lt;member_name&gt;'</span>] <span class="hljs-comment"># Returns a member or raises KeyError.</span>
1237+
&lt;member&gt; = &lt;enum&gt;(&lt;value&gt;) <span class="hljs-comment"># Returns a member or raises ValueError.</span>
1238+
&lt;str&gt; = &lt;member&gt;.name <span class="hljs-comment"># Returns member's name.</span>
1239+
&lt;obj&gt; = &lt;member&gt;.value <span class="hljs-comment"># Returns member's value.</span>
12401240
</code></pre>
12411241
<pre><code class="python language-python hljs">list_of_members = list(&lt;enum&gt;)
12421242
member_names = [a.name <span class="hljs-keyword">for</span> a <span class="hljs-keyword">in</span> &lt;enum&gt;]
@@ -1831,9 +1831,9 @@
18311831
LogicOp = enum.Enum(<span class="hljs-string">'LogicOp'</span>, {<span class="hljs-string">'AND'</span>: op.and_, <span class="hljs-string">'OR'</span> : op.or_})
18321832
last_el = op.methodcaller(<span class="hljs-string">'pop'</span>)(&lt;list&gt;)
18331833
</code></pre>
1834-
<div><h2 id="introspection"><a href="#introspection" name="introspection">#</a>Introspection</h2><p><strong>Inspecting code at runtime.</strong></p><div><h3 id="variables">Variables</h3><pre><code class="python language-python hljs">&lt;list&gt; = dir() <span class="hljs-comment"># Names of variables in current scope.</span>
1835-
&lt;dict&gt; = locals() <span class="hljs-comment"># Dict of local variables. Also vars().</span>
1836-
&lt;dict&gt; = globals() <span class="hljs-comment"># Dict of global variables.</span>
1834+
<div><h2 id="introspection"><a href="#introspection" name="introspection">#</a>Introspection</h2><p><strong>Inspecting code at runtime.</strong></p><div><h3 id="variables">Variables</h3><pre><code class="python language-python hljs">&lt;list&gt; = dir() <span class="hljs-comment"># Returns names of variables in current scope.</span>
1835+
&lt;dict&gt; = locals() <span class="hljs-comment"># Returns dict of local variables. Also vars().</span>
1836+
&lt;dict&gt; = globals() <span class="hljs-comment"># Returns dict of global variables.</span>
18371837
</code></pre></div></div>
18381838

18391839

@@ -1884,8 +1884,8 @@
18841884
<pre><code class="python language-python hljs"><span class="hljs-meta">&gt;&gt;&gt; </span>MyClass.a, MyClass.b
18851885
(<span class="hljs-string">'abcde'</span>, <span class="hljs-number">12345</span>)
18861886
</code></pre>
1887-
<div><h3 id="typediagram">Type Diagram</h3><pre><code class="python language-python hljs">type(MyClass) == MyMetaClass <span class="hljs-comment"># MyClass is an instance of MyMetaClass.</span>
1888-
type(MyMetaClass) == type <span class="hljs-comment"># MyMetaClass is an instance of type.</span>
1887+
<div><h3 id="typediagram">Type Diagram</h3><pre><code class="python language-python hljs">type(MyClass) == MyMetaClass <span class="hljs-comment"># MyClass is an instance of MyMetaClass.</span>
1888+
type(MyMetaClass) == type <span class="hljs-comment"># MyMetaClass is an instance of type.</span>
18891889
</code></pre></div>
18901890

18911891
<pre><code class="text language-text">+-------------+-------------+
@@ -1898,8 +1898,8 @@
18981898
| str ---------+ |
18991899
+-------------+-------------+
19001900
</code></pre>
1901-
<div><h3 id="inheritancediagram">Inheritance Diagram</h3><pre><code class="python language-python hljs">MyClass.__base__ == object <span class="hljs-comment"># MyClass is a subclass of object.</span>
1902-
MyMetaClass.__base__ == type <span class="hljs-comment"># MyMetaClass is a subclass of type.</span>
1901+
<div><h3 id="inheritancediagram">Inheritance Diagram</h3><pre><code class="python language-python hljs">MyClass.__base__ == object <span class="hljs-comment"># MyClass is a subclass of object.</span>
1902+
MyMetaClass.__base__ == type <span class="hljs-comment"># MyMetaClass is a subclass of type.</span>
19031903
</code></pre></div>
19041904

19051905
<pre><code class="text language-text">+-------------+-------------+
@@ -2197,13 +2197,13 @@
21972197
<ul>
21982198
<li><strong>If row and column indexes differ in shape, they are combined with broadcasting.</strong></li>
21992199
</ul>
2200-
<div><h3 id="broadcasting">Broadcasting</h3><p><strong>Broadcasting is a set of rules by which NumPy functions operate on arrays of different sizes and/or dimensions.</strong></p><pre><code class="python language-python hljs">left = [[<span class="hljs-number">0.1</span>], [<span class="hljs-number">0.6</span>], [<span class="hljs-number">0.8</span>]] <span class="hljs-comment"># Shape: (3, 1)</span>
2201-
right = [ <span class="hljs-number">0.1</span> , <span class="hljs-number">0.6</span> , <span class="hljs-number">0.8</span> ] <span class="hljs-comment"># Shape: (3)</span>
2200+
<div><h3 id="broadcasting">Broadcasting</h3><p><strong>Broadcasting is a set of rules by which NumPy functions operate on arrays of different sizes and/or dimensions.</strong></p><pre><code class="python language-python hljs">left = [[<span class="hljs-number">0.1</span>], [<span class="hljs-number">0.6</span>], [<span class="hljs-number">0.8</span>]] <span class="hljs-comment"># Shape: (3, 1)</span>
2201+
right = [ <span class="hljs-number">0.1</span> , <span class="hljs-number">0.6</span> , <span class="hljs-number">0.8</span> ] <span class="hljs-comment"># Shape: (3)</span>
22022202
</code></pre></div>
22032203

22042204

2205-
<div><h4 id="1ifarrayshapesdifferinlengthleftpadtheshortershapewithones">1. If array shapes differ in length, left-pad the shorter shape with ones:</h4><pre><code class="python language-python hljs">left = [[<span class="hljs-number">0.1</span>], [<span class="hljs-number">0.6</span>], [<span class="hljs-number">0.8</span>]] <span class="hljs-comment"># Shape: (3, 1)</span>
2206-
right = [[<span class="hljs-number">0.1</span> , <span class="hljs-number">0.6</span> , <span class="hljs-number">0.8</span>]] <span class="hljs-comment"># Shape: (1, 3) &lt;- !</span>
2205+
<div><h4 id="1ifarrayshapesdifferinlengthleftpadtheshortershapewithones">1. If array shapes differ in length, left-pad the shorter shape with ones:</h4><pre><code class="python language-python hljs">left = [[<span class="hljs-number">0.1</span>], [<span class="hljs-number">0.6</span>], [<span class="hljs-number">0.8</span>]] <span class="hljs-comment"># Shape: (3, 1)</span>
2206+
right = [[<span class="hljs-number">0.1</span> , <span class="hljs-number">0.6</span> , <span class="hljs-number">0.8</span>]] <span class="hljs-comment"># Shape: (1, 3) &lt;- !</span>
22072207
</code></pre></div>
22082208

22092209
<div><h4 id="2ifanydimensionsdifferinsizeexpandtheonesthathavesize1byduplicatingtheirelements">2. If any dimensions differ in size, expand the ones that have size 1 by duplicating their elements:</h4><pre><code class="python language-python hljs">left = [[<span class="hljs-number">0.1</span>, <span class="hljs-number">0.1</span>, <span class="hljs-number">0.1</span>], [<span class="hljs-number">0.6</span>, <span class="hljs-number">0.6</span>, <span class="hljs-number">0.6</span>], [<span class="hljs-number">0.8</span>, <span class="hljs-number">0.8</span>, <span class="hljs-number">0.8</span>]] <span class="hljs-comment"># Shape: (3, 3) &lt;- !</span>

0 commit comments

Comments
 (0)