Class WrapperSpec
- Namespace
- Gym.Envs.Registration
- Assembly
- Gym.dll
The record of one wrapper applied on top of an env, which AdditionalWrappers accumulates as
Spec walks up a stack. make (P3) re-creates the wrapper
from it.
public sealed record WrapperSpec : IEquatable<WrapperSpec>
- Inheritance
-
WrapperSpec
- Implements
- Inherited Members
- Extension Methods
Remarks
Equality compares every field, the kwargs as Python dicts compare, as Gymnasium's dataclass does. Reference: gymnasium/envs/registration.py.
Constructors
WrapperSpec(string, string, Info?)
The record of one wrapper applied on top of an env, which AdditionalWrappers accumulates as
Spec walks up a stack. make (P3) re-creates the wrapper
from it.
public WrapperSpec(string Name, string EntryPoint, Info? Kwargs)
Parameters
NamestringThe wrapper's class name (
Wrapper.ClassName()).EntryPointstringWhere the wrapper lives,
"Namespace:Class"(Python's"module:Class").KwargsInfoThe wrapper's constructor arguments, recorded by IRecordConstructorArgs; null for a wrapper that does not record them, which
makethen cannot re-create.
Remarks
Equality compares every field, the kwargs as Python dicts compare, as Gymnasium's dataclass does. Reference: gymnasium/envs/registration.py.
Properties
EntryPoint
Where the wrapper lives, "Namespace:Class" (Python's "module:Class").
public string EntryPoint { get; init; }
Property Value
Kwargs
The wrapper's constructor arguments, recorded by IRecordConstructorArgs; null for a
wrapper that does not record them, which make then cannot re-create.
public Info? Kwargs { get; init; }
Property Value
Name
The wrapper's class name (Wrapper.ClassName()).
public string Name { get; init; }
Property Value
Methods
DeepCopy()
copy.deepcopy(wrapper_spec): the same spec with its own copy of the kwargs.
public WrapperSpec DeepCopy()
Returns
- WrapperSpec
The copy.
Equals(WrapperSpec?)
The dataclass equality: the same name, entry point and kwargs (compared as Python dicts).
public bool Equals(WrapperSpec? other)
Parameters
otherWrapperSpecThe other spec; may be null.
Returns
For(Type, Info?)
The spec of a wrapper type, named by its class and entry point, with the given constructor arguments (Gymnasium's
Wrapper.wrapper_spec(**kwargs) classmethod).
public static WrapperSpec For(Type wrapperType, Info? kwargs)
Parameters
wrapperTypeTypeThe wrapper's type (open or closed generic).
kwargsInfoThe constructor arguments to record.
Returns
- WrapperSpec
The spec.
Remarks
Reference: gymnasium/core.py.
Exceptions
- ArgumentNullException
Thrown when
wrapperTypeis null.
GetHashCode()
A hash consistent with Equals(WrapperSpec?) (the kwargs contribute their count).
public override int GetHashCode()
Returns
- int
The hash.
ToString()
The dataclass repr: WrapperSpec(name='TimeLimit', entry_point='Gym.Wrappers:TimeLimit', kwargs={'max_episode_steps': 10}).
public override string ToString()
Returns
- string
The text.