Remove unneeded six stuff
This commit is contained in:
parent
1cc86cc3c8
commit
c3b305cc5d
3 changed files with 26 additions and 28 deletions
|
|
@ -57,7 +57,7 @@ from collections import namedtuple, defaultdict
|
|||
from decimal import Context, Decimal, InvalidOperation, getcontext
|
||||
|
||||
import six
|
||||
from six.moves import range, urllib
|
||||
from six.moves import urllib
|
||||
|
||||
from scour.stats import ScourStats
|
||||
from scour.svg_regex import svg_parser
|
||||
|
|
@ -1433,7 +1433,7 @@ def collapse_singly_referenced_gradients(doc, stats):
|
|||
identifiedElements = findElementsWithId(doc.documentElement)
|
||||
|
||||
# make sure to reset the ref'ed ids for when we are running this in testscour
|
||||
for rid, nodes in six.iteritems(findReferencedElements(doc.documentElement)):
|
||||
for rid, nodes in findReferencedElements(doc.documentElement).items():
|
||||
# Make sure that there's actually a defining element for the current ID name.
|
||||
# (Cyn: I've seen documents with #id references but no element with that ID!)
|
||||
if len(nodes) == 1 and rid in identifiedElements:
|
||||
|
|
@ -1540,7 +1540,7 @@ def detect_duplicate_gradients(*grad_lists):
|
|||
key = computeGradientBucketKey(grad)
|
||||
grad_buckets[key].append(grad)
|
||||
|
||||
for bucket in six.itervalues(grad_buckets):
|
||||
for bucket in grad_buckets.values():
|
||||
if len(bucket) < 2:
|
||||
# The gradient must be unique if it is the only one in
|
||||
# this bucket.
|
||||
|
|
@ -3005,7 +3005,7 @@ def scourUnitlessLength(length, renderer_workaround=False, is_control_point=Fals
|
|||
exponent = length.adjusted() # how far do we have to shift the dot?
|
||||
length = length.scaleb(-exponent).normalize() # shift the dot and remove potential trailing zeroes
|
||||
|
||||
sci = six.text_type(length) + 'e' + six.text_type(exponent)
|
||||
sci = str(length) + 'e' + str(exponent)
|
||||
|
||||
if len(sci) < len(nonsci):
|
||||
return_value = sci
|
||||
|
|
|
|||
|
|
@ -60,7 +60,6 @@ import re
|
|||
from decimal import Decimal
|
||||
from functools import partial
|
||||
|
||||
from six.moves import range
|
||||
|
||||
|
||||
# Sentinel.
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ import sys
|
|||
import unittest
|
||||
|
||||
import six
|
||||
from six.moves import map, range
|
||||
|
||||
from scour.scour import (make_well_formed, parse_args, scourString, scourXmlFile, start, run,
|
||||
XML_ENTS_ESCAPE_APOS, XML_ENTS_ESCAPE_QUOT)
|
||||
|
|
@ -1146,30 +1145,30 @@ class HandleEncodingUTF8(unittest.TestCase):
|
|||
|
||||
def runTest(self):
|
||||
doc = scourXmlFile('unittests/encoding-utf8.svg')
|
||||
text = u'Hello in many languages:\n' \
|
||||
u'ar: أهلا\n' \
|
||||
u'bn: হ্যালো\n' \
|
||||
u'el: Χαίρετε\n' \
|
||||
u'en: Hello\n' \
|
||||
u'hi: नमस्ते\n' \
|
||||
u'iw: שלום\n' \
|
||||
u'ja: こんにちは\n' \
|
||||
u'km: ជំរាបសួរ\n' \
|
||||
u'ml: ഹലോ\n' \
|
||||
u'ru: Здравствуйте\n' \
|
||||
u'ur: ہیلو\n' \
|
||||
u'zh: 您好'
|
||||
desc = six.text_type(doc.getElementsByTagNameNS(SVGNS, 'desc')[0].firstChild.wholeText).strip()
|
||||
text = 'Hello in many languages:\n' \
|
||||
'ar: أهلا\n' \
|
||||
'bn: হ্যালো\n' \
|
||||
'el: Χαίρετε\n' \
|
||||
'en: Hello\n' \
|
||||
'hi: नमस्ते\n' \
|
||||
'iw: שלום\n' \
|
||||
'ja: こんにちは\n' \
|
||||
'km: ជំរាបសួរ\n' \
|
||||
'ml: ഹലോ\n' \
|
||||
'ru: Здравствуйте\n' \
|
||||
'ur: ہیلو\n' \
|
||||
'zh: 您好'
|
||||
desc = str(doc.getElementsByTagNameNS(SVGNS, 'desc')[0].firstChild.wholeText).strip()
|
||||
self.assertEqual(desc, text,
|
||||
'Did not handle international UTF8 characters')
|
||||
desc = six.text_type(doc.getElementsByTagNameNS(SVGNS, 'desc')[1].firstChild.wholeText).strip()
|
||||
self.assertEqual(desc, u'“”‘’–—…‐‒°©®™•½¼¾⅓⅔†‡µ¢£€«»♠♣♥♦¿<EFBFBD>',
|
||||
desc = str(doc.getElementsByTagNameNS(SVGNS, 'desc')[1].firstChild.wholeText).strip()
|
||||
self.assertEqual(desc, '“”‘’–—…‐‒°©®™•½¼¾⅓⅔†‡µ¢£€«»♠♣♥♦¿<EFBFBD>',
|
||||
'Did not handle common UTF8 characters')
|
||||
desc = six.text_type(doc.getElementsByTagNameNS(SVGNS, 'desc')[2].firstChild.wholeText).strip()
|
||||
self.assertEqual(desc, u':-×÷±∞π∅≤≥≠≈∧∨∩∪∈∀∃∄∑∏←↑→↓↔↕↖↗↘↙↺↻⇒⇔',
|
||||
desc = str(doc.getElementsByTagNameNS(SVGNS, 'desc')[2].firstChild.wholeText).strip()
|
||||
self.assertEqual(desc, ':-×÷±∞π∅≤≥≠≈∧∨∩∪∈∀∃∄∑∏←↑→↓↔↕↖↗↘↙↺↻⇒⇔',
|
||||
'Did not handle mathematical UTF8 characters')
|
||||
desc = six.text_type(doc.getElementsByTagNameNS(SVGNS, 'desc')[3].firstChild.wholeText).strip()
|
||||
self.assertEqual(desc, u'⁰¹²³⁴⁵⁶⁷⁸⁹⁺⁻⁽⁾ⁿⁱ₀₁₂₃₄₅₆₇₈₉₊₋₌₍₎',
|
||||
desc = str(doc.getElementsByTagNameNS(SVGNS, 'desc')[3].firstChild.wholeText).strip()
|
||||
self.assertEqual(desc, '⁰¹²³⁴⁵⁶⁷⁸⁹⁺⁻⁽⁾ⁿⁱ₀₁₂₃₄₅₆₇₈₉₊₋₌₍₎',
|
||||
'Did not handle superscript/subscript UTF8 characters')
|
||||
|
||||
|
||||
|
|
@ -1177,8 +1176,8 @@ class HandleEncodingISO_8859_15(unittest.TestCase):
|
|||
|
||||
def runTest(self):
|
||||
doc = scourXmlFile('unittests/encoding-iso-8859-15.svg')
|
||||
desc = six.text_type(doc.getElementsByTagNameNS(SVGNS, 'desc')[0].firstChild.wholeText).strip()
|
||||
self.assertEqual(desc, u'áèîäöüß€ŠšŽžŒœŸ', 'Did not handle ISO 8859-15 encoded characters')
|
||||
desc = str(doc.getElementsByTagNameNS(SVGNS, 'desc')[0].firstChild.wholeText).strip()
|
||||
self.assertEqual(desc, 'áèîäöüß€ŠšŽžŒœŸ', 'Did not handle ISO 8859-15 encoded characters')
|
||||
|
||||
|
||||
class HandleSciNoInPathData(unittest.TestCase):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue