Skip to content

Commit a4db64a

Browse files
oschwaldclaude
andcommitted
Update README to recommend Mode enum over MODE constants
Updated the README to suggest using the new Mode enum style (e.g., Mode.FILE) instead of the old constant style (e.g., MODE_FILE). The old constants remain available for backward compatibility, but the enum provides better IDE support and type safety. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 5648f66 commit a4db64a

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

README.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,19 @@ provide `free GeoLite2 databases
3939
files must be decompressed with ``gunzip``.
4040

4141
After you have obtained a database and imported the module, call
42-
``open_database`` with a path, or file descriptor (in the case of ``MODE_FD``),
42+
``open_database`` with a path, or file descriptor (in the case of ``Mode.FD``),
4343
to the database as the first argument. Optionally, you may pass a mode as the
44-
second argument. The modes are exported from ``maxminddb``. Valid modes are:
45-
46-
* ``MODE_MMAP_EXT`` - use the C extension with memory map.
47-
* ``MODE_MMAP`` - read from memory map. Pure Python.
48-
* ``MODE_FILE`` - read database as standard file. Pure Python.
49-
* ``MODE_MEMORY`` - load database into memory. Pure Python.
50-
* ``MODE_FD`` - load database into memory from a file descriptor. Pure Python.
51-
* ``MODE_AUTO`` - try ``MODE_MMAP_EXT``, ``MODE_MMAP``, ``MODE_FILE`` in that
44+
second argument. The modes are available from ``maxminddb.Mode``. Valid modes are:
45+
46+
* ``Mode.MMAP_EXT`` - use the C extension with memory map.
47+
* ``Mode.MMAP`` - read from memory map. Pure Python.
48+
* ``Mode.FILE`` - read database as standard file. Pure Python.
49+
* ``Mode.MEMORY`` - load database into memory. Pure Python.
50+
* ``Mode.FD`` - load database into memory from a file descriptor. Pure Python.
51+
* ``Mode.AUTO`` - try ``Mode.MMAP_EXT``, ``Mode.MMAP``, ``Mode.FILE`` in that
5252
order. Default.
5353

54-
**NOTE**: When using ``MODE_FD``, it is the *caller's* responsibility to be
54+
**NOTE**: When using ``Mode.FD``, it is the *caller's* responsibility to be
5555
sure that the file descriptor gets closed properly. The caller may close the
5656
file descriptor immediately after the ``Reader`` object is created.
5757

0 commit comments

Comments
 (0)