{ "info": { "author": "David Ma", "author_email": "davidma@davidma.cn", "bugtrack_url": null, "classifiers": [], "description": "# Oven\nAn util package that includes algorithms, functions and IO similar to that of other languages' standard library.\n\n## Installation\nInstallation with pip is recommended.\n```sh\npip install oven\n```\n\n## Table of Contents\n\n- [Standard I/O](#standard-io)\n\t- [Creating Session](#creating-session)\n\t- [Calling cin/cout](#calling-cincout)\n- [Pointer](#pointer)\n\t- [Instantiating Pointers](#instantiating-pointers)\n\t- [Calling Pointers](#calling-pointers)\n- [Structs](#structs)\n\t- [Stack](#stack)\n\t- [Queue](#queue)\n\t- [Tree](#tree)\n\t- [Binary Tree](#binarytree)\n\n## Standard I/O\nThe [stdio](/oven/stdio) package includes convient functions to redefine basic I/O.\n\n```python\nfrom oven.stdio import *\n```\n\n### Creating Session\n\nThe [stdio](/oven/stdio) session is required in order to call any I/O functions. A session is created as such:\n```python\nset_io(IO_STREAM, 'path/to/file', METHOD)\n```\n\nThe *IO_STREAM* can be any of:\n* stdio.FILE: Redirect the IO stream to a file\n* stdio.CONSOLE: Redirect the IO stream to the console\n\nThe *METHOD* can be any of:\n* *r* : Read from a file\n* *w* : Write to a file, create/override if nessesary\n* *a* : Append to a file, create if nessesary\n\nMethod *w* overrides the file and dump all output from the session, while *a* append all output from the session to the end of the file.\n\nIf the *IO_STREAM* is set to *CONSOLE*, then the *path* argument will be ignored.\n\nNote that the [stdio]() session is created on the global scope, therefore one session will always suffice for one method of IO action.\n\nAn example is given below. This code reads a line of input from a file and print it to the screen.\n```python\nfrom oven.stdio import *\n\nset_io(FILE, 'text.in', 'r')\nset_io(CONSOLE, None, 'w')\n\ntext = cin()\ncout(text)\n```\n\n### Calling cin/cout\nDespite the name, the cin/cout also applies to file IO.\n```python\ncin() # Read one line.\ncout('Hello World') # Write. Note that \\n is not added at the end.\n```\n\n## Pointer\nThe [Pointer](/oven/pointer) package includes a pointer object.\n\n```python\nfrom oven.pointer import Pointer\n```\n\n### Instantiating Pointers\nA [Pointer](/oven/pointer) is created as such:\n```python\nptr_1 = Pointer()\nptr_2 = Pointer(INIT_VALUE)\n```\n\n### Calling Pointers\nGetting value from pointer:\n```python\nvalue = ptr()\n```\n\nAssigning value to pointer:\n```python\nptr(value)\n```\n\n## Structs\nThe [structs](/oven/structs) package features some data structures.\n\n```python\nfrom oven.structs import *\n```\n\n### Stack\n```python\nfrom oven.structs import Stack\n```\n\nThe [Stack](/oven/structs/stack.py) class is a subclass of python's list, its methods are:\n* *push* : Push a value to the stack\n* *pop* : Remove and return the ending element of the stack\n\n### Queue\n```python\nfrom oven.structs import Queue\n```\n\nThe [Queue](/oven/structs/queue.py) class is a subclass of python's list, its methods are:\n* *push* : Push a value to the queue\n* *pop* : Remove and return the starting element of the queue\n\n### Tree\n```python\nfrom oven.structs import Tree\n```\n\nThe [Tree](/oven/structs/tree.py) class is a recursive node of a tree. The value of the node can be assigned either in the constructor or by calling the *value* attribute (variable).\n```python\n# Both nodes are tree nodes with the value 42\n\nnode_1 = Tree(42)\n\nnode_2 = Tree()\nnode_2.value = 42\n```\n\nA child can be added to a node by calling the *addChild* method and passing the child as the parameter. The children of a node can be accessed by calling the *children* attribute (variable).\n\nOther methods include:\n* *dfs* : Returns a list of the tree's nodes in *depth first search* order.\n* *bfs* : Returns a list of the tree's nodes in *breadth first search* order.\n\n### BinaryTree\n```python\nfrom oven.structs import BinaryTree\n```\n\nThe [BinaryTree](/oven/structs/binarytree.py) class is a subclass of the [Tree](/oven/structs/tree.py) class. The *left* and *right* children can be accessed by:\n```python\nnode.left() # Returns the left node\nnode.right() # Returns the right node\n\nnode.left(newNode) # Sets the left node\nnode.right(newNode) # Sets the right node\n```\n\nDue to this, the *addChild* method is removed.\n\nAll other methods are identical to that of the [Tree](/oven/structs/tree.py) class except the *dfs* method, which is tweaked so that the calling of it becomes:\n```python\nnode.dfs(MODE)\n```\n\nThe *MODE* can be any of:\n* *PREORDER*\n* *INORDER*\n* *POSTORDER*\n\nAll of the above modes are imported as such:\n```python\nfrom oven.structs import PREORDER, INORDER, POSTORDER\n```\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/davidmaamoaix/Oven", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "oven", "package_url": "https://pypi.org/project/oven/", "platform": "", "project_url": "https://pypi.org/project/oven/", "project_urls": { "Homepage": "https://github.com/davidmaamoaix/Oven" }, "release_url": "https://pypi.org/project/oven/0.1.0/", "requires_dist": null, "requires_python": "", "summary": "An util package that includes features from other languages' stdlib.", "version": "0.1.0" }, "last_serial": 4559029, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "d507882f0c2ca499d26a2fd06f0dda5d", "sha256": "115b8958a9d1ca501e1e6ec48798ef4f9d3103afe07f15bd3a92fcf16317c8ac" }, "downloads": -1, "filename": "oven-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "d507882f0c2ca499d26a2fd06f0dda5d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8284, "upload_time": "2018-12-04T10:08:57", "url": "https://files.pythonhosted.org/packages/08/66/aa65b3128ca0ececec4a4601d292d69e9e87d531456c11c08b89c37abc16/oven-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e9c14eeaa73927b367743af84b84f225", "sha256": "df6876b446809e1fb319c1e213d210a464c9de5a84eddaf2b7a4167f581ee251" }, "downloads": -1, "filename": "oven-0.1.0.tar.gz", "has_sig": false, "md5_digest": "e9c14eeaa73927b367743af84b84f225", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5294, "upload_time": "2018-12-04T10:09:00", "url": "https://files.pythonhosted.org/packages/27/59/5bfef19cb6699e51a2af1f9d161ea14805744720ed5ddf987a3bfa5c2c79/oven-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d507882f0c2ca499d26a2fd06f0dda5d", "sha256": "115b8958a9d1ca501e1e6ec48798ef4f9d3103afe07f15bd3a92fcf16317c8ac" }, "downloads": -1, "filename": "oven-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "d507882f0c2ca499d26a2fd06f0dda5d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8284, "upload_time": "2018-12-04T10:08:57", "url": "https://files.pythonhosted.org/packages/08/66/aa65b3128ca0ececec4a4601d292d69e9e87d531456c11c08b89c37abc16/oven-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e9c14eeaa73927b367743af84b84f225", "sha256": "df6876b446809e1fb319c1e213d210a464c9de5a84eddaf2b7a4167f581ee251" }, "downloads": -1, "filename": "oven-0.1.0.tar.gz", "has_sig": false, "md5_digest": "e9c14eeaa73927b367743af84b84f225", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5294, "upload_time": "2018-12-04T10:09:00", "url": "https://files.pythonhosted.org/packages/27/59/5bfef19cb6699e51a2af1f9d161ea14805744720ed5ddf987a3bfa5c2c79/oven-0.1.0.tar.gz" } ] }