Skip to content

Commit 17ee61f

Browse files
author
Miguel Alonso Jr
committed
Precommit fixes.
1 parent b4122df commit 17ee61f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+109
-109
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,4 +135,4 @@ repos:
135135
language: python
136136
entry: ./utils/generate_markdown_docs.py --package_dirs ml-agents-envs ml-agents
137137
pass_filenames: false
138-
additional_dependencies: [pyyaml, pydoc-markdown==3.10.1]
138+
additional_dependencies: [pyyaml==5.3, pydoc-markdown==3.10.1]

com.unity.ml-agents.extensions/Runtime/Sensors/PhysicsBodySensor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public void Update()
108108
}
109109

110110
/// <inheritdoc/>
111-
public void Reset() {}
111+
public void Reset() { }
112112

113113
/// <inheritdoc/>
114114
public CompressionSpec GetCompressionSpec()

com.unity.ml-agents.extensions/Runtime/Sensors/PoseExtractor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ internal IList<DisplayNode> GetDisplayNodes()
387387

388388
while (stack.Count != 0)
389389
{
390-
var(current, depth) = stack.Pop();
390+
var (current, depth) = stack.Pop();
391391
var obj = GetObjectAt(current);
392392

393393
var node = new DisplayNode

com.unity.ml-agents/Runtime/Academy.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ void EnableAutomaticStepping()
314314
// This try-catch is because DontDestroyOnLoad cannot be used in Editor Tests
315315
GameObject.DontDestroyOnLoad(m_StepperObject);
316316
}
317-
catch {}
317+
catch { }
318318
}
319319

320320
/// <summary>
@@ -501,13 +501,13 @@ out var unityRlInitParameters
501501

502502
void ResetActions()
503503
{
504-
DecideAction = () => {};
505-
DestroyAction = () => {};
506-
AgentPreStep = i => {};
507-
AgentSendState = () => {};
508-
AgentAct = () => {};
509-
AgentForceReset = () => {};
510-
OnEnvironmentReset = () => {};
504+
DecideAction = () => { };
505+
DestroyAction = () => { };
506+
AgentPreStep = i => { };
507+
AgentSendState = () => { };
508+
AgentAct = () => { };
509+
AgentForceReset = () => { };
510+
OnEnvironmentReset = () => { };
511511
}
512512

513513
static void OnQuitCommandReceived()

com.unity.ml-agents/Runtime/Actuators/ActionSegment.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static void CheckParameters(IReadOnlyCollection<T> actionArray, int offset, int
4949
/// </summary>
5050
/// <param name="actionArray">The action array to use for the this segment.</param>
5151
public ActionSegment(T[] actionArray)
52-
: this(actionArray ?? System.Array.Empty<T>(), 0, actionArray?.Length ?? 0) {}
52+
: this(actionArray ?? System.Array.Empty<T>(), 0, actionArray?.Length ?? 0) { }
5353

5454
/// <summary>
5555
/// Construct an <see cref="ActionSegment{T}"/> with an underlying array

com.unity.ml-agents/Runtime/Actuators/IActionReceiver.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public static ActionBuffers FromDiscreteActions(float[] discreteActions)
4747
/// <param name="continuousActions">The continuous actions to send to an <see cref="IActionReceiver"/>.</param>
4848
/// <param name="discreteActions">The discrete actions to send to an <see cref="IActionReceiver"/>.</param>
4949
public ActionBuffers(float[] continuousActions, int[] discreteActions)
50-
: this(new ActionSegment<float>(continuousActions), new ActionSegment<int>(discreteActions)) {}
50+
: this(new ActionSegment<float>(continuousActions), new ActionSegment<int>(discreteActions)) { }
5151

5252
/// <summary>
5353
/// Construct an <see cref="ActionBuffers"/> instance with the continuous and discrete actions that will
@@ -68,7 +68,7 @@ public ActionBuffers(ActionSegment<float> continuousActions, ActionSegment<int>
6868
public ActionBuffers(ActionSpec actionSpec)
6969
: this(new ActionSegment<float>(new float[actionSpec.NumContinuousActions]),
7070
new ActionSegment<int>(new int[actionSpec.NumDiscreteActions]))
71-
{}
71+
{ }
7272

7373
/// <summary>
7474
/// Create an <see cref="ActionBuffers"/> instance with ActionSpec and all actions stored as a float array.

com.unity.ml-agents/Runtime/Actuators/VectorActuator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ internal ActionBuffers ActionBuffers
2828
public VectorActuator(IActionReceiver actionReceiver,
2929
ActionSpec actionSpec,
3030
string name = "VectorActuator")
31-
: this(actionReceiver, actionReceiver as IHeuristicProvider, actionSpec, name) {}
31+
: this(actionReceiver, actionReceiver as IHeuristicProvider, actionSpec, name) { }
3232

3333
/// <summary>
3434
/// Create a VectorActuator that forwards to the provided IActionReceiver.

com.unity.ml-agents/Runtime/Agent.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public AgentVectorActuator(IActionReceiver actionReceiver,
9191
ActionSpec actionSpec,
9292
string name = "VectorActuator"
9393
) : base(actionReceiver, heuristicProvider, actionSpec, name)
94-
{}
94+
{ }
9595

9696
public override BuiltInActuatorType GetBuiltInActuatorType()
9797
{
@@ -904,7 +904,7 @@ void ResetData()
904904
///
905905
/// [GameObject]: https://docs.unity3d.com/Manual/GameObjects.html
906906
/// </remarks>
907-
public virtual void Initialize() {}
907+
public virtual void Initialize() { }
908908

909909
/// <summary>
910910
/// Implement <see cref="Heuristic"/> to choose an action for this agent using a custom heuristic.
@@ -1241,7 +1241,7 @@ public ReadOnlyCollection<float> GetStackedObservations()
12411241
/// [Agents - Actions]: https://github.com/Unity-Technologies/ml-agents/blob/release_20_docs/docs/Learning-Environment-Design-Agents.md#actions
12421242
/// </remarks>
12431243
/// <seealso cref="IActionReceiver.OnActionReceived"/>
1244-
public virtual void WriteDiscreteActionMask(IDiscreteActionMask actionMask) {}
1244+
public virtual void WriteDiscreteActionMask(IDiscreteActionMask actionMask) { }
12451245

12461246
/// <summary>
12471247
/// Implement `OnActionReceived()` to specify agent behavior at every step, based
@@ -1309,15 +1309,15 @@ public virtual void WriteDiscreteActionMask(IDiscreteActionMask actionMask) {}
13091309
/// <param name="actions">
13101310
/// Struct containing the buffers of actions to be executed at this step.
13111311
/// </param>
1312-
public virtual void OnActionReceived(ActionBuffers actions) {}
1312+
public virtual void OnActionReceived(ActionBuffers actions) { }
13131313

13141314
/// <summary>
13151315
/// Implement `OnEpisodeBegin()` to set up an Agent instance at the beginning
13161316
/// of an episode.
13171317
/// </summary>
13181318
/// <seealso cref="Initialize"/>
13191319
/// <seealso cref="EndEpisode"/>
1320-
public virtual void OnEpisodeBegin() {}
1320+
public virtual void OnEpisodeBegin() { }
13211321

13221322
/// <summary>
13231323
/// Gets the most recent ActionBuffer for this agent.

com.unity.ml-agents/Runtime/Inference/TensorProxy.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,21 @@ public enum TensorType
4949

5050
public long Height
5151
{
52-
get { return shape.Length >= 4 ? shape[^ 2] : 1; }
52+
get { return shape.Length >= 4 ? shape[^2] : 1; }
5353
}
5454

5555
public long Width
5656
{
57-
get { return shape.Length >= 3 ? shape[^ 1] : 1; }
57+
get { return shape.Length >= 3 ? shape[^1] : 1; }
5858
}
5959

6060
public long Channels
6161
{
6262
get
6363
{
64-
return shape.Length >= 4 ? shape[^ 3] :
65-
shape.Length == 3 ? shape[^ 2] :
66-
shape.Length == 2 ? shape[^ 1] : 1;
64+
return shape.Length >= 4 ? shape[^3] :
65+
shape.Length == 3 ? shape[^2] :
66+
shape.Length == 2 ? shape[^1] : 1;
6767
}
6868
}
6969

com.unity.ml-agents/Runtime/InplaceArray.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public override string ToString()
195195
/// <param name="lhs"></param>
196196
/// <param name="rhs"></param>
197197
/// <returns>Whether the arrays are equivalent.</returns>
198-
public static bool operator==(InplaceArray<T> lhs, InplaceArray<T> rhs)
198+
public static bool operator ==(InplaceArray<T> lhs, InplaceArray<T> rhs)
199199
{
200200
return lhs.Equals(rhs);
201201
}
@@ -206,7 +206,7 @@ public override string ToString()
206206
/// <param name="lhs"></param>
207207
/// <param name="rhs"></param>
208208
/// <returns>Whether the arrays are not equivalent</returns>
209-
public static bool operator!=(InplaceArray<T> lhs, InplaceArray<T> rhs) => !lhs.Equals(rhs);
209+
public static bool operator !=(InplaceArray<T> lhs, InplaceArray<T> rhs) => !lhs.Equals(rhs);
210210

211211
/// <summary>
212212
/// Check that the arrays are equivalent.

0 commit comments

Comments
 (0)