diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-12-12 15:42:33 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-12-12 15:42:33 +0000 |
commit | 579e404567dfff42e64325a8c79f03ac627ea341 (patch) | |
tree | 12d101aa5d1b70a69132e5cbd3307741c00d097f /sqlglot/helper.py | |
parent | Adding upstream version 10.1.3. (diff) | |
download | sqlglot-a2bc9c35bd58ff935bf37447572939c713546e14.tar.xz sqlglot-a2bc9c35bd58ff935bf37447572939c713546e14.zip |
Adding upstream version 10.2.6.upstream/10.2.6
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sqlglot/helper.py')
-rw-r--r-- | sqlglot/helper.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sqlglot/helper.py b/sqlglot/helper.py index 8c5808d..ed37e6c 100644 --- a/sqlglot/helper.py +++ b/sqlglot/helper.py @@ -385,3 +385,11 @@ def dict_depth(d: t.Dict) -> int: except StopIteration: # d.values() returns an empty sequence return 1 + + +def first(it: t.Iterable[T]) -> T: + """Returns the first element from an iterable. + + Useful for sets. + """ + return next(i for i in it) |