From de2bcb08b40fb0cf8402c742d510fc66cc6e6f5c Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Thu, 27 Jan 2022 18:28:04 +0530 Subject: [PATCH] fix!: Drop six PY2 compatibility package --- frappe/core/doctype/file/file.py | 4 +--- frappe/email/doctype/email_queue/email_queue.py | 3 +-- frappe/website/utils.py | 3 +-- requirements.txt | 1 - 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/frappe/core/doctype/file/file.py b/frappe/core/doctype/file/file.py index adf10b9a03..d9c966cc95 100755 --- a/frappe/core/doctype/file/file.py +++ b/frappe/core/doctype/file/file.py @@ -572,12 +572,10 @@ class File(Document): @staticmethod def zip_files(files): - from six import string_types - zip_file = io.BytesIO() zf = zipfile.ZipFile(zip_file, "w", zipfile.ZIP_DEFLATED) for _file in files: - if isinstance(_file, string_types): + if isinstance(_file, str): _file = frappe.get_doc("File", _file) if not isinstance(_file, File): continue diff --git a/frappe/email/doctype/email_queue/email_queue.py b/frappe/email/doctype/email_queue/email_queue.py index a7a593806f..4da83bd0d2 100644 --- a/frappe/email/doctype/email_queue/email_queue.py +++ b/frappe/email/doctype/email_queue/email_queue.py @@ -11,7 +11,6 @@ import quopri from email.parser import Parser from email.policy import SMTPUTF8 from html2text import html2text -from six.moves import html_parser as HTMLParser import frappe from frappe import _, safe_encode, task @@ -445,7 +444,7 @@ class QueueBuilder: try: text_content = html2text(self._message) - except HTMLParser.HTMLParseError: + except Exception: text_content = "See html attachment" return text_content + unsubscribe_text_message diff --git a/frappe/website/utils.py b/frappe/website/utils.py index 909d9678bb..fa95fbfbb0 100644 --- a/frappe/website/utils.py +++ b/frappe/website/utils.py @@ -8,7 +8,6 @@ from functools import wraps from typing import Dict, Optional import yaml -from six import iteritems from werkzeug.wrappers import Response import frappe @@ -464,7 +463,7 @@ def build_response(path, data, http_status_code, headers: Optional[Dict] = None) add_preload_headers(response) if headers: - for key, val in iteritems(headers): + for key, val in headers.items(): response.headers[key] = val.encode("ascii", errors="xmlcharrefreplace") return response diff --git a/requirements.txt b/requirements.txt index e074224410..114ab5f61d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -59,7 +59,6 @@ rq~=1.8.0 rsa>=4.1 # not directly required, pinned by Snyk to avoid a vulnerability schedule~=1.1.0 semantic-version~=2.8.5 -six~=1.15.0 sqlparse~=0.4.1 stripe~=2.56.0 terminaltables~=3.1.0