Skip to content
Snippets Groups Projects
Commit c5f35bc7 authored by Pavel Kácha's avatar Pavel Kácha
Browse files

Removed string check to be able to take ipranges types themselves

parent 0db81f9c
No related branches found
No related tags found
No related merge requests found
...@@ -243,8 +243,6 @@ IP4Util.net = IP4Net ...@@ -243,8 +243,6 @@ IP4Util.net = IP4Net
IP6Util.net = IP6Net IP6Util.net = IP6Net
def from_str(s): def from_str(s):
if not isinstance(s, basestring):
raise ValueError("IP string expected, got: %s" % s)
for t in IP4Net, IP4Range, IP4, IP6Net, IP6Range, IP6: for t in IP4Net, IP4Range, IP4, IP6Net, IP6Range, IP6:
try: try:
return t(s) return t(s)
...@@ -253,8 +251,6 @@ def from_str(s): ...@@ -253,8 +251,6 @@ def from_str(s):
raise ValueError("%s does not appear as IP address, network or range string" % s) raise ValueError("%s does not appear as IP address, network or range string" % s)
def from_str_v4(s): def from_str_v4(s):
if not isinstance(s, basestring):
raise ValueError("IPv4 string expected, got: %s" % s)
for t in IP4Net, IP4Range, IP4: for t in IP4Net, IP4Range, IP4:
try: try:
return t(s) return t(s)
...@@ -263,8 +259,6 @@ def from_str_v4(s): ...@@ -263,8 +259,6 @@ def from_str_v4(s):
raise ValueError("%s does not appear as IPv4 address, network or range string" % s) raise ValueError("%s does not appear as IPv4 address, network or range string" % s)
def from_str_v6(s): def from_str_v6(s):
if not isinstance(s, basestring):
raise ValueError("IPv6 string expected, got: %s" % s)
for t in IP6Net, IP6Range, IP6: for t in IP6Net, IP6Range, IP6:
try: try:
return t(s) return t(s)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment