Skip to content
Myr

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

9 files+21 added−21 removed

modified:flask/testsuite/basic.py+2 added-2 removed
15 unmodified lines
16import unittest17from datetime import datetime18from threading import Thread19from flask.testsuite import FlaskTestCase, emits_module_deprecation_warning20from flask._compat import text_type21from werkzeug.exceptions import BadRequest, NotFound22from werkzeug.http import parse_date23from werkzeug.routing import BuildError23import six242526class BasicFunctionalityTestCase(FlaskTestCase):27
247 unmodified lines
275 return ''276277 @app.route('/test')278 def test():279 return six.text_type(flask.session.permanent)279 return text_type(flask.session.permanent)280281 client = app.test_client()282 rv = client.get('/')283 self.assert_in('set-cookie', rv.headers)
867 unmodified lines
modified:flask/testsuite/blueprints.py+2 added-2 removed
11 unmodified lines
12import flask13import unittest14import warnings15from flask.testsuite import FlaskTestCase, emits_module_deprecation_warning16from flask._compat import text_type17from werkzeug.exceptions import NotFound18from werkzeug.http import parse_cache_control_header19from jinja2 import TemplateNotFound19import six202122# import moduleapp here because it uses deprecated features and we don't23# want to see the warnings
278 unmodified lines
302 return '%s/%d' % (bar, baz)303304 @bp.route('/bar')305 def bar(bar):306 return six.text_type(bar)306 return text_type(bar)307308 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 lines
modified:flask/testsuite/ext.py+4 added-1 removed
9 unmodified lines
10"""1112import sys13import unittest14try:15 from imp import reload as reload_module16except ImportError:17 reload_module = reload18from flask.testsuite import FlaskTestCase19from flask._compat import PY216from six.moves import reload_module2021class ExtImportHookTestCase(FlaskTestCase):2223 def setup(self):
107 unmodified lines
modified:flask/testsuite/helpers.py+5 added-6 removed
13 unmodified lines
14import unittest15from logging import StreamHandler16from flask.testsuite import FlaskTestCase, catch_warnings, catch_stderr17from werkzeug.http import parse_cache_control_header, parse_options_header18import six19from flask._compat import StringIO18from flask._compat import StringIO, text_type192021def has_encoding(name):22 try:
9 unmodified lines
32 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)4041 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 lines
93 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 lines
504 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 lines
modified:flask/testsuite/testing.py+2 added-2 removed
10 unmodified lines
1112import flask13import unittest14from flask.testsuite import FlaskTestCase15import six15from flask._compat import text_type161718class TestToolsTestCase(FlaskTestCase):19
63 unmodified lines
83 app.secret_key = 'testing'8485 @app.route('/')86 def index():87 return six.text_type(flask.session['foo'])87 return text_type(flask.session['foo'])8889 with app.test_client() as c:90 with c.session_transaction() as sess:91 self.assert_equal(len(sess), 0)
151 unmodified lines
modified:flask/helpers.py+1 added-2 removed
22 unmodified lines
232425from werkzeug.datastructures import Headers26from werkzeug.exceptions import NotFound27import six27from flask._compat import string_types, text_type2829# this was moved in 0.730try:
95 unmodified lines
126 # 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_g132133134def make_response(*args):
710 unmodified lines
modified:flask/json.py+2 added-2 removed
9 unmodified lines
10"""11import uuid12from datetime import datetime13from .globals import current_app, request14from ._compat import text_type1516from werkzeug.http import http_date1718# Use the same json implementation as itsdangerous on which we19# depend anyways.20from itsdangerous import json as _json20import six212223# figure out if simplejson escapes slashes. This behavior was changed24# from one version to another without reason.
34 unmodified lines
59 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)656667class JSONDecoder(_json.JSONDecoder):
105 unmodified lines
modified:flask/templating.py+3 added-3 removed
13 unmodified lines
1415from .globals import _request_ctx_stack, _app_ctx_stack16from .signals import template_rendered17from .module import blueprint_is_module18import six18from ._compat import itervalues, iteritems192021def _default_template_ctx_processor():22 """Default template context processor. Injects `request`,
56 unmodified lines
79 yield loader, local_name80 except (ValueError, KeyError):81 pass8283 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 lines
92 loader = self.app.jinja_loader93 if loader is not None:94 result.update(loader.list_templates())9596 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 lines
modified:setup.py-1 removed
89 unmodified lines
90 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