77import argparse
88from getpass import getpass
99
10+ from . import imapclient
1011from .config import create_client_from_config , get_config_defaults , parse_config_file
1112
1213
13- def command_line ():
14+ def command_line () -> argparse . Namespace :
1415 parser = argparse .ArgumentParser ()
1516 parser .add_argument (
1617 "-H" , "--host" , dest = "host" , action = "store" , help = "IMAP host connect to"
@@ -95,36 +96,38 @@ def command_line():
9596 return args
9697
9798
98- def main ():
99+ def main () -> int :
99100 args = command_line ()
100101 print ("Connecting..." )
101102 client = create_client_from_config (args )
102103 print ("Connected." )
103104 banner = '\n IMAPClient instance is "c"'
104105
105- def ptpython (c ) :
106- from ptpython .repl import embed
106+ def ptpython (c : imapclient . IMAPClient ) -> None :
107+ from ptpython .repl import embed # type: ignore[import]
107108
108109 embed (globals (), locals ())
109110
110- def ipython_400 (c ) :
111- from IPython .terminal .embed import InteractiveShellEmbed
111+ def ipython_400 (c : imapclient . IMAPClient ) -> None :
112+ from IPython .terminal .embed import InteractiveShellEmbed # type: ignore[import]
112113
113114 ipshell = InteractiveShellEmbed (banner1 = banner )
114115 ipshell ("" )
115116
116- def ipython_011 (c ):
117- from IPython .frontend .terminal .embed import InteractiveShellEmbed
117+ def ipython_011 (c : imapclient .IMAPClient ) -> None :
118+ from IPython .frontend .terminal .embed import ( # type: ignore[import]
119+ InteractiveShellEmbed ,
120+ )
118121
119122 ipshell = InteractiveShellEmbed (banner1 = banner )
120123 ipshell ("" )
121124
122- def ipython_010 (c ) :
123- from IPython .Shell import IPShellEmbed
125+ def ipython_010 (c : imapclient . IMAPClient ) -> None :
126+ from IPython .Shell import IPShellEmbed # type: ignore[import]
124127
125128 IPShellEmbed ("" , banner = banner )()
126129
127- def builtin (c ) :
130+ def builtin (c : imapclient . IMAPClient ) -> None :
128131 import code
129132
130133 code .interact (banner , local = {"c" : c })
@@ -143,6 +146,7 @@ def builtin(c):
143146 pass
144147 else :
145148 break
149+ return 0
146150
147151
148152if __name__ == "__main__" :
0 commit comments