How to use the pypandoc.py3compat.url2path function in pypandoc

To help you get started, we’ve selected a few pypandoc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bebraw / pypandoc / pypandoc / __init__.py View on Github external
except UnicodeEncodeError:
        is_path = os.path.exists(source.encode('utf-8'))
    except:  # noqa
        # still false
        pass

    if not is_path:
        # check if it's an URL
        result = urlparse(source)
        if result.scheme in ["http", "https"]:
            is_path = True
        elif result.scheme and result.netloc and result.path:
            # complete uri including one with a network path
            is_path = True
        elif result.scheme == "file" and result.path:
            is_path = os.path.exists(url2path(source))

    return is_path