splitport('host:port') --> 'host', 'port'.
(host)
| 1193 | # splittag('/path#tag') --> '/path', 'tag' |
| 1194 | _portprog = None |
| 1195 | def _splitport(host): |
| 1196 | """splitport('host:port') --> 'host', 'port'.""" |
| 1197 | global _portprog |
| 1198 | if _portprog is None: |
| 1199 | _portprog = re.compile('(.*):([0-9]*)', re.DOTALL) |
| 1200 | |
| 1201 | match = _portprog.fullmatch(host) |
| 1202 | if match: |
| 1203 | host, port = match.groups() |
| 1204 | if port: |
| 1205 | return host, port |
| 1206 | return host, None |
| 1207 | |
| 1208 | |
| 1209 | def splitnport(host, defport=-1): |
no test coverage detected