Skip to content

Commit

Permalink
removed unnecessary code
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Kaufman committed May 27, 2015
1 parent d6208ab commit f80d7e1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
12 changes: 1 addition & 11 deletions fencepy/helpers.py
Expand Up @@ -101,24 +101,14 @@ def redirected(out=sys.stdout, err=sys.stderr):
sys.stdout, sys.stderr = saved


def py2():
"""Check that we are running python 2.x"""
return sys.version.startswith('2')


def py3():
"""Check that we are running python 3.x"""
return sys.version.startswith('3')


def pyversionstr():
"""Return a pyXY version string for the python version"""
return 'py{0}'.format(''.join([str(x) for x in sys.version_info[:2]]))


def str2bool(value):
"""Convert various acceptable string values into a bool"""
if type(value) == str or (py2() and type(value) == unicode):
if type(value) == str or (sys.version_info[0] == 2 and type(value) == unicode):
if value.lower() in ('true', 't', 'yes', 'y', '1'):
return True
elif value.lower() in ('false', 'f', 'no', 'n', '0'):
Expand Down
2 changes: 1 addition & 1 deletion fencepy/main.py
Expand Up @@ -9,7 +9,7 @@
import shutil
import sys
from . import plugins
from .helpers import getoutputoserror, findpybin, str2bool, py2, pyversionstr, get_shell
from .helpers import getoutputoserror, findpybin, str2bool, pyversionstr, get_shell

try:
from ConfigParser import SafeConfigParser
Expand Down
2 changes: 1 addition & 1 deletion tests/test_fencepy.py
Expand Up @@ -9,7 +9,7 @@
import uuid
from py.test import raises
from docopt import DocoptExit
from fencepy.helpers import getoutputoserror, redirected, py3
from fencepy.helpers import getoutputoserror, redirected
try:
from StringIO import StringIO
except ImportError:
Expand Down

0 comments on commit f80d7e1

Please sign in to comment.