Name | pockets JSON |
Version |
0.9.1
JSON |
| download |
home_page | http://pockets.readthedocs.org |
Summary | A collection of helpful Python tools! |
upload_time | 2019-11-02 14:46:19 |
maintainer | |
docs_url | None |
author | Rob Ruana |
requires_python | |
license | BSD |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
Pockets full of useful Python tools!
====================================
*Let me check my pockets...*
----------------------------
The Pockets library pulls together many of the Python helper functions I've
found useful over the years.
If you've worked on a project that exports an API and accesses a data store,
you've probably seen some code that looks like this::
# Receive a data type with underscores from some API
data_type = 'user_preference'
# Convert underscored data type to CamelCase to match the data model
model_name = camel(data_type)
# Resolve the model name into a model class
model_class = resolve(model_name, modules=["webapp.model.admin",
"webapp.model.user",
"webapp.model.businesslogic"]
# Instantiate the model class and do stuff with the instance...
instance = model_class()
There's an impedance mismatch any time you work with two different frameworks;
especially when you want to update your back-end while maintaining legacy
compatibility with an external API.
Pockets is full of highly tested, well maintained functions that help bridge
the gap. Here are just a few examples...
.. rubric :: Easily get the right logger no matter where you are
::
>>> from pockets.autolog import log
>>> log.error("Always log from the correct module.Class!")
mymodule.MyClass: Always log from the correct module.Class!
.. rubric :: Convert underscore_separated string to CamelCase
::
>>> from pockets import camel
>>> camel("xml_http_request", upper_segments=[1])
'XmlHTTPRequest'
.. rubric :: Convert CamelCase string to underscore_separated
::
>>> from pockets import uncamel
>>> uncamel("XmlHTTPRequest")
'xml_http_request'
.. rubric :: Resolve a string into an object
::
>>> from pockets import resolve
>>> resolve("calendar.TextCalendar")
<class 'calendar.TextCalendar'>
.. rubric :: Peek ahead iterator
::
>>> from pockets import iterpeek
>>> p = iterpeek(["a", "b", "c", "d", "e"])
>>> p.peek()
'a'
>>> p.next()
'a'
>>> p.peek(3)
['b', 'c', 'd']
Downloads and Docs
------------------
Full documentation is available on `Read the Docs
<http://pockets.readthedocs.org>`_.
Built packages are available on `PyPI <https://pypi.python.org/pypi/pockets>`_.
`Source code <https://github.com/RobRuana/pockets>`_ is available on `GitHub
<https://github.com/RobRuana/pockets>`_. Feel free to:
- `Create an issue <https://github.com/RobRuana/pockets/issues>`_ to request a
feature or a report a bug.
- `Fork the repository <https://github.com/RobRuana/pockets/fork>`_ and make
changes to the **master** branch for next release.
- Send a pull request and pester the maintainer until it's merged. Make sure
to add yourself to `AUTHORS
<https://github.com/RobRuana/pockets/blob/master/AUTHORS>`_ and update
`CHANGES <https://github.com/RobRuana/pockets/blob/master/CHANGES>`_.
Build Status
------------
.. image:: https://travis-ci.org/RobRuana/pockets.svg
:target: https://travis-ci.org/RobRuana/pockets
:alt: Build Status
.. image:: https://coveralls.io/repos/RobRuana/pockets/badge.svg
:target: https://coveralls.io/r/RobRuana/pockets
:alt: Coverage Status
.. image:: https://readthedocs.org/projects/pockets/badge/?version=latest
:target: https://readthedocs.org/projects/pockets/?badge=latest
:alt: Documentation Status
Raw data
{
"_id": null,
"home_page": "http://pockets.readthedocs.org",
"name": "pockets",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Rob Ruana",
"author_email": "rob@robruana.com",
"download_url": "https://files.pythonhosted.org/packages/df/8e/0601097cfcce2e8c2297db5080e9719f549c2bd4b94420ddc8d3f848bbca/pockets-0.9.1.tar.gz",
"platform": "any",
"description": "Pockets full of useful Python tools!\n====================================\n\n*Let me check my pockets...*\n----------------------------\n\nThe Pockets library pulls together many of the Python helper functions I've\nfound useful over the years.\n\nIf you've worked on a project that exports an API and accesses a data store,\nyou've probably seen some code that looks like this::\n\n # Receive a data type with underscores from some API\n data_type = 'user_preference'\n\n # Convert underscored data type to CamelCase to match the data model\n model_name = camel(data_type)\n\n # Resolve the model name into a model class\n model_class = resolve(model_name, modules=[\"webapp.model.admin\",\n \"webapp.model.user\",\n \"webapp.model.businesslogic\"]\n\n # Instantiate the model class and do stuff with the instance...\n instance = model_class()\n\n\nThere's an impedance mismatch any time you work with two different frameworks;\nespecially when you want to update your back-end while maintaining legacy\ncompatibility with an external API.\n\nPockets is full of highly tested, well maintained functions that help bridge\nthe gap. Here are just a few examples...\n\n.. rubric :: Easily get the right logger no matter where you are\n\n::\n\n >>> from pockets.autolog import log\n >>> log.error(\"Always log from the correct module.Class!\")\n mymodule.MyClass: Always log from the correct module.Class!\n\n.. rubric :: Convert underscore_separated string to CamelCase\n\n::\n\n >>> from pockets import camel\n >>> camel(\"xml_http_request\", upper_segments=[1])\n 'XmlHTTPRequest'\n\n.. rubric :: Convert CamelCase string to underscore_separated\n\n::\n\n >>> from pockets import uncamel\n >>> uncamel(\"XmlHTTPRequest\")\n 'xml_http_request'\n\n.. rubric :: Resolve a string into an object\n\n::\n\n >>> from pockets import resolve\n >>> resolve(\"calendar.TextCalendar\")\n <class 'calendar.TextCalendar'>\n\n.. rubric :: Peek ahead iterator\n\n::\n\n >>> from pockets import iterpeek\n >>> p = iterpeek([\"a\", \"b\", \"c\", \"d\", \"e\"])\n >>> p.peek()\n 'a'\n >>> p.next()\n 'a'\n >>> p.peek(3)\n ['b', 'c', 'd']\n\n\nDownloads and Docs\n------------------\n\nFull documentation is available on `Read the Docs\n<http://pockets.readthedocs.org>`_.\n\nBuilt packages are available on `PyPI <https://pypi.python.org/pypi/pockets>`_.\n\n`Source code <https://github.com/RobRuana/pockets>`_ is available on `GitHub\n<https://github.com/RobRuana/pockets>`_. Feel free to:\n\n- `Create an issue <https://github.com/RobRuana/pockets/issues>`_ to request a\n feature or a report a bug.\n- `Fork the repository <https://github.com/RobRuana/pockets/fork>`_ and make\n changes to the **master** branch for next release.\n- Send a pull request and pester the maintainer until it's merged. Make sure\n to add yourself to `AUTHORS\n <https://github.com/RobRuana/pockets/blob/master/AUTHORS>`_ and update\n `CHANGES <https://github.com/RobRuana/pockets/blob/master/CHANGES>`_.\n\n\nBuild Status\n------------\n\n.. image:: https://travis-ci.org/RobRuana/pockets.svg\n :target: https://travis-ci.org/RobRuana/pockets\n :alt: Build Status\n\n\n.. image:: https://coveralls.io/repos/RobRuana/pockets/badge.svg\n :target: https://coveralls.io/r/RobRuana/pockets\n :alt: Coverage Status\n\n\n.. image:: https://readthedocs.org/projects/pockets/badge/?version=latest\n :target: https://readthedocs.org/projects/pockets/?badge=latest\n :alt: Documentation Status\n\n\n\n",
"bugtrack_url": null,
"license": "BSD",
"summary": "A collection of helpful Python tools!",
"version": "0.9.1",
"project_urls": {
"Download": "http://pypi.python.org/pypi/pockets",
"Homepage": "http://pockets.readthedocs.org"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e92fa4583c70fbd8cd04910e2884bcc2bdd670e884061f7b4d70bc13e632a993",
"md5": "0b212b5c5118a5f8cedab335be44a731",
"sha256": "68597934193c08a08eb2bf6a1d85593f627c22f9b065cc727a4f03f669d96d86"
},
"downloads": -1,
"filename": "pockets-0.9.1-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "0b212b5c5118a5f8cedab335be44a731",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 26263,
"upload_time": "2019-11-02T14:46:17",
"upload_time_iso_8601": "2019-11-02T14:46:17.814633Z",
"url": "https://files.pythonhosted.org/packages/e9/2f/a4583c70fbd8cd04910e2884bcc2bdd670e884061f7b4d70bc13e632a993/pockets-0.9.1-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "df8e0601097cfcce2e8c2297db5080e9719f549c2bd4b94420ddc8d3f848bbca",
"md5": "4f7e699bd6d1a6b05e1a71905c1d58d1",
"sha256": "9320f1a3c6f7a9133fe3b571f283bcf3353cd70249025ae8d618e40e9f7e92b3"
},
"downloads": -1,
"filename": "pockets-0.9.1.tar.gz",
"has_sig": false,
"md5_digest": "4f7e699bd6d1a6b05e1a71905c1d58d1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 24993,
"upload_time": "2019-11-02T14:46:19",
"upload_time_iso_8601": "2019-11-02T14:46:19.433537Z",
"url": "https://files.pythonhosted.org/packages/df/8e/0601097cfcce2e8c2297db5080e9719f549c2bd4b94420ddc8d3f848bbca/pockets-0.9.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2019-11-02 14:46:19",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "pockets"
}