str-to-obj 2023.11__py3-none-any.whl → 2024.1__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.
@@ -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:
str_to_obj/version.py CHANGED
@@ -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
@@ -1,14 +1,14 @@
1
1
  str_to_obj/__init__.py,sha256=odgBU079fpQMu9GXhY0Lc19Rris-8Oa60Dd4F5SxGpQ,1735
2
2
  str_to_obj/main.py,sha256=YxjO1kyeZxGf_31KRZVZ39F7gr0gYM1OyOa7Y8m4iG8,2488
3
- str_to_obj/version.py,sha256=TEQ62unWCSdx1keA8pSXlLICI5VTqbVbXWzCAk6G37I,1610
3
+ str_to_obj/version.py,sha256=rlojaXevssZP7Crmyq2gSWwZ5xM-WJW9n3iVSVFSO18,1609
4
4
  str_to_obj/interface/console.py,sha256=PHcDGFmscXYSrPOJRjmlBPglQUBBGUhe1Bov3pthGT0,2414
5
5
  str_to_obj/task/casting.py,sha256=74eIRKpokqq-JqEK0UwRSQs1F4Zdj8pRDQXAPkqg3Ug,8468
6
6
  str_to_obj/task/comparison.py,sha256=-1xreDu25SrWyTEGwcZMctURj2A47zAh2QJdMf4EuTg,2568
7
7
  str_to_obj/task/inspection.py,sha256=dwaK4uMN5iPgcWWVnFu86eSkuPy1G_phBAGTqEa_414,2488
8
8
  str_to_obj/type/annotation.py,sha256=bR7tQVfYmAohizn4APx_D0aNoPo6gMjyFRoa-QpDNKM,3241
9
9
  str_to_obj/type/hint.py,sha256=Jv3m1VbXICsUwPTCFidW6A1bX-xgNU2twRP_H1DX5v4,2221
10
- str_to_obj/type/hint_tree.py,sha256=0ELSPbnvaES_oI-Ze1nT195LO4HgkyZx1N38bOvrmCw,5715
11
- str_to_obj-2023.11.dist-info/METADATA,sha256=M-NnFn-L9dONizYksTLhsg7PbY-CM1ntjL3xC227w4k,5390
12
- str_to_obj-2023.11.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
13
- str_to_obj-2023.11.dist-info/top_level.txt,sha256=h-6bR_TAnXRGVSLTeNPlivlaG64xYM3E__Xg7sCgeug,11
14
- str_to_obj-2023.11.dist-info/RECORD,,
10
+ str_to_obj/type/hint_tree.py,sha256=1Gp4I6kgRGshKQJBurJF0wbG02xv-d5Spe2f-4h19qk,6113
11
+ str_to_obj-2024.1.dist-info/METADATA,sha256=_AkIgj6_TGFJvuo0wvmP5Hdnuk9Z8jtbxbo_OaqmuQU,5389
12
+ str_to_obj-2024.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
13
+ str_to_obj-2024.1.dist-info/top_level.txt,sha256=h-6bR_TAnXRGVSLTeNPlivlaG64xYM3E__Xg7sCgeug,11
14
+ str_to_obj-2024.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.42.0)
2
+ Generator: bdist_wheel (0.43.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5