Skip to content

Commit 5cef0b0

Browse files
committed
Refactor / simplify unused code.
1 parent bd6dc20 commit 5cef0b0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

full_offline_backup_for_todoist/frontend.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,17 @@ def __huge_warning(text: str) -> None:
6666
@staticmethod
6767
def __get_auth(args: argparse.Namespace, environment: Mapping[str, str]) -> TodoistAuth:
6868
def get_credential(opt_file: Optional[str], opt_direct: Optional[str],
69-
env_var: str, prompt: str, sensitive: bool) -> str:
69+
env_var: str, prompt: str) -> str:
7070
if opt_file:
71-
if sensitive and os.name == "posix": # OpenSSH-like check
71+
if os.name == "posix": # OpenSSH-like check
7272
file_stat = os.stat(opt_file)
7373
if file_stat.st_uid == os.getuid() and file_stat.st_mode & 0o077 != 0:
7474
ConsoleFrontend.__huge_warning(
7575
f"WARNING: Reading credentials from file {opt_file} "
7676
"accessible by other users is deprecated.")
7777
return Path(opt_file).read_text('utf-8')
7878

79-
if sensitive and opt_direct:
79+
if opt_direct:
8080
ConsoleFrontend.__huge_warning(
8181
"WARNING: Passing credentials through the command line is deprecated.\n"
8282
f" Pass it through the {env_var} environment variable,\n"
@@ -85,14 +85,14 @@ def get_credential(opt_file: Optional[str], opt_direct: Optional[str],
8585

8686
if env_var in environment:
8787
return environment[env_var]
88-
return getpass.getpass(prompt + ": ") if sensitive else input(prompt + ": ")
88+
return getpass.getpass(prompt + ": ")
8989

9090
for deprecated_env in ("TODOIST_EMAIL", "TODOIST_PASSWORD"):
9191
if deprecated_env in environment:
9292
print(f"WARNING: The {deprecated_env} environment variable is no longer necessary")
9393

9494
token = get_credential(args.token_file, args.token, "TODOIST_TOKEN",
95-
"Todoist token (from https://todoist.com/app/settings/integrations/developer)", sensitive=True)
95+
"Todoist token (from https://todoist.com/app/settings/integrations/developer)")
9696
return TodoistAuth(token)
9797

9898
def handle_download(self, args: argparse.Namespace, environment: Mapping[str, str]) -> None:

0 commit comments

Comments
 (0)