INNER CODE UNIT · Python

get_regexs

kubernetes-csi/csi-driver-nfs · hack/boilerplate/boilerplate.py:175

def get_regexs():
    regexs = {}
    # Search for "YEAR" which exists in the boilerplate, but shouldn't in the real thing
    regexs["year"] = re.compile( 'YEAR' )
    # dates can be 2014, 2015, 2016, ..., CURRENT_YEAR, company holder names can be anything
    years = range(2014, date.today().year + 1)
    regexs["date"] = re.compile( '(%s)' % "|".join(map(lambda l: str(l), years)) )
    # strip // +build \n\n build constraints
    regexs["go_build_constraints"] = re.compile(r"^(//go:build.*\n(// \+build.*\n)*|// \+build.*\n(// \+build.*\n)*)\n", re.MULTILINE)
    # strip #!.* from shell scripts
    regexs["shebang"] = re.compile(r"^(#!.*\n)\n*", re.MULTILINE)
    return regexs



def main():
    regexs = get_regexs()
    refs = get_refs()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…