Commit e7fc2c5
committed
Define Registry.__rmatmul__ for adding resources.
I can't resist a bit of over-the-top fun. This is a (useful) shortcut
for adding a resource (or multiple resources) to a registry where the
URI you want to use is specifically the resource's internal ID.
It *must* have one to use this, otherwise you get an error, which is a
benefit over using `with_resource` -- which will happily not error if
you pass it `resource.id()` but that returned None.
That being said, Registries already have 3 methods named with_<foo> for
adding resource-like things to themselves, so I didn't want to add a
fourth and risk users getting even more confused as to which they should
use.
Using @ seems like the sort of thing that "pOwEr UsErS" will find, and
more casual users who just want to figure out something working will not
be distracted by.1 parent e4b215c commit e7fc2c5
File tree
4 files changed
+101
-16
lines changed- docs
- referencing
- tests
4 files changed
+101
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
279 | 318 | | |
280 | 319 | | |
281 | 320 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
11 | 16 | | |
12 | 17 | | |
13 | 18 | | |
| |||
23 | 28 | | |
24 | 29 | | |
25 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
26 | 50 | | |
27 | 51 | | |
28 | 52 | | |
| |||
64 | 88 | | |
65 | 89 | | |
66 | 90 | | |
67 | | - | |
| 91 | + | |
68 | 92 | | |
69 | 93 | | |
70 | 94 | | |
| |||
76 | 100 | | |
77 | 101 | | |
78 | 102 | | |
79 | | - | |
| 103 | + | |
80 | 104 | | |
81 | 105 | | |
82 | 106 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
59 | 83 | | |
60 | 84 | | |
61 | 85 | | |
| |||
98 | 122 | | |
99 | 123 | | |
100 | 124 | | |
101 | | - | |
| 125 | + | |
102 | 126 | | |
103 | 127 | | |
104 | 128 | | |
| |||
109 | 133 | | |
110 | 134 | | |
111 | 135 | | |
112 | | - | |
| 136 | + | |
113 | 137 | | |
114 | 138 | | |
115 | 139 | | |
| |||
173 | 197 | | |
174 | 198 | | |
175 | 199 | | |
176 | | - | |
| 200 | + | |
177 | 201 | | |
178 | 202 | | |
179 | 203 | | |
| |||
637 | 661 | | |
638 | 662 | | |
639 | 663 | | |
640 | | - | |
641 | | - | |
| 664 | + | |
| 665 | + | |
642 | 666 | | |
643 | 667 | | |
644 | 668 | | |
| |||
648 | 672 | | |
649 | 673 | | |
650 | 674 | | |
651 | | - | |
652 | | - | |
| 675 | + | |
| 676 | + | |
653 | 677 | | |
654 | 678 | | |
655 | 679 | | |
| |||
756 | 780 | | |
757 | 781 | | |
758 | 782 | | |
759 | | - | |
| 783 | + | |
760 | 784 | | |
761 | 785 | | |
762 | 786 | | |
| |||
783 | 807 | | |
784 | 808 | | |
785 | 809 | | |
786 | | - | |
| 810 | + | |
787 | 811 | | |
788 | 812 | | |
789 | 813 | | |
| |||
814 | 838 | | |
815 | 839 | | |
816 | 840 | | |
817 | | - | |
818 | | - | |
819 | | - | |
| 841 | + | |
820 | 842 | | |
821 | 843 | | |
822 | 844 | | |
| |||
0 commit comments