File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3030import base64
3131import struct
3232import logging
33- import zipfile
3433import platform
3534import datetime
3635import binascii
6867BINARY_TYPES = (bytes , bytearray , memoryview )
6968PATH_TYPES = (str , os .PathLike )
7069
70+ try :
71+ import zipfile_zstd as zipfile
72+ except (ImportError , OSError ):
73+ import zipfile
74+
7175# RAR file support
7276rarfile_support = False
7377try :
113117
114118def running_interactively ():
115119 main = sys .modules .get ("__main__" )
116- no_main_file = not hasattr (main , "__file__" )
117- interactive_flag = bool (getattr (sys .flags , "interactive" , 0 ))
118- return no_main_file or interactive_flag
120+ return (
121+ hasattr (sys , "ps1" ) or
122+ bool (getattr (sys .flags , "interactive" , 0 )) or
123+ (main is not None and not hasattr (main , "__file__" ))
124+ )
119125
120126if running_interactively ():
121127 logging .basicConfig (format = "%(message)s" , stream = PY_STDOUT_TEXT , level = logging .DEBUG )
You can’t perform that action at this time.
0 commit comments