-
Notifications
You must be signed in to change notification settings - Fork 6
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
Sourcery refactored master branch #8
Conversation
query_param = request.query_params._dict | ||
if query_param: | ||
if query_param := request.query_params._dict: | ||
for key, value in query_param.items(): | ||
stream_url += "?" + key + "=" + value | ||
stream_url += f"?{key}={value}" |
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 live
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
) - Use f-string instead of string concatenation [×3] (
use-fstring-for-concatenation
)
self.clients[ip + ":" + port] = {"url": chanel_watch, "time_create": int(time.time())} | ||
self.clients[f"{ip}:{port}"] = { | ||
"url": chanel_watch, | ||
"time_create": int(time.time()), | ||
} |
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 Client.add_client
refactored with the following changes:
- Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation
)
if ip + ":" + port not in self.clients: | ||
if f"{ip}:{port}" not in self.clients: | ||
return False | ||
# update time_create | ||
self.clients[ip + ":" + port]["time_create"] = int(time.time()) | ||
return self.clients[ip + ":" + port]["url"] | ||
self.clients[f"{ip}:{port}"]["time_create"] = int(time.time()) | ||
return self.clients[f"{ip}:{port}"]["url"] |
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 Client.get_client
refactored with the following changes:
- Use f-string instead of string concatenation [×6] (
use-fstring-for-concatenation
)
if channel is None: | ||
return None | ||
|
||
return channel["direct_source"] | ||
return None if channel is None else channel["direct_source"] |
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 M3U_Parser.get_channel_url
refactored with the following changes:
- Lift code into else after jump in control flow (
reintroduce-else
) - Replace if statement with if expression (
assign-if-exp
)
Branch
master
refactored 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
master
branch, then run:Help us improve this pull request!