Commit 3eea9277 authored by Abhilash Raj's avatar Abhilash Raj

Merge branch 'py3-improvements' into 'master'

Remove dependencies on six and some old python 2 stuff.

See merge request !91
parents e452dbde 55da9e85
Pipeline #49396909 passed with stage
in 4 minutes and 41 seconds
......@@ -51,6 +51,17 @@ setup(
],
install_requires=[
'httplib2',
'six',
],
extras_require={
'testing': [
'requests',
'pytest',
'pytest-vcr',
'pytest-services',
'mailman',
],
'lint': [
'flake8>3.0'
]
},
)
......@@ -18,10 +18,6 @@
"""Package contents."""
from __future__ import absolute_import, print_function, unicode_literals
import six
from mailmanclient.client import Client
from mailmanclient.constants import __version__
from mailmanclient.restbase.connection import MailmanConnectionError
......@@ -64,7 +60,5 @@ __all__ = [
'__version__',
]
if six.PY2:
__all__ = [str(x) for x in __all__]
elif six.PY3:
__all__ = [bytes(x, 'utf-8') for x in __all__]
__all__ = [bytes(x, 'utf-8') for x in __all__]
......@@ -652,9 +652,6 @@ We can get all list settings via a lists settings attribute. A proxy object
for the settings is returned which behaves much like a dictionary.
>>> settings = test_one.settings
>>> len(settings)
59
>>> for attr in sorted(settings):
... print(attr + ': ' + str(settings[attr]))
acceptable_aliases: []
......
......@@ -14,9 +14,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with mailmanclient. If not, see <http://www.gnu.org/licenses/>.
import six
from collections import MutableMapping, Sequence
from collections.abc import MutableMapping, Sequence
__metaclass__ = type
__all__ = [
......@@ -144,9 +142,6 @@ class RESTDict(RESTBase, MutableMapping):
def __repr__(self):
return repr(self.rest_data)
def __unicode__(self):
return six.text_type(self.rest_data)
def __getitem__(self, key):
return self._get(key)
......@@ -204,9 +199,6 @@ class RESTList(RESTBase, Sequence):
def __repr__(self):
return repr(self.rest_data)
def __unicode__(self):
return six.text_type(self.rest_data)
def __getitem__(self, key):
return self._factory(self.rest_data[key])
......
......@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with mailmanclient. If not, see <http://www.gnu.org/licenses/>.
from six.moves.urllib_parse import urlencode, urlsplit, parse_qs, urlunsplit
from urllib.parse import urlencode, urlsplit, parse_qs, urlunsplit
from mailmanclient.constants import DEFAULT_PAGE_ITEM_COUNT
......
......@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with mailmanclient. If not, see <http://www.gnu.org/licenses/>.
from six.moves.urllib_error import HTTPError
from urllib.error import HTTPError
from mailmanclient.restobjects.mailinglist import MailingList
from mailmanclient.restbase.base import RESTList, RESTObject
......
......@@ -13,7 +13,6 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with mailmanclient. If not, see <http://www.gnu.org/licenses/>.
import six
from mailmanclient.restbase.base import RESTObject
......@@ -32,9 +31,6 @@ class HeldMessage(RESTObject):
return '<HeldMessage {0!r} by {1}>'.format(
self.request_id, self.sender)
def __unicode__(self):
return six.text_type(self.rest_data)
def moderate(self, action):
"""Moderate a held message.
......
......@@ -15,8 +15,8 @@
# along with mailmanclient. If not, see <http://www.gnu.org/licenses/>.
import warnings
from operator import itemgetter
from six.moves.urllib_error import HTTPError
from six.moves.urllib_parse import urlencode
from urllib.error import HTTPError
from urllib.parse import urlencode
from mailmanclient.restobjects.header_match import HeaderMatches
from mailmanclient.restobjects.archivers import ListArchivers
......
......@@ -21,8 +21,8 @@ from __future__ import absolute_import, print_function, unicode_literals
import unittest
import pytest
from mock import Mock
from six.moves.urllib_parse import urlsplit, parse_qs
from unittest.mock import Mock
from urllib.parse import urlsplit, parse_qs
from mailmanclient.constants import DEFAULT_PAGE_ITEM_COUNT
from mailmanclient.restbase.page import Page
......
......@@ -3,25 +3,15 @@ envlist = py{35,36,37},lint
[testenv]
usedevelop = True
commands = pytest --vcr-record-mode=all
deps =
WebTest
contextlib2
mock
requests
pytest
pytest-vcr
mailman
pytest-services
commands = pytest --vcr-record=all
extras = testing
[testenv:record]
basepython = python3
commands = pytest --vcr-record-mode=once
commands = pytest --vcr-record=once
[testenv:lint]
deps =
six
flake8 > 3.0
extras = lint
commands =
python -m flake8 {posargs}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment