python-liquid 2.3.3__tar.gz → 2.3.5__tar.gz
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.
- {python_liquid-2.3.3 → python_liquid-2.3.5}/PKG-INFO +2 -1
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/__init__.py +1 -1
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/expressions/logical.py +2 -2
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/filters/misc.py +47 -29
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/utils/lru_cache.py +1 -1
- {python_liquid-2.3.3 → python_liquid-2.3.5}/pyproject.toml +3 -1
- {python_liquid-2.3.3 → python_liquid-2.3.5}/.gitignore +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/LICENSE +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/README.md +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/analyze_tags.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/ast.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/__init__.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/content.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/drops/__init__.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/drops/drops.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/expressions/__init__.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/expressions/_tokenize.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/expressions/arguments.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/expressions/filtered.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/expressions/loop.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/expressions/path.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/expressions/primitive.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/filters/__init__.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/filters/array.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/filters/extra.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/filters/math.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/filters/string.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/illegal.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/loaders/__init__.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/loaders/caching_file_system_loader.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/loaders/choice_loader.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/loaders/dict_loader.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/loaders/file_system_loader.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/loaders/mixins.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/loaders/package_loader.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/output.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/tags/__init__.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/tags/assign_tag.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/tags/capture_tag.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/tags/case_tag.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/tags/comment_tag.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/tags/cycle_tag.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/tags/decrement_tag.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/tags/doc_tag.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/tags/echo_tag.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/tags/for_tag.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/tags/if_tag.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/tags/ifchanged_tag.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/tags/include_tag.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/tags/increment_tag.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/tags/inline_comment_tag.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/tags/liquid_tag.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/tags/render_tag.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/tags/tablerow_tag.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/tags/unless_tag.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/context.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/environment.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/exceptions.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/expression.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/extra/__init__.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/extra/filters/__init__.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/extra/filters/_json.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/extra/filters/array.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/extra/filters/babel.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/extra/filters/html.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/extra/filters/translate.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/extra/tags/__init__.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/extra/tags/_with.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/extra/tags/extends_tag.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/extra/tags/macro_tag.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/extra/tags/snippet_tag.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/extra/tags/translate_tag.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/filter.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/future/__init__.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/future/environment.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/future/filters/__init__.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/future/tags/__init__.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/lex.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/limits.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/loader.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/messages.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/mode.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/output.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/parser.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/py.typed +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/span.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/static_analysis.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/stream.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/stringify.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/tag.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/template.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/token.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/undefined.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/utils/__init__.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/utils/chain_map.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/utils/html.py +0 -0
- {python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/utils/text.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: python-liquid
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.5
|
|
4
4
|
Summary: A Python engine for the Liquid template language.
|
|
5
5
|
Project-URL: Change Log, https://github.com/jg-rp/liquid/blob/main/CHANGES.md
|
|
6
6
|
Project-URL: Documentation, https://jg-rp.github.io/liquid/
|
|
@@ -20,6 +20,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.12
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.13
|
|
22
22
|
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
23
24
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
24
25
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
25
26
|
Requires-Python: >=3.9
|
|
@@ -641,7 +641,7 @@ def _le(left: object, right: object) -> bool:
|
|
|
641
641
|
right = right.__liquid__()
|
|
642
642
|
|
|
643
643
|
if isinstance(left, str) and isinstance(right, str):
|
|
644
|
-
return left
|
|
644
|
+
return left <= right
|
|
645
645
|
|
|
646
646
|
if isinstance(left, bool) or isinstance(right, bool):
|
|
647
647
|
return False
|
|
@@ -649,7 +649,7 @@ def _le(left: object, right: object) -> bool:
|
|
|
649
649
|
if isinstance(left, (int, float, Decimal)) and isinstance(
|
|
650
650
|
right, (int, float, Decimal)
|
|
651
651
|
):
|
|
652
|
-
return left
|
|
652
|
+
return left <= right
|
|
653
653
|
|
|
654
654
|
if left is None or right is None:
|
|
655
655
|
return False
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
import datetime
|
|
5
|
+
import datetime as dt
|
|
6
6
|
import decimal
|
|
7
7
|
import functools
|
|
8
8
|
from typing import TYPE_CHECKING
|
|
@@ -62,9 +62,8 @@ def default(obj: Any, default_: object = "", *, allow_false: bool = False) -> An
|
|
|
62
62
|
|
|
63
63
|
@with_environment
|
|
64
64
|
@liquid_filter
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
dat: Union[datetime.datetime, str, int],
|
|
65
|
+
def date(
|
|
66
|
+
dat: Union[dt.datetime, str, int],
|
|
68
67
|
fmt: str,
|
|
69
68
|
*,
|
|
70
69
|
environment: Environment,
|
|
@@ -76,44 +75,63 @@ def date( # noqa: PLR0912 PLR0911
|
|
|
76
75
|
if is_undefined(fmt):
|
|
77
76
|
return str(dat)
|
|
78
77
|
|
|
79
|
-
if
|
|
80
|
-
if dat in ("now", "today"):
|
|
81
|
-
dat = datetime.datetime.now()
|
|
82
|
-
elif dat.isdigit():
|
|
83
|
-
# The reference implementation does not support string
|
|
84
|
-
# representations of negative integers either.
|
|
85
|
-
dat = datetime.datetime.fromtimestamp(int(dat))
|
|
86
|
-
else:
|
|
87
|
-
try:
|
|
88
|
-
dat = parser.parse(dat)
|
|
89
|
-
except parser.ParserError:
|
|
90
|
-
# Input is returned unchanged. This is consistent
|
|
91
|
-
# with the reference implementation.
|
|
92
|
-
return str(dat)
|
|
93
|
-
elif isinstance(dat, int):
|
|
94
|
-
try:
|
|
95
|
-
dat = datetime.datetime.fromtimestamp(dat)
|
|
96
|
-
except (OverflowError, OSError):
|
|
97
|
-
# Testing on Windows shows that it can't handle some
|
|
98
|
-
# negative integers.
|
|
99
|
-
return str(dat)
|
|
78
|
+
date_ = dt.datetime.now() if dat in ("now", "today") else _to_date(dat)
|
|
100
79
|
|
|
101
|
-
if
|
|
80
|
+
if date_ is None:
|
|
81
|
+
if isinstance(dat, (str, int)):
|
|
82
|
+
# Input is returned unchanged. This is consistent
|
|
83
|
+
# with the reference implementation.
|
|
84
|
+
return str(dat)
|
|
102
85
|
raise FilterArgumentError(
|
|
103
|
-
f"date expected datetime.datetime, found {type(dat).__name__}"
|
|
86
|
+
f"date expected datetime.datetime, found {type(dat).__name__}",
|
|
87
|
+
token=None,
|
|
104
88
|
)
|
|
105
89
|
|
|
106
90
|
try:
|
|
107
|
-
rv =
|
|
91
|
+
rv = date_.strftime(fmt)
|
|
108
92
|
except ValueError as err:
|
|
109
93
|
# This is not uncommon on Windows when a format string contains
|
|
110
94
|
# directives that are not officially supported by Python.
|
|
111
95
|
|
|
112
96
|
# Handle "%s" as a special case.
|
|
113
97
|
if fmt == r"%s":
|
|
114
|
-
return str(
|
|
98
|
+
return str(date_.timestamp()).split(".")[0]
|
|
115
99
|
raise FilterArgumentError(str(err), token=None) from err
|
|
116
100
|
|
|
117
101
|
if environment.autoescape and isinstance(fmt, Markup):
|
|
118
102
|
return Markup(rv)
|
|
119
103
|
return rv
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
@functools.lru_cache(maxsize=10)
|
|
107
|
+
def _to_date( # noqa: PLR0911
|
|
108
|
+
d: object,
|
|
109
|
+
) -> Union[dt.datetime, None]:
|
|
110
|
+
if isinstance(d, dt.datetime):
|
|
111
|
+
return d
|
|
112
|
+
|
|
113
|
+
if isinstance(d, dt.date):
|
|
114
|
+
return dt.datetime.combine(d, dt.time.min)
|
|
115
|
+
|
|
116
|
+
if isinstance(d, str):
|
|
117
|
+
if d.isdigit():
|
|
118
|
+
# The reference implementation does not support string
|
|
119
|
+
# representations of negative integers either.
|
|
120
|
+
return dt.datetime.fromtimestamp(int(d))
|
|
121
|
+
|
|
122
|
+
try:
|
|
123
|
+
return parser.parse(d)
|
|
124
|
+
except parser.ParserError:
|
|
125
|
+
# Input is returned unchanged. This is consistent
|
|
126
|
+
# with the reference implementation.
|
|
127
|
+
return None
|
|
128
|
+
|
|
129
|
+
if isinstance(d, int):
|
|
130
|
+
try:
|
|
131
|
+
return dt.datetime.fromtimestamp(d)
|
|
132
|
+
except (OverflowError, OSError):
|
|
133
|
+
# Testing on Windows shows that it can't handle some
|
|
134
|
+
# negative integers.
|
|
135
|
+
return None
|
|
136
|
+
|
|
137
|
+
return None
|
|
@@ -17,6 +17,7 @@ classifiers = [
|
|
|
17
17
|
"Programming Language :: Python :: 3.12",
|
|
18
18
|
"Programming Language :: Python :: 3.13",
|
|
19
19
|
"Programming Language :: Python :: 3.14",
|
|
20
|
+
"Programming Language :: Python :: 3.15",
|
|
20
21
|
]
|
|
21
22
|
dependencies = [
|
|
22
23
|
"MarkupSafe>=3",
|
|
@@ -81,7 +82,7 @@ test = "pytest {args}"
|
|
|
81
82
|
typing = "mypy"
|
|
82
83
|
|
|
83
84
|
[[tool.hatch.envs.test.matrix]]
|
|
84
|
-
python = ["39", "310", "311", "312", "313", "314", "pypy39"]
|
|
85
|
+
python = ["39", "310", "311", "312", "313", "314", "315", "pypy39"]
|
|
85
86
|
|
|
86
87
|
[tool.hatch.envs.test.scripts]
|
|
87
88
|
test = "pytest {args}"
|
|
@@ -226,6 +227,7 @@ ignore = [
|
|
|
226
227
|
"TC006",
|
|
227
228
|
"PLW1641",
|
|
228
229
|
"PLR0917",
|
|
230
|
+
"ICN001",
|
|
229
231
|
]
|
|
230
232
|
|
|
231
233
|
fixable = ["I", "SIM", "D202"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_liquid-2.3.3 → python_liquid-2.3.5}/liquid/builtin/loaders/caching_file_system_loader.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|