Skip to content

Commit f0162b9

Browse files
committed
Deploying to gh-pages from @ a04d3dd 🚀
1 parent 8bcca3f commit f0162b9

File tree

1 file changed

+42
-3
lines changed

1 file changed

+42
-3
lines changed

Diff for: tokenizers.html

+42-3
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,20 @@ <h1 class="title">Module <code>eyecite.tokenizers</code></h1>
548548
cache_dir.mkdir(exist_ok=True)
549549
cache = cache_dir / fingerprint
550550
if cache.exists():
551-
hyperscan_db = hyperscan.loadb(cache.read_bytes())
551+
cache_bytes = cache.read_bytes()
552+
try:
553+
# hyperscan &gt;= 0.5.0 added a mandatory mode argument
554+
hyperscan_db = hyperscan.loadb(
555+
cache_bytes, mode=hyperscan.HS_MODE_BLOCK
556+
)
557+
except TypeError:
558+
hyperscan_db = hyperscan.loadb(cache_bytes)
559+
try:
560+
# at some point Scratch became necessary --
561+
# https://github.com/darvid/python-hyperscan/issues/50#issuecomment-1386243477
562+
hyperscan_db.scratch = hyperscan.Scratch(hyperscan_db)
563+
except AttributeError:
564+
pass
552565

553566
if not hyperscan_db:
554567
# No cache, so compile database.
@@ -849,7 +862,20 @@ <h3>Inherited members</h3>
849862
cache_dir.mkdir(exist_ok=True)
850863
cache = cache_dir / fingerprint
851864
if cache.exists():
852-
hyperscan_db = hyperscan.loadb(cache.read_bytes())
865+
cache_bytes = cache.read_bytes()
866+
try:
867+
# hyperscan &gt;= 0.5.0 added a mandatory mode argument
868+
hyperscan_db = hyperscan.loadb(
869+
cache_bytes, mode=hyperscan.HS_MODE_BLOCK
870+
)
871+
except TypeError:
872+
hyperscan_db = hyperscan.loadb(cache_bytes)
873+
try:
874+
# at some point Scratch became necessary --
875+
# https://github.com/darvid/python-hyperscan/issues/50#issuecomment-1386243477
876+
hyperscan_db.scratch = hyperscan.Scratch(hyperscan_db)
877+
except AttributeError:
878+
pass
853879

854880
if not hyperscan_db:
855881
# No cache, so compile database.
@@ -935,7 +961,20 @@ <h3>Instance variables</h3>
935961
cache_dir.mkdir(exist_ok=True)
936962
cache = cache_dir / fingerprint
937963
if cache.exists():
938-
hyperscan_db = hyperscan.loadb(cache.read_bytes())
964+
cache_bytes = cache.read_bytes()
965+
try:
966+
# hyperscan &gt;= 0.5.0 added a mandatory mode argument
967+
hyperscan_db = hyperscan.loadb(
968+
cache_bytes, mode=hyperscan.HS_MODE_BLOCK
969+
)
970+
except TypeError:
971+
hyperscan_db = hyperscan.loadb(cache_bytes)
972+
try:
973+
# at some point Scratch became necessary --
974+
# https://github.com/darvid/python-hyperscan/issues/50#issuecomment-1386243477
975+
hyperscan_db.scratch = hyperscan.Scratch(hyperscan_db)
976+
except AttributeError:
977+
pass
939978

940979
if not hyperscan_db:
941980
# No cache, so compile database.

0 commit comments

Comments
 (0)