Return a new SheetUrl instance from parsed URL string.

        >>> SheetUrl.from_string('https://docs.google.com/spreadsheets/d/spam')
        <SheetUrl id='spam' gid=0>
480782
def from_string(cls, link):
        
        ma = cls._pattern.search(link)
        if ma is None:
            raise ValueError(link)
        id = ma.group('id')
        return cls(id)
783793
def url(self):
        ''''''
        return URL.from_url(self.request.url, show_host=self.show_host)
764463
def from_string(cls, jss, xml_string):
        
        root = ElementTree.fromstring(xml_string.encode('utf-8'))
        return cls(jss, root)
1069010
def from_request(cls, http_method, http_url, headers=None, parameters=None,
            query_string=None):
        """"""
        if parameters is None:
            parameters = {}
 
        # Headers
        if headers:
            auth_header = None
            for k, v in headers.items():
                if k.lower() == 'authorization' or \
                    k.upper() == 'HTTP_AUTHORIZATION':
                    auth_header = v

            # Check that the authorization header is OAuth.
            if auth_header and auth_header[:6] == 'OAuth ':
                auth_header = auth_header[6:]
                try:
                    # Get the parameters from the header.
                    header_params = cls._split_header(auth_header)
                    parameters.update(header_params)
                except:
                    raise Error('Unable to parse OAuth parameters from '
                        'Authorization header.')
 
        # GET or POST query string.
        if query_string:
            query_params = cls._split_url_string(query_string)

            parameters.update(query_params)
 
        # URL parameters.
        param_str = urlparse(http_url)[4] # query
        url_params = cls._split_url_string(param_str)
        parameters.update(url_params)
 
        if parameters:
            return cls(http_method, http_url, parameters)
 
        return None
369134
function parseURL(url) {
  let urlLike;

  if (typeof URL === 'function') {
    urlLike = new URL(url);
  } else {
    urlLike = document.createElement('a');
    urlLike.setAttribute('href', url);
  }

  const { hostname, pathname, search } = urlLike;

  return { hostname, pathname, search };
}
432414
def new_from_response(cls, response):
        
        return cls(response.url, html=response.text, headers=response.headers)
108365
def fromString(cls, string):
        
        return cls(level=[int(i) for i in string.split("/") if i])
104721
def from_url(cls, url, **kwargs):
        """"""
        url = urllib3.util.parse_url(url)
        if url.host:
            kwargs.setdefault('host', url.host)

        if url.port:
            kwargs.setdefault('port', url.port)

        if url.scheme == 'https':
            kwargs.setdefault('connection_class', urllib3.HTTPSConnectionPool)

        return cls(**kwargs)
968080
def from_string(proto_str):
    '''
    
    '''
    _, proto_file = tempfile.mkstemp(suffix='.proto')

    with open(proto_file, 'w+') as proto_f:
        proto_f.write(proto_str)

    return from_file(proto_file)
1095689
function ( from_value, to_value ) {

        var type;

        if ( from_value instanceof RegExp ) {

            type = 'RegExp';

        } else if ( typeof from_value === 'string' ) {

            type = 'String';

        } else {

            throw { type: 'changeURLContent', message: 'First argument must be RegExp of String' };

        }

        if ( to_value === undefined ) {

            to_value = "";

        } else if( typeof to_value !== 'string' ) {

            throw { type: 'changeURLContent', message: 'Second argument must be String' };

        }

        urls.filter( function ( value ) {

            if ( type === "RegExp" ) {

                return from_value.test( _getURLValue( value ) );

            } else {

                return _getURLValue( value ).indexOf( from_value ) !== -1;

            }

        } ).forEach( function ( value ) {

            var new_value = _getURLValue( value ).replace( from_value, to_value );
            _setURLValue( value, new_value );

        } );

    }
869814
def from_str(string):
        
        match = re.match(r'^READ (\w+) FOR (\d+) \w+S$', string)
        if match:
            return ReadEvent(match.group(1), int(match.group(2)))
        else:
            raise EventParseError
385780
function parseURL(s) {
  var url = null;
  try {
    url = new URL(s);
  } catch (error) {
    console.error(error);
  }
  return url;
}
489188
def from_string(cls, serialized):
        """"""
        warnings.warn(
            "SlashSeparatedCourseKey is deprecated! Please use locator.CourseLocator",
            DeprecationWarning,
            stacklevel=2
        )
        return CourseLocator.from_string(serialized)
96442
def get_page_from_string_or_id(page_string, lang=None):
    """"""
    if type(page_string) == int:
        return Page.objects.get(pk=int(page_string))
    # if we have a string coming from some templates templates
    is_text = isinstance(page_string, SafeText)
    import sys
    PY3 = sys.version > '3'
    if PY3:
        is_string = isinstance(page_string, str)
    else:
        is_string = isinstance(page_string, unicode) or isinstance(page_string, str)
    if is_text or is_string:
        if page_string.isdigit():
            return Page.objects.get(pk=int(page_string))
        return Page.objects.from_path(page_string, lang)
    # in any other case we return the input becasue it's probably
    # a Page object.
    return page_string
986980
def from_str(string):
        
        match = re.match(r'^FINISH READING (\w+)$', string)
        if match:
            return SetFinishedEvent(match.group(1))
        else:
            raise EventParseError
1001930
async def fromURL(
            cls, url, *, credentials=None, insecure=False):
        """"""
        try:
            description = await helpers.fetch_api_description(
                url, insecure=insecure)
        except helpers.RemoteError as error:
            # For now just re-raise as SessionError.
            raise SessionError(str(error))
        else:
            session = cls(description, credentials)
            session.insecure = insecure
            return session
300298
def url_to_string(url):
    
    try:
        page = urllib2.urlopen(url)
    except (urllib2.HTTPError, urllib2.URLError) as err:
        ui.error(c.MESSAGES["url_unreachable"], err)
        sys.exit(1)

    return page