Skip to content

Commit bc1937d

Browse files
authored
Merge pull request #47 from maxmind/greg/run-yapf
Run recent YAPF version against code
2 parents cf42a02 + b65ef5b commit bc1937d

File tree

4 files changed

+48
-50
lines changed

4 files changed

+48
-50
lines changed

examples/benchmark.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@
1111
import timeit
1212

1313
parser = argparse.ArgumentParser(description='Benchmark maxminddb.')
14-
parser.add_argument(
15-
'--count', default=250000, type=int, help='number of lookups')
14+
parser.add_argument('--count',
15+
default=250000,
16+
type=int,
17+
help='number of lookups')
1618
parser.add_argument('--mode', default=0, type=int, help='reader mode to use')
17-
parser.add_argument(
18-
'--file', default='GeoIP2-City.mmdb', help='path to mmdb file')
19+
parser.add_argument('--file',
20+
default='GeoIP2-City.mmdb',
21+
help='path to mmdb file')
1922

2023
args = parser.parse_args()
2124

@@ -27,9 +30,8 @@ def lookup_ip_address():
2730
record = reader.get(str(ip))
2831

2932

30-
elapsed = timeit.timeit(
31-
'lookup_ip_address()',
32-
setup='from __main__ import lookup_ip_address',
33-
number=args.count)
33+
elapsed = timeit.timeit('lookup_ip_address()',
34+
setup='from __main__ import lookup_ip_address',
35+
number=args.count)
3436

3537
print(args.count / elapsed, 'lookups per second')

maxminddb/decoder.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
class Decoder(object): # pylint: disable=too-few-public-methods
1717
"""Decoder for the data section of the MaxMind DB"""
18-
1918
def __init__(self, database_buffer, pointer_base=0, pointer_test=False):
2019
"""Created a Decoder for a MaxMind DB
2120

maxminddb/file.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
class FileBuffer(object):
1313
"""A slice-able file reader"""
14-
1514
def __init__(self, database):
1615
self._handle = open(database, 'rb')
1716
self._size = os.fstat(self._handle.fileno()).st_size

setup.py

Lines changed: 38 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ def status_msgs(*msgs):
9696
def find_packages(location):
9797
packages = []
9898
for pkg in ['maxminddb']:
99-
for _dir, subdirectories, files in (os.walk(
100-
os.path.join(location, pkg))):
99+
for _dir, subdirectories, files in (os.walk(os.path.join(
100+
location, pkg))):
101101
if '__init__.py' in files:
102102
tokens = _dir.split(os.sep)[len(location.split(os.sep)):]
103103
packages.append(".".join(tokens))
@@ -110,48 +110,46 @@ def run_setup(with_cext):
110110
if Feature:
111111
kwargs['features'] = {
112112
'extension':
113-
Feature(
114-
"optional C implementation",
115-
standard=True,
116-
ext_modules=ext_module)
113+
Feature("optional C implementation",
114+
standard=True,
115+
ext_modules=ext_module)
117116
}
118117
else:
119118
kwargs['ext_modules'] = ext_module
120119

121-
setup(
122-
name='maxminddb',
123-
version=VERSION,
124-
author='Gregory Oschwald',
125-
author_email='[email protected]',
126-
description='Reader for the MaxMind DB format',
127-
long_description=README,
128-
url='http://www.maxmind.com/',
129-
packages=find_packages('.'),
130-
package_data={'': ['LICENSE']},
131-
package_dir={'maxminddb': 'maxminddb'},
132-
python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*',
133-
include_package_data=True,
134-
install_requires=requirements,
135-
tests_require=['nose'],
136-
test_suite='nose.collector',
137-
license=LICENSE,
138-
cmdclass=cmdclass,
139-
classifiers=[
140-
'Development Status :: 5 - Production/Stable',
141-
'Environment :: Web Environment',
142-
'Intended Audience :: Developers',
143-
'Intended Audience :: System Administrators',
144-
'License :: OSI Approved :: Apache Software License',
145-
'Programming Language :: Python :: 2.7',
146-
'Programming Language :: Python :: 3',
147-
'Programming Language :: Python :: 3.5',
148-
'Programming Language :: Python :: 3.6',
149-
'Programming Language :: Python :: 3.7',
150-
'Programming Language :: Python',
151-
'Topic :: Internet :: Proxy Servers',
152-
'Topic :: Internet',
153-
],
154-
**kwargs)
120+
setup(name='maxminddb',
121+
version=VERSION,
122+
author='Gregory Oschwald',
123+
author_email='[email protected]',
124+
description='Reader for the MaxMind DB format',
125+
long_description=README,
126+
url='http://www.maxmind.com/',
127+
packages=find_packages('.'),
128+
package_data={'': ['LICENSE']},
129+
package_dir={'maxminddb': 'maxminddb'},
130+
python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*',
131+
include_package_data=True,
132+
install_requires=requirements,
133+
tests_require=['nose'],
134+
test_suite='nose.collector',
135+
license=LICENSE,
136+
cmdclass=cmdclass,
137+
classifiers=[
138+
'Development Status :: 5 - Production/Stable',
139+
'Environment :: Web Environment',
140+
'Intended Audience :: Developers',
141+
'Intended Audience :: System Administrators',
142+
'License :: OSI Approved :: Apache Software License',
143+
'Programming Language :: Python :: 2.7',
144+
'Programming Language :: Python :: 3',
145+
'Programming Language :: Python :: 3.5',
146+
'Programming Language :: Python :: 3.6',
147+
'Programming Language :: Python :: 3.7',
148+
'Programming Language :: Python',
149+
'Topic :: Internet :: Proxy Servers',
150+
'Topic :: Internet',
151+
],
152+
**kwargs)
155153

156154

157155
if PYPY or JYTHON:

0 commit comments

Comments
 (0)