Skip to content

Commit

Permalink
pw_tokenizer: Add prefix to AutoUpdatingDetokenizer
Browse files Browse the repository at this point in the history
Allow AutoUpdatingDetokenizer to set the prefix in base
Detokenizer class

Change-Id: I34a4981037fe34f44d8a524b3d04647bd47e426f
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/243612
Presubmit-Verified: CQ Bot Account <[email protected]>
Commit-Queue: Auto-Submit <[email protected]>
Lint: Lint 🤖 <[email protected]>
Reviewed-by: Wyatt Hepler <[email protected]>
Docs-Not-Needed: Wyatt Hepler <[email protected]>
Pigweed-Auto-Submit: Al Semjonovs <[email protected]>
  • Loading branch information
asemjonovs authored and CQ Bot Account committed Oct 21, 2024
1 parent 5eec847 commit e4d8db4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pw_tokenizer/py/pw_tokenizer/detokenize.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,14 +524,15 @@ def __init__(
*paths_or_files: Path | str,
min_poll_period_s: float = 1.0,
pool: Executor = ThreadPoolExecutor(max_workers=1),
prefix: str | bytes = encode.NESTED_TOKEN_PREFIX,
) -> None:
self.paths = tuple(self._DatabasePath(path) for path in paths_or_files)
self.min_poll_period_s = min_poll_period_s
self._last_checked_time: float = time.time()
# Thread pool to use for loading the databases. Limit to a single
# worker since this is low volume and not time critical.
self._pool = pool
super().__init__(*(path.load() for path in self.paths))
super().__init__(*(path.load() for path in self.paths), prefix=prefix)

def __del__(self) -> None:
self._pool.shutdown(wait=False)
Expand Down

0 comments on commit e4d8db4

Please sign in to comment.