Skip to content

Commit 99a570d

Browse files
authored
Remove backslash from f-string (Patch for Issue: #247) (#248)
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
2 parents e851508 + 03dfb3e commit 99a570d

File tree

8 files changed

+83
-158
lines changed

8 files changed

+83
-158
lines changed

src/webexpythonsdk/models/cards/__init__.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,9 @@
2222
"""
2323

2424
from webexpythonsdk.models.cards.adaptive_card_component import (
25-
AdaptiveCardComponent
26-
)
27-
from webexpythonsdk.models.cards.cards import (
28-
AdaptiveCard
25+
AdaptiveCardComponent,
2926
)
27+
from webexpythonsdk.models.cards.cards import AdaptiveCard
3028
from webexpythonsdk.models.cards.card_elements import (
3129
TextBlock,
3230
Image,

src/webexpythonsdk/models/cards/actions.py

+9-25
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,7 @@ def __init__(
153153

154154
super().__init__(
155155
serializable_properties=[
156-
*(
157-
["fallback"] if hasattr(fallback, "to_dict") else []
158-
),
156+
*(["fallback"] if hasattr(fallback, "to_dict") else []),
159157
],
160158
simple_properties=[
161159
"type",
@@ -164,9 +162,7 @@ def __init__(
164162
"iconUrl",
165163
"id",
166164
"style",
167-
*(
168-
[] if hasattr(fallback, "to_dict") else ["fallback"]
169-
),
165+
*([] if hasattr(fallback, "to_dict") else ["fallback"]),
170166
"requires",
171167
],
172168
)
@@ -246,7 +242,7 @@ def __init__(
246242
str,
247243
object,
248244
),
249-
optional=True
245+
optional=True,
250246
)
251247

252248
validate_input(
@@ -315,9 +311,7 @@ def __init__(
315311

316312
super().__init__(
317313
serializable_properties=[
318-
*(
319-
["fallback"] if hasattr(fallback, "to_dict") else []
320-
),
314+
*(["fallback"] if hasattr(fallback, "to_dict") else []),
321315
],
322316
simple_properties=[
323317
"type",
@@ -327,9 +321,7 @@ def __init__(
327321
"iconUrl",
328322
"id",
329323
"style",
330-
*(
331-
[] if hasattr(fallback, "to_dict") else ["fallback"]
332-
),
324+
*([] if hasattr(fallback, "to_dict") else ["fallback"]),
333325
"requires",
334326
],
335327
)
@@ -461,19 +453,15 @@ def __init__(
461453
super().__init__(
462454
serializable_properties=[
463455
"card",
464-
*(
465-
["fallback"] if hasattr(fallback, "to_dict") else []
466-
),
456+
*(["fallback"] if hasattr(fallback, "to_dict") else []),
467457
],
468458
simple_properties=[
469459
"type",
470460
"title",
471461
"iconUrl",
472462
"id",
473463
"style",
474-
*(
475-
[] if hasattr(fallback, "to_dict") else ["fallback"]
476-
),
464+
*([] if hasattr(fallback, "to_dict") else ["fallback"]),
477465
"requires",
478466
],
479467
)
@@ -608,19 +596,15 @@ def __init__(
608596
super().__init__(
609597
serializable_properties=[
610598
"targetElements",
611-
*(
612-
["fallback"] if hasattr(fallback, "to_dict") else []
613-
),
599+
*(["fallback"] if hasattr(fallback, "to_dict") else []),
614600
],
615601
simple_properties=[
616602
"type",
617603
"title",
618604
"iconUrl",
619605
"id",
620606
"style",
621-
*(
622-
[] if hasattr(fallback, "to_dict") else ["fallback"]
623-
),
607+
*([] if hasattr(fallback, "to_dict") else ["fallback"]),
624608
"requires",
625609
],
626610
)

src/webexpythonsdk/models/cards/card_elements.py

+8-24
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,7 @@ def __init__(
267267

268268
super().__init__(
269269
serializable_properties=[
270-
*(
271-
["fallback"] if hasattr(fallback, "to_dict") else []
272-
),
270+
*(["fallback"] if hasattr(fallback, "to_dict") else []),
273271
],
274272
simple_properties=[
275273
"type",
@@ -282,9 +280,7 @@ def __init__(
282280
"size",
283281
"weight",
284282
"wrap",
285-
*(
286-
[] if hasattr(fallback, "to_dict") else ["fallback"]
287-
),
283+
*([] if hasattr(fallback, "to_dict") else ["fallback"]),
288284
"height",
289285
"separator",
290286
"spacing",
@@ -531,9 +527,7 @@ def __init__(
531527
super().__init__(
532528
serializable_properties=[
533529
"selectAction",
534-
*(
535-
["fallback"] if hasattr(fallback, "to_dict") else []
536-
),
530+
*(["fallback"] if hasattr(fallback, "to_dict") else []),
537531
],
538532
simple_properties=[
539533
"type",
@@ -545,9 +539,7 @@ def __init__(
545539
"size",
546540
"style",
547541
"width",
548-
*(
549-
[] if hasattr(fallback, "to_dict") else ["fallback"]
550-
),
542+
*([] if hasattr(fallback, "to_dict") else ["fallback"]),
551543
"separator",
552544
"spacing",
553545
"id",
@@ -726,17 +718,13 @@ def __init__(
726718
super().__init__(
727719
serializable_properties=[
728720
"sources",
729-
*(
730-
["fallback"] if hasattr(fallback, "to_dict") else []
731-
),
721+
*(["fallback"] if hasattr(fallback, "to_dict") else []),
732722
],
733723
simple_properties=[
734724
"type",
735725
"poster",
736726
"altText",
737-
*(
738-
[] if hasattr(fallback, "to_dict") else ["fallback"]
739-
),
727+
*([] if hasattr(fallback, "to_dict") else ["fallback"]),
740728
"height",
741729
"separator",
742730
"spacing",
@@ -954,16 +942,12 @@ def __init__(
954942
super().__init__(
955943
serializable_properties=[
956944
"inlines",
957-
*(
958-
["fallback"] if hasattr(fallback, "to_dict") else []
959-
),
945+
*(["fallback"] if hasattr(fallback, "to_dict") else []),
960946
],
961947
simple_properties=[
962948
"type",
963949
"horizontalAlignment",
964-
*(
965-
[] if hasattr(fallback, "to_dict") else ["fallback"]
966-
),
950+
*([] if hasattr(fallback, "to_dict") else ["fallback"]),
967951
"height",
968952
"separator",
969953
"spacing",

src/webexpythonsdk/models/cards/cards.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,8 @@ def __init__(
219219
"actions",
220220
"selectAction",
221221
*(
222-
["backgroundImage"] if hasattr(backgroundImage, "to_dict")
222+
["backgroundImage"]
223+
if hasattr(backgroundImage, "to_dict")
223224
else []
224225
),
225226
],
@@ -228,7 +229,8 @@ def __init__(
228229
"version",
229230
"fallbackText",
230231
*(
231-
[] if hasattr(backgroundImage, "to_dict")
232+
[]
233+
if hasattr(backgroundImage, "to_dict")
232234
else ["backgroundImage"]
233235
),
234236
"minHeight",

src/webexpythonsdk/models/cards/containers.py

+22-42
Original file line numberDiff line numberDiff line change
@@ -186,15 +186,11 @@ def __init__(
186186
super().__init__(
187187
serializable_properties=[
188188
"actions",
189-
*(
190-
["fallback"] if hasattr(fallback, "to_dict") else []
191-
),
189+
*(["fallback"] if hasattr(fallback, "to_dict") else []),
192190
],
193191
simple_properties=[
194192
"type",
195-
*(
196-
[] if hasattr(fallback, "to_dict") else ["fallback"]
197-
),
193+
*([] if hasattr(fallback, "to_dict") else ["fallback"]),
198194
"height",
199195
"separator",
200196
"spacing",
@@ -455,26 +451,24 @@ def __init__(
455451
"items",
456452
"selectAction",
457453
*(
458-
["backgroundImage"] if hasattr(backgroundImage, "to_dict")
454+
["backgroundImage"]
455+
if hasattr(backgroundImage, "to_dict")
459456
else []
460457
),
461-
*(
462-
["fallback"] if hasattr(fallback, "to_dict") else []
463-
),
458+
*(["fallback"] if hasattr(fallback, "to_dict") else []),
464459
],
465460
simple_properties=[
466461
"type",
467462
"style",
468463
"verticalContentAlignment",
469464
"bleed",
470465
*(
471-
[] if hasattr(backgroundImage, "to_dict")
466+
[]
467+
if hasattr(backgroundImage, "to_dict")
472468
else ["backgroundImage"]
473469
),
474470
"minHeight",
475-
*(
476-
[] if hasattr(fallback, "to_dict") else ["fallback"]
477-
),
471+
*([] if hasattr(fallback, "to_dict") else ["fallback"]),
478472
"height",
479473
"separator",
480474
"spacing",
@@ -504,7 +498,7 @@ def __init__(
504498
minHeight: str = None,
505499
horizontalAlignment: OPTIONS.HorizontalAlignment = None,
506500
fallback: object = None,
507-
height: OPTIONS.BlockElementHeight=None,
501+
height: OPTIONS.BlockElementHeight = None,
508502
separator: bool = None,
509503
spacing: OPTIONS.Spacing = None,
510504
id: str = None,
@@ -698,19 +692,15 @@ def __init__(
698692
serializable_properties=[
699693
"columns",
700694
"selectAction",
701-
*(
702-
["fallback"] if hasattr(fallback, "to_dict") else []
703-
),
695+
*(["fallback"] if hasattr(fallback, "to_dict") else []),
704696
],
705697
simple_properties=[
706698
"type",
707699
"style",
708700
"bleed",
709701
"minHeight",
710702
"horizontalAlignment",
711-
*(
712-
[] if hasattr(fallback, "to_dict") else ["fallback"]
713-
),
703+
*([] if hasattr(fallback, "to_dict") else ["fallback"]),
714704
"height",
715705
"separator",
716706
"spacing",
@@ -959,24 +949,22 @@ def __init__(
959949
serializable_properties=[
960950
"items",
961951
*(
962-
["backgroundImage"] if hasattr(backgroundImage, "to_dict")
952+
["backgroundImage"]
953+
if hasattr(backgroundImage, "to_dict")
963954
else []
964955
),
965-
*(
966-
["fallback"] if hasattr(fallback, "to_dict") else []
967-
),
956+
*(["fallback"] if hasattr(fallback, "to_dict") else []),
968957
"selectAction",
969958
],
970959
simple_properties=[
971960
"type",
972961
*(
973-
[] if hasattr(backgroundImage, "to_dict")
962+
[]
963+
if hasattr(backgroundImage, "to_dict")
974964
else ["backgroundImage"]
975965
),
976966
"bleed",
977-
*(
978-
[] if hasattr(fallback, "to_dict") else ["fallback"]
979-
),
967+
*([] if hasattr(fallback, "to_dict") else ["fallback"]),
980968
"minHeight",
981969
"separator",
982970
"spacing",
@@ -1135,15 +1123,11 @@ def __init__(
11351123
super().__init__(
11361124
serializable_properties=[
11371125
"facts",
1138-
*(
1139-
["fallback"] if hasattr(fallback, "to_dict") else []
1140-
),
1126+
*(["fallback"] if hasattr(fallback, "to_dict") else []),
11411127
],
11421128
simple_properties=[
11431129
"type",
1144-
*(
1145-
[] if hasattr(fallback, "to_dict") else ["fallback"]
1146-
),
1130+
*([] if hasattr(fallback, "to_dict") else ["fallback"]),
11471131
"height",
11481132
"separator",
11491133
"id",
@@ -1215,7 +1199,7 @@ def __init__(
12151199
height: OPTIONS.BlockElementHeight = None,
12161200
separator: bool = None,
12171201
spacing: OPTIONS.Spacing = None,
1218-
id: str = None,
1202+
id: str = None,
12191203
isVisible: bool = True,
12201204
requires: dict[str, str] = None,
12211205
):
@@ -1357,16 +1341,12 @@ def __init__(
13571341
super().__init__(
13581342
serializable_properties=[
13591343
"images",
1360-
*(
1361-
["fallback"] if hasattr(fallback, "to_dict") else []
1362-
),
1344+
*(["fallback"] if hasattr(fallback, "to_dict") else []),
13631345
],
13641346
simple_properties=[
13651347
"type",
13661348
"imageSize",
1367-
*(
1368-
[] if hasattr(fallback, "to_dict") else ["fallback"]
1369-
),
1349+
*([] if hasattr(fallback, "to_dict") else ["fallback"]),
13701350
"height",
13711351
"separator",
13721352
"spacing",

0 commit comments

Comments
 (0)