openenv/coding_env
21
1# Copyright (c) Meta Platforms, Inc. and affiliates.2# All rights reserved.3#4# This source code is licensed under the BSD-style license found in the5# LICENSE file in the root directory of this source tree.6 7"""Base transform implementations for composing environment-specific transforms."""8 9from .interfaces import Transform10from .types import Observation11 12 13class CompositeTransform(Transform):14 """Combines multiple transforms into a single transform."""15 16 def __init__(self, transforms: list[Transform]):17 self.transforms = transforms18 19 def __call__(self, observation: Observation) -> Observation:20 for transform in self.transforms:21 observation = transform(observation)22 return observation23 24 25class NullTransform(Transform):26 """Default transform that passes through unchanged."""27 28 def __call__(self, observation: Observation) -> Observation:29 return observation30 