diff --git a/pyschool/school.ipynb b/pyschool/school.ipynb index 3ea9f3b..0569292 100644 --- a/pyschool/school.ipynb +++ b/pyschool/school.ipynb @@ -16,11 +16,7 @@ "cell_type": "code", "id": "initial_id", "metadata": { - "collapsed": true, - "ExecuteTime": { - "end_time": "2024-10-16T22:07:39.654858Z", - "start_time": "2024-10-16T22:07:39.651583Z" - } + "collapsed": true }, "source": [ "from users.user import User\n", @@ -28,7 +24,7 @@ "from pyrsistent import m\n" ], "outputs": [], - "execution_count": 5 + "execution_count": null }, { "metadata": {}, @@ -41,15 +37,10 @@ "id": "e096dacdce185e62" }, { - "metadata": { - "ExecuteTime": { - "end_time": "2024-10-16T22:07:39.708358Z", - "start_time": "2024-10-16T22:07:39.699756Z" - } - }, + "metadata": {}, "cell_type": "code", "source": [ - " # Création d'un objet avec des données Pyrsistent\n", + "# Création d'un objet avec des données Pyrsistent\n", "signup_data = m(\n", " login=\"johndoe\",\n", " password=\"secret\",\n", @@ -64,89 +55,38 @@ "# Utilisation de copy qui a été vérifié comme fonctionnel\n", "new_signup = signup.copy(update={\"email\": \"janedoe@example.com\"})\n", "\n", - "print(\"Original signup:\", signup)\n", - "print(\"New signup:\", new_signup)\n", - "\n", - "# Démonstration de la conversion retour vers Pyrsistent\n", "persistent_data = new_signup.to_persistent()\n", - "print(\"Données Pyrsistent:\", persistent_data)\n", - "\n", - "print(f\"to_json : {new_signup.to_json()}\")\n", - "\n", - "print(f\"to_xml : {new_signup.to_xml()}\")\n", - "\n", - "print(f\"to_schema json : {new_signup.to_schema()}\")\n", - "\n", - "print(f\"to_schema yaml : {new_signup.to_schema(\"yaml\")}\")\n", "\n", - "print(f\"to_dtd : {new_signup.to_dtd()}\")\n", "\n", - "print(f\"to_xsd : {new_signup.to_xsd()}\")" + "def display_school(signup: Signup, new_signup: Signup, persistent_data):\n", + " print(\"Original signup:\", signup)\n", + " print(\"New signup:\", new_signup)\n", + " # Démonstration de la conversion retour vers Pyrsistent\n", + " print(\"Données Pyrsistent:\", persistent_data)\n", + " print(f\"to_json : {new_signup.to_json()}\")\n", + " print(f\"to_xml : {new_signup.to_xml()}\")\n", + " print(f\"to_schema json : {new_signup.to_schema()}\")\n", + " print(f\"to_schema yaml : {new_signup.to_schema(\"yaml\")}\")\n", + " print(f\"to_dtd : {new_signup.to_dtd()}\")\n", + " print(f\"to_xsd : {new_signup.to_xsd()}\")" ], "id": "5c4584174cb83ecf", - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Original signup: login='johndoe' password='secret' repassword='secret' email='johndoe@example.com'\n", - "New signup: login='johndoe' password='secret' repassword='secret' email='janedoe@example.com'\n", - "Données Pyrsistent: pmap({'login': 'johndoe', 'email': 'janedoe@example.com', 'password': 'secret', 'repassword': 'secret'})\n", - "to_json : {\"login\": \"johndoe\", \"password\": \"secret\", \"repassword\": \"secret\", \"email\": \"janedoe@example.com\"}\n", - "to_xml : johndoesecretsecretjanedoe@example.com\n", - "to_schema json : {'type': 'object', 'properties': {'login': {'type': 'str'}, 'password': {'type': 'str'}, 'repassword': {'type': 'str'}, 'email': {'type': 'str'}}}\n", - "to_schema yaml : properties:\n", - " email:\n", - " type: str\n", - " login:\n", - " type: str\n", - " password:\n", - " type: str\n", - " repassword:\n", - " type: str\n", - "type: object\n", - "\n", - "to_dtd : , , , )>\n", - "to_xsd : \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " Field: login\n", - " \n", - " \n", - " \n", - " \n", - " Field: password\n", - " \n", - " \n", - " \n", - " \n", - " Field: repassword\n", - " \n", - " \n", - " \n", - " \n", - " Field: email\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n" - ] - } - ], - "execution_count": 6 + "outputs": [], + "execution_count": null }, { "metadata": {}, "cell_type": "markdown", "source": "## Générons des users\n", "id": "b30c01bf323eb272" + }, + { + "metadata": {}, + "cell_type": "code", + "source": "display_school(signup, new_signup, persistent_data)", + "id": "cb2eac54d0494e00", + "outputs": [], + "execution_count": null } ], "metadata": {