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
@@ -1351,98 +1351,6 @@ class TapPlus(Tap):
msg = f"Removed jobs: '{jobs_list}'."
print(msg)
- def login(self, user=None, password=None, credentials_file=None,
- verbose=False):
- """Performs a login.
- User and password arguments can be used or a file that contains
- user name and password
- (2 lines: one for user name and the following one for the password).
- If no arguments are provided, a prompt asking for user name and
- password will appear.
-
- Parameters
- ----------
- user : str, default None
- login name
- password : str, default None
- user password
- credentials_file : str, default None
- file containing user and password in two lines
- verbose : bool, optional, default 'False'
- flag to display information about the process
- """
- if credentials_file is not None:
- # read file: get user & password
- with open(credentials_file, "r") as ins:
- user = ins.readline().strip()
- password = ins.readline().strip()
- if user is None:
- user = input("User: ")
- if user is None:
- print("Invalid user name")
- return
- if password is None:
- password = getpass.getpass("Password: ")
- if password is None:
- print("Invalid password")
- return
- self.__user = str(user)
- self.__pwd = str(password)
- self.__dologin(verbose)
-
- def login_gui(self, verbose=False):
- """Performs a login using a GUI dialog
-
- Parameters
- ----------
- verbose : bool, optional, default 'False'
- flag to display information about the process
- """
- connHandler = self.__getconnhandler()
- url = connHandler.get_host_url()
- loginDialog = LoginDialog(url)
- loginDialog.show_login()
- if loginDialog.is_accepted():
- self.__user = loginDialog.get_user()
- self.__pwd = loginDialog.get_password()
- # execute login
- self.__dologin(verbose)
- else:
- self.__isLoggedIn = False
-
- def __dologin(self, verbose=False):
- self.__isLoggedIn = False
- response = self.__execLogin(self.__user, self.__pwd, verbose)
- # check response
- connHandler = self.__getconnhandler()
- connHandler.check_launch_response_status(response,
- verbose,
- 200)
- # extract cookie
- cookie = self._Tap__findCookieInHeader(response.getheaders())
- if cookie is not None:
- self.__isLoggedIn = True
- connHandler.set_cookie(cookie)
- print("OK: user logged in.")
-
- def logout(self, verbose=False):
- """Performs a logout
-
- Parameters
- ----------
- verbose : bool, optional, default 'False'
- flag to display information about the process
- """
- subContext = "logout"
- args = {}
- connHandler = self.__getconnhandler()
- data = connHandler.url_encode(args)
- response = connHandler.execute_secure(subContext, data)
- if verbose:
- print(response.status, response.reason)
- print(response.getheaders())
- self.__isLoggedIn = False
-
def __execLogin(self, usr, pwd, verbose=False):
subContext = "login"
args = {
