Browse Source

Datetime, Decorator

pull/115/head
Jure Šorn 3 years ago
parent
commit
4d64e63cbd
2 changed files with 10 additions and 6 deletions
  1. 5
      README.md
  2. 11
      index.html

5
README.md

@ -648,7 +648,7 @@ from dateutil.tz import UTC, tzlocal, gettz, datetime_exists, resolve_imaginary
>>> dt.strftime("%A, %dth of %B '%y, %I:%M%p %Z")
"Thursday, 14th of May '15, 11:39PM UTC+02:00"
```
* **When parsing, `'%z'` also accepts `'±HH:MM'`.**
* **`'%Z'` only accepts `'UTC/GMT'` and local timezone's code. `'%z'` also accepts `'±HH:MM'`.**
* **For abbreviated weekday and month use `'%a'` and `'%b'`.**
### Arithmetics
@ -881,7 +881,8 @@ def get_counter():
Decorator
---------
**A decorator takes a function, adds some functionality and returns it.**
* **A decorator takes a function, adds some functionality and returns it.**
* **It can be any [callable](#callable), but is usually implemented as a function that returns a [closure](#closure).**
```python
@decorator_name

11
index.html

@ -226,7 +226,7 @@ pre.prettyprint {
<body>
<header>
<aside>October 29, 2021</aside>
<aside>October 30, 2021</aside>
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
</header>
@ -730,7 +730,7 @@ to_exclusive = &lt;range&gt;.stop
</code></pre></div>
<ul>
<li><strong>When parsing, <code class="python hljs"><span class="hljs-string">'%z'</span></code> also accepts <code class="python hljs"><span class="hljs-string">'±HH:MM'</span></code>.</strong></li>
<li><strong><code class="python hljs"><span class="hljs-string">'%Z'</span></code> only accepts <code class="python hljs"><span class="hljs-string">'UTC/GMT'</span></code> and local timezone's code. <code class="python hljs"><span class="hljs-string">'%z'</span></code> also accepts <code class="python hljs"><span class="hljs-string">'±HH:MM'</span></code>.</strong></li>
<li><strong>For abbreviated weekday and month use <code class="python hljs"><span class="hljs-string">'%a'</span></code> and <code class="python hljs"><span class="hljs-string">'%b'</span></code>.</strong></li>
</ul>
<div><h3 id="arithmetics">Arithmetics</h3><pre><code class="python language-python apache hljs">&lt;D/DT&gt; = &lt;D/DT&gt; ± &lt;TD&gt; <span class="hljs-comment"># Returned datetime can fall into missing hour.</span>
@ -897,7 +897,10 @@ creature = Creature(point, direction)
<span class="hljs-meta">&gt;&gt;&gt; </span>counter(), counter(), counter()
(<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>)
</code></pre>
<div class="pagebreak"></div><div><h2 id="decorator"><a href="#decorator" name="decorator">#</a>Decorator</h2><p><strong>A decorator takes a function, adds some functionality and returns it.</strong></p><pre><code class="python language-python hljs"><span class="hljs-meta">@decorator_name</span>
<div class="pagebreak"></div><div><h2 id="decorator"><a href="#decorator" name="decorator">#</a>Decorator</h2><ul>
<li><strong>A decorator takes a function, adds some functionality and returns it.</strong></li>
<li><strong>It can be any <a href="#callable">callable</a>, but is usually implemented as a function that returns a <a href="#closure">closure</a>.</strong></li>
</ul><pre><code class="python language-python hljs"><span class="hljs-meta">@decorator_name</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">function_that_gets_passed_to_decorator</span><span class="hljs-params">()</span>:</span>
...
</code></pre></div>
@ -3017,7 +3020,7 @@ $ pyinstaller script.py --add-data '&lt;path&gt;:.' <span class="hljs-comment">
<footer>
<aside>October 29, 2021</aside>
<aside>October 30, 2021</aside>
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
</footer>

Loading…
Cancel
Save