{ "info": { "author": "BlueDynamics Alliance", "author_email": "dev@bluedynamics.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development" ], "description": "==================\nnode.ext.directory\n==================\n\nFilesystem directory abstraction based on\n`node `_.\n\n\nUsage\n=====\n\nCreate new file\n---------------\n\n.. code-block:: python\n\n from node.ext.directory import File\n\n file_path = 'file.txt'\n f = File(name=file_path)\n\n # set contents via data attribute\n f.data = 'data\\n'\n\n # set contents via lines attribute\n f.lines = ['data']\n\n # set permissions\n f.fs_mode = 0o644\n\n # persist\n f()\n\n\nRead existing file\n------------------\n\n.. code-block:: python\n\n file_path = 'file.txt'\n f = File(name=file_path)\n\n assert(f.data == 'data\\n')\n assert(f.lines == ['data'])\n assert(f.fs_mode == 0o644)\n\n\nFiles with binary data\n----------------------\n\n.. code-block:: python\n\n from node.ext.directory import MODE_BINARY\n\n file_path = 'file.txt'\n f = File(name=file_path)\n f.mode = MODE_BINARY\n\n f.data = b'\\x00\\x00'\n\n assert(f.data == b'\\x00\\x00')\n\n # lines property won't work if file in binary mode\n f.lines # raises RuntimeError\n\n\nCreate directory\n----------------\n\n.. code-block:: python\n\n from node.ext.directory import Directory\n\n dir_path = '.'\n d = Directory(name=dir_path)\n\n # add subdirectories and files\n d['sub'] = Directory()\n d['file.txt'] = File()\n\n # set permissions for directory\n d['sub'].fs_mode = 0o755\n\n # persist\n d()\n\n\nRead existing directory\n-----------------------\n\n.. code-block:: python\n\n dir_path = '.'\n d = Directory(name=dir_path)\n\n.. code-block:: pycon\n\n >>> d.printtree()\n : .\n : file.txt\n : sub\n\n\nDefine file factories\n---------------------\n\n.. code-block:: python\n\n from node.ext import directory\n\n class PyFile(File):\n pass\n\n # set global factories\n directory.file_factories['.py'] = PyFile\n\n # set local factories\n d = Directory(name='.', factories={'.py': PyFile})\n\n.. code-block:: pycon\n\n # when reading .py files, PyFile is used to instanciate children\n >>> with open('foo.py', 'w') as f:\n ... f.write('#')\n\n >>> d = Directory(name='.', factories={'.py': PyFile})\n >>> d.printtree()\n : .\n : foo.py\n\n\nTestCoverage\n============\n\n.. image:: https://travis-ci.org/bluedynamics/node.ext.directory.svg?branch=master\n :target: https://travis-ci.org/bluedynamics/node.ext.directory\n\nSummary of the test coverage report::\n\n Name Stmts Miss Cover\n ---------------------------------------------------------------------------\n src/node/ext/directory/__init__.py 7 0 100%\n src/node/ext/directory/directory.py 221 0 100%\n src/node/ext/directory/events.py 5 0 100%\n src/node/ext/directory/interfaces.py 23 0 100%\n src/node/ext/directory/tests.py 335 0 100%\n ---------------------------------------------------------------------------\n TOTAL 591 0 100%\n\n\nPython Versions\n===============\n\n- Python 2.7, 3.3+, pypy\n\n- May work with other versions (untested)\n\n\nContributors\n============\n\n- Robert Niederreiter (Author)\n\n\nTODO\n====\n\n- Documentation.\n\n- Remove lifecycle event notification on ``__setitem__`` in directory. Use\n ``node.behaviors.Lifecycle`` instead\n\n- Suppress lifecycle events in ``_create_child_by_factory``.\n\n- Remove ``Reference`` plumbing behavior from default ``File`` and\n ``Directory`` implementations.\n\n- Rename ``DirectoryStorage.factories`` to ``DirectoryStorage.file_factories``.\n\n- Use regular expressions for child factories if desired.\n\n- Introduce flag on ``DirectoryStorage`` to turn off RAM caching of children.\n\n- Introduce strict mode which prevents fallback ``File`` creation if file\n factory raises ``TypeError``.\n\n\nChanges\n=======\n\n0.7\n---\n\n- Python 3 support.\n [rnix, 2017-06-06]\n\n- ``fs_mode`` is read from filesystem if file or directory exists and\n fs_mode not set explicitely.\n [rnix, 2017-06-06]\n\n- Remove ``backup`` option from ``IDirectory`` interface. It never really\n worked properly and conceptually ``IDirectory`` is the wrong place for\n handling backups of files.\n [rnix, 2017-06-04]\n\n\n0.6\n---\n\n- Introduce ``node.ext.directory.interfaces.IFile.direct_sync`` setting.\n [rnix, 2017-01-30]\n\n- Complete ``node.ext.directory.interfaces.IFile`` and\n ``node.ext.directory.interfaces.IDirectory`` to reflect implemented features.\n [rnix, 2017-01-30]\n\n- Move ``node.ext.directory.directory.MODE_TEXT`` and\n ``node.ext.directory.directory.MODE_BINARY`` to\n ``node.ext.directory.interfaces``.\n [rnix, 2017-01-30]\n\n\n0.5.4\n-----\n\n- Check whether directory to be peristed already exists by name as file in\n ``node.ext.directory.FileStorage.__call__``.\n [rnix, 2015-10-05]\n\n- Implement fallback to ``path`` in\n ``node.ext.directory.FileStorage.__call__`` if ``fs_path`` not exists.\n [rnix, 2015-10-05]\n\n- Implement fallback to ``path`` in\n ``node.ext.directory.FileStorage._get_data`` if ``fs_path`` not exists.\n [rnix, 2015-10-05]\n\n- Set initial mode with ``self.mode`` property setter instead of internal\n ``self._mode`` in ``node.ext.directory.FileStorage._get_mode``.\n [rnix, 2015-10-05]\n\n\n0.5.3\n-----\n\n- Remove deleted keys from internal reference after ``__call__`` in order\n to return the correct result when adding a file or directory with the same\n key again.\n [rnix, 2015-07-20]\n\n\n0.5.2\n-----\n\n- Use try/except instead of iteration to check whether directory child already\n in memory.\n [rnix, 2015-05-12]\n\n\n0.5.1\n-----\n\n- Always use ``os.chmod`` for setting directory permissions, not only if\n already exists.\n [rnix, 2015-03-03]\n\n\n0.5\n---\n\n- Introduce ``fs_mode`` on directories and files.\n [rnix, 2015-03-03]\n\n\n0.4\n---\n\n- Return empty list in ``File.lines`` if no data.\n [rnix, 2015-02-18]\n\n- Consider filesystem encoding. Defaults to UTF-8.\n [rnix, 2015-02-18]\n\n- Tree locking on modification.\n [rnix, 2014-09-02]\n\n- Prevent empty keys in ``__setitem__``.\n [rnix, 2014-09-02]\n\n- Use ``plumbing`` decorator.\n [rnix, 2014-08-25]\n\n\n0.3\n---\n\n- introduce ``default_file_factory`` on directories for controlling default\n file child creation.\n [rnix, 2013-12-09]\n\n- move file logic in ``FileStorage`` behavior.\n [rnix, 2013-08-06]\n\n- make ``file_factories`` a class property on directory storage.\n [rnix, 2013-08-06]\n\n- make ``ignores`` a class property on directory storage.\n [rnix, 2013-08-06]\n\n- Cleanup interfaces.\n [rnix, 2013-08-06]\n\n\n0.2\n---\n\n- Almost complete rewrite. Fits now paradigms of node based API's.\n [rnix, 2012-01-30]\n\n\n0.1\n---\n\n- initial\n\n\n\nLicense\n=======\n\nCopyright (c) 2010-2017, BlueDynamics Alliance, Austria\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this \n list of conditions and the following disclaimer.\n* Redistributions in binary form must reproduce the above copyright notice, this \n list of conditions and the following disclaimer in the documentation and/or \n other materials provided with the distribution.\n* Neither the name of the BlueDynamics Alliance nor the names of its \n contributors may be used to endorse or promote products derived from this \n software without specific prior written permission.\n \nTHIS SOFTWARE IS PROVIDED BY BlueDynamics Alliance ``AS IS`` AND ANY\nEXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL BlueDynamics Alliance BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/bluedynamics/node.ext.directory", "keywords": "", "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "node.ext.directory", "package_url": "https://pypi.org/project/node.ext.directory/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/node.ext.directory/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/bluedynamics/node.ext.directory" }, "release_url": "https://pypi.org/project/node.ext.directory/0.7/", "requires_dist": null, "requires_python": null, "summary": "Filesystem directory abstraction based on nodes", "version": "0.7" }, "last_serial": 2931812, "releases": { "0.2": [ { "comment_text": "", "digests": { "md5": "7273064512c95e8de773b44306b85e3e", "sha256": "7904f0eb14c84a99864814ba9369a557222740814d1dc30035135e61ac08b5c0" }, "downloads": -1, "filename": "node.ext.directory-0.2.tar.gz", "has_sig": false, "md5_digest": "7273064512c95e8de773b44306b85e3e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6637, "upload_time": "2013-02-22T16:47:48", "url": "https://files.pythonhosted.org/packages/e8/13/aa22df96b4beaeeda3adc8a0e54ae853758961c886980efb325f9bd1d07f/node.ext.directory-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "0e28895b80547a02a2f307605a2ca42f", "sha256": "24e4108cbe5693ae5361e8b93d5ccec185dc97697cf989b20f5e2950e147ea36" }, "downloads": -1, "filename": "node.ext.directory-0.3.tar.gz", "has_sig": false, "md5_digest": "0e28895b80547a02a2f307605a2ca42f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8416, "upload_time": "2013-12-16T17:12:30", "url": "https://files.pythonhosted.org/packages/17/d0/15f67052cfb1fc9290d90c827d4603abc6d0444acf9f7ee8b7044f7620f3/node.ext.directory-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "fcbd91ac922db420461e906168e8959b", "sha256": "fdb5e2db055e603f548e0d02da60a7af384bf6a584365fc03133720021b11402" }, "downloads": -1, "filename": "node.ext.directory-0.4.tar.gz", "has_sig": false, "md5_digest": "fcbd91ac922db420461e906168e8959b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8906, "upload_time": "2015-02-24T08:17:27", "url": "https://files.pythonhosted.org/packages/48/ed/8f2e435a4e6d499c6aa93916db13caf45ed362f0592c062339d68c53ec07/node.ext.directory-0.4.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "fe129093f3c82b3cfb54df249f981e00", "sha256": "f7307da16625089312470edfc516504857bf3189f230b1c4c7a1857705073975" }, "downloads": -1, "filename": "node.ext.directory-0.5.tar.gz", "has_sig": false, "md5_digest": "fe129093f3c82b3cfb54df249f981e00", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9167, "upload_time": "2015-03-03T11:09:33", "url": "https://files.pythonhosted.org/packages/42/36/e0190664cd81b0e62773d7b8b87d6a7fab544ddea790bdc8133ac8e1d26d/node.ext.directory-0.5.tar.gz" } ], "0.5.1": [ { "comment_text": "", "digests": { "md5": "929b11e62336620f79c4a500987a0c47", "sha256": "f09f11c2bebd19b63498c5b3e819e3eddf5e2838d725f90021d615fd0afba65d" }, "downloads": -1, "filename": "node.ext.directory-0.5.1.tar.gz", "has_sig": false, "md5_digest": "929b11e62336620f79c4a500987a0c47", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9270, "upload_time": "2015-03-03T12:10:30", "url": "https://files.pythonhosted.org/packages/36/3b/d3c135ff1934ff9dec5629e40b07f861f51a4ac0ef269a774e34a4b25797/node.ext.directory-0.5.1.tar.gz" } ], "0.5.2": [ { "comment_text": "", "digests": { "md5": "5cdbaf889cda28002b5bddeb72078e9d", "sha256": "649e030c9c8e48979ba4251bae514eb19762a6b5c6a3a7e64292c362d15dee41" }, "downloads": -1, "filename": "node.ext.directory-0.5.2.tar.gz", "has_sig": false, "md5_digest": "5cdbaf889cda28002b5bddeb72078e9d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9420, "upload_time": "2015-05-15T06:50:44", "url": "https://files.pythonhosted.org/packages/ff/3f/46c0d0f77dcc9c9b7d514c3dd271e48d8028b8fac17720c4d5e12ff91bfa/node.ext.directory-0.5.2.tar.gz" } ], "0.5.3": [ { "comment_text": "", "digests": { "md5": "f3cb7197433fa828829d385a629b7e29", "sha256": "998e3ec9e2900a94a5a8e650502647fb5e54da1dc0033c73780931adfcf59765" }, "downloads": -1, "filename": "node.ext.directory-0.5.3.tar.gz", "has_sig": false, "md5_digest": "f3cb7197433fa828829d385a629b7e29", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9606, "upload_time": "2015-07-20T09:05:56", "url": "https://files.pythonhosted.org/packages/16/6e/4c7e5520ab3b787b957439bfaa9db72cc32e2aac53e109af9103a6d5aec7/node.ext.directory-0.5.3.tar.gz" } ], "0.5.4": [ { "comment_text": "", "digests": { "md5": "c203a238c2be9e8ee5f4337fba3e0a66", "sha256": "f0a4df18cfe248dc0a9679a8ece2e84802553a992d959ecc035cf8b57ad77303" }, "downloads": -1, "filename": "node.ext.directory-0.5.4.tar.gz", "has_sig": false, "md5_digest": "c203a238c2be9e8ee5f4337fba3e0a66", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10686, "upload_time": "2015-10-08T08:50:17", "url": "https://files.pythonhosted.org/packages/50/ff/9bbad3c9e802ef78737e0b264cf32bef42271366c26e2cda521e499b408e/node.ext.directory-0.5.4.tar.gz" } ], "0.6": [ { "comment_text": "", "digests": { "md5": "ebf8812a76a4727d8a6a9212d4e9b142", "sha256": "f7dbadfbff0145eb553037d1b87114fc500cd3faef3738a2491e35a8b946aee5" }, "downloads": -1, "filename": "node.ext.directory-0.6.tar.gz", "has_sig": false, "md5_digest": "ebf8812a76a4727d8a6a9212d4e9b142", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10004, "upload_time": "2017-02-14T10:33:51", "url": "https://files.pythonhosted.org/packages/a9/f8/2a314dd848a4223319cea442cd85e2381245c49222f769746dbe4679a4b9/node.ext.directory-0.6.tar.gz" } ], "0.7": [ { "comment_text": "", "digests": { "md5": "c8166b11acf7e1e3aaa9d247a343a0c7", "sha256": "ef6076b6de44cb022f5e35e660b0ae01739509b94fedaae7004e935f70f1783c" }, "downloads": -1, "filename": "node.ext.directory-0.7.tar.gz", "has_sig": false, "md5_digest": "c8166b11acf7e1e3aaa9d247a343a0c7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12924, "upload_time": "2017-06-07T10:43:46", "url": "https://files.pythonhosted.org/packages/66/2f/8767099fa5e87c3d709aaf3114427eccd9e42b8bca9549f99836247cc060/node.ext.directory-0.7.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c8166b11acf7e1e3aaa9d247a343a0c7", "sha256": "ef6076b6de44cb022f5e35e660b0ae01739509b94fedaae7004e935f70f1783c" }, "downloads": -1, "filename": "node.ext.directory-0.7.tar.gz", "has_sig": false, "md5_digest": "c8166b11acf7e1e3aaa9d247a343a0c7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12924, "upload_time": "2017-06-07T10:43:46", "url": "https://files.pythonhosted.org/packages/66/2f/8767099fa5e87c3d709aaf3114427eccd9e42b8bca9549f99836247cc060/node.ext.directory-0.7.tar.gz" } ] }