def clean_orphaned_pyc(paths):
 orphaned_pyc = []
 for path in paths:
  for pyc_path in stem.util.system.files_with_suffix(path, '.pyc'):
   py_path = pyc_path[:(-1)]
   pycache = ('%s__pycache__%s' % (os.path.sep, os.path.sep))
   if (pycache in pyc_path):
    (directory, pycache_filename) = pyc_path.split(pycache, 1)
    if (not pycache_filename.endswith('.pyc')):
     continue
    py_path = os.path.join(directory, (pycache_filename.split('.')[0] + '.py'))
   if (not os.path.exists(py_path)):
    orphaned_pyc.append(pyc_path)
    os.remove(pyc_path)
 return orphaned_pyc

def clean_orphaned_pyc ( paths ) : orphaned_pyc = [ ] for path in paths : for pyc_path in stem . util . system . files_with_suffix ( path , '.pyc' ) : py_path = pyc_path [ : ( - 1 ) ] pycache = ( '%s__pycache__%s' % ( os . path . sep , os . path . sep ) ) if ( pycache in pyc_path ) : ( directory , pycache_filename ) = pyc_path . split ( pycache , 1 ) if ( not pycache_filename . endswith ( '.pyc' ) ) : continue py_path = os . path . join ( directory , ( pycache_filename . split ( '.' ) [ 0 ] + '.py' ) ) if ( not os . path . exists ( py_path ) ) : orphaned_pyc . append ( pyc_path ) os . remove ( pyc_path ) return orphaned_pyc
deletes any file with a * .