str-to-obj 2023.10__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.
- str_to_obj/task/comparison.py +4 -0
- str_to_obj/type/hint_tree.py +14 -1
- str_to_obj/version.py +1 -1
- {str_to_obj-2023.10.dist-info → str_to_obj-2024.1.dist-info}/METADATA +1 -1
- {str_to_obj-2023.10.dist-info → str_to_obj-2024.1.dist-info}/RECORD +7 -7
- {str_to_obj-2023.10.dist-info → str_to_obj-2024.1.dist-info}/WHEEL +1 -1
- {str_to_obj-2023.10.dist-info → str_to_obj-2024.1.dist-info}/top_level.txt +0 -0
str_to_obj/task/comparison.py
CHANGED
@@ -29,6 +29,7 @@
|
|
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
|
+
import typing as h
|
32
33
|
from types import UnionType
|
33
34
|
|
34
35
|
from str_to_obj.type.hint_tree import hint_tree_t
|
@@ -43,6 +44,9 @@ def TypesAreCompatible(
|
|
43
44
|
second_should_be_wider: bool = False,
|
44
45
|
) -> bool:
|
45
46
|
""""""
|
47
|
+
if h.Any in (one.type, another.type):
|
48
|
+
return True
|
49
|
+
|
46
50
|
if one.type is UnionType:
|
47
51
|
return any(
|
48
52
|
TypesAreCompatible(_elm, another, strict_mode=strict_mode)
|
str_to_obj/type/hint_tree.py
CHANGED
@@ -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
|
-
|
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
@@ -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=
|
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
|
-
str_to_obj/task/comparison.py,sha256
|
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=
|
11
|
-
str_to_obj-
|
12
|
-
str_to_obj-
|
13
|
-
str_to_obj-
|
14
|
-
str_to_obj-
|
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,,
|
File without changes
|