dycw-utilities 0.166.36__py3-none-any.whl → 0.166.37__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of dycw-utilities might be problematic. Click here for more details.
- {dycw_utilities-0.166.36.dist-info → dycw_utilities-0.166.37.dist-info}/METADATA +1 -1
- {dycw_utilities-0.166.36.dist-info → dycw_utilities-0.166.37.dist-info}/RECORD +7 -7
- utilities/__init__.py +1 -1
- utilities/jinja2.py +29 -1
- {dycw_utilities-0.166.36.dist-info → dycw_utilities-0.166.37.dist-info}/WHEEL +0 -0
- {dycw_utilities-0.166.36.dist-info → dycw_utilities-0.166.37.dist-info}/entry_points.txt +0 -0
- {dycw_utilities-0.166.36.dist-info → dycw_utilities-0.166.37.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
utilities/__init__.py,sha256=
|
|
1
|
+
utilities/__init__.py,sha256=5A2yZ5q_GCT119LdZKfbPBpyhrtF0D3ytDUhvCLLd1s,61
|
|
2
2
|
utilities/aeventkit.py,sha256=ddoleSwW9zdc2tjX5Ge0pMKtYwV_JMxhHYOxnWX2AGM,12609
|
|
3
3
|
utilities/altair.py,sha256=nHdpWt8ZwdUwRQN970MvHd5bRWokNqzHcZQEdSHKRuE,9033
|
|
4
4
|
utilities/asyncio.py,sha256=60l1IwjnRGeaVphAFiwDIHyfKoZYKY-XGpptUxGiU-M,17034
|
|
@@ -28,7 +28,7 @@ utilities/importlib.py,sha256=mV1xT_O_zt_GnZZ36tl3xOmMaN_3jErDWY54fX39F6Y,429
|
|
|
28
28
|
utilities/inflect.py,sha256=v7YkOWSu8NAmVghPcf4F3YBZQoJCS47_DLf9jbfWIs0,581
|
|
29
29
|
utilities/ipython.py,sha256=V2oMYHvEKvlNBzxDXdLvKi48oUq2SclRg5xasjaXStw,763
|
|
30
30
|
utilities/iterables.py,sha256=t2TsW-K3rVlS6y4_tqcc1fk9RwJV-bi7G_VwduMABK0,42558
|
|
31
|
-
utilities/jinja2.py,sha256=
|
|
31
|
+
utilities/jinja2.py,sha256=JpNHMcyMJDguX8rBN4wEz-v4En7w6WHXvYJr4Xw-F0o,4691
|
|
32
32
|
utilities/json.py,sha256=-WcGtSsCr9Y42wHZzAMnfvU6ihAfVftylFfRUORaDFo,2102
|
|
33
33
|
utilities/jupyter.py,sha256=ft5JA7fBxXKzP-L9W8f2-wbF0QeYc_2uLQNFDVk4Z-M,2917
|
|
34
34
|
utilities/libcst.py,sha256=ngD4wxnR3Kh-RBVmU5l5ST7cuZLhMZwyMDjHZe5mhTs,5581
|
|
@@ -92,8 +92,8 @@ utilities/zoneinfo.py,sha256=tdIScrTB2-B-LH0ukb1HUXKooLknOfJNwHk10MuMYvA,3619
|
|
|
92
92
|
utilities/pytest_plugins/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
|
93
93
|
utilities/pytest_plugins/pytest_randomly.py,sha256=B1qYVlExGOxTywq2r1SMi5o7btHLk2PNdY_b1p98dkE,409
|
|
94
94
|
utilities/pytest_plugins/pytest_regressions.py,sha256=mnHYBfdprz50UGVkVzV1bZERZN5CFfoF8YbokGxdFwU,1639
|
|
95
|
-
dycw_utilities-0.166.
|
|
96
|
-
dycw_utilities-0.166.
|
|
97
|
-
dycw_utilities-0.166.
|
|
98
|
-
dycw_utilities-0.166.
|
|
99
|
-
dycw_utilities-0.166.
|
|
95
|
+
dycw_utilities-0.166.37.dist-info/METADATA,sha256=rz6vDyAduIOHCHNE2PwjwCjAi6Oj886M54iwgmo7Bxk,1699
|
|
96
|
+
dycw_utilities-0.166.37.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
97
|
+
dycw_utilities-0.166.37.dist-info/entry_points.txt,sha256=BOD_SoDxwsfJYOLxhrSXhHP_T7iw-HXI9f2WVkzYxvQ,135
|
|
98
|
+
dycw_utilities-0.166.37.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
|
|
99
|
+
dycw_utilities-0.166.37.dist-info/RECORD,,
|
utilities/__init__.py
CHANGED
utilities/jinja2.py
CHANGED
|
@@ -98,6 +98,12 @@ class TemplateJob:
|
|
|
98
98
|
target: Path
|
|
99
99
|
mode: Literal["write", "append"] = "write"
|
|
100
100
|
|
|
101
|
+
def __post_init__(self) -> None:
|
|
102
|
+
if not self.template.exists():
|
|
103
|
+
raise _TemplateJobTemplateDoesNotExistError(path=self.template)
|
|
104
|
+
if (self.mode == "append") and not self.target.exists():
|
|
105
|
+
raise _TemplateJobTargetDoesNotExistError(path=self.template)
|
|
106
|
+
|
|
101
107
|
def run(self) -> None:
|
|
102
108
|
"""Run the job."""
|
|
103
109
|
match self.mode:
|
|
@@ -117,4 +123,26 @@ class TemplateJob:
|
|
|
117
123
|
return env.get_template(self.template.name).render(self.kwargs)
|
|
118
124
|
|
|
119
125
|
|
|
120
|
-
|
|
126
|
+
@dataclass(kw_only=True, slots=True)
|
|
127
|
+
class TemplateJobError(Exception): ...
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
@dataclass(kw_only=True, slots=True)
|
|
131
|
+
class _TemplateJobTemplateDoesNotExistError(TemplateJobError):
|
|
132
|
+
path: Path
|
|
133
|
+
|
|
134
|
+
@override
|
|
135
|
+
def __str__(self) -> str:
|
|
136
|
+
return f"Template {str(self.path)!r} does not exist"
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
@dataclass(kw_only=True, slots=True)
|
|
140
|
+
class _TemplateJobTargetDoesNotExistError(TemplateJobError):
|
|
141
|
+
path: Path
|
|
142
|
+
|
|
143
|
+
@override
|
|
144
|
+
def __str__(self) -> str:
|
|
145
|
+
return f"Target {str(self.path)!r} does not exist"
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
__all__ = ["EnhancedEnvironment", "TemplateJob", "TemplateJobError"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|