We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Came across this in a complex application, so I don't have a reproducible example.
Not sure if this code is correct in this PR: https://github.com/Textualize/textual/pull/2519/files#r1204692994
Shouldn't it be checking that the denominator is > 0 in the fraction instead of the numerator?
│ /Users/darrenburns/Code/textual/src/textual/_resolve.py:168 in resolve_fraction_unit │ │ │ │ 165 │ │ │ break │ │ 166 │ │ │ 167 │ return ( │ │ ❱ 168 │ │ Fraction(remaining_space, remaining_fraction) │ │ 169 │ │ if remaining_space > 0 │ │ 170 │ │ else Fraction(1) │ │ 171 │ ) │ │ │ │ ╭───────────────────────────────────────────────── locals ──────────────────────────────────────────────────╮ │ │ │ index = 0 │ │ │ │ max_value = Fraction(1, 1) │ │ │ │ min_value = None │ │ │ │ remaining_fraction = Fraction(0, 1) │ │ │ │ remaining_space = Fraction(26, 1) │ │ │ │ remaining_space_changed = True │ │ │ │ resolve = [ │ │ │ │ │ ( │ │ │ │ │ │ Scalar( │ │ │ │ │ │ │ value=1.0, │ │ │ │ │ │ │ unit=<Unit.FRACTION: 2>, │ │ │ │ │ │ │ percent_unit=<Unit.WIDTH: 4> │ │ │ │ │ │ ), │ │ │ │ │ │ None, │ │ │ │ │ │ Fraction(1, 1) │ │ │ │ │ ) │ │ │ │ ] │ │ │ │ resolve_dimension = 'height' │ │ │ │ resolve_fraction = Fraction(27, 1) │ │ │ │ resolve_scalar = <function resolve_fraction_unit.<locals>.resolve_scalar at 0x10f7c85e0> │ │ │ │ resolved = [Fraction(1, 1)] │ │ │ │ resolved_scalar = Fraction(27, 1) │ │ │ │ scalar = Scalar(value=1.0, unit=<Unit.FRACTION: 2>, percent_unit=<Unit.WIDTH: 4>) │ │ │ │ size = Size(width=32, height=32) │ │ │ │ value = None │ │ │ │ viewport_size = Size(width=113, height=38) │ │ │ │ widget_styles = [ │ │ │ │ │ RenderStyles( │ │ │ │ │ │ layout=<vertical>, │ │ │ │ │ │ auto_color=True, │ │ │ │ │ │ color=Color(255, 255, 255, a=0.87), │ │ │ │ │ │ background=Color(18, 18, 18, a=0.15), │ │ │ │ │ │ margin=Spacing(top=1, right=0, bottom=0, left=0), │ │ │ │ │ │ width=Scalar( │ │ │ │ │ │ │ value=1.0, │ │ │ │ │ │ │ unit=<Unit.FRACTION: 2>, │ │ │ │ │ │ │ percent_unit=<Unit.WIDTH: 4> │ │ │ │ │ │ ), │ │ │ │ │ │ height=Scalar( │ │ │ │ │ │ │ value=1.0, │ │ │ │ │ │ │ unit=<Unit.FRACTION: 2>, │ │ │ │ │ │ │ percent_unit=<Unit.WIDTH: 4> │ │ │ │ │ │ ), │ │ │ │ │ │ max_height=Scalar( │ │ │ │ │ │ │ value=1.0, │ │ │ │ │ │ │ unit=<Unit.FRACTION: 2>, │ │ │ │ │ │ │ percent_unit=<Unit.WIDTH: 4> │ │ │ │ │ │ ), │ │ │ │ │ │ overflow_x='hidden', │ │ │ │ │ │ overflow_y='auto', │ │ │ │ │ │ scrollbar_color=Color(35, 86, 139), │ │ │ │ │ │ scrollbar_color_hover=Color(35, 86, 139), │ │ │ │ │ │ scrollbar_color_active=Color(231, 146, 13), │ │ │ │ │ │ scrollbar_corner_color=Color(20, 25, 31), │ │ │ │ │ │ scrollbar_background=Color(20, 25, 31), │ │ │ │ │ │ scrollbar_background_hover=Color(0, 5, 15), │ │ │ │ │ │ scrollbar_background_active=Color(0, 0, 0), │ │ │ │ │ │ scrollbar_size_vertical=2, │ │ │ │ │ │ scrollbar_size_horizontal=1, │ │ │ │ │ │ link_color=Color(255, 255, 255, a=0.87), │ │ │ │ │ │ auto_link_color=True, │ │ │ │ │ │ link_style=Style(underline=True), │ │ │ │ │ │ link_hover_color=Color(255, 255, 255, a=0.87), │ │ │ │ │ │ auto_link_hover_color=True, │ │ │ │ │ │ link_hover_background=Color(1, 120, 212), │ │ │ │ │ │ link_hover_style=Style(bold=True, underline=False) │ │ │ │ │ ) │ │ │ │ ] │ │ │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /Users/darrenburns/.pyenv/versions/3.11.0/lib/python3.11/fractions.py:157 in __new__ │ │ │ │ 154 │ │ │ │ │ │ │ "Rational instances") │ │ 155 │ │ │ │ 156 │ │ if denominator == 0: │ │ ❱ 157 │ │ │ raise ZeroDivisionError('Fraction(%s, 0)' % numerator) │ │ 158 │ │ if _normalize: │ │ 159 │ │ │ g = math.gcd(numerator, denominator) │ │ 160 │ │ │ if denominator < 0: │ │ │ │ ╭─────────────────────────────────── locals ───────────────────────────────────╮ │ │ │ _normalize = True │ │ │ │ cls = <class 'fractions.Fraction'> │ │ │ │ denominator = 0 │ │ │ │ numerator = 26 │ │ │ │ self = <repr-error "'Fraction' object has no attribute '_numerator'"> │ │ │ ╰──────────────────────────────────────────────────────────────────────────────╯ │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ZeroDivisionError: Fraction(26, 0)
The text was updated successfully, but these errors were encountered:
Don't forget to star the repository!
Follow @textualizeio for Textual updates.
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Came across this in a complex application, so I don't have a reproducible example.
Not sure if this code is correct in this PR: https://github.com/Textualize/textual/pull/2519/files#r1204692994
Shouldn't it be checking that the denominator is > 0 in the fraction instead of the numerator?
The text was updated successfully, but these errors were encountered: