From 95ef35d219daa2a207ed7bd30e961101935770e4 Mon Sep 17 00:00:00 2001 From: Daniel Watkins Date: Wed, 1 Apr 2020 16:57:26 -0400 Subject: util: remove unnecessary lru_cache import fallback (#299) functools.lru_cache has been present since Python 3.2, so we no longer need to handle its absence. (Also sort util's imports while we're modifying them.) --- cloudinit/util.py | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) (limited to 'cloudinit') diff --git a/cloudinit/util.py b/cloudinit/util.py index f8e28d2d..818904b1 100644 --- a/cloudinit/util.py +++ b/cloudinit/util.py @@ -31,32 +31,22 @@ import string import subprocess import sys import time -from urllib import parse - -from errno import ENOENT, ENOEXEC - from base64 import b64decode, b64encode +from errno import ENOENT, ENOEXEC +from functools import lru_cache +from urllib import parse from cloudinit import importer from cloudinit import log as logging -from cloudinit import mergers -from cloudinit import safeyaml -from cloudinit import temp_utils -from cloudinit import type_utils -from cloudinit import url_helper -from cloudinit import version - -from cloudinit.settings import (CFG_BUILTIN) - -try: - from functools import lru_cache -except ImportError: - def lru_cache(): - """pass-thru replace for Python3's lru_cache()""" - def wrapper(f): - return f - return wrapper - +from cloudinit import ( + mergers, + safeyaml, + temp_utils, + type_utils, + url_helper, + version, +) +from cloudinit.settings import CFG_BUILTIN _DNS_REDIRECT_IP = None LOG = logging.getLogger(__name__) -- cgit v1.2.3