From 3eb679a86956d9eedf24492f0002de002f7180f5 Mon Sep 17 00:00:00 2001 From: Anton Samarchyan Date: Tue, 24 Jan 2017 16:23:56 -0500 Subject: [PATCH] Refs #27656 -- Updated django.forms/http docstring verbs according to PEP 257. --- django/dispatch/dispatcher.py | 10 ++-- django/forms/boundfield.py | 39 +++++++-------- django/forms/fields.py | 76 +++++++++++++--------------- django/forms/forms.py | 87 ++++++++++++++------------------ django/forms/formsets.py | 77 ++++++++++++----------------- django/forms/models.py | 90 ++++++++++++++++------------------ django/forms/utils.py | 2 +- django/forms/widgets.py | 27 +++++----- django/http/multipartparser.py | 23 ++++----- django/http/request.py | 46 +++++++++-------- django/http/response.py | 14 +++--- 11 files changed, 225 insertions(+), 266 deletions(-) diff --git a/django/dispatch/dispatcher.py b/django/dispatch/dispatcher.py index 5599b9fdfc..5e1f83890f 100644 --- a/django/dispatch/dispatcher.py +++ b/django/dispatch/dispatcher.py @@ -118,7 +118,7 @@ class Signal: Disconnect receiver from sender for signal. If weak references are used, disconnect need not be called. The receiver - will be remove from dispatch automatically. + will be removed from dispatch automatically. Arguments: @@ -168,7 +168,7 @@ class Signal: named Named arguments which will be passed to receivers. - Returns a list of tuple pairs [(receiver, response), ... ]. + Return a list of tuple pairs [(receiver, response), ... ]. """ if not self.receivers or self.sender_receivers_cache.get(sender) is NO_RECEIVERS: return [] @@ -194,12 +194,10 @@ class Signal: arguments must be a subset of the argument names defined in providing_args. - Return a list of tuple pairs [(receiver, response), ... ]. May raise - DispatcherKeyError. + Return a list of tuple pairs [(receiver, response), ... ]. If any receiver raises an error (specifically any subclass of - Exception), the error instance is returned as the result for that - receiver. + Exception), return the error instance as the result for that receiver. """ if not self.receivers or self.sender_receivers_cache.get(sender) is NO_RECEIVERS: return [] diff --git a/django/forms/boundfield.py b/django/forms/boundfield.py index dc34958777..cb256fc76b 100644 --- a/django/forms/boundfield.py +++ b/django/forms/boundfield.py @@ -31,7 +31,7 @@ class BoundField: self.help_text = field.help_text or '' def __str__(self): - """Renders this field as an HTML widget.""" + """Render this field as an HTML widget.""" if self.field.show_hidden_initial: return self.as_widget() + self.as_hidden(only_initial=True) return self.as_widget() @@ -69,16 +69,15 @@ class BoundField: @property def errors(self): """ - Returns an ErrorList for this field. Returns an empty ErrorList - if there are none. + Return an ErrorList (empty if there are no errors) for this field. """ return self.form.errors.get(self.name, self.form.error_class()) def as_widget(self, widget=None, attrs=None, only_initial=False): """ - Renders the field by rendering the passed widget, adding any HTML - attributes passed as attrs. If no widget is specified, then the - field's default widget will be used. + Render the field by rendering the passed widget, adding any HTML + attributes passed as attrs. If a widget isn't specified, use the + field's default widget. """ if not widget: widget = self.field.widget @@ -119,30 +118,30 @@ class BoundField: def as_text(self, attrs=None, **kwargs): """ - Returns a string of HTML for representing this as an . + Return a string of HTML for representing this as an . """ return self.as_widget(TextInput(), attrs, **kwargs) def as_textarea(self, attrs=None, **kwargs): - "Returns a string of HTML for representing this as a