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

fix(layout_columns): Fix coercion of scalar row height to list for python <= 3.9 #1494

Merged
merged 3 commits into from
Jul 3, 2024

Conversation

gadenbuie
Copy link
Collaborator

In Python <= 3.9, the following code throws an error

from typing import Union
if isinstance(1, Union[int, str]):
    print("yes")

#> TypeError: Subscripted generics cannot be used with class and instance checks

We have a variant of this with CssUnit = int | float | str in ui.layout_columns(). This is fixed by using isinstance_cssunit(), an existing helper function created just for this scenario.

@gadenbuie gadenbuie requested a review from wch July 3, 2024 19:34
@wch wch added this pull request to the merge queue Jul 3, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 3, 2024
@wch wch added this pull request to the merge queue Jul 3, 2024
Merged via the queue into main with commit 36a5308 Jul 3, 2024
31 checks passed
@wch wch deleted the fix/layout-columns-3-9 branch July 3, 2024 21:55
schloerke added a commit to machow/py-shiny that referenced this pull request Jul 5, 2024
* main:
  test(controllers): Refactor column sort and filter methods for Dataframe class (posit-dev#1496)
  Follow up to posit-dev#1453: allow user roles when normalizing a dictionary (posit-dev#1495)
  fix(layout_columns): Fix coercion of scalar row height to list for python <= 3.9 (posit-dev#1494)
  Add `shiny.ui.Chat` (posit-dev#1453)
  docs(Theme): Fix example and clarify usage (posit-dev#1491)
  chore(pyright): Pin pyright version to `1.1.369` to avoid CI failures (posit-dev#1493)
  tests(dataframe): Add additional tests for dataframe (posit-dev#1487)
  bug(data frame): Export `render.StyleInfo` (posit-dev#1488)
schloerke added a commit that referenced this pull request Jul 9, 2024
* main:
  feat(data frame): Support `polars` (#1474)
  api(playwright): Code review of complete playwright API (#1501)
  fix: Move `www/shared/py-shiny` to `www/py-shiny` (#1499)
  test(controllers): Refactor column sort and filter methods for Dataframe class (#1496)
  Follow up to #1453: allow user roles when normalizing a dictionary (#1495)
  fix(layout_columns): Fix coercion of scalar row height to list for python <= 3.9 (#1494)
  Add `shiny.ui.Chat` (#1453)
  docs(Theme): Fix example and clarify usage (#1491)
  chore(pyright): Pin pyright version to `1.1.369` to avoid CI failures (#1493)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants