-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Make TextLoader.ArgumentsCore.Separator internal #2059
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
Make TextLoader.ArgumentsCore.Separator internal #2059
Conversation
Allow CmdParser.GetArgumentInfo to search through non-public fields
@@ -466,7 +466,7 @@ private static ArgumentInfo GetArgumentInfo(Type type, object defaults) | |||
var map = new Dictionary<string, Argument>(); | |||
Argument def = null; | |||
|
|||
foreach (FieldInfo field in type.GetFields()) | |||
foreach (FieldInfo field in type.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance [](start = 55, length = 68)
Cool. Thank you for working on this @mareklinka! As mentioned in the associated issue, we might need to do something like this in one or two more places.
16a5d4a
to
2987cd9
Compare
As mentioned, I refactored the I was unsure whether to do any additional checks on the attribute (e.g. check cc @TomFinley |
Can you also touch
? #Resolved |
Just to let everyone involved here know, I will be be out of range of a computer for the next 7 days so if more changes are required, I'll work on them once I get back. |
if (attribute == null) | ||
{ | ||
continue; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} [](start = 20, length = 1)
stylistic nit: no { } for one line instructions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, force of habit. Fixed.
|
||
private ArgumentAttribute GetAttribute(FieldInfo field) | ||
{ | ||
return field.GetCustomAttribute<ArgumentAttribute>(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since it is used only inside the function above, keep it as a delegate inside that function.
|
||
namespace Microsoft.ML.RunTests | ||
{ | ||
public class SmokeTests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public class SmokeTests [](start = 3, length = 24)
were you planning to remove those?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup. Done.
thanks for working on this @mareklinka. It looks good to me, and i'll be good to sign off as soon as the SmokeTests.cs is gone. In reply to: 454704447 [](ancestors = 454704447) |
8ba84b7
to
a2b2ebc
Compare
Small style fixes
a2b2ebc
to
f01c12f
Compare
Alright, hopefully that should be everything. Removed the smoke tests and fixed the style issues. Merged with current master and resolved conflicts. Let's see if it checks out. |
Codecov Report
@@ Coverage Diff @@
## master #2059 +/- ##
==========================================
- Coverage 66.08% 66.06% -0.02%
==========================================
Files 638 638
Lines 116423 116428 +5
Branches 14846 14847 +1
==========================================
- Hits 76939 76921 -18
- Misses 35231 35257 +26
+ Partials 4253 4250 -3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, thank you @mareklinka! Sorry for delay...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since
TextLoader.ArgumentsCore.Separator
is only used for the command line interface, #2041 aims to make the field internal so that it doesn't show for API users. In order to facilitate this hiding, theCmdParser.GetArgumentInfo
had to be updated to reflect on both public and private fields of the provided type.At the same time, the API-serving
SeparatorChars
field was renamed to simplySeparators
.Work in progress. More fields might be turned
internal
, depending on discussion in the issue.Fixes #2041