From bd84412eabb323282fc7207cbf7134d5cc181eef Mon Sep 17 00:00:00 2001 From: Mike Fiedler Date: Fri, 10 Apr 2020 18:55:33 -0400 Subject: [PATCH] chore: remove python 2 specific handling Refs: #23 Signed-off-by: Mike Fiedler --- pytest_socket.py | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/pytest_socket.py b/pytest_socket.py index 30070ea..53e39d2 100644 --- a/pytest_socket.py +++ b/pytest_socket.py @@ -1,11 +1,9 @@ # -*- coding: utf-8 -*- import socket -import sys import pytest _true_socket = socket.socket _true_connect = socket.socket.connect -is_py2 = sys.version_info[0] == 2 class SocketBlockedError(RuntimeError): @@ -108,20 +106,11 @@ def host_from_address(address): return host -def host_from_address_py2(address): - host = address[0] - if isinstance(host, str) or isinstance(host, unicode): # noqa F821 - return host - - def host_from_connect_args(args): address = args[0] if isinstance(address, tuple): - if is_py2: - return host_from_address_py2(address) - else: - return host_from_address(address) + return host_from_address(address) def socket_allow_hosts(allowed=None):