diff options
| author | Anton Samarchyan <anton.samarchyan@savoirfairelinux.com> | 2017-01-24 18:04:12 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-02-28 09:17:27 -0500 |
| commit | 60e52a047e55bc4cd5a93a8bd4d07baed27e9a22 (patch) | |
| tree | 010a363968b1ed41adf2e64c98d572d7148a2a5e /django/db/backends/postgresql | |
| parent | d6e26e5b7c8063c2cc5aa045edea6555bf358fc2 (diff) | |
Refs #27656 -- Updated django.db docstring verbs according to PEP 257.
Diffstat (limited to 'django/db/backends/postgresql')
| -rw-r--r-- | django/db/backends/postgresql/base.py | 4 | ||||
| -rw-r--r-- | django/db/backends/postgresql/introspection.py | 11 | ||||
| -rw-r--r-- | django/db/backends/postgresql/operations.py | 13 | ||||
| -rw-r--r-- | django/db/backends/postgresql/schema.py | 4 | ||||
| -rw-r--r-- | django/db/backends/postgresql/version.py | 4 |
5 files changed, 17 insertions, 19 deletions
diff --git a/django/db/backends/postgresql/base.py b/django/db/backends/postgresql/base.py index 7dab1cb364..f8a13eeb5f 100644 --- a/django/db/backends/postgresql/base.py +++ b/django/db/backends/postgresql/base.py @@ -230,8 +230,8 @@ class DatabaseWrapper(BaseDatabaseWrapper): def check_constraints(self, table_names=None): """ - To check constraints, we set constraints to immediate. Then, when, we're done we must ensure they - are returned to deferred. + Check constraints by setting them to immediate. Return them to deferred + afterward. """ self.cursor().execute('SET CONSTRAINTS ALL IMMEDIATE') self.cursor().execute('SET CONSTRAINTS ALL DEFERRED') diff --git a/django/db/backends/postgresql/introspection.py b/django/db/backends/postgresql/introspection.py index d50f6eb9c2..7e7091a613 100644 --- a/django/db/backends/postgresql/introspection.py +++ b/django/db/backends/postgresql/introspection.py @@ -53,9 +53,7 @@ class DatabaseIntrospection(BaseDatabaseIntrospection): return field_type def get_table_list(self, cursor): - """ - Returns a list of table and view names in the current database. - """ + """Return a list of table and view names in the current database.""" cursor.execute(""" SELECT c.relname, c.relkind FROM pg_catalog.pg_class c @@ -68,7 +66,10 @@ class DatabaseIntrospection(BaseDatabaseIntrospection): if row[0] not in self.ignored_tables] def get_table_description(self, cursor, table_name): - "Returns a description of the table, with the DB-API cursor.description interface." + """ + Return a description of the table with the DB-API cursor.description + interface. + """ # As cursor.description does not return reliably the nullable property, # we have to query the information_schema (#7783) cursor.execute(""" @@ -87,7 +88,7 @@ class DatabaseIntrospection(BaseDatabaseIntrospection): def get_relations(self, cursor, table_name): """ - Returns a dictionary of {field_name: (field_name_other_table, other_table)} + Return a dictionary of {field_name: (field_name_other_table, other_table)} representing all relationships to the given table. """ cursor.execute(""" diff --git a/django/db/backends/postgresql/operations.py b/django/db/backends/postgresql/operations.py index d246638cca..4658eac7c1 100644 --- a/django/db/backends/postgresql/operations.py +++ b/django/db/backends/postgresql/operations.py @@ -202,16 +202,15 @@ class DatabaseOperations(BaseDatabaseOperations): def max_name_length(self): """ - Returns the maximum length of an identifier. + Return the maximum length of an identifier. - Note that the maximum length of an identifier is 63 by default, but can - be changed by recompiling PostgreSQL after editing the NAMEDATALEN - macro in src/include/pg_config_manual.h . + The maximum length of an identifier is 63 by default, but can be + changed by recompiling PostgreSQL after editing the NAMEDATALEN + macro in src/include/pg_config_manual.h. - This implementation simply returns 63, but can easily be overridden by a - custom database backend that inherits most of its behavior from this one. + This implementation returns 63, but can be overridden by a custom + database backend that inherits most of its behavior from this one. """ - return 63 def distinct_sql(self, fields): diff --git a/django/db/backends/postgresql/schema.py b/django/db/backends/postgresql/schema.py index e9928999db..9cedc763bd 100644 --- a/django/db/backends/postgresql/schema.py +++ b/django/db/backends/postgresql/schema.py @@ -52,9 +52,7 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): return None def _alter_column_type_sql(self, table, old_field, new_field, new_type): - """ - Makes ALTER TYPE with SERIAL make sense. - """ + """Make ALTER TYPE with SERIAL make sense.""" if new_type.lower() in ("serial", "bigserial"): column = new_field.column sequence_name = "%s_%s_seq" % (table, column) diff --git a/django/db/backends/postgresql/version.py b/django/db/backends/postgresql/version.py index d558fb2e51..3b219159f5 100644 --- a/django/db/backends/postgresql/version.py +++ b/django/db/backends/postgresql/version.py @@ -1,5 +1,5 @@ """ -Extracts the version of the PostgreSQL server. +Extract the version of the PostgreSQL server. """ import re @@ -24,7 +24,7 @@ def _parse_version(text): def get_version(connection): """ - Returns an integer representing the major, minor and revision number of the + Return an integer representing the major, minor, and revision number of the server. Format is the one used for the return value of libpq PQServerVersion()/``server_version`` connection attribute (available in newer psycopg2 versions.) |
