o G_'%@sdZddlmZzddlZ[Wney!ddlmZdZYdSwddlm Z ddl m Z m Z ddlmZmZdd lmZdd lmZmZmZmZmZmZmZmZdd lmZd d lmZm Z ddlm!Z!ddl"m#Z#m$Z$m%Z%m&Z&m'Z'ddl(m)Z)m*Z*m+Z,dZedZ-eede-fge-fZ.ze/Wn e0ye1Z/YnwddZ2da3e#d)ddZ4e#d*ddZ5e#d+ddZ6e#d,dd Z7d!d"Z8da9e#d#d$Z:e#d%d&Z;e#d'd(Z Returns a string containing IDNA characters. zidna-tables-properties.csv.gzcss|]}|dVqdS)utf-8N)decode).0linerr6/usr/lib/python3/dist-packages/hyperlink/hypothesis.py Qz"idna_characters..,) delimiterPVALIDr-rcss|]}t|dVqdS)N)int)r*irrr,r-br.N) _idnaCharactersrr__file__ open_gzip csv_readernextsplitlenappendranger unichr) result dataFileNamedataFilerrowcodesprop descriptionstartEndstartendr5rrr,idna_characters?s8     rKr6cCsjt}|dks J|dur|dksJtt|t|||d}zt|W|Sty4tdY|Sw)a( A strategy which generates IDNA-encodable text. @param min_size: The minimum number of characters in the text. C{None} is treated as C{0}. @param max_size: The maximum number of characters in the text. Use C{None} for an unbounded size. rNmin_sizemax_sizealphabetF)rKrrr idna_encoderr)drawrMrNrOrArrr,r$os    r$FcCs$|rd}nd}tt|t|ddS)z A strategy which generates port numbers. @param allow_zero: Whether to allow port C{0} as a possible value. rri) min_value max_value)rr4r)rQ allow_zerorRrrr,r&sr&Tc Cs|r>tt|tddd}z|dWn;ty=t|ddtdkr;|dd}t|ddtdks(Ynwtt|tddtttd d }zt |W|St yet d Y|Sw) z A strategy which generates host name labels. @param allow_idn: Whether to allow non-ASCII characters as allowed by internationalized domain names (IDNs). r?rMrNasciipunycodezxn--Nr2rLF) rrr$rUnicodeEncodeErrorr=rrr r UnicodeErrorr)rQ allow_idnlabelrrr,r"s6      r"c stt|t|dfddg}|ttt|tt|dddd7}tdd|Dt|dd krM|d d }tdd|Dt|dd ks6d |S) aD A strategy which generates host names. @param allow_leading_digit: Whether to allow a leading digit in host names; they were not allowed prior to RFC 1123. @param allow_idn: Whether to allow non-ASCII characters as allowed by internationalized domain names (IDNs). )r\csrdS|dtvS)NTr)r )lallow_leading_digitrr,szhostnames..rrVcss|]}t|VqdS)N)r=)r*r]rrr,r-szhostnames..NrY.) rrr"filterr rsumr=r)rQr`r\labelsrr_r,r#s.   " " r#cCs tdurdd}d|atS)zH Returns a string containing valid URL path characters. Nc ssNttD]}t|}|dvrqz|dWn ty Yqw|VqdS)Nz#/?r()r?r r@rrZ)r5crrr,charss  zpath_characters..charsr6)_path_charactersr)rirrr,path_characterss rkcCs$ttt|ttdtdddS)Nr)rMrO )rN)rr rrrrkrQrrr,r%s r%cCsfttt|tdd}tt|t}ttt|t}|dkr$d}ttt|t d|||dS)z A strategy which generates L{EncodedURL}s. Call the L{EncodedURL.to_uri} method on each URL to get an HTTP protocol-friendly URI. T)rTrN)httphttps)schemehostportpath) rrr4r&rr#rr%rr)rQrrrqrsrrr,r!#sr!cCst|tS)z A strategy which generates L{DecodedURL}s. Call the L{EncodedURL.to_uri} method on each URL to get an HTTP protocol-friendly URI. )rr!rmrrr,r 9sr )rN)F)T)TT)=__doc__ __future__r hypothesis ImportErrortypingr__all__csvrr:os.pathrrstringrr sysr r r r rrrrrgziprr9r6rrrhypothesis.strategiesrrrrridnarrrrPr' DrawCallabler@ NameErrorchrrKr7r$r&r"r#rkrjr%r!r rrrr,sZ      (    .   - +