# doodad
Making access to names easier.
doodad: A gadget or other object whose name the speaker does not know or cannot recall.
Often, when writing code, you need to specify field names, for example, when writing code that
communicates with a database. It's so easy to make a typo in the field name, and you might only know
this once you run the code, which may be a lot later...
What `doodad` wants to do when it grows up, is make it easier to find names, and use the names
you meant to use, with tab completion etc.
To install: ```pip install doodad```
# Examples
Find all the names (variables, functions, etc.) in a piece of code or data.
>>> from doodad import find_names
>>> mapping = {'c': 1, 'b': {'a': 2, 'd': 3}}
>>> list(find_names(mapping))
['c', 'b', 'a', 'd']
>>> import os
>>> names = list(find_names(os.path.join))
>>> names
['join', 'a', 'a', 'sep', 'path', 'path']
Make an instance whose sole purpose is to contain those names.
This allows you to have a ready-to-use collection of names that you can tab complete
and catch spelling mistakes early (before, say, you ask for a field name that doesn't exist...)
>>> from doodad import mk_str_attr_obj
>>>
>>> f = mk_str_attr_obj(names)
>>> f.join
'join'
>>> f.path
'path'
>>> f = mk_str_attr_obj('date worker offre success')
>>> f.date
'date'
>>> f.worker
'worker'
>>> f.does_not_exist
Traceback (most recent call last):
...
AttributeError: 'AttrObj' object has no attribute 'does_not_exist'
`f` is a `namedtuple` so you can do things like:
>>> list(f)
['date', 'worker', 'offre', 'success']
>>> date, worker, offer, success = f
>>> offer
'offre'
Raw data
{
"_id": null,
"home_page": "https://github.com/i2mint/doodad",
"name": "doodad",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "OtoSense",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/cf/36/ea237a9763dc8662f32df979cf1cfa23816386d1054b87e397f33d043ad9/doodad-0.1.0.tar.gz",
"platform": "any",
"description": "# doodad\n\nMaking access to names easier.\n\ndoodad: A gadget or other object whose name the speaker does not know or cannot recall.\n\nOften, when writing code, you need to specify field names, for example, when writing code that \ncommunicates with a database. It's so easy to make a typo in the field name, and you might only know \nthis once you run the code, which may be a lot later...\n\nWhat `doodad` wants to do when it grows up, is make it easier to find names, and use the names \nyou meant to use, with tab completion etc.\n\nTo install:\t```pip install doodad```\n\n\n# Examples\n\nFind all the names (variables, functions, etc.) in a piece of code or data.\n\n >>> from doodad import find_names\n >>> mapping = {'c': 1, 'b': {'a': 2, 'd': 3}}\n >>> list(find_names(mapping))\n ['c', 'b', 'a', 'd']\n >>> import os\n >>> names = list(find_names(os.path.join))\n >>> names\n ['join', 'a', 'a', 'sep', 'path', 'path']\n\n\nMake an instance whose sole purpose is to contain those names.\nThis allows you to have a ready-to-use collection of names that you can tab complete \nand catch spelling mistakes early (before, say, you ask for a field name that doesn't exist...)\n\n >>> from doodad import mk_str_attr_obj\n >>>\n >>> f = mk_str_attr_obj(names)\n >>> f.join\n 'join'\n >>> f.path\n 'path'\n >>> f = mk_str_attr_obj('date worker offre success')\n >>> f.date\n 'date'\n >>> f.worker\n 'worker'\n >>> f.does_not_exist\n Traceback (most recent call last):\n ...\n AttributeError: 'AttrObj' object has no attribute 'does_not_exist'\n\n`f` is a `namedtuple` so you can do things like:\n\n >>> list(f)\n ['date', 'worker', 'offre', 'success']\n >>> date, worker, offer, success = f\n >>> offer\n 'offre'",
"bugtrack_url": null,
"license": "apache-2.0",
"summary": "Making access to names easier",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/i2mint/doodad"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "cf36ea237a9763dc8662f32df979cf1cfa23816386d1054b87e397f33d043ad9",
"md5": "ab3122a5e86ab7bd94b251fef303f6d7",
"sha256": "2d5a1317cf0ba10ee79da0204125b07c8c075faf9943ec7220021f64487b5b17"
},
"downloads": -1,
"filename": "doodad-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "ab3122a5e86ab7bd94b251fef303f6d7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 8860,
"upload_time": "2023-09-06T12:42:27",
"upload_time_iso_8601": "2023-09-06T12:42:27.990037Z",
"url": "https://files.pythonhosted.org/packages/cf/36/ea237a9763dc8662f32df979cf1cfa23816386d1054b87e397f33d043ad9/doodad-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-06 12:42:27",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "i2mint",
"github_project": "doodad",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "doodad"
}