ats_utilities.checker.context_provider module

Module

context_provider.py

Copyright

Copyright (C) 2017 - 2026 Vladimir Roncevic <elektron.ronca@gmail.com> ats_utilities is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ats_utilities is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Info

Defines class ContextProvider with attribute(s) and method(s). Creates an API for retrieving execution context.

class ats_utilities.checker.context_provider.ContextProvider(stack_index_caller: int = 2)[source]

Bases: IContextProvider

Defines class ContextProvider with attribute(s) and method(s). Retrieves context using the call stack. Mechanism for getting context for function or method parameters.

It defines:

attributes:
_stack_index_caller - Index in the call stack to identify the caller (instance attribute).
methods:
__init__ - Initializes ContextProvider constructor.
set_stack_index_caller - Sets the index in the call stack to identify the caller.
get_context - Returns a string representing the calling context.
__str__ - Returns the ATS context provider as string representation.
_abc_impl = <_abc._abc_data object>
get_context() str[source]

Returns a string representing the calling context. It uses the instance’s STACK_INDEX_CALLER to determine the correct frame in the call stack.

Returns:

Context information in string format.

Return type:

<str>

Exceptions:

None..

set_stack_index_caller(stack_index_caller: int) None[source]

Sets the index in the call stack to identify the caller.

Parameters:

stack_index_caller (<int>) – Index in the call stack to identify the caller.

Exceptions:

None..