-
Notifications
You must be signed in to change notification settings - Fork 663
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
Update api.py #484
base: master
Are you sure you want to change the base?
Update api.py #484
Conversation
为API添加一个deadline参数,默认为60秒,
WalkthroughWalkthrough本次更新对 Changes
Tip New Features and ImprovementsReview SettingsIntroduced new personality profiles for code reviews. Users can now select between "Chill" and "Assertive" review tones to tailor feedback styles according to their preferences. The "Assertive" profile posts more comments and nitpicks the code more aggressively, while the "Chill" profile is more relaxed and posts fewer comments. AST-based InstructionsCodeRabbit offers customizing reviews based on the Abstract Syntax Tree (AST) pattern matching. Read more about AST-based instructions in the documentation. Community-driven AST-based RulesWe are kicking off a community-driven initiative to create and share AST-based rules. Users can now contribute their AST-based rules to detect security vulnerabilities, code smells, and anti-patterns. Please see the ast-grep-essentials repository for more information. New Static Analysis ToolsWe are continually expanding our support for static analysis tools. We have added support for Tone SettingsUsers can now customize CodeRabbit to review code in the style of their favorite characters or personalities. Here are some of our favorite examples:
Revamped Settings PageWe have redesigned the settings page for a more intuitive layout, enabling users to find and adjust settings quickly. This change was long overdue; it not only improves the user experience but also allows our development team to add more settings in the future with ease. Going forward, the changes to Miscellaneous
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Actionable comments posted: 1
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- tqsdk/api.py (2 hunks)
Additional Context Used
Ruff (15)
tqsdk/api.py (15)
433-433: f-string without any placeholders
559-559: f-string without any placeholders
561-561: f-string without any placeholders
1253-1253: f-string without any placeholders
1264-1264: f-string without any placeholders
1468-1468: f-string without any placeholders
1529-1529: f-string without any placeholders
1591-1591: f-string without any placeholders
1816-1819: Do not assign a
lambda
expression, use adef
2243-2243: f-string without any placeholders
2339-2339: f-string without any placeholders
2341-2341: f-string without any placeholders
2716-2716: Do not compare types, use
isinstance()
4026-4026: Do not assign a
lambda
expression, use adef
4031-4031: Do not use bare
except
Additional comments not posted (1)
tqsdk/api.py (1)
94-94
: 新增deadline
参数以允许用户设置超时时间,这提高了灵活性和用户体验。
tqsdk/api.py
Outdated
_deadline = time.time() + deadline | ||
try: | ||
# 多账户时,所有账户需要初始化完成 | ||
trade_more_data = True | ||
while self._data.get("mdhis_more_data", True) or trade_more_data: | ||
if not self.wait_update(deadline=deadline): # 等待连接成功并收取截面数据 | ||
if not self.wait_update(_deadline=deadline): # 等待连接成功并收取截面数据 |
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.
在 wait_update
方法调用中,应将参数名从 _deadline
改为 deadline
,以保持一致性和清晰性。
- if not self.wait_update(_deadline=deadline):
+ if not self.wait_update(deadline=_deadline):
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
_deadline = time.time() + deadline | |
try: | |
# 多账户时,所有账户需要初始化完成 | |
trade_more_data = True | |
while self._data.get("mdhis_more_data", True) or trade_more_data: | |
if not self.wait_update(deadline=deadline): # 等待连接成功并收取截面数据 | |
if not self.wait_update(_deadline=deadline): # 等待连接成功并收取截面数据 | |
_deadline = time.time() + deadline | |
try: | |
# 多账户时,所有账户需要初始化完成 | |
trade_more_data = True | |
while self._data.get("mdhis_more_data", True) or trade_more_data: | |
if not self.wait_update(deadline=_deadline): # 等待连接成功并收取截面数据 |
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.
写错了。。。 SORRY
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.
@WangJieCIFCO, no worries at all! If there's anything else you need help with or if you have further modifications, feel free to let me know. I'm here to help! 😊
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.
Actionable comments posted: 1
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- tqsdk/api.py (2 hunks)
Additional Context Used
Ruff (15)
tqsdk/api.py (15)
433-433: f-string without any placeholders
559-559: f-string without any placeholders
561-561: f-string without any placeholders
1253-1253: f-string without any placeholders
1264-1264: f-string without any placeholders
1468-1468: f-string without any placeholders
1529-1529: f-string without any placeholders
1591-1591: f-string without any placeholders
1816-1819: Do not assign a
lambda
expression, use adef
2243-2243: f-string without any placeholders
2339-2339: f-string without any placeholders
2341-2341: f-string without any placeholders
2716-2716: Do not compare types, use
isinstance()
4026-4026: Do not assign a
lambda
expression, use adef
4031-4031: Do not use bare
except
Additional comments not posted (1)
tqsdk/api.py (1)
94-94
: 添加了新的可选参数deadline
,默认值为 60,这允许用户自定义初始化接口的超时时间。这是一个积极的改变,可以提高 API 的灵活性和用户体验。
为TqApi类初始化方法添加一个deadline参数,默认设置为60秒。解决用户无法指定初始化接口的超时时间,以前默认超时为60秒,或许有些太长。
Summary by CodeRabbit
TqApi
类的初始化方法新增了一个可选参数deadline
,用于设定等待更新的时间。