fuzzyfields/domain.py
def _parse_choices(self) -> None:
        """Parse choices and update several cache fields.
        This needs to be invoked after every time choices changes.
        """
        self._has_numeric_choices = False
        self._choices_map = {}

        for v in self.choices:
            k = v
            if isinstance(v, str) and not self.case_sensitive:
                k = v.lower()
            elif isinstance(v, (int, float, complex)):
                self._has_numeric_choices = True
            try:
                self._choices_map[k] = v
            except TypeError:
                k = pickle.dumps(v, protocol=pickle.HIGHEST_PROTOCOL)
                self._choices_map[k] = v

        # Build sorted list of choices, used for string representations
        try:
            sorted_choices = sorted(self.choices)
        except TypeError:
            # choices is a mix of incomparable types, e.g. (1, '2')
            sorted_choices = sorted(self.choices, key=str)
        self._choices_str = ",".join(str(choice) for choice in sorted_choices)
        if len(self._choices_str) > 200:
            self._choices_str = self._choices_str[:200] + '...'
Parse choices and update several cache fields.
        This needs to be invoked after every time choices changes.
        
Parse choices and update several cache fields.
This needs to be invoked after every time choices changes.
Parse choices and update several cache fields . This needs to be invoked after every time choices changes .
def _parse_choices(self) -> None:
        self._has_numeric_choices = False
        self._choices_map = {}
        for v in self.choices:
            k = v
            if isinstance(v, str) and not self.case_sensitive:
                k = v.lower()
            elif isinstance(v, (int, float, complex)):
                self._has_numeric_choices = True
            try:
                self._choices_map[k] = v
            except TypeError:
                k = pickle.dumps(v, protocol=pickle.HIGHEST_PROTOCOL)
                self._choices_map[k] = v
        try:
            sorted_choices = sorted(self.choices)
        except TypeError:
            sorted_choices = sorted(self.choices, key=str)
        self._choices_str = ",".join(str(choice) for choice in sorted_choices)
        if len(self._choices_str) > 200:
            self._choices_str = self._choices_str[:200] + '...'
def _parse_choices ( self ) -> None : self . _has_numeric_choices = False self . _choices_map = { } for v in self . choices : k = v if isinstance ( v , str ) and not self . case_sensitive : k = v . lower ( ) elif isinstance ( v , ( int , float , complex ) ) : self . _has_numeric_choices = True try : self . _choices_map [ k ] = v except TypeError : k = pickle . dumps ( v , protocol = pickle . HIGHEST_PROTOCOL ) self . _choices_map [ k ] = v try : sorted_choices = sorted ( self . choices ) except TypeError : sorted_choices = sorted ( self . choices , key = str ) self . _choices_str = "," . join ( str ( choice ) for choice in sorted_choices ) if len ( self . _choices_str ) > 200 : self . _choices_str = self . _choices_str [ : 200 ] + '...'
Parse choices and update several cache fields.
Parse choices and update several cache fields .
"""Parse choices and update several cache fields.
        This needs to be invoked after every time choices changes.
        """ # Build sorted list of choices, used for string representations # choices is a mix of incomparable types, e.g. (1, '2')
self