Skip to content

Commit 6159fc6

Browse files
frozencemeterysimo5
authored andcommitted
Fix Python unused imports and variables
This includes flagging the requests_kerberos magic OPTIONAL keyword as to be ignored. Signed-off-by: Robbie Harwood <rharwood@redhat.com>
1 parent 2a93118 commit 6159fc6

11 files changed

+10
-19
lines changed

contrib/sweeper.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@
99
# removing any ccaches that have expired from the filesystem, and serves as an
1010
# example of how this cleaning can be performed.
1111

12-
import gssapi
1312
import os
14-
import re
1513
import stat
1614
import sys
1715
import time
1816

17+
# try importing this first to provide a more useful error message
18+
import gssapi
19+
del gssapi
1920
try:
2021
from gssapi.raw import acquire_cred_from
2122
except ImportError:

tests/magtests.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22
# Copyright (C) 2015 - mod_auth_gssapi contributors, see COPYING for license.
33

44
import argparse
5-
import glob
65
import os
76
import random
87
import shutil
98
import signal
109
from string import Template
1110
import subprocess
1211
import sys
13-
import time
1412

1513
# check that we can import requests (for use in test scripts)
1614
import requests, requests_kerberos
@@ -279,8 +277,6 @@ def setup_kdc(testdir, wrapenv):
279277
krb5conf = os.path.join(testdir, 'krb5.conf')
280278
kdcconf = os.path.join(testdir, 'kdc.conf')
281279
kdcdir = os.path.join(testdir, 'kdc')
282-
kdcstash = os.path.join(kdcdir, KDC_STASH)
283-
kdcdb = os.path.join(kdcdir, KDC_DBNAME)
284280
if os.path.exists(kdcdir):
285281
shutil.rmtree(kdcdir)
286282
os.makedirs(kdcdir)

tests/t_bad_acceptor_name.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33

44
import os
55
import requests
6-
from stat import ST_MODE
7-
from requests_kerberos import HTTPKerberosAuth, OPTIONAL
6+
from requests_kerberos import HTTPKerberosAuth, OPTIONAL # noqa
87

98

109
if __name__ == '__main__':

tests/t_basic_k5_fail_second.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
import os
55
import requests
6-
import sys
7-
from requests.auth import HTTPBasicAuth
86

97

108
if __name__ == '__main__':

tests/t_basic_k5_two_users.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
import os
55
import requests
6-
from requests.auth import HTTPBasicAuth
76

87

98
if __name__ == '__main__':

tests/t_hostname_acceptor.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
#!/usr/bin/env python
22
# Copyright (C) 2017 - mod_auth_gssapi contributors, see COPYING for license.
33

4-
import os
54
import requests
65
import sys
7-
from stat import ST_MODE
8-
from requests_kerberos import HTTPKerberosAuth, OPTIONAL
6+
from requests_kerberos import HTTPKerberosAuth, OPTIONAL # noqa
97

108

119
if __name__ == '__main__':

tests/t_required_name_attr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import os
55
import requests
6-
from requests_kerberos import HTTPKerberosAuth, OPTIONAL
6+
from requests_kerberos import HTTPKerberosAuth, OPTIONAL # noqa
77

88

99
if __name__ == '__main__':

tests/t_spnego.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import os
55
import requests
66
from stat import ST_MODE
7-
from requests_kerberos import HTTPKerberosAuth, OPTIONAL
7+
from requests_kerberos import HTTPKerberosAuth, OPTIONAL # noqa
88

99

1010
if __name__ == '__main__':

tests/t_spnego_negotiate_once.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import os
55
import requests
6-
from requests_kerberos import HTTPKerberosAuth, OPTIONAL
6+
from requests_kerberos import HTTPKerberosAuth, OPTIONAL # noqa
77

88

99
if __name__ == '__main__':

tests/t_spnego_no_auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import os
55
import requests
6-
from requests_kerberos import HTTPKerberosAuth, OPTIONAL
6+
from requests_kerberos import HTTPKerberosAuth, OPTIONAL # noqa
77

88

99
if __name__ == '__main__':

0 commit comments

Comments
 (0)