Skip to content

github

github

Classes:

Name Description
Github

Match Github tokens

Github()

Bases: RegexPredictor

Match Github tokens

Source code in src/nemo_safe_synthesizer/pii_replacer/ner/regexes/github.py
def __init__(self):
    entity = Entity.GITHUB_TOKEN

    # NOTE: require at least one char and one number to not match long ass
    # char only strings
    _match_1 = Pattern(
        pattern=r"\b(?=.*[a-fA-F])(?=.*[0-9])[0-9a-fA-F]{35,40}\b",
        context_score=Score.MED,
        header_contexts=LABELS,
        span_contexts=SPANNER,
        ignore_raw_score=True,
        neg_header_contexts=NEG_HEADERS,
    )

    super().__init__(
        entity=entity,
        patterns=[_match_1],
    )