Skip to main content

Useful python utilities with less effort.

Project description

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

Usage:

Check “sample” 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, we are just adding).

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

    • [ ] @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:

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

useless-py-1.0.2.zip (5.1 kB view details)

Uploaded Source

File details

Details for the file useless-py-1.0.2.zip.

File metadata

  • Download URL: useless-py-1.0.2.zip
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for useless-py-1.0.2.zip
Algorithm Hash digest
SHA256 5208e9ca3c3fb3d9a415788bab34d2bf5e50b6fa3acd701ab07787e5e38a1684
MD5 a697079179899326ca24b3ca72ec97b0
BLAKE2b-256 34f0ee0567f2c0b8ee92204337b840fdab165d0c6242e33d87f63b52450b217b

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