Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADD] progress: Decorator for progressbar #233

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Commits on Apr 5, 2021

  1. [ADD] progress: Decorator for progressbar

    This is a decorator for any sub function called in an OpenUpgrade script
    (pre, post or end migration script).
    
    Decorate functions that may take time. If a function is decorated, we
    provide an iterable argument that will be looped on and call the original
    function, while a progress bar will be displayed.
    
    Function: 28% (152 of 529) I#####              I Elapsed Time: 0:00:03 ETA: 0:01:32
    
    :param index: Index of the argument to be used as iterable. Default to the
      second argument. It will pass each of the elements of the iterable in the
      same place.
    :param title: Optional title for prefixing the progress bar. If not
      specified, the function name will be used.
    
    Typical use::
    
    @openupgrade.progress()
    def migrate_some_stuff(env, record)
        # some custom code
        ...
    
    @openupgrade.migrate()
    def migrate(env, version):
        records = ...  # get an iterable
        migrate_some_stuff(env, records)
    
    Co-Authored-By: Yann Papouin <[email protected]>
    pedrobaeza and ypapouin committed Apr 5, 2021
    Configuration menu
    Copy the full SHA
    961c581 View commit details
    Browse the repository at this point in the history

Commits on May 11, 2021

  1. Configuration menu
    Copy the full SHA
    be10c08 View commit details
    Browse the repository at this point in the history