Skip to main content

A project containing packages common to various other Python projects.

Project description

Table of Contents

About Corny Commons

Corny Commons is a Python package containing modules for use by Konrad Guzek. They are used projects such as Dzwonnik 2 and other private work-in-progress projects.

Contents

There are currently two core modules and one package inside Corny Commons: the console_graphics and file_manager modules, and the util package.

Standalone modules

1. console_graphics.py

This module contains a graphics engine that can display a text-based GUI, rather than having to rely on window managers such as Tkinter or Pygame. It's useful for quick console output for games or simulators. It's currently used in projects such as lcd-display or console-dino.

2. file_manager.py

This module contains many functions related to file handling on the server as well as general input/output.

log() -- Formats and outputs a log message both to the terminal and a log file, defaulting to a file called .log in the current working directory.

read_env() -- Reads the file in .env in the current working directory and applies the environment variable assignments contained within it.

... and more!

Packages

1. util

As you can guess, this package contains more specific, utility-oriented modules.

a) web.py

The web module implements functionality for creating web requests. It is used in various web APIs that must retrieve information from an external source. In essence, this module is a wrapper around the built-in requests module.

make_request() -- takes a URL and creates a web request to that address. If the function has been called before the maximum request cooldown has passed, web.TooManyRequestsException is raised. Otherwise, the request is made. If the response is not retrieved within 10 seconds, or if it returns a response with a HTTP code that is not between 200-299, raises web.InvalidResponseException. If all checks pass, returns the response object.

get_html() -- makes a request using the make_request() function, then decodes the binary content and returns it as a string.

b) currency.py

The currency module contains functions that utilise a public API to get the latest currency exchange information and provide it as-needed for a given fiat currency.

convert() -- this function converts a value from one currency into another.

c) polish.py

Since Konrad Guzek is Polish by blood and currently lives in the Silesian area of Poland at the time of writing, some projects involve the Polish language. It is a complex language that has in-depth conjugation rules, which means that lots of boilerplate code has to be used when dealing with worded numbers, for example. This module contains code that was necessary for a project and may see future use in other projects.

conjugate_numeric() -- this function correctly conjugates a noun when used with a quantifing number, since the noun form changes depending on the amount of the item that is present. Take for example the word jabłko meaning 'apple': 1 apple would be 1 jabłko, 2 apples would be 2 jabłka, and 7 apples would be 7 jabłek -- note the suffix change.

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

corny_commons-1.0.2.tar.gz (46.2 kB view details)

Uploaded Source

Built Distribution

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

corny_commons-1.0.2-py3-none-any.whl (34.7 kB view details)

Uploaded Python 3

File details

Details for the file corny_commons-1.0.2.tar.gz.

File metadata

  • Download URL: corny_commons-1.0.2.tar.gz
  • Upload date:
  • Size: 46.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for corny_commons-1.0.2.tar.gz
Algorithm Hash digest
SHA256 79b538ffd420afc013316e610a623a78f60a8544556c604affd1abcd879ec9ba
MD5 1ccf112731f578e39ac8271126696595
BLAKE2b-256 9682c922ef25e6fc233b0f41f2442942df8bc2eedacc2e2b63a686d516700699

See more details on using hashes here.

Provenance

The following attestation bundles were made for corny_commons-1.0.2.tar.gz:

Publisher: python-publish.yml on kguzek/corny-commons

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file corny_commons-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: corny_commons-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 34.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for corny_commons-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 063761b5341c3053dc89845693238bfc1a1262be0f666cf73b72094956a956cc
MD5 2f657d8216c72540623e556d7a2bb7db
BLAKE2b-256 a76938628693d0b2e5e4541198dfba9112da4391b46054f6568c59a21480c6fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for corny_commons-1.0.2-py3-none-any.whl:

Publisher: python-publish.yml on kguzek/corny-commons

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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