honeybee-core 1.61.27__py2.py3-none-any.whl → 1.61.29__py2.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.
- honeybee/typing.py +25 -11
- {honeybee_core-1.61.27.dist-info → honeybee_core-1.61.29.dist-info}/METADATA +3 -3
- {honeybee_core-1.61.27.dist-info → honeybee_core-1.61.29.dist-info}/RECORD +7 -7
- {honeybee_core-1.61.27.dist-info → honeybee_core-1.61.29.dist-info}/LICENSE +0 -0
- {honeybee_core-1.61.27.dist-info → honeybee_core-1.61.29.dist-info}/WHEEL +0 -0
- {honeybee_core-1.61.27.dist-info → honeybee_core-1.61.29.dist-info}/entry_points.txt +0 -0
- {honeybee_core-1.61.27.dist-info → honeybee_core-1.61.29.dist-info}/top_level.txt +0 -0
honeybee/typing.py
CHANGED
|
@@ -3,6 +3,7 @@ import re
|
|
|
3
3
|
import os
|
|
4
4
|
import math
|
|
5
5
|
import uuid
|
|
6
|
+
import hashlib
|
|
6
7
|
|
|
7
8
|
try:
|
|
8
9
|
INFPOS = math.inf
|
|
@@ -170,7 +171,8 @@ def clean_string(value, input_name=''):
|
|
|
170
171
|
"""Clean a string so that it is valid for both Radiance and EnergyPlus.
|
|
171
172
|
|
|
172
173
|
This will strip out spaces and special characters and raise an error if the
|
|
173
|
-
string is
|
|
174
|
+
string is has more than 100 characters. If the input has no valid characters
|
|
175
|
+
after stripping out illegal ones, a randomly-generated UUID will be returned.
|
|
174
176
|
"""
|
|
175
177
|
try:
|
|
176
178
|
value = value.replace(' ', '_') # spaces > underscores for readability
|
|
@@ -178,8 +180,10 @@ def clean_string(value, input_name=''):
|
|
|
178
180
|
except TypeError:
|
|
179
181
|
raise TypeError('Input {} must be a text string. Got {}: {}.'.format(
|
|
180
182
|
input_name, type(value), value))
|
|
181
|
-
|
|
182
|
-
|
|
183
|
+
if len(val) == 0: # generate a unique but consistent ID from the input
|
|
184
|
+
sha256_hash = hashlib.sha256(value.encode('utf-8'))
|
|
185
|
+
hash_str = str(sha256_hash.hexdigest())
|
|
186
|
+
return hash_str[:8] if len(hash_str) > 8 else hash_str
|
|
183
187
|
assert len(val) <= 100, 'Input {} "{}" must be less than 100 characters.'.format(
|
|
184
188
|
input_name, value)
|
|
185
189
|
return val
|
|
@@ -188,8 +192,9 @@ def clean_string(value, input_name=''):
|
|
|
188
192
|
def clean_rad_string(value, input_name=''):
|
|
189
193
|
"""Clean a string for Radiance that can be used for rad material names.
|
|
190
194
|
|
|
191
|
-
This includes stripping out illegal characters and white spaces
|
|
192
|
-
|
|
195
|
+
This includes stripping out illegal characters and white spaces. If the input
|
|
196
|
+
has no valid characters after stripping out illegal ones, a randomly-generated
|
|
197
|
+
UUID will be returned.
|
|
193
198
|
"""
|
|
194
199
|
try:
|
|
195
200
|
value = value.replace(' ', '_') # spaces > underscores for readability
|
|
@@ -197,8 +202,10 @@ def clean_rad_string(value, input_name=''):
|
|
|
197
202
|
except TypeError:
|
|
198
203
|
raise TypeError('Input {} must be a text string. Got {}: {}.'.format(
|
|
199
204
|
input_name, type(value), value))
|
|
200
|
-
|
|
201
|
-
|
|
205
|
+
if len(val) == 0: # generate a unique but consistent ID from the input
|
|
206
|
+
sha256_hash = hashlib.sha256(value.encode('utf-8'))
|
|
207
|
+
hash_str = str(sha256_hash.hexdigest())
|
|
208
|
+
return hash_str[:8] if len(hash_str) > 8 else hash_str
|
|
202
209
|
return val
|
|
203
210
|
|
|
204
211
|
|
|
@@ -206,8 +213,9 @@ def clean_ep_string(value, input_name=''):
|
|
|
206
213
|
"""Clean a string for EnergyPlus that can be used for energy material names.
|
|
207
214
|
|
|
208
215
|
This includes stripping out all illegal characters, removing trailing spaces,
|
|
209
|
-
and rasing an error if the name is not longer than 100 characters
|
|
210
|
-
characters
|
|
216
|
+
and rasing an error if the name is not longer than 100 characters. If the input
|
|
217
|
+
has no valid characters after stripping out illegal ones, a randomly-generated
|
|
218
|
+
UUID will be returned.
|
|
211
219
|
"""
|
|
212
220
|
try:
|
|
213
221
|
val = ''.join(i for i in value if ord(i) < 128) # strip out non-ascii
|
|
@@ -216,8 +224,10 @@ def clean_ep_string(value, input_name=''):
|
|
|
216
224
|
raise TypeError('Input {} must be a text string. Got {}: {}.'.format(
|
|
217
225
|
input_name, type(value), value))
|
|
218
226
|
val = val.strip()
|
|
219
|
-
|
|
220
|
-
|
|
227
|
+
if len(val) == 0: # generate a unique but consistent ID from the input
|
|
228
|
+
sha256_hash = hashlib.sha256(value.encode('utf-8'))
|
|
229
|
+
hash_str = str(sha256_hash.hexdigest())
|
|
230
|
+
return hash_str[:8] if len(hash_str) > 8 else hash_str
|
|
221
231
|
assert len(val) <= 100, 'Input {} "{}" must be less than 100 characters.'.format(
|
|
222
232
|
input_name, value)
|
|
223
233
|
return val
|
|
@@ -449,6 +459,10 @@ def clean_doe2_string(value, max_length=24):
|
|
|
449
459
|
raise TypeError('Input must be a text string. Got {}: {}.'.format(
|
|
450
460
|
type(value), value))
|
|
451
461
|
val = val.strip()
|
|
462
|
+
if len(val) == 0: # generate a unique but consistent ID from the input
|
|
463
|
+
sha256_hash = hashlib.sha256(value.encode('utf-8'))
|
|
464
|
+
hash_str = str(sha256_hash.hexdigest())
|
|
465
|
+
return hash_str[:8] if len(hash_str) > 8 else hash_str
|
|
452
466
|
return readable_short_name(val, max_length)
|
|
453
467
|
|
|
454
468
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: honeybee-core
|
|
3
|
-
Version: 1.61.
|
|
3
|
+
Version: 1.61.29
|
|
4
4
|
Summary: A library to create 3D building geometry for various types of environmental simulation.
|
|
5
5
|
Home-page: https://github.com/ladybug-tools/honeybee-core
|
|
6
6
|
Author: Ladybug Tools
|
|
@@ -14,8 +14,8 @@ Classifier: License :: OSI Approved :: GNU Affero General Public License v3
|
|
|
14
14
|
Classifier: Operating System :: OS Independent
|
|
15
15
|
Description-Content-Type: text/markdown
|
|
16
16
|
License-File: LICENSE
|
|
17
|
-
Requires-Dist: ladybug-core==0.44.
|
|
18
|
-
Requires-Dist: ladybug-geometry-polyskel==1.7.
|
|
17
|
+
Requires-Dist: ladybug-core==0.44.19
|
|
18
|
+
Requires-Dist: ladybug-geometry-polyskel==1.7.30
|
|
19
19
|
Requires-Dist: honeybee-schema==1.59.0; python_version >= "3.7"
|
|
20
20
|
|
|
21
21
|

|
|
@@ -23,7 +23,7 @@ honeybee/room.py,sha256=lZZR_ZIpu3ZatnlRSZe4mjirkfJo8FCwRQmgsuR-6d8,150193
|
|
|
23
23
|
honeybee/search.py,sha256=OiXibGGVb1ff4gTn_768i-sehB-zAYG12c0o3B0RjKE,4718
|
|
24
24
|
honeybee/shade.py,sha256=GSlceN2kpo8NOc_QkvvxEhKozRytOS8InZ1Ge0fPuko,19746
|
|
25
25
|
honeybee/shademesh.py,sha256=oldugnwhu-ibX9f0hfxpO-DvgM8U7S-dYwUjBSVzo4g,13273
|
|
26
|
-
honeybee/typing.py,sha256=
|
|
26
|
+
honeybee/typing.py,sha256=E8-HrCB9cSoqhFR6zcFXhrAlQRAFw_sxHGdobB8Lre8,20051
|
|
27
27
|
honeybee/units.py,sha256=_qG_G5b9hdqjpyVOpGdIYCB6k8VKYjcxSJn1St-7Xjc,3204
|
|
28
28
|
honeybee/cli/__init__.py,sha256=nYyTV_HapGo-a1XZLZps9__Bqp50YJYzHZ1LzHp4TJU,3675
|
|
29
29
|
honeybee/cli/compare.py,sha256=CxOtGnaDkc9ACt6MgkQBUcNuP0aBS4Kb7vsWDYnRnY8,6544
|
|
@@ -40,9 +40,9 @@ honeybee/writer/model.py,sha256=N7F_jksf-5TrdVecuxTaFWxnPVFLmQs7k8g27TsdB7Q,177
|
|
|
40
40
|
honeybee/writer/room.py,sha256=kFghgStTU1SEJSLigXB0VjOWhZtgs4uXuAqdwd4yRQo,174
|
|
41
41
|
honeybee/writer/shade.py,sha256=EpgX-vMc-s21TnMvNWvWTKyT8iAnxu1nFVXzjY1oyF8,177
|
|
42
42
|
honeybee/writer/shademesh.py,sha256=Y41bLogJ7dwpvMe5cAWVRDRVqJEwo9e5hFJQjlt6UX8,189
|
|
43
|
-
honeybee_core-1.61.
|
|
44
|
-
honeybee_core-1.61.
|
|
45
|
-
honeybee_core-1.61.
|
|
46
|
-
honeybee_core-1.61.
|
|
47
|
-
honeybee_core-1.61.
|
|
48
|
-
honeybee_core-1.61.
|
|
43
|
+
honeybee_core-1.61.29.dist-info/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
|
|
44
|
+
honeybee_core-1.61.29.dist-info/METADATA,sha256=0l4YuUVBPOUDCe2YUVGKKqyuy2a7o-InbvwQOV0ntcM,3317
|
|
45
|
+
honeybee_core-1.61.29.dist-info/WHEEL,sha256=AHX6tWk3qWuce7vKLrj7lnulVHEdWoltgauo8bgCXgU,109
|
|
46
|
+
honeybee_core-1.61.29.dist-info/entry_points.txt,sha256=r3YqOm40goBroH3ccUhpwQjvTwu10JWLd0HIRHI1J8E,47
|
|
47
|
+
honeybee_core-1.61.29.dist-info/top_level.txt,sha256=8ve7puCRLUA9XDEGc1Mcs-UX9sFjpPV8MeTaIMwQ_Tg,9
|
|
48
|
+
honeybee_core-1.61.29.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|