python-hcl2 6.0.0__tar.gz → 6.1.1__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.
Files changed (41) hide show
  1. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/CHANGELOG.md +14 -0
  2. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/PKG-INFO +1 -1
  3. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/hcl2/hcl2.lark +5 -4
  4. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/hcl2/transformer.py +11 -1
  5. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/hcl2/version.py +2 -2
  6. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/python_hcl2.egg-info/PKG-INFO +1 -1
  7. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/.codacy.yml +0 -0
  8. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/.coveragerc +0 -0
  9. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/.github/CODEOWNERS +0 -0
  10. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/.github/workflows/codeql-analysis.yml +0 -0
  11. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/.github/workflows/pr_check.yml +0 -0
  12. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/.github/workflows/publish.yml +0 -0
  13. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/.gitignore +0 -0
  14. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/.pre-commit-config.yaml +0 -0
  15. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/.yamllint.yml +0 -0
  16. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/LICENSE +0 -0
  17. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/MANIFEST.in +0 -0
  18. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/README.md +0 -0
  19. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/bin/terraform_test +0 -0
  20. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/hcl2/__init__.py +0 -0
  21. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/hcl2/__main__.py +0 -0
  22. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/hcl2/api.py +0 -0
  23. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/hcl2/builder.py +0 -0
  24. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/hcl2/parser.py +0 -0
  25. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/hcl2/py.typed +0 -0
  26. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/hcl2/reconstructor.py +0 -0
  27. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/mypy.ini +0 -0
  28. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/pylintrc +0 -0
  29. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/pyproject.toml +0 -0
  30. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/python_hcl2.egg-info/SOURCES.txt +0 -0
  31. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/python_hcl2.egg-info/dependency_links.txt +0 -0
  32. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/python_hcl2.egg-info/entry_points.txt +0 -0
  33. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/python_hcl2.egg-info/not-zip-safe +0 -0
  34. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/python_hcl2.egg-info/requires.txt +0 -0
  35. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/python_hcl2.egg-info/top_level.txt +0 -0
  36. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/reports/.gitignore +0 -0
  37. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/requirements.txt +0 -0
  38. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/setup.cfg +0 -0
  39. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/test-requirements.txt +0 -0
  40. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/tox.ini +0 -0
  41. {python-hcl2-6.0.0 → python-hcl2-6.1.1}/tree-to-hcl2-reconstruction.md +0 -0
@@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6
6
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## \[6.1.1\] - 2025-02-13
9
+
10
+ ### Fixed
11
+
12
+ - `DictTransformer.to_tf_inline` - handle float type. ([#188](https://github.com/amplify-education/python-hcl2/pull/188))
13
+
14
+ ## \[6.1.0\] - 2025-01-24
15
+
16
+ ### Fixed
17
+
18
+ - fix e-notation and negative numbers literals. ([#182](https://github.com/amplify-education/python-hcl2/pull/182))
19
+ - fix parsing of `null`. ([#184](https://github.com/amplify-education/python-hcl2/pull/184))
20
+ - DictTransformer - do not wrap type literals into `${` and `}`. ([#186](https://github.com/amplify-education/python-hcl2/pull/186))
21
+
8
22
  ## \[6.0.0\] - 2025-01-15
9
23
 
10
24
  ### Added
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-hcl2
3
- Version: 6.0.0
3
+ Version: 6.1.1
4
4
  Summary: A parser for HCL2
5
5
  Author-email: Amplify Education <github@amplify.com>
6
6
  License: MIT
@@ -61,11 +61,12 @@ STRING_CHARS : /(?:(?!\${)([^"\\]|\\.))+/ // any character except '"'
61
61
  string_with_interpolation: "\"" (STRING_CHARS)* interpolation_maybe_nested (STRING_CHARS | interpolation_maybe_nested)* "\""
62
62
  interpolation_maybe_nested: "${" expression "}"
63
63
 
64
- int_lit : DECIMAL+
65
- !float_lit: DECIMAL+ "." DECIMAL+ (EXP_MARK DECIMAL+)?
66
- | DECIMAL+ ("." DECIMAL+)? EXP_MARK DECIMAL+
64
+ int_lit : NEGATIVE_DECIMAL? DECIMAL+ | NEGATIVE_DECIMAL+
65
+ !float_lit: (NEGATIVE_DECIMAL? DECIMAL+ | NEGATIVE_DECIMAL+) "." DECIMAL+ (EXP_MARK)?
66
+ | (NEGATIVE_DECIMAL? DECIMAL+ | NEGATIVE_DECIMAL+) ("." DECIMAL+)? (EXP_MARK)
67
+ NEGATIVE_DECIMAL : "-" DECIMAL
67
68
  DECIMAL : "0".."9"
68
- EXP_MARK : ("e" | "E") ("+" | "-")?
69
+ EXP_MARK : ("e" | "E") ("+" | "-")? DECIMAL+
69
70
  EQ : /[ \t]*=(?!=|>)/
70
71
 
71
72
  tuple : "[" (new_line_or_comment* expression new_line_or_comment* ",")* (new_line_or_comment* expression)? new_line_or_comment* "]"
@@ -30,6 +30,10 @@ class DictTransformer(Transformer):
30
30
 
31
31
  with_meta: bool
32
32
 
33
+ @staticmethod
34
+ def is_type_keyword(value: str) -> bool:
35
+ return value in {"bool", "number", "string"}
36
+
33
37
  def __init__(self, with_meta: bool = False):
34
38
  """
35
39
  :param with_meta: If set to true then adds `__start_line__` and `__end_line__`
@@ -301,6 +305,10 @@ class DictTransformer(Transformer):
301
305
  if value.startswith('"') and value.endswith('"'):
302
306
  value = str(value)[1:-1]
303
307
  return self.process_escape_sequences(value)
308
+
309
+ if self.is_type_keyword(value):
310
+ return value
311
+
304
312
  return f"${{{value}}}"
305
313
  return value
306
314
 
@@ -341,8 +349,10 @@ class DictTransformer(Transformer):
341
349
  return "true" if value else "false"
342
350
  if isinstance(value, str):
343
351
  return value
344
- if isinstance(value, int):
352
+ if isinstance(value, (int, float)):
345
353
  return str(value)
354
+ if value is None:
355
+ return "None"
346
356
 
347
357
  raise RuntimeError(f"Invalid type to convert to inline HCL: {type(value)}")
348
358
 
@@ -1,4 +1,4 @@
1
1
  # file generated by setuptools_scm
2
2
  # don't change, don't track in version control
3
- __version__ = version = '6.0.0'
4
- __version_tuple__ = version_tuple = (6, 0, 0)
3
+ __version__ = version = '6.1.1'
4
+ __version_tuple__ = version_tuple = (6, 1, 1)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-hcl2
3
- Version: 6.0.0
3
+ Version: 6.1.1
4
4
  Summary: A parser for HCL2
5
5
  Author-email: Amplify Education <github@amplify.com>
6
6
  License: MIT
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