Skip to content
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

STYLE: Reformat missing dir #761

Closed

Conversation

charlesdong1991
Copy link
Contributor

this pr will reformat missing dir, and max length has set to 100.

@softagram-bot
Copy link

Softagram Impact Report for pull/761 (head commit: 6d78413)

⭐ Change Overview

Showing the changed files, dependency changes and the impact - click for full size
(Open in Softagram Desktop for full details)

📄 Full report

Impact Report explained. Give feedback on this report to [email protected]

@codecov-io
Copy link

codecov-io commented Sep 8, 2019

Codecov Report

Merging #761 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #761   +/-   ##
=======================================
  Coverage   93.91%   93.91%           
=======================================
  Files          32       32           
  Lines        5667     5667           
=======================================
  Hits         5322     5322           
  Misses        345      345
Impacted Files Coverage Δ
databricks/koalas/missing/common.py 100% <ø> (ø) ⬆️
databricks/koalas/missing/groupby.py 100% <100%> (ø) ⬆️
databricks/koalas/missing/__init__.py 100% <100%> (ø) ⬆️
databricks/koalas/missing/indexes.py 100% <100%> (ø) ⬆️
databricks/koalas/missing/frame.py 100% <100%> (ø) ⬆️
databricks/koalas/missing/series.py 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update db3cf1e...6d78413. Read the comment docs.


# Functions
agg = unsupported_function('agg')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, '' vs "`. both are legitimate per PEP 8. Does this show an error?

Copy link
Contributor Author

@charlesdong1991 charlesdong1991 Sep 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, they standardize quotes to " in Black. You are right, both are legitimate in PEP8. I think they just try to avoid some people use ' while some use "

def unsupported_function(*args, **kwargs):
raise PandasNotImplementedError(class_name=class_name, method_name=method_name,
reason=reason)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm .. this is legitimate per PEP 8 if I didn't miss anything.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, i think almost all lines in the current codebase are legitimate. This is just how Black reformat codes to standardize code style i think

reason="Unlike pandas, most DataFrames are not materialized in memory in Spark "
"(and Koalas), and as a result memory_usage() does not do what you intend it "
"to do. Use Spark's web UI to monitor disk and memory usage of your application.")
"(and Koalas), and as a result memory_usage() does not do what you intend it "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and, this actually looks a bit odd. Because alined indentation within parentheses is legitimate per PEP 8 as well (i use this style quite often too)

@HyukjinKwon
Copy link
Member

@charlesdong1991, is it possible to make the changes smaller by ignoring some rules? Seems it's too aggressive.

@charlesdong1991
Copy link
Contributor Author

charlesdong1991 commented Sep 9, 2019

yeah, i agree with you some look a bit odd and aggressive. There are several ways to write codes aligned with PEP8, and I think Black just choose one of them so that in a way all codes follow the same style. I will take a deeper look later to see if there are less aggressive way to figure this out. @HyukjinKwon

with my past experience, i think sometimes code reformatted by Black is not aligned with flake8, so some people suggest to ignore some rules in flake8. I will let you know later.

btw, I think some of your doubts can be answered in their README, https://github.com/psf/black, and pls let me know your thoughts :)

@HyukjinKwon
Copy link
Member

Hmmmm .. is it possible to disable the formatting itself less aggressively?

@HyukjinKwon
Copy link
Member

or .. is it possible to only reformat the github diff optionally? In case of Apache Spark, it has a script called dev/scalafmt which can optionally reformat the files but only for the diff IIRC. I wonder if Black has similar feature.

@ueshin
Copy link
Collaborator

ueshin commented Sep 9, 2019

I'd prefer to only reformat the github diff, but seems like black does not support partial format (psf/black#320).
There is an extension to support it, but I'm not sure how it works (https://github.com/wbolster/black-macchiato).

@charlesdong1991
Copy link
Contributor Author

Hmmmm .. is it possible to disable the formatting itself less aggressively?

i think only forcing the string quotes can be easily ignored in Black...

@charlesdong1991
Copy link
Contributor Author

sorry, i was away for a holiday, and back now, I am not sure how you want to proceed on this? or do you want to proceed? maybe give some directions you prefer? @HyukjinKwon @ueshin

otherwise, i would like to pick up other issues then :)

@HyukjinKwon
Copy link
Member

HyukjinKwon commented Sep 27, 2019

Can we only apply the formatting for github diff? I think @ueshin gave a pointer at #761 (comment)

@charlesdong1991
Copy link
Contributor Author

i am afraid partial formatting is not supported by black because it goes against black's philosophy which is to have standard/unified code format in the project even it's aligned with PEP8.

Regarding the alternative, i also saw that repo quite long ago, and I don't know exactly how that works, but when i read it, in README it says: Note that this tool is a stopgap measure, and you should avoid using it if you can, so I was doubting if koalas should adopt this.

@HyukjinKwon
Copy link
Member

Hm .. let's drop this for now then. I think it's too aggressive and forces us the style even if you don't like it ..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants