#NEWLINE# def _embed_worker( worker ) : #NEWLINE# #INDENT# wparse = re . compile ( 'importScripts\\((.*)\\)' ) #NEWLINE# wpath = os . path . split ( worker ) [ 0 ] #NEWLINE# with open ( worker ) as wfile : #NEWLINE# #INDENT# wdata = wfile . read ( ) #NEWLINE# for simport in wparse . findall ( wdata ) : #NEWLINE# #INDENT# imports = [ ] #NEWLINE# for fname in simport . split ( ',' ) : #NEWLINE# #INDENT# iname = os . path . join ( wpath , fname . strip ( '\'" ' ) ) #NEWLINE# with open ( iname ) as fp : #NEWLINE# #INDENT# imports . append ( fp . read ( ) ) #NEWLINE# #UNINDENT# #UNINDENT# wdata = wdata . replace ( ( 'importScripts(%s)' % simport ) , '\n' . join ( iname ) ) #NEWLINE# #UNINDENT# return wdata