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

Use inspect.getdoc to get model description #657

Merged
merged 3 commits into from
Jul 24, 2019

Conversation

tiangolo
Copy link
Member

@tiangolo tiangolo commented Jul 13, 2019

Change Summary

Use inspect.getdoc to get model description instead of the custom function clean_docstring.

It also allows models to inherit a description, the same way classes inherit a docstring.

Ref: https://docs.python.org/3/library/inspect.html#inspect.getdoc

Related issue number

Minor change without issue.

Checklist

  • Unit tests for the changes exist
  • Tests pass on CI and coverage remains at 100%
  • Documentation reflects the changes where applicable
  • HISTORY.rst has been updated
    • if this is the first change since a release, please add a new section
    • include the issue number or this pull request number #<number>
    • include your github username @<whomever>

This instead of the custom function clean_docstring.
It also allows models to inherit a description, the same way classes inherit a docstring.
@tiangolo
Copy link
Member Author

Let me know if you want to have extra tests for models inheriting the description.

@codecov
Copy link

codecov bot commented Jul 13, 2019

Codecov Report

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

@@          Coverage Diff          @@
##           master   #657   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          15     15           
  Lines        2673   2672    -1     
  Branches      530    530           
=====================================
- Hits         2673   2672    -1

Copy link
Member

@samuelcolvin samuelcolvin left a comment

Choose a reason for hiding this comment

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

LGTM, just conflicts and rebase/update history.

@samuelcolvin samuelcolvin merged commit 886d05e into pydantic:master Jul 24, 2019
@tiangolo
Copy link
Member Author

Sorry for the delay on this.

Thanks for moving it forward and merging.

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.

2 participants