-
Notifications
You must be signed in to change notification settings - Fork 8
Sourcery refactored master branch #1
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
base: master
Are you sure you want to change the base?
Conversation
| 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, | ||
| ) |
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.
Function SocketIOHandler.routes refactored with the following changes:
- Hoist repeated code outside conditional statement
- Inline variable that is only used once
| 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, | ||
| ) | ||
|
|
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.
Function SocketIOProtocol.verify_origin refactored with the following changes:
- Replace multiple comparisons of same variable with
inoperator
| if self.asynchronous: | ||
| out_fh = self.output_handle | ||
| else: | ||
| out_fh = self | ||
|
|
||
| out_fh = self.output_handle if self.asynchronous else self |
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.
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 |
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.
Function SocketIOProtocol._write refactored with the following changes:
- Remove redundant pass statement
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: