def get_config_directory(section):
 if (section is None):
  return os.getcwd()
 if ('project_dir' in section):
  return path(section.get('project_dir'))
 config = os.path.abspath(section.get('files', '').origin)
 return (config if os.path.isdir(config) else os.path.dirname(config))

def get_config_directory ( section ) : if ( section is None ) : return os . getcwd ( ) if ( 'project_dir' in section ) : return path ( section . get ( 'project_dir' ) ) config = os . path . abspath ( section . get ( 'files' , '' ) . origin ) return ( config if os . path . isdir ( config ) else os . path . dirname ( config ) )
retrieves the configuration directory for the given section .