Repository: matplotlib/matplotlib
File: lib/matplotlib/text.py (Python)

Code before:

    def _va_for_angle(self, angle):
        """
        Determines vertical alignment ('va') for rotation_mode "ytick" based on
        the angle of rotation in degrees and the horizontal alignment.
        """
        anchor_at_left = self.get_horizontalalignment() == 'left'
        if (angle <= 10 or 350 <= angle or 170 <= angle <= 190
                or 80 <= angle <= 100 or 260 <= angle <= 280):
            return 'center'
        elif 190 < angle < 260 or 10 < angle < 80:
            return 'baseline' if anchor_at_left else 'top'
        return 'top' if anchor_at_left else 'baseline'

    def get_language(self):
        """Return the language this Text is in."""
        return self._language

    def set_language(self, language):
        """
        Set the language of the text.

        Parameters
        ----------
        language : str or None
            The language of the text in a format accepted by libraqm, namely `a BCP47
            language code <https://www.w3.org/International/articles/language-tags/>`_.

            If None, then defaults to :rc:`text.language`.
        """
        _api.check_isinstance((list, tuple, str, None), language=language)
        language = mpl._val_or_rc(language, 'text.language')

        if not cbook.is_scalar_or_string(language):
            for val in language:
                if not isinstance(val, tuple) or len(val) != 3:
                    raise TypeError('language must be list of tuple, not {language!r}')
                sublang, start, end = val
                if not isinstance(sublang, str):
                    raise TypeError(
                        'sub-language specification must be str, not {sublang!r}')
                if not isinstance(start, int):
                    raise TypeError('start location must be int, not {start!r}')
                if not isinstance(end, int):
                    raise TypeError('end location must be int, not {end!r}')

        self._language = language
        self.stale = True


class OffsetFrom:

Review comment (suggestion):
```suggestion
        language : str or list or tuple or None
```

Code after:
        return 'right' if anchor_at_bottom else 'left'

    def _va_for_angle(self, angle):
        """
        Determines vertical alignment ('va') for rotation_mode "ytick" based on
        the angle of rotation in degrees and the horizontal alignment.
        """
        anchor_at_left = self.get_horizontalalignment() == 'left'
        if (angle <= 10 or 350 <= angle or 170 <= angle <= 190
                or 80 <= angle <= 100 or 260 <= angle <= 280):
            return 'center'
        elif 190 < angle < 260 or 10 < angle < 80:
            return 'baseline' if anchor_at_left else 'top'
        return 'top' if anchor_at_left else 'baseline'

    def get_language(self):
        """Return the language this Text is in."""
        return self._language

    def set_language(self, language):
        """
        Set the language of the text.

        Parameters
        ----------
        language : str or None
            The language of the text in a format accepted by libraqm, namely `a BCP47
            language code <https://www.w3.org/International/articles/language-tags/>`_.

            If None, then defaults to :rc:`text.language`.
        """
        _api.check_isinstance((Sequence, str, None), language=language)
        language = mpl._val_or_rc(language, 'text.language')

        if not cbook.is_scalar_or_string(language):
            language = tuple(language)
            for val in language:
                if not isinstance(val, tuple) or len(val) != 3:
                    raise TypeError('language must be list of tuple, not {language!r}')
                sublang, start, end = val
                if not isinstance(sublang, str):
                    raise TypeError(
                        'sub-language specification must be str, not {sublang!r}')
                if not isinstance(start, int):
                    raise TypeError('start location must be int, not {start!r}')
                if not isinstance(end, int):
                    raise TypeError('end location must be int, not {end!r}')

        self._language = language
        self.stale = True