Skip to content

Commit

Permalink
Refactor Namespace and Seald Classes in Microsoft.ML.AutoML.SourceGen…
Browse files Browse the repository at this point in the history
…erator Project (#7223)

* Make all classes in Microsoft.ML.AutoML.SourceGenerator project `sealed`

* Refactor namespace from Microsoft.ML.ModelBuilder.SweepableEstimator.CodeGenerator to Microsoft.ML.AutoML.SourceGenerator
  • Loading branch information
mhshahmoradi committed Aug 29, 2024
1 parent 70e5ab1 commit 1612edc
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Microsoft.ML.AutoML.SourceGenerator
{
internal class Constant
internal sealed class Constant
{
public const string CodeGeneratorNameSpace = "Microsoft.ML.AutoML.CodeGen";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Microsoft.ML.AutoML.SourceGenerator
{
internal class EstimatorContract
internal sealed class EstimatorContract
{
[JsonPropertyName("functionName")]
public string FunctionName { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
namespace Microsoft.ML.AutoML.SourceGenerator
{
[Generator]
public class EstimatorTypeGenerator : ISourceGenerator
public sealed class EstimatorTypeGenerator : ISourceGenerator
{
private const string className = "EstimatorType";
private const string fullName = Constant.CodeGeneratorNameSpace + "." + className;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
namespace Microsoft.ML.AutoML.SourceGenerator
{
[Generator]
public class SearchSpaceGenerator : ISourceGenerator
public sealed class SearchSpaceGenerator : ISourceGenerator
{
public void Execute(GeneratorExecutionContext context)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
namespace Microsoft.ML.AutoML.SourceGenerator
{
[Generator]
public class SweepableEstimatorFactoryGenerator : ISourceGenerator
public sealed class SweepableEstimatorFactoryGenerator : ISourceGenerator
{
private const string className = "SweepableEstimatorFactory";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,17 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Text.Json;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Text;
using Microsoft.ML.AutoML.SourceGenerator;
using SweepableEstimator = Microsoft.ML.AutoML.SourceGenerator.Template.SweepableEstimator;
using SweepableEstimatorT = Microsoft.ML.AutoML.SourceGenerator.Template.SweepableEstimator_T_;
namespace Microsoft.ML.ModelBuilder.SweepableEstimator.CodeGenerator
namespace Microsoft.ML.AutoML.SourceGenerator
{
[Generator]
public class SweepableEstimatorGenerator : ISourceGenerator
public sealed class SweepableEstimatorGenerator : ISourceGenerator
{
private const string SweepableEstimatorAttributeDisplayName = Constant.CodeGeneratorNameSpace + "." + "SweepableEstimatorAttribute";

Expand Down
2 changes: 1 addition & 1 deletion tools-local/Microsoft.ML.AutoML.SourceGenerator/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace Microsoft.ML.AutoML.SourceGenerator
{
internal class Utils
internal sealed class Utils
{
public static EstimatorsContract GetEstimatorsFromJson(string json)
{
Expand Down

0 comments on commit 1612edc

Please sign in to comment.