Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .ci/generation/py2cs/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ def _request(self, method: str, path: str, body: dict[str, Any] | None = None, a
if status >= 400:
message = ""
try:
message = str(json.loads(content).get("message", ""))
data = json.loads(content)
details = "; ".join(str(e.get("message") or e.get("code") or e) if isinstance(e, dict) else str(e) for e in data.get("errors", []))
message = str(data.get("message", "")) + (f" ({details})" if details else "")
except ValueError:
pass
raise GitHubError(f"GitHub {method} {path} failed with {status}: {message}")
Expand Down
7 changes: 7 additions & 0 deletions .ci/generation/py2cs/pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ def raise_pr(client: GitHubClient, plan_dir: Path, repo: str, python_pr: PythonP

branch = branch_name(python_pr.number)
base = client.default_branch(repo)
# The base already has every planned file (the C# pull request was merged) and no draft is open: there is nothing to propose, and GitHub
# refuses a pull request with no commits, whether or not the branch exists
in_sync = all((found := client.get_file(repo, base, e["path"])) is not None and found.content == (plan_folder(plan_dir, repo) / e["path"]).read_bytes() for e in files)
if in_sync and client.find_pull_request(repo, branch) is None:
result.actions.append(Action("skip", repo, f"{base} already has the planned files, nothing to raise"))
return result

if client.branch_sha(repo, branch) is None:
base_sha = client.branch_sha(repo, base)
if base_sha is None:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* This file is part of the Buildings and Habitats object Model (BHoM)
* Copyright (c) 2015 - 2025, the respective contributors. All rights reserved.
*
* Each contributor holds copyright over their respective contributions.
* The project versioning (Git) records all such contribution source information.
*
*
* The BHoM is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3.0 of the License, or
* (at your option) any later version.
*
* The BHoM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this code. If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
*/

namespace BH.oM.FixtureAlpha
{
//File folder differs from the namespace on purpose, like dKoP_oM/AdministrativeInformation/ProjectIdentification.cs
public class ProjectLike : ThingIdentity
{
public virtual string ProjectReference { get; set; } = "";
public virtual string ProjectName { get; set; } = "";
public virtual string ProjectLocation { get; set; } = "";
public virtual string AdditionalReferences { get; set; } = "";
}
}
44 changes: 44 additions & 0 deletions .ci/unit-tests/csharp/Fixtures/FixtureAlpha_oM/Enums/Enums.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* This file is part of the Buildings and Habitats object Model (BHoM)
* Copyright (c) 2015 - 2025, the respective contributors. All rights reserved.
*
* Each contributor holds copyright over their respective contributions.
* The project versioning (Git) records all such contribution source information.
*
*
* The BHoM is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3.0 of the License, or
* (at your option) any later version.
*
* The BHoM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this code. If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
*/

using System;
using System.ComponentModel;

namespace BH.oM.FixtureAlpha
{
[Description("Kinds of support.")]
public enum SupportKind
{
None,
[Description("Fully fixed.")]
Fixed,
Pinned
}

[Flags]
public enum Options
{
A = 1,
B = 2,
Both = 3
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
<Description>https://github.com/BHoM/CSharpSchema_Test</Description>
<Version>1.0.0</Version>
<Authors>BHoM</Authors>
<Copyright>Copyright © https://github.com/BHoM</Copyright>
<RootNamespace>BH.oM.FixtureAlpha</RootNamespace>
<FileVersion>10.0.0.0</FileVersion>
<LangVersion>latest</LangVersion>
<Nullable>disable</Nullable>
</PropertyGroup>

<ItemGroup>
<Reference Include="BHoM">
<HintPath>$(ProgramData)\BHoM\Assemblies\BHoM.dll</HintPath>
<Private>false</Private>
<SpecificVersion>false</SpecificVersion>
</Reference>
<Reference Include="Quantities_oM">
<HintPath>$(ProgramData)\BHoM\Assemblies\Quantities_oM.dll</HintPath>
<Private>false</Private>
<SpecificVersion>false</SpecificVersion>
</Reference>
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Drawing.Common" Version="8.0.0" />
</ItemGroup>


</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* This file is part of the Buildings and Habitats object Model (BHoM)
* Copyright (c) 2015 - 2025, the respective contributors. All rights reserved.
*
* Each contributor holds copyright over their respective contributions.
* The project versioning (Git) records all such contribution source information.
*
*
* The BHoM is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3.0 of the License, or
* (at your option) any later version.
*
* The BHoM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this code. If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
*/

using System.ComponentModel;
using BH.oM.Base;

namespace BH.oM.FixtureAlpha
{
public class PointLike : IGeometryLike
{
public virtual double X { get; set; } = 0;
public virtual double Y { get; set; } = 0;
public virtual double Z { get; set; } = 0;
}

[Description("A straight segment between two points.")]
public class LineLike : ICurveLike, ILabelled
{
public virtual PointLike Start { get; set; } = new PointLike();
public virtual PointLike End { get; set; } = new PointLike();
[Description("Extends the line to infinity.")]
public virtual bool Infinite { get; set; } = false;
public virtual string Label { get; set; } = null;
}
}
68 changes: 68 additions & 0 deletions .ci/unit-tests/csharp/Fixtures/FixtureAlpha_oM/Hardening.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* This file is part of the Buildings and Habitats object Model (BHoM)
* Copyright (c) 2015 - 2025, the respective contributors. All rights reserved.
*
* Each contributor holds copyright over their respective contributions.
* The project versioning (Git) records all such contribution source information.
*
*
* The BHoM is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3.0 of the License, or
* (at your option) any later version.
*
* The BHoM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this code. If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
*/

using System.Collections.Generic;
using System.Collections.ObjectModel;
using BH.oM.Base;

namespace BH.oM.FixtureAlpha
{
//No member has the value 0, but the C# default of a property of this type is 0
public enum Sparse
{
One = 1,
Two = 2,
}

public class SparseHolder : BHoMObject
{
public virtual Sparse Level { get; set; }
}

//Its default instance cannot be created in Python, because SparseHolder needs an argument
public class SparseParent : BHoMObject
{
public virtual SparseHolder Holder { get; set; } = new SparseHolder();
}

//A generic class that names itself in a default collection
public class TreeLike<T> : BHoMObject
{
public virtual Dictionary<string, TreeLike<T>> Children { get; set; } = new Dictionary<string, TreeLike<T>>();
public virtual List<T> Values { get; set; } = new List<T>();
}

public class GridHolder : BHoMObject
{
public virtual double[,] Matrix { get; set; } = new double[2, 2];
public virtual ReadOnlyDictionary<string, double> Table { get; set; } = new ReadOnlyDictionary<string, double>(new Dictionary<string, double>());
}

public interface IOpeningLike<T> : IBHoMObject
{
}

//A constraint that depends on another type parameter
public interface IPanelLike<TEdge, TOpening> : IBHoMObject where TOpening : IOpeningLike<TEdge>
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* This file is part of the Buildings and Habitats object Model (BHoM)
* Copyright (c) 2015 - 2025, the respective contributors. All rights reserved.
*
* Each contributor holds copyright over their respective contributions.
* The project versioning (Git) records all such contribution source information.
*
*
* The BHoM is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3.0 of the License, or
* (at your option) any later version.
*
* The BHoM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this code. If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
*/

using BH.oM.Base;

namespace BH.oM.FixtureAlpha
{
public interface IGeometryLike : IObject { }

public interface IElement1DLike : IObject { }

//Two parent interfaces, like ICurve : IGeometry, IElement1D
public interface ICurveLike : IGeometryLike, IElement1DLike { }

//No "I" prefix on purpose, like IdKoPObject
public interface ThingIdentity : IObject { }

public interface ILabelled : IObject
{
string Label { get; set; }
}
}
Loading
Loading