Skip to content

Commit

Permalink
Remove runtime dep on typing_extensions (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
zakstucke authored Feb 6, 2024
1 parent 61f4ca3 commit 1e7be24
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions py_rust/python/zetch/_yaml.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import typing_extensions as tp


class Update(tp.TypedDict):
# The path in the yaml file to update.
path: "list[tp.Union[str, int]]"
# If key doesn't exist will be treated as delete.
# The string will be a json str that needs to be decoded.
put: "tp.NotRequired[str]"
import typing

# Can't use typing_extensions at runtime, would be an extra python dep.
if typing.TYPE_CHECKING:
import typing_extensions as tp

class Update(tp.TypedDict):
# The path in the yaml file to update.
path: "list[tp.Union[str, int]]"
# If key doesn't exist will be treated as delete.
# The string will be a json str that needs to be decoded.
put: "tp.NotRequired[str]"


def modify_yaml(src: str, updates: "list[Update]") -> memoryview:
Expand Down

0 comments on commit 1e7be24

Please sign in to comment.