def _parse_precondition()

in sapp/pipeline/mariana_trench_parser.py [0:0]


    def _parse_precondition(self, model: Dict[str, Any]) -> Iterable[Precondition]:
        caller = Method.from_json(model["method"])
        caller_position = Position.from_json(model["position"], caller)

        for sink in model.get("sinks", []):
            sinks = Parser._normalize_frame(sink, caller)
            for sink in sinks:
                yield Precondition(
                    caller=Call(
                        method=caller,
                        port=Port.from_json(sink["caller_port"], "sink"),
                        position=caller_position,
                    ),
                    callee=Call.from_json(
                        method=_get_frame_callee(sink),
                        port=sink["callee_port"],
                        position=sink.get("call_position"),
                        default_position=caller_position,
                        leaf_kind="sink",
                    ),
                    kind=sink["kind"],
                    distance=sink.get("distance", 0),
                    local_positions=LocalPositions.from_json(
                        sink.get("local_positions", []), caller
                    ),
                    features=Features.from_json(sink.get("local_features", {})),
                )