Skip to content

Commit

Permalink
feat!: Improve Contain stmt and implement Dask
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Remove `verbose` from Contain statement in favor of
`report_limit`. Null values are now valid
  • Loading branch information
bressanmarcos committed Jul 20, 2022
1 parent e824d78 commit effa169
Show file tree
Hide file tree
Showing 4 changed files with 342 additions and 197 deletions.
13 changes: 12 additions & 1 deletion deirokay/_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from difflib import get_close_matches
from typing import Generator, Iterable, TypeVar
from typing import Generator, Iterable, TypeVar, Union

from jinja2.nativetypes import Environment

Expand Down Expand Up @@ -77,3 +77,14 @@ def render_dict(env: Environment, dict_: dict, template: dict):
render_dict(env, value, template)
elif isinstance(value, list):
render_list(env, value, template)


T = TypeVar('T')


def noneor(*operands: T) -> Union[T, None]:
"""Return the first non-None element."""
for item in operands:
if item is not None:
return item
return None

0 comments on commit effa169

Please sign in to comment.