def __init__(self, source=None): PEP8Compatibility.__init__(self) self.validationMode = RFC2234Parser.kStopOnFatalErrors if source is None: self.ResetParser("") else: self.ResetParser(source)
def __init__(self, source): PEP8Compatibility.__init__(self) self.raw = type(source) is not types.UnicodeType """Indicates if source is being parsed raw (as OCTETS or plain ASCII characters, or as Unicode characters. This may affect the interpretation of some productions.""" self.src = source #: the string being parsed self.pos = -1 #: the position of the current character self.the_char = None """The current character or None if the parser is positioned outside the src string.""" self.next_char()
def __init__(self, octets): PEP8Compatibility.__init__(self) uri_len = parse_uric(octets) #: The octet string representing this URI self.octets = octets[0:uri_len] #: The fragment string that was appended to the URI or None if #: no fragment was given. self.fragment = None if uri_len < len(octets): if ord(octets[uri_len]) == 0x23: self.fragment = octets[uri_len + 1:] else: raise URIException( "URI incompletely parsed from octets: %s" % octets) #: The URI scheme, if present self.scheme = parse_scheme(self.octets) #: The scheme specific part of the URI self.scheme_specific_part = None #: None if the URI is hierarchical, otherwise the same as #: scheme_specific_part self.opaque_part = None #: The authority (e.g., host name) of a hierarchical URI self.authority = None #: The absolute path of a hierarchical URI (None if the path is #: relative) self.abs_path = None #: The relative path of a hierarchical URI (None if the path is #: absolute) self.rel_path = None #: The optional query associated with a hierarchical URI self.query = None if self.scheme is not None: self.scheme_specific_part = self.octets[len(self.scheme) + 1:] if self.is_absolute(): self.rel_path = None self.parse_scheme_specific_part() else: self.opaque_part = None self.parse_relative_uri()
def __init__(self, octets): PEP8Compatibility.__init__(self) uri_len = parse_uric(octets) #: The octet string representing this URI self.octets = octets[0:uri_len] #: The fragment string that was appended to the URI or None if #: no fragment was given. self.fragment = None if uri_len < len(octets): if ord(octets[uri_len]) == 0x23: self.fragment = octets[uri_len + 1:] else: raise URIException("URI incompletely parsed from octets: %s" % octets) #: The URI scheme, if present self.scheme = parse_scheme(self.octets) #: The scheme specific part of the URI self.scheme_specific_part = None #: None if the URI is hierarchical, otherwise the same as #: scheme_specific_part self.opaque_part = None #: The authority (e.g., host name) of a hierarchical URI self.authority = None #: The absolute path of a hierarchical URI (None if the path is #: relative) self.abs_path = None #: The relative path of a hierarchical URI (None if the path is #: absolute) self.rel_path = None #: The optional query associated with a hierarchical URI self.query = None if self.scheme is not None: self.scheme_specific_part = self.octets[len(self.scheme) + 1:] if self.is_absolute(): self.rel_path = None self.parse_scheme_specific_part() else: self.opaque_part = None self.parse_relative_uri()
def __init__(self): PEP8Compatibility.__init__(self) self.urlClass = {}