[AIRFLOW-4570] Remove future library (#5324)
Remove all usage of the future library because we're dropping Python 2 support.
This commit is contained in:
Родитель
a7370594ad
Коммит
3322782aa6
|
@ -24,8 +24,6 @@
|
|||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
from future.standard_library import install_aliases
|
||||
|
||||
from airflow.utils.log.logging_mixin import LoggingMixin
|
||||
|
||||
import kerberos
|
||||
|
@ -43,8 +41,6 @@ from functools import wraps
|
|||
from requests_kerberos import HTTPKerberosAuth
|
||||
from socket import getfqdn
|
||||
|
||||
install_aliases()
|
||||
|
||||
client_auth = HTTPKerberosAuth(service='airflow')
|
||||
|
||||
_SERVICE_NAME = None
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from future.moves.urllib.parse import urljoin
|
||||
from urllib.parse import urljoin
|
||||
|
||||
import requests
|
||||
|
||||
from airflow.api.client import api_client
|
||||
|
|
|
@ -21,7 +21,6 @@ from base64 import b64encode
|
|||
from builtins import str
|
||||
from collections import OrderedDict
|
||||
import copy
|
||||
from future import standard_library
|
||||
import os
|
||||
import pathlib
|
||||
import shlex
|
||||
|
@ -36,8 +35,6 @@ from zope.deprecation import deprecated
|
|||
from airflow.exceptions import AirflowConfigException
|
||||
from airflow.utils.log.logging_mixin import LoggingMixin
|
||||
|
||||
standard_library.install_aliases()
|
||||
|
||||
log = LoggingMixin().log
|
||||
|
||||
# show Airflow's deprecation warnings
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from future.utils import native
|
||||
|
||||
import flask_login
|
||||
from flask_login import login_required, current_user, logout_user # noqa: F401
|
||||
|
@ -75,7 +74,7 @@ def get_ldap_connection(dn=None, password=None):
|
|||
use_ssl=True,
|
||||
tls=tls_configuration)
|
||||
|
||||
conn = Connection(server, native(dn), native(password))
|
||||
conn = Connection(server, dn, password)
|
||||
|
||||
if not conn.bind():
|
||||
log.error("Cannot bind to ldap server: %s ", conn.last_error)
|
||||
|
@ -87,8 +86,7 @@ def get_ldap_connection(dn=None, password=None):
|
|||
def group_contains_user(conn, search_base, group_filter, user_name_attr, username):
|
||||
search_filter = '(&({0}))'.format(group_filter)
|
||||
|
||||
if not conn.search(native(search_base), native(search_filter),
|
||||
attributes=[native(user_name_attr)]):
|
||||
if not conn.search(search_base, search_filter, attributes=[user_name_attr]):
|
||||
log.warning("Unable to find group for %s %s", search_base, search_filter)
|
||||
else:
|
||||
for entry in conn.entries:
|
||||
|
@ -105,8 +103,7 @@ def groups_user(conn, search_base, user_filter, user_name_att, username):
|
|||
memberof_attr = configuration.conf.get("ldap", "group_member_attr")
|
||||
except Exception:
|
||||
memberof_attr = "memberOf"
|
||||
res = conn.search(native(search_base), native(search_filter),
|
||||
attributes=[native(memberof_attr)])
|
||||
res = conn.search(search_base, search_filter, attributes=[memberof_attr])
|
||||
if not res:
|
||||
log.info("Cannot find user %s", username)
|
||||
raise AuthenticationError("Invalid username or password")
|
||||
|
@ -210,9 +207,7 @@ class LdapUser(models.User):
|
|||
|
||||
# todo: BASE or ONELEVEL?
|
||||
|
||||
res = conn.search(native(configuration.conf.get("ldap", "basedn")),
|
||||
native(search_filter),
|
||||
search_scope=native(search_scope))
|
||||
res = conn.search(configuration.conf.get("ldap", "basedn"), search_filter, search_scope=search_scope)
|
||||
|
||||
# todo: use list or result?
|
||||
if not res:
|
||||
|
|
|
@ -34,7 +34,6 @@ import pendulum
|
|||
import six
|
||||
from croniter import croniter
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from future.standard_library import install_aliases
|
||||
from sqlalchemy import Column, String, Boolean, Integer, Text, func, or_
|
||||
|
||||
from airflow import configuration, settings, utils
|
||||
|
@ -54,8 +53,6 @@ from airflow.utils.log.logging_mixin import LoggingMixin
|
|||
from airflow.utils.sqlalchemy import UtcDateTime, Interval
|
||||
from airflow.utils.state import State
|
||||
|
||||
install_aliases()
|
||||
|
||||
ScheduleInterval = Union[str, timedelta, relativedelta]
|
||||
|
||||
|
||||
|
|
|
@ -17,9 +17,6 @@
|
|||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from future import standard_library # noqa
|
||||
standard_library.install_aliases() # noqa
|
||||
|
||||
import inspect
|
||||
import json
|
||||
import time
|
||||
|
|
1
setup.py
1
setup.py
|
@ -323,7 +323,6 @@ def do_setup():
|
|||
'flask-swagger==0.2.13',
|
||||
'flask-wtf>=0.14.2, <0.15',
|
||||
'funcsigs==1.0.0',
|
||||
'future>=0.16.0, <0.17',
|
||||
'gitpython>=2.0.2',
|
||||
'gunicorn>=19.5.0, <20.0',
|
||||
'iso8601>=0.1.12',
|
||||
|
|
Загрузка…
Ссылка в новой задаче