Commit 6c7f4c3
Convert Metadata class to dataclass
Convert the pure Python `maxminddb.reader.Metadata` class to use
@DataClass(kw_only=True) for cleaner, more maintainable code.
Changes:
- Added dataclass import and decorator
- Removed manual __init__ method (15+ lines of boilerplate)
- Removed custom __repr__ method
- Preserved @Property methods for node_byte_size and search_tree_size
- All functionality remains identical
Breaking change: The __repr__ format changes from
`maxminddb.reader.Metadata(...)` to `Metadata(...)`. This is
documented in HISTORY.rst.
The C extension's Metadata class is unchanged.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 89abe7e commit 6c7f4c3
2 files changed
Lines changed: 17 additions & 44 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
25 | 32 | | |
26 | 33 | | |
27 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
307 | 308 | | |
308 | 309 | | |
309 | 310 | | |
| 311 | + | |
310 | 312 | | |
311 | 313 | | |
312 | 314 | | |
| |||
323 | 325 | | |
324 | 326 | | |
325 | 327 | | |
326 | | - | |
327 | | - | |
328 | | - | |
| 328 | + | |
329 | 329 | | |
330 | 330 | | |
331 | | - | |
332 | | - | |
333 | | - | |
| 331 | + | |
334 | 332 | | |
335 | 333 | | |
336 | | - | |
337 | | - | |
338 | | - | |
| 334 | + | |
339 | 335 | | |
340 | 336 | | |
341 | 337 | | |
| |||
345 | 341 | | |
346 | 342 | | |
347 | 343 | | |
348 | | - | |
349 | | - | |
350 | | - | |
| 344 | + | |
351 | 345 | | |
352 | 346 | | |
353 | | - | |
354 | | - | |
355 | | - | |
| 347 | + | |
356 | 348 | | |
357 | 349 | | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
| 350 | + | |
375 | 351 | | |
376 | 352 | | |
377 | 353 | | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
| 354 | + | |
382 | 355 | | |
383 | 356 | | |
384 | 357 | | |
385 | 358 | | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
| 359 | + | |
390 | 360 | | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
0 commit comments