Преглед изворни кода

Merge branch 'fix/remove_future_package_usage' into 'master'

esp_prov: remove future usage

See merge request espressif/esp-idf!24887
Chen Yu Dong пре 2 година
родитељ
комит
7d03999b2b

+ 0 - 4
.pylintrc

@@ -146,10 +146,6 @@ disable=print-statement,
         invalid-name,
         too-few-public-methods,
         too-many-locals,
-        bad-super-call,  # since we still haven't drop python2 support
-        too-many-nested-blocks,
-        too-many-branches,
-        too-many-statements,
         ungrouped-imports,  # since we have isort in pre-commit
         no-name-in-module,  # since we have flake8 to check this
         too-many-instance-attributes,

+ 0 - 1
examples/protocols/esp_local_ctrl/pytest_esp_local_ctrl.py

@@ -1,6 +1,5 @@
 # SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
 # SPDX-License-Identifier: Unlicense OR CC0-1.0
-from __future__ import unicode_literals
 
 import logging
 import os

+ 1 - 1
tools/ci/check_requirement_files.py

@@ -8,8 +8,8 @@ import re
 from typing import Any
 
 import jsonschema
+from idf_ci_utils import IDF_PATH
 
-IDF_PATH = os.environ['IDF_PATH']
 JSON_PATH = os.path.join(IDF_PATH, 'tools', 'requirements.json')
 SCHEMA_PATH = os.path.join(IDF_PATH, 'tools', 'requirements_schema.json')
 REQ_DIR = os.path.join(IDF_PATH, 'tools', 'requirements')

+ 0 - 1
tools/esp_prov/README.md

@@ -105,7 +105,6 @@ For Android, a provisioning tool along with source code is available [here](http
 
 This requires the following python libraries to run:
 * `bleak`
-* `future`
 * `protobuf`
 * `cryptography`
 

+ 1 - 3
tools/esp_prov/transport/transport_ble.py

@@ -1,9 +1,7 @@
-# SPDX-FileCopyrightText: 2018-2022 Espressif Systems (Shanghai) CO LTD
+# SPDX-FileCopyrightText: 2018-2023 Espressif Systems (Shanghai) CO LTD
 # SPDX-License-Identifier: Apache-2.0
 #
 
-from __future__ import print_function
-
 from . import ble_cli
 from .transport import Transport
 

+ 5 - 12
tools/esp_prov/transport/transport_http.py

@@ -1,18 +1,10 @@
-# SPDX-FileCopyrightText: 2018-2022 Espressif Systems (Shanghai) CO LTD
+# SPDX-FileCopyrightText: 2018-2023 Espressif Systems (Shanghai) CO LTD
 # SPDX-License-Identifier: Apache-2.0
 #
-
-from __future__ import print_function
-
 import socket
+from http.client import HTTPConnection, HTTPSConnection
 
-from future.utils import tobytes
-
-try:
-    from http.client import HTTPConnection, HTTPSConnection
-except ImportError:
-    # Python 2 fallback
-    from httplib import HTTPConnection, HTTPSConnection  # type: ignore
+from utils import str_to_bytes
 
 from .transport import Transport
 
@@ -36,8 +28,9 @@ class Transport_HTTP(Transport):
         self.headers = {'Content-type': 'application/x-www-form-urlencoded','Accept': 'text/plain'}
 
     def _send_post_request(self, path, data):
+        data = str_to_bytes(data) if isinstance(data, str) else data
         try:
-            self.conn.request('POST', path, tobytes(data), self.headers)
+            self.conn.request('POST', path, data, self.headers)
             response = self.conn.getresponse()
             # While establishing a session, the device sends the Set-Cookie header
             # with value 'session=cookie_session_id' in its first response of the session to the tool.

+ 0 - 2
tools/requirements/requirements.ttfw.txt

@@ -16,13 +16,11 @@ python-gitlab
 pygdbmi
 
 # ble
-future
 dbus-python; sys_platform == 'linux'
 pygobject; sys_platform != 'win32'
 
 # esp_prov
 bleak
-# future  # addressed before under ble
 protobuf
 
 # tools/test_apps/system/monitor_ide_integration