Skip to content

Commit 1467310

Browse files
committed
Formatting adjustments; remove types-as-docs and avoid single line doc-strings.
1 parent 9caff9a commit 1467310

23 files changed

Lines changed: 389 additions & 229 deletions

postgresql/clientparameters.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -580,15 +580,15 @@ def resolve_pg_service_file(
580580
return None
581581

582582
def collect(
583-
parsed_options = None,
584-
no_defaults = False,
585-
environ = os.environ,
586-
environ_prefix = 'PG',
587-
default_pg_sysconfdir = None,
588-
pg_service_file = None,
589-
prompt_title = '',
590-
parameters = (),
591-
):
583+
parsed_options = None,
584+
no_defaults = False,
585+
environ = os.environ,
586+
environ_prefix = 'PG',
587+
default_pg_sysconfdir = None,
588+
pg_service_file = None,
589+
prompt_title = '',
590+
parameters = (),
591+
):
592592
"""
593593
Build a normalized client parameters dictionary for use with a connection
594594
construction interface.

postgresql/cluster.py

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,35 @@ class ClusterError(pg_exc.Error):
4040
code = '-C000'
4141
source = 'CLUSTER'
4242
class ClusterInitializationError(ClusterError):
43-
"General cluster initialization failure"
43+
"""
44+
General cluster initialization failure.
45+
"""
4446
code = '-Cini'
4547
class InitDBError(ClusterInitializationError):
46-
"A non-zero result was returned by the initdb command"
48+
"""
49+
A non-zero result was returned by the initdb command.
50+
"""
4751
code = '-Cidb'
4852
class ClusterStartupError(ClusterError):
49-
"Cluster startup failed"
53+
"""
54+
Cluster startup failed.
55+
"""
5056
code = '-Cbot'
5157
class ClusterNotRunningError(ClusterError):
52-
"Cluster is not running"
58+
"""
59+
Cluster is not running.
60+
"""
5361
code = '-Cdwn'
5462
class ClusterTimeoutError(ClusterError):
55-
"Cluster operation timed out"
63+
"""
64+
Cluster operation timed out.
65+
"""
5666
code = '-Cout'
5767

5868
class ClusterWarning(pg_exc.Warning):
59-
"Warning issued by cluster operations"
69+
"""
70+
Warning issued by cluster operations.
71+
"""
6072
code = '-Cwrn'
6173
source = 'CLUSTER'
6274

@@ -154,10 +166,7 @@ def hba_file(self, join = os.path.join):
154166
join(self.data_directory, self.DEFAULT_HBA_FILENAME)
155167
)
156168

157-
def __init__(self,
158-
installation,
159-
data_directory,
160-
):
169+
def __init__(self, installation, data_directory):
161170
self.installation = installation
162171
self.data_directory = os.path.abspath(data_directory)
163172
self.pgsql_dot_conf = os.path.join(
@@ -190,11 +199,7 @@ def __exit__(self, typ, val, tb):
190199
self.stop()
191200
self.wait_until_stopped()
192201

193-
def init(self,
194-
password = None,
195-
timeout = None,
196-
**kw
197-
):
202+
def init(self, password = None, timeout = None, **kw):
198203
"""
199204
Create the cluster at the given `data_directory` using the
200205
provided keyword parameters as options to the command.
@@ -323,10 +328,7 @@ def drop(self):
323328
os.rmdir(os.path.join(root, name))
324329
os.rmdir(self.data_directory)
325330

326-
def start(self,
327-
logfile = None,
328-
settings = None
329-
):
331+
def start(self, logfile = None, settings = None):
330332
"""
331333
Start the cluster.
332334
"""
@@ -562,10 +564,7 @@ def ready_for_connections(self):
562564
# credentials... strange, but true..
563565
return e if e is not None else True
564566

565-
def wait_until_started(self,
566-
timeout = 10,
567-
delay = 0.05,
568-
):
567+
def wait_until_started(self, timeout = 10, delay = 0.05):
569568
"""
570569
After the `start` method is used, this can be ran in order to block
571570
until the cluster is ready for use.
@@ -614,10 +613,7 @@ def wait_until_started(self,
614613
raise e
615614
time.sleep(delay)
616615

617-
def wait_until_stopped(self,
618-
timeout = 10,
619-
delay = 0.05
620-
):
616+
def wait_until_stopped(self, timeout = 10, delay = 0.05):
621617
"""
622618
After the `stop` method is used, this can be ran in order to block until
623619
the cluster is shutdown.

postgresql/configfile.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
##
22
# .configfile
33
##
4-
'PostgreSQL configuration file parser and editor functions.'
4+
"""
5+
PostgreSQL configuration file parser and editor functions.
6+
"""
57
import sys
68
import os
79
from . import string as pg_str
@@ -76,18 +78,18 @@ def unquote(s, quote = quote):
7678
return s[1:-1].replace(quote*2, quote)
7779

7880
def write_config(map, writer, keys = None):
79-
'A configuration writer that will trample & merely write the settings'
81+
"""
82+
A configuration writer that will trample & merely write the settings.
83+
"""
8084
if keys is None:
8185
keys = map
8286
for k in keys:
8387
writer('='.join((k, map[k])) + os.linesep)
8488

85-
def alter_config(
86-
map : "the configuration changes to make",
87-
fo : "file object containing configuration lines(Iterable)",
88-
keys : "the keys to change; defaults to map.keys()" = None
89-
):
90-
'Alters a configuration file without trampling on the existing structure'
89+
def alter_config(map, fo, keys = None):
90+
"""
91+
Alters a configuration file without trampling on the existing structure.
92+
"""
9193
if keys is None:
9294
keys = list(map.keys())
9395
# Normalize keys and map them back to
@@ -212,7 +214,7 @@ class ConfigFile(pg_api.Settings):
212214
"""
213215
Provides a mapping interface to a configuration file.
214216
215-
Every action will cause the file to be wholly read, so using `update` to make
217+
Every operation will cause the file to be wholly read, so using `update` to make
216218
multiple changes is desirable.
217219
"""
218220
_e_factors = ('path',)

postgresql/copyman.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ def __next__(self):
443443
return self.nextchunk()
444444

445445
def __init__(self,
446-
recv_into : "callable taking writable buffer and size",
446+
recv_into,
447447
buffer_size = default_buffer_size
448448
):
449449
super().__init__()

0 commit comments

Comments
 (0)