Skip to content

Commit

Permalink
clean py cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyNikiforov authored May 24, 2024
1 parent 585d792 commit 700d74a
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/pyicloud_ipd/cmdline.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
#! /usr/bin/env python
# mypy: ignore-errors
"""
A Command Line Wrapper to allow easy use of pyicloud for
command line scripts, and related.
"""
import argparse
import pickle
import sys
from typing import NoReturn
from typing import NoReturn, Optional, Sequence

from click import confirm

from pyicloud_ipd import PyiCloudService
from pyicloud_ipd.base import PyiCloudService
from pyicloud_ipd.exceptions import PyiCloudFailedLoginException
from . import utils

DEVICE_ERROR = "Please use the --device switch to indicate which device to use."


def create_pickled_data(idevice, filename):
def create_pickled_data(idevice, filename: str) -> None:
"""
This helper will output the idevice to a pickled file named
after the passed filename.
Expand All @@ -30,7 +29,7 @@ def create_pickled_data(idevice, filename):
pickle.dump(idevice.content, pickle_file, protocol=pickle.HIGHEST_PROTOCOL)


def main(args=None) -> NoReturn:
def main(args:Optional[Sequence[str]]=None) -> NoReturn:
"""Main commandline entrypoint."""
if args is None:
args = sys.argv[1:]
Expand Down Expand Up @@ -247,8 +246,8 @@ def main(args=None) -> NoReturn:
)

print("\nWhich device would you like to use?")
device = int(input("(number) --> "))
device = devices[device]
device_index = int(input("(number) --> "))
device = devices[device_index]
if not api.send_verification_code(device):
print("Failed to send verification code")
sys.exit(1)
Expand Down

0 comments on commit 700d74a

Please sign in to comment.