def replace(self, scheme=_UNSET, host=_UNSET, path=_UNSET, query=_UNSET,
                fragment=_UNSET, port=_UNSET, rooted=_UNSET, userinfo=_UNSET,
                uses_netloc=_UNSET):
        """While the signature is the same, this `replace()` differs a little
        from URL.replace. For instance, it accepts userinfo as a
        tuple, not as a string, handling the case of having a username
        containing a `:`. As with the rest of the methods on
        DecodedURL, if you pass a reserved character, it will be
        automatically encoded instead of an error being raised.

        """
        if path is not _UNSET:
            path = [_encode_reserved(p) for p in path]
        if query is not _UNSET:
            query = [[_encode_reserved(x)
                      if x is not None else None
                      for x in (k, v)]
                     for k, v in iter_pairs(query)]
        if userinfo is not _UNSET:
            if len(userinfo) > 2:
                raise ValueError('userinfo expected sequence of ["user"] or'
                                 ' ["user", "password"], got %r' % userinfo)
            userinfo = u':'.join([_encode_reserved(p) for p in userinfo])
        new_url = self._url.replace(scheme=scheme,
                                    host=host,
                                    path=path,
                                    query=query,
                                    fragment=fragment,
                                    port=port,
                                    rooted=rooted,
                                    userinfo=userinfo,
                                    uses_netloc=uses_netloc)
        return self.__class__(url=new_url)
While the signature is the same, this `replace()` differs a little
        from URL.replace. For instance, it accepts userinfo as a
        tuple, not as a string, handling the case of having a username
        containing a `:`. As with the rest of the methods on
        DecodedURL, if you pass a reserved character, it will be
        automatically encoded instead of an error being raised.

        
stackoverflow/venv/lib/python3.6/site-packages/hyperlink/_url.py