code cleanup
corrected indentation to 4 spaces. Removed some final semicolons.
This commit is contained in:
parent
fe98270715
commit
66f1e7884e
1 changed files with 17 additions and 16 deletions
|
|
@ -2567,7 +2567,8 @@ def scourCoordinates(data, options, forceCommaWsp=False, cmd=''):
|
||||||
c = 0
|
c = 0
|
||||||
previousCoord = ''
|
previousCoord = ''
|
||||||
for coord in data:
|
for coord in data:
|
||||||
scouredCoord = scourUnitlessLength(coord, needsRendererWorkaround=options.renderer_workaround, isControlPoint=((cmd == 'c' and (c % 6) < 4) or (cmd == 's' and (c % 4) < 2)))
|
cp = ((cmd == 'c' and (c % 6) < 4) or (cmd == 's' and (c % 4) < 2))
|
||||||
|
scouredCoord = scourUnitlessLength(coord, needsRendererWorkaround=options.renderer_workaround, isControlPoint=cp)
|
||||||
# only need the comma if the current number starts with a digit
|
# only need the comma if the current number starts with a digit
|
||||||
# (numbers can start with - without needing a comma before)
|
# (numbers can start with - without needing a comma before)
|
||||||
# or if forceCommaWsp is True
|
# or if forceCommaWsp is True
|
||||||
|
|
@ -2625,11 +2626,11 @@ def scourUnitlessLength(length, needsRendererWorkaround=False, isControlPoint=Fa
|
||||||
|
|
||||||
# reduce numeric precision
|
# reduce numeric precision
|
||||||
# plus() corresponds to the unary prefix plus operator and applies context precision and rounding
|
# plus() corresponds to the unary prefix plus operator and applies context precision and rounding
|
||||||
sContext = scouringContext;
|
sContext = scouringContext
|
||||||
roundNearZero = scouringRoundNearZero
|
roundNearZero = scouringRoundNearZero
|
||||||
if(isControlPoint):
|
if(isControlPoint):
|
||||||
sContext = scouringContextC;
|
sContext = scouringContextC
|
||||||
roundNearZero = scouringRoundNearZeroC;
|
roundNearZero = scouringRoundNearZeroC
|
||||||
|
|
||||||
if(roundNearZero and length > -1 and length < 1):
|
if(roundNearZero and length > -1 and length < 1):
|
||||||
length = getcontext().create_decimal(str(int(round(length))))
|
length = getcontext().create_decimal(str(int(round(length))))
|
||||||
|
|
@ -2637,12 +2638,12 @@ def scourUnitlessLength(length, needsRendererWorkaround=False, isControlPoint=Fa
|
||||||
if(scouringKeepIntPrecision):
|
if(scouringKeepIntPrecision):
|
||||||
length_as_int = int(round(length))
|
length_as_int = int(round(length))
|
||||||
len_length_as_int = len(str(abs(length_as_int)))
|
len_length_as_int = len(str(abs(length_as_int)))
|
||||||
saved_prec = sContext.prec;
|
saved_prec = sContext.prec
|
||||||
if(sContext.prec < len_length_as_int):
|
if(sContext.prec < len_length_as_int):
|
||||||
# preserve all digits left of the decimal point
|
# preserve all digits left of the decimal point
|
||||||
sContext.prec = len_length_as_int;
|
sContext.prec = len_length_as_int
|
||||||
length = sContext.plus(length)
|
length = sContext.plus(length)
|
||||||
sContext.prec = saved_prec;
|
sContext.prec = saved_prec
|
||||||
else:
|
else:
|
||||||
length = sContext.plus(length)
|
length = sContext.plus(length)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue