URI implementation with additional functionality useful for service scope matching
| 4 | |
| 5 | |
| 6 | class URI: |
| 7 | "URI implementation with additional functionality useful for service scope matching" |
| 8 | |
| 9 | def __init__(self, uri): |
| 10 | uri = unquote(uri) |
| 11 | i1 = uri.find(":") |
| 12 | i2 = uri.find("@") |
| 13 | self._scheme = uri[:i1] |
| 14 | if i2 != -1: |
| 15 | self._authority = uri[i1 + 1: i2] |
| 16 | self._path = uri[i2 + 1:] |
| 17 | else: |
| 18 | self._authority = "" |
| 19 | self._path = uri[i1 + 1:] |
| 20 | |
| 21 | def getScheme(self): |
| 22 | return self._scheme |
| 23 | |
| 24 | def getAuthority(self): |
| 25 | return self._authority |
| 26 | |
| 27 | def getPath(self): |
| 28 | return self._path |
| 29 | |
| 30 | def getPathExQueryFragment(self): |
| 31 | i = self._path.find("?") |
| 32 | path = self.getPath() |
| 33 | if i != -1: |
| 34 | return path[:self._path.find("?")] |
| 35 | else: |
| 36 | return path |
| 37 |
no outgoing calls
no test coverage detected