Commit 91d3634a by William Tisäter

Remove dependency on six. Closes pull #11.

Thanks to jimbo1023 for the pull request. Due recent refactor jobs I had
to rewrite these lines and did therefor not merge the pull.
parent b7ac752f
Bootstrap manual for developers of pygeoip
Dependencies: tox, nose, epydoc, six
Dependencies: tox, nose, epydoc
For testing we are using tox virtualenv-based Python version testing
and nose as test framwork.
......
pygeoip pygeoip-module.html
pygeoip.MMAP_CACHE pygeoip-module.html#MMAP_CACHE
pygeoip.STANDARD pygeoip-module.html#STANDARD
pygeoip.time_zone_by_country_and_region pygeoip.timezone-module.html#time_zone_by_country_and_region
pygeoip.MEMORY_CACHE pygeoip-module.html#MEMORY_CACHE
pygeoip.ip2long pygeoip.util-module.html#ip2long
pygeoip.__package__ pygeoip-module.html#__package__
pygeoip.STANDARD pygeoip-module.html#STANDARD
pygeoip.MMAP_CACHE pygeoip-module.html#MMAP_CACHE
pygeoip.MEMORY_CACHE pygeoip-module.html#MEMORY_CACHE
pygeoip.const pygeoip.const-module.html
pygeoip.const.GEOIP_STANDARD pygeoip.const-module.html#GEOIP_STANDARD
pygeoip.const.COUNTRY_CODES3 pygeoip.const-module.html#COUNTRY_CODES3
pygeoip.const.PY3 pygeoip.const-module.html#PY3
pygeoip.const.IPV6_EDITIONS pygeoip.const-module.html#IPV6_EDITIONS
pygeoip.const.ORG_EDITION pygeoip.const-module.html#ORG_EDITION
pygeoip.const.ASNUM_EDITION pygeoip.const-module.html#ASNUM_EDITION
pygeoip.const.STRUCTURE_INFO_MAX_SIZE pygeoip.const-module.html#STRUCTURE_INFO_MAX_SIZE
......@@ -16,6 +17,7 @@ pygeoip.const.REGION_EDITION_REV0 pygeoip.const-module.html#REGION_EDITION_REV0
pygeoip.const.REGION_EDITION_REV1 pygeoip.const-module.html#REGION_EDITION_REV1
pygeoip.const.CANADA_OFFSET pygeoip.const-module.html#CANADA_OFFSET
pygeoip.const.MAX_ORG_RECORD_LENGTH pygeoip.const-module.html#MAX_ORG_RECORD_LENGTH
pygeoip.const.CITY_EDITIONS pygeoip.const-module.html#CITY_EDITIONS
pygeoip.const.__package__ pygeoip.const-module.html#__package__
pygeoip.const.CITY_EDITION_REV0 pygeoip.const-module.html#CITY_EDITION_REV0
pygeoip.const.STATE_BEGIN_REV1 pygeoip.const-module.html#STATE_BEGIN_REV1
......@@ -24,6 +26,7 @@ pygeoip.const.FULL_RECORD_LENGTH pygeoip.const-module.html#FULL_RECORD_LENGTH
pygeoip.const.COUNTRY_EDITION_V6 pygeoip.const-module.html#COUNTRY_EDITION_V6
pygeoip.const.ISP_EDITION pygeoip.const-module.html#ISP_EDITION
pygeoip.const.NETSPEED_EDITION pygeoip.const-module.html#NETSPEED_EDITION
pygeoip.const.PY2 pygeoip.const-module.html#PY2
pygeoip.const.WORLD_OFFSET pygeoip.const-module.html#WORLD_OFFSET
pygeoip.const.CITY_EDITION_REV1 pygeoip.const-module.html#CITY_EDITION_REV1
pygeoip.const.DATABASE_INFO_MAX_SIZE pygeoip.const-module.html#DATABASE_INFO_MAX_SIZE
......@@ -31,6 +34,7 @@ pygeoip.const.ORG_RECORD_LENGTH pygeoip.const-module.html#ORG_RECORD_LENGTH
pygeoip.const.COUNTRY_BEGIN pygeoip.const-module.html#COUNTRY_BEGIN
pygeoip.const.PROXY_EDITION pygeoip.const-module.html#PROXY_EDITION
pygeoip.const.STANDARD pygeoip.const-module.html#STANDARD
pygeoip.const.REGION_EDITIONS pygeoip.const-module.html#REGION_EDITIONS
pygeoip.const.FIPS_RANGE pygeoip.const-module.html#FIPS_RANGE
pygeoip.const.SEGMENT_RECORD_LENGTH pygeoip.const-module.html#SEGMENT_RECORD_LENGTH
pygeoip.const.COUNTRY_EDITION pygeoip.const-module.html#COUNTRY_EDITION
......@@ -40,6 +44,7 @@ pygeoip.const.MMAP_CACHE pygeoip.const-module.html#MMAP_CACHE
pygeoip.const.DMA_MAP pygeoip.const-module.html#DMA_MAP
pygeoip.const.COUNTRY_CODES pygeoip.const-module.html#COUNTRY_CODES
pygeoip.const.GEOIP_MEMORY_CACHE pygeoip.const-module.html#GEOIP_MEMORY_CACHE
pygeoip.const.REGION_CITY_EDITIONS pygeoip.const-module.html#REGION_CITY_EDITIONS
pygeoip.const.MEMORY_CACHE pygeoip.const-module.html#MEMORY_CACHE
pygeoip.const.MAX_RECORD_LENGTH pygeoip.const-module.html#MAX_RECORD_LENGTH
pygeoip.timezone pygeoip.timezone-module.html
......@@ -47,8 +52,10 @@ pygeoip.timezone._country pygeoip.timezone-module.html#_country
pygeoip.timezone.time_zone_by_country_and_region pygeoip.timezone-module.html#time_zone_by_country_and_region
pygeoip.timezone.__package__ pygeoip.timezone-module.html#__package__
pygeoip.util pygeoip.util-module.html
pygeoip.util.ip2long pygeoip.util-module.html#ip2long
pygeoip.util.__package__ pygeoip.util-module.html#__package__
pygeoip.util.ip2long_v4 pygeoip.util-module.html#ip2long_v4
pygeoip.util.ip2long_v6 pygeoip.util-module.html#ip2long_v6
pygeoip.util.ip2long pygeoip.util-module.html#ip2long
pygeoip.GeoIP pygeoip.GeoIP-class.html
pygeoip.GeoIP.country_code_by_addr pygeoip.GeoIP-class.html#country_code_by_addr
pygeoip.GeoIP.region_by_name pygeoip.GeoIP-class.html#region_by_name
......@@ -56,15 +63,16 @@ pygeoip.GeoIP.record_by_name pygeoip.GeoIP-class.html#record_by_name
pygeoip.GeoIP._setup_segments pygeoip.GeoIP-class.html#_setup_segments
pygeoip.GeoIP._seek_country pygeoip.GeoIP-class.html#_seek_country
pygeoip.GeoIP.__init__ pygeoip.GeoIP-class.html#__init__
pygeoip.GeoIP.time_zone_by_name pygeoip.GeoIP-class.html#time_zone_by_name
pygeoip.GeoIP._get_region pygeoip.GeoIP-class.html#_get_region
pygeoip.GeoIP.country_code_by_name pygeoip.GeoIP-class.html#country_code_by_name
pygeoip.GeoIP._get_org pygeoip.GeoIP-class.html#_get_org
pygeoip.GeoIP._lookup_country_id pygeoip.GeoIP-class.html#_lookup_country_id
pygeoip.GeoIP.time_zone_by_addr pygeoip.GeoIP-class.html#time_zone_by_addr
pygeoip.GeoIP.id_by_addr pygeoip.GeoIP-class.html#id_by_addr
pygeoip.GeoIP.time_zone_by_name pygeoip.GeoIP-class.html#time_zone_by_name
pygeoip.GeoIP._get_record pygeoip.GeoIP-class.html#_get_record
pygeoip.GeoIP.org_by_addr pygeoip.GeoIP-class.html#org_by_addr
pygeoip.GeoIP.region_by_addr pygeoip.GeoIP-class.html#region_by_addr
pygeoip.GeoIP._gethostbyname pygeoip.GeoIP-class.html#_gethostbyname
pygeoip.GeoIP.record_by_addr pygeoip.GeoIP-class.html#record_by_addr
pygeoip.GeoIP.country_name_by_addr pygeoip.GeoIP-class.html#country_name_by_addr
pygeoip.GeoIP.org_by_name pygeoip.GeoIP-class.html#org_by_name
......
......@@ -123,7 +123,7 @@
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
Generated by Epydoc 3.0.1 on Thu Sep 20 17:58:04 2012
Generated by Epydoc 3.0.1 on Fri Sep 28 22:42:00 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
......
......@@ -256,7 +256,7 @@ page was last updated. </p>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
Generated by Epydoc 3.0.1 on Thu Sep 20 17:58:04 2012
Generated by Epydoc 3.0.1 on Fri Sep 28 22:42:00 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
......
......@@ -99,7 +99,7 @@
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
Generated by Epydoc 3.0.1 on Thu Sep 20 17:58:04 2012
Generated by Epydoc 3.0.1 on Fri Sep 28 22:42:00 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
......
......@@ -73,9 +73,12 @@
pygeoip.MEMORY_CACHE)</code></p>
<hr />
<div class="fields"> <p><strong>Author:</strong>
Jennifer Ennis &lt;zaylea at gmail dot com&gt;
</p>
<div class="fields"> <dl><dt>Authors:</dt>
<dd>
Jennifer Ennis &lt;zaylea at gmail dot com&gt;,
William Tis&#228;ter &lt;william@defunct.cc&gt;
</dd>
</dl>
<p><strong>License:</strong>
Copyright(C) 2004 MaxMind LLC
<p>This program is free software: you can redistribute it and/or
......@@ -239,7 +242,7 @@
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
Generated by Epydoc 3.0.1 on Thu Sep 20 17:58:04 2012
Generated by Epydoc 3.0.1 on Fri Sep 28 22:42:00 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -167,7 +167,7 @@ object --+
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
Generated by Epydoc 3.0.1 on Thu Sep 20 17:58:04 2012
Generated by Epydoc 3.0.1 on Fri Sep 28 22:42:00 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
......
......@@ -177,7 +177,7 @@ exceptions.BaseException --+
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
Generated by Epydoc 3.0.1 on Thu Sep 20 17:58:04 2012
Generated by Epydoc 3.0.1 on Fri Sep 28 22:42:00 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
......
......@@ -337,7 +337,7 @@ object --+
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
Generated by Epydoc 3.0.1 on Thu Sep 20 17:58:04 2012
Generated by Epydoc 3.0.1 on Fri Sep 28 22:42:00 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
......
......@@ -103,6 +103,20 @@
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a name="PY2"></a><span class="summary-name">PY2</span> = <code title="True">True</code>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a name="PY3"></a><span class="summary-name">PY3</span> = <code title="False">False</code>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a name="GEOIP_STANDARD"></a><span class="summary-name">GEOIP_STANDARD</span> = <code title="0">0</code>
</td>
</tr>
......@@ -282,14 +296,14 @@
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a name="PROXY_EDITION"></a><span class="summary-name">PROXY_EDITION</span> = <code title="8">8</code>
<a name="ASNUM_EDITION"></a><span class="summary-name">ASNUM_EDITION</span> = <code title="9">9</code>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a name="ASNUM_EDITION"></a><span class="summary-name">ASNUM_EDITION</span> = <code title="9">9</code>
<a name="PROXY_EDITION"></a><span class="summary-name">PROXY_EDITION</span> = <code title="8">8</code>
</td>
</tr>
<tr>
......@@ -310,6 +324,34 @@
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a name="IPV6_EDITIONS"></a><span class="summary-name">IPV6_EDITIONS</span> = <code title="(12)"><code class="variable-group">(</code>12<code class="variable-group">)</code></code>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a name="CITY_EDITIONS"></a><span class="summary-name">CITY_EDITIONS</span> = <code title="(6, 2)"><code class="variable-group">(</code>6<code class="variable-op">, </code>2<code class="variable-group">)</code></code>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a name="REGION_EDITIONS"></a><span class="summary-name">REGION_EDITIONS</span> = <code title="(7, 3)"><code class="variable-group">(</code>7<code class="variable-op">, </code>3<code class="variable-group">)</code></code>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a name="REGION_CITY_EDITIONS"></a><span class="summary-name">REGION_CITY_EDITIONS</span> = <code title="(7, 3, 6, 2)"><code class="variable-group">(</code>7<code class="variable-op">, </code>3<code class="variable-op">, </code>6<code class="variable-op">, </code>2<code class="variable-group">)</code></code>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a name="SEGMENT_RECORD_LENGTH"></a><span class="summary-name">SEGMENT_RECORD_LENGTH</span> = <code title="3">3</code>
</td>
</tr>
......@@ -380,7 +422,7 @@
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a name="__package__"></a><span class="summary-name">__package__</span> = <code title="None">None</code>
<a name="__package__"></a><span class="summary-name">__package__</span> = <code title="'pygeoip'"><code class="variable-quote">'</code><code class="variable-string">pygeoip</code><code class="variable-quote">'</code></code>
</td>
</tr>
</table>
......@@ -538,7 +580,7 @@
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
Generated by Epydoc 3.0.1 on Thu Sep 20 17:58:04 2012
Generated by Epydoc 3.0.1 on Fri Sep 28 22:42:00 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -212,7 +212,7 @@
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
Generated by Epydoc 3.0.1 on Thu Sep 20 17:58:04 2012
Generated by Epydoc 3.0.1 on Fri Sep 28 22:42:00 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
......
......@@ -760,22 +760,23 @@
<a name="L697"></a><tt class="py-lineno">697</tt> <tt class="py-line"><tt id="link-694" class="py-name"><a title="pygeoip.timezone._country" class="py-name" href="#" onclick="return doclink('link-694', '_country', 'link-0');">_country</a></tt><tt class="py-op">[</tt><tt class="py-string">"ZM"</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-string">"Africa/Lusaka"</tt> </tt>
<a name="L698"></a><tt class="py-lineno">698</tt> <tt class="py-line"><tt id="link-695" class="py-name"><a title="pygeoip.timezone._country" class="py-name" href="#" onclick="return doclink('link-695', '_country', 'link-0');">_country</a></tt><tt class="py-op">[</tt><tt class="py-string">"ZW"</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-string">"Africa/Harare"</tt> </tt>
<a name="L699"></a><tt class="py-lineno">699</tt> <tt class="py-line"> </tt>
<a name="time_zone_by_country_and_region"></a><div id="time_zone_by_country_and_region-def"><a name="L700"></a><tt class="py-lineno">700</tt> <a class="py-toggle" href="#" id="time_zone_by_country_and_region-toggle" onclick="return toggle('time_zone_by_country_and_region');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="pygeoip.timezone-module.html#time_zone_by_country_and_region">time_zone_by_country_and_region</a><tt class="py-op">(</tt><tt class="py-param">country_code</tt><tt class="py-op">,</tt> <tt class="py-param">region_name</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="time_zone_by_country_and_region-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="time_zone_by_country_and_region-expanded"><a name="L701"></a><tt class="py-lineno">701</tt> <tt class="py-line"> </tt>
<a name="L702"></a><tt class="py-lineno">702</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">country_code</tt> <tt class="py-keyword">not</tt> <tt class="py-keyword">in</tt> <tt id="link-696" class="py-name"><a title="pygeoip.timezone._country" class="py-name" href="#" onclick="return doclink('link-696', '_country', 'link-0');">_country</a></tt><tt class="py-op">:</tt> </tt>
<a name="L703"></a><tt class="py-lineno">703</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">None</tt> </tt>
<a name="L700"></a><tt class="py-lineno">700</tt> <tt class="py-line"> </tt>
<a name="time_zone_by_country_and_region"></a><div id="time_zone_by_country_and_region-def"><a name="L701"></a><tt class="py-lineno">701</tt> <a class="py-toggle" href="#" id="time_zone_by_country_and_region-toggle" onclick="return toggle('time_zone_by_country_and_region');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="pygeoip.timezone-module.html#time_zone_by_country_and_region">time_zone_by_country_and_region</a><tt class="py-op">(</tt><tt class="py-param">country_code</tt><tt class="py-op">,</tt> <tt class="py-param">region_name</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="time_zone_by_country_and_region-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="time_zone_by_country_and_region-expanded"><a name="L702"></a><tt class="py-lineno">702</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">country_code</tt> <tt class="py-keyword">not</tt> <tt class="py-keyword">in</tt> <tt id="link-696" class="py-name"><a title="pygeoip.timezone._country" class="py-name" href="#" onclick="return doclink('link-696', '_country', 'link-0');">_country</a></tt><tt class="py-op">:</tt> </tt>
<a name="L703"></a><tt class="py-lineno">703</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-string">''</tt> </tt>
<a name="L704"></a><tt class="py-lineno">704</tt> <tt class="py-line"> </tt>
<a name="L705"></a><tt class="py-lineno">705</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">region_name</tt> <tt class="py-keyword">or</tt> <tt class="py-name">region_name</tt> <tt class="py-op">==</tt> <tt class="py-string">'00'</tt><tt class="py-op">:</tt> </tt>
<a name="L706"></a><tt class="py-lineno">706</tt> <tt class="py-line"> <tt class="py-name">region_name</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
<a name="L707"></a><tt class="py-lineno">707</tt> <tt class="py-line"> </tt>
<a name="L708"></a><tt class="py-lineno">708</tt> <tt class="py-line"> <tt class="py-name">timezones</tt> <tt class="py-op">=</tt> <tt id="link-697" class="py-name"><a title="pygeoip.timezone._country" class="py-name" href="#" onclick="return doclink('link-697', '_country', 'link-0');">_country</a></tt><tt class="py-op">[</tt><tt class="py-name">country_code</tt><tt class="py-op">]</tt> </tt>
<a name="L709"></a><tt class="py-lineno">709</tt> <tt class="py-line"> </tt>
<a name="L710"></a><tt class="py-lineno">710</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">timezones</tt><tt class="py-op">,</tt> <tt class="py-name">str</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L711"></a><tt class="py-lineno">711</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">timezones</tt> </tt>
<a name="L712"></a><tt class="py-lineno">712</tt> <tt class="py-line"> </tt>
<a name="L713"></a><tt class="py-lineno">713</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">region_name</tt><tt class="py-op">:</tt> </tt>
<a name="L714"></a><tt class="py-lineno">714</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">timezones</tt><tt class="py-op">.</tt><tt class="py-name">get</tt><tt class="py-op">(</tt><tt class="py-name">region_name</tt><tt class="py-op">)</tt> </tt>
</div><a name="L715"></a><tt class="py-lineno">715</tt> <tt class="py-line"> </tt><script type="text/javascript">
<a name="L709"></a><tt class="py-lineno">709</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">timezones</tt><tt class="py-op">,</tt> <tt class="py-name">str</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L710"></a><tt class="py-lineno">710</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">timezones</tt> </tt>
<a name="L711"></a><tt class="py-lineno">711</tt> <tt class="py-line"> </tt>
<a name="L712"></a><tt class="py-lineno">712</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">region_name</tt><tt class="py-op">:</tt> </tt>
<a name="L713"></a><tt class="py-lineno">713</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-string">''</tt> </tt>
<a name="L714"></a><tt class="py-lineno">714</tt> <tt class="py-line"> </tt>
<a name="L715"></a><tt class="py-lineno">715</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">timezones</tt><tt class="py-op">.</tt><tt class="py-name">get</tt><tt class="py-op">(</tt><tt class="py-name">region_name</tt><tt class="py-op">)</tt> </tt>
</div><a name="L716"></a><tt class="py-lineno">716</tt> <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
......@@ -813,7 +814,7 @@ expandto(location.href);
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
Generated by Epydoc 3.0.1 on Thu Sep 20 17:58:05 2012
Generated by Epydoc 3.0.1 on Fri Sep 28 22:42:00 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
......
......@@ -100,12 +100,12 @@
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">int</span>
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="pygeoip.util-module.html#ip2long" class="summary-sig-name">ip2long</a>(<span class="summary-sig-arg">ip</span>)</span><br />
Convert a IPv4 address into a 32-bit integer.</td>
Wrapper function for IPv4 and IPv6 converters</td>
<td align="right" valign="top">
<span class="codelink"><a href="pygeoip.util-pysrc.html#ip2long">source&nbsp;code</a></span>
......@@ -115,6 +115,40 @@
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">int</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="pygeoip.util-module.html#ip2long_v4" class="summary-sig-name">ip2long_v4</a>(<span class="summary-sig-arg">ip</span>)</span><br />
Convert a IPv4 address into a 32-bit integer.</td>
<td align="right" valign="top">
<span class="codelink"><a href="pygeoip.util-pysrc.html#ip2long_v4">source&nbsp;code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">long</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="pygeoip.util-module.html#ip2long_v6" class="summary-sig-name">ip2long_v6</a>(<span class="summary-sig-arg">ip</span>)</span><br />
Convert a IPv6 address into long.</td>
<td align="right" valign="top">
<span class="codelink"><a href="pygeoip.util-pysrc.html#ip2long_v6">source&nbsp;code</a></span>
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- ==================== VARIABLES ==================== -->
<a name="section-Variables"></a>
......@@ -173,6 +207,29 @@
</td>
</tr></table>
<p>Wrapper function for IPv4 and IPv6 converters</p>
<dl class="fields">
<dt>Parameters:</dt>
<dd><ul class="nomargin-top">
<li><strong class="pname"><code>ip</code></strong> (str) - IPv4 or IPv6 address</li>
</ul></dd>
</dl>
</td></tr></table>
</div>
<a name="ip2long_v4"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">ip2long_v4</span>(<span class="sig-arg">ip</span>)</span>
</h3>
</td><td align="right" valign="top"
><span class="codelink"><a href="pygeoip.util-pysrc.html#ip2long_v4">source&nbsp;code</a></span>&nbsp;
</td>
</tr></table>
<p>Convert a IPv4 address into a 32-bit integer.</p>
<dl class="fields">
<dt>Parameters:</dt>
......@@ -184,6 +241,31 @@
</dl>
</td></tr></table>
</div>
<a name="ip2long_v6"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">ip2long_v6</span>(<span class="sig-arg">ip</span>)</span>
</h3>
</td><td align="right" valign="top"
><span class="codelink"><a href="pygeoip.util-pysrc.html#ip2long_v6">source&nbsp;code</a></span>&nbsp;
</td>
</tr></table>
<p>Convert a IPv6 address into long.</p>
<dl class="fields">
<dt>Parameters:</dt>
<dd><ul class="nomargin-top">
<li><strong class="pname"><code>ip</code></strong> (str) - IPv6 address</li>
</ul></dd>
<dt>Returns: long</dt>
<dd>network byte order long</dd>
</dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
......@@ -216,7 +298,7 @@
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
Generated by Epydoc 3.0.1 on Thu Sep 20 17:58:04 2012
Generated by Epydoc 3.0.1 on Fri Sep 28 22:42:00 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
......
......@@ -20,14 +20,17 @@
>pygeoip.GeoIPMetaclass</a><br /> <h2 class="toc">All Functions</h2>
<a target="mainFrame" href="pygeoip.timezone-module.html#time_zone_by_country_and_region"
>pygeoip.timezone.time_zone_by_country_and_region</a><br /> <a target="mainFrame" href="pygeoip.util-module.html#ip2long"
>pygeoip.util.ip2long</a><br /> <h2 class="toc">All Variables</h2>
>pygeoip.util.ip2long</a><br /> <a target="mainFrame" href="pygeoip.util-module.html#ip2long_v4"
>pygeoip.util.ip2long_v4</a><br /> <a target="mainFrame" href="pygeoip.util-module.html#ip2long_v6"
>pygeoip.util.ip2long_v6</a><br /> <h2 class="toc">All Variables</h2>
<a target="mainFrame" href="pygeoip-module.html#MEMORY_CACHE"
>pygeoip.MEMORY_CACHE</a><br /> <a target="mainFrame" href="pygeoip-module.html#MMAP_CACHE"
>pygeoip.MMAP_CACHE</a><br /> <a target="mainFrame" href="pygeoip-module.html#STANDARD"
>pygeoip.STANDARD</a><br /> <a target="mainFrame" href="pygeoip-module.html#__package__"
>pygeoip.__package__</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#ASNUM_EDITION"
>pygeoip.const.ASNUM_EDITION</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#CANADA_OFFSET"
>pygeoip.const.CANADA_OFFSET</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#CITY_EDITION_REV0"
>pygeoip.const.CANADA_OFFSET</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#CITY_EDITIONS"
>pygeoip.const.CITY_EDITIONS</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#CITY_EDITION_REV0"
>pygeoip.const.CITY_EDITION_REV0</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#CITY_EDITION_REV1"
>pygeoip.const.CITY_EDITION_REV1</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#COUNTRY_BEGIN"
>pygeoip.const.COUNTRY_BEGIN</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#COUNTRY_CODES"
......@@ -41,7 +44,8 @@
>pygeoip.const.FIPS_RANGE</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#FULL_RECORD_LENGTH"
>pygeoip.const.FULL_RECORD_LENGTH</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#GEOIP_MEMORY_CACHE"
>pygeoip.const.GEOIP_MEMORY_CACHE</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#GEOIP_STANDARD"
>pygeoip.const.GEOIP_STANDARD</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#ISP_EDITION"
>pygeoip.const.GEOIP_STANDARD</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#IPV6_EDITIONS"
>pygeoip.const.IPV6_EDITIONS</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#ISP_EDITION"
>pygeoip.const.ISP_EDITION</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#MAX_ORG_RECORD_LENGTH"
>pygeoip.const.MAX_ORG_RECORD_LENGTH</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#MAX_RECORD_LENGTH"
>pygeoip.const.MAX_RECORD_LENGTH</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#MEMORY_CACHE"
......@@ -50,7 +54,11 @@
>pygeoip.const.NETSPEED_EDITION</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#ORG_EDITION"
>pygeoip.const.ORG_EDITION</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#ORG_RECORD_LENGTH"
>pygeoip.const.ORG_RECORD_LENGTH</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#PROXY_EDITION"
>pygeoip.const.PROXY_EDITION</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#REGION_EDITION_REV0"
>pygeoip.const.PROXY_EDITION</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#PY2"
>pygeoip.const.PY2</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#PY3"
>pygeoip.const.PY3</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#REGION_CITY_EDITIONS"
>pygeoip.const.REGION_CITY_EDITIONS</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#REGION_EDITIONS"
>pygeoip.const.REGION_EDITIONS</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#REGION_EDITION_REV0"
>pygeoip.const.REGION_EDITION_REV0</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#REGION_EDITION_REV1"
>pygeoip.const.REGION_EDITION_REV1</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#SEGMENT_RECORD_LENGTH"
>pygeoip.const.SEGMENT_RECORD_LENGTH</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#STANDARD"
......
......@@ -15,7 +15,8 @@
<h2 class="toc">Variables</h2>
<a target="mainFrame" href="pygeoip.const-module.html#ASNUM_EDITION"
>ASNUM_EDITION</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#CANADA_OFFSET"
>CANADA_OFFSET</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#CITY_EDITION_REV0"
>CANADA_OFFSET</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#CITY_EDITIONS"
>CITY_EDITIONS</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#CITY_EDITION_REV0"
>CITY_EDITION_REV0</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#CITY_EDITION_REV1"
>CITY_EDITION_REV1</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#COUNTRY_BEGIN"
>COUNTRY_BEGIN</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#COUNTRY_CODES"
......@@ -29,7 +30,8 @@
>FIPS_RANGE</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#FULL_RECORD_LENGTH"
>FULL_RECORD_LENGTH</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#GEOIP_MEMORY_CACHE"
>GEOIP_MEMORY_CACHE</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#GEOIP_STANDARD"
>GEOIP_STANDARD</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#ISP_EDITION"
>GEOIP_STANDARD</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#IPV6_EDITIONS"
>IPV6_EDITIONS</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#ISP_EDITION"
>ISP_EDITION</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#MAX_ORG_RECORD_LENGTH"
>MAX_ORG_RECORD_LENGTH</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#MAX_RECORD_LENGTH"
>MAX_RECORD_LENGTH</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#MEMORY_CACHE"
......@@ -38,7 +40,11 @@
>NETSPEED_EDITION</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#ORG_EDITION"
>ORG_EDITION</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#ORG_RECORD_LENGTH"
>ORG_RECORD_LENGTH</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#PROXY_EDITION"
>PROXY_EDITION</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#REGION_EDITION_REV0"
>PROXY_EDITION</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#PY2"
>PY2</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#PY3"
>PY3</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#REGION_CITY_EDITIONS"
>REGION_CITY_EDITIONS</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#REGION_EDITIONS"
>REGION_EDITIONS</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#REGION_EDITION_REV0"
>REGION_EDITION_REV0</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#REGION_EDITION_REV1"
>REGION_EDITION_REV1</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#SEGMENT_RECORD_LENGTH"
>SEGMENT_RECORD_LENGTH</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#STANDARD"
......
......@@ -14,7 +14,9 @@
<hr />
<h2 class="toc">Functions</h2>
<a target="mainFrame" href="pygeoip.util-module.html#ip2long"
>ip2long</a><br /> <h2 class="toc">Variables</h2>
>ip2long</a><br /> <a target="mainFrame" href="pygeoip.util-module.html#ip2long_v4"
>ip2long_v4</a><br /> <a target="mainFrame" href="pygeoip.util-module.html#ip2long_v6"
>ip2long_v6</a><br /> <h2 class="toc">Variables</h2>
<a target="mainFrame" href="pygeoip.util-module.html#__package__"
>__package__</a><br /><hr />
<span class="options">[<a href="javascript:void(0);" class="privatelink"
......
......@@ -31,7 +31,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/lgpl.txt>.
from __future__ import with_statement, division
import os
import six
import math
import socket
import mmap
......@@ -45,6 +44,7 @@ except ImportError:
import pygeoip.const
from pygeoip import util
from pygeoip.const import PY2, PY3
from pygeoip.timezone import time_zone_by_country_and_region
......@@ -128,14 +128,14 @@ class GeoIP(GeoIPBase):
Supported databases:
COUNTRY_EDITION
REGION_EDITION_REV0
REGION_EDITION_REV1
CITY_EDITION_REV0
CITY_EDITION_REV1
ORG_EDITION
ISP_EDITION
ASNUM_EDITION
* COUNTRY_EDITION
* REGION_EDITION_REV0
* REGION_EDITION_REV1
* CITY_EDITION_REV0
* CITY_EDITION_REV1
* ORG_EDITION
* ISP_EDITION
* ASNUM_EDITION
"""
self._databaseType = const.COUNTRY_EDITION
......@@ -146,7 +146,10 @@ class GeoIP(GeoIPBase):
self._filehandle.seek(-3, os.SEEK_END)
for i in range(const.STRUCTURE_INFO_MAX_SIZE):
if self._filehandle.read(3) == six.u(chr(255) * 3):
chars = chr(255) * 3
encoding = 'unicode_escape'
delim = self._filehandle.read(3)
if (delim == chars) if PY3 else (delim == unicode(chars, encoding)):
self._databaseType = ord(self._filehandle.read(1))
# Backwards compatibility with databases from
......
......@@ -21,6 +21,11 @@ You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/lgpl.txt>.
"""
from platform import python_version_tuple
PY2 = python_version_tuple()[0] == '2'
PY3 = python_version_tuple()[0] == '3'
GEOIP_STANDARD = 0
GEOIP_MEMORY_CACHE = 1
......
......@@ -20,11 +20,12 @@ You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/lgpl.txt>.
"""
import six
import struct
import socket
from array import array
from pygeoip.const import PY3
def ip2long(ip):
"""
......@@ -48,7 +49,7 @@ def ip2long_v4(ip):
@rtype: int
"""
ip_array = ip.split('.')
if six.PY3:
if PY3:
# int and long are unified in py3
ip_long = int(ip_array[0]) * 16777216 + int(ip_array[1]) * 65536 + int(ip_array[2]) * 256 + int(ip_array[3])
else:
......
......@@ -43,6 +43,5 @@ setup(name='pygeoip',
'Programming Language :: Python :: 3.1',
'Programming Language :: Python :: 3.2'],
packages=['pygeoip'],
install_requires=['six'],
license='LGPLv3+',
keywords='geoip')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment