Commit 4c3ec00b by William Tisäter

Make epydoc generation work and update documentation

parent 054066d5
......@@ -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 11:41:42 2012
Generated by Epydoc 3.0.1 on Thu Sep 20 17:58:04 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 11:41:42 2012
Generated by Epydoc 3.0.1 on Thu Sep 20 17:58:04 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
......
......@@ -437,7 +437,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 11:41:42 2012
Generated by Epydoc 3.0.1 on Thu Sep 20 17:58:04 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 11:41:42 2012
Generated by Epydoc 3.0.1 on Thu Sep 20 17:58:04 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
......
......@@ -239,7 +239,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 11:41:42 2012
Generated by Epydoc 3.0.1 on Thu Sep 20 17:58:04 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
......
......@@ -1026,7 +1026,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 11:41:42 2012
Generated by Epydoc 3.0.1 on Thu Sep 20 17:58:04 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
......
......@@ -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 11:41:42 2012
Generated by Epydoc 3.0.1 on Thu Sep 20 17:58:04 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 11:41:42 2012
Generated by Epydoc 3.0.1 on Thu Sep 20 17:58:04 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 11:41:42 2012
Generated by Epydoc 3.0.1 on Thu Sep 20 17:58:04 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
......
......@@ -538,7 +538,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 11:41:42 2012
Generated by Epydoc 3.0.1 on Thu Sep 20 17:58:04 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
......
......@@ -482,7 +482,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 11:41:42 2012
Generated by Epydoc 3.0.1 on Thu Sep 20 17:58:04 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
......
......@@ -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 11:41:42 2012
Generated by Epydoc 3.0.1 on Thu Sep 20 17:58:04 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
......
......@@ -760,23 +760,22 @@
<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="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>
<a name="L703"></a><tt class="py-lineno">703</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="L704"></a><tt class="py-lineno">704</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">None</tt> </tt>
<a name="L705"></a><tt class="py-lineno">705</tt> <tt class="py-line"> </tt>
<a name="L706"></a><tt class="py-lineno">706</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="L707"></a><tt class="py-lineno">707</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="L708"></a><tt class="py-lineno">708</tt> <tt class="py-line"> </tt>
<a name="L709"></a><tt class="py-lineno">709</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="L710"></a><tt class="py-lineno">710</tt> <tt class="py-line"> </tt>
<a name="L711"></a><tt class="py-lineno">711</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="L712"></a><tt class="py-lineno">712</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">timezones</tt> </tt>
<a name="L713"></a><tt class="py-lineno">713</tt> <tt class="py-line"> </tt>
<a name="L714"></a><tt class="py-lineno">714</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="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">
<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="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">
<!--
expandto(location.href);
// -->
......@@ -814,7 +813,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 11:41:42 2012
Generated by Epydoc 3.0.1 on Thu Sep 20 17:58:05 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
......
......@@ -216,7 +216,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 11:41:42 2012
Generated by Epydoc 3.0.1 on Thu Sep 20 17:58:04 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
......
......@@ -140,7 +140,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 11:41:42 2012
Generated by Epydoc 3.0.1 on Thu Sep 20 17:58:04 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
......
......@@ -27,8 +27,9 @@ 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 __future__ import with_statement, absolute_import, division
from __future__ import with_statement, division
import os
import six
import math
import socket
import mmap
......@@ -40,21 +41,21 @@ try:
except ImportError:
from io import StringIO
from . import const
from .util import ip2long
from .timezone import time_zone_by_country_and_region
import const
from util import ip2long
from timezone import time_zone_by_country_and_region
import six
MMAP_CACHE = const.MMAP_CACHE
MEMORY_CACHE = const.MEMORY_CACHE
STANDARD = const.STANDARD
class GeoIPError(Exception):
pass
class GeoIPMetaclass(type):
class GeoIPMetaclass(type):
def __new__(cls, *args, **kwargs):
"""
Singleton method to gets an instance without reparsing the db. Unique
......@@ -77,10 +78,11 @@ class GeoIPMetaclass(type):
return cls._instances[filename]
GeoIPBase = GeoIPMetaclass('GeoIPBase', (object,), {})
class GeoIP(GeoIPBase):
class GeoIP(GeoIPBase):
def __init__(self, filename, flags=0):
"""
Initialize the class.
......@@ -617,8 +619,8 @@ class GeoIP(GeoIPBase):
Look up the time zone for a given IP address.
Use this method if you have a Region or City database.
@param hostname: IP address
@type hostname: str
@param addr: IP address
@type addr: str
@return: Time zone
@rtype: str
"""
......
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