Skip to content

Commit

Permalink
Updated to 0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafiqul Hasan committed Dec 15, 2017
1 parent 01c160d commit d086787
Show file tree
Hide file tree
Showing 72 changed files with 6,075 additions and 7,998 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ deploy:
repo: shopnilsazal/validus
tags: true
env:
- TOXENV=py36
- TOXENV=py35
- TOXENV=py34
- TOXENV=py33
Expand Down
6 changes: 6 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
History
=======

0.2.0 (2017-12-15)
------------------

* Added some more functions.
* Refactored for improved performance.

0.1.0 (2017-06-07)
------------------

Expand Down
6 changes: 5 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Validus
:target: https://travis-ci.org/shopnilsazal/validus


A dead simple Python data validation library.
A dead simple Python string validation library.


Requirements
Expand Down Expand Up @@ -45,11 +45,13 @@ List of Functions
isascii()
isprintascii()
isnonempty()
isbase64()
isemail()
ishexadecimal()
isint()
isfloat()
ispositive()
isslug()
isuuid()
isuuid3()
Expand Down Expand Up @@ -90,6 +92,8 @@ List of Functions
isisbn10()
isisbn13()
isimei()
ismimetype()
isisrc()
Expand Down
2 changes: 1 addition & 1 deletion docs/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: d0213160df0bf744dd6a6203cfb914b0
config: e7441bff21ce101b07f8cb138af3427c
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file modified docs/.doctrees/authors.doctree
Binary file not shown.
Binary file modified docs/.doctrees/contributing.doctree
Binary file not shown.
Binary file modified docs/.doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/.doctrees/history.doctree
Binary file not shown.
Binary file modified docs/.doctrees/index.doctree
Binary file not shown.
Binary file modified docs/.doctrees/installation.doctree
Binary file not shown.
Binary file modified docs/.doctrees/readme.doctree
Binary file not shown.
Binary file modified docs/.doctrees/usage.doctree
Binary file not shown.
35 changes: 0 additions & 35 deletions docs/_downloads/game1.py

This file was deleted.

33 changes: 0 additions & 33 deletions docs/_downloads/game2.py

This file was deleted.

26 changes: 0 additions & 26 deletions docs/_downloads/gcd0.py

This file was deleted.

25 changes: 0 additions & 25 deletions docs/_downloads/gcd1.py

This file was deleted.

20 changes: 9 additions & 11 deletions docs/_modules/index.html
Original file line number Diff line number Diff line change
@@ -1,39 +1,36 @@

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Overview: module code &#8212; validus 0.1.0 documentation</title>

<title>Overview: module code &#8212; validus 0.2.0 documentation</title>
<link rel="stylesheet" href="../_static/alabaster.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />

<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '0.1.0',
VERSION: '0.2.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="top" title="validus 0.1.0 documentation" href="../index.html" />

<link rel="stylesheet" href="../_static/custom.css" type="text/css" />


<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />

</head>
<body role="document">
<body>


<div class="document">
Expand Down Expand Up @@ -63,9 +60,10 @@ <h1 class="logo"><a href="../index.html">validus</a></h1>

<h3>Navigation</h3>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../readme.html">validus</a></li>
<li class="toctree-l1"><a class="reference internal" href="../readme.html">Validus</a></li>
<li class="toctree-l1"><a class="reference internal" href="../installation.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../usage.html">Usage</a></li>
<li class="toctree-l1"><a class="reference internal" href="../usage.html#available-functions">Available Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../contributing.html">Contributing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../authors.html">Credits</a></li>
<li class="toctree-l1"><a class="reference internal" href="../history.html">History</a></li>
Expand Down Expand Up @@ -96,7 +94,7 @@ <h3>Quick search</h3>
&copy;2017, Rafiqul Hasan.

|
Powered by <a href="http://sphinx-doc.org/">Sphinx 1.4.8</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 1.6.4</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.10</a>

</div>
Expand Down
33 changes: 13 additions & 20 deletions docs/_modules/validus/isbn.html
Original file line number Diff line number Diff line change
@@ -1,40 +1,36 @@

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>validus.isbn &#8212; validus 0.1.0 documentation</title>

<title>validus.isbn &#8212; validus 0.2.0 documentation</title>
<link rel="stylesheet" href="../../_static/alabaster.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />

<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '0.1.0',
VERSION: '0.2.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="top" title="validus 0.1.0 documentation" href="../../index.html" />
<link rel="up" title="Module code" href="../index.html" />

<link rel="stylesheet" href="../../_static/custom.css" type="text/css" />


<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />

</head>
<body role="document">
<body>


<div class="document">
Expand All @@ -47,12 +43,6 @@ <h1>Source code for validus.isbn</h1><div class="highlight"><pre>
<span class="kn">import</span> <span class="nn">re</span>


<span class="n">isbn_patterns</span> <span class="o">=</span> <span class="p">{</span>
<span class="s1">&#39;isbn10&#39;</span><span class="p">:</span> <span class="sa">r</span><span class="s2">&quot;^(?:[0-9]</span><span class="si">{9}</span><span class="s2">X|[0-9]</span><span class="si">{10}</span><span class="s2">)$&quot;</span><span class="p">,</span>
<span class="s1">&#39;isbn13&#39;</span><span class="p">:</span> <span class="sa">r</span><span class="s2">&quot;^(?:[0-9]</span><span class="si">{13}</span><span class="s2">)$&quot;</span><span class="p">,</span>
<span class="p">}</span>


<span class="nd">@validate_str</span>
<span class="k">def</span> <span class="nf">sanitize_isbn</span><span class="p">(</span><span class="n">isbn</span><span class="p">):</span>
<span class="n">sanitized</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">sub</span><span class="p">(</span><span class="sa">r</span><span class="s1">&#39;[\s-]+&#39;</span><span class="p">,</span> <span class="s1">&#39;&#39;</span><span class="p">,</span> <span class="n">isbn</span><span class="p">)</span>
Expand Down Expand Up @@ -93,18 +83,20 @@ <h1>Source code for validus.isbn</h1><div class="highlight"><pre>
<span class="sd"> :param isbn: ISBN string to validate</span>
<span class="sd"> :param version: Optional ISBN version (10 or 13)</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">isbn10_pattern</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="sa">r</span><span class="s2">&quot;^(?:[0-9]</span><span class="si">{9}</span><span class="s2">X|[0-9]</span><span class="si">{10}</span><span class="s2">)$&quot;</span><span class="p">)</span>
<span class="n">isbn13_pattern</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="sa">r</span><span class="s2">&quot;^(?:[0-9]</span><span class="si">{13}</span><span class="s2">)$&quot;</span><span class="p">)</span>
<span class="n">sanitized</span> <span class="o">=</span> <span class="n">sanitize_isbn</span><span class="p">(</span><span class="n">isbn</span><span class="p">)</span>

<span class="k">if</span> <span class="n">version</span> <span class="o">==</span> <span class="mi">10</span><span class="p">:</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">re</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">isbn_patterns</span><span class="p">[</span><span class="s1">&#39;isbn10&#39;</span><span class="p">],</span> <span class="n">sanitized</span><span class="p">):</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">isbn10_pattern</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">sanitized</span><span class="p">):</span>
<span class="k">return</span> <span class="kc">False</span>
<span class="n">checksum</span> <span class="o">=</span> <span class="n">get_isbn_10_checksum</span><span class="p">(</span><span class="n">isbn</span><span class="p">)</span>
<span class="k">if</span> <span class="n">checksum</span> <span class="o">%</span> <span class="mi">11</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
<span class="k">return</span> <span class="kc">True</span>
<span class="k">return</span> <span class="kc">False</span>

<span class="k">elif</span> <span class="n">version</span> <span class="o">==</span> <span class="mi">13</span><span class="p">:</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">re</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">isbn_patterns</span><span class="p">[</span><span class="s1">&#39;isbn13&#39;</span><span class="p">],</span> <span class="n">sanitized</span><span class="p">):</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">isbn13_pattern</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">sanitized</span><span class="p">):</span>
<span class="k">return</span> <span class="kc">False</span>
<span class="n">checksum</span> <span class="o">=</span> <span class="n">get_isbn_13_checksum</span><span class="p">(</span><span class="n">isbn</span><span class="p">)</span>
<span class="k">if</span> <span class="nb">int</span><span class="p">(</span><span class="n">sanitized</span><span class="p">[</span><span class="mi">12</span><span class="p">])</span> <span class="o">-</span> <span class="p">((</span><span class="mi">10</span> <span class="o">-</span> <span class="p">(</span><span class="n">checksum</span> <span class="o">%</span> <span class="mi">10</span><span class="p">))</span> <span class="o">%</span> <span class="mi">10</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
Expand Down Expand Up @@ -167,9 +159,10 @@ <h1 class="logo"><a href="../../index.html">validus</a></h1>

<h3>Navigation</h3>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../readme.html">validus</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../readme.html">Validus</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../installation.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../usage.html">Usage</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../usage.html#available-functions">Available Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../contributing.html">Contributing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../authors.html">Credits</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../history.html">History</a></li>
Expand Down Expand Up @@ -202,7 +195,7 @@ <h3>Quick search</h3>
&copy;2017, Rafiqul Hasan.

|
Powered by <a href="http://sphinx-doc.org/">Sphinx 1.4.8</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 1.6.4</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.10</a>

</div>
Expand Down
Loading

0 comments on commit d086787

Please sign in to comment.