Skip to main content

Making access to names easier

Project description

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

Documentation

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'

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

doodad-0.1.3.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

doodad-0.1.3-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file doodad-0.1.3.tar.gz.

File metadata

  • Download URL: doodad-0.1.3.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for doodad-0.1.3.tar.gz
Algorithm Hash digest
SHA256 71ceff9efc47ee1aebc23e6d279769c6c7277cfd5b6d53f4f61823f01800888d
MD5 a9be6247c345cd2058f2f2ca89855eb9
BLAKE2b-256 0182c41a4ca6c3cf782e1319aac14efb54c7cb646761996307399ee7e4d7bf8d

See more details on using hashes here.

File details

Details for the file doodad-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: doodad-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for doodad-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f0cd4a7565da6db3ca76911a0c23a3794eeffa6d2b3ba840a783460945abf88c
MD5 a9642e8faea9c268bb03a9c50efaa2e6
BLAKE2b-256 735d6dca96e2ababf4ba306e44710095a7c28b856c10f11c4ae0fccf8be1e61e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page