Browse Source

Datetime, Enum

pull/36/head
Jure Šorn 5 years ago
parent
commit
6d5dfc6af7
2 changed files with 9 additions and 2 deletions
  1. 5
      README.md
  2. 6
      index.html

5
README.md

@ -586,7 +586,7 @@ from dateutil.tz import UTC, tzlocal, gettz
### Timezone ### Timezone
```python ```python
<tzinfo> = UTC # UTC timezone. London without DST. <tzinfo> = UTC # UTC timezone. London without DST.
<tzinfo> = tzlocal() # Local timezone.
<tzinfo> = tzlocal() # Local timezone. Also gettz().
<tzinfo> = gettz('<Cont.>/<City>') # Timezone from 'Continent/City_Name' str. <tzinfo> = gettz('<Cont.>/<City>') # Timezone from 'Continent/City_Name' str.
``` ```
@ -1177,6 +1177,9 @@ class <enum_name>(Enum):
def get_member_names(cls): def get_member_names(cls):
return [a.name for a in cls.__members__.values()] return [a.name for a in cls.__members__.values()]
``` ```
* **If there are no numeric values before auto(), it returns 1.**
* **Otherwise it returns an increment of last numeric value.**
```python ```python
<member> = <enum>.<member_name> <member> = <enum>.<member_name>

6
index.html

@ -624,7 +624,7 @@ shuffle(&lt;list&gt;)
</ul> </ul>
<h3 id="timezone">Timezone</h3> <h3 id="timezone">Timezone</h3>
<pre><code class="python language-python hljs">&lt;tzinfo&gt; = UTC <span class="hljs-comment"># UTC timezone. London without DST.</span> <pre><code class="python language-python hljs">&lt;tzinfo&gt; = UTC <span class="hljs-comment"># UTC timezone. London without DST.</span>
&lt;tzinfo&gt; = tzlocal() <span class="hljs-comment"># Local timezone.</span>
&lt;tzinfo&gt; = tzlocal() <span class="hljs-comment"># Local timezone. Also gettz().</span>
&lt;tzinfo&gt; = gettz(<span class="hljs-string">'&lt;Cont.&gt;/&lt;City&gt;'</span>) <span class="hljs-comment"># Timezone from 'Continent/City_Name' str.</span> &lt;tzinfo&gt; = gettz(<span class="hljs-string">'&lt;Cont.&gt;/&lt;City&gt;'</span>) <span class="hljs-comment"># Timezone from 'Continent/City_Name' str.</span>
</code></pre> </code></pre>
<pre><code class="python language-python apache hljs">&lt;DTa&gt; = &lt;DT&gt;.astimezone(&lt;tzinfo&gt;) <span class="hljs-comment"># Datetime, converted to passed timezone.</span> <pre><code class="python language-python apache hljs">&lt;DTa&gt; = &lt;DT&gt;.astimezone(&lt;tzinfo&gt;) <span class="hljs-comment"># Datetime, converted to passed timezone.</span>
@ -1090,6 +1090,10 @@ Hello World!
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_member_names</span><span class="hljs-params">(cls)</span>:</span> <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_member_names</span><span class="hljs-params">(cls)</span>:</span>
<span class="hljs-keyword">return</span> [a.name <span class="hljs-keyword">for</span> a <span class="hljs-keyword">in</span> cls.__members__.values()] <span class="hljs-keyword">return</span> [a.name <span class="hljs-keyword">for</span> a <span class="hljs-keyword">in</span> cls.__members__.values()]
</code></pre> </code></pre>
<ul>
<li><strong>If there are no numeric values before auto(), it returns 1.</strong></li>
<li><strong>Otherwise it returns an increment of last numeric value.</strong></li>
</ul>
<pre><code class="python language-python hljs">&lt;member&gt; = &lt;enum&gt;.&lt;member_name&gt; <pre><code class="python language-python hljs">&lt;member&gt; = &lt;enum&gt;.&lt;member_name&gt;
&lt;member&gt; = &lt;enum&gt;[<span class="hljs-string">'&lt;member_name&gt;'</span>] &lt;member&gt; = &lt;enum&gt;[<span class="hljs-string">'&lt;member_name&gt;'</span>]
&lt;member&gt; = &lt;enum&gt;(&lt;value&gt;) &lt;member&gt; = &lt;enum&gt;(&lt;value&gt;)

Loading…
Cancel
Save