def build(cls, text): if isinstance(text, TransportLayer): return text elif text is None: return TransportLayer() original_text = text cls._validate_text(text) text = cls._clean_text(text) protocol_cls, text = TransportAddressBuilder._extract_protocol(text) text = cls._normalize(text, original_text) source, destination = text.split() source_group = TransportGroup() source_group.add(protocol_cls.from_string(source)) destination_group = TransportGroup() destination_group.add(protocol_cls.from_string(destination)) return TransportLayer(source=source_group, destination=destination_group)
def address_builder(address): return TransportAddressBuilder.build(address)