str-to-obj 2023.11__tar.gz → 2024.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 (24) hide show
  1. {str-to-obj-2023.11 → str_to_obj-2024.1}/MANIFEST.in +0 -0
  2. {str-to-obj-2023.11 → str_to_obj-2024.1}/PKG-INFO +1 -1
  3. {str-to-obj-2023.11 → str_to_obj-2024.1}/README-COPYRIGHT-utf8.txt +0 -0
  4. {str-to-obj-2023.11 → str_to_obj-2024.1}/README-LICENCE-utf8.txt +0 -0
  5. {str-to-obj-2023.11 → str_to_obj-2024.1}/README.rst +0 -0
  6. {str-to-obj-2023.11 → str_to_obj-2024.1}/documentation/wiki/description.asciidoc +0 -0
  7. {str-to-obj-2023.11 → str_to_obj-2024.1}/pyproject.toml +0 -0
  8. {str-to-obj-2023.11 → str_to_obj-2024.1}/setup.py +0 -0
  9. {str-to-obj-2023.11 → str_to_obj-2024.1}/str_to_obj/__init__.py +0 -0
  10. {str-to-obj-2023.11 → str_to_obj-2024.1}/str_to_obj/interface/console.py +0 -0
  11. {str-to-obj-2023.11 → str_to_obj-2024.1}/str_to_obj/main.py +0 -0
  12. {str-to-obj-2023.11 → str_to_obj-2024.1}/str_to_obj/task/casting.py +0 -0
  13. {str-to-obj-2023.11 → str_to_obj-2024.1}/str_to_obj/task/comparison.py +0 -0
  14. {str-to-obj-2023.11 → str_to_obj-2024.1}/str_to_obj/task/inspection.py +0 -0
  15. {str-to-obj-2023.11 → str_to_obj-2024.1}/str_to_obj/type/annotation.py +0 -0
  16. {str-to-obj-2023.11 → str_to_obj-2024.1}/str_to_obj/type/hint.py +0 -0
  17. {str-to-obj-2023.11 → str_to_obj-2024.1}/str_to_obj/type/hint_tree.py +14 -1
  18. {str-to-obj-2023.11 → str_to_obj-2024.1}/str_to_obj/version.py +1 -1
  19. {str-to-obj-2023.11 → str_to_obj-2024.1}/str_to_obj.egg-info/PKG-INFO +1 -1
  20. {str-to-obj-2023.11 → str_to_obj-2024.1}/setup.cfg +0 -0
  21. {str-to-obj-2023.11 → str_to_obj-2024.1}/str_to_obj.egg-info/SOURCES.txt +0 -0
  22. {str-to-obj-2023.11 → str_to_obj-2024.1}/str_to_obj.egg-info/dependency_links.txt +0 -0
  23. {str-to-obj-2023.11 → str_to_obj-2024.1}/str_to_obj.egg-info/requires.txt +0 -0
  24. {str-to-obj-2023.11 → str_to_obj-2024.1}/str_to_obj.egg-info/top_level.txt +0 -0
File without changes
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: str-to-obj
3
- Version: 2023.11
3
+ Version: 2024.1
4
4
  Summary: Convert strings to Python objects guided by (potentially annotated) type hints
5
5
  Home-page: https://src.koda.cnrs.fr/eric.debreuve/str-to-obj/
6
6
  Author: Eric Debreuve
File without changes
File without changes
File without changes
@@ -123,7 +123,20 @@ class hint_tree_t(_hint_node_t):
123
123
  if self.elements is None:
124
124
  return self.type
125
125
 
126
- return self.type(_elm.template for _elm in self.elements)
126
+ try:
127
+ output = self.type(_elm.template for _elm in self.elements)
128
+ except TypeError:
129
+ output = None
130
+ if output is not None:
131
+ return output
132
+
133
+ # TODO: Does it work all the time?
134
+ if self.elements.__len__() == 1:
135
+ # For example, self.type is typing.Sequence.
136
+ return self.type[self.elements[0].template]
137
+
138
+ # TODO: Can something better be done?
139
+ return self.type
127
140
 
128
141
  @property
129
142
  def template_as_str(self) -> str:
@@ -29,6 +29,6 @@
29
29
  # The fact that you are presently reading this means that you have had
30
30
  # knowledge of the CeCILL license and that you accept its terms.
31
31
 
32
- __version__ = "2023.11"
32
+ __version__ = "2024.1"
33
33
 
34
34
  # TODO: Switch to issue-manager.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: str-to-obj
3
- Version: 2023.11
3
+ Version: 2024.1
4
4
  Summary: Convert strings to Python objects guided by (potentially annotated) type hints
5
5
  Home-page: https://src.koda.cnrs.fr/eric.debreuve/str-to-obj/
6
6
  Author: Eric Debreuve
File without changes