Skip to content

Fix PR06 errors in docstrings ('Parameter "{param_name}" type should use "{right_type}" instead of "{wrong_type}"') #28253

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
1 of 39 tasks
danielplawrence opened this issue Sep 2, 2019 · 7 comments
Assignees
Labels

Comments

@danielplawrence
Copy link
Contributor

danielplawrence commented Sep 2, 2019

link to original issue

The output of python scripts/validate_docstrings.py --errors=PR06 returns 257 instances of 'Parameter "{param_name}" type should use "{right_type}" instead of "{wrong_type}'

Given the large number of cases, it probably makes sense to break them out by class:

  • pandas.Series
  • pandas.Timestamp
  • pandas.Timedelta
  • pandas.Period
  • pandas.arrays
  • pandas.Categorical
  • pandas.SparseArray
  • pandas.read* (inc. all 'read' methods e.g. read_sql, read spss etc.)
  • pandas.HDFStore
  • pandas.io.stata
  • pandas.core.resample
  • pandas.testing
  • pandas.api
  • pandas.melt
  • pandas.pivot
  • pandas.pivot_table
  • pandas.qcut
  • pandas.merge_asof
  • pandas.to_numeric
  • pandas.to_datetime
  • pandas.date_range
  • pandas.bdate_range
  • pandas.period_range
  • pandas.timedelta_range
  • pandas.infer_freq
  • pandas.interval_range
  • pandas.eval
  • pandas.util
  • pandas.Index
  • pandas.CategoricalIndex
  • pandas.IntervalIndex
  • pandas.MultiIndex
  • pandas.DatetimeIndex
  • pandas.TimedeltaIndex
  • pandas.PeriodIndex
  • pandas.Grouper
  • pandas.core
  • pandas.io
  • pandas.DataFrame
@danielplawrence danielplawrence changed the title Fix PR06 errors in docstrings ('Parameter "{param_name}" type should use "{right_type}" instead of "{wrong_type}") Fix PR06 errors in docstrings ('Parameter "{param_name}" type should use "{right_type}" instead of "{wrong_type}"') Sep 2, 2019
@danielplawrence
Copy link
Contributor Author

I'll have a go at the first 10 here

@TomAugspurger TomAugspurger added this to the Contributions Welcome milestone Sep 3, 2019
@Kanter666
Copy link

I can join on this and take the second 10 (from pandas.core.resample up to pandas.to_datetime).

@danielplawrence
Copy link
Contributor Author

Thanks Adam!

A lot of these should be straightforward, but I've noticed there are some cases where we will want to change validate_docstrings.py -- for example, it fails on parameter type 'basestring' because the validation is done with a simple 'in' test, and 'string' in 'basestring == True.

Additionally, the tests for validate_docstrings.py are not being executed as part of the main pytest target (not sure if this should be changed), so we need to run test_validate_docstrings.py explicitly with pytest to check any changes to the script are working properly.

@TomAugspurger
Copy link
Contributor

it fails on parameter type 'basestring' because the validation is done with a simple 'in' test, and 'string' in 'basestring == True.

Just FYI, we can remove all references to basestring. That's a Python 2 thing which we've removed.

@willpeppo
Copy link
Contributor

take

@willpeppo
Copy link
Contributor

The output of python scripts/validate_docstrings.py --errors=PR06 returns 12 instances of 'Parameter "{param_name}" type should use "{right_type}" instead of "{wrong_type}' (4 in pandas.Timestamp and 8 in pandas.Timedelta.

@mroeschke
Copy link
Member

Closing as #28724 covers this specific case.

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

Successfully merging a pull request may close this issue.

5 participants