def copy_globals(source, globs, only_names=None, ignore_missing_names=False, names_to_ignore=(), dunder_names_to_keep=('__implements__', '__all__', '__imports__'), cleanup_globs=True):
 if only_names:
  if ignore_missing_names:
   items = ((k, getattr(source, k, _NONE)) for k in only_names)
  else:
   items = ((k, getattr(source, k)) for k in only_names)
 else:
  items = iteritems(source.__dict__)
 copied = []
 for (key, value) in items:
  if (value is _NONE):
   continue
  if (key in names_to_ignore):
   continue
  if (key.startswith('__') and (key not in dunder_names_to_keep)):
   continue
  globs[key] = value
  copied.append(key)
 if cleanup_globs:
  if ('copy_globals' in globs):
   del globs['copy_globals']
 return copied

def copy_globals ( source , globs , only_names = None , ignore_missing_names = False , names_to_ignore = ( ) , dunder_names_to_keep = ( '__implements__' , '__all__' , '__imports__' ) , cleanup_globs = True ) : if only_names : if ignore_missing_names : items = ( ( k , getattr ( source , k , _NONE ) ) for k in only_names ) else : items = ( ( k , getattr ( source , k ) ) for k in only_names ) else : items = iteritems ( source . __dict__ ) copied = [ ] for ( key , value ) in items : if ( value is _NONE ) : continue if ( key in names_to_ignore ) : continue if ( key . startswith ( '__' ) and ( key not in dunder_names_to_keep ) ) : continue globs [ key ] = value copied . append ( key ) if cleanup_globs : if ( 'copy_globals' in globs ) : del globs [ 'copy_globals' ] return copied
copy attributes defined in source .