rename MultiAddr

This commit is contained in:
zixuanzh 2018-10-26 00:45:41 +02:00
parent 50bfbae71d
commit 4bae3ad3c1

View File

@ -1,4 +1,4 @@
class Multiaddr: class MultiAddr:
# Validates input string and constructs internal representation. # Validates input string and constructs internal representation.
def __init__(self, addr): def __init__(self, addr):
@ -8,14 +8,14 @@ class Multiaddr:
return return
if not addr[0] == "/": if not addr[0] == "/":
raise MultiaddrValueError("Invalid input multiaddr.") raise MultiAddrValueError("Invalid input multiaddr.")
addr = addr[1:] addr = addr[1:]
protocol_map = dict() protocol_map = dict()
split_addr = addr.split("/") split_addr = addr.split("/")
if not split_addr or len(split_addr) % 2 != 0: if not split_addr or len(split_addr) % 2 != 0:
raise MultiaddrValueError("Invalid input multiaddr.") raise MultiAddrValueError("Invalid input multiaddr.")
is_protocol = True is_protocol = True
curr_protocol = "" curr_protocol = ""
@ -76,6 +76,6 @@ class Multiaddr:
return addr return addr
class MultiaddrValueError(ValueError): class MultiAddrValueError(ValueError):
"""Raised when the input string to the Multiaddr constructor was invalid.""" """Raised when the input string to the MultiAddr constructor was invalid."""
pass pass