Source code for visions.types.url

from typing import Any, Sequence

from multimethod import multimethod

from visions.relations import IdentityRelation, InferenceRelation, TypeRelation
from visions.types.object import Object
from visions.types.string import String
from visions.types.type import VisionsBaseType


[docs]class URL(VisionsBaseType): """**Url** implementation of :class:`visions.types.type.VisionsBaseType`. Examples: >>> from urllib.parse import urlparse >>> urls = ['http://www.cwi.nl:80/%7Eguido/Python.html', 'https://github.com/pandas-profiling/pandas-profiling'] >>> x = [urlparse(url) for url in urls] >>> x in visions.URL True """ @classmethod def get_relations(cls) -> Sequence[TypeRelation]: relations = [ IdentityRelation(cls, Object), InferenceRelation(cls, String), ] return relations
[docs] @staticmethod @multimethod def contains_op(item: Any, state: dict) -> bool: pass