(cls, init=0)
Context for manually setting counter of seq number.

        :init: init value
Context for manually setting counter of seq number.
Context for manually setting counter of seq number .
def counter(cls, init=0):
        """Context for manually setting counter of seq number.

        :init: init value
        """
        if not hasattr(ctx, "counter"):
            ctx.counter = 0

        old = ctx.counter
        ctx.counter = init

        try:
            yield
        finally:
            ctx.counter = old
def counter ( cls , init = 0 ) : if not hasattr ( ctx , "counter" ) : ctx . counter = 0 old = ctx . counter ctx . counter = init try : yield finally : ctx . counter = old