python-requests-file/backport-Remove-installation-dependency-on-six.patch
2022-08-04 11:39:57 +08:00

36 lines
951 B
Diff

From f3d5f8f724767075854d3d657875e658bbff9a74 Mon Sep 17 00:00:00 2001
From: shixuantong <shixuantong@huawei.com>
Date: Sat, 9 Apr 2022 23:15:27 +0800
Subject: [PATCH] Remove installation dependency on six
The python2 life cycle is over and we can give up support for python2. Therefore, we no longer need to rely on the six module.
---
requests_file.py | 6 ++++--
requirements.txt | 1 -
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/requests_file.py b/requests_file.py
index 7464e55..d9bf5b8 100644
--- a/requests_file.py
+++ b/requests_file.py
@@ -6,8 +6,10 @@
import stat
import locale
import io
-
-from six import BytesIO
+try:
+ from io import BytesIO
+except ImportError:
+ from StringIO import StringIO as BytesIO
class FileAdapter(BaseAdapter):
diff --git a/requirements.txt b/requirements.txt
index 0f255c9..5a687fa 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,2 +1 @@
requests>=1.0.0
-six