tasks/agent.py
def check_supports_python_version(_, filename, python):
    """
    Check if a setup.py file states support for a given major Python version.
    """
    if python not in ['2', '3']:
        raise Exit("invalid Python version", code=2)

    with open(filename, 'r') as f:
        tree = ast.parse(f.read(), filename=filename)

    prefix = f'Programming Language :: Python :: {python}'
    for node in ast.walk(tree):
        if isinstance(node, ast.keyword) and node.arg == "classifiers":
            classifiers = ast.literal_eval(node.value)
            print(any(cls.startswith(prefix) for cls in classifiers), end="")
            return

    Check if a setup.py file states support for a given major Python version.
    
Check if a setup.py file states support for a given major Python version.
Check if a setup . py file states support for a given major Python version .
def check_supports_python_version(_, filename, python):
    if python not in ['2', '3']:
        raise Exit("invalid Python version", code=2)
    with open(filename, 'r') as f:
        tree = ast.parse(f.read(), filename=filename)
    prefix = f'Programming Language :: Python :: {python}'
    for node in ast.walk(tree):
        if isinstance(node, ast.keyword) and node.arg == "classifiers":
            classifiers = ast.literal_eval(node.value)
            print(any(cls.startswith(prefix) for cls in classifiers), end="")
            return
def check_supports_python_version ( _ , filename , python ) : if python not in [ '2' , '3' ] : raise Exit ( "invalid Python version" , code = 2 ) with open ( filename , 'r' ) as f : tree = ast . parse ( f . read ( ) , filename = filename ) prefix = f'Programming Language :: Python :: {python}' for node in ast . walk ( tree ) : if isinstance ( node , ast . keyword ) and node . arg == "classifiers" : classifiers = ast . literal_eval ( node . value ) print ( any ( cls . startswith ( prefix ) for cls in classifiers ) , end = "" ) return
Check if a setup.py file states support for a given major Python version.
Check if a setup . py file states support for a given major Python version .
"""
    Check if a setup.py file states support for a given major Python version.
    """
_
filename
python