splitport('host:port') --> 'host', 'port'.
(host)
| 1133 | # splittag('/path#tag') --> '/path', 'tag' |
| 1134 | _portprog = None |
| 1135 | def _splitport(host): |
| 1136 | """splitport('host:port') --> 'host', 'port'.""" |
| 1137 | global _portprog |
| 1138 | if _portprog is None: |
| 1139 | _portprog = re.compile('(.*):([0-9]*)', re.DOTALL) |
| 1140 | |
| 1141 | match = _portprog.fullmatch(host) |
| 1142 | if match: |
| 1143 | host, port = match.groups() |
| 1144 | if port: |
| 1145 | return host, port |
| 1146 | return host, None |
| 1147 | |
| 1148 | |
| 1149 | def splitnport(host, defport=-1): |
no test coverage detected