Skip to content

Commit d4719e1

Browse files
koubaaMohamed Koubaapyansys-ci-bot
authored
fix: Allow setting option fields to None (#713)
Co-authored-by: Mohamed Koubaa <[email protected]> Co-authored-by: pyansys-ci-bot <[email protected]>
1 parent bc3e536 commit d4719e1

File tree

1,649 files changed

+11511
-11499
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,649 files changed

+11511
-11499
lines changed

codegen/templates/keyword/card_properties.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@
5555
@{{field.property_name}}.setter
5656
def {{field.property_name}}(self, value: {{field.type}}) -> None:
5757
{% if field.options is defined %}
58-
if value not in [{{ field.options|join(', ')}}]:
59-
raise Exception("""{{field.property_name}} must be one of {{openbrace}}{{ field.options|join(',')}}{{closebrace}}""")
58+
if value not in [{{ field.options|join(', ')}}, None]:
59+
raise Exception("""{{field.property_name}} must be `None` or one of {{openbrace}}{{ field.options|join(',')}}{{closebrace}}""")
6060
{% endif %}
6161
{% if field.card_indices %}
6262
{% for card_index in field.card_indices %}

doc/changelog/713.miscellaneous.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fix: Allow setting option fields to None

src/ansys/dyna/core/keywords/keyword_classes/auto/airbag_adiabatic_gas_model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ def sidtyp(self) -> int:
162162

163163
@sidtyp.setter
164164
def sidtyp(self, value: int) -> None:
165-
if value not in [0, 1]:
166-
raise Exception("""sidtyp must be one of {0,1}""")
165+
if value not in [0, 1, None]:
166+
raise Exception("""sidtyp must be `None` or one of {0,1}""")
167167
self._cards[0].set_value("sidtyp", value)
168168

169169
@property

src/ansys/dyna/core/keywords/keyword_classes/auto/airbag_adiabatic_gas_model_id.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ def sidtyp(self) -> int:
200200

201201
@sidtyp.setter
202202
def sidtyp(self, value: int) -> None:
203-
if value not in [0, 1]:
204-
raise Exception("""sidtyp must be one of {0,1}""")
203+
if value not in [0, 1, None]:
204+
raise Exception("""sidtyp must be `None` or one of {0,1}""")
205205
self._cards[1].set_value("sidtyp", value)
206206

207207
@property

src/ansys/dyna/core/keywords/keyword_classes/auto/airbag_ale.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -597,8 +597,8 @@ def sidtyp(self) -> int:
597597

598598
@sidtyp.setter
599599
def sidtyp(self, value: int) -> None:
600-
if value not in [0, 1]:
601-
raise Exception("""sidtyp must be one of {0,1}""")
600+
if value not in [0, 1, None]:
601+
raise Exception("""sidtyp must be `None` or one of {0,1}""")
602602
self._cards[0].set_value("sidtyp", value)
603603

604604
@property
@@ -752,8 +752,8 @@ def normtyp(self) -> int:
752752

753753
@normtyp.setter
754754
def normtyp(self, value: int) -> None:
755-
if value not in [0, 1]:
756-
raise Exception("""normtyp must be one of {0,1}""")
755+
if value not in [0, 1, None]:
756+
raise Exception("""normtyp must be `None` or one of {0,1}""")
757757
self._cards[2].set_value("normtyp", value)
758758

759759
@property
@@ -797,8 +797,8 @@ def ivtype(self) -> int:
797797

798798
@ivtype.setter
799799
def ivtype(self, value: int) -> None:
800-
if value not in [0, 1, 2]:
801-
raise Exception("""ivtype must be one of {0,1,2}""")
800+
if value not in [0, 1, 2, None]:
801+
raise Exception("""ivtype must be `None` or one of {0,1,2}""")
802802
self._cards[3].set_value("ivtype", value)
803803

804804
@property

src/ansys/dyna/core/keywords/keyword_classes/auto/airbag_fluid_and_gas.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,8 @@ def sidtyp(self) -> int:
222222

223223
@sidtyp.setter
224224
def sidtyp(self, value: int) -> None:
225-
if value not in [0, 1]:
226-
raise Exception("""sidtyp must be one of {0,1}""")
225+
if value not in [0, 1, None]:
226+
raise Exception("""sidtyp must be `None` or one of {0,1}""")
227227
self._cards[0].set_value("sidtyp", value)
228228

229229
@property

src/ansys/dyna/core/keywords/keyword_classes/auto/airbag_fluid_and_gas_id.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,8 @@ def sidtyp(self) -> int:
260260

261261
@sidtyp.setter
262262
def sidtyp(self, value: int) -> None:
263-
if value not in [0, 1]:
264-
raise Exception("""sidtyp must be one of {0,1}""")
263+
if value not in [0, 1, None]:
264+
raise Exception("""sidtyp must be `None` or one of {0,1}""")
265265
self._cards[1].set_value("sidtyp", value)
266266

267267
@property

src/ansys/dyna/core/keywords/keyword_classes/auto/airbag_hybrid.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,8 @@ def sidtyp(self) -> int:
339339

340340
@sidtyp.setter
341341
def sidtyp(self, value: int) -> None:
342-
if value not in [0, 1]:
343-
raise Exception("""sidtyp must be one of {0,1}""")
342+
if value not in [0, 1, None]:
343+
raise Exception("""sidtyp must be `None` or one of {0,1}""")
344344
self._cards[0].set_value("sidtyp", value)
345345

346346
@property
@@ -563,8 +563,8 @@ def opt(self) -> int:
563563

564564
@opt.setter
565565
def opt(self, value: int) -> None:
566-
if value not in [0, 1, 2, 3, 4, 5, 6, 7, 8]:
567-
raise Exception("""opt must be one of {0,1,2,3,4,5,6,7,8}""")
566+
if value not in [0, 1, 2, 3, 4, 5, 6, 7, 8, None]:
567+
raise Exception("""opt must be `None` or one of {0,1,2,3,4,5,6,7,8}""")
568568
self._cards[3].set_value("opt", value)
569569

570570
@property

src/ansys/dyna/core/keywords/keyword_classes/auto/airbag_hybrid_chemkin.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,8 @@ def sidtyp(self) -> int:
407407

408408
@sidtyp.setter
409409
def sidtyp(self, value: int) -> None:
410-
if value not in [0, 1]:
411-
raise Exception("""sidtyp must be one of {0,1}""")
410+
if value not in [0, 1, None]:
411+
raise Exception("""sidtyp must be `None` or one of {0,1}""")
412412
self._cards[0].set_value("sidtyp", value)
413413

414414
@property
@@ -519,8 +519,8 @@ def data(self) -> int:
519519

520520
@data.setter
521521
def data(self, value: int) -> None:
522-
if value not in [0, 1, 2, 3]:
523-
raise Exception("""data must be one of {0,1,2,3}""")
522+
if value not in [0, 1, 2, 3, None]:
523+
raise Exception("""data must be `None` or one of {0,1,2,3}""")
524524
self._cards[1].set_value("data", value)
525525

526526
@property

src/ansys/dyna/core/keywords/keyword_classes/auto/airbag_hybrid_chemkin_id.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,8 @@ def sidtyp(self) -> int:
445445

446446
@sidtyp.setter
447447
def sidtyp(self, value: int) -> None:
448-
if value not in [0, 1]:
449-
raise Exception("""sidtyp must be one of {0,1}""")
448+
if value not in [0, 1, None]:
449+
raise Exception("""sidtyp must be `None` or one of {0,1}""")
450450
self._cards[1].set_value("sidtyp", value)
451451

452452
@property
@@ -557,8 +557,8 @@ def data(self) -> int:
557557

558558
@data.setter
559559
def data(self, value: int) -> None:
560-
if value not in [0, 1, 2, 3]:
561-
raise Exception("""data must be one of {0,1,2,3}""")
560+
if value not in [0, 1, 2, 3, None]:
561+
raise Exception("""data must be `None` or one of {0,1,2,3}""")
562562
self._cards[2].set_value("data", value)
563563

564564
@property

0 commit comments

Comments
 (0)