def _hijacked_run_baton_query(
            self, baton_binary: BatonBinary, program_arguments: List[str]=None, input_data: Any=None) -> List[Dict]:
        """
        Hijacked `run_baton_query` method with hijacking to add the `--recursive` flag to calls to `baton-chmod` that
        originate from code called from frames with the ids in `self._hijack_frame_ids`.
        :param baton_binary: see `BatonRunner.run_baton_query`
        :param program_arguments: see `BatonRunner.run_baton_query`
        :param input_data: see `BatonRunner.run_baton_query`
        :return: see `BatonRunner.run_baton_query`
        """
        if baton_binary == BatonBinary.BATON_CHMOD:
            current_frame = inspect.currentframe()

            def frame_code_in_same_file(frame) -> bool:
                return frame_back.f_code.co_filename == current_frame.f_code.co_filename

            frame_back = current_frame.f_back
            assert frame_code_in_same_file(frame_back)

            while frame_back is not None and frame_code_in_same_file(frame_back):
                if id(frame_back) in self._hijack_frame_ids:
                    return self._original_run_baton_query(baton_binary, [BATON_CHMOD_RECURSIVE_FLAG], input_data)
                frame_back = frame_back.f_back

        return self._original_run_baton_query(baton_binary, program_arguments, input_data)
def _hijacked_run_baton_query ( self , baton_binary : BatonBinary , program_arguments : List [ str ] = None , input_data : Any = None ) -> List [ Dict ] : if baton_binary == BatonBinary . BATON_CHMOD : current_frame = inspect . currentframe ( ) def frame_code_in_same_file ( frame ) -> bool : return frame_back . f_code . co_filename == current_frame . f_code . co_filename frame_back = current_frame . f_back assert frame_code_in_same_file ( frame_back ) while frame_back is not None and frame_code_in_same_file ( frame_back ) : if id ( frame_back ) in self . _hijack_frame_ids : return self . _original_run_baton_query ( baton_binary , [ BATON_CHMOD_RECURSIVE_FLAG ] , input_data ) frame_back = frame_back . f_back return self . _original_run_baton_query ( baton_binary , program_arguments , input_data )
Hijacked `run_baton_query` method with hijacking to add the `--recursive` flag to calls to `baton-chmod` that
        originate from code called from frames with the ids in `self._hijack_frame_ids`.
        :param baton_binary: see `BatonRunner.run_baton_query`
        :param program_arguments: see `BatonRunner.run_baton_query`
        :param input_data: see `BatonRunner.run_baton_query`
        :return: see `BatonRunner.run_baton_query`