Merging upstream version 11.4.1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
ecb42ec17f
commit
63746a3e92
89 changed files with 35352 additions and 33081 deletions
|
@ -403,3 +403,20 @@ def first(it: t.Iterable[T]) -> T:
|
|||
Useful for sets.
|
||||
"""
|
||||
return next(i for i in it)
|
||||
|
||||
|
||||
def should_identify(text: str, identify: str | bool) -> bool:
|
||||
"""Checks if text should be identified given an identify option.
|
||||
|
||||
Args:
|
||||
text: the text to check.
|
||||
identify: "always" | True - always returns true, "safe" - true if no upper case
|
||||
|
||||
Returns:
|
||||
Whether or not a string should be identified.
|
||||
"""
|
||||
if identify is True or identify == "always":
|
||||
return True
|
||||
if identify == "safe":
|
||||
return not any(char.isupper() for char in text)
|
||||
return False
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue