Skip to content

Commit 18739fe

Browse files
committed
Add docs for Metadata attributes
1 parent 45ddee3 commit 18739fe

File tree

1 file changed

+70
-3
lines changed

1 file changed

+70
-3
lines changed

maxminddb/reader.py

Lines changed: 70 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,68 @@ def __enter__(self):
205205

206206

207207
class Metadata(object):
208-
"""Metadata for the MaxMind DB reader"""
208+
"""Metadata for the MaxMind DB reader
209+
210+
211+
.. attribute:: binary_format_major_version
212+
213+
The major version number of the binary format used when creating the
214+
database.
215+
216+
:type: int
217+
218+
.. attribute:: binary_format_minor_version
219+
220+
The minor version number of the binary format used when creating the
221+
database.
222+
223+
:type: int
224+
225+
.. attribute:: build_epoch
226+
227+
The Unix epoch for the build time of the database.
228+
229+
:type: int
230+
231+
.. attribute:: database_type
232+
233+
A string identifying the database type, e.g., "GeoIP2-City".
234+
235+
:type: str
236+
237+
.. attribute:: description
238+
239+
A map from locales to text descriptions of the database.
240+
241+
:type: dict(str, str)
242+
243+
.. attribute:: ip_version
244+
245+
The IP version of the data in a database. A value of "4" means the
246+
database only supports IPv4. A database with a value of "6" may support
247+
both IPv4 and IPv6 lookups.
248+
249+
:type: int
250+
251+
.. attribute:: languages
252+
253+
A list of locale codes supported by the databse.
254+
255+
:type: list(str)
256+
257+
.. attribute:: node_count
258+
259+
The number of nodes in the database.
260+
261+
:type: int
262+
263+
.. attribute:: record_size
264+
265+
The bit size of a record in the search tree.
266+
267+
:type: int
268+
269+
"""
209270

210271
# pylint: disable=too-many-instance-attributes
211272
def __init__(self, **kwargs):
@@ -226,12 +287,18 @@ def __init__(self, **kwargs):
226287

227288
@property
228289
def node_byte_size(self):
229-
"""The size of a node in bytes"""
290+
"""The size of a node in bytes
291+
292+
:type: int
293+
"""
230294
return self.record_size // 4
231295

232296
@property
233297
def search_tree_size(self):
234-
"""The size of the search tree"""
298+
"""The size of the search tree
299+
300+
:type: int
301+
"""
235302
return self.node_count * self.node_byte_size
236303

237304
def __repr__(self):

0 commit comments

Comments
 (0)