def hide_sensitive_data_queries(queries): queries = dict(queries) for pattern in settings.HIDE_SENSITIVE_DATA_PATTERNS.get('QUERIES', ()): for query_name, query in queries.items(): if re.match(pattern, query_name, re.IGNORECASE): queries[query_name] = (len(query) * [settings.SENSITIVE_DATA_REPLACEMENT] if is_base_collection(query) else settings.SENSITIVE_DATA_REPLACEMENT) return queries
def hide_sensitive_data_queries(queries): queries = dict(queries) for pattern in settings.HIDE_SENSITIVE_DATA_PATTERNS.get('QUERIES', ()): for query_name, query in queries.items(): if re.match(pattern, query_name, re.IGNORECASE): queries[query_name] = ( len(query) * [settings.SENSITIVE_DATA_REPLACEMENT] if is_base_collection(query) else settings.SENSITIVE_DATA_REPLACEMENT ) return queries
def list_params(params): return { k: list(v) if is_base_collection(v) else [v] for k, v in params.items() }
def flat_params(params): return { k: v[0] if is_base_collection(v) and len(v) == 1 else v for k, v in params.items() }