splitport('host:port') --> 'host', 'port'.
(host)
| 1313 | # splittag('/path#tag') --> '/path', 'tag' |
| 1314 | _portprog = None |
| 1315 | def _splitport(host): |
| 1316 | """splitport('host:port') --> 'host', 'port'.""" |
| 1317 | global _portprog |
| 1318 | if _portprog is None: |
| 1319 | _portprog = re.compile('(.*):([0-9]*)', re.DOTALL) |
| 1320 | |
| 1321 | match = _portprog.fullmatch(host) |
| 1322 | if match: |
| 1323 | host, port = match.groups() |
| 1324 | if port: |
| 1325 | return host, port |
| 1326 | return host, None |
| 1327 | |
| 1328 | |
| 1329 | def splitnport(host, defport=-1): |
no test coverage detected
searching dependent graphs…