Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

As part of redesign of parse methods in Model, consider to make sure that parser... #207

Open
github-actions bot opened this issue Sep 16, 2024 · 0 comments
Labels

Comments

@github-actions
Copy link

the typing allows output can be directly funnelled back as input, but which still change

the data, can be revalidated without altering the state. An example of such a Model is

the RomanNumeral Model below, given that the if statement where removed.

# TODO: As part of redesign of parse methods in Model, consider to make sure that parsers where

    roman_numerals = ('I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X')

    # TODO: As part of redesign of parse methods in Model, consider to make sure that parsers where
    #       the typing allows output can be directly funnelled back as input, but which still change
    #       the data, can be revalidated without altering the state. An example of such a Model is
    #       the RomanNumeral Model below, given that the if statement where removed.
    class RomanNumeral(Model[str]):
        """A roman numeral"""
        @classmethod
        def _parse_data(cls, data: str) -> str:
            if data in roman_numerals:
                return data
            number = int(data)
            assert 0 < number <= 10
            return roman_numerals[number - 1]
@github-actions github-actions bot added the todo label Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

0 participants