Skip to content

Commit

Permalink
Remove backslash from f-string (Patch for Issue: #247) (#248)
Browse files Browse the repository at this point in the history
Remove backslash from f-string to maintain backward compatibility with
Python 3.10 and 3.11 versions.

Also, corrected little (very minor non-impacting) cosmetic issues.

Patch for Issue: #247
  • Loading branch information
Joezanini authored Jan 11, 2025
2 parents e851508 + 03dfb3e commit 99a570d
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 158 deletions.
6 changes: 2 additions & 4 deletions src/webexpythonsdk/models/cards/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@
"""

from webexpythonsdk.models.cards.adaptive_card_component import (
AdaptiveCardComponent
)
from webexpythonsdk.models.cards.cards import (
AdaptiveCard
AdaptiveCardComponent,
)
from webexpythonsdk.models.cards.cards import AdaptiveCard
from webexpythonsdk.models.cards.card_elements import (
TextBlock,
Image,
Expand Down
34 changes: 9 additions & 25 deletions src/webexpythonsdk/models/cards/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,7 @@ def __init__(

super().__init__(
serializable_properties=[
*(
["fallback"] if hasattr(fallback, "to_dict") else []
),
*(["fallback"] if hasattr(fallback, "to_dict") else []),
],
simple_properties=[
"type",
Expand All @@ -164,9 +162,7 @@ def __init__(
"iconUrl",
"id",
"style",
*(
[] if hasattr(fallback, "to_dict") else ["fallback"]
),
*([] if hasattr(fallback, "to_dict") else ["fallback"]),
"requires",
],
)
Expand Down Expand Up @@ -246,7 +242,7 @@ def __init__(
str,
object,
),
optional=True
optional=True,
)

validate_input(
Expand Down Expand Up @@ -315,9 +311,7 @@ def __init__(

super().__init__(
serializable_properties=[
*(
["fallback"] if hasattr(fallback, "to_dict") else []
),
*(["fallback"] if hasattr(fallback, "to_dict") else []),
],
simple_properties=[
"type",
Expand All @@ -327,9 +321,7 @@ def __init__(
"iconUrl",
"id",
"style",
*(
[] if hasattr(fallback, "to_dict") else ["fallback"]
),
*([] if hasattr(fallback, "to_dict") else ["fallback"]),
"requires",
],
)
Expand Down Expand Up @@ -461,19 +453,15 @@ def __init__(
super().__init__(
serializable_properties=[
"card",
*(
["fallback"] if hasattr(fallback, "to_dict") else []
),
*(["fallback"] if hasattr(fallback, "to_dict") else []),
],
simple_properties=[
"type",
"title",
"iconUrl",
"id",
"style",
*(
[] if hasattr(fallback, "to_dict") else ["fallback"]
),
*([] if hasattr(fallback, "to_dict") else ["fallback"]),
"requires",
],
)
Expand Down Expand Up @@ -608,19 +596,15 @@ def __init__(
super().__init__(
serializable_properties=[
"targetElements",
*(
["fallback"] if hasattr(fallback, "to_dict") else []
),
*(["fallback"] if hasattr(fallback, "to_dict") else []),
],
simple_properties=[
"type",
"title",
"iconUrl",
"id",
"style",
*(
[] if hasattr(fallback, "to_dict") else ["fallback"]
),
*([] if hasattr(fallback, "to_dict") else ["fallback"]),
"requires",
],
)
Expand Down
32 changes: 8 additions & 24 deletions src/webexpythonsdk/models/cards/card_elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,7 @@ def __init__(

super().__init__(
serializable_properties=[
*(
["fallback"] if hasattr(fallback, "to_dict") else []
),
*(["fallback"] if hasattr(fallback, "to_dict") else []),
],
simple_properties=[
"type",
Expand All @@ -282,9 +280,7 @@ def __init__(
"size",
"weight",
"wrap",
*(
[] if hasattr(fallback, "to_dict") else ["fallback"]
),
*([] if hasattr(fallback, "to_dict") else ["fallback"]),
"height",
"separator",
"spacing",
Expand Down Expand Up @@ -531,9 +527,7 @@ def __init__(
super().__init__(
serializable_properties=[
"selectAction",
*(
["fallback"] if hasattr(fallback, "to_dict") else []
),
*(["fallback"] if hasattr(fallback, "to_dict") else []),
],
simple_properties=[
"type",
Expand All @@ -545,9 +539,7 @@ def __init__(
"size",
"style",
"width",
*(
[] if hasattr(fallback, "to_dict") else ["fallback"]
),
*([] if hasattr(fallback, "to_dict") else ["fallback"]),
"separator",
"spacing",
"id",
Expand Down Expand Up @@ -726,17 +718,13 @@ def __init__(
super().__init__(
serializable_properties=[
"sources",
*(
["fallback"] if hasattr(fallback, "to_dict") else []
),
*(["fallback"] if hasattr(fallback, "to_dict") else []),
],
simple_properties=[
"type",
"poster",
"altText",
*(
[] if hasattr(fallback, "to_dict") else ["fallback"]
),
*([] if hasattr(fallback, "to_dict") else ["fallback"]),
"height",
"separator",
"spacing",
Expand Down Expand Up @@ -954,16 +942,12 @@ def __init__(
super().__init__(
serializable_properties=[
"inlines",
*(
["fallback"] if hasattr(fallback, "to_dict") else []
),
*(["fallback"] if hasattr(fallback, "to_dict") else []),
],
simple_properties=[
"type",
"horizontalAlignment",
*(
[] if hasattr(fallback, "to_dict") else ["fallback"]
),
*([] if hasattr(fallback, "to_dict") else ["fallback"]),
"height",
"separator",
"spacing",
Expand Down
6 changes: 4 additions & 2 deletions src/webexpythonsdk/models/cards/cards.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ def __init__(
"actions",
"selectAction",
*(
["backgroundImage"] if hasattr(backgroundImage, "to_dict")
["backgroundImage"]
if hasattr(backgroundImage, "to_dict")
else []
),
],
Expand All @@ -228,7 +229,8 @@ def __init__(
"version",
"fallbackText",
*(
[] if hasattr(backgroundImage, "to_dict")
[]
if hasattr(backgroundImage, "to_dict")
else ["backgroundImage"]
),
"minHeight",
Expand Down
64 changes: 22 additions & 42 deletions src/webexpythonsdk/models/cards/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,11 @@ def __init__(
super().__init__(
serializable_properties=[
"actions",
*(
["fallback"] if hasattr(fallback, "to_dict") else []
),
*(["fallback"] if hasattr(fallback, "to_dict") else []),
],
simple_properties=[
"type",
*(
[] if hasattr(fallback, "to_dict") else ["fallback"]
),
*([] if hasattr(fallback, "to_dict") else ["fallback"]),
"height",
"separator",
"spacing",
Expand Down Expand Up @@ -455,26 +451,24 @@ def __init__(
"items",
"selectAction",
*(
["backgroundImage"] if hasattr(backgroundImage, "to_dict")
["backgroundImage"]
if hasattr(backgroundImage, "to_dict")
else []
),
*(
["fallback"] if hasattr(fallback, "to_dict") else []
),
*(["fallback"] if hasattr(fallback, "to_dict") else []),
],
simple_properties=[
"type",
"style",
"verticalContentAlignment",
"bleed",
*(
[] if hasattr(backgroundImage, "to_dict")
[]
if hasattr(backgroundImage, "to_dict")
else ["backgroundImage"]
),
"minHeight",
*(
[] if hasattr(fallback, "to_dict") else ["fallback"]
),
*([] if hasattr(fallback, "to_dict") else ["fallback"]),
"height",
"separator",
"spacing",
Expand Down Expand Up @@ -504,7 +498,7 @@ def __init__(
minHeight: str = None,
horizontalAlignment: OPTIONS.HorizontalAlignment = None,
fallback: object = None,
height: OPTIONS.BlockElementHeight=None,
height: OPTIONS.BlockElementHeight = None,
separator: bool = None,
spacing: OPTIONS.Spacing = None,
id: str = None,
Expand Down Expand Up @@ -698,19 +692,15 @@ def __init__(
serializable_properties=[
"columns",
"selectAction",
*(
["fallback"] if hasattr(fallback, "to_dict") else []
),
*(["fallback"] if hasattr(fallback, "to_dict") else []),
],
simple_properties=[
"type",
"style",
"bleed",
"minHeight",
"horizontalAlignment",
*(
[] if hasattr(fallback, "to_dict") else ["fallback"]
),
*([] if hasattr(fallback, "to_dict") else ["fallback"]),
"height",
"separator",
"spacing",
Expand Down Expand Up @@ -959,24 +949,22 @@ def __init__(
serializable_properties=[
"items",
*(
["backgroundImage"] if hasattr(backgroundImage, "to_dict")
["backgroundImage"]
if hasattr(backgroundImage, "to_dict")
else []
),
*(
["fallback"] if hasattr(fallback, "to_dict") else []
),
*(["fallback"] if hasattr(fallback, "to_dict") else []),
"selectAction",
],
simple_properties=[
"type",
*(
[] if hasattr(backgroundImage, "to_dict")
[]
if hasattr(backgroundImage, "to_dict")
else ["backgroundImage"]
),
"bleed",
*(
[] if hasattr(fallback, "to_dict") else ["fallback"]
),
*([] if hasattr(fallback, "to_dict") else ["fallback"]),
"minHeight",
"separator",
"spacing",
Expand Down Expand Up @@ -1135,15 +1123,11 @@ def __init__(
super().__init__(
serializable_properties=[
"facts",
*(
["fallback"] if hasattr(fallback, "to_dict") else []
),
*(["fallback"] if hasattr(fallback, "to_dict") else []),
],
simple_properties=[
"type",
*(
[] if hasattr(fallback, "to_dict") else ["fallback"]
),
*([] if hasattr(fallback, "to_dict") else ["fallback"]),
"height",
"separator",
"id",
Expand Down Expand Up @@ -1215,7 +1199,7 @@ def __init__(
height: OPTIONS.BlockElementHeight = None,
separator: bool = None,
spacing: OPTIONS.Spacing = None,
id: str = None,
id: str = None,
isVisible: bool = True,
requires: dict[str, str] = None,
):
Expand Down Expand Up @@ -1357,16 +1341,12 @@ def __init__(
super().__init__(
serializable_properties=[
"images",
*(
["fallback"] if hasattr(fallback, "to_dict") else []
),
*(["fallback"] if hasattr(fallback, "to_dict") else []),
],
simple_properties=[
"type",
"imageSize",
*(
[] if hasattr(fallback, "to_dict") else ["fallback"]
),
*([] if hasattr(fallback, "to_dict") else ["fallback"]),
"height",
"separator",
"spacing",
Expand Down
Loading

0 comments on commit 99a570d

Please sign in to comment.