Skip to content

Commit 1dcd670

Browse files
Merge pull request #47 from sunweaver/pr/drop-python-six-dependency
{src/pam,pyproject.toml}: Stop using six module. Deprecated.
2 parents 2408c2e + 8d6f8ee commit 1dcd670

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

pyproject.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
requires = [
33
'setuptools>=44',
44
'wheel>=0.30.0',
5-
'six',
65
]
76
build-backend = 'setuptools.build_meta'
87

@@ -32,7 +31,6 @@ deps =
3231
bandit
3332
flake8
3433
mypy
35-
types-six
3634
coverage
3735
pytest-cov
3836
pytest

src/pam/__internals.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import os
2-
import six
32
import sys
43
from ctypes import cdll
54
from ctypes import CFUNCTYPE
@@ -296,11 +295,11 @@ def __conv(n_messages, messages, p_response, app_data):
296295

297296
return my_conv(n_messages, messages, p_response, self.libc, msg_list, password, encoding)
298297

299-
if isinstance(username, six.text_type):
298+
if isinstance(username, str):
300299
username = username.encode(encoding)
301-
if isinstance(password, six.text_type):
300+
if isinstance(password, str):
302301
password = password.encode(encoding)
303-
if isinstance(service, six.text_type):
302+
if isinstance(service, str):
304303
service = service.encode(encoding)
305304

306305
if b'\x00' in username or b'\x00' in password or b'\x00' in service:
@@ -482,8 +481,7 @@ def getenv(self, key, encoding='utf-8'):
482481
return PAM_SYSTEM_ERR
483482

484483
# can't happen unless someone is using internals directly
485-
if sys.version_info >= (3, ): # pragma: no branch
486-
if isinstance(key, six.text_type): # pragma: no branch
484+
if isinstance(key, str): # pragma: no branch
487485
key = key.encode(encoding)
488486

489487
value = self.pam_getenv(self.handle, key)

src/pam/pam.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
Implemented using ctypes, so no compilation is necessary.
3131
'''
3232

33-
import six
3433
import __internals
3534

3635
if __name__ == "__main__": # pragma: no cover
@@ -43,7 +42,7 @@ def hook():
4342
readline.redisplay()
4443

4544
readline.set_pre_input_hook(hook)
46-
result = six.moves.input(prompt) # nosec (bandit; python2)
45+
result = input(prompt) # nosec (bandit; python2)
4746

4847
readline.set_pre_input_hook()
4948

0 commit comments

Comments
 (0)