Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
BasedOnStyle: LLVM
IndentWidth: 4
BinPackArguments: false
BinPackParameters: false
IndentCaseLabels: true
78 changes: 0 additions & 78 deletions .uncrustify.cfg

This file was deleted.

2 changes: 2 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ History
``ipaddress.IPv6Address`` objects in addition to strings. This works with
both the pure Python implementation as well as the extension. Based on a
pull request #48 by Eric Pruitt. GitHub #50.
* A new method, ``get_with_prefix_len`` was added. This method returns a
tuple containing the record and the prefix length.

1.4.1 (2018-06-22)
++++++++++++++++++
Expand Down
8 changes: 8 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ corresponding values for the IP address from the database (e.g., a dictionary
for GeoIP2/GeoLite2 databases). If the database does not contain a record for
that IP address, the method will return ``None``.

If you wish to also retrieve the prefix length for the record, use the
``get_with_prefix_len`` method. This returns a tuple containing the record
followed by the network prefix length associated with the record.

Example
-------

Expand All @@ -70,9 +74,13 @@ Example
>>> import maxminddb
>>>
>>> reader = maxminddb.open_database('GeoLite2-City.mmdb')
>>>
>>> reader.get('1.1.1.1')
{'country': ... }
>>>
>>> reader.get_with_prefix_len('1.1.1.1')
({'country': ... }, 24)
>>>
>>> reader.close()

Exceptions
Expand Down
15 changes: 15 additions & 0 deletions dev-bin/clang-format-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

format="clang-format -i -style=file"

for dir in extension; do
c_files=`find $dir -maxdepth 1 -name '*.c'`
if [ "$c_files" != "" ]; then
$format $dir/*.c;
fi

h_files=`find $dir -maxdepth 1 -name '*.h'`
if [ "$h_files" != "" ]; then
$format $dir/*.h;
fi
done
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

# General information about the project.
project = 'maxminddb'
copyright = '2013-2018, MaxMind, Inc.'
copyright = '2013-2019, MaxMind, Inc.'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ Indices and tables
* :ref:`modindex`
* :ref:`search`

:copyright: (c) 2013-2018 by MaxMind, Inc.
:copyright: (c) 2013-2019 by MaxMind, Inc.
:license: Apache License, Version 2.0

Loading