INNER CODE UNIT · Python

entry_scoring

panther-labs/panther-analysis · .scripts/generate_indexes.py:216

def entry_scoring(entry):
    score = 0
    if entry['AnalysisType'] in ('Scheduled Query', 'scheduled_query'):
        score += 3
    if entry['AnalysisType'] in ('Scheduled Rule', 'scheduled_rule'):
        score += 2
    if entry['AnalysisType'] in ('Rule', 'rule'):
        score += 1
    return score

def group_by(iterable, key=None):
    # Uses itertools.groupby to produce a dictionary where each key is the grouping defined by the key function
    if key is None:
        key = lambda x: x
    result = {}
    data = sorted(iterable, key=key)
    groups = itertools.groupby(data, key=key)
    for k, g in groups:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…