Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3 `Â_Œã @s‚ddlmZddlmZddlmZmZddl m Z ddddd œZ d d d d ddddddddœ Z Gdd„deƒZ Gdd„deƒZdS)é)Úinch)ÚBarcode)ÚdigitsÚ whitespace)ÚasNativez || | ||z | || || |z || | | ||z ||| | |||)ÚAÚBÚCÚDz...||z..|.|z..||.z.|..|z.|.|.z.||..z|...|z|..|.z|.|..z||...ú|) Ú1Ú2Ú3Ú4Ú5Ú6Ú7Ú8Ú9Ú0ÚSc@sneZdZdZedZedZedZedZedZ d Z dd d „Z d d„Z dd„Z dd„Zdd„Zdd„ZdS)ÚFIMa‘ FIM (Facing ID Marks) encode only one letter. There are currently four defined: A Courtesy reply mail with pre-printed POSTNET B Business reply mail without pre-printed POSTNET C Business reply mail with pre-printed POSTNET D OCR Readable mail without pre-printed POSTNET Options that may be passed to constructor: value (single character string from the set A - D. required.): The value to encode. quiet (bool, default 0): Whether to include quiet zones in the symbol. The following may also be passed, but doing so will generate nonstandard symbols which should not be used. This is mainly documented here to show the defaults: barHeight (float, default 5/8 inch): Height of the code. This might legitimately be overriden to make a taller symbol that will 'bleed' off the edge of the paper, leaving 5/8 inch remaining. lquiet (float, default 1/4 inch): Quiet zone size to left of code, if quiet is true. Default is the greater of .25 inch, or .15 times the symbol's length. rquiet (float, default 15/32 inch): Quiet zone size to right left of code, if quiet is true. Sources of information on FIM: USPS Publication 25, A Guide to Business Mail Preparation http://new.usps.com/cpim/ftp/pubs/pub25.pdf gð?g@@g0@g@g @gÐ?g.@rÚcKsLt|tƒrt|ƒnt|ƒ}x |jƒD]\}}t|||ƒq$Wtj||ƒdS)N)Ú isinstanceÚintÚstrrÚitemsÚsetattrrÚ__init__)ÚselfÚvalueÚargsÚkÚv©r$ú@/tmp/tmp4i9tl1d3/lib64/python/reportlab/graphics/barcode/usps.pyrdsz FIM.__init__cCsdd|_d|_x:|jD]0}|tkr$qq|dkr>|j|jƒ|_qd|_qWt|jƒdkr^tdƒ‚|jS)NérZabcdABCDrz#Input must be exactly one character)ÚvalidÚ validatedr Ústring_whitespaceÚupperÚlenÚ ValueError)rÚcr$r$r%Úvalidateks  z FIM.validatecCs,d|_x|jD]}|jt||_qW|jS)Nr)Ú decomposedÚencodedÚ _fim_patterns)rr-r$r$r%Ú decompose{s z FIM.decomposecCsDt|jƒd|j|j|_|jr8|j|j|j7_|j|_ dS)Nr&) r+r/Ú spaceWidthÚbarWidthÚ_widthÚquietÚlquietÚrquietÚ barHeightÚ_height)rr$r$r%Ú computeSize‚szFIM.computeSizecCsZ|jƒ|jr|jpd}x4|jD]*}|dkr@|j|d|j|jƒ||j7}q W|jƒdS)Nrr g) Ú _calculater6r7r/Úrectr4r9r3ÚdrawHumanReadable)rÚleftr-r$r$r%Údrawˆs zFIM.drawcCs|jS)N)r )rr$r$r%Ú _humanText‘szFIM._humanTextNg ?g°?gä?gÞ?)r)Ú__name__Ú __module__Ú __qualname__Ú__doc__rr4r3r9r8r7r6rr.r2r;r@rAr$r$r$r%r6s'  rc@sneZdZdZdZedZedZedZedZ ddd „Z d d „Z d d „Z dd„Z dd„Zdd„Zdd„ZdS)ÚPOSTNETa‰ POSTNET is used in the US to encode "zip codes" (postal codes) on mail. It can encode 5, 9, or 11 digit codes. I've read that it's pointless to do 5 digits, since USPS will just have to re-print them with 9 or 11 digits. Sources of information on POSTNET: USPS Publication 25, A Guide to Business Mail Preparation http://new.usps.com/cpim/ftp/pubs/pub25.pdf rgš™™™™™©?gÀ?g;ßO�—n’?g)\�Âõ(œ?rcKsLt|tƒrt|ƒnt|ƒ}x |jƒD]\}}t|||ƒq$Wtj||ƒdS)N)rrrrrrrr)rr r!r"r#r$r$r%r¥szPOSTNET.__init__cCs€d|_d|_d}xT|jD]J}|tdkr*q|tkr\|d}|dkrN|jd|_|j||_qd|_qWt|jƒd krzd|_|jS) Nrr&rú-ééé é )rIrJrK)r(r'r r)Ú string_digitsr+)rÚcountr-r$r$r%r.¬s    zPOSTNET.validatecCstd|_d}xB|jD]8}|tkr8|j||_|t|ƒ}q|dkrBqtdƒ‚qWd|d}|jt|ƒd|_|jS)NrrrGzInvalid character in inputrJ)r0r(rLrr,Úrepr)rÚcheckr-r$r$r%ÚencodeÀs    zPOSTNET.encodecCs,d|_x|jD]}|jt||_qW|jS)Nr)r/r0Ú_postnet_patterns)rr-r$r$r%r2Ïs zPOSTNET.decomposecCs2t|jƒ|jt|jƒd|j|_|j|_dS)Nr&)r+r/r4r3r5r9r:)rr$r$r%r;Õs&zPOSTNET.computeSizecCsl|jƒ|j|j}d}xF|jD]<}|dkr4|j}n|j}|j|d|j|ƒ||j|j}q W|jƒdS)NrÚ.g)r<r9Ú shortHeightr/r=r4r3r>)rZsdownr?r-Úhr$r$r%r@Ùs  z POSTNET.drawcCs|jdd…S)Nr&éÿÿÿÿ)r0)rr$r$r%rAçszPOSTNET._humanTextN)r)rBrCrDrEr6rrSr9r4r3rr.rPr2r;r@rAr$r$r$r%rF”s  rFN)Zreportlab.lib.unitsrZ!reportlab.graphics.barcode.commonrÚstringrrLrr)Zreportlab.lib.utilsrr1rQrrFr$r$r$r%Ú!s    ^