
import os
import click
from urllib.parse import urlparse
import json
import urllib.request
import configparser
import subprocess
from butterknife.pool import LocalPool
from butterknife.subvol import Subvol

def pool_factory(url):
    o = urlparse(url)
    if o.scheme == "file":
        from butterknife.pool import LocalPool
        assert not o.netloc, "Username, hostname or port not supported for file:// transport"
        assert not o.password
        assert not o.fragment
        assert not o.query
        return LocalPool(o.path)
    if o.scheme in ("http", "https"):
        from butterknife.transport.http import WebPool
        return WebPool(o.hostname, o.port, o.path, secure=o.scheme=="https")
    if o.scheme == "ssh":