Skip to content

Commit 0571ef8

Browse files
committed
First commit
1 parent 339f02e commit 0571ef8

File tree

1 file changed

+125
-0
lines changed

1 file changed

+125
-0
lines changed

mapcode/__init__.py

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# This file was automatically generated by SWIG (http://www.swig.org).
2+
# Version 3.0.5
3+
#
4+
# Do not make changes to this file unless you know what you are doing--modify
5+
# the SWIG interface file instead.
6+
7+
8+
9+
10+
"""
11+
Routines to encode latitude/longitudes to mapcodes and back.
12+
13+
See mapcode.org for more information on Mapcode.
14+
"""
15+
16+
17+
from sys import version_info
18+
if version_info >= (2, 6, 0):
19+
def swig_import_helper():
20+
from os.path import dirname
21+
import imp
22+
fp = None
23+
try:
24+
fp, pathname, description = imp.find_module('_mapcode', [dirname(__file__)])
25+
except ImportError:
26+
import _mapcode
27+
return _mapcode
28+
if fp is not None:
29+
try:
30+
_mod = imp.load_module('_mapcode', fp, pathname, description)
31+
finally:
32+
fp.close()
33+
return _mod
34+
_mapcode = swig_import_helper()
35+
del swig_import_helper
36+
else:
37+
import _mapcode
38+
del version_info
39+
try:
40+
_swig_property = property
41+
except NameError:
42+
pass # Python < 2.2 doesn't have 'property'.
43+
44+
45+
def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
46+
if (name == "thisown"):
47+
return self.this.own(value)
48+
if (name == "this"):
49+
if type(value).__name__ == 'SwigPyObject':
50+
self.__dict__[name] = value
51+
return
52+
method = class_type.__swig_setmethods__.get(name, None)
53+
if method:
54+
return method(self, value)
55+
if (not static):
56+
if _newclass:
57+
object.__setattr__(self, name, value)
58+
else:
59+
self.__dict__[name] = value
60+
else:
61+
raise AttributeError("You cannot add attributes to %s" % self)
62+
63+
64+
def _swig_setattr(self, class_type, name, value):
65+
return _swig_setattr_nondynamic(self, class_type, name, value, 0)
66+
67+
68+
def _swig_getattr_nondynamic(self, class_type, name, static=1):
69+
if (name == "thisown"):
70+
return self.this.own()
71+
method = class_type.__swig_getmethods__.get(name, None)
72+
if method:
73+
return method(self)
74+
if (not static):
75+
return object.__getattr__(self, name)
76+
else:
77+
raise AttributeError(name)
78+
79+
def _swig_getattr(self, class_type, name):
80+
return _swig_getattr_nondynamic(self, class_type, name, 0)
81+
82+
83+
def _swig_repr(self):
84+
try:
85+
strthis = "proxy of " + self.this.__repr__()
86+
except:
87+
strthis = ""
88+
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
89+
90+
try:
91+
_object = object
92+
_newclass = 1
93+
except AttributeError:
94+
class _object:
95+
pass
96+
_newclass = 0
97+
98+
99+
100+
def version():
101+
return _mapcode.version()
102+
version = _mapcode.version
103+
104+
def encode(latitude, longitude, territory=None, extra_digits=0):
105+
return _mapcode.encode(latitude, longitude, territory, extra_digits)
106+
encode = _mapcode.encode
107+
108+
def encode_single(latitude, longitude, territory=None, extra_digits=0):
109+
return _mapcode.encode_single(latitude, longitude, territory, extra_digits)
110+
encode_single = _mapcode.encode_single
111+
112+
def decode(mapcode, territory=None):
113+
return _mapcode.decode(mapcode, territory)
114+
decode = _mapcode.decode
115+
116+
def isvalid(mapcode, includesTerritory):
117+
return _mapcode.isvalid(mapcode, includesTerritory)
118+
isvalid = _mapcode.isvalid
119+
120+
def alphabet(mapcode, alphabet):
121+
return _mapcode.alphabet(mapcode, alphabet)
122+
alphabet = _mapcode.alphabet
123+
# This file is compatible with both classic and new-style classes.
124+
125+

0 commit comments

Comments
 (0)