Skip to content

Commit 66a30cf

Browse files
authored
CLI -- regenerate templated CS files (#3954)
1 parent 227da9d commit 66a30cf

File tree

6 files changed

+423
-423
lines changed

6 files changed

+423
-423
lines changed

src/mlnet/Templates/Console/ModelBuilder.cs

+137-137
Large diffs are not rendered by default.

src/mlnet/Templates/Console/ModelInputClass.cs

+52-52
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public partial class ModelInputClass : ModelInputClassBase
2525
/// </summary>
2626
public virtual string TransformText()
2727
{
28-
Write(@"//*****************************************************************************************
28+
this.Write(@"//*****************************************************************************************
2929
//* *
3030
//* This is an auto-generated file by Microsoft ML.NET CLI (Command-Line Interface) tool. *
3131
//* *
@@ -34,15 +34,15 @@ public virtual string TransformText()
3434
using Microsoft.ML.Data;
3535
3636
namespace ");
37-
Write(ToStringHelper.ToStringWithCulture(Namespace));
38-
Write(".Model.DataModels\r\n{\r\n public class ModelInput\r\n {\r\n");
37+
this.Write(this.ToStringHelper.ToStringWithCulture(Namespace));
38+
this.Write(".Model.DataModels\r\n{\r\n public class ModelInput\r\n {\r\n");
3939
foreach(var label in ClassLabels){
40-
Write(" ");
41-
Write(ToStringHelper.ToStringWithCulture(label));
42-
Write("\r\n");
40+
this.Write(" ");
41+
this.Write(this.ToStringHelper.ToStringWithCulture(label));
42+
this.Write("\r\n");
4343
}
44-
Write("}\r\n}\r\n");
45-
return GenerationEnvironment.ToString();
44+
this.Write("}\r\n}\r\n");
45+
return this.GenerationEnvironment.ToString();
4646
}
4747

4848
public IList<string> ClassLabels {get;set;}
@@ -72,15 +72,15 @@ protected System.Text.StringBuilder GenerationEnvironment
7272
{
7373
get
7474
{
75-
if ((generationEnvironmentField == null))
75+
if ((this.generationEnvironmentField == null))
7676
{
77-
generationEnvironmentField = new global::System.Text.StringBuilder();
77+
this.generationEnvironmentField = new global::System.Text.StringBuilder();
7878
}
79-
return generationEnvironmentField;
79+
return this.generationEnvironmentField;
8080
}
8181
set
8282
{
83-
generationEnvironmentField = value;
83+
this.generationEnvironmentField = value;
8484
}
8585
}
8686
/// <summary>
@@ -90,11 +90,11 @@ public System.CodeDom.Compiler.CompilerErrorCollection Errors
9090
{
9191
get
9292
{
93-
if ((errorsField == null))
93+
if ((this.errorsField == null))
9494
{
95-
errorsField = new global::System.CodeDom.Compiler.CompilerErrorCollection();
95+
this.errorsField = new global::System.CodeDom.Compiler.CompilerErrorCollection();
9696
}
97-
return errorsField;
97+
return this.errorsField;
9898
}
9999
}
100100
/// <summary>
@@ -104,11 +104,11 @@ private System.Collections.Generic.List<int> indentLengths
104104
{
105105
get
106106
{
107-
if ((indentLengthsField == null))
107+
if ((this.indentLengthsField == null))
108108
{
109-
indentLengthsField = new global::System.Collections.Generic.List<int>();
109+
this.indentLengthsField = new global::System.Collections.Generic.List<int>();
110110
}
111-
return indentLengthsField;
111+
return this.indentLengthsField;
112112
}
113113
}
114114
/// <summary>
@@ -118,7 +118,7 @@ public string CurrentIndent
118118
{
119119
get
120120
{
121-
return currentIndentField;
121+
return this.currentIndentField;
122122
}
123123
}
124124
/// <summary>
@@ -128,11 +128,11 @@ public string CurrentIndent
128128
{
129129
get
130130
{
131-
return sessionField;
131+
return this.sessionField;
132132
}
133133
set
134134
{
135-
sessionField = value;
135+
this.sessionField = value;
136136
}
137137
}
138138
#endregion
@@ -148,59 +148,59 @@ public void Write(string textToAppend)
148148
}
149149
// If we're starting off, or if the previous text ended with a newline,
150150
// we have to append the current indent first.
151-
if (((GenerationEnvironment.Length == 0)
152-
|| endsWithNewline))
151+
if (((this.GenerationEnvironment.Length == 0)
152+
|| this.endsWithNewline))
153153
{
154-
GenerationEnvironment.Append(currentIndentField);
155-
endsWithNewline = false;
154+
this.GenerationEnvironment.Append(this.currentIndentField);
155+
this.endsWithNewline = false;
156156
}
157157
// Check if the current text ends with a newline
158158
if (textToAppend.EndsWith(global::System.Environment.NewLine, global::System.StringComparison.CurrentCulture))
159159
{
160-
endsWithNewline = true;
160+
this.endsWithNewline = true;
161161
}
162162
// This is an optimization. If the current indent is "", then we don't have to do any
163163
// of the more complex stuff further down.
164-
if ((currentIndentField.Length == 0))
164+
if ((this.currentIndentField.Length == 0))
165165
{
166-
GenerationEnvironment.Append(textToAppend);
166+
this.GenerationEnvironment.Append(textToAppend);
167167
return;
168168
}
169169
// Everywhere there is a newline in the text, add an indent after it
170-
textToAppend = textToAppend.Replace(global::System.Environment.NewLine, (global::System.Environment.NewLine + currentIndentField));
170+
textToAppend = textToAppend.Replace(global::System.Environment.NewLine, (global::System.Environment.NewLine + this.currentIndentField));
171171
// If the text ends with a newline, then we should strip off the indent added at the very end
172172
// because the appropriate indent will be added when the next time Write() is called
173-
if (endsWithNewline)
173+
if (this.endsWithNewline)
174174
{
175-
GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - currentIndentField.Length));
175+
this.GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - this.currentIndentField.Length));
176176
}
177177
else
178178
{
179-
GenerationEnvironment.Append(textToAppend);
179+
this.GenerationEnvironment.Append(textToAppend);
180180
}
181181
}
182182
/// <summary>
183183
/// Write text directly into the generated output
184184
/// </summary>
185185
public void WriteLine(string textToAppend)
186186
{
187-
Write(textToAppend);
188-
GenerationEnvironment.AppendLine();
189-
endsWithNewline = true;
187+
this.Write(textToAppend);
188+
this.GenerationEnvironment.AppendLine();
189+
this.endsWithNewline = true;
190190
}
191191
/// <summary>
192192
/// Write formatted text directly into the generated output
193193
/// </summary>
194194
public void Write(string format, params object[] args)
195195
{
196-
Write(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args));
196+
this.Write(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args));
197197
}
198198
/// <summary>
199199
/// Write formatted text directly into the generated output
200200
/// </summary>
201201
public void WriteLine(string format, params object[] args)
202202
{
203-
WriteLine(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args));
203+
this.WriteLine(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args));
204204
}
205205
/// <summary>
206206
/// Raise an error
@@ -209,7 +209,7 @@ public void Error(string message)
209209
{
210210
System.CodeDom.Compiler.CompilerError error = new global::System.CodeDom.Compiler.CompilerError();
211211
error.ErrorText = message;
212-
Errors.Add(error);
212+
this.Errors.Add(error);
213213
}
214214
/// <summary>
215215
/// Raise a warning
@@ -219,7 +219,7 @@ public void Warning(string message)
219219
System.CodeDom.Compiler.CompilerError error = new global::System.CodeDom.Compiler.CompilerError();
220220
error.ErrorText = message;
221221
error.IsWarning = true;
222-
Errors.Add(error);
222+
this.Errors.Add(error);
223223
}
224224
/// <summary>
225225
/// Increase the indent
@@ -230,23 +230,23 @@ public void PushIndent(string indent)
230230
{
231231
throw new global::System.ArgumentNullException("indent");
232232
}
233-
currentIndentField = (currentIndentField + indent);
234-
indentLengths.Add(indent.Length);
233+
this.currentIndentField = (this.currentIndentField + indent);
234+
this.indentLengths.Add(indent.Length);
235235
}
236236
/// <summary>
237237
/// Remove the last indent that was added with PushIndent
238238
/// </summary>
239239
public string PopIndent()
240240
{
241241
string returnValue = "";
242-
if ((indentLengths.Count > 0))
242+
if ((this.indentLengths.Count > 0))
243243
{
244-
int indentLength = indentLengths[(indentLengths.Count - 1)];
245-
indentLengths.RemoveAt((indentLengths.Count - 1));
244+
int indentLength = this.indentLengths[(this.indentLengths.Count - 1)];
245+
this.indentLengths.RemoveAt((this.indentLengths.Count - 1));
246246
if ((indentLength > 0))
247247
{
248-
returnValue = currentIndentField.Substring((currentIndentField.Length - indentLength));
249-
currentIndentField = currentIndentField.Remove((currentIndentField.Length - indentLength));
248+
returnValue = this.currentIndentField.Substring((this.currentIndentField.Length - indentLength));
249+
this.currentIndentField = this.currentIndentField.Remove((this.currentIndentField.Length - indentLength));
250250
}
251251
}
252252
return returnValue;
@@ -256,8 +256,8 @@ public string PopIndent()
256256
/// </summary>
257257
public void ClearIndent()
258258
{
259-
indentLengths.Clear();
260-
currentIndentField = "";
259+
this.indentLengths.Clear();
260+
this.currentIndentField = "";
261261
}
262262
#endregion
263263
#region ToString Helpers
@@ -274,13 +274,13 @@ public System.IFormatProvider FormatProvider
274274
{
275275
get
276276
{
277-
return formatProviderField ;
277+
return this.formatProviderField ;
278278
}
279279
set
280280
{
281281
if ((value != null))
282282
{
283-
formatProviderField = value;
283+
this.formatProviderField = value;
284284
}
285285
}
286286
}
@@ -303,7 +303,7 @@ public string ToStringWithCulture(object objectToConvert)
303303
else
304304
{
305305
return ((string)(method.Invoke(objectToConvert, new object[] {
306-
formatProviderField })));
306+
this.formatProviderField })));
307307
}
308308
}
309309
}
@@ -315,7 +315,7 @@ public ToStringInstanceHelper ToStringHelper
315315
{
316316
get
317317
{
318-
return toStringHelperField;
318+
return this.toStringHelperField;
319319
}
320320
}
321321
#endregion

0 commit comments

Comments
 (0)