From d778a9e6e070d7aa989e49cc517e5087d1a4c795 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Tue, 17 Jan 2012 15:22:47 -0500 Subject: remove need for global pylint disable of W0402 This is actually a pylint bug, but it considers use of string.letters and string.whitespace deprecated. --- cloudinit/CloudConfig/cc_mounts.py | 4 ++-- cloudinit/CloudConfig/cc_set_passwords.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cloudinit/CloudConfig/cc_mounts.py b/cloudinit/CloudConfig/cc_mounts.py index dbd9c454..2fa57362 100644 --- a/cloudinit/CloudConfig/cc_mounts.py +++ b/cloudinit/CloudConfig/cc_mounts.py @@ -18,7 +18,7 @@ import cloudinit.util as util import os import re -import string +from string import whitespace # pylint: disable=W0402 def is_mdname(name): @@ -139,7 +139,7 @@ def handle(_name, cfg, cloud, log, _args): fstab_lines = [] fstab = open("/etc/fstab", "r+") - ws = re.compile("[%s]+" % string.whitespace) + ws = re.compile("[%s]+" % whitespace) for line in fstab.read().splitlines(): try: toks = ws.split(line) diff --git a/cloudinit/CloudConfig/cc_set_passwords.py b/cloudinit/CloudConfig/cc_set_passwords.py index 05384f4f..f40544b3 100644 --- a/cloudinit/CloudConfig/cc_set_passwords.py +++ b/cloudinit/CloudConfig/cc_set_passwords.py @@ -19,7 +19,7 @@ import cloudinit.util as util import sys import random -import string +from string import letters, digits # pylint: disable=W0402 def handle(_name, cfg, _cloud, log, args): @@ -117,11 +117,11 @@ def handle(_name, cfg, _cloud, log, args): return -def rand_str(strlen=32, select_from=string.letters + string.digits): +def rand_str(strlen=32, select_from=letters + digits): return("".join([random.choice(select_from) for _x in range(0, strlen)])) def rand_user_password(pwlen=9): - selfrom = (string.letters.translate(None, 'loLOI') + - string.digits.translate(None, '01')) + selfrom = (letters.translate(None, 'loLOI') + + digits.translate(None, '01')) return(rand_str(pwlen, select_from=selfrom)) -- cgit v1.2.3