mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2024-11-21 06:15:56 -07:00
Microoptimizations; minor fix
The microoptimizations do nothing at all, but it was poor style before them. The fix is a missing u for a Unicode string.
This commit is contained in:
parent
8e20a06912
commit
91b3186245
2 changed files with 7 additions and 4 deletions
|
@ -552,7 +552,7 @@ def InternalTypecast(val, out, InList, f32):
|
|||
if out in (Vector, Quaternion):
|
||||
Z,dim = (ZERO_VECTOR,3) if out == Vector else (ZERO_ROTATION,4)
|
||||
ret = []
|
||||
if val[0:1] != u'<':
|
||||
if not val.startswith(u'<'):
|
||||
return Z
|
||||
val = val[1:]
|
||||
for _ in range(dim):
|
||||
|
@ -562,7 +562,8 @@ def InternalTypecast(val, out, InList, f32):
|
|||
if match.group(1):
|
||||
ret.append(F32(float.fromhex(match.group(0)), f32))
|
||||
elif match.group(2):
|
||||
ret.append(Indet if match.group(0)[0] == '-' else NaN)
|
||||
ret.append(Indet if match.group(0).startswith(u'-') else
|
||||
NaN)
|
||||
else:
|
||||
ret.append(F32(float(match.group(0)), f32))
|
||||
if len(ret) < dim:
|
||||
|
|
|
@ -175,7 +175,8 @@ def LoadLibrary(builtins = None, fndata = None):
|
|||
value = None
|
||||
elif typ in (u'vector', u'rotation'):
|
||||
try:
|
||||
if value[0:1] != u'<' or value[-1:] != u'>':
|
||||
if not (value.startswith(u'<') and value.endswith(u'>')
|
||||
):
|
||||
raise ValueError
|
||||
value = value[1:-1].split(u',')
|
||||
if len(value) != (3 if typ == 'vector' else 4):
|
||||
|
@ -205,7 +206,8 @@ def LoadLibrary(builtins = None, fndata = None):
|
|||
u" line %d: %s" % (ubuiltins, linenum, line))
|
||||
else:
|
||||
assert typ == u'list'
|
||||
if value[0:1] != u'[' or value[-1:] != u']':
|
||||
if not (value.startswith(u'[') and value.endswith(u']')
|
||||
):
|
||||
warning(u"Invalid list value in %s, line %d: %s"
|
||||
% (ubuiltins, linenum, line))
|
||||
elif value[1:-1].strip() != '':
|
||||
|
|
Loading…
Reference in a new issue