Commit ddd0f84
authored
Change Hyperparameter to a dataclass. (#6426)
Change Hyperparameter to a dataclass so we can get special methods like
`__repr__` and `__eq__`. It also simplifies the code. We can do this now that we
only target versions of python > 3.7.
This also requires typing the Hyperparameter class in order for the
dataclass to be properly generated. I therefore considered also typing
the list_hyperparameters() function but there is mixed value since the
py_library() rule does not run a pytype checker.
Note that we still target Python 3.8 so we must use `Union` instead of
`|` in order to list `None` as an option.1 parent 2b68513 commit ddd0f84
1 file changed
+13
-34
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| |||
530 | 532 | | |
531 | 533 | | |
532 | 534 | | |
| 535 | + | |
533 | 536 | | |
534 | 537 | | |
535 | 538 | | |
| |||
552 | 555 | | |
553 | 556 | | |
554 | 557 | | |
555 | | - | |
556 | | - | |
557 | | - | |
558 | | - | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | | - | |
575 | | - | |
576 | | - | |
577 | | - | |
578 | | - | |
579 | | - | |
580 | | - | |
581 | | - | |
582 | | - | |
583 | | - | |
584 | | - | |
585 | | - | |
586 | | - | |
587 | | - | |
588 | | - | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
589 | 568 | | |
590 | 569 | | |
591 | 570 | | |
| |||
0 commit comments