1414from .settings import ChangedSetting , _setting_code_from_int
1515
1616
17- class Event ( object ) :
17+ class Event :
1818 """
1919 Base class for h2 events.
2020 """
@@ -374,11 +374,16 @@ def __repr__(self):
374374 )
375375
376376
377- class PingAcknowledged (Event ):
377+ class PingAckReceived (Event ):
378378 """
379- Same as PingAckReceived.
379+ The PingAckReceived event is fired whenever a PING acknowledgment is
380+ received. It contains the 'opaque data' of the PING+ACK frame, allowing the
381+ user to correlate PINGs and calculate RTT.
382+
383+ .. versionadded:: 3.1.0
380384
381- .. deprecated:: 3.1.0
385+ .. versionchanged:: 4.0.0
386+ Removed deprecated but equivalent ``PingAcknowledged``.
382387 """
383388 def __init__ (self ):
384389 #: The data included on the ping.
@@ -390,17 +395,6 @@ def __repr__(self):
390395 )
391396
392397
393- class PingAckReceived (PingAcknowledged ):
394- """
395- The PingAckReceived event is fired whenever a PING acknowledgment is
396- received. It contains the 'opaque data' of the PING+ACK frame, allowing the
397- user to correlate PINGs and calculate RTT.
398-
399- .. versionadded:: 3.1.0
400- """
401- pass
402-
403-
404398class StreamEnded (Event ):
405399 """
406400 The StreamEnded event is fired whenever a stream is ended by a remote
@@ -637,12 +631,4 @@ def _bytes_representation(data):
637631 if data is None :
638632 return None
639633
640- hex = binascii .hexlify (data )
641-
642- # This is moderately clever: on all Python versions hexlify returns a byte
643- # string. On Python 3 we want an actual string, so we just check whether
644- # that's what we have.
645- if not isinstance (hex , str ): # pragma: no cover
646- hex = hex .decode ('ascii' )
647-
648- return hex
634+ return binascii .hexlify (data ).decode ('ascii' )
0 commit comments