Skip to content

Commit

Permalink
Merge pull request #19 from retr0h/correct-flake8
Browse files Browse the repository at this point in the history
Changed regex to raw strings
  • Loading branch information
retr0h authored Oct 25, 2018
2 parents ff5c252 + fda4985 commit d9768f5
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions giturlparse/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,27 +71,27 @@ def parse(self):
}
regexes = [
(r'^(?P<protocol>https?|git|ssh|rsync)\://'
'(?:(?P<user>.+)@)*'
'(?P<resource>[a-z0-9_.-]*)'
'[:/]*'
'(?P<port>[\d]+){0,1}'
'(?P<pathname>\/(?P<owner>.+)/(?P<name>.+).git)'),
r'(?:(?P<user>.+)@)*'
r'(?P<resource>[a-z0-9_.-]*)'
r'[:/]*'
r'(?P<port>[\d]+){0,1}'
r'(?P<pathname>\/(?P<owner>.+)/(?P<name>.+).git)'),
(r'(git\+)?'
'((?P<protocol>\w+)://)'
'((?P<user>\w+)@)?'
'((?P<resource>[\w\.\-]+))'
'(:(?P<port>\d+))?'
'(?P<pathname>(\/(?P<owner>\w+)/)?'
'(\/?(?P<name>[\w\-]+)(\.git)?)?)'),
r'((?P<protocol>\w+)://)'
r'((?P<user>\w+)@)?'
r'((?P<resource>[\w\.\-]+))'
r'(:(?P<port>\d+))?'
r'(?P<pathname>(\/(?P<owner>\w+)/)?'
r'(\/?(?P<name>[\w\-]+)(\.git)?)?)'),
(r'^(?:(?P<user>.+)@)*'
'(?P<resource>[a-z0-9_.-]*)[:/]*'
'(?P<port>[\d]+){0,1}'
'[:](?P<pathname>\/?(?P<owner>.+)/(?P<name>.+).git)'),
r'(?P<resource>[a-z0-9_.-]*)[:/]*'
r'(?P<port>[\d]+){0,1}'
r'[:](?P<pathname>\/?(?P<owner>.+)/(?P<name>.+).git)'),
(r'((?P<user>\w+)@)?'
'((?P<resource>[\w\.\-]+))'
'[\:\/]{1,2}'
'(?P<pathname>((?P<owner>\w+)/)?'
'((?P<name>[\w\-]+)(\.git)?)?)'),
r'((?P<resource>[\w\.\-]+))'
r'[\:\/]{1,2}'
r'(?P<pathname>((?P<owner>\w+)/)?'
r'((?P<name>[\w\-]+)(\.git)?)?)'),
]
for regex in regexes:
if re.search(regex, self._url):
Expand Down

0 comments on commit d9768f5

Please sign in to comment.