|
54 | 54 |
|
55 | 55 | <body>
|
56 | 56 | <header>
|
57 |
| - <aside>July 22, 2023</aside> |
| 57 | + <aside>July 24, 2023</aside> |
58 | 58 | <a href="https://gto76.github.io" rel="author">Jure Šorn</a>
|
59 | 59 | </header>
|
60 | 60 |
|
|
1230 | 1230 | func_name = <name>.__traceback__.tb_frame.f_code.co_name
|
1231 | 1231 | line = linecache.getline(filename, <name>.__traceback__.tb_lineno)
|
1232 | 1232 | trace_str = <span class="hljs-string">''</span>.join(traceback.format_tb(<name>.__traceback__))
|
1233 |
| -error_msg = <span class="hljs-string">''</span>.join(traceback.format_exception(exc_type, <name>, <name>.__traceback__)) |
| 1233 | +error_msg = <span class="hljs-string">''</span>.join(traceback.format_exception(type(<name>), <name>, <name>.__traceback__)) |
1234 | 1234 | </code></pre></div>
|
1235 | 1235 |
|
1236 | 1236 | <div><h3 id="builtinexceptions">Built-in Exceptions</h3><pre><code class="text language-text">BaseException
|
|
1414 | 1414 |
|
1415 | 1415 | <div><h3 id="pathobject">Path Object</h3><pre><code class="python language-python hljs"><Path> = Path(<path> [, ...]) <span class="hljs-comment"># Accepts strings, Paths and DirEntry objects.</span>
|
1416 | 1416 | <Path> = <path> / <path> [/ ...] <span class="hljs-comment"># First or second path must be a Path object.</span>
|
1417 |
| -<Path> = <Path>.resolve() <span class="hljs-comment"># Resolves symlinks and calls <Path>.absolute().</span> |
| 1417 | +<Path> = <Path>.resolve() <span class="hljs-comment"># Returns absolute path with resolved symlinks.</span> |
1418 | 1418 | </code></pre></div>
|
1419 | 1419 |
|
1420 | 1420 | <pre><code class="python language-python hljs"><Path> = Path() <span class="hljs-comment"># Returns relative cwd. Also Path('.').</span>
|
@@ -2288,7 +2288,7 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment
|
2288 | 2288 |
|
2289 | 2289 |
|
2290 | 2290 |
|
2291 |
| -<div><h4 id="addsnoisetoapngimage">Adds noise to a PNG image:</h4><pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> random <span class="hljs-keyword">import</span> randint |
| 2291 | +<div><h4 id="addsnoisetoapngimageanddisplaysit">Adds noise to a PNG image and displays it:</h4><pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> random <span class="hljs-keyword">import</span> randint |
2292 | 2292 | add_noise = <span class="hljs-keyword">lambda</span> value: max(<span class="hljs-number">0</span>, min(<span class="hljs-number">255</span>, value + randint(<span class="hljs-number">-20</span>, <span class="hljs-number">20</span>)))
|
2293 | 2293 | img = Image.open(<span class="hljs-string">'test.png'</span>).convert(<span class="hljs-string">'HSV'</span>)
|
2294 | 2294 | img.putdata([(add_noise(h), s, v) <span class="hljs-keyword">for</span> h, s, v <span class="hljs-keyword">in</span> img.getdata()])
|
@@ -2933,7 +2933,7 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment
|
2933 | 2933 |
|
2934 | 2934 |
|
2935 | 2935 | <footer>
|
2936 |
| - <aside>July 22, 2023</aside> |
| 2936 | + <aside>July 24, 2023</aside> |
2937 | 2937 | <a href="https://gto76.github.io" rel="author">Jure Šorn</a>
|
2938 | 2938 | </footer>
|
2939 | 2939 |
|
|
0 commit comments