db36f20b88709421b9a59c31d2092385e565fb2e,rasa/nlu/utils/__init__.py,,is_url,#Any#,49

Before Change



    Returns: `True` if valid, otherwise `False`.
    
    URL_REGEX = re.compile(
        r"^(?:http|ftp|file)s?://"  // http:// or https:// or file://
        r"(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)|"  // domain
        r"localhost|"  // localhost
        r"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})"  // or ip
        r"(?::\d+)?"  // optional port
        r"(?:/?|[/?]\S+)$",
        re.IGNORECASE,
    )
    return URL_REGEX.match(resource_name) is not None


def remove_model(model_dir: Text) -> bool:

After Change


    
    from urllib.parse import urlparse

    try:
        result = urlparse(resource_name)
    except Exception:
        return False

    if result.scheme == "file":
        return bool(result.path)

    return bool(result.scheme in ["http", "https", "ftp", "ftps"] and result.netloc)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: RasaHQ/rasa
Commit Name: db36f20b88709421b9a59c31d2092385e565fb2e
Time: 2020-11-19
Author: federicotedin@gmail.com
File Name: rasa/nlu/utils/__init__.py
Class Name:
Method Name: is_url


Project Name: biotite-dev/biotite
Commit Name: 27d331c946cd8dc45d63b37be2dfe0e5cf342f50
Time: 2020-02-20
Author: patrick.kunzm@gmail.com
File Name: src/biotite/sequence/graphics/plasmid.py
Class Name:
Method Name:


Project Name: pyinstaller/pyinstaller
Commit Name: 839c10190d44e912c632db0ef4549af855216fb0
Time: 2019-11-08
Author: lkollar@users.noreply.github.com
File Name: PyInstaller/depend/utils.py
Class Name:
Method Name: load_ldconfig_cache