-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
MNT Run dos2unix #21053
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
MNT Run dos2unix #21053
Conversation
8ce87b4
to
7182c26
Compare
b17ec7c
to
eade9d1
Compare
eade9d1
to
ad218f5
Compare
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.
Thanks for unifying line endings, this sounds reasonable.
However contribution changes can't be integrated if there are linting errors, which is de facto to the case here.
The pre-commit setup should solve some of the problem. You can trigger it by calling black
and by then committing changes.
i'll run black into a different commit, but same PR. Should fix the problem. |
4cef309
to
8b979c1
Compare
053b03e
to
9c9090f
Compare
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 LGTM after removing some dead code. Thanks @DimitriPapadopoulos.
# ~ 'decorator to trim function calls to match the arity of the target' | ||
# ~ def _trim_arity(func, maxargs=3): | ||
# ~ if func in singleArgBuiltins: | ||
# ~ return lambda s,l,t: func(t) | ||
# ~ limit = 0 | ||
# ~ foundArity = False | ||
# ~ def wrapper(*args): | ||
# ~ nonlocal limit,foundArity | ||
# ~ while 1: | ||
# ~ try: | ||
# ~ ret = func(*args[limit:]) | ||
# ~ foundArity = True | ||
# ~ return ret | ||
# ~ except TypeError: | ||
# ~ if limit == maxargs or foundArity: | ||
# ~ raise | ||
# ~ limit += 1 | ||
# ~ continue | ||
# ~ return wrapper |
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 can be removed.
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.
Not sure about this one:
The function that is commented out is for Python 3:
scikit-learn/doc/tutorial/machine_learning_map/pyparsing.py
Lines 994 to 996 in d3429c1
# Only works on Python 3.x - nonlocal is toxic to Python 2 installs | |
#~ 'decorator to trim function calls to match the arity of the target' | |
#~ def _trim_arity(func, maxargs=3): |
The current function is for Python 2-3:
scikit-learn/doc/tutorial/machine_learning_map/pyparsing.py
Lines 1015 to 1017 in d3429c1
# this version is Python 2.x-3.x cross-compatible | |
'decorator to trim function calls to match the arity of the target' | |
def _trim_arity(func, maxargs=2): |
Shouldn't we discard the current Python 2-3 code and enable the commented out Python 3 code?
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.
I feel this should be handled in a different PR.
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.
That's a good question. Even though Python 2 is not supported anymore, a conservative choice would be to keep the current one if it works for Python 3. But the commented one used for Python 3 is way smaller and using it this would ease maintenance.
In any case, I am not sure if tutorial are referenced nor used anymore.
Cc: @glemaitre for a more authoritative point of view.
ead6ffa
to
502ca37
Compare
Please @DimitriPapadopoulos, do not force-push if your PRs got one or more review as reviews have to be done again entirely. Also, from a git log point of view, this won't have an impact because commits are squashed. |
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.
Thanks for the PR @DimitriPapadopoulos !
Since doc/tutorial/machine_learning_map/pyparsing.py
and doc/tutorial/machine_learning_map/parse_path.py
look vendored, I suggest not to change them.
I think we can keep the change in doc/tutorial/machine_learning_map/svg2imagemap.py
and sklearn/svm/_newrand.pyx
.
Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
502ca37
to
269adb8
Compare
Ah, I hadn't noticed these two files are vendored files. I've removed these files from the commits. |
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.
LGTM
Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
What does this implement/fix? Explain your changes.
Run
dos2unix
on 4 files withCR
LF
Windows line endings instead ofLF
Unix line endings.My initial motivation was that some diff tools show the additional
CR
as an annoying bold and red "^M
"!Any other comments?
Initially part of #21051.