def make_code(self):
        """This method returns the best possible QR code."""
        from copy import deepcopy

        #Get the size of the underlying matrix
        matrix_size = tables.version_size[self.version]

        #Create a template matrix we will build the codes with
        row = [' ' for x in range(matrix_size)]
        template = [deepcopy(row) for x in range(matrix_size)]

        #Add mandatory information to the template
        self.add_detection_pattern(template)
        self.add_position_pattern(template)
        self.add_version_pattern(template)

        #Create the various types of masks of the template
        self.masks = self.make_masks(template)

        self.best_mask = self.choose_best_mask()
        self.code = self.masks[self.best_mask]
def make_code ( self ) : from copy import deepcopy matrix_size = tables . version_size [ self . version ] row = [ ' ' for x in range ( matrix_size ) ] template = [ deepcopy ( row ) for x in range ( matrix_size ) ] self . add_detection_pattern ( template ) self . add_position_pattern ( template ) self . add_version_pattern ( template ) self . masks = self . make_masks ( template ) self . best_mask = self . choose_best_mask ( ) self . code = self . masks [ self . best_mask ]
This method returns the best possible QR code.