Skip to content

Commit ef04b3c

Browse files
committed
Normalize doc-string formatting
1 parent 22c6295 commit ef04b3c

1 file changed

Lines changed: 77 additions & 26 deletions

File tree

postgresql/protocol/element3.py

Lines changed: 77 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
##
22
# .protocol.element3
33
##
4-
'PQ version 3.0 elements'
4+
"""
5+
PQ version 3.0 elements.
6+
"""
57
import sys
68
import os
79
import pprint
@@ -300,7 +302,9 @@ class Suspension(EmptyMessage):
300302
Suspension.SingleInstance = SuspensionMessage
301303

302304
class Ready(Message):
303-
'Ready for new query'
305+
"""
306+
Ready for new query message.
307+
"""
304308
type = message_types[b'Z'[0]]
305309
possible_states = (
306310
message_types[b'I'[0]],
@@ -319,7 +323,7 @@ def serialize(self):
319323

320324
class Notice(Message, dict):
321325
"""
322-
Notification message
326+
Notification message.
323327
324328
Used by PQ to emit INFO, NOTICE, and WARNING messages among other
325329
severities.
@@ -353,7 +357,9 @@ def parse(self):
353357
raise RuntimeError("cannot parse ClientNotice")
354358

355359
class Error(Notice):
356-
"""Incoming error"""
360+
"""
361+
Error information message.
362+
"""
357363
type = message_types[b'E'[0]]
358364
__slots__ = ()
359365

@@ -368,7 +374,9 @@ def parse(self):
368374
raise RuntimeError("cannot serialize ClientError")
369375

370376
class FunctionResult(Message):
371-
"""Function result value"""
377+
"""
378+
Function result value.
379+
"""
372380
type = message_types[b'V'[0]]
373381
__slots__ = ('result',)
374382

@@ -394,7 +402,9 @@ def parse(typ, data):
394402
return typ(data)
395403

396404
class AttributeTypes(TupleMessage):
397-
"""Tuple attribute types"""
405+
"""
406+
Tuple attribute types.
407+
"""
398408
type = message_types[b't'[0]]
399409
__slots__ = ()
400410

@@ -410,7 +420,9 @@ def parse(typ, data):
410420
return typ(unpack('!%dL'%(ac,), args))
411421

412422
class TupleDescriptor(TupleMessage):
413-
"""Tuple description"""
423+
"""
424+
Tuple structure description.
425+
"""
414426
type = message_types[b'T'[0]]
415427
struct = Struct("!LhLhlh")
416428
__slots__ = ()
@@ -442,7 +454,9 @@ def parse(typ, data):
442454
return typ(atts)
443455

444456
class Tuple(TupleMessage):
445-
"""Incoming tuple"""
457+
"""
458+
Tuple Data.
459+
"""
446460
type = message_types[b'D'[0]]
447461
__slots__ = ()
448462

@@ -480,7 +494,9 @@ def parse(typ, data,
480494
pass
481495

482496
class KillInformation(Message):
483-
'Backend cancellation information'
497+
"""
498+
Backend cancellation information.
499+
"""
484500
type = message_types[b'K'[0]]
485501
struct = Struct("!LL")
486502
__slots__ = ('pid', 'key')
@@ -497,7 +513,9 @@ def parse(typ, data):
497513
return typ(*typ.struct.unpack(data))
498514

499515
class CancelRequest(KillInformation):
500-
'Abort the query in the specified backend'
516+
"""
517+
Abort the query in the specified backend.
518+
"""
501519
type = b''
502520
from .version import CancelRequestCode as version
503521
packed_version = version.bytes()
@@ -519,7 +537,9 @@ def parse(typ, data):
519537
return typ(*typ.struct.unpack(data[4:]))
520538

521539
class NegotiateSSL(Message):
522-
"Discover backend's SSL support"
540+
"""
541+
Discover backend's SSL support.
542+
"""
523543
type = b''
524544
from .version import NegotiateSSLCode as version
525545
packed_version = version.bytes()
@@ -605,7 +625,9 @@ def parse(typ, data):
605625
}
606626

607627
class Authentication(Message):
608-
"""Authentication(request, salt)"""
628+
"""
629+
Authentication(request, salt)
630+
"""
609631
type = message_types[b'R'[0]]
610632
__slots__ = ('request', 'salt')
611633

@@ -621,38 +643,50 @@ def parse(typ, data):
621643
return typ(ulong_unpack(data[0:4]), data[4:])
622644

623645
class Password(StringMessage):
624-
'Password supplement'
646+
"""
647+
Password supplement.
648+
"""
625649
type = message_types[b'p'[0]]
626650
__slots__ = ('data',)
627651

628652
class Disconnect(EmptyMessage):
629-
'Close the connection'
653+
"""
654+
Connection closed message.
655+
"""
630656
type = message_types[b'X'[0]]
631657
__slots__ = ()
632658
DisconnectMessage = Message.__new__(Disconnect)
633659
Disconnect.SingleInstance = DisconnectMessage
634660

635661
class Flush(EmptyMessage):
636-
'Flush'
662+
"""
663+
Flush message.
664+
"""
637665
type = message_types[b'H'[0]]
638666
__slots__ = ()
639667
FlushMessage = Message.__new__(Flush)
640668
Flush.SingleInstance = FlushMessage
641669

642670
class Synchronize(EmptyMessage):
643-
'Synchronize'
671+
"""
672+
Synchronize.
673+
"""
644674
type = message_types[b'S'[0]]
645675
__slots__ = ()
646676
SynchronizeMessage = Message.__new__(Synchronize)
647677
Synchronize.SingleInstance = SynchronizeMessage
648678

649679
class Query(StringMessage):
650-
"""Execute the query with the given arguments"""
680+
"""
681+
Execute the query with the given arguments.
682+
"""
651683
type = message_types[b'Q'[0]]
652684
__slots__ = ('data',)
653685

654686
class Parse(Message):
655-
"""Parse a query with the specified argument types"""
687+
"""
688+
Parse a query with the specified argument types.
689+
"""
656690
type = message_types[b'P'[0]]
657691
__slots__ = ('name', 'statement', 'argtypes')
658692

@@ -741,7 +775,9 @@ def parse(typ, message_data):
741775
return typ(name, statement, aformats, args, rformats)
742776

743777
class Execute(Message):
744-
"""Fetch results from the specified Portal"""
778+
"""
779+
Fetch results from the specified Portal.
780+
"""
745781
type = message_types[b'E'[0]]
746782
__slots__ = ('name', 'max')
747783

@@ -758,7 +794,9 @@ def parse(typ, data):
758794
return typ(name, ulong_unpack(max))
759795

760796
class Describe(StringMessage):
761-
"""Describe a Portal or Prepared Statement"""
797+
"""
798+
Request a description of a Portal or Prepared Statement.
799+
"""
762800
type = message_types[b'D'[0]]
763801
__slots__ = ('data',)
764802

@@ -784,7 +822,9 @@ class DescribePortal(Describe):
784822
__slots__ = ('data',)
785823

786824
class Close(StringMessage):
787-
"""Generic Close"""
825+
"""
826+
Generic Close
827+
"""
788828
type = message_types[b'C'[0]]
789829
__slots__ = ()
790830

@@ -802,17 +842,24 @@ def parse(typ, data):
802842
return super().parse(data[1:])
803843

804844
class CloseStatement(Close):
805-
"""Close the specified Statement"""
845+
"""
846+
Close the specified Statement
847+
"""
806848
subtype = message_types[b'S'[0]]
807849
__slots__ = ()
808850

809851
class ClosePortal(Close):
810-
"""Close the specified Portal"""
852+
"""
853+
Close the specified Portal
854+
"""
811855
subtype = message_types[b'P'[0]]
812856
__slots__ = ()
813857

814858
class Function(Message):
815-
"""Execute the specified function with the given arguments"""
859+
"""
860+
Execute the specified function with the given arguments
861+
"""
862+
816863
type = message_types[b'F'[0]]
817864
__slots__ = ('oid', 'aformats', 'arguments', 'rformat')
818865

@@ -881,12 +928,16 @@ def parse(typ, data):
881928
])
882929

883930
class CopyToBegin(CopyBegin):
884-
"""Begin copying to"""
931+
"""
932+
Begin copying to.
933+
"""
885934
type = message_types[b'H'[0]]
886935
__slots__ = ('format', 'formats')
887936

888937
class CopyFromBegin(CopyBegin):
889-
"""Begin copying from"""
938+
"""
939+
Begin copying from.
940+
"""
890941
type = message_types[b'G'[0]]
891942
__slots__ = ('format', 'formats')
892943

0 commit comments

Comments
 (0)