Commit f13e7ef
authored
Fix Python docs: correct Py.Decorator to Py.Decorate (#227)
* Fix Python docs: correct Py.Decorator to Py.Decorate and fix examples
- Rename Py.Decorator to Py.Decorate (the actual API name)
- Replace record example with class example (records already compile to
@DataClass automatically, and Py.Decorate cannot be used on records)
- Remove function decorator example (Fable doesn't support attributes on
functions, only on types)
- Add single-argument form example for local decorators
- Move Class Attributes section before Python Decorators since the
decorator example references Py.ClassAttributes
* Add ClassAttributes options table and Py.DataClass shorthand to docs
Explain the different style and init parameters for Py.ClassAttributes,
and document Py.DataClass as a shorthand for frameworks like Pydantic.
* Add DecorateTemplate section for library authors
Document Py.DecorateTemplate for creating reusable custom decorator
attributes, with a web framework route decorator as an example.1 parent 5d38a6d commit f13e7ef
1 file changed
Lines changed: 68 additions & 30 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
458 | 458 | | |
459 | 459 | | |
460 | 460 | | |
461 | | - | |
| 461 | + | |
462 | 462 | | |
463 | 463 | | |
464 | 464 | | |
465 | 465 | | |
466 | 466 | | |
467 | | - | |
| 467 | + | |
468 | 468 | | |
469 | 469 | | |
470 | 470 | | |
471 | 471 | | |
472 | | - | |
473 | | - | |
474 | | - | |
475 | | - | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
476 | 476 | | |
477 | 477 | | |
478 | 478 | | |
479 | 479 | | |
480 | 480 | | |
481 | | - | |
482 | | - | |
483 | | - | |
484 | | - | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
485 | 484 | | |
486 | 485 | | |
487 | | - | |
| 486 | + | |
488 | 487 | | |
489 | | - | |
490 | | - | |
491 | | - | |
492 | | - | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
493 | 494 | | |
494 | | - | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
495 | 498 | | |
496 | | - | |
497 | | - | |
498 | | - | |
499 | | - | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
500 | 505 | | |
501 | 506 | | |
502 | | - | |
| 507 | + | |
503 | 508 | | |
504 | 509 | | |
505 | 510 | | |
506 | 511 | | |
507 | 512 | | |
508 | | - | |
| 513 | + | |
509 | 514 | | |
510 | 515 | | |
511 | 516 | | |
512 | 517 | | |
513 | | - | |
514 | | - | |
515 | | - | |
516 | | - | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
517 | 523 | | |
518 | 524 | | |
519 | 525 | | |
520 | 526 | | |
521 | 527 | | |
522 | | - | |
523 | | - | |
524 | | - | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
525 | 532 | | |
526 | 533 | | |
527 | | - | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
528 | 566 | | |
529 | 567 | | |
530 | 568 | | |
| |||
0 commit comments