(self)
Calculate the unique survey ID from the surveys settings and boxes.

        The ID only includes the boxes positions, which means that simple typo
        fixes will not change the ID most of the time.
Calculate the unique survey ID from the surveys settings and boxes.
Calculate the unique survey ID from the surveys settings and boxes .
def calculate_survey_id(self):
        """Calculate the unique survey ID from the surveys settings and boxes.

        The ID only includes the boxes positions, which means that simple typo
        fixes will not change the ID most of the time."""
        import hashlib
        md5 = hashlib.new('md5')

        for qobject in self.questionnaire.qobjects:
            qobject.calculate_survey_id(md5)

        for defs_slot in self.defs.__slots__:
            # Backward compatibility
            if defs_slot == 'checkmode' and self.defs.checkmode == "checkcorrect":
                continue

            if defs_slot == 'engine':
                continue

            # Introduced in 1.9.10
            if defs_slot == 'corner_mark_left' and self.defs.corner_mark_left == defs._corner_mark_left:
                continue

            if defs_slot == 'corner_mark_right' and self.defs.corner_mark_right == defs._corner_mark_right:
                continue

            if defs_slot == 'corner_mark_top' and self.defs.corner_mark_top == defs._corner_mark_top:
                continue

            if defs_slot == 'corner_mark_bottom' and self.defs.corner_mark_bottom == defs._corner_mark_bottom:
                continue

            if isinstance(self.defs.__getattribute__(defs_slot), float):
                md5.update(str(round(self.defs.__getattribute__(defs_slot), 1)).encode('utf-8'))
            else:
                md5.update(str(self.defs.__getattribute__(defs_slot)).encode('utf-8'))

        # Use the first 32 bits as a little endian unsigned integer
        self.survey_id = struct.unpack('<I', md5.digest()[0:4])[0]
def calculate_survey_id ( self ) : import hashlib md5 = hashlib . new ( 'md5' ) for qobject in self . questionnaire . qobjects : qobject . calculate_survey_id ( md5 ) for defs_slot in self . defs . __slots__ : # Backward compatibility if defs_slot == 'checkmode' and self . defs . checkmode == "checkcorrect" : continue if defs_slot == 'engine' : continue # Introduced in 1.9.10 if defs_slot == 'corner_mark_left' and self . defs . corner_mark_left == defs . _corner_mark_left : continue if defs_slot == 'corner_mark_right' and self . defs . corner_mark_right == defs . _corner_mark_right : continue if defs_slot == 'corner_mark_top' and self . defs . corner_mark_top == defs . _corner_mark_top : continue if defs_slot == 'corner_mark_bottom' and self . defs . corner_mark_bottom == defs . _corner_mark_bottom : continue if isinstance ( self . defs . __getattribute__ ( defs_slot ) , float ) : md5 . update ( str ( round ( self . defs . __getattribute__ ( defs_slot ) , 1 ) ) . encode ( 'utf-8' ) ) else : md5 . update ( str ( self . defs . __getattribute__ ( defs_slot ) ) . encode ( 'utf-8' ) ) # Use the first 32 bits as a little endian unsigned integer self . survey_id = struct . unpack ( '<I' , md5 . digest ( ) [ 0 : 4 ] ) [ 0 ]