-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
feat: v1 to v2 shift #1369
feat: v1 to v2 shift #1369
Changes from 4 commits
448d585
d3c1a4a
7611298
14452bd
6c79e0f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -1531,6 +1531,10 @@ def create( | |||||||||||||||||||||||||||
def remove(self, id: str) -> None: | ||||||||||||||||||||||||||||
self.client.http.delete(url=str(self.endpoint / id)) | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
def delete(self, id: str) -> int: | ||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The new delete() method duplicates the HTTP delete call already used in remove(). Consider refactoring the common deletion logic into a helper (or have remove() delegate to delete()) to avoid duplication and potential inconsistencies. Also, clarify the intended difference between remove() (no return) and delete() (returning status code). |
||||||||||||||||||||||||||||
response = self.client.http.delete(url=str(self.endpoint / id)) | ||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding error handling using the existing response = self.client.http.delete(url=str(self.endpoint / id))
self._raise_if_required(response, status_code=204) # 204 is typical for successful DELETE
return response.status_code There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The variable 'response' is now assigned but not used. If the response is important, consider validating its status or content; otherwise, remove the assignment.
Suggested change
|
||||||||||||||||||||||||||||
return response.status_code | ||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Duplicate functionality with 📝 Committable Code Suggestion
Suggested change
|
||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
@t.overload # type: ignore | ||||||||||||||||||||||||||||
def get( | ||||||||||||||||||||||||||||
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.
Removing the
delete()
method without providing an alternative could break backward compatibility for code that depends on getting the status code. Theremove()
method should return the status code or document the breaking change.📝 Committable Code Suggestion