Remove six dependency
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Daniel Neuhäuser · committed by Daniel Neuhäuser · parent 135c53a · Browse files · 9 files·+21 added−21 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
9 files+21 added−21 removed
- other:+21 added−21 removed
Provenance
- Commit
a080171- Tree
6d57532- Author
Daniel Neuhäuser <dasdasich@gmail.com>- Committer
Daniel Neuhäuser <dasdasich@gmail.com>- Parent
135c53a
9 files changed+21 added−21 removed
modified:flask/testsuite/basic.py+2 added-2 removed
15 unmodified lines16 import unittest17 from datetime import datetime18 from threading import Thread19 from flask.testsuite import FlaskTestCase, emits_module_deprecation_warning20+from flask._compat import text_type21 from werkzeug.exceptions import BadRequest, NotFound22 from werkzeug.http import parse_date23 from werkzeug.routing import BuildError23-import six24 25 26 class BasicFunctionalityTestCase(FlaskTestCase):27 247 unmodified lines275 return ''276 277 @app.route('/test')278 def test():279- return six.text_type(flask.session.permanent)279+ return text_type(flask.session.permanent)280 281 client = app.test_client()282 rv = client.get('/')283 self.assert_in('set-cookie', rv.headers)867 unmodified linesmodified:flask/testsuite/blueprints.py+2 added-2 removed
11 unmodified lines12 import flask13 import unittest14 import warnings15 from flask.testsuite import FlaskTestCase, emits_module_deprecation_warning16+from flask._compat import text_type17 from werkzeug.exceptions import NotFound18 from werkzeug.http import parse_cache_control_header19 from jinja2 import TemplateNotFound19-import six20 21 22 # import moduleapp here because it uses deprecated features and we don't23 # want to see the warnings278 unmodified lines302 return '%s/%d' % (bar, baz)303 304 @bp.route('/bar')305 def bar(bar):306- return six.text_type(bar)306+ return text_type(bar)307 308 app = flask.Flask(__name__)309 app.register_blueprint(bp, url_prefix='/1', url_defaults={'bar': 23})310 app.register_blueprint(bp, url_prefix='/2', url_defaults={'bar': 19})455 unmodified linesmodified:flask/testsuite/ext.py+4 added-1 removed
9 unmodified lines10 """11 12 import sys13 import unittest14+try:15+ from imp import reload as reload_module16+except ImportError:17+ reload_module = reload18 from flask.testsuite import FlaskTestCase19 from flask._compat import PY216-from six.moves import reload_module20 21 class ExtImportHookTestCase(FlaskTestCase):22 23 def setup(self):107 unmodified linesmodified:flask/testsuite/helpers.py+5 added-6 removed
13 unmodified lines14 import unittest15 from logging import StreamHandler16 from flask.testsuite import FlaskTestCase, catch_warnings, catch_stderr17 from werkzeug.http import parse_cache_control_header, parse_options_header18-import six19-from flask._compat import StringIO18+from flask._compat import StringIO, text_type19 20 21 def has_encoding(name):22 try:9 unmodified lines32 def test_json_bad_requests(self):33 app = flask.Flask(__name__)34 @app.route('/json', methods=['POST'])35 def return_json():37- return six.text_type(flask.request.json)36+ return text_type(flask.request.json)37 c = app.test_client()38 rv = c.post('/json', data='malformed', content_type='application/json')39 self.assert_equal(rv.status_code, 400)40 41 def test_json_bad_requests_content_type(self):42 app = flask.Flask(__name__)43 @app.route('/json', methods=['POST'])44 def return_json():46- return six.text_type(flask.request.json)45+ return text_type(flask.request.json)46 c = app.test_client()47 rv = c.post('/json', data='malformed', content_type='application/json')48 self.assert_equal(rv.status_code, 400)49 self.assert_equal(rv.mimetype, 'application/json')43 unmodified lines93 def test_json_attr(self):94 app = flask.Flask(__name__)95 @app.route('/add', methods=['POST'])96 def add():98- return six.text_type(flask.request.json['a'] + flask.request.json['b'])97+ return text_type(flask.request.json['a'] + flask.request.json['b'])98 c = app.test_client()99 rv = c.post('/add', data=flask.json.dumps({'a': 1, 'b': 2}),100 content_type='application/json')101 self.assert_equal(rv.data, b'3')402 unmodified lines504 return self505 def close(self):506 called.append(42)507 def next(self):509- return six.advance_iterator(self._gen)508+ return next(self._gen)509 @app.route('/')510 def index():511 def generate():512 yield 'Hello '19 unmodified linesmodified:flask/testsuite/testing.py+2 added-2 removed
10 unmodified lines11 12 import flask13 import unittest14 from flask.testsuite import FlaskTestCase15-import six15+from flask._compat import text_type16 17 18 class TestToolsTestCase(FlaskTestCase):19 63 unmodified lines83 app.secret_key = 'testing'84 85 @app.route('/')86 def index():87- return six.text_type(flask.session['foo'])87+ return text_type(flask.session['foo'])88 89 with app.test_client() as c:90 with c.session_transaction() as sess:91 self.assert_equal(len(sess), 0)151 unmodified linesmodified:flask/helpers.py+1 added-2 removed
22 unmodified lines23 24 25 from werkzeug.datastructures import Headers26 from werkzeug.exceptions import NotFound27-import six27 from flask._compat import string_types, text_type28 29 # this was moved in 0.730 try:95 unmodified lines126 # the first dummy None is yielded at which point the context was already127 # pushed. This item is discarded. Then when the iteration continues the128 # real generator is executed.129 wrapped_g = generator()131- six.advance_iterator(wrapped_g)130+ next(wrapped_g)131 return wrapped_g132 133 134 def make_response(*args):710 unmodified linesmodified:flask/json.py+2 added-2 removed
9 unmodified lines10 """11 import uuid12 from datetime import datetime13 from .globals import current_app, request14+from ._compat import text_type15 16 from werkzeug.http import http_date17 18 # Use the same json implementation as itsdangerous on which we19 # depend anyways.20 from itsdangerous import json as _json20-import six21 22 23 # figure out if simplejson escapes slashes. This behavior was changed24 # from one version to another without reason.34 unmodified lines59 return http_date(o)60 if isinstance(o, uuid.UUID):61 return str(o)62 if hasattr(o, '__html__'):63- return six.text_type(o.__html__())63+ return text_type(o.__html__())64 return _json.JSONEncoder.default(self, o)65 66 67 class JSONDecoder(_json.JSONDecoder):105 unmodified linesmodified:flask/templating.py+3 added-3 removed
13 unmodified lines14 15 from .globals import _request_ctx_stack, _app_ctx_stack16 from .signals import template_rendered17 from .module import blueprint_is_module18-import six18+from ._compat import itervalues, iteritems19 20 21 def _default_template_ctx_processor():22 """Default template context processor. Injects `request`,56 unmodified lines79 yield loader, local_name80 except (ValueError, KeyError):81 pass82 83- for blueprint in six.itervalues(self.app.blueprints):83+ for blueprint in itervalues(self.app.blueprints):84 if blueprint_is_module(blueprint):85 continue86 loader = blueprint.jinja_loader87 if loader is not None:4 unmodified lines92 loader = self.app.jinja_loader93 if loader is not None:94 result.update(loader.list_templates())95 96- for name, blueprint in six.iteritems(self.app.blueprints):96+ for name, blueprint in iteritems(self.app.blueprints):97 loader = blueprint.jinja_loader98 if loader is not None:99 for template in loader.list_templates():100 prefix = ''43 unmodified linesmodified:setup.py-1 removed
89 unmodified lines90 include_package_data=True,91 zip_safe=False,92 platforms='any',93 install_requires=[94- 'six>=1.3.0',94 'Werkzeug>=0.7',95 'Jinja2>=2.4',96 'itsdangerous>=0.17'97 ],15 unmodified lines