
    hf                         S SK r S SKJr  S SKJr  S SKr S SKrSrS\S\R                  4   S\R                  4S	 jr
S
\S\R                  4   S\R                  4S jrg! \ a    Sr NOf = f)    N)	signature)UnionTFenvzgym.Envreturnc                    [        U [        R                  5      (       a  U $ [        (       a  [        U [        R                  5      (       d  [        S[        U 5       S35      e SSKn[        R                  " S5        S[        U R                  R                  5      R                  ;   a  UR                  U S9$ UR!                  U S9$ ! [         a  n[        S5      UeSnAff = f)	a;  
Adapted from https://github.com/thu-ml/tianshou.

Takes an environment and patches it to return Gymnasium env.
This function takes the environment object and returns a patched
env, using shimmy wrapper to convert it to Gymnasium,
if necessary.

:param env: A gym/gymnasium env
:return: Patched env (gymnasium env)
zThe environment is of type z, not a Gymnasium environment. In this case, we expect OpenAI Gym to be installed and the environment to be an OpenAI Gym environment.r   NzMissing shimmy installation. You provided an OpenAI Gym environment. Stable-Baselines3 (SB3) has transitioned to using Gymnasium internally. In order to use OpenAI Gym environments with SB3, you need to install shimmy (`pip install 'shimmy>=2.0'`).zYou provided an OpenAI Gym environment. We strongly recommend transitioning to Gymnasium environments. Stable-Baselines3 is automatically wrapping your environments in a compatibility layer, which could potentially cause issues.seed)r   )
isinstance	gymnasiumEnvgym_installedgym
ValueErrortypeshimmyImportErrorwarningswarnr   	unwrappedreset
parametersGymV26CompatibilityV0GymV21CompatibilityV0)r   r   es      d/home/james-whalen/.local/lib/python3.13/site-packages/stable_baselines3/common/vec_env/patch_gym.py
_patch_envr      s     #y}}%%
=
3 8 8)$s) 5M N
 	
 MM	7 3==../:::+++44''C'00'  <

 	s   %C
 

C%C  C%spacez	gym.Spacec                 p   [        U [        R                  5      (       a  U $ [        (       a  [        U [        R                  5      (       d  [        S[        U 5       S35      e SSKn[        R                  " S5        UR                  R                  U 5      $ ! [         a  n[        S5      UeSnAff = f)a  
Takes a space and patches it to return Gymnasium Space.
This function takes the space object and returns a patched
space, using shimmy wrapper to convert it to Gymnasium,
if necessary.

:param env: A gym/gymnasium Space
:return: Patched space (gymnasium Space)
zThe space is of type zt, not a Gymnasium space. In this case, we expect OpenAI Gym to be installed and the space to be an OpenAI Gym space.r   NzMissing shimmy installation. You provided an OpenAI Gym space. Stable-Baselines3 (SB3) has transitioned to using Gymnasium internally. In order to use OpenAI Gym space with SB3, you need to install shimmy (`pip install 'shimmy>=0.2.1'`).zYou loaded a model that was trained using OpenAI Gym. We strongly recommend transitioning to Gymnasium by saving that model again.)r	   r
   Spacer   r   r   r   r   r   r   r   openai_gym_compatibility_convert_space)r   r   r   s      r   r    r    ?   s     %))=
5#)) < <#DK= 1A B
 	
 MM	W
 **99%@@  >

 	s   %B 
B5$B00B5)r   inspectr   typingr   r
   r   r   r   r   r   r   r         r   <module>r%      s       M
-1E)Y]]23 -1	 -1`%A%Y__ <= %A)// %Ai  Ms   A! !A,+A,