def filter_hidden_settings(conf):
 def maybe_censor(key, value, mask=(u'*' * 8)):
  if isinstance(value, Mapping):
   return filter_hidden_settings(value)
  if isinstance(key, string_t):
   if HIDDEN_SETTINGS.search(key):
    return mask
   elif (u'broker_url' in key.lower()):
    from kombu import Connection
    return Connection(value).as_uri(mask=mask)
   elif (u'backend' in key.lower()):
    return maybe_sanitize_url(value, mask=mask)
  return value
 return {k: maybe_censor(k, v) for (k, v) in items(conf)}

def filter_hidden_settings ( conf ) : def maybe_censor ( key , value , mask = ( u'*' * 8 ) ) : if isinstance ( value , Mapping ) : return filter_hidden_settings ( value ) if isinstance ( key , string_t ) : if HIDDEN_SETTINGS . search ( key ) : return mask elif ( u'broker_url' in key . lower ( ) ) : from kombu import Connection return Connection ( value ) . as_uri ( mask = mask ) elif ( u'backend' in key . lower ( ) ) : return maybe_sanitize_url ( value , mask = mask ) return value return { k : maybe_censor ( k , v ) for ( k , v ) in items ( conf ) }
filter sensitive settings .