forked from ITISFoundation/osparc-simcore
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into upgrade-api-server-dependencies
- Loading branch information
Showing
70 changed files
with
954 additions
and
676 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from typing import Any | ||
|
||
|
||
class UnSet: | ||
VALUE: "UnSet" | ||
|
||
|
||
UnSet.VALUE = UnSet() | ||
|
||
|
||
def as_dict_exclude_unset(**params) -> dict[str, Any]: | ||
return {k: v for k, v in params.items() if not isinstance(v, UnSet)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from typing import Any | ||
|
||
from common_library.unset import UnSet, as_dict_exclude_unset | ||
|
||
|
||
def test_as_dict_exclude_unset(): | ||
def f( | ||
par1: str | UnSet = UnSet.VALUE, par2: int | UnSet = UnSet.VALUE | ||
) -> dict[str, Any]: | ||
return as_dict_exclude_unset(par1=par1, par2=par2) | ||
|
||
assert f() == {} | ||
assert f(par1="hi") == {"par1": "hi"} | ||
assert f(par2=4) == {"par2": 4} | ||
assert f(par1="hi", par2=4) == {"par1": "hi", "par2": 4} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.