diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-05-03 09:12:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-05-03 09:12:28 +0000 |
commit | 67c28dbe67209effad83d93b850caba5ee1e20e3 (patch) | |
tree | dffdfbfb4f0899c92a4c978e6eac55af2ff76367 /sqlglot/trie.py | |
parent | Releasing debian version 11.5.2-1. (diff) | |
download | sqlglot-67c28dbe67209effad83d93b850caba5ee1e20e3.tar.xz sqlglot-67c28dbe67209effad83d93b850caba5ee1e20e3.zip |
Merging upstream version 11.7.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sqlglot/trie.py')
-rw-r--r-- | sqlglot/trie.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sqlglot/trie.py b/sqlglot/trie.py index f3b1c38..eba91b9 100644 --- a/sqlglot/trie.py +++ b/sqlglot/trie.py @@ -3,7 +3,7 @@ import typing as t key = t.Sequence[t.Hashable] -def new_trie(keywords: t.Iterable[key]) -> t.Dict: +def new_trie(keywords: t.Iterable[key], trie: t.Optional[t.Dict] = None) -> t.Dict: """ Creates a new trie out of a collection of keywords. @@ -16,11 +16,12 @@ def new_trie(keywords: t.Iterable[key]) -> t.Dict: Args: keywords: the keywords to create the trie from. + trie: a trie to mutate instead of creating a new one Returns: The trie corresponding to `keywords`. """ - trie: t.Dict = {} + trie = {} if trie is None else trie for key in keywords: current = trie |