def _find_observable_paths(extra_files=None):
 rv = set((os.path.abspath(x) for x in sys.path))
 for filename in (extra_files or ()):
  rv.add(os.path.dirname(os.path.abspath(filename)))
 for module in list(sys.modules.values()):
  fn = getattr(module, '__file__', None)
  if (fn is None):
   continue
  fn = os.path.abspath(fn)
  rv.add(os.path.dirname(fn))
 return _find_common_roots(rv)

def _find_observable_paths ( extra_files = None ) : rv = set ( ( os . path . abspath ( x ) for x in sys . path ) ) for filename in ( extra_files or ( ) ) : rv . add ( os . path . dirname ( os . path . abspath ( filename ) ) ) for module in list ( sys . modules . values ( ) ) : fn = getattr ( module , '__file__' , None ) if ( fn is None ) : continue fn = os . path . abspath ( fn ) rv . add ( os . path . dirname ( fn ) ) return _find_common_roots ( rv )
finds all paths that should be observed .