def _getImports_pe(pth):
 from ..lib import pefile
 dlls = set()
 pe = pefile.PE(pth, fast_load=True)
 pe.parse_data_directories(directories=[pefile.DIRECTORY_ENTRY['IMAGE_DIRECTORY_ENTRY_IMPORT'], pefile.DIRECTORY_ENTRY['IMAGE_DIRECTORY_ENTRY_EXPORT']], forwarded_exports_only=True, import_dllnames_only=True)
 for entry in getattr(pe, 'DIRECTORY_ENTRY_IMPORT', []):
  dll_str = winutils.convert_dll_name_to_str(entry.dll)
  dlls.add(dll_str)
 exportSymbols = getattr(pe, 'DIRECTORY_ENTRY_EXPORT', None)
 if exportSymbols:
  for sym in exportSymbols.symbols:
   if (sym.forwarder is not None):
    forwarder = winutils.convert_dll_name_to_str(sym.forwarder)
    (dll, _) = forwarder.split('.')
    dlls.add((dll + '.dll'))
 pe.close()
 return dlls

def _getImports_pe ( pth ) : from . . lib import pefile dlls = set ( ) pe = pefile . PE ( pth , fast_load = True ) pe . parse_data_directories ( directories = [ pefile . DIRECTORY_ENTRY [ 'IMAGE_DIRECTORY_ENTRY_IMPORT' ] , pefile . DIRECTORY_ENTRY [ 'IMAGE_DIRECTORY_ENTRY_EXPORT' ] ] , forwarded_exports_only = True , import_dllnames_only = True ) for entry in getattr ( pe , 'DIRECTORY_ENTRY_IMPORT' , [ ] ) : dll_str = winutils . convert_dll_name_to_str ( entry . dll ) dlls . add ( dll_str ) exportSymbols = getattr ( pe , 'DIRECTORY_ENTRY_EXPORT' , None ) if exportSymbols : for sym in exportSymbols . symbols : if ( sym . forwarder is not None ) : forwarder = winutils . convert_dll_name_to_str ( sym . forwarder ) ( dll , _ ) = forwarder . split ( '.' ) dlls . add ( ( dll + '.dll' ) ) pe . close ( ) return dlls
find the binary dependencies of pth .