Table of Contents

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

Name string

The wrapper's class name (Wrapper.ClassName()).

EntryPoint string

Where the wrapper lives, "Namespace:Class" (Python's "module:Class").

Kwargs Info

The wrapper's constructor arguments, recorded by IRecordConstructorArgs; null for a wrapper that does not record them, which make then 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

string

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

Info

Name

The wrapper's class name (Wrapper.ClassName()).

public string Name { get; init; }

Property Value

string

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

other WrapperSpec

The other spec; may be null.

Returns

bool

true when all fields are equal.

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

wrapperType Type

The wrapper's type (open or closed generic).

kwargs Info

The constructor arguments to record.

Returns

WrapperSpec

The spec.

Remarks

Reference: gymnasium/core.py.

Exceptions

ArgumentNullException

Thrown when wrapperType is 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.