1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
Forwarded: https://github.com/fedora-static-analysis/firehose/pull/46
--- a/firehose/model.py
+++ b/firehose/model.py
@@ -27,9 +27,9 @@
import sys
import os
-from six import BytesIO, string_types, integer_types, iteritems
+from io import BytesIO
-_string_type = string_types[0]
+_string_type = str
class Attribute(namedtuple('Attribute', ('name', 'type', 'nullable'))):
@@ -1304,11 +1304,11 @@
def to_xml(self):
node = ET.Element('custom-fields')
- for key, value in iteritems(self):
+ for key, value in self.items():
if isinstance(value, _string_type):
tag = 'str-field'
text = value
- elif isinstance(value, integer_types):
+ elif isinstance(value, int):
tag = 'int-field'
text = str(value)
else:
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -22,7 +22,7 @@
import tempfile
import unittest
-from six import u, StringIO, BytesIO
+from io import StringIO, BytesIO
from firehose.model import Analysis, Issue, Metadata, Generator, SourceRpm, \
Location, File, Function, Point, Message, Notes, Trace, State, Stats, \
@@ -333,7 +333,7 @@
def test_non_ascii_example(self):
with open('examples/example-non-ascii.xml') as f:
a = Analysis.from_xml(f)
- self.assertEqual(a.metadata.generator.name, u('\u2620') * 8)
+ self.assertEqual(a.metadata.generator.name, '\u2620' * 8)
self.assertEqual(len(a.results), 1)
w = a.results[0]
@@ -343,15 +343,15 @@
# "comparison between signed and unsigned integer expressions"
# within the message:
self.assertEqual(w.message.text,
- (u('\u7b26\u53f7\u4ed8\u304d\u3068\u7b26\u53f7'
+ ( '\u7b26\u53f7\u4ed8\u304d\u3068\u7b26\u53f7'
'\u7121\u3057\u306e\u6574\u6570\u5f0f\u306e'
- '\u9593\u3067\u306e\u6bd4\u8f03\u3067\u3059')))
+ '\u9593\u3067\u306e\u6bd4\u8f03\u3067\u3059'))
# Verify the "mojibake" Kanji/Hiragana within the notes:
- self.assertIn(u('\u6587\u5b57\u5316\u3051'),
+ self.assertIn('\u6587\u5b57\u5316\u3051',
w.notes.text)
- self.assertEqual(w.location.function.name, u('oo\u025f'))
+ self.assertEqual(w.location.function.name, 'oo\u025f')
def test_to_xml(self):
def validate(xmlbytes):
|