-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
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
Fixed #27656 -- Updated docstring verbs according to PEP 257. #7763
Conversation
django/test/client.py
Outdated
and passes to the handler, returning the result of the handler. | ||
Assumes defaults for the query environment, which can be overridden | ||
The master request method. Compose the environment dictionary | ||
and pass to the handler, return the result of the handler. |
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.
, -> , and
django/test/client.py
Outdated
@@ -674,9 +674,9 @@ def _login(self, user, backend=None): | |||
|
|||
def logout(self): | |||
""" | |||
Removes the authenticated user's cookies and session object. | |||
Remove the authenticated user's cookies and session object. |
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.
"Log out the user by removing the cookies and session object."
(remove second sentence)
django/test/client.py
Outdated
@@ -701,7 +701,7 @@ def _parse_json(self, response, **extra): | |||
return response._json | |||
|
|||
def _handle_redirects(self, response, **extra): | |||
"Follows any redirects by requesting responses from the server using GET." | |||
"Follow any redirects by requesting responses from the server using GET." |
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.
Pep257 says, "Triple quotes are used even though the string fits on one line. This makes it easy to later expand it."
django/test/client.py
Outdated
@@ -441,14 +441,14 @@ def __init__(self, enforce_csrf_checks=False, **defaults): | |||
|
|||
def store_exc_info(self, **kwargs): | |||
""" | |||
Stores exceptions when they are generated by a view. | |||
Store exceptions when they are generated by a view. | |||
""" | |||
self.exc_info = sys.exc_info() | |||
|
|||
@property | |||
def session(self): | |||
""" |
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.
Should these by one liners ? e.g. """Obtain the current session variables.""" -- we currently don't have consistency about that.
4881036
to
3217f1b
Compare
@timgraham I'll be making the changes you suggested as well as fixes for the verb style. Also, I noticed that this coding style is not being followed as well. I should probably be fixing that as well - I go through the all of the comments anyway.
And I assume it is a good idea to also make sure these PEP rules are being followed as well:
|
Keep this patch focused on django/ only -- don't worry about test docstrings, there's a separate ticket for that. |
Ok. Also I noticed that the wrapping is sometimes different. It can be 72 or less than 79. Since you mentioned it in the commit we should probably make it consistent to 79.
|
If you're making significant changes to the docstring, feel free to adjust the length to 79, otherwise don't make needless changes. |
247e63a
to
35785e9
Compare
I made some changes. Please see if I am on the right track. |
0be176f
to
c6dbc53
Compare
tests/admin_checks/tests.py
Outdated
@@ -158,7 +158,7 @@ class SongAdmin(admin.ModelAdmin): | |||
|
|||
def test_custom_modelforms_with_fields_fieldsets(self): | |||
""" | |||
# Regression test for #8027: custom ModelForms with fields/fieldsets |
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.
As I mentioned before, please don't modify any test docstrings for this PR.
django/test/client.py
Outdated
The test client has been asked to follow a redirect loop. | ||
""" | ||
"""The test client has been asked to follow a redirect loop.""" | ||
|
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'd skip the blank line after the class docstring changes. Focus on changing the verbs only.
# reporting purposes. Needed to maintain backwards | ||
# compatibility with existing admin templates. | ||
""" | ||
Wrapper class used to return items in a list_editable |
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.
Might as well reflow the line length in a case like this.
django/contrib/admin/checks.py
Outdated
@@ -420,8 +419,8 @@ def _check_prepopulated_fields_value(self, obj, model, val, label): | |||
])) | |||
|
|||
def _check_prepopulated_fields_value_item(self, obj, model, field_name, label): | |||
""" For `prepopulated_fields` equal to {"slug": ("title",)}, | |||
`field_name` is "title". """ | |||
"""For `prepopulated_fields` equal to {"slug": ("title",)}, |
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.
Be consistent about the multiline style -- use
"""
....
"""
django/apps/registry.py
Outdated
# perform imports because of the risk of import loops. It mustn't | ||
# call get_app_config(). | ||
""" | ||
Since this method is called when models are imported, it cannot |
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 content isn't a docstring, so inline comment is more appropriate.
django/apps/config.py
Outdated
""" | ||
Class representing a Django application and its configuration. | ||
""" | ||
"""Class representing a Django application and its configuration.""" |
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.
If there aren't any content changes required, don't bother changing a docstring like this.
c6dbc53
to
8efc72b
Compare
Please do only verb changes in this PR. I think all other changes could be refactored automatically with some tool if we decide to do that. Otherwise, this is just creating a huge unreviewable patch. |
So I assume this means don't follow your previous suggestions and do only verb changes. I caught few typos - I will include them as well. |
Yes, sorry I had second thoughts about this when I started seeing how many more changes would be required as well as the thought that other changes could be automated. |
On further thought, I'd hold off on doing further changes for a couple weeks so that you don't create merge conflicts with all that code that will be removed in Django 2.0 as part of the ending deprecations (#7773). I'll leave a note when it's a good time to continue. Thanks! |
197a583
to
e68078c
Compare
I guess we can continue with this ticket since #7773 got merged. |
Sure, feel free to rebase. Maybe you can submit some smaller commits for easier review, such as only doing "django.contrib" so that the patch doesn't get so long that GitHub starts displaying "Load diff" buttons. It gets tedious to click those to review things. |
I completed all of the changes. |
What was your methodology for identifying places that need to be fixed? Working my way through |
django.contrib commit merged in 5411821 (with many edits). |
1d78a25
to
3bbf8a1
Compare
3a1eb45
to
adfe549
Compare
adfe549
to
93b3c71
Compare
https://code.djangoproject.com/ticket/27656