@@ -41,31 +41,3 @@ def __add__(self, other):
4141
4242 def __repr__ (self ):
4343 return "<LiveServer listening at %s>" % self .url
44-
45-
46- def parse_addr (specified_address ):
47- """Parse the --liveserver argument into a host/IP address and port range"""
48- # This code is based on
49- # django.test.testcases.LiveServerTestCase.setUpClass
50-
51- # The specified ports may be of the form '8000-8010,8080,9200-9300'
52- # i.e. a comma-separated list of ports or ranges of ports, so we break
53- # it down into a detailed list of all possible ports.
54- possible_ports = []
55- try :
56- host , port_ranges = specified_address .split (":" )
57- for port_range in port_ranges .split ("," ):
58- # A port range can be of either form: '8000' or '8000-8010'.
59- extremes = list (map (int , port_range .split ("-" )))
60- assert len (extremes ) in (1 , 2 )
61- if len (extremes ) == 1 :
62- # Port range of the form '8000'
63- possible_ports .append (extremes [0 ])
64- else :
65- # Port range of the form '8000-8010'
66- for port in range (extremes [0 ], extremes [1 ] + 1 ):
67- possible_ports .append (port )
68- except Exception :
69- raise Exception ('Invalid address ("%s") for live server.' % specified_address )
70-
71- return host , possible_ports
0 commit comments