Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove six dependency

  • Loading branch information...
commit a0801719f8f24a0e3192eca203bbd341c4e557ec 1 parent 135c53a
@DasIch DasIch authored
View
3  flask/helpers.py
@@ -24,7 +24,6 @@
from werkzeug.datastructures import Headers
from werkzeug.exceptions import NotFound
-import six
from flask._compat import string_types, text_type
# this was moved in 0.7
@@ -128,7 +127,7 @@ def generator():
# pushed. This item is discarded. Then when the iteration continues the
# real generator is executed.
wrapped_g = generator()
- six.advance_iterator(wrapped_g)
+ next(wrapped_g)
return wrapped_g
View
4 flask/json.py
@@ -11,13 +11,13 @@
import uuid
from datetime import datetime
from .globals import current_app, request
+from ._compat import text_type
from werkzeug.http import http_date
# Use the same json implementation as itsdangerous on which we
# depend anyways.
from itsdangerous import json as _json
-import six
# figure out if simplejson escapes slashes. This behavior was changed
@@ -60,7 +60,7 @@ def default(self, o):
if isinstance(o, uuid.UUID):
return str(o)
if hasattr(o, '__html__'):
- return six.text_type(o.__html__())
+ return text_type(o.__html__())
return _json.JSONEncoder.default(self, o)
View
6 flask/templating.py
@@ -15,7 +15,7 @@
from .globals import _request_ctx_stack, _app_ctx_stack
from .signals import template_rendered
from .module import blueprint_is_module
-import six
+from ._compat import itervalues, iteritems
def _default_template_ctx_processor():
@@ -80,7 +80,7 @@ def _iter_loaders(self, template):
except (ValueError, KeyError):
pass
- for blueprint in six.itervalues(self.app.blueprints):
+ for blueprint in itervalues(self.app.blueprints):
if blueprint_is_module(blueprint):
continue
loader = blueprint.jinja_loader
@@ -93,7 +93,7 @@ def list_templates(self):
if loader is not None:
result.update(loader.list_templates())
- for name, blueprint in six.iteritems(self.app.blueprints):
+ for name, blueprint in iteritems(self.app.blueprints):
loader = blueprint.jinja_loader
if loader is not None:
for template in loader.list_templates():
View
4 flask/testsuite/basic.py
@@ -17,10 +17,10 @@
from datetime import datetime
from threading import Thread
from flask.testsuite import FlaskTestCase, emits_module_deprecation_warning
+from flask._compat import text_type
from werkzeug.exceptions import BadRequest, NotFound
from werkzeug.http import parse_date
from werkzeug.routing import BuildError
-import six
class BasicFunctionalityTestCase(FlaskTestCase):
@@ -276,7 +276,7 @@ def index():
@app.route('/test')
def test():
- return six.text_type(flask.session.permanent)
+ return text_type(flask.session.permanent)
client = app.test_client()
rv = client.get('/')
View
4 flask/testsuite/blueprints.py
@@ -13,10 +13,10 @@
import unittest
import warnings
from flask.testsuite import FlaskTestCase, emits_module_deprecation_warning
+from flask._compat import text_type
from werkzeug.exceptions import NotFound
from werkzeug.http import parse_cache_control_header
from jinja2 import TemplateNotFound
-import six
# import moduleapp here because it uses deprecated features and we don't
@@ -303,7 +303,7 @@ def foo(bar, baz):
@bp.route('/bar')
def bar(bar):
- return six.text_type(bar)
+ return text_type(bar)
app = flask.Flask(__name__)
app.register_blueprint(bp, url_prefix='/1', url_defaults={'bar': 23})
View
5 flask/testsuite/ext.py
@@ -11,9 +11,12 @@
import sys
import unittest
+try:
+ from imp import reload as reload_module
+except ImportError:
+ reload_module = reload

shouldn't that be in _compat also?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
from flask.testsuite import FlaskTestCase
from flask._compat import PY2
-from six.moves import reload_module
class ExtImportHookTestCase(FlaskTestCase):
View
11 flask/testsuite/helpers.py
@@ -15,8 +15,7 @@
from logging import StreamHandler
from flask.testsuite import FlaskTestCase, catch_warnings, catch_stderr
from werkzeug.http import parse_cache_control_header, parse_options_header
-import six
-from flask._compat import StringIO
+from flask._compat import StringIO, text_type
def has_encoding(name):
@@ -34,7 +33,7 @@ def test_json_bad_requests(self):
app = flask.Flask(__name__)
@app.route('/json', methods=['POST'])
def return_json():
- return six.text_type(flask.request.json)
+ return text_type(flask.request.json)
c = app.test_client()
rv = c.post('/json', data='malformed', content_type='application/json')
self.assert_equal(rv.status_code, 400)
@@ -43,7 +42,7 @@ def test_json_bad_requests_content_type(self):
app = flask.Flask(__name__)
@app.route('/json', methods=['POST'])
def return_json():
- return six.text_type(flask.request.json)
+ return text_type(flask.request.json)
c = app.test_client()
rv = c.post('/json', data='malformed', content_type='application/json')
self.assert_equal(rv.status_code, 400)
@@ -95,7 +94,7 @@ def test_json_attr(self):
app = flask.Flask(__name__)
@app.route('/add', methods=['POST'])
def add():
- return six.text_type(flask.request.json['a'] + flask.request.json['b'])
+ return text_type(flask.request.json['a'] + flask.request.json['b'])
c = app.test_client()
rv = c.post('/add', data=flask.json.dumps({'a': 1, 'b': 2}),
content_type='application/json')
@@ -506,7 +505,7 @@ def __iter__(self):
def close(self):
called.append(42)
def next(self):
- return six.advance_iterator(self._gen)
+ return next(self._gen)
@app.route('/')
def index():
def generate():
View
4 flask/testsuite/testing.py
@@ -12,7 +12,7 @@
import flask
import unittest
from flask.testsuite import FlaskTestCase
-import six
+from flask._compat import text_type
class TestToolsTestCase(FlaskTestCase):
@@ -84,7 +84,7 @@ def test_session_transactions(self):
@app.route('/')
def index():
- return six.text_type(flask.session['foo'])
+ return text_type(flask.session['foo'])
with app.test_client() as c:
with c.session_transaction() as sess:
View
1  setup.py
@@ -91,7 +91,6 @@ def run(self):
zip_safe=False,
platforms='any',
install_requires=[
- 'six>=1.3.0',
'Werkzeug>=0.7',
'Jinja2>=2.4',
'itsdangerous>=0.17'
Please sign in to comment.
Something went wrong with that request. Please try again.