mirror of
				https://github.com/gsi-upm/sitc
				synced 2025-10-31 07:28:17 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			154 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			154 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| {
 | |
|  "cells": [
 | |
|   {
 | |
|    "cell_type": "markdown",
 | |
|    "metadata": {},
 | |
|    "source": [
 | |
|     ""
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "markdown",
 | |
|    "metadata": {},
 | |
|    "source": [
 | |
|     "# Course Notes for Learning Intelligent Systems"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "markdown",
 | |
|    "metadata": {},
 | |
|    "source": [
 | |
|     "Department of Telematic Engineering Systems, Universidad Politécnica de Madrid, © Carlos A. Iglesias"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "markdown",
 | |
|    "metadata": {},
 | |
|    "source": [
 | |
|     "# Modules and Packages\n",
 | |
|     "\n",
 | |
|     "*Modules* contains definitions and objects that can be reused in other programmes.\n",
 | |
|     "\n",
 | |
|     "*Packages* contain subpackages of modules. They are directories and provide the namespace for modules.\n",
 | |
|     "\n",
 | |
|     "For example, let's have this package babel, a subpackage messages and the modules plurals and catalog:\n",
 | |
|     "\n",
 | |
|     "<code>\n",
 | |
|     "babel/\n",
 | |
|     "    messages/\n",
 | |
|     "        \\_\\_init\\_\\_.py\n",
 | |
|     "        plurals.py\n",
 | |
|     "        catalog.py\n",
 | |
|     "</code>\n",
 | |
|     "\n"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": null,
 | |
|    "metadata": {},
 | |
|    "outputs": [],
 | |
|    "source": [
 | |
|     "# We can import the module plural with import, but we should use the full name\n",
 | |
|     "import babel.messages.plurals\n",
 | |
|     "plurals.get_plural()"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": null,
 | |
|    "metadata": {},
 | |
|    "outputs": [],
 | |
|    "source": [
 | |
|     "import babel.messages.plurals\n",
 | |
|     "babel.messages.plurals.get_plural()"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": null,
 | |
|    "metadata": {},
 | |
|    "outputs": [],
 | |
|    "source": [
 | |
|     "from babel.messages import plurals # with from-import, we can use the short name\n",
 | |
|     "plurals.get_plural()"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": null,
 | |
|    "metadata": {},
 | |
|    "outputs": [],
 | |
|    "source": [
 | |
|     "from babel.messages.plurals import get_plural # now we can use directly get_plural()\n",
 | |
|     "get_plural()"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "markdown",
 | |
|    "metadata": {},
 | |
|    "source": [
 | |
|     "To write a module, it is just needed to include the code in a file ended with \".py\" and the name of the file is the name of the module.\n",
 | |
|     "\n",
 | |
|     "Packages are directories that should have a file \\_\\_.init\\_\\_.py, that can be an empty file or contain initialization code.\n",
 | |
|     "\n",
 | |
|     "Read [this](https://packaging.python.org/en/latest/) if you want to distribute your modules"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "markdown",
 | |
|    "metadata": {},
 | |
|    "source": [
 | |
|     "# Licence"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "markdown",
 | |
|    "metadata": {},
 | |
|    "source": [
 | |
|     "The notebook is freely licensed under under the [Creative Commons Attribution Share-Alike license](https://creativecommons.org/licenses/by/2.0/).  \n",
 | |
|     "\n",
 | |
|     "© Carlos A. Iglesias, Universidad Politécnica de Madrid."
 | |
|    ]
 | |
|   }
 | |
|  ],
 | |
|  "metadata": {
 | |
|   "kernelspec": {
 | |
|    "display_name": "Python 3",
 | |
|    "language": "python",
 | |
|    "name": "python3"
 | |
|   },
 | |
|   "language_info": {
 | |
|    "codemirror_mode": {
 | |
|     "name": "ipython",
 | |
|     "version": 3
 | |
|    },
 | |
|    "file_extension": ".py",
 | |
|    "mimetype": "text/x-python",
 | |
|    "name": "python",
 | |
|    "nbconvert_exporter": "python",
 | |
|    "pygments_lexer": "ipython3",
 | |
|    "version": "3.7.1"
 | |
|   },
 | |
|   "latex_envs": {
 | |
|    "LaTeX_envs_menu_present": true,
 | |
|    "autocomplete": true,
 | |
|    "bibliofile": "biblio.bib",
 | |
|    "cite_by": "apalike",
 | |
|    "current_citInitial": 1,
 | |
|    "eqLabelWithNumbers": true,
 | |
|    "eqNumInitial": 1,
 | |
|    "hotkeys": {
 | |
|     "equation": "Ctrl-E",
 | |
|     "itemize": "Ctrl-I"
 | |
|    },
 | |
|    "labels_anchors": false,
 | |
|    "latex_user_defs": false,
 | |
|    "report_style_numbering": false,
 | |
|    "user_envs_cfg": false
 | |
|   }
 | |
|  },
 | |
|  "nbformat": 4,
 | |
|  "nbformat_minor": 1
 | |
| }
 |