Skip to content

[AutoML] CLI: Regenerate templated CS files #3954

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 2, 2019
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
274 changes: 137 additions & 137 deletions src/mlnet/Templates/Console/ModelBuilder.cs

Large diffs are not rendered by default.

104 changes: 52 additions & 52 deletions src/mlnet/Templates/Console/ModelInputClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public partial class ModelInputClass : ModelInputClassBase
/// </summary>
public virtual string TransformText()
{
Write(@"//*****************************************************************************************
this.Write(@"//*****************************************************************************************
//* *
//* This is an auto-generated file by Microsoft ML.NET CLI (Command-Line Interface) tool. *
//* *
Expand All @@ -34,15 +34,15 @@ public virtual string TransformText()
using Microsoft.ML.Data;

namespace ");
Write(ToStringHelper.ToStringWithCulture(Namespace));
Write(".Model.DataModels\r\n{\r\n public class ModelInput\r\n {\r\n");
this.Write(this.ToStringHelper.ToStringWithCulture(Namespace));
this.Write(".Model.DataModels\r\n{\r\n public class ModelInput\r\n {\r\n");
foreach(var label in ClassLabels){
Write(" ");
Write(ToStringHelper.ToStringWithCulture(label));
Write("\r\n");
this.Write(" ");
this.Write(this.ToStringHelper.ToStringWithCulture(label));
this.Write("\r\n");
}
Write("}\r\n}\r\n");
return GenerationEnvironment.ToString();
this.Write("}\r\n}\r\n");
return this.GenerationEnvironment.ToString();
}

public IList<string> ClassLabels {get;set;}
Expand Down Expand Up @@ -72,15 +72,15 @@ protected System.Text.StringBuilder GenerationEnvironment
{
get
{
if ((generationEnvironmentField == null))
if ((this.generationEnvironmentField == null))
{
generationEnvironmentField = new global::System.Text.StringBuilder();
this.generationEnvironmentField = new global::System.Text.StringBuilder();
}
return generationEnvironmentField;
return this.generationEnvironmentField;
}
set
{
generationEnvironmentField = value;
this.generationEnvironmentField = value;
}
}
/// <summary>
Expand All @@ -90,11 +90,11 @@ public System.CodeDom.Compiler.CompilerErrorCollection Errors
{
get
{
if ((errorsField == null))
if ((this.errorsField == null))
{
errorsField = new global::System.CodeDom.Compiler.CompilerErrorCollection();
this.errorsField = new global::System.CodeDom.Compiler.CompilerErrorCollection();
}
return errorsField;
return this.errorsField;
}
}
/// <summary>
Expand All @@ -104,11 +104,11 @@ private System.Collections.Generic.List<int> indentLengths
{
get
{
if ((indentLengthsField == null))
if ((this.indentLengthsField == null))
{
indentLengthsField = new global::System.Collections.Generic.List<int>();
this.indentLengthsField = new global::System.Collections.Generic.List<int>();
}
return indentLengthsField;
return this.indentLengthsField;
}
}
/// <summary>
Expand All @@ -118,7 +118,7 @@ public string CurrentIndent
{
get
{
return currentIndentField;
return this.currentIndentField;
}
}
/// <summary>
Expand All @@ -128,11 +128,11 @@ public string CurrentIndent
{
get
{
return sessionField;
return this.sessionField;
}
set
{
sessionField = value;
this.sessionField = value;
}
}
#endregion
Expand All @@ -148,59 +148,59 @@ public void Write(string textToAppend)
}
// If we're starting off, or if the previous text ended with a newline,
// we have to append the current indent first.
if (((GenerationEnvironment.Length == 0)
|| endsWithNewline))
if (((this.GenerationEnvironment.Length == 0)
|| this.endsWithNewline))
{
GenerationEnvironment.Append(currentIndentField);
endsWithNewline = false;
this.GenerationEnvironment.Append(this.currentIndentField);
this.endsWithNewline = false;
}
// Check if the current text ends with a newline
if (textToAppend.EndsWith(global::System.Environment.NewLine, global::System.StringComparison.CurrentCulture))
{
endsWithNewline = true;
this.endsWithNewline = true;
}
// This is an optimization. If the current indent is "", then we don't have to do any
// of the more complex stuff further down.
if ((currentIndentField.Length == 0))
if ((this.currentIndentField.Length == 0))
{
GenerationEnvironment.Append(textToAppend);
this.GenerationEnvironment.Append(textToAppend);
return;
}
// Everywhere there is a newline in the text, add an indent after it
textToAppend = textToAppend.Replace(global::System.Environment.NewLine, (global::System.Environment.NewLine + currentIndentField));
textToAppend = textToAppend.Replace(global::System.Environment.NewLine, (global::System.Environment.NewLine + this.currentIndentField));
// If the text ends with a newline, then we should strip off the indent added at the very end
// because the appropriate indent will be added when the next time Write() is called
if (endsWithNewline)
if (this.endsWithNewline)
{
GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - currentIndentField.Length));
this.GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - this.currentIndentField.Length));
}
else
{
GenerationEnvironment.Append(textToAppend);
this.GenerationEnvironment.Append(textToAppend);
}
}
/// <summary>
/// Write text directly into the generated output
/// </summary>
public void WriteLine(string textToAppend)
{
Write(textToAppend);
GenerationEnvironment.AppendLine();
endsWithNewline = true;
this.Write(textToAppend);
this.GenerationEnvironment.AppendLine();
this.endsWithNewline = true;
}
/// <summary>
/// Write formatted text directly into the generated output
/// </summary>
public void Write(string format, params object[] args)
{
Write(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args));
this.Write(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args));
}
/// <summary>
/// Write formatted text directly into the generated output
/// </summary>
public void WriteLine(string format, params object[] args)
{
WriteLine(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args));
this.WriteLine(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args));
}
/// <summary>
/// Raise an error
Expand All @@ -209,7 +209,7 @@ public void Error(string message)
{
System.CodeDom.Compiler.CompilerError error = new global::System.CodeDom.Compiler.CompilerError();
error.ErrorText = message;
Errors.Add(error);
this.Errors.Add(error);
}
/// <summary>
/// Raise a warning
Expand All @@ -219,7 +219,7 @@ public void Warning(string message)
System.CodeDom.Compiler.CompilerError error = new global::System.CodeDom.Compiler.CompilerError();
error.ErrorText = message;
error.IsWarning = true;
Errors.Add(error);
this.Errors.Add(error);
}
/// <summary>
/// Increase the indent
Expand All @@ -230,23 +230,23 @@ public void PushIndent(string indent)
{
throw new global::System.ArgumentNullException("indent");
}
currentIndentField = (currentIndentField + indent);
indentLengths.Add(indent.Length);
this.currentIndentField = (this.currentIndentField + indent);
this.indentLengths.Add(indent.Length);
}
/// <summary>
/// Remove the last indent that was added with PushIndent
/// </summary>
public string PopIndent()
{
string returnValue = "";
if ((indentLengths.Count > 0))
if ((this.indentLengths.Count > 0))
{
int indentLength = indentLengths[(indentLengths.Count - 1)];
indentLengths.RemoveAt((indentLengths.Count - 1));
int indentLength = this.indentLengths[(this.indentLengths.Count - 1)];
this.indentLengths.RemoveAt((this.indentLengths.Count - 1));
if ((indentLength > 0))
{
returnValue = currentIndentField.Substring((currentIndentField.Length - indentLength));
currentIndentField = currentIndentField.Remove((currentIndentField.Length - indentLength));
returnValue = this.currentIndentField.Substring((this.currentIndentField.Length - indentLength));
this.currentIndentField = this.currentIndentField.Remove((this.currentIndentField.Length - indentLength));
}
}
return returnValue;
Expand All @@ -256,8 +256,8 @@ public string PopIndent()
/// </summary>
public void ClearIndent()
{
indentLengths.Clear();
currentIndentField = "";
this.indentLengths.Clear();
this.currentIndentField = "";
}
#endregion
#region ToString Helpers
Expand All @@ -274,13 +274,13 @@ public System.IFormatProvider FormatProvider
{
get
{
return formatProviderField ;
return this.formatProviderField ;
}
set
{
if ((value != null))
{
formatProviderField = value;
this.formatProviderField = value;
}
}
}
Expand All @@ -303,7 +303,7 @@ public string ToStringWithCulture(object objectToConvert)
else
{
return ((string)(method.Invoke(objectToConvert, new object[] {
formatProviderField })));
this.formatProviderField })));
}
}
}
Expand All @@ -315,7 +315,7 @@ public ToStringInstanceHelper ToStringHelper
{
get
{
return toStringHelperField;
return this.toStringHelperField;
}
}
#endregion
Expand Down
Loading