Skip to content

Commit

Permalink
Remove imports related to Python 2 compatibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
fschulze committed Aug 31, 2023
1 parent 7a49b4b commit c16f1c9
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 26 deletions.
2 changes: 0 additions & 2 deletions client/devpi/test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@

from __future__ import with_statement
import re
import shlex
import hashlib
Expand Down
5 changes: 1 addition & 4 deletions client/devpi/use.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
from copy import deepcopy
from operator import attrgetter
try:
from urllib.parse import quote as url_quote
except ImportError:
from urllib import quote as url_quote # noqa: F401
from urllib.parse import quote as url_quote
import itertools
import os
import sys
Expand Down
1 change: 0 additions & 1 deletion client/testing/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function
from _pytest import capture
from contextlib import closing
from devpi_common.metadata import parse_version
Expand Down
1 change: 0 additions & 1 deletion common/devpi_common/types.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import absolute_import, unicode_literals
from lazy import lazy as cached_property # noqa: F401 must be importable
from types import FunctionType
import hashlib
Expand Down
1 change: 0 additions & 1 deletion common/testing/test_url.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import unicode_literals
import hashlib
import posixpath
import pytest
Expand Down
7 changes: 2 additions & 5 deletions server/test_devpi_server/functional.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
# this file is shared via symlink with devpi-client,
# so it must continue to work with the lowest supported Python 3.x version
from devpi_common.metadata import parse_version
from urllib.parse import quote as url_quote
import pytest

try:
from urllib.parse import quote as url_quote
except ImportError:
from urllib import quote as url_quote # type: ignore


class API:
def __init__(self, d):
Expand Down
4 changes: 2 additions & 2 deletions server/test_devpi_server/reqmock.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# this file is shared via symlink with devpi-client,
# so for the time being it must continue to work with Python 2
# so it must continue to work with the lowest supported Python 3.x version
from io import BytesIO
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.response import HTTPResponse # type: ignore
from requests.packages.urllib3.response import HTTPResponse
import fnmatch
import pytest

Expand Down
13 changes: 3 additions & 10 deletions server/test_devpi_server/simpypi.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
# this file is shared via symlink with devpi-client,
# so for the time being it must continue to work with Python 2
from __future__ import print_function
try:
from html import escape
except ImportError:
from cgi import escape # type: ignore
# so it must continue to work with the lowest supported Python 3.x version
from html import escape
import hashlib
try:
import http.server as httpserver
except ImportError:
import BaseHTTPServer as httpserver # type: ignore
import http.server as httpserver
import sys


Expand Down

0 comments on commit c16f1c9

Please sign in to comment.