Conversation
Contributor
Reviewer's GuideIntroduces a new request execution API ( Sequence diagram for tg.request.execute.create() with RequestCall.donesequenceDiagram
actor UserCode
participant Client
participant Request
participant Execute
participant RequestCall
participant HTTPAPI
UserCode->>Client: client.request.execute.create(data)
Client->>Request: request
Request->>Execute: execute
Execute->>RequestCall: create(**kw)
Activate RequestCall
UserCode->>RequestCall: done(ok=true, dot=false)
RequestCall->>HTTPAPI: execute()
HTTPAPI-->>RequestCall: { ok, data }
alt ok flag set
alt response ok and has data
RequestCall-->>UserCode: result.ok (bool)
else response not ok or missing data
RequestCall-->>UserCode: None
end
end
deactivate RequestCall
Class diagram for new tg.request.execute API and RequestCall.doneclassDiagram
class Client {
+CustomTranslate translate
+Services services
+Quotes quotes
+Request request
+DefaultMethod use
+Platform platform
+MediaFactory media
}
class Request {
+Execute execute
+__init__(client)
}
class Execute {
+__init__(client)
+create(**kw)
+run(**kw)
+get(request_id)
+delete(request_id)
}
class RequestCall {
+_client
+_method
+_path
+_params
+execute()
+skip()
+done(ok, dot)
+json()
}
Client --> Request : has
Request --> Execute : has
Execute --> RequestCall : creates
RequestCall --> Client : uses _client
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
Execute.runthe function signature uses**KWbut the body referencesrequest_idandkw, which are undefined; adjust the parameters and variable names so the request ID and payload are passed in correctly. - The new
Requesthelper added totgcore/client.pyis instantiated (self.request = Request(self)) but theRequestclass fromtgcore.executeis never imported, which will cause aNameErrorat runtime. - The
donemethod signature incore.pyusesdot=Falsewhile the changelog describes.done(ok=False, result=False); align the parameter name and behavior with the documented interface to avoid confusion for callers.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `Execute.run` the function signature uses `**KW` but the body references `request_id` and `kw`, which are undefined; adjust the parameters and variable names so the request ID and payload are passed in correctly.
- The new `Request` helper added to `tgcore/client.py` is instantiated (`self.request = Request(self)`) but the `Request` class from `tgcore.execute` is never imported, which will cause a `NameError` at runtime.
- The `done` method signature in `core.py` uses `dot=False` while the changelog describes `.done(ok=False, result=False)`; align the parameter name and behavior with the documented interface to avoid confusion for callers.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
for more information, see https://pre-commit.ci
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.
Summary by Sourcery
Introduce a new request execution API and convenience completion method.
New Features:
Documentation: