python-liquid 2.3.1__py3-none-any.whl → 2.3.2__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.
liquid/__init__.py CHANGED
@@ -56,7 +56,7 @@ from .tag import Tag
56
56
 
57
57
  from . import future
58
58
 
59
- __version__ = "2.3.1"
59
+ __version__ = "2.3.2"
60
60
 
61
61
  __all__ = (
62
62
  "AwareBoundTemplate",
@@ -13,6 +13,7 @@ from typing import Union
13
13
  from liquid import Mode
14
14
  from liquid.exceptions import LiquidSyntaxError
15
15
  from liquid.exceptions import LiquidTypeError
16
+ from liquid.exceptions import LiquidValueError
16
17
  from liquid.expression import Expression
17
18
  from liquid.limits import to_int
18
19
  from liquid.token import TOKEN_ASSIGN
@@ -95,7 +96,12 @@ class LoopExpression(Expression):
95
96
  if isinstance(obj, Mapping):
96
97
  return iter(obj.items()), len(obj)
97
98
  if isinstance(obj, range):
98
- return iter(obj), len(obj)
99
+ try:
100
+ return iter(obj), len(obj)
101
+ except OverflowError as err:
102
+ raise LiquidValueError(
103
+ "range literal length limit reached", token=None
104
+ ) from err
99
105
  if isinstance(obj, str) and not context.env.string_sequences:
100
106
  return (iter([]), 0) if not obj else (iter([obj]), 1)
101
107
  if isinstance(obj, Sequence):
@@ -39,12 +39,6 @@ if TYPE_CHECKING:
39
39
  from liquid import TokenStream
40
40
 
41
41
 
42
- # MAX_RANGE = (2**53) - 1
43
- # MIN_RANGE = -(2**53) + 1
44
- MAX_RANGE = 1024
45
- MIN_RANGE = -1024
46
-
47
-
48
42
  class Nil(Expression):
49
43
  __slots__ = ()
50
44
 
@@ -255,9 +249,7 @@ class RangeLiteral(Expression):
255
249
  if start > stop:
256
250
  return range(0)
257
251
 
258
- return range(
259
- clamp(start, MIN_RANGE, MAX_RANGE), clamp(stop + 1, MIN_RANGE, MAX_RANGE)
260
- )
252
+ return range(start, stop + 1)
261
253
 
262
254
  def evaluate(self, context: RenderContext) -> range:
263
255
  return self._make_range(
@@ -423,8 +415,3 @@ def parse_string_or_path(
423
415
  def is_empty(obj: object) -> bool:
424
416
  """Return True if _obj_ is considered empty."""
425
417
  return isinstance(obj, (list, dict, str)) and not obj
426
-
427
-
428
- def clamp(n: int, min_value: int, max_value: int) -> int:
429
- """Clamp _n_ between _min_value_ and _max_value_."""
430
- return max(min_value, min(n, max_value))
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: python-liquid
3
- Version: 2.3.1
3
+ Version: 2.3.2
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/
@@ -1,4 +1,4 @@
1
- liquid/__init__.py,sha256=viMmHHCCZOk_FE-FfW7RR_drOPTDMrePw2_95KuvFks,7696
1
+ liquid/__init__.py,sha256=qJCQnUp4SFeIjlrsTo6I07bqqVUFptfOj9xbwHXb3nQ,7696
2
2
  liquid/analyze_tags.py,sha256=Uc1nueKLRiIejs2JyQIC7u2pxp9l-5HJAMWlg-Qj1m8,7615
3
3
  liquid/ast.py,sha256=4ZqSbuW4mv9IvoIMPk3OICUaOI1vPh8P8uFCrXI_3XA,8140
4
4
  liquid/context.py,sha256=fEuMsj9MVguX3Kzy9_k99TWekOwAToL0RtbGm9yZ71o,21718
@@ -33,9 +33,9 @@ liquid/builtin/expressions/_tokenize.py,sha256=p7RbeOg8iwXDnW0fIL4_7FSrBulkPYrCm
33
33
  liquid/builtin/expressions/arguments.py,sha256=hlZh7LLFT5UismTo7mTlVjM87_ihUJo0BYuCxyTwKMI,6448
34
34
  liquid/builtin/expressions/filtered.py,sha256=FqPNZLjwDdlCfivtBa7e0wuQYwcJdKUl3_UY9AS3zG4,13073
35
35
  liquid/builtin/expressions/logical.py,sha256=S8T9IgsuWgv0s7GYcGvIJFOqYMiMFRpat7zF3nCZHR0,20388
36
- liquid/builtin/expressions/loop.py,sha256=ki3kMBuDyT21NZ_VrK19avsGbwBfz0VrrJo-mFox57Q,8594
36
+ liquid/builtin/expressions/loop.py,sha256=F2mBD9_bXtarzmEKstak_u50cXF9ijlKs9Ip2Q_BbsQ,8839
37
37
  liquid/builtin/expressions/path.py,sha256=m1J33uIuEFlUaRXR_-G6qcsClOm0B5jbTZ0Pdt1P7Ak,5703
38
- liquid/builtin/expressions/primitive.py,sha256=AlG828WqP3bZuwQTBJTx6RP2FvBra_aoEsq_J4uR4Tk,11684
38
+ liquid/builtin/expressions/primitive.py,sha256=Gzaeb-dF84zsMn5ZYhe-FOosnSbkkM2C6JLqjLvK5ns,11352
39
39
  liquid/builtin/filters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
40
40
  liquid/builtin/filters/array.py,sha256=jy35hoouAWI1yG2JX5OMG39Az2dmP--4IcuwqT59JMY,10281
41
41
  liquid/builtin/filters/extra.py,sha256=m13_1nbZyRBl3CZV9WWGLlUZueRPt8cKPEHRAioqM_o,2710
@@ -90,7 +90,7 @@ liquid/utils/chain_map.py,sha256=nxkw3wwF6ddlGarIuL7Ii2elm4dU80LySgdQx1oift0,151
90
90
  liquid/utils/html.py,sha256=TmqOOpRMsy7fqZLj7X5ybd_XQnWW2YDAVDwTP1Gwf40,1706
91
91
  liquid/utils/lru_cache.py,sha256=p7bXOGaUwJpLsREI2lGSzK6lLna5W_k_zNXKWnPJdos,4022
92
92
  liquid/utils/text.py,sha256=1SwDECNMaqnnZ05je_AZZgxqzZd6U-mvq5jNU3W1-Qk,841
93
- python_liquid-2.3.1.dist-info/METADATA,sha256=aLYdUQmhJey4YMztc-zpVJ-LnOcEeNbCcNQyugzkD2M,6786
94
- python_liquid-2.3.1.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
95
- python_liquid-2.3.1.dist-info/licenses/LICENSE,sha256=yAFURzud5ERNHt1rZIPnTLJ92ep7q8y5yG9g5DUMR_E,1075
96
- python_liquid-2.3.1.dist-info/RECORD,,
93
+ python_liquid-2.3.2.dist-info/METADATA,sha256=FpoUkgvAUbCL5Xg2He4xOmqVvCU1E_xvZpPn8ci9FYw,6786
94
+ python_liquid-2.3.2.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
95
+ python_liquid-2.3.2.dist-info/licenses/LICENSE,sha256=yAFURzud5ERNHt1rZIPnTLJ92ep7q8y5yG9g5DUMR_E,1075
96
+ python_liquid-2.3.2.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.31.0
2
+ Generator: hatchling 1.32.4
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any