Skip to content

Commit 7c83592

Browse files
committed
more cleanup, dropping 2.6 support
1 parent 1e729fd commit 7c83592

8 files changed

+10
-57
lines changed

CONTRIBUTING.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ Before you submit a pull request, check that it meets these guidelines:
9999
2. If the pull request adds functionality, the docs should be updated. Put
100100
your new functionality into a function with a docstring, and add the
101101
feature to the list in README.rst.
102-
3. The pull request should work for Python 2.6, 2.7 and for PyPy. Check
102+
3. The pull request should work for Python 2.7 and for PyPy. Check
103103
https://travis-ci.org/scrapinghub/skinfer/pull_requests
104104
and make sure that the tests pass for all supported Python versions.
105105

setup.py

+3-10
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@
88
readme = open('README.rst').read()
99
history = open('HISTORY.rst').read().replace('.. :changelog:', '')
1010

11-
requirements = [
12-
'json-schema-generator >= 0.3'
13-
]
14-
15-
test_requirements = [
16-
# put package test requirements here
17-
]
1811

1912
setup(
2013
name='skinfer',
@@ -34,7 +27,9 @@
3427
'bin/json_schema_merger',
3528
],
3629
include_package_data=True,
37-
install_requires=requirements,
30+
install_requires=[
31+
'json-schema-generator >= 0.3'
32+
],
3833
license="BSD",
3934
zip_safe=False,
4035
keywords='skinfer json-schema json schema inferer merger',
@@ -44,12 +39,10 @@
4439
'License :: OSI Approved :: BSD License',
4540
'Natural Language :: English',
4641
"Programming Language :: Python :: 2",
47-
'Programming Language :: Python :: 2.6',
4842
'Programming Language :: Python :: 2.7',
4943
'Programming Language :: Python :: 3',
5044
'Programming Language :: Python :: 3.3',
5145
'Programming Language :: Python :: 3.4',
5246
],
5347
test_suite='tests',
54-
tests_require=test_requirements
5548
)

skinfer/json_schema_merger.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
from __future__ import absolute_import, division, print_function, unicode_literals
3+
from __future__ import absolute_import, print_function
44
import itertools
55
import sys
66

skinfer/schema_inferer.py

+2-15
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,14 @@
1-
from __future__ import absolute_import, division, print_function, unicode_literals
1+
from __future__ import absolute_import, print_function
22

33
import json
44
import gzip
55
from skinfer.draft4_generator import IncompleteDraft4SchemaGenerator
66
from skinfer.json_schema_merger import merge_schema
77

88

9-
class GzipFileShim(gzip.GzipFile):
10-
"""Python 2.6 Shim
11-
See https://mail.python.org/pipermail/tutor/2009-November/072959.html
12-
"""
13-
def __enter__(self):
14-
if self.fileobj is None:
15-
raise ValueError("I/O operation on closed GzipFile object")
16-
return self
17-
18-
def __exit__(self, *args):
19-
self.close()
20-
21-
229
def gzopen(filename):
2310
if '.gz' in filename:
24-
return GzipFileShim(filename)
11+
return gzip.GzipFile(filename)
2512

2613
return open(filename)
2714

tests/fixtures.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import unicode_literals
21
import os
32
import json
43

tests/test_draft4_generator.py

-4
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ def test_object_with_nested_properties(self):
2323
self.assertEqual(generate_schema({"something": {"nested_required": "1"}}),
2424
fixtures.REQUIRING_SOME_PROPERTY_WITH_NESTED_REQUIRED_PROPERTY)
2525

26-
def assertIn(self, a, b):
27-
"""polyfill for python 2.6"""
28-
self.assertTrue(a in b, "%r not found in %r" % (a, b))
29-
3026
def assertSchemaEqual(self, schema1, schema2):
3127
self.assertEqual(len(schema1), len(schema2))
3228
self.assertEqual(schema1.get('type'), schema2.get('type'))

tests/test_json_schema_merger.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33

4-
from __future__ import absolute_import, division, print_function, unicode_literals
4+
from __future__ import absolute_import, print_function
55
from skinfer.json_schema_merger import merge_schema
66
import unittest
77
from tests import fixtures

tests/test_schema_inferer.py

+2-24
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33

4-
from __future__ import absolute_import, division, print_function, unicode_literals
4+
from __future__ import absolute_import, print_function
55
import unittest
66
import json
77
from tests import fixtures
88
from skinfer import schema_inferer
9-
import subprocess
9+
from subprocess import check_output
1010

1111

1212
class TestJsonSchemaInferer(unittest.TestCase):
@@ -39,28 +39,6 @@ def test_load_jsonlines_samples(self):
3939
self.assertEquals(3, len(samples))
4040

4141

42-
def check_output(*popenargs, **kwargs):
43-
r"""Run command with arguments and return its output as a byte string.
44-
45-
Backported from Python 2.7 as it's implemented as pure python on stdlib.
46-
47-
>>> check_output(['/usr/bin/python', '--version'])
48-
Python 2.6.2
49-
"""
50-
# FROM: https://gist.github.com/edufelipe/1027906
51-
process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs, **kwargs)
52-
output, unused_err = process.communicate()
53-
retcode = process.poll()
54-
if retcode:
55-
cmd = kwargs.get("args")
56-
if cmd is None:
57-
cmd = popenargs[0]
58-
error = subprocess.CalledProcessError(retcode, cmd)
59-
error.output = output
60-
raise error
61-
return output
62-
63-
6442
class TestCasePython26Shim(unittest.TestCase):
6543
def assertIsNotNone(self, value):
6644
self.assertFalse(value is None, "%r is not None" % value)

0 commit comments

Comments
 (0)