{ "info": { "author": "Eric Ringeisen", "author_email": "UNKNOWN", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Utilities" ], "description": "Symboldict\n==========\n\nVersion 0.3.0\n\n`Package documentation `__\n\nOrganize symbols and load them lazily\n\nInstall symboldict\n------------------\npython 2::\n\n \n pip install symboldict\n \n\npython 3::\n\n \n pip3 install symboldict\n \n\nPurpose\n-------\n\nThe symboldict module implements a dictionary type containing symbolic\nreferences to python objects in the hierarchy of importable\nmodules or builtins objects. Examples of symbolic references are\n``'os.path.isdir'``, ``'telnetlib.Telnet'``, ``'complex.conjugate'`` etc.\nReferences to user-defined objects are equally easy.\n\nThe module implements a lazy loading mechanism for these symbols, which\nmeans that a dictionary can contain symbols from many different modules\nwithout importing any of these modules until this import becomes necessary\nin user code.\n\nSymboldicts are meant to favor loose coupling between different parts\nof an application. For example three modules ``A, B, C`` may share a\ncommon symboldict ``sy`` instead of importing each others symbols\ndirectly. ``A`` and ``B`` can use method ``sy.func()`` instead of\nfunction ``C.func()``, thus decreasing the knowledge that each module\npossesses about other modules.\n\nQuick Start\n-----------\n\nSymbolDict objects\n~~~~~~~~~~~~~~~~~~\n\nA ``SymbolDict``, or dictionary of symbols, is typically created by\na statement similar to::\n\n \n >>> sy = SymbolDict(\n ... isfile=symbol.os.path.isfile,\n ... Telnet=symbol.telnetlib.Telnet,\n ... conju=symbol.complex.conjugate,\n ... eggs=symbol.spam.eggs,\n ... )\n \n\nIt is a regular dictionary, which keys are arbitrary but which values\nare instances of a new type ``Symbol``::\n\n \n >>> sy\n SymbolDict({'eggs': Symbol('spam.eggs'), 'isfile': Symbol('os.path.isfile'), ...})\n >>>\n >>> isinstance(sy, dict)\n True\n \n\nThe usual dictionary operations apply::\n\n \n >>> sy['isfile']\n Symbol('os.path.isfile')\n >>> sy['eggs']\n Symbol('spam.eggs')\n >>> sy['Parser'] = Symbol('argparse.ArgumentParser')\n >>> 'Telnet' in sy\n True\n \n\nAttribute access is overloaded for symboldicts.\nIt supplies a lazy access to the value symbolically represented by\nthe ``Symbol`` instance::\n\n >>> sy.isfile\n \n >>> sy.Telnet\n \n >>> sy.conju\n \n >>> sy.eggs\n Traceback (most recent call last)\n ...\n ImportError: No module named spam\n \n\nThis syntax enables user code to manipulate the ``SymbolDict``\ninstance as if it was a module containing python variables\navailable through qualified names. Actual modules are imported\nonly when it is necessary to do so.\n\nThe values of these variables can also be obtained by the following\nalternative expression,\nwhich handles the case where the dictionary keys are not\ncharacter strings or where they are existing attribute names of the\n``dict`` class (such as ``'update'`` or ``'clear'``)::\n\n >>> sy.getvalue('isfile')\n \n >>> sy.getvalue('Parser')\n \n \n\nPrevious versions of this module used a call syntax here, requiring\nexpressions such as ``sy().getvalue('isfile')``. Calling a\n``SymbolDict`` instance is deprecated and currently returns\nthe instance itself.\n\n**Special attributes**\n\nAs of version 0.3.0, the valued loaded lazily, such as ``sy.Telnet`` above\nare stored in the instance's ``__dict__`` under the\ncorresponding attribute. It means that subsequent accesses to these values\nhave the efficiency of a simple attribute access.\n\nTo avoid collisions with ordinary dict method names, SymbolDict will normally\nreject the use of a certain number of keys such as::\n\n \n _strict has_key itervalues keys iterkeys items\n iteritems viewkeys hasvalue update fromkeys clear\n pop viewitems symboldict popitem setdefault values\n getvalue strict get copy viewvalues\n \n\nand magic attribute names such as ``__doc__`` or ``__setattr__``. Using\none of these keys in a symboldict will raise a ``TypeError`` exception.\n\nThis restriction on the keys can be removed by unsetting the ``strict``\nproperty::\n\n \n sy.strict = False\n \n\nIt can also be removed at instantiation time by calling the\n``LaxSymbolDict``\nconstructor instead of ``SymbolDict``. For those lax symboldicts, forbidden\nkeys such as ``'popitem'`` can be used, but the lazy access can only be\nobtained through\nthe ``getvalue()`` method. Loaded values won't be added to the\ninstance's ``__dict__``.\n\nSymbol objects\n~~~~~~~~~~~~~~\n\nSymbol objects (used as values in ``SymbolDict`` instances) wrap a\ndot-separated path to a python object, which may exist or not, for example::\n\n \n >>> a = Symbol('wave.Error')\n >>> b = Symbol('complex.conjugate')\n >>> c = Symbol('spam.ham.eggs')\n \n\nAttribute access is overloaded to allow building other instances\nwith the dot syntax::\n\n \n >>> Symbol('spam').ham.eggs\n Symbol('spam.ham.eggs')\n \n\nA special instance named ``symbol`` is defined, which\nvalue is ``Symbol('')``. Its path is empty, and it permits\nexpressions such as::\n\n \n >>> a = symbol.wave.Error\n >>> b = symbol.complex.conjugate\n >>> c = symbol.spam.ham.eggs\n \n\nwhich produce the same result as above.\n\nDefining an instance does *not* trigger an attempt\nto retrieve the indicated python object by importing modules or\naccessing attributes. However, standalone ``Symbol`` instances\nhave the ability to fetch this object by calling\nthe ``getvalue()`` method::\n\n \n >>> a().getvalue()\n \n \n\nThe call syntax ``a()`` enables to bypass the overloading of\nthe attribute operator. It returns a special adapter having the type\n``SymbolControl``. Method ``getvalue()`` cannot be called\ndirectly on the ``Symbol`` instance.\n\nA method ``hasvalue()`` indicates if a value can be obtained for\nthe symbol's path. Unlike ``getvalue()``, it does not raise an exception\nwhen there is no value::\n\n \n >>> symbol.spam.ham().hasvalue()\n False\n \n\nThis method also exists for symboldicts. It may raise ``KeyError`` if\nthe key is missing in the dictionary::\n\n \n >>> sy.hasvalue('conju')\n True\n \n\nLicense\n-------\n\nThis software is licensed under the `MIT License `__\n\n\u00a9 2014-2015 Eric Ringeisen", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Gribouillis/symboldict", "keywords": null, "license": "MIT license", "maintainer": null, "maintainer_email": null, "name": "symboldict", "package_url": "https://pypi.org/project/symboldict/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/symboldict/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/Gribouillis/symboldict" }, "release_url": "https://pypi.org/project/symboldict/0.3.0/", "requires_dist": null, "requires_python": null, "summary": "A dict class to organize and lazily import symbols", "version": "0.3.0" }, "last_serial": 1386772, "releases": { "0.2.4": [ { "comment_text": "", "digests": { "md5": "d6dc1521134716289ef6e9ed6df1724b", "sha256": "7d1f44f688c7c310ca861cfc3e96d63e3be6dc81d93f421572ec776c4bcb9a44" }, "downloads": -1, "filename": "symboldict-0.2.4.tar.gz", "has_sig": false, "md5_digest": "d6dc1521134716289ef6e9ed6df1724b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12943, "upload_time": "2014-12-28T09:27:30", "url": "https://files.pythonhosted.org/packages/a2/59/833365495d6c0bfea36ba517fc14ef70127741e76d8fa4518f271e4d71d9/symboldict-0.2.4.tar.gz" } ], "0.2.5": [ { "comment_text": "", "digests": { "md5": "eb3b25a114ec6d9037d4124362a1374b", "sha256": "3dc2f8a399e3d5dce12f4838cdcb97cfcaa1609ca3477371308ca2bcc146c066" }, "downloads": -1, "filename": "symboldict-0.2.5.tar.gz", "has_sig": false, "md5_digest": "eb3b25a114ec6d9037d4124362a1374b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12942, "upload_time": "2014-12-28T09:43:47", "url": "https://files.pythonhosted.org/packages/3e/3f/c815266d5b44407679750be5f4531c5999cd02b3883ec3588bdcc1090278/symboldict-0.2.5.tar.gz" } ], "0.2.6": [ { "comment_text": "", "digests": { "md5": "f2e3e9523804bae58850f6f85822c0cb", "sha256": "e66aa8d9b5228c2cbae8a4fab0f6a2e209fef819e846362d1a6f2b5af24f8ac0" }, "downloads": -1, "filename": "symboldict-0.2.6.tar.gz", "has_sig": false, "md5_digest": "f2e3e9523804bae58850f6f85822c0cb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12763, "upload_time": "2014-12-29T09:29:15", "url": "https://files.pythonhosted.org/packages/b7/03/52baba7d1c91385868b3b569b715706543484e500eeb4c56368c06727153/symboldict-0.2.6.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "1a960ad676a1103476896a83da86b7c1", "sha256": "749e5a257ebc3af6207fc8db8c30608848aee11e4e146dca268904e1620d9761" }, "downloads": -1, "filename": "symboldict-0.3.0.tar.gz", "has_sig": false, "md5_digest": "1a960ad676a1103476896a83da86b7c1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12040, "upload_time": "2015-01-18T13:41:03", "url": "https://files.pythonhosted.org/packages/37/2c/8b2d8fc098e47cff2673d65501ef740211118e27c4212cf30037c65d2743/symboldict-0.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1a960ad676a1103476896a83da86b7c1", "sha256": "749e5a257ebc3af6207fc8db8c30608848aee11e4e146dca268904e1620d9761" }, "downloads": -1, "filename": "symboldict-0.3.0.tar.gz", "has_sig": false, "md5_digest": "1a960ad676a1103476896a83da86b7c1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12040, "upload_time": "2015-01-18T13:41:03", "url": "https://files.pythonhosted.org/packages/37/2c/8b2d8fc098e47cff2673d65501ef740211118e27c4212cf30037c65d2743/symboldict-0.3.0.tar.gz" } ] }