File tree Expand file tree Collapse file tree 1 file changed +13
-16
lines changed
Expand file tree Collapse file tree 1 file changed +13
-16
lines changed Original file line number Diff line number Diff line change 2323import collections
2424import re
2525
26+ Parsed = collections .namedtuple ('Parsed' , [
27+ 'pathname' ,
28+ 'protocols' ,
29+ 'protocol' ,
30+ 'href' ,
31+ 'resource' ,
32+ 'user' ,
33+ 'port' ,
34+ 'name' ,
35+ 'owner' ,
36+ ])
37+
2638
2739class ParserError (Exception ):
2840 """ Error raised when a URL can't be parsed. """
@@ -37,19 +49,6 @@ class Parser(object):
3749 def __init__ (self , url ):
3850 self ._url = url
3951
40- def get_parsed (self ):
41- return collections .namedtuple ('Parsed' , [
42- 'pathname' ,
43- 'protocols' ,
44- 'protocol' ,
45- 'href' ,
46- 'resource' ,
47- 'user' ,
48- 'port' ,
49- 'name' ,
50- 'owner' ,
51- ])
52-
5352 def parse (self ):
5453 """
5554 Parses a GIT URL and returns an object. Raises an exception on invalid
@@ -102,9 +101,7 @@ def parse(self):
102101 msg = "Invalid URL '{}'" .format (self ._url )
103102 raise ParserError (msg )
104103
105- p = self .get_parsed ()
106-
107- return p (** d )
104+ return Parsed (** d )
108105
109106 def _get_protocols (self ):
110107 try :
You can’t perform that action at this time.
0 commit comments