Skip to content

Commit

Permalink
Fixed security jinja2 warning. Updated documentation (#52)
Browse files Browse the repository at this point in the history
* Updated code to jinja 2

* Added more method documentation
  • Loading branch information
turulomio authored Jan 16, 2024
1 parent 6acc7de commit e8b87cb
Show file tree
Hide file tree
Showing 6 changed files with 389 additions and 255 deletions.
32 changes: 32 additions & 0 deletions docs/_sources/casts.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,15 @@ These calls will raise CastException:

### dtaware_now

Returns a aware datetime object of current moment. By default returns UTC timezone

```{code-cell}
from pydicts import casts
print(casts.dtaware_now())
print(casts.dtaware_now("Europe/Madrid"))
```


### dtaware_year_end

### dtaware_year_start
Expand All @@ -149,10 +158,33 @@ These calls will raise CastException:

### dtnaive_now

Returns a naive datetime object of current moment. By default returns UTC timezone

```{code-cell}
from pydicts import casts
casts.dtnaive_now()
```

### is_aware

Returns if a datetime object is aware (with timezone)

```{code-cell}
from pydicts import casts
print(casts.is_aware(casts.dtaware_now()))
print(casts.is_aware(casts.dtnaive_now()))
```

### is_naive

Returns if a datetime object is naive (without timezone)

```{code-cell}
from pydicts import casts
print(casts.is_naive(casts.dtaware_now()))
print(casts.is_naive(casts.dtnaive_now()))
```

### months


Expand Down
62 changes: 62 additions & 0 deletions docs/casts.html
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,22 @@ <h3>dtaware_month_start<a class="headerlink" href="#dtaware-month-start" title="
</section>
<section id="dtaware-now">
<h3>dtaware_now<a class="headerlink" href="#dtaware-now" title="Permalink to this heading">#</a></h3>
<p>Returns a aware datetime object of current moment. By default returns UTC timezone</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">pydicts</span> <span class="kn">import</span> <span class="n">casts</span>
<span class="nb">print</span><span class="p">(</span><span class="n">casts</span><span class="o">.</span><span class="n">dtaware_now</span><span class="p">())</span>
<span class="nb">print</span><span class="p">(</span><span class="n">casts</span><span class="o">.</span><span class="n">dtaware_now</span><span class="p">(</span><span class="s2">&quot;Europe/Madrid&quot;</span><span class="p">))</span>
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>2024-01-16 19:06:54.277087+00:00
2024-01-16 20:06:54.278501+01:00
</pre></div>
</div>
</div>
</div>
</section>
<section id="dtaware-year-end">
<h3>dtaware_year_end<a class="headerlink" href="#dtaware-year-end" title="Permalink to this heading">#</a></h3>
Expand All @@ -651,12 +667,58 @@ <h3>dtnaive_day_start_from_date<a class="headerlink" href="#dtnaive-day-start-fr
</section>
<section id="dtnaive-now">
<h3>dtnaive_now<a class="headerlink" href="#dtnaive-now" title="Permalink to this heading">#</a></h3>
<p>Returns a naive datetime object of current moment. By default returns UTC timezone</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">pydicts</span> <span class="kn">import</span> <span class="n">casts</span>
<span class="n">casts</span><span class="o">.</span><span class="n">dtnaive_now</span><span class="p">()</span>
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>datetime.datetime(2024, 1, 16, 19, 6, 54, 282126)
</pre></div>
</div>
</div>
</div>
</section>
<section id="is-aware">
<h3>is_aware<a class="headerlink" href="#is-aware" title="Permalink to this heading">#</a></h3>
<p>Returns if a datetime object is aware (with timezone)</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">pydicts</span> <span class="kn">import</span> <span class="n">casts</span>
<span class="nb">print</span><span class="p">(</span><span class="n">casts</span><span class="o">.</span><span class="n">is_aware</span><span class="p">(</span><span class="n">casts</span><span class="o">.</span><span class="n">dtaware_now</span><span class="p">()))</span>
<span class="nb">print</span><span class="p">(</span><span class="n">casts</span><span class="o">.</span><span class="n">is_aware</span><span class="p">(</span><span class="n">casts</span><span class="o">.</span><span class="n">dtnaive_now</span><span class="p">()))</span>
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>True
False
</pre></div>
</div>
</div>
</div>
</section>
<section id="is-naive">
<h3>is_naive<a class="headerlink" href="#is-naive" title="Permalink to this heading">#</a></h3>
<p>Returns if a datetime object is naive (without timezone)</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">pydicts</span> <span class="kn">import</span> <span class="n">casts</span>
<span class="nb">print</span><span class="p">(</span><span class="n">casts</span><span class="o">.</span><span class="n">is_naive</span><span class="p">(</span><span class="n">casts</span><span class="o">.</span><span class="n">dtaware_now</span><span class="p">()))</span>
<span class="nb">print</span><span class="p">(</span><span class="n">casts</span><span class="o">.</span><span class="n">is_naive</span><span class="p">(</span><span class="n">casts</span><span class="o">.</span><span class="n">dtnaive_now</span><span class="p">()))</span>
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>False
True
</pre></div>
</div>
</div>
</div>
</section>
<section id="months">
<h3>months<a class="headerlink" href="#months" title="Permalink to this heading">#</a></h3>
Expand Down
2 changes: 1 addition & 1 deletion docs/searchindex.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions jupyter/casts.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,15 @@ These calls will raise CastException:

### dtaware_now

Returns a aware datetime object of current moment. By default returns UTC timezone

```{code-cell}
from pydicts import casts
print(casts.dtaware_now())
print(casts.dtaware_now("Europe/Madrid"))
```


### dtaware_year_end

### dtaware_year_start
Expand All @@ -149,10 +158,33 @@ These calls will raise CastException:

### dtnaive_now

Returns a naive datetime object of current moment. By default returns UTC timezone

```{code-cell}
from pydicts import casts
casts.dtnaive_now()
```

### is_aware

Returns if a datetime object is aware (with timezone)

```{code-cell}
from pydicts import casts
print(casts.is_aware(casts.dtaware_now()))
print(casts.is_aware(casts.dtnaive_now()))
```

### is_naive

Returns if a datetime object is naive (without timezone)

```{code-cell}
from pydicts import casts
print(casts.is_naive(casts.dtaware_now()))
print(casts.is_naive(casts.dtnaive_now()))
```

### months


Expand Down
Loading

0 comments on commit e8b87cb

Please sign in to comment.