|
637 | 637 | "source": [
|
638 | 638 | "# Let's document all storing processes in a list\n",
|
639 | 639 | "stored = []\n",
|
640 |
| - "# Let's store the entity\n", |
| 640 | + "\n", |
| 641 | + "# Storing an entity requires only one line:\n", |
641 | 642 | "res = osw_obj.store_entity(john)\n",
|
642 |
| - "stored.append(res)\n", |
643 |
| - "# In this specific case equivalent to:\n", |
644 |
| - "params = prm.StoreEntityParam(\n", |
645 |
| - " entities=[john],\n", |
646 |
| - " namespace=john.get_namespace(),\n", |
647 |
| - " parallel=False,\n", |
648 |
| - " overwrite=\"keep existing\",\n", |
649 |
| - " overwrite_per_class=None,\n", |
650 |
| - ") # All default values included\n", |
651 |
| - "# osw_obj.store_entity(params)" |
| 643 | + "\n", |
| 644 | + "# But to be able to access all storage event later on, we will append the result to the list\n", |
| 645 | + "stored.append(res)" |
652 | 646 | ],
|
653 | 647 | "id": "99cf8828bee651ee"
|
654 | 648 | },
|
|
657 | 651 | "id": "639db64348bbd905",
|
658 | 652 | "metadata": {},
|
659 | 653 | "source": [
|
660 |
| - "Like most methods and functions in the osw-python library, the `store_entity` takes only a single argument. Usually \n", |
| 654 | + "```python\n", |
| 655 | + "# In this specific case equivalent to:\n", |
| 656 | + "params = prm.StoreEntityParam(\n", |
| 657 | + " entities=[john],\n", |
| 658 | + " namespace=john.get_namespace(),\n", |
| 659 | + " parallel=False,\n", |
| 660 | + " overwrite=\"keep existing\",\n", |
| 661 | + " overwrite_per_class=None,\n", |
| 662 | + ") # All default values included\n", |
| 663 | + "stored.append(osw_obj.store_entity(params))\n", |
| 664 | + "```\n", |
| 665 | + "Like most methods and functions in the osw-python library, the `store_entity` takes only a single argument. Usually\n", |
661 | 666 | "either a specific object type or a dedicated params object is accepted. If an object of type other than the params \n",
|
662 | 667 | "object is passed, it is usually tested for compatibility and put inside a params object, filling the other parameters \n",
|
663 | 668 | "with default values. \n",
|
|
0 commit comments