- Notifications
You must be signed in to change notification settings - Fork1
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Sourcery refactored master branch#1
base:master
Are you sure you want to change the base?
Conversation
print('>>>' +msg) | ||
print(f'>>>{msg}') | ||
if msg[:4] == '####': | ||
yiri.send_message('msg={}, title={}, sender={}'.format(msg, title, sender)) | ||
yiri.send_message(f'msg={msg}, title={title}, sender={sender}') |
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.
Functionon_message
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
) - Replace call to format with f-string. (
use-fstring-for-formatting
)
if txt[4:] == '请使用最新版手机QQ查看。': | ||
return '', 'Unknown' | ||
else: | ||
return txt, 'Text' | ||
# 回复消息 | ||
return ('', 'Unknown') if txt[4:] == '请使用最新版手机QQ查看。' else (txt, 'Text') | ||
elif layout_type == 'android.widget.LinearLayout': | ||
txt = chat_item_content_layout.child( | ||
'com.tencent.qqlite:id/chat_item_content_text').get_text().strip() | ||
return txt, 'Text' | ||
# 图片、语音或多媒体信息 |
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_analyze_message_type
refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp
)
This removes the following comments (why? ):
# 回复消息# 图片、语音或多媒体信息
message_list = self.get_message_list() | ||
if message_list: | ||
if message_list := self.get_message_list(): | ||
self.latest_message = message_list[-1] | ||
self.title = self.get_title() | ||
logger_yiri.info('Session set up. Title: {}'.format(self.title)) | ||
logger_yiri.info(f'Session set up. Title: {self.title}') |
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.
FunctionSession.init_latest_message
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
) - Replace call to format with f-string. (
use-fstring-for-formatting
)
Sourcery Code Quality Report✅ Merging this PR willincrease code quality in the affected files by0.06%.
Here are some functions in these files that still need a tune-up:
Legend and ExplanationThe emojis denote the absolute quality of the code:
The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request. Please see our documentationhere for details on how these metrics are calculated. We are actively working on this report - lots more documentation and extra metrics to come! Help usimprove this quality report! |
Branch
master
refactored bySourcery.If you're happy with these changes, merge this Pull Request using theSquash and merge strategy.
See our documentationhere.
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 usimprove this pull request!