GithubHelp home page GithubHelp logo

anwar03 / capslock Goto Github PK

View Code? Open in Web Editor NEW

This project forked from faruk-ahmad/capslock

0.0 1.0 0.0 147 KB

A utility python library for writing certain tasks in python easily & elegantly.

License: Other

Python 100.00%

capslock's Introduction

CAPSLOCK


A utility python library for writing certain tasks in python easily & elegantly.


[The library is still in development. The doc is not completed yet. You can contribute to improve the library.]

Background

capslock is a high level utility library written in python for writing certain frequently needed task in faster & efficient way. For example, if you want to keep track of the execution time of one of your method while optimizing it, witing code for tracking execution time can be done easily using capslock.


Installation

Install using the following command -

pip install capslock

Uninstall using the following command -

pip uninstall capslock

Getting Started

How to use decorators from capslock

Capslock defines different decorators that can be used out of the box for certain frequent tasks. E.g. getting the run time of certain function over the period of optimization in development phase.

Timing Decorator

To keep track of the execution time of a function in your project for optimizing it over the time, just put the "timing" decorator in your desired function. Capslock will keep track of different run of that function and will plot a well visualized graph for last five execution time of that function.

from capslock import timing

@timing(plot=True)
def say_hello():
    print("Hello World")

if __name__ == '__main__':
    say_hello()

This will generate output like bellow:

Output of Capslock Timing Decorator

And it will also keep track of runtime for different runs of the say_hello() function. and will plot a graph in the same directory of your python script if you set plot=True, otherwise the plot flag is by default False.

Runtime tracking using Capslock Timing Decorator

Debug Decorator

To get debug information of anyof your function, follow the bellow instruction-

from capslock import debug

@debug
def add(number1, number2):
    return number1 + number2

if __name__ == '__main__':
    print(add(20, 30))

will provide you the following output with some debug information-

Debug Information using Capslock Debug Decorator

How to Contribute

You can contribute in different ways. You can add more decorators for frequently used tasks in day to day development works.

capslock's People

Contributors

faruk-ahmad avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.