diff options
| author | Michael Merickel <michael@merickel.org> | 2018-11-12 23:27:59 -0600 |
|---|---|---|
| committer | Michael Merickel <michael@merickel.org> | 2018-11-12 23:27:59 -0600 |
| commit | e2c7bbf5566f5be4d1b5b58d3e23948b4dc9b651 (patch) | |
| tree | 3a777228c4a5c030db2ab8dd6cc9acdfbf146a59 | |
| parent | d879bdfd477a138746e8593b8d9f30c492ff71e1 (diff) | |
| download | pyramid-e2c7bbf5566f5be4d1b5b58d3e23948b4dc9b651.tar.gz pyramid-e2c7bbf5566f5be4d1b5b58d3e23948b4dc9b651.tar.bz2 pyramid-e2c7bbf5566f5be4d1b5b58d3e23948b4dc9b651.zip | |
get rid of NativeIO alias and a few others
| -rw-r--r-- | src/pyramid/compat.py | 28 | ||||
| -rw-r--r-- | src/pyramid/security.py | 3 | ||||
| -rw-r--r-- | tests/test_scripts/test_prequest.py | 21 | ||||
| -rw-r--r-- | tests/test_scripts/test_pserve.py | 5 |
4 files changed, 9 insertions, 48 deletions
diff --git a/src/pyramid/compat.py b/src/pyramid/compat.py index e502cbce4..3ad8720d6 100644 --- a/src/pyramid/compat.py +++ b/src/pyramid/compat.py @@ -70,22 +70,6 @@ def reraise(tp, value, tb=None): raise value -def iteritems_(d): - return d.items() - - -def itervalues_(d): - return d.values() - - -def iterkeys_(d): - return d.keys() - - -def map_(*arg): - return list(map(*arg)) - - def is_nonstr_iter(v): if isinstance(v, str): return False @@ -95,20 +79,10 @@ def is_nonstr_iter(v): im_func = '__func__' im_self = '__self__' -import configparser - from http.cookies import SimpleCookie from html import escape -input_ = input - -from io import StringIO as NativeIO - -# "json" is not an API; it's here to support older pyramid_debugtoolbar -# versions which attempt to import it -import json - # see PEP 3333 for why we encode WSGI PATH_INFO to latin-1 before # decoding it to utf-8 def decode_path_info(path): @@ -130,8 +104,6 @@ def is_bound_method(ob): # support annotations and keyword-only arguments in PY3 from inspect import getfullargspec as getargspec -from itertools import zip_longest - def is_unbound_method(fn): """ diff --git a/src/pyramid/security.py b/src/pyramid/security.py index 08ae295d8..f8743e9a7 100644 --- a/src/pyramid/security.py +++ b/src/pyramid/security.py @@ -8,7 +8,6 @@ from pyramid.interfaces import ( IViewClassifier, ) -from pyramid.compat import map_ from pyramid.threadlocal import get_current_registry Everyone = 'system.Everyone' @@ -149,7 +148,7 @@ def view_execution_permitted(context, request, name=''): """ reg = _get_registry(request) - provides = [IViewClassifier] + map_(providedBy, (request, context)) + provides = [IViewClassifier] + [providedBy(x) for x in (request, context)] # XXX not sure what to do here about using _find_views or analogue; # for now let's just keep it as-is view = reg.adapters.lookup(provides, ISecuredView, name=name) diff --git a/tests/test_scripts/test_prequest.py b/tests/test_scripts/test_prequest.py index 1521172bc..aadde719a 100644 --- a/tests/test_scripts/test_prequest.py +++ b/tests/test_scripts/test_prequest.py @@ -1,3 +1,4 @@ +from io import StringIO import unittest from . import dummy @@ -134,13 +135,11 @@ class TestPRequestCommand(unittest.TestCase): self.assertEqual(self._out, ['abc']) def test_command_method_post(self): - from pyramid.compat import NativeIO - command = self._makeOne( ['', '--method=POST', 'development.ini', '/'], [('Content-Type', 'text/html; charset=UTF-8')], ) - stdin = NativeIO() + stdin = StringIO() command.stdin = stdin command.run() self.assertEqual(self._environ['REQUEST_METHOD'], 'POST') @@ -150,13 +149,11 @@ class TestPRequestCommand(unittest.TestCase): self.assertEqual(self._out, ['abc']) def test_command_method_put(self): - from pyramid.compat import NativeIO - command = self._makeOne( ['', '--method=PUT', 'development.ini', '/'], [('Content-Type', 'text/html; charset=UTF-8')], ) - stdin = NativeIO() + stdin = StringIO() command.stdin = stdin command.run() self.assertEqual(self._environ['REQUEST_METHOD'], 'PUT') @@ -166,13 +163,11 @@ class TestPRequestCommand(unittest.TestCase): self.assertEqual(self._out, ['abc']) def test_command_method_patch(self): - from pyramid.compat import NativeIO - command = self._makeOne( ['', '--method=PATCH', 'development.ini', '/'], [('Content-Type', 'text/html; charset=UTF-8')], ) - stdin = NativeIO() + stdin = StringIO() command.stdin = stdin command.run() self.assertEqual(self._environ['REQUEST_METHOD'], 'PATCH') @@ -182,13 +177,11 @@ class TestPRequestCommand(unittest.TestCase): self.assertEqual(self._out, ['abc']) def test_command_method_propfind(self): - from pyramid.compat import NativeIO - command = self._makeOne( ['', '--method=PROPFIND', 'development.ini', '/'], [('Content-Type', 'text/html; charset=UTF-8')], ) - stdin = NativeIO() + stdin = StringIO() command.stdin = stdin command.run() self.assertEqual(self._environ['REQUEST_METHOD'], 'PROPFIND') @@ -196,13 +189,11 @@ class TestPRequestCommand(unittest.TestCase): self.assertEqual(self._out, ['abc']) def test_command_method_options(self): - from pyramid.compat import NativeIO - command = self._makeOne( ['', '--method=OPTIONS', 'development.ini', '/'], [('Content-Type', 'text/html; charset=UTF-8')], ) - stdin = NativeIO() + stdin = StringIO() command.stdin = stdin command.run() self.assertEqual(self._environ['REQUEST_METHOD'], 'OPTIONS') diff --git a/tests/test_scripts/test_pserve.py b/tests/test_scripts/test_pserve.py index b85f4ddb7..a573f2e5b 100644 --- a/tests/test_scripts/test_pserve.py +++ b/tests/test_scripts/test_pserve.py @@ -1,3 +1,4 @@ +from io import StringIO import os import unittest from . import dummy @@ -8,9 +9,7 @@ here = os.path.abspath(os.path.dirname(__file__)) class TestPServeCommand(unittest.TestCase): def setUp(self): - from pyramid.compat import NativeIO - - self.out_ = NativeIO() + self.out_ = StringIO() def out(self, msg): self.out_.write(msg) |
