From a746ddcec9b63cba828dc48e3fa04ae1b98cd08e Mon Sep 17 00:00:00 2001 From: Robb Kidd Date: Fri, 15 Jul 2022 15:55:32 -0400 Subject: [PATCH] remove use of six for Py 2 compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Beeline hasn't supported use under Python 2 for a while now, so we can remove compat code. Note: six is still a transitive dep via dev dependencies, so it still appears in the poetry.lock. » poetry show --tree mock 3.0.5 Rolling backport of unittest.mock for all Pythons └── six * pylint 2.6.2 python code static checker └── astroid >=2.4.0,<2.5 └── six >=1.12,<2.0 --- beeline/patch/test_urllib.py | 2 -- beeline/propagation/__init__.py | 4 +--- beeline/propagation/honeycomb.py | 2 +- pylint.rc | 2 +- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/beeline/patch/test_urllib.py b/beeline/patch/test_urllib.py index 14c02cd..fd70880 100644 --- a/beeline/patch/test_urllib.py +++ b/beeline/patch/test_urllib.py @@ -1,5 +1,4 @@ from __future__ import absolute_import -import six import unittest from mock import Mock, patch @@ -7,7 +6,6 @@ class TestUrllibPatch(unittest.TestCase): - @unittest.skipIf(six.PY2, "urllib not compatible with python2") def test_request_fn_injects_headers_and_returns(self): from beeline.patch.urllib import _urllibopen # pylint: disable=bad-option-value,import-outside-toplevel diff --git a/beeline/propagation/__init__.py b/beeline/propagation/__init__.py index 0e3a7ca..5dc48cd 100644 --- a/beeline/propagation/__init__.py +++ b/beeline/propagation/__init__.py @@ -1,4 +1,3 @@ -import six from abc import ABCMeta, abstractmethod import beeline @@ -23,8 +22,7 @@ def __init__(self, trace_id, parent_id, trace_fields={}, dataset=None): self.dataset = dataset -@six.add_metaclass(ABCMeta) -class Request(object): +class Request(object, metaclass=ABCMeta): ''' beeline.propagation.Request is an abstract class that defines the interface that should be used by middleware to pass request information into http_trace_parser_hooks. It should diff --git a/beeline/propagation/honeycomb.py b/beeline/propagation/honeycomb.py index 04db12f..48137bb 100644 --- a/beeline/propagation/honeycomb.py +++ b/beeline/propagation/honeycomb.py @@ -2,7 +2,7 @@ from beeline.propagation import PropagationContext import base64 import json -from six.moves.urllib.parse import quote, unquote +from urllib.parse import quote, unquote def http_trace_parser_hook(request): diff --git a/pylint.rc b/pylint.rc index 62083f5..d2de477 100644 --- a/pylint.rc +++ b/pylint.rc @@ -537,7 +537,7 @@ init-import=no # List of qualified module names which can have objects that can redefine # builtins. -redefining-builtins-modules=six.moves,past.builtins,future.builtins,io,builtins +redefining-builtins-modules=past.builtins,future.builtins,io,builtins [FORMAT]