-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get rid of legacy class StreamWriter #2109 #2651
Conversation
Legacy StreamWriter as a pure proxy of the transport and the protocol is no longer needed. All of the functionalities that were behind this class has been moved to the PayloadWriter. Some changes that have to be considered that impacted during this change * TCP Operations have been isolated in a module rather than move them into the PayloadWriter * WebSocketWriter had a dependency with the StreamWriter, to get rid of that dependency the constructor has been modified to take the protocol and the transport. A next step changing the name PayLoadWriter for the StreamWriter to have consistency with the reader part, might be considered.
looks good to me |
return self._transport | ||
|
||
@property | ||
def protocol(self): | ||
return self._protocol |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a test for the property
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PayLoadWriter -> StreamWriter renaming sounds reasonable too
Codecov Report
@@ Coverage Diff @@
## master #2651 +/- ##
==========================================
+ Coverage 97.92% 97.98% +0.06%
==========================================
Files 38 39 +1
Lines 7272 7245 -27
Branches 1262 1257 -5
==========================================
- Hits 7121 7099 -22
+ Misses 47 45 -2
+ Partials 104 101 -3
Continue to review full report at Codecov.
|
Another question: why do you return a value from |
@asvetlov removed the value returned by the TCP operations. My fault Ive ended up changing the code to have an easy way to test the functions, once these have become stateless there is some edge cases where I cant see how to assert properly. For example the case of the socket |
You can monkey-patch socket object to make sure that its methods are not called but I think current code is good enough. |
Thanks! |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a [new issue] for related bugs. |
What do these changes do?
Legacy StreamWriter class as a pure proxy of the transport and the protocol is
no longer needed. All of the functionalities that were behind this class
has been moved to the
PayloadWriter
class.Some changes that have to be considered that impacted by this change
TCP Operations have been isolated in a module rather than move them
into the
PayloadWriter
class. All of these operations have been simplified and state less.WebSocketWriter
class had a dependency with the StreamWriter, to get rid ofthat dependency the constructor has been modified to take the protocol
and the transport.
A next step changing the name of the
PayLoadWriter
class for theStreamWriter
- it reborn!- might be considered, making it consistent with the reader side.Are there changes in behavior for the user?
No
Related issue number
#2109
Checklist
CONTRIBUTORS.txt
CHANGES
folder<issue_id>.<type>
for example (588.bugfix)issue_id
change it to the pr id after creating the pr.feature
: Signifying a new feature..bugfix
: Signifying a bug fix..doc
: Signifying a documentation improvement..removal
: Signifying a deprecation or removal of public API..misc
: A ticket has been closed, but it is not of interest to users.