-
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.
fix: double-check importing correctly errors if render neither behave…
…s as a package nor isolated module
- Loading branch information
Showing
2 changed files
with
43 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
"""Testing example renderer. | ||
Correctly fails to import to show a broken module being handled. | ||
""" | ||
|
||
from typing import Unpack, TypedDict | ||
from dewret.workflow import Workflow | ||
|
||
# This lacking a relative import, while extra itself | ||
# uses one is what breaks the module. It cannot be both | ||
# a package and not-a-package. This is importable by | ||
# adding a . before extra. If instead, you try to avoid | ||
# relative imports altogether, and change .other -> other | ||
# in extra, it will also break, as the directory of this | ||
# file is not in the PATH. | ||
from extra import JUMP # type: ignore | ||
|
||
class UnfrenderRendererConfiguration(TypedDict): | ||
allow_complex_types: bool | ||
|
||
def default_config() -> UnfrenderRendererConfiguration: | ||
return { | ||
"allow_complex_types": True | ||
} | ||
|
||
def render_raw( | ||
workflow: Workflow, **kwargs: Unpack[UnfrenderRendererConfiguration] | ||
) -> dict[str, str]: | ||
return {"JUMP": str(JUMP)} |
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