refactor python reader to take a get_bytes function; add reader tests [#38]

This commit is contained in:
Brandon Liu
2022-04-26 16:15:03 +08:00
parent adb6f896a3
commit 3944d27833
4 changed files with 79 additions and 39 deletions

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env python
import sys
from pmtiles.reader import read
from pmtiles.reader import Reader, MmapSource
if len(sys.argv) <= 1:
print("Usage: pmtiles-show PMTILES_FILE")
@@ -9,7 +9,8 @@ if len(sys.argv) <= 1:
print("Usage: pmtiles-show PMTILES_FILE list")
exit(1)
with read(sys.argv[1]) as reader:
with open(sys.argv[1],'r+b') as f:
reader = Reader(MmapSource(f))
spec_version = reader.version
if len(sys.argv) == 2:
print("spec version: ", spec_version)