def GetDefaultStyleForDir(dirname):
 dirname = os.path.abspath(dirname)
 while True:
  style_file = os.path.join(dirname, style.LOCAL_STYLE)
  if os.path.exists(style_file):
   return style_file
  config_file = os.path.join(dirname, style.SETUP_CONFIG)
  if os.path.exists(config_file):
   with open(config_file) as fd:
    config = py3compat.ConfigParser()
    config.read_file(fd)
    if config.has_section('yapf'):
     return config_file
  dirname = os.path.dirname(dirname)
  if ((not dirname) or (not os.path.basename(dirname)) or (dirname == os.path.abspath(os.path.sep))):
   break
 global_file = os.path.expanduser(style.GLOBAL_STYLE)
 if os.path.exists(global_file):
  return global_file
 return style.DEFAULT_STYLE

def GetDefaultStyleForDir ( dirname ) : dirname = os . path . abspath ( dirname ) while True : style_file = os . path . join ( dirname , style . LOCAL_STYLE ) if os . path . exists ( style_file ) : return style_file config_file = os . path . join ( dirname , style . SETUP_CONFIG ) if os . path . exists ( config_file ) : with open ( config_file ) as fd : config = py3compat . ConfigParser ( ) config . read_file ( fd ) if config . has_section ( 'yapf' ) : return config_file dirname = os . path . dirname ( dirname ) if ( ( not dirname ) or ( not os . path . basename ( dirname ) ) or ( dirname == os . path . abspath ( os . path . sep ) ) ) : break global_file = os . path . expanduser ( style . GLOBAL_STYLE ) if os . path . exists ( global_file ) : return global_file return style . DEFAULT_STYLE
return default style name for a given directory .