Skip to main content

Python Catalog

https://badge.fury.io/py/pycatalog.svg https://travis-ci.org/jsatt/python-catalog.svg?branch=master

Catalog is a data structure for storing complex enumeration. It provides a clean definition pattern and several options for member lookup.

Supports Python 2.7, 3.3+

Install

pip install pycatalog

Usage

from catalog import Catalog

class Color(Catalog):
    _attrs = 'value', 'label', 'other'
    red = 1, 'Red', 'stuff'
    blue = 2, 'Blue', 'things'

# Access values as Attributes
> Color.red.value
1
> Color.red.label
'Red'

# Call to look up members by attribute value
> Color('Blue', 'label')
Color.blue

# Calling without attribute specified assumes first attribute defined in `_attrs`
> Color(1)
Color.red

Attributes

_attrs: Defines names of attributes of members. (default: ['value'])

_member_class: Override the class used to create members. Create a custom member class by extending CatalogMember.

Methods

_zip: Return all members as a tuple. If attrs are provided as positional arguments, only those attributes will be included, and in that order. Otherwise all attributes are included followed by the member name.

> Color._zip()
(('red', 1, 'Red', 'stuff'), ('blue', 2, 'Blue', 'things'))
> Colot._zip('value', 'label')
((1, 'Red'), (2, 'Blue'))

Changelog

1.2.0 - Add support for Python 2. (Wrong direction. I know)

1.1.1 - Add _zip method

1.0.0 - Initial build and packaging

Metadata

Release files for pycatalog 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pycatalog 1.2.0
File Size Uploaded Provenance
pycatalog-1.2.0.tar.gz 4.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pycatalog 1.2.0
File Interpreter ABI Platform
pycatalog-1.2.0-py3.5.egg Legacy Egg format - - Details

Total release size: 11.5 kB

Release files / pycatalog-1.2.0.tar.gz

Download URL pycatalog-1.2.0.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d0cc1497cdc8a3dd82f2de26bba519955132b5853e85a831cf2f174c85ece986
BLAKE2b-256 checksum
How to use checksums
37798ca814d4dc511216bbfa4fb009ec2717616c1ed5a292fa657f56845a0922
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pycatalog-1.2.0-py3.5.egg

Download URL pycatalog-1.2.0-py3.5.egg
Size 6.8 kB
Tags Egg
SHA-256 checksum
How to use checksums
72bbcbc26aa6ae2797e6cbb3af80ec2adc814a9d65ff1e9346b4e9867c5b77fd
BLAKE2b-256 checksum
How to use checksums
26bf531c485ab605b222fa84d39d04024128d3b6ff5cc380606174c500349d90
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for pycatalog 1.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page