Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 63a85ba

Browse files
committed
Type, String
1 parent 019fa61 commit 63a85ba

File tree

3 files changed

+50
-6
lines changed

3 files changed

+50
-6
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ from types import FunctionType, MethodType, LambdaType, GeneratorType, ModuleTyp
262262
```
263263

264264
### Abstract Base Classes
265-
**Each abstract base class specifies a set of virtual subclasses. These classes are then recognized by isinstance() and issubclass() as subclasses of the ABC, although they are really not. ABC can also manually decide whether or not a specific class is its virtual subclass, usually based on which methods the class has implemented. For instance, Iterable ABC looks for method iter() while Collection ABC looks for methods iter(), contains() and len().**
265+
**Each abstract base class specifies a set of virtual subclasses. These classes are then recognized by isinstance() and issubclass() as subclasses of the ABC, although they are really not. ABC can also manually decide whether or not a specific class is its virtual subclass, usually based on which methods the class has implemented. For instance, Collection ABC looks for methods iter(), contains() and len(), while Iterable ABC only looks for method iter().**
266266

267267
```python
268268
>>> from collections.abc import Sequence, Collection, Iterable
@@ -318,7 +318,7 @@ String
318318
<bool> = <str>.startswith(<sub_str>) # Pass tuple of strings for multiple options.
319319
<bool> = <str>.endswith(<sub_str>) # Pass tuple of strings for multiple options.
320320
<int> = <str>.find(<sub_str>) # Returns start index of the first match or -1.
321-
<int> = <str>.index(<sub_str>) # Same but raises ValueError if missing.
321+
<int> = <str>.index(<sub_str>) # Same, but raises ValueError if missing.
322322
```
323323

324324
```python

index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
<body>
5656
<header>
57-
<aside>February 6, 2022</aside>
57+
<aside>February 13, 2022</aside>
5858
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
5959
</header>
6060

@@ -263,7 +263,7 @@
263263
<div><h4 id="sometypesdonothavebuiltinnamessotheymustbeimported">Some types do not have built-in names, so they must be imported:</h4><pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> types <span class="hljs-keyword">import</span> FunctionType, MethodType, LambdaType, GeneratorType, ModuleType
264264
</code></pre></div>
265265

266-
<div><h3 id="abstractbaseclasses">Abstract Base Classes</h3><p><strong>Each abstract base class specifies a set of virtual subclasses. These classes are then recognized by isinstance() and issubclass() as subclasses of the ABC, although they are really not. ABC can also manually decide whether or not a specific class is its virtual subclass, usually based on which methods the class has implemented. For instance, Iterable ABC looks for method iter() while Collection ABC looks for methods iter(), contains() and len().</strong></p><pre><code class="python language-python hljs"><span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> collections.abc <span class="hljs-keyword">import</span> Sequence, Collection, Iterable
266+
<div><h3 id="abstractbaseclasses">Abstract Base Classes</h3><p><strong>Each abstract base class specifies a set of virtual subclasses. These classes are then recognized by isinstance() and issubclass() as subclasses of the ABC, although they are really not. ABC can also manually decide whether or not a specific class is its virtual subclass, usually based on which methods the class has implemented. For instance, Collection ABC looks for methods iter(), contains() and len(), while Iterable ABC only looks for method iter().</strong></p><pre><code class="python language-python hljs"><span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> collections.abc <span class="hljs-keyword">import</span> Sequence, Collection, Iterable
267267
<span class="hljs-meta">&gt;&gt;&gt; </span>isinstance([<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>], Iterable)
268268
<span class="hljs-keyword">True</span>
269269
</code></pre></div>
@@ -304,7 +304,7 @@
304304
&lt;bool&gt; = &lt;str&gt;.startswith(&lt;sub_str&gt;) <span class="hljs-comment"># Pass tuple of strings for multiple options.</span>
305305
&lt;bool&gt; = &lt;str&gt;.endswith(&lt;sub_str&gt;) <span class="hljs-comment"># Pass tuple of strings for multiple options.</span>
306306
&lt;int&gt; = &lt;str&gt;.find(&lt;sub_str&gt;) <span class="hljs-comment"># Returns start index of the first match or -1.</span>
307-
&lt;int&gt; = &lt;str&gt;.index(&lt;sub_str&gt;) <span class="hljs-comment"># Same but raises ValueError if missing.</span>
307+
&lt;int&gt; = &lt;str&gt;.index(&lt;sub_str&gt;) <span class="hljs-comment"># Same, but raises ValueError if missing.</span>
308308
</code></pre>
309309
<pre><code class="python language-python hljs">&lt;str&gt; = &lt;str&gt;.replace(old, new [, count]) <span class="hljs-comment"># Replaces 'old' with 'new' at most 'count' times.</span>
310310
&lt;str&gt; = &lt;str&gt;.translate(&lt;table&gt;) <span class="hljs-comment"># Use `str.maketrans(&lt;dict&gt;)` to generate table.</span>
@@ -2883,7 +2883,7 @@
28832883

28842884

28852885
<footer>
2886-
<aside>February 6, 2022</aside>
2886+
<aside>February 13, 2022</aside>
28872887
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
28882888
</footer>
28892889

parse.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,15 @@ const DIAGRAM_1_B =
115115
'┃ iter │ │ │ ✓ ┃\n' +
116116
'┗━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┛\n';
117117

118+
// const DIAGRAM_1_B =
119+
// '┏━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━┓\n' +
120+
// '┃ │ Iterable │ Collection │ Sequence ┃\n' +
121+
// '┠──────────────────┼────────────┼────────────┼────────────┨\n' +
122+
// '┃ list, range, str │ ✓ │ ✓ │ ✓ ┃\n' +
123+
// '┃ dict, set │ ✓ │ ✓ │ ┃\n' +
124+
// '┃ iter │ ✓ │ │ ┃\n' +
125+
// '┗━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┛\n';
126+
118127
const DIAGRAM_2_A =
119128
'+--------------------+----------+----------+----------+----------+----------+\n' +
120129
'| | Integral | Rational | Real | Complex | Number |\n' +
@@ -131,6 +140,17 @@ const DIAGRAM_2_B =
131140
'┃ decimal.Decimal │ │ │ │ │ ✓ ┃\n' +
132141
'┗━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━┛\n';
133142

143+
// const DIAGRAM_2_B =
144+
// '┏━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━┓\n' +
145+
// '┃ │ Number │ Complex │ Real │ Rational │ Integral ┃\n' +
146+
// '┠────────────────────┼──────────┼──────────┼──────────┼──────────┼──────────┨\n' +
147+
// '┃ int │ ✓ │ ✓ │ ✓ │ ✓ │ ✓ ┃\n' +
148+
// '┃ fractions.Fraction │ ✓ │ ✓ │ ✓ │ ✓ │ ┃\n' +
149+
// '┃ float │ ✓ │ ✓ │ ✓ │ │ ┃\n' +
150+
// '┃ complex │ ✓ │ ✓ │ │ │ ┃\n' +
151+
// '┃ decimal.Decimal │ ✓ │ │ │ │ ┃\n' +
152+
// '┗━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━┛\n';
153+
134154
const DIAGRAM_3_A =
135155
'+---------------+----------+----------+----------+----------+----------+\n';
136156

@@ -145,6 +165,17 @@ const DIAGRAM_3_B =
145165
'┃ isdecimal() │ │ │ │ │ ✓ ┃\n' +
146166
'┗━━━━━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━┛\n';
147167

168+
// const DIAGRAM_3_B =
169+
// '┏━━━━━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━┓\n' +
170+
// '┃ │ [0-9] │ [²³¹] │ [¼½¾] │ [a-zA-Z] │ [ !#$%…] ┃\n' +
171+
// '┠───────────────┼──────────┼──────────┼──────────┼──────────┼──────────┨\n' +
172+
// '┃ isprintable() │ ✓ │ ✓ │ ✓ │ ✓ │ ✓ ┃\n' +
173+
// '┃ isalnum() │ ✓ │ ✓ │ ✓ │ ✓ │ ┃\n' +
174+
// '┃ isnumeric() │ ✓ │ ✓ │ ✓ │ │ ┃\n' +
175+
// '┃ isdigit() │ ✓ │ ✓ │ │ │ ┃\n' +
176+
// '┃ isdecimal() │ ✓ │ │ │ │ ┃\n' +
177+
// '┗━━━━━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━┛\n';
178+
148179
const DIAGRAM_4_A =
149180
"+--------------+----------------+----------------+----------------+----------------+\n" +
150181
"| | {<float>} | {<float>:f} | {<float>:e} | {<float>:%} |\n" +
@@ -199,6 +230,19 @@ const DIAGRAM_6_B =
199230
'┃ count() │ │ │ │ ✓ ┃\n' +
200231
'┗━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━┛\n';
201232

233+
// const DIAGRAM_6_B =
234+
// '┏━━━━━━━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━┓\n' +
235+
// '┃ │ abc.Sequence │ Sequence │ Collection │ Iterable ┃\n' +
236+
// '┠────────────┼──────────────┼────────────┼────────────┼────────────┨\n' +
237+
// '┃ iter() │ ✓ │ ✓ │ ! │ ! ┃\n' +
238+
// '┃ contains() │ ✓ │ ✓ │ ✓ │ ✓ ┃\n' +
239+
// '┃ len() │ ! │ ! │ ! │ ┃\n' +
240+
// '┃ getitem() │ ! │ ! │ │ ┃\n' +
241+
// '┃ reversed() │ ✓ │ ✓ │ │ ┃\n' +
242+
// '┃ index() │ ✓ │ │ │ ┃\n' +
243+
// '┃ count() │ ✓ │ │ │ ┃\n' +
244+
// '┗━━━━━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┛\n';
245+
202246
const DIAGRAM_7_A =
203247
'BaseException\n' +
204248
' +-- SystemExit';

0 commit comments

Comments
 (0)