def is_file()

in pygenie/jobs/utils.py [0:0]


def is_file(path):
    """Checks if path is to a file."""

    path = convert_to_unicode(path)

    try:
        return path is not None and \
            (os.path.isfile(path) \
            or path.startswith('s3://') \
            or path.startswith('s3n://'))
    except (ValueError, TypeError):
        # Py2 throws TypeError and Py3 ValueError
        # if os.path.isfile encounters invalid path
        # ref https://github.com/python/cpython/pull/7695
        return False