Skip to content

Commit f0aa70f

Browse files
committed
[nginxctl/helpers.py] Fixed Python 2.7 support ; linting
1 parent f183e76 commit f0aa70f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

nginxctl/helpers.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55

66
if version_info[0] == 2:
77
from codecs import open
8-
from string import maketrans
8+
9+
maketrans = string.maketrans
10+
string_types = basestring,
911
else:
1012
maketrans = str.maketrans
13+
string_types = str,
1114

12-
string_types = (basestring,) if version_info.major == 2 else (str,) # noqa: F821
1315
pp = PrettyPrinter(indent=4).pprint
1416

1517

@@ -112,9 +114,11 @@ def get_dict_by_key_val(obj, key, value):
112114
"get_dict_by_key_val for {!r} {}".format(type(obj), obj)
113115
)
114116

117+
115118
def rpartial(func, *args):
116119
return lambda *a: func(*(a + args))
117120

121+
118122
def strings(filename, minimum=4):
119123
with open(filename, errors="ignore") as f:
120124
result = ""

0 commit comments

Comments
 (0)