Skip to content

Commit 6836e01

Browse files
committed
Remove redundant method defs
astroquery/utils/tap/core.py:1994:5: F811 redefinition of unused 'login' from line 1354 astroquery/utils/tap/core.py:2033:5: F811 redefinition of unused 'login_gui' from line 1393 astroquery/utils/tap/core.py:2053:5: F811 redefinition of unused '__dologin' from line 1413 astroquery/utils/tap/core.py:2072:5: F811 redefinition of unused 'logout' from line 1428
1 parent 557a5a3 commit 6836e01

File tree

1 file changed

+0
-92
lines changed

1 file changed

+0
-92
lines changed

astroquery/utils/tap/core.py

Lines changed: 0 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,98 +1351,6 @@ def remove_jobs(self, jobs_list, verbose=False):
13511351
msg = f"Removed jobs: '{jobs_list}'."
13521352
print(msg)
13531353

1354-
def login(self, user=None, password=None, credentials_file=None,
1355-
verbose=False):
1356-
"""Performs a login.
1357-
User and password arguments can be used or a file that contains
1358-
user name and password
1359-
(2 lines: one for user name and the following one for the password).
1360-
If no arguments are provided, a prompt asking for user name and
1361-
password will appear.
1362-
1363-
Parameters
1364-
----------
1365-
user : str, default None
1366-
login name
1367-
password : str, default None
1368-
user password
1369-
credentials_file : str, default None
1370-
file containing user and password in two lines
1371-
verbose : bool, optional, default 'False'
1372-
flag to display information about the process
1373-
"""
1374-
if credentials_file is not None:
1375-
# read file: get user & password
1376-
with open(credentials_file, "r") as ins:
1377-
user = ins.readline().strip()
1378-
password = ins.readline().strip()
1379-
if user is None:
1380-
user = input("User: ")
1381-
if user is None:
1382-
print("Invalid user name")
1383-
return
1384-
if password is None:
1385-
password = getpass.getpass("Password: ")
1386-
if password is None:
1387-
print("Invalid password")
1388-
return
1389-
self.__user = str(user)
1390-
self.__pwd = str(password)
1391-
self.__dologin(verbose)
1392-
1393-
def login_gui(self, verbose=False):
1394-
"""Performs a login using a GUI dialog
1395-
1396-
Parameters
1397-
----------
1398-
verbose : bool, optional, default 'False'
1399-
flag to display information about the process
1400-
"""
1401-
connHandler = self.__getconnhandler()
1402-
url = connHandler.get_host_url()
1403-
loginDialog = LoginDialog(url)
1404-
loginDialog.show_login()
1405-
if loginDialog.is_accepted():
1406-
self.__user = loginDialog.get_user()
1407-
self.__pwd = loginDialog.get_password()
1408-
# execute login
1409-
self.__dologin(verbose)
1410-
else:
1411-
self.__isLoggedIn = False
1412-
1413-
def __dologin(self, verbose=False):
1414-
self.__isLoggedIn = False
1415-
response = self.__execLogin(self.__user, self.__pwd, verbose)
1416-
# check response
1417-
connHandler = self.__getconnhandler()
1418-
connHandler.check_launch_response_status(response,
1419-
verbose,
1420-
200)
1421-
# extract cookie
1422-
cookie = self._Tap__findCookieInHeader(response.getheaders())
1423-
if cookie is not None:
1424-
self.__isLoggedIn = True
1425-
connHandler.set_cookie(cookie)
1426-
print("OK: user logged in.")
1427-
1428-
def logout(self, verbose=False):
1429-
"""Performs a logout
1430-
1431-
Parameters
1432-
----------
1433-
verbose : bool, optional, default 'False'
1434-
flag to display information about the process
1435-
"""
1436-
subContext = "logout"
1437-
args = {}
1438-
connHandler = self.__getconnhandler()
1439-
data = connHandler.url_encode(args)
1440-
response = connHandler.execute_secure(subContext, data)
1441-
if verbose:
1442-
print(response.status, response.reason)
1443-
print(response.getheaders())
1444-
self.__isLoggedIn = False
1445-
14461354
def __execLogin(self, usr, pwd, verbose=False):
14471355
subContext = "login"
14481356
args = {

0 commit comments

Comments
 (0)