Open
Conversation
Comment on lines
-131
to
+142
| if extraRE[0] == '(': | ||
| extraRE = r'(?P<extra>%s)' % extraRE | ||
| else: | ||
| extraRE = r"(?P<extra>%s)" % extraRE | ||
| extraRE = r'(?P<extra>%s)' % extraRE | ||
| if extraSep: | ||
| extraRE = extraSep + extraRE | ||
| else: | ||
| extraRE = "(?P<extra>)" | ||
|
|
||
| protoRE = "(%s)" % "|".join(PROTOCOLS.keys()) | ||
| route = (r"/(?P<resource>%s)%s/(?P<protocol>%s)/?(?P<session_id>[0-9a-zA-Z]*?)/?((?P<protocol_init>\d*?)|(?P<xhr_path>\w*?))/?(?P<jsonp_index>\d*?)" % (resource, extraRE, protoRE), cls) | ||
| return route | ||
| return ( | ||
| r"/(?P<resource>%s)%s/(?P<protocol>%s)/?(?P<session_id>[0-9a-zA-Z]*?)/?((?P<protocol_init>\d*?)|(?P<xhr_path>\w*?))/?(?P<jsonp_index>\d*?)" | ||
| % (resource, extraRE, protoRE), | ||
| cls, | ||
| ) |
Author
There was a problem hiding this comment.
Function SocketIOHandler.routes refactored with the following changes:
- Hoist repeated code outside conditional statement
- Inline variable that is only used once
Comment on lines
-211
to
+216
| return filter(lambda t: (t[0] == '*' or t[0].lower() == host.lower()) and (t[1] == '*' or t[1] == int(port)), origins) | ||
| return filter( | ||
| lambda t: ((t[0] == '*' or t[0].lower() == host.lower())) | ||
| and t[1] in ['*', int(port)], | ||
| origins, | ||
| ) | ||
|
|
Author
There was a problem hiding this comment.
Function SocketIOProtocol.verify_origin refactored with the following changes:
- Replace multiple comparisons of same variable with
inoperator
Comment on lines
-221
to
+226
| if self.asynchronous: | ||
| out_fh = self.output_handle | ||
| else: | ||
| out_fh = self | ||
|
|
||
| out_fh = self.output_handle if self.asynchronous else self |
Author
There was a problem hiding this comment.
Function SocketIOProtocol.send refactored with the following changes:
- Replace if statement with if expression
| """Write method which all protocols must define to | ||
| indicate how to push to their wire""" | ||
| self.warning("[socketio protocol] Default call to _write. NOOP. [%s]" % message) | ||
| pass |
Author
There was a problem hiding this comment.
Function SocketIOProtocol._write refactored with the following changes:
- Remove redundant pass statement
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Branch
masterrefactored by Sourcery.If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.
See our documentation here.
Run Sourcery locally
Reduce the feedback loop during development by using the Sourcery editor plugin:
Review changes via command line
To manually merge these changes, make sure you're on the
masterbranch, then run: