parameters: (number_of_barcodes, barcode_width, barcode_height,
                             output_directory='.',
                             path_to_zxing='zxing-read-only')
return_statement: return not errors
docstring: Generates UPC-A barcodes.
  
    This function generates a number_of_barcodes UPC-A barcodes. The function
    calls an example Java encoder from the Zxing library. The barcodes are
    generated as PNG images. The width of the barcodes shouldn't be less than 102
    pixels because otherwise Zxing can't properly generate the barcodes.
  
    Args:
      number_of_barcodes(int): The number of barcodes to generate.
      barcode_width(int): Width of barcode in pixels.
      barcode_height(int): Height of barcode in pixels.
      output_directory(string): Output directory where to store generated
        barcodes.
      path_to_zxing(string): The path to Zxing.
  
    Return:
      (bool): True if the conversion is successful.
docstring_summary: Generates UPC-A barcodes.
docstring_tokens: Generates UPC - A barcodes .
function: def generate_upca_barcodes(number_of_barcodes, barcode_width, barcode_height,
                             output_directory='.',
                             path_to_zxing='zxing-read-only'):
    """Generates UPC-A barcodes.
  
    This function generates a number_of_barcodes UPC-A barcodes. The function
    calls an example Java encoder from the Zxing library. The barcodes are
    generated as PNG images. The width of the barcodes shouldn't be less than 102
    pixels because otherwise Zxing can't properly generate the barcodes.
  
    Args:
      number_of_barcodes(int): The number of barcodes to generate.
      barcode_width(int): Width of barcode in pixels.
      barcode_height(int): Height of barcode in pixels.
      output_directory(string): Output directory where to store generated
        barcodes.
      path_to_zxing(string): The path to Zxing.
  
    Return:
      (bool): True if the conversion is successful.
    """
    base_file_name = os.path.join(output_directory, "barcode_")
    jars = _form_jars_string(path_to_zxing)
    command_line_encoder = 'com.google.zxing.client.j2se.CommandLineEncoder'
    barcode_width = str(barcode_width)
    barcode_height = str(barcode_height)
  
    errors = False
    for i in range(number_of_barcodes):
      suffix = helper_functions.zero_pad(i)
      # Barcodes starting from 0
      content = helper_functions.zero_pad(i, 11)
      output_file_name = base_file_name + suffix + ".png"
  
      command = ["java", "-cp", jars, command_line_encoder,
                 "--barcode_format=UPC_A", "--height=%s" % barcode_height,
                 "--width=%s" % barcode_width,
                 "--output=%s" % (output_file_name), "%s" % (content)]
      try:
        helper_functions.run_shell_command(
            command, fail_msg=('Error during barcode %s generation' % content))
      except helper_functions.HelperError as err:
        print >> sys.stderr, err
        errors = True
    return not errors
function_tokens: def generate_upca_barcodes ( number_of_barcodes , barcode_width , barcode_height , output_directory = '.' , path_to_zxing = 'zxing-read-only' ) : base_file_name = os . path . join ( output_directory , "barcode_" ) jars = _form_jars_string ( path_to_zxing ) command_line_encoder = 'com.google.zxing.client.j2se.CommandLineEncoder' barcode_width = str ( barcode_width ) barcode_height = str ( barcode_height ) errors = False for i in range ( number_of_barcodes ) : suffix = helper_functions . zero_pad ( i ) # Barcodes starting from 0 content = helper_functions . zero_pad ( i , 11 ) output_file_name = base_file_name + suffix + ".png" command = [ "java" , "-cp" , jars , command_line_encoder , "--barcode_format=UPC_A" , "--height=%s" % barcode_height , "--width=%s" % barcode_width , "--output=%s" % ( output_file_name ) , "%s" % ( content ) ] try : helper_functions . run_shell_command ( command , fail_msg = ( 'Error during barcode %s generation' % content ) ) except helper_functions . HelperError as err : print >> sys . stderr , err errors = True return not errors