docs/support/trace_support.py
def run_trace(
    mname,
    fname,
    module_prefix,
    callable_names,
    no_print,
    module_exclude=None,
    callable_exclude=None,
    debug=False,
):
    """Run module tracing."""
    # pylint: disable=R0913
    module_exclude = [] if module_exclude is None else module_exclude
    callable_exclude = [] if callable_exclude is None else callable_exclude
    par = trace_pars(mname)
    start_time = datetime.datetime.now()
    with pexdoc.exdoc.ExDocCxt(
        exclude=par.exclude + module_exclude,
        pickle_fname=par.pickle_fname,
        in_callables_fname=par.in_callables_fname,
        out_callables_fname=par.out_callables_fname,
        _no_print=no_print,
    ) as exdoc_obj:
        fname = os.path.realpath(
            os.path.join(
                os.path.dirname(__file__),
                "..",
                "..",
                "tests",
                "test_{0}.py".format(fname),
            )
        )
        test_cmd = (
            ["--color=yes"]
            + (["-s", "-vv"] if debug else ["-q", "-q", "-q"])
            + ["--disable-warnings"]
            + ["-x"]
            + ([par.noption] if par.noption else [])
            + ["-m " + mname]
            + [fname]
        )
        with warnings.catch_warnings():
            warnings.filterwarnings("ignore", category=PytestWarning)
            if pytest.main(test_cmd):
                raise RuntimeError("Tracing did not complete successfully")
    stop_time = datetime.datetime.now()
    if not no_print:
        print(
            "Auto-generation of exceptions documentation time: {0}".format(
                pmisc.elapsed_time_string(start_time, stop_time)
            )
        )
        for callable_name in callable_names:
            callable_name = module_prefix + callable_name
            print("\nCallable: {0}".format(callable_name))
            print(exdoc_obj.get_sphinx_doc(callable_name, exclude=callable_exclude))
            print("\n")
    return copy.copy(exdoc_obj)
def run_trace(
    mname,
    fname,
    module_prefix,
    callable_names,
    no_print,
    module_exclude=None,
    callable_exclude=None,
    debug=False,
):
    # pylint: disable=R0913
    module_exclude = [] if module_exclude is None else module_exclude
    callable_exclude = [] if callable_exclude is None else callable_exclude
    par = trace_pars(mname)
    start_time = datetime.datetime.now()
    with pexdoc.exdoc.ExDocCxt(
        exclude=par.exclude + module_exclude,
        pickle_fname=par.pickle_fname,
        in_callables_fname=par.in_callables_fname,
        out_callables_fname=par.out_callables_fname,
        _no_print=no_print,
    ) as exdoc_obj:
        fname = os.path.realpath(
            os.path.join(
                os.path.dirname(__file__),
                "..",
                "..",
                "tests",
                "test_{0}.py".format(fname),
            )
        )
        test_cmd = (
            ["--color=yes"]
            + (["-s", "-vv"] if debug else ["-q", "-q", "-q"])
            + ["--disable-warnings"]
            + ["-x"]
            + ([par.noption] if par.noption else [])
            + ["-m " + mname]
            + [fname]
        )
        with warnings.catch_warnings():
            warnings.filterwarnings("ignore", category=PytestWarning)
            if pytest.main(test_cmd):
                raise RuntimeError("Tracing did not complete successfully")
    stop_time = datetime.datetime.now()
    if not no_print:
        print(
            "Auto-generation of exceptions documentation time: {0}".format(
                pmisc.elapsed_time_string(start_time, stop_time)
            )
        )
        for callable_name in callable_names:
            callable_name = module_prefix + callable_name
            print("\nCallable: {0}".format(callable_name))
            print(exdoc_obj.get_sphinx_doc(callable_name, exclude=callable_exclude))
            print("\n")
    return copy.copy(exdoc_obj)
def run_trace ( mname , fname , module_prefix , callable_names , no_print , module_exclude = None , callable_exclude = None , debug = False , ) : # pylint: disable=R0913 module_exclude = [ ] if module_exclude is None else module_exclude callable_exclude = [ ] if callable_exclude is None else callable_exclude par = trace_pars ( mname ) start_time = datetime . datetime . now ( ) with pexdoc . exdoc . ExDocCxt ( exclude = par . exclude + module_exclude , pickle_fname = par . pickle_fname , in_callables_fname = par . in_callables_fname , out_callables_fname = par . out_callables_fname , _no_print = no_print , ) as exdoc_obj : fname = os . path . realpath ( os . path . join ( os . path . dirname ( __file__ ) , ".." , ".." , "tests" , "test_{0}.py" . format ( fname ) , ) ) test_cmd = ( [ "--color=yes" ] + ( [ "-s" , "-vv" ] if debug else [ "-q" , "-q" , "-q" ] ) + [ "--disable-warnings" ] + [ "-x" ] + ( [ par . noption ] if par . noption else [ ] ) + [ "-m " + mname ] + [ fname ] ) with warnings . catch_warnings ( ) : warnings . filterwarnings ( "ignore" , category = PytestWarning ) if pytest . main ( test_cmd ) : raise RuntimeError ( "Tracing did not complete successfully" ) stop_time = datetime . datetime . now ( ) if not no_print : print ( "Auto-generation of exceptions documentation time: {0}" . format ( pmisc . elapsed_time_string ( start_time , stop_time ) ) ) for callable_name in callable_names : callable_name = module_prefix + callable_name print ( "\nCallable: {0}" . format ( callable_name ) ) print ( exdoc_obj . get_sphinx_doc ( callable_name , exclude = callable_exclude ) ) print ( "\n" ) return copy . copy ( exdoc_obj )
Run module tracing.
Run module tracing .