Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
idna / lib / python2.7 / site-packages / eventlet / support / dns / tokenizer.pyc
Size: Mime:
ó
 ‹EYc@sdZddlmZddlZddlZddlZddlZddlm	Z	m
Z
mZied6ed6ed6ed	6ed
6ed6ed6Z
ied6Zd
ZdZdZdZdZdZdZdejjfd„ƒYZdefd„ƒYZdefd„ƒYZdS(sTokenize DNS master file formatiÿÿÿÿ(tStringIONi(tlongt	text_typetbinary_typet s	s
t;t(t)t"iiiiiitUngetBufferFullcBseZdZRS(sDAn attempt was made to unget a token when the unget buffer was full.(t__name__t
__module__t__doc__(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pyR	.stTokencBs¤eZdZded„Zd„Zd„Zd„Zd„Zd„Z	d„Z
d	„Zd
„Zd„Z
d„Zd
„Zd„Zd„Zd„Zd„ZRS(sêA DNS master file format token.

    @ivar ttype: The token type
    @type ttype: int
    @ivar value: The token value
    @type value: string
    @ivar has_escape: Does the token value contain escapes?
    @type has_escape: bool
    tcCs||_||_||_dS(sInitialize a token instance.

        @param ttype: The token type
        @type ttype: int
        @param value: The token value
        @type value: string
        @param has_escape: Does the token value contain escapes?
        @type has_escape: bool
        N(tttypetvaluet
has_escape(tselfRRR((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pyt__init__?s
		cCs
|jtkS(N(RtEOF(R((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pytis_eofMscCs
|jtkS(N(RtEOL(R((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pytis_eolPscCs
|jtkS(N(Rt
WHITESPACE(R((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pyt
is_whitespaceSscCs
|jtkS(N(Rt
IDENTIFIER(R((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pyt
is_identifierVscCs
|jtkS(N(Rt
QUOTED_STRING(R((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pytis_quoted_stringYscCs
|jtkS(N(RtCOMMENT(R((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pyt
is_comment\scCs
|jtkS(N(Rt	DELIMITER(R((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pytis_delimiter_scCs|jtkp|jtkS(N(RRR(R((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pyt
is_eol_or_eofbscCs5t|tƒstS|j|jko4|j|jkS(N(t
isinstanceR
tFalseRR(Rtother((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pyt__eq__escCs5t|tƒstS|j|jkp4|j|jkS(N(R#R
tTrueRR(RR%((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pyt__ne__kscCsd|j|jfS(Ns%d "%s"(RR(R((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pyt__str__qscCsu|js
|Sd}t|jƒ}d}x:||krd|j|}|d7}|dkrW||krutjj‚n|j|}|d7}|jƒrW||kr³tjj‚n|j|}|d7}||kråtjj‚n|j|}|d7}|jƒo|jƒs#tjj‚ntt	|ƒdt	|ƒdt	|ƒƒ}qWn||7}q+Wt
|j|ƒS(NRiis\idi
(RtlenRtdnst	exceptiont
UnexpectedEndtisdigittSyntaxErrortchrtintR
R(Rt	unescapedtltitctc2tc3((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pytunescapets6	







4cCsdS(Ni((R((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pyt__len__“scCst|j|jfƒS(N(titerRR(R((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pyt__iter__–scCs0|dkr|jS|dkr&|jSt‚dS(Nii(RRt
IndexError(RR4((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pyt__getitem__™s
(R
RRR$RRRRRRRR!R"R&R(R)R8R9R;R=(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pyR
3s"
														t	TokenizercBsÎeZdZejdd„Zd„Zd„Zd„Z	d„Z
eed„Zd„Z
d„ZeZd	„Zd
„Zd„Zd„Zd
„Zdd„Zdd„Zdd„Zd„Zd„ZRS(s´A DNS master file format tokenizer.

    A token is a (type, value) tuple, where I{type} is an int, and
    I{value} is a string.  The valid types are EOF, EOL, WHITESPACE,
    IDENTIFIER, QUOTED_STRING, COMMENT, and DELIMITER.

    @ivar file: The file to tokenize
    @type file: file
    @ivar ungotten_char: The most recently ungotten character, or None.
    @type ungotten_char: string
    @ivar ungotten_token: The most recently ungotten token, or None.
    @type ungotten_token: (int, string) token tuple
    @ivar multiline: The current multiline level.  This value is increased
    by one every time a '(' delimiter is read, and decreased by one every time
    a ')' delimiter is read.
    @type multiline: int
    @ivar quoting: This variable is true if the tokenizer is currently
    reading a quoted string.
    @type quoting: bool
    @ivar eof: This variable is true if the tokenizer has encountered EOF.
    @type eof: bool
    @ivar delimiters: The current delimiter dictionary.
    @type delimiters: dict
    @ivar line_number: The current line number
    @type line_number: int
    @ivar filename: A filename that will be returned by the L{where} method.
    @type filename: string
    cCsît|tƒr3t|ƒ}|dkr™d}q™nft|tƒrlt|jƒƒ}|dkr™d}q™n-|dkr™|tjkrd}q™d}n||_d|_	d|_
d|_t|_
t|_t|_d|_||_dS(s’Initialize a tokenizer instance.

        @param f: The file to tokenize.  The default is sys.stdin.
        This parameter may also be a string, in which case the tokenizer
        will take its input from the contents of the string.
        @type f: file or string
        @param filename: the name of the filename that the L{where} method
        will return.
        @type filename: string
        s<string>s<stdin>s<file>iiN(R#RRtNoneRtdecodetsyststdintfilet
ungotten_chartungotten_tokent	multilineR$tquotingteoft_DELIMITERSt
delimiterstline_numbertfilename(RtfRL((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pyRÁs*										cCs‚|jdkrl|jr!d}q~|jjdƒ}|dkrKt|_q~|dkr~|jd7_q~n|j}d|_|S(s<Read a character from input.
        @rtype: string
        Ris
N(RDR?RHRCtreadR'RK(RR5((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pyt	_get_charås				cCs|j|jfS(sµReturn the current location in the input.

        @rtype: (string, int) tuple.  The first item is the filename of
        the input, the second is the current line number.
        (RLRK(R((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pytwhereøscCs%|jdk	rt‚n||_dS(sEUnget a character.

        The unget buffer for characters is only one character large; it is
        an error to try to unget a character when the unget buffer is not
        empty.

        @param c: the character to unget
        @type c: string
        @raises UngetBufferFull: there is already an ungotten char
        N(RDR?R	(RR5((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pyt_unget_chars	cCsod}xbtrj|jƒ}|dkr]|dkr]|dksI|jr]|j|ƒ|Sn|d7}q	WdS(s(Consume input until a non-whitespace character is encountered.

        The non-whitespace character is then ungotten, and the number of
        whitespace characters consumed is returned.

        If the tokenizer is in multiline mode, then newlines are whitespace.

        @rtype: int
        iRs	s
iN(R'RORFRQ(RtskippedR5((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pytskip_whitespaces	
c
Cs‘|jdk	rZ|j}d|_|jƒr:|rW|SqZ|jƒrS|rW|SqZ|Sn|jƒ}|r…|dkr…ttdƒSd}t}t}x¨t	rA|j
ƒ}|dksÇ||jkrÍ|dkrë|jrët
jj‚n|dkr¼|tkr¼|dkr.|jd7_|jƒqšqÉ|dkrw|jdkrXt
jj‚n|jd8_|jƒqšqÉ|dkrÌ|jsªt	|_t|_t}qšq¹t|_t|_|jƒqšqÉ|dkråttdƒS|d	kr­x6|j
ƒ}|dks|dkrPn||7}qôW|rJ|j|ƒtt|ƒS|dkr~|jrtt
jjd
ƒ‚nttƒS|jr|jƒd}qšq¹ttdƒSqÉ|}t}n
|j|ƒPng|jrâ|dkr¾|j
ƒ}|dkr	t
jj‚n|jƒrß|j
ƒ}|dkr<t
jj‚n|j
ƒ}	|dkrct
jj‚n|jƒox|	jƒsŠt
jj‚ntt|ƒdt|ƒd
t|	ƒƒ}qßq4|dkr4t
jjdƒ‚q4nR|dkr4||7}t	}|j
ƒ}|dks"|dkr4t
jj‚q4n||7}qšW|dkr|tkr|jrxt
jjd
ƒ‚nt}nt|||ƒS(sGet the next token.

        @param want_leading: If True, return a WHITESPACE token if the
        first character read is whitespace.  The default is False.
        @type want_leading: bool
        @param want_comment: If True, return a COMMENT token if the
        first token read is a comment.  The default is False.
        @type want_comment: bool
        @rtype: Token object
        @raises dns.exception.UnexpectedEnd: input ended prematurely
        @raises dns.exception.SyntaxError: input was badly formed
        iRRRiRRs
Rsunbalanced parenthesess\idi
snewline in quoted stringN(RER?RRRSR
RRR$R'RORJRGR+R,R-RRFR/t_QUOTING_DELIMITERSRIRRQRRR R.R0R1(
Rtwant_leadingtwant_commentttokenRRRRR5R6R7((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pytget%sÀ		
	

					



		
	
	
	4
		cCs%|jdk	rt‚n||_dS(s@Unget a token.

        The unget buffer for tokens is only one token large; it is
        an error to try to unget a token when the unget buffer is not
        empty.

        @param token: the token to unget
        @type token: Token object
        @raises UngetBufferFull: there is already an ungotten token
        N(RER?R	(RRW((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pytunget s	cCs%|jƒ}|jƒr!t‚n|S(sLReturn the next item in an iteration.
        @rtype: (int, string)
        (RXRt
StopIteration(RRW((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pytnext°s	cCs|S(N((R((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pyR;¼scCsd|jƒjƒ}|jƒs3tjjdƒ‚n|jjƒsWtjjdƒ‚nt|jƒS(s|Read the next token and interpret it as an integer.

        @raises dns.exception.SyntaxError:
        @rtype: int
        sexpecting an identifiersexpecting an integer(	RXR8RR+R,R/RR.R1(RRW((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pytget_intÁscCsA|jƒ}|dks$|dkr=tjjd|ƒ‚n|S(s“Read the next token and interpret it as an 8-bit unsigned
        integer.

        @raises dns.exception.SyntaxError:
        @rtype: int
        iiÿs#%d is not an unsigned 8-bit integer(R\R+R,R/(RR((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pyt	get_uint8Ïs
	cCsA|jƒ}|dks$|dkr=tjjd|ƒ‚n|S(s“Read the next token and interpret it as a 16-bit unsigned
        integer.

        @raises dns.exception.SyntaxError:
        @rtype: int
        iiÿÿs$%d is not an unsigned 16-bit integer(R\R+R,R/(RR((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pyt
get_uint16Ýs
	cCs¡|jƒjƒ}|jƒs3tjjdƒ‚n|jjƒsWtjjdƒ‚nt|jƒ}|dks„|tdƒkrtjjd|ƒ‚n|S(s“Read the next token and interpret it as a 32-bit unsigned
        integer.

        @raises dns.exception.SyntaxError:
        @rtype: int
        sexpecting an identifiersexpecting an integeriIs$%d is not an unsigned 32-bit integer(	RXR8RR+R,R/RR.R(RRWR((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pyt
get_uint32ës	cCsF|jƒjƒ}|jƒp'|jƒs?tjjdƒ‚n|jS(s}Read the next token and interpret it as a string.

        @raises dns.exception.SyntaxError:
        @rtype: string
        sexpecting a string(RXR8RRR+R,R/R(RtoriginRW((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pyt
get_stringþscCs:|jƒjƒ}|jƒs3tjjdƒ‚n|jS(s’Read the next token and raise an exception if it is not an identifier.

        @raises dns.exception.SyntaxError:
        @rtype: string
        sexpecting an identifier(RXR8RR+R,R/R(RR`RW((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pytget_identifier
scCsC|jƒ}|jƒs-tjjdƒ‚ntjj|j|ƒS(s„Read the next token and interpret it as a DNS name.

        @raises dns.exception.SyntaxError:
        @rtype: dns.name.Name objectsexpecting an identifier(RXRR+R,R/tnamet	from_textR(RR`RW((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pytget_namescCsD|jƒ}|jƒs=tjjd|j|jfƒ‚n|jS(s–Read the next token and raise an exception if it isn't EOL or
        EOF.

        @raises dns.exception.SyntaxError:
        @rtype: string
        s expected EOL or EOF, got %d "%s"(RXR"R+R,R/RR(RRW((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pytget_eol!s		cCsF|jƒjƒ}|jƒs3tjjdƒ‚ntjj|jƒS(Nsexpecting an identifier(	RXR8RR+R,R/tttlRdR(RRW((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pytget_ttl0sN(R
RRRARBR?RRORPRQRSR$RXRYR[t__next__R;R\R]R^R_RaRbReRfRh(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pyR>¢s($					{		
						(RtioRRAt
dns.exceptionR+tdns.nametdns.ttlt_compatRRRR'RIRTRRRRRRR R,tDNSExceptionR	tobjectR
R>(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/tokenizer.pyt<module>s2

o