Skip to main content

Codetable is a lightweight package for seamlessly setting up codes, such as those used in API responses.

Project description

from codetable import Code, Codes, msg


class UserErrorCodes(Codes):
    NAMESPACE: str = "user"

    ALREADY_EXISTS: Code
    DOES_NOT_EXIST: Code = msg("User does not exist.")


print("# ALREADY_EXISTS\n")
print("obj:", UserErrorCodes.ALREADY_EXISTS)
print("code:", UserErrorCodes.ALREADY_EXISTS.code)
print("msg:", UserErrorCodes.ALREADY_EXISTS.msg)

print("\n# DOES_NOT_EXIST\n")
print("obj:", UserErrorCodes.DOES_NOT_EXIST)
print("code:", UserErrorCodes.DOES_NOT_EXIST.code)
print("msg:", UserErrorCodes.DOES_NOT_EXIST.msg)

# # ALREADY_EXISTS

# obj: Code(code='user_already_exists', msg=None)
# code: user_already_exists
# msg: None

# # DOES_NOT_EXIST

# obj: Code(code='user_does_not_exist', msg='User does not exist.')
# code: user_does_not_exist
# msg: User does not exist.

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

codetable-1.0.0.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

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

codetable-1.0.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file codetable-1.0.0.tar.gz.

File metadata

  • Download URL: codetable-1.0.0.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for codetable-1.0.0.tar.gz
Algorithm Hash digest
SHA256 502f8662722ce0b83d7581108b03b119e7ef3ff86f5ea7c0e371c4bf1506ef3c
MD5 abdfce96fa883168a8d775427663979d
BLAKE2b-256 43bcdcee79f73fec10b69ad826f42b265515ca14a4be55a5feafd25764bd9728

See more details on using hashes here.

File details

Details for the file codetable-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: codetable-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for codetable-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d9b58bcc5f228fbe1429ec0a269d0be0e162ac2f9c7a91b3a1594a7bae4440f9
MD5 0c9138b4f50ff4063f9d2309a47aec5e
BLAKE2b-256 1dfd9702eb8631386e065c3cbae6edf394baec40fe4e4eed128b4ff38d2f79de

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