Skip to content

DOC: Fix code style in any and all methods #51195

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

Closed
wants to merge 1 commit into from
Closed

DOC: Fix code style in any and all methods #51195

wants to merge 1 commit into from

Conversation

m-ahmadi
Copy link
Contributor

@m-ahmadi m-ahmadi commented Feb 6, 2023

change double quotes to single quotes

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

change double quotes to single quotes
@MarcoGorelli
Copy link
Member

thanks for your PR, but please don't do this to any repo

closing then, please search 'good first issue' if you want something to contribute to, and check the contributing guide https://pandas.pydata.org/docs/dev/development/contributing.html

@m-ahmadi
Copy link
Contributor Author

m-ahmadi commented Feb 6, 2023

I saw mixed usage of both in those code examples, so my logic was that must be a mistake.
But I might have mistaken which style (double or single) is recommended in Pandas.
Is that what you are referring to? or just "code style" commits in general?

I don't see why I shouldn't have done this, unless mixed usage of both is valid in terms of recommended style guide.

@MarcoGorelli
Copy link
Member

this is the kind of thing we'd only do with an automated checker, please don't do it by hand

@MarcoGorelli
Copy link
Member

could do with some help on #37875 if you're interested in docs / stylistic issues

@m-ahmadi
Copy link
Contributor Author

m-ahmadi commented Feb 7, 2023

Does the automated checker also check code examples in docstrings?

Because I looked at some more methods and there were many more cases of this mixed usage of single & double quotes.

So I thought maybe it's the checker's fault for letting this happen in the first place.

The ones with mixed usage:

info
insert
lt
gt
le
ge
ne
eq
agg
aggregate
transform
groupby
all
any
...

The ones with double quotes:

set_flags
convert_dtypes
infer_objects
copy
get
expanding
...

@m-ahmadi
Copy link
Contributor Author

m-ahmadi commented Nov 7, 2024

I came across this today and see that the discrepancies still exist in the docs...

Is this not considered an issue? Maybe not a critical issue, but still, it's an eyesore...

@jorisvandenbossche
Copy link
Member

If there is a linter that can check and fix this automatically, I think we would be happy to take a PR for that

@MarcoGorelli
Copy link
Member

one complication is pandas' complicated docstring substitution mechanism...I don't it would be too easy to fix this automatically, but it should be possible to verify that it's done by amending

file.write(content)
file.flush()
cmd = [
sys.executable,
"-m",
"flake8",
"--format=%(row)d\t%(col)d\t%(code)s\t%(text)s",
"--max-line-length=88",
"--ignore=E203,E3,W503,W504,E402,E731,E128,E124,E704",
file.name,
]
response = subprocess.run(cmd, capture_output=True, check=False, text=True)
for output in ("stdout", "stderr"):
out = getattr(response, output)
out = out.replace(file.name, "")
messages = out.strip("\n").splitlines()
if messages:
error_messages.extend(messages)

to do some other check

not sure it would be worth it, and i can't commit to reviewing at this time, just pointing it out as a possibility

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.

3 participants