pyflakes fixes (mostly unused imports, unused vars)

This commit is contained in:
Michael DeHaan 2012-10-30 20:47:05 -04:00
parent c0747b7baa
commit be300b562a
4 changed files with 3 additions and 22 deletions

View file

@ -18,7 +18,6 @@
####################################################### #######################################################
import os
import sys import sys
import getpass import getpass

View file

@ -18,7 +18,6 @@
import os import os
import pwd import pwd
import ConfigParser import ConfigParser
import traceback
def get_config(p, section, key, env_var, default): def get_config(p, section, key, env_var, default):
if env_var is not None: if env_var is not None:

View file

@ -15,22 +15,15 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>. # along with Ansible. If not, see <http://www.gnu.org/licenses/>.
import sys
import os import os
import shlex
import re import re
import codecs import codecs
import jinja2 import jinja2
import yaml import yaml
import operator
import json import json
from ansible import errors from ansible import errors
from ansible import __version__
import ansible.constants as C import ansible.constants as C
import time import time
import StringIO
import imp
import glob
import subprocess import subprocess
import datetime import datetime
import pwd import pwd
@ -87,7 +80,6 @@ def _varFind(text, vars, depth=0):
is_complex = False is_complex = False
brace_level = 0 brace_level = 0
end = var_start end = var_start
path = []
part_start = (var_start, brace_level) part_start = (var_start, brace_level)
space = vars space = vars
while end < len(text) and ((is_complex and brace_level > 0) or not is_complex): while end < len(text) and ((is_complex and brace_level > 0) or not is_complex):
@ -195,10 +187,7 @@ def varReplaceWithItems(basedir, varname, vars):
if not m: if not m:
return varname return varname
if m['start'] == 0 and m['end'] == len(varname): if m['start'] == 0 and m['end'] == len(varname):
try: return varReplaceWithItems(basedir, m['replacement'], vars)
return varReplaceWithItems(basedir, m['replacement'], vars)
except VarNotFoundException:
return varname
else: else:
return template(basedir, varname, vars) return template(basedir, varname, vars)
elif isinstance(varname, (list, tuple)): elif isinstance(varname, (list, tuple)):
@ -214,7 +203,6 @@ def varReplaceWithItems(basedir, varname, vars):
def template(basedir, text, vars, expand_lists=False): def template(basedir, text, vars, expand_lists=False):
''' run a text buffer through the templating engine until it no longer changes ''' ''' run a text buffer through the templating engine until it no longer changes '''
prev_text = ''
try: try:
text = text.decode('utf-8') text = text.decode('utf-8')
except UnicodeEncodeError: except UnicodeEncodeError:

View file

@ -18,9 +18,6 @@
import sys import sys
import os import os
import shlex import shlex
import re
import codecs
import jinja2
import yaml import yaml
import optparse import optparse
import operator import operator
@ -32,12 +29,9 @@ import time
import StringIO import StringIO
import imp import imp
import glob import glob
import subprocess
import stat import stat
import termios import termios
import tty import tty
import datetime
import pwd
VERBOSITY=0 VERBOSITY=0
@ -60,6 +54,7 @@ except:
KEYCZAR_AVAILABLE=False KEYCZAR_AVAILABLE=False
try: try:
import keyczar.errors as key_errors
from keyczar.keys import AesKey from keyczar.keys import AesKey
KEYCZAR_AVAILABLE=True KEYCZAR_AVAILABLE=True
except ImportError: except ImportError:
@ -99,7 +94,7 @@ def encrypt(key, msg):
def decrypt(key, msg): def decrypt(key, msg):
try: try:
return key.Decrypt(msg) return key.Decrypt(msg)
except keyczar.errors.InvalidSignatureError: except key_errors.InvalidSignatureError:
raise errors.AnsibleError("decryption failed") raise errors.AnsibleError("decryption failed")
############################################################### ###############################################################