# Path: pycc/asttools/parse.py
# def parse(source, filename='<unknown>', mode='exec'):
#     """An ast.parse extension.
# 
#     This function behaves identically to the standard ast.parse except that it
#     adds parent and sibling references to each node.
#     """
#     node = ast.parse(source, filename, mode)
#     references.add_parent_references(node)
#     references.add_sibling_references(node)
# 
#     return node
# 
# Path: pycc/cli/extensions/utils.py
# def iter_extensions():
# def register_extensions(parser):
# def execute(args, node):


import collections
import os
import sys
from ..asttools import parse
from .extensions import utils
                path,
            ),
        ),
    )


def load_dir(path):
    """Get an iterable of PySource from the given directory."""
    for root, subdirs, files in os.walk(abspath(path)):

        files = (abspath(os.path.join(root, fname)) for fname in files)
        files = (fname for fname in files if fname.endswith('.py'))
        for file_name in files:

            with open(file_name, 'r') as file_handle:

                source = file_handle.read()
                yield PySource(parse.parse(source), file_name)


def load_path(path):
    """Get an iterable of PySource from the given path."""
    path = abspath(path)

    if os.path.isdir(path):

        return load_dir(path)

    with open(path, 'r') as file_handle:


# Path: pycc/asttools/parse.py
# def parse(source, filename='<unknown>', mode='exec'):
#     """An ast.parse extension.
# 
#     This function behaves identically to the standard ast.parse except that it
#     adds parent and sibling references to each node.
#     """
#     node = ast.parse(source, filename, mode)
#     references.add_parent_references(node)
#     references.add_sibling_references(node)
# 
#     return node
# 
# Path: pycc/cli/extensions/utils.py
# def iter_extensions():
# def register_extensions(parser):
# def execute(args, node):


# Path: pycc/cli/common.py
import collections
import os
import sys
from ..asttools import parse
from .extensions import utils

                path,
            ),
        ),
    )


def load_dir(path):
    """Get an iterable of PySource from the given directory."""
    for root, subdirs, files in os.walk(abspath(path)):

        files = (abspath(os.path.join(root, fname)) for fname in files)
        files = (fname for fname in files if fname.endswith('.py'))
        for file_name in files:

            with open(file_name, 'r') as file_handle:

                source = file_handle.read()
                yield PySource(parse.parse(source), file_name)


def load_path(path):
    """Get an iterable of PySource from the given path."""
    path = abspath(path)

    if os.path.isdir(path):

        return load_dir(path)

    with open(path, 'r') as file_handle:


        return (PySource(parse.parse(file_handle.read()), path),)