Skip to content

Commit 21d7053

Browse files
committed
Correct format. Add modes to benchmark script
1 parent 6b92980 commit 21d7053

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

examples/benchmark.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@
1313
parser = argparse.ArgumentParser(description='Benchmark maxminddb.')
1414
parser.add_argument('--count', default=250000, type=int,
1515
help='number of lookups')
16+
parser.add_argument('--mode', default=0, type=int,
17+
help='reader mode to use')
1618
parser.add_argument('--file', default='GeoIP2-City.mmdb',
1719
help='path to mmdb file')
1820

1921
args = parser.parse_args()
2022

21-
reader = maxminddb.Reader(args.file)
23+
reader = maxminddb.open_database(args.file, args.mode)
2224

2325

2426
def lookup_ip_address():

maxminddb/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def open_database(database, mode=MODE_AUTO):
3131
return maxminddb.extension.Reader(database)
3232
elif mode in (MODE_AUTO, MODE_MMAP, MODE_FILE, MODE_MEMORY):
3333
return maxminddb.reader.Reader(database, mode)
34-
raise ValueError('Unsupported open mode: {}', mode)
34+
raise ValueError('Unsupported open mode: {0}'.format(mode))
3535

3636

3737
def Reader(database): # pylint: disable=invalid-name

0 commit comments

Comments
 (0)