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 :
112116 shared_memory = None
113117
114118def running_interactively ():
119+ import sys
115120 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
121+ return (
122+ hasattr (sys , "ps1" ) or
123+ bool (getattr (sys .flags , "interactive" , 0 )) or
124+ (main is not None and not hasattr (main , "__file__" ))
125+ )
119126
120127if running_interactively ():
121128 logging .basicConfig (format = "%(message)s" , stream = PY_STDOUT_TEXT , level = logging .DEBUG )
You can’t perform that action at this time.
0 commit comments