Skip to main content

versionlicensestatus

useless-py

Useful python utilities with less effort.

Installation:

pip install useless-py

Features:

  • set_interval() function and @interval decorator - similar to Javascript’s setInterval() method, uses gevent

  • set_timeout() function and @timeout decorator - similar to Javascript’s setTimeout() method, uses gevent

  • set_time_limit() function and @time_limit decorator - limits the maximum execution time of a function, raises TimeLimitExceededError

  • @extends decorator - inheritance using a class decorator, inspired by Java’s extends

  • @nocase decorator - class decorator that allows access to attributes regardless of coding style (camelCase or snake_case)

  • @didyoumean decorator - class decorator, raises DidYouMeanError (subclass of AttributeError) which suggest close matches

Usage:

Check “samples” folder.

To-Do:

  • [ ] Class Decorators

    • [x] @extends - like Java’s (instead of direct inheritance). IMO, more readable when you are doing multiple inheritance.

    • [ ] @implements - like Java’s (with the help of python “abc” module).

    • [x] @nocase - rewrite of “nocase” module using a class decorator instead of direct inheritance, more Pythonic, IMO. (https://pypi.python.org/pypi/nocase)

    • [x] @didyoumean - raises a “DidYouMean” exception (instead of AttributeError) when an attribute of an instance does not exist and suggests close matches. Think of “git” when you messed up on giving the correct argument:

      C:\Users\Ronie Martinez>git hello
      git: 'hello' is not a git command. See 'git --help'.
      Did you mean one of these?
          help
          reflog
  • [ ] Context Managers

    • [ ] Regular expressions in a “with” statement - I miss the old Perl $1, $2, $3 (special variables)… but global variable is an overkill, let’s make a more Pythonic feature

Author:

Metadata

Release files for useless-py 1.0.3

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

Source distribution (sdist)

Source distribution for useless-py 1.0.3
File Size Uploaded
useless-py-1.0.3.zip 5.9 kB Details

Release files / useless-py-1.0.3.zip

Download URL useless-py-1.0.3.zip
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
27117ffe3044ffeee36af4572c224e445e04878668c45b133cfe606998c73b2a
BLAKE2b-256 checksum
How to use checksums
2ee69ff8242741216f5724db7ac1b6a3c2d793eeb436da7eae6d45a514c020cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.0.3 This release

1 release file

1.0.2

1 release file

1.0.1

1 release file

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