Skip to content

Commit

Permalink
fix #18, added remainder of species methods
Browse files Browse the repository at this point in the history
  • Loading branch information
sckott committed Oct 19, 2016
1 parent dc28bc1 commit d157189
Show file tree
Hide file tree
Showing 33 changed files with 1,810 additions and 420 deletions.
Binary file modified docs/_build/doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/_build/doctrees/species.doctree
Binary file not shown.
4 changes: 4 additions & 0 deletions docs/_build/html/_modules/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,11 @@ <h1>All modules for which code is available</h1>
<li><a href="pygbif/registry/networks.html">pygbif.registry.networks</a></li>
<li><a href="pygbif/registry/nodes.html">pygbif.registry.nodes</a></li>
<li><a href="pygbif/registry/organizations.html">pygbif.registry.organizations</a></li>
<li><a href="pygbif/species/name_backbone.html">pygbif.species.name_backbone</a></li>
<li><a href="pygbif/species/name_lookup.html">pygbif.species.name_lookup</a></li>
<li><a href="pygbif/species/name_parser.html">pygbif.species.name_parser</a></li>
<li><a href="pygbif/species/name_suggest.html">pygbif.species.name_suggest</a></li>
<li><a href="pygbif/species/name_usage.html">pygbif.species.name_usage</a></li>
<li><a href="pygbif/species/names.html">pygbif.species.names</a></li>
</ul>

Expand Down
42 changes: 20 additions & 22 deletions docs/_build/html/_modules/pygbif/registry/datasets.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@
<h1>Source code for pygbif.registry.datasets</h1><div class="highlight"><pre>
<span></span><span class="kn">import</span> <span class="nn">re</span>
<span class="kn">from</span> <span class="nn">..gbifutils</span> <span class="k">import</span> <span class="o">*</span>
<span class="kn">from</span> <span class="nn">.registry_utils</span> <span class="k">import</span> <span class="o">*</span>

<span class="k">def</span> <span class="nf">dataset_metrics</span><span class="p">(</span><span class="n">uuid</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="sd">&#39;&#39;&#39;</span>
Expand Down Expand Up @@ -193,33 +192,32 @@ <h1>Source code for pygbif.registry.datasets</h1><div class="highlight"><pre>
<span class="s1">&#39;constituents&#39;</span><span class="p">,</span> <span class="s1">&#39;document&#39;</span><span class="p">,</span> <span class="s1">&#39;metadata&#39;</span><span class="p">,</span> <span class="s1">&#39;deleted&#39;</span><span class="p">,</span>
<span class="s1">&#39;duplicate&#39;</span><span class="p">,</span> <span class="s1">&#39;subDataset&#39;</span><span class="p">,</span> <span class="s1">&#39;withNoEndpoint&#39;</span><span class="p">]</span>
<span class="n">check_data</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">data_choices</span><span class="p">)</span>
<span class="k">if</span> <span class="n">len2</span><span class="p">(</span><span class="n">data</span><span class="p">)</span> <span class="o">==</span><span class="mi">1</span><span class="p">:</span>
<span class="k">return</span> <span class="n">datasets_fetch</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">uuid</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">return</span> <span class="p">[</span><span class="n">datasets_fetch</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">uuid</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">data</span><span class="p">]</span>

<span class="k">def</span> <span class="nf">getdata</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">uuid</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="k">if</span> <span class="n">x</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">[</span><span class="s1">&#39;all&#39;</span><span class="p">,</span><span class="s1">&#39;deleted&#39;</span><span class="p">,</span><span class="s1">&#39;duplicate&#39;</span><span class="p">,</span><span class="s1">&#39;subDataset&#39;</span><span class="p">,</span><span class="s1">&#39;withNoEndpoint&#39;</span><span class="p">]</span> <span class="ow">and</span> <span class="n">uuid</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s1">&#39;You must specify a uuid if data does not equal all and data does not equal of deleted, duplicate, subDataset, or withNoEndpoint&#39;</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">datasets_fetch</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">uuid</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="k">if</span> <span class="n">x</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">[</span><span class="s1">&#39;all&#39;</span><span class="p">,</span><span class="s1">&#39;deleted&#39;</span><span class="p">,</span><span class="s1">&#39;duplicate&#39;</span><span class="p">,</span><span class="s1">&#39;subDataset&#39;</span><span class="p">,</span><span class="s1">&#39;withNoEndpoint&#39;</span><span class="p">]</span> <span class="ow">and</span> <span class="n">uuid</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s1">&#39;You must specify a uuid if data does not equal all and data does not equal of deleted, duplicate, subDataset, or withNoEndpoint&#39;</span><span class="p">)</span>

<span class="k">if</span> <span class="n">uuid</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="k">if</span> <span class="n">x</span> <span class="ow">is</span> <span class="s1">&#39;all&#39;</span><span class="p">:</span>
<span class="n">url</span> <span class="o">=</span> <span class="n">gbif_baseurl</span> <span class="o">+</span> <span class="s1">&#39;dataset&#39;</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">if</span> <span class="nb">id</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="ow">and</span> <span class="n">x</span> <span class="ow">is</span> <span class="s1">&#39;metadata&#39;</span><span class="p">:</span>
<span class="n">url</span> <span class="o">=</span> <span class="n">gbif_baseurl</span> <span class="o">+</span> <span class="s1">&#39;dataset/metadata/&#39;</span> <span class="o">+</span> <span class="nb">id</span> <span class="o">+</span> <span class="s1">&#39;/document&#39;</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">url</span> <span class="o">=</span> <span class="n">gbif_baseurl</span> <span class="o">+</span> <span class="s1">&#39;dataset/&#39;</span> <span class="o">+</span> <span class="n">x</span>
<span class="k">if</span> <span class="n">uuid</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="k">if</span> <span class="n">x</span> <span class="ow">is</span> <span class="s1">&#39;all&#39;</span><span class="p">:</span>
<span class="n">url</span> <span class="o">=</span> <span class="n">gbif_baseurl</span> <span class="o">+</span> <span class="s1">&#39;dataset&#39;</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">if</span> <span class="n">x</span> <span class="ow">is</span> <span class="s1">&#39;all&#39;</span><span class="p">:</span>
<span class="n">url</span> <span class="o">=</span> <span class="n">gbif_baseurl</span> <span class="o">+</span> <span class="s1">&#39;dataset/&#39;</span> <span class="o">+</span> <span class="n">uuid</span>
<span class="k">if</span> <span class="nb">id</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="ow">and</span> <span class="n">x</span> <span class="ow">is</span> <span class="s1">&#39;metadata&#39;</span><span class="p">:</span>
<span class="n">url</span> <span class="o">=</span> <span class="n">gbif_baseurl</span> <span class="o">+</span> <span class="s1">&#39;dataset/metadata/&#39;</span> <span class="o">+</span> <span class="nb">id</span> <span class="o">+</span> <span class="s1">&#39;/document&#39;</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">url</span> <span class="o">=</span> <span class="n">gbif_baseurl</span> <span class="o">+</span> <span class="s1">&#39;dataset/&#39;</span> <span class="o">+</span> <span class="n">uuid</span> <span class="o">+</span> <span class="s1">&#39;/&#39;</span> <span class="o">+</span> <span class="n">x</span>
<span class="n">url</span> <span class="o">=</span> <span class="n">gbif_baseurl</span> <span class="o">+</span> <span class="s1">&#39;dataset/&#39;</span> <span class="o">+</span> <span class="n">x</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">if</span> <span class="n">x</span> <span class="ow">is</span> <span class="s1">&#39;all&#39;</span><span class="p">:</span>
<span class="n">url</span> <span class="o">=</span> <span class="n">gbif_baseurl</span> <span class="o">+</span> <span class="s1">&#39;dataset/&#39;</span> <span class="o">+</span> <span class="n">uuid</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">url</span> <span class="o">=</span> <span class="n">gbif_baseurl</span> <span class="o">+</span> <span class="s1">&#39;dataset/&#39;</span> <span class="o">+</span> <span class="n">uuid</span> <span class="o">+</span> <span class="s1">&#39;/&#39;</span> <span class="o">+</span> <span class="n">x</span>

<span class="n">res</span> <span class="o">=</span> <span class="n">gbif_GET</span><span class="p">(</span><span class="n">url</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="k">return</span> <span class="p">{</span><span class="s1">&#39;meta&#39;</span><span class="p">:</span> <span class="n">get_meta</span><span class="p">(</span><span class="n">res</span><span class="p">),</span> <span class="s1">&#39;data&#39;</span><span class="p">:</span> <span class="n">parse_results</span><span class="p">(</span><span class="n">res</span><span class="p">,</span> <span class="n">uuid</span><span class="p">)}</span>
<span class="n">res</span> <span class="o">=</span> <span class="n">gbif_GET</span><span class="p">(</span><span class="n">url</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="k">return</span> <span class="n">res</span>

<span class="c1"># Get data</span>
<span class="k">if</span> <span class="n">len2</span><span class="p">(</span><span class="n">data</span><span class="p">)</span> <span class="o">==</span><span class="mi">1</span><span class="p">:</span>
<span class="k">return</span> <span class="n">getdata</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">uuid</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">return</span> <span class="p">[</span><span class="n">getdata</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">uuid</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">data</span><span class="p">]</span>


<span class="k">def</span> <span class="nf">dataset_suggest</span><span class="p">(</span><span class="n">q</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">keyword</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">owningOrg</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@

<h1>Source code for pygbif.registry.installations</h1><div class="highlight"><pre>
<span></span><span class="kn">from</span> <span class="nn">..gbifutils</span> <span class="k">import</span> <span class="o">*</span>
<span class="kn">from</span> <span class="nn">.registry_utils</span> <span class="k">import</span> <span class="o">*</span>

<span class="k">def</span> <span class="nf">installations</span><span class="p">(</span><span class="n">data</span> <span class="o">=</span> <span class="s1">&#39;all&#39;</span><span class="p">,</span> <span class="n">uuid</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="n">query</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="n">identifier</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
<span class="n">identifierType</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="n">limit</span> <span class="o">=</span> <span class="mi">100</span><span class="p">,</span> <span class="n">start</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
Expand Down
1 change: 0 additions & 1 deletion docs/_build/html/_modules/pygbif/registry/networks.html
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@

<h1>Source code for pygbif.registry.networks</h1><div class="highlight"><pre>
<span></span><span class="kn">from</span> <span class="nn">..gbifutils</span> <span class="k">import</span> <span class="o">*</span>
<span class="kn">from</span> <span class="nn">.registry_utils</span> <span class="k">import</span> <span class="o">*</span>

<span class="k">def</span> <span class="nf">networks</span><span class="p">(</span><span class="n">data</span> <span class="o">=</span> <span class="s1">&#39;all&#39;</span><span class="p">,</span> <span class="n">uuid</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="n">query</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="n">identifier</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
<span class="n">identifierType</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="n">limit</span> <span class="o">=</span> <span class="mi">100</span><span class="p">,</span> <span class="n">start</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
Expand Down
1 change: 0 additions & 1 deletion docs/_build/html/_modules/pygbif/registry/nodes.html
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@

<h1>Source code for pygbif.registry.nodes</h1><div class="highlight"><pre>
<span></span><span class="kn">from</span> <span class="nn">..gbifutils</span> <span class="k">import</span> <span class="o">*</span>
<span class="kn">from</span> <span class="nn">.registry_utils</span> <span class="k">import</span> <span class="o">*</span>

<span class="k">def</span> <span class="nf">nodes</span><span class="p">(</span><span class="n">data</span> <span class="o">=</span> <span class="s1">&#39;all&#39;</span><span class="p">,</span> <span class="n">uuid</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="n">query</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="n">identifier</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
<span class="n">identifierType</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="n">limit</span> <span class="o">=</span> <span class="mi">100</span><span class="p">,</span> <span class="n">start</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="n">isocode</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@

<h1>Source code for pygbif.registry.organizations</h1><div class="highlight"><pre>
<span></span><span class="kn">from</span> <span class="nn">..gbifutils</span> <span class="k">import</span> <span class="o">*</span>
<span class="kn">from</span> <span class="nn">.registry_utils</span> <span class="k">import</span> <span class="o">*</span>

<span class="k">def</span> <span class="nf">organizations</span><span class="p">(</span><span class="n">data</span> <span class="o">=</span> <span class="s1">&#39;all&#39;</span><span class="p">,</span> <span class="n">uuid</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="n">query</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="n">identifier</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
<span class="n">identifierType</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="n">limit</span> <span class="o">=</span> <span class="mi">100</span><span class="p">,</span> <span class="n">start</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
Expand Down
Loading

0 comments on commit d157189

Please sign in to comment.