From 2671d0ff4f8c8771b770f5e4dc53672244190288 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Wed, 27 Mar 2024 12:34:40 -0700 Subject: [PATCH] Stripped extra spaces --- models/csharp/dock_models.cs | 16 ----- models/csharp/ephys_link_models.cs | 36 ----------- models/csharp/generic_models.cs | 96 ------------------------------ models/csharp/logging_models.cs | 12 ---- models/csharp/pinpoint_models.cs | 7 --- models/csharp/urchin_models.cs | 29 --------- src/vbl_aquarium/build.py | 4 +- src/vbl_aquarium/generate_cs.py | 1 - 8 files changed, 2 insertions(+), 199 deletions(-) diff --git a/models/csharp/dock_models.cs b/models/csharp/dock_models.cs index 5961560..75233be 100644 --- a/models/csharp/dock_models.cs +++ b/models/csharp/dock_models.cs @@ -1,40 +1,24 @@ - - - public struct BucketModel { public string Token; public string Password; } - - - - public struct LoadModel { public string Bucket; public string Password; } - - - - public struct SaveModel { public string Bucket; public string Password; } - - - - public struct UploadModel { public string Data; public string Password; } - diff --git a/models/csharp/ephys_link_models.cs b/models/csharp/ephys_link_models.cs index 3b49488..80d5653 100644 --- a/models/csharp/ephys_link_models.cs +++ b/models/csharp/ephys_link_models.cs @@ -1,27 +1,17 @@ using UnityEngine; - - public struct AngularResponse { public Vector3 Angles; public string Error; } - - - - public struct BooleanStateResponse { public bool State; public string Error; } - - - - public struct CanWriteRequest { public string ManipulatorId; @@ -29,10 +19,6 @@ public struct CanWriteRequest public float Hours; } - - - - public struct DriveToDepthRequest { public string ManipulatorId; @@ -40,10 +26,6 @@ public struct DriveToDepthRequest public float Speed; } - - - - public struct DriveToDepthResponse { public float Depth; @@ -51,9 +33,6 @@ public struct DriveToDepthResponse } - - - public struct GetManipulatorsResponse { public string[] Manipulators; @@ -63,9 +42,6 @@ public struct GetManipulatorsResponse } - - - public struct GotoPositionRequest { public string ManipulatorId; @@ -73,10 +49,6 @@ public struct GotoPositionRequest public float Speed; } - - - - public struct InsideBrainRequest { public string ManipulatorId; @@ -84,23 +56,15 @@ public struct InsideBrainRequest } - - - public struct PositionalResponse { public Vector4 Position; public string Error; } - - - - public struct ShankCountResponse { public int ShankCount; public string Error; } - diff --git a/models/csharp/generic_models.cs b/models/csharp/generic_models.cs index 12077ef..51e6aaa 100644 --- a/models/csharp/generic_models.cs +++ b/models/csharp/generic_models.cs @@ -1,17 +1,10 @@ using UnityEngine; - - - public struct BoolData { public string ID; public bool Value; } - - - - public struct BoolList { public string ID; @@ -19,9 +12,6 @@ public struct BoolList } - - - public struct ColorData { public string ID; @@ -29,67 +19,40 @@ public struct ColorData } - - - public struct ColorList { public string ID; public Color[] Values; } - - - - public struct FloatData { public string ID; public float Value; } - - - - public struct FloatList { public string ID; public float[] Values; } - - - - public struct IDData { public string ID; } - - - - public struct IDList { public string[] IDs; } - - - - public struct IDListBoolData { public string[] IDs; public bool Value; } - - - - public struct IDListBoolList { public string[] IDs; @@ -97,9 +60,6 @@ public struct IDListBoolList } - - - public struct IDListColorData { public string[] IDs; @@ -107,69 +67,42 @@ public struct IDListColorData } - - - public struct IDListColorList { public string[] IDs; public Color[] Values; } - - - - public struct IDListFloatData { public string[] IDs; public float Value; } - - - - public struct IDListFloatList { public string[] IDs; public float[] Values; } - - - - public struct IDListIntData { public string[] IDs; public int Value; } - - - - public struct IDListIntList { public string[] IDs; public int[] Values; } - - - - public struct IDListStringData { public string[] IDs; public string Value; } - - - - public struct IDListStringList { public string[] IDs; @@ -177,9 +110,6 @@ public struct IDListStringList } - - - public struct IDListVector3Data { public string[] IDs; @@ -187,49 +117,30 @@ public struct IDListVector3Data } - - - public struct IDListVector3List { public string[] IDs; public Vector3[] Values; } - - - - public struct IntData { public string ID; public int Value; } - - - - public struct IntList { public string ID; public int[] Values; } - - - - public struct StringData { public string ID; public string Value; } - - - - public struct StringList { public string ID; @@ -237,9 +148,6 @@ public struct StringList } - - - public struct Vector3Data { public string ID; @@ -247,13 +155,9 @@ public struct Vector3Data } - - - public struct Vector3List { public string ID; public Vector3[] Values; } - diff --git a/models/csharp/logging_models.cs b/models/csharp/logging_models.cs index 053d714..e7d9108 100644 --- a/models/csharp/logging_models.cs +++ b/models/csharp/logging_models.cs @@ -1,27 +1,15 @@ - - - public struct Log { public string Msg; } - - - - public struct LogError { public string Msg; } - - - - public struct LogWarning { public string Msg; } - diff --git a/models/csharp/pinpoint_models.cs b/models/csharp/pinpoint_models.cs index b433f3b..9eae056 100644 --- a/models/csharp/pinpoint_models.cs +++ b/models/csharp/pinpoint_models.cs @@ -1,7 +1,4 @@ using UnityEngine; - - - public struct CraniotomyGroup { public string Atlas; @@ -9,9 +6,6 @@ public struct CraniotomyGroup } - - - public struct CraniotomyModel { public int Index; @@ -20,4 +14,3 @@ public struct CraniotomyModel public bool Rectangle; } - diff --git a/models/csharp/urchin_models.cs b/models/csharp/urchin_models.cs index 2006e11..39d57ca 100644 --- a/models/csharp/urchin_models.cs +++ b/models/csharp/urchin_models.cs @@ -1,7 +1,5 @@ using UnityEngine; - - public struct AtlasModel { public string Name; @@ -11,9 +9,6 @@ public struct AtlasModel } - - - public struct CameraModel { public float Id; @@ -36,10 +31,6 @@ public enum CameraMode } - - - - public struct CustomAtlasModel { public string Name; @@ -48,9 +39,6 @@ public struct CustomAtlasModel } - - - public struct CustomMeshData { public string ID; @@ -60,9 +48,6 @@ public struct CustomMeshData } - - - public struct CustomMeshModel { public string ID; @@ -74,9 +59,6 @@ public struct CustomMeshModel } - - - public struct MeshModel { public string ID; @@ -89,9 +71,6 @@ public struct MeshModel } - - - public struct ParticleGroupModel { public string ID; @@ -104,19 +83,12 @@ public struct ParticleGroupModel public Color[] Colors; } - - - - public struct PrimitiveMeshModel { public MeshModel[] Data; } - - - public struct StructureModel { public string Name; @@ -129,4 +101,3 @@ public struct StructureModel public string Material; } - diff --git a/src/vbl_aquarium/build.py b/src/vbl_aquarium/build.py index eb44a7e..950f3bd 100644 --- a/src/vbl_aquarium/build.py +++ b/src/vbl_aquarium/build.py @@ -1,8 +1,8 @@ -from shutil import rmtree from enum import Enum from json import dumps from os import makedirs from os.path import abspath, dirname, exists +from shutil import rmtree from vbl_aquarium.generate_cs import pydantic_to_csharp from vbl_aquarium.models import dock, ephys_link, generic, logging, pinpoint, unity, urchin @@ -51,7 +51,7 @@ def remove_ignored_classes(module): output = "" for cclass in classes: if cclass.__name__ not in unity_class_names: - output += pydantic_to_csharp(cclass, cclass.model_json_schema()) + "\n\n" + output += pydantic_to_csharp(cclass, cclass.model_json_schema()).strip() + "\n\n" # Move using statement to top if "using UnityEngine;" in output: diff --git a/src/vbl_aquarium/generate_cs.py b/src/vbl_aquarium/generate_cs.py index daf308d..bcd8eb4 100644 --- a/src/vbl_aquarium/generate_cs.py +++ b/src/vbl_aquarium/generate_cs.py @@ -39,7 +39,6 @@ def generate_csharp_struct(class_name: str, fields: list[str], enums=None, has_u # build the full class file string return f""" {usings} - public struct {class_name} {{ {field_declarations}