File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88
99from barcode .base import Barcode
1010from barcode .charsets import upc as _upc
11- from barcode .errors import (
12- IllegalCharacterError ,
13- NumberOfDigitsError ,
14- )
11+ from barcode .errors import IllegalCharacterError , NumberOfDigitsError
1512
1613
1714class UniversalProductCodeA (Barcode ):
1815 """Initializes new UPC-A barcode.
1916
20- :parameters:
21- upc : String
22- The upc number as string.
23- writer : barcode.writer Instance
24- The writer to render the barcode (default: SVGWriter).
25- make_ean: boolean
17+ :param str upc: The upc number as string.
18+ :param writer: barcode.writer instance. The writer to render the barcode
19+ (default: SVGWriter).
20+ :param bool make_ean: Indicates if a leading zero should be added to the
21+ barcode. This converts the UPC into a valid European Article Number (EAN).
2622 """
2723
2824 name = 'UPC-A'
@@ -61,7 +57,7 @@ def calculate_checksum(self):
6157 """Calculates the checksum for UPCA/UPC codes
6258
6359 :return: The checksum for 'self.upc'
64- :rtype: Integer
60+ :rtype: int
6561 """
6662 def sum_ (x , y ):
6763 return int (x ) + int (y )
@@ -79,7 +75,7 @@ def build(self):
7975 """Builds the barcode pattern from 'self.upc'
8076
8177 :return: The pattern as string
82- :rtype: String
78+ :rtype: str
8379 """
8480 code = _upc .EDGE [:]
8581
@@ -98,7 +94,7 @@ def build(self):
9894 def to_ascii (self ):
9995 """Returns an ascii representation of the barcode.
10096
101- :rtype: String
97+ :rtype: str
10298 """
10399
104100 code = self .build ()
You can’t perform that action at this time.
0 commit comments