Trim all (ASCII) whitespace characters
This commit is contained in:
parent
593f9b688c
commit
150dd0c4cd
@ -28,6 +28,7 @@ Use ``load()`` to obtain an instance of ``Configuration`` for use with
|
|||||||
import contextlib
|
import contextlib
|
||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
|
import string
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from configparser import RawConfigParser
|
from configparser import RawConfigParser
|
||||||
|
|
||||||
@ -75,7 +76,7 @@ def list_of_ip_address(value):
|
|||||||
def ip_address(value):
|
def ip_address(value):
|
||||||
try:
|
try:
|
||||||
address, port = value.rsplit(":", 1)
|
address, port = value.rsplit(":", 1)
|
||||||
return address.strip("[] "), int(port)
|
return address.strip(string.whitespace + "[]"), int(port)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise ValueError("malformed IP address: %r" % value)
|
raise ValueError("malformed IP address: %r" % value)
|
||||||
return [ip_address(s) for s in value.split(",")]
|
return [ip_address(s) for s in value.split(",")]
|
||||||
|
Loading…
Reference in New Issue
Block a user