dycw-utilities 0.166.32__py3-none-any.whl → 0.166.34__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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dycw-utilities
3
- Version: 0.166.32
3
+ Version: 0.166.34
4
4
  Author-email: Derek Wan <d.wan@icloud.com>
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.12
@@ -12,7 +12,7 @@ Provides-Extra: logging
12
12
  Requires-Dist: coloredlogs<15.1,>=15.0.1; extra == 'logging'
13
13
  Provides-Extra: test
14
14
  Requires-Dist: dycw-pytest-only<2.2,>=2.1.1; extra == 'test'
15
- Requires-Dist: hypothesis<6.139,>=6.138.17; extra == 'test'
15
+ Requires-Dist: hypothesis<6.140,>=6.139.1; extra == 'test'
16
16
  Requires-Dist: pytest-asyncio<1.3,>=1.2.0; extra == 'test'
17
17
  Requires-Dist: pytest-cov<7.1,>=7.0.0; extra == 'test'
18
18
  Requires-Dist: pytest-instafail<0.6,>=0.5.0; extra == 'test'
@@ -1,4 +1,4 @@
1
- utilities/__init__.py,sha256=BCBze7o506gGD-MnR2TAXoxwZvXEqmia1TYfMVrjd30,61
1
+ utilities/__init__.py,sha256=mR10rgX7UKklBglgCOpVCV3EzZi3zOY6LmfPRqAYtVg,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,6 +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=Pbq29FLEaTkPxMICcRMYsHj94m5geBfJlP62hghCYKM,2704
31
32
  utilities/json.py,sha256=-WcGtSsCr9Y42wHZzAMnfvU6ihAfVftylFfRUORaDFo,2102
32
33
  utilities/jupyter.py,sha256=ft5JA7fBxXKzP-L9W8f2-wbF0QeYc_2uLQNFDVk4Z-M,2917
33
34
  utilities/libcst.py,sha256=ngD4wxnR3Kh-RBVmU5l5ST7cuZLhMZwyMDjHZe5mhTs,5581
@@ -91,8 +92,8 @@ utilities/zoneinfo.py,sha256=tdIScrTB2-B-LH0ukb1HUXKooLknOfJNwHk10MuMYvA,3619
91
92
  utilities/pytest_plugins/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
92
93
  utilities/pytest_plugins/pytest_randomly.py,sha256=B1qYVlExGOxTywq2r1SMi5o7btHLk2PNdY_b1p98dkE,409
93
94
  utilities/pytest_plugins/pytest_regressions.py,sha256=mnHYBfdprz50UGVkVzV1bZERZN5CFfoF8YbokGxdFwU,1639
94
- dycw_utilities-0.166.32.dist-info/METADATA,sha256=wvYUJi51eoI9JSTq854DGfKpXwhJwPpYj6xZ0JAdTps,1700
95
- dycw_utilities-0.166.32.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
96
- dycw_utilities-0.166.32.dist-info/entry_points.txt,sha256=BOD_SoDxwsfJYOLxhrSXhHP_T7iw-HXI9f2WVkzYxvQ,135
97
- dycw_utilities-0.166.32.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
98
- dycw_utilities-0.166.32.dist-info/RECORD,,
95
+ dycw_utilities-0.166.34.dist-info/METADATA,sha256=iO6583nzzeVrxxrnuotJiivMwbDLy4DNChzE1Mov6xs,1699
96
+ dycw_utilities-0.166.34.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
97
+ dycw_utilities-0.166.34.dist-info/entry_points.txt,sha256=BOD_SoDxwsfJYOLxhrSXhHP_T7iw-HXI9f2WVkzYxvQ,135
98
+ dycw_utilities-0.166.34.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
99
+ dycw_utilities-0.166.34.dist-info/RECORD,,
utilities/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  from __future__ import annotations
2
2
 
3
- __version__ = "0.166.32"
3
+ __version__ = "0.166.34"
utilities/jinja2.py ADDED
@@ -0,0 +1,86 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING, Any, Literal, override
4
+
5
+ from jinja2 import BaseLoader, BytecodeCache, Environment, Undefined
6
+ from jinja2.defaults import (
7
+ BLOCK_END_STRING,
8
+ BLOCK_START_STRING,
9
+ COMMENT_END_STRING,
10
+ COMMENT_START_STRING,
11
+ KEEP_TRAILING_NEWLINE,
12
+ LINE_COMMENT_PREFIX,
13
+ LINE_STATEMENT_PREFIX,
14
+ LSTRIP_BLOCKS,
15
+ NEWLINE_SEQUENCE,
16
+ TRIM_BLOCKS,
17
+ VARIABLE_END_STRING,
18
+ VARIABLE_START_STRING,
19
+ )
20
+
21
+ from utilities.text import pascal_case, snake_case
22
+
23
+ if TYPE_CHECKING:
24
+ from collections.abc import Callable, Sequence
25
+
26
+ from jinja2.ext import Extension
27
+
28
+
29
+ class EnhancedEnvironment(Environment):
30
+ """Environment with enhanced features."""
31
+
32
+ @override
33
+ def __init__(
34
+ self,
35
+ block_start_string: str = BLOCK_START_STRING,
36
+ block_end_string: str = BLOCK_END_STRING,
37
+ variable_start_string: str = VARIABLE_START_STRING,
38
+ variable_end_string: str = VARIABLE_END_STRING,
39
+ comment_start_string: str = COMMENT_START_STRING,
40
+ comment_end_string: str = COMMENT_END_STRING,
41
+ line_statement_prefix: str | None = LINE_STATEMENT_PREFIX,
42
+ line_comment_prefix: str | None = LINE_COMMENT_PREFIX,
43
+ trim_blocks: bool = TRIM_BLOCKS,
44
+ lstrip_blocks: bool = LSTRIP_BLOCKS,
45
+ newline_sequence: Literal["\n", "\r\n", "\r"] = NEWLINE_SEQUENCE,
46
+ keep_trailing_newline: bool = KEEP_TRAILING_NEWLINE,
47
+ extensions: Sequence[str | type[Extension]] = (),
48
+ optimized: bool = True,
49
+ undefined: type[Undefined] = Undefined,
50
+ finalize: Callable[..., Any] | None = None,
51
+ autoescape: bool | Callable[[str | None], bool] = False,
52
+ loader: BaseLoader | None = None,
53
+ cache_size: int = 400,
54
+ auto_reload: bool = True,
55
+ bytecode_cache: BytecodeCache | None = None,
56
+ enable_async: bool = False,
57
+ ) -> None:
58
+ super().__init__(
59
+ block_start_string,
60
+ block_end_string,
61
+ variable_start_string,
62
+ variable_end_string,
63
+ comment_start_string,
64
+ comment_end_string,
65
+ line_statement_prefix,
66
+ line_comment_prefix,
67
+ trim_blocks,
68
+ lstrip_blocks,
69
+ newline_sequence,
70
+ keep_trailing_newline,
71
+ extensions,
72
+ optimized,
73
+ undefined,
74
+ finalize,
75
+ autoescape,
76
+ loader,
77
+ cache_size,
78
+ auto_reload,
79
+ bytecode_cache,
80
+ enable_async,
81
+ )
82
+ self.filters["snake"] = snake_case
83
+ self.filters["pascal"] = pascal_case
84
+
85
+
86
+ __all__ = ["EnhancedEnvironment"]