-
Notifications
You must be signed in to change notification settings - Fork 43
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
refactor: rework Entry, Request and Response classes #276
base: main
Are you sure you want to change the base?
Conversation
277d081
to
a69d07e
Compare
a69d07e
to
88d66ad
Compare
9422982
to
47d07a9
Compare
47d07a9
to
218eb32
Compare
Quality Gate failedFailed conditions See analysis details on SonarQube Cloud Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE |
fyi i have another branch that builds on top of this that gets us to fully typed. |
I'm sorry for not answering before, first I've been sick, then very busy at work. I'll look at both soon. |
Nothing to be sorry. feel better and take your 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.
I am not sure I like the concept of mocket.core
, in the end it gets most of the code, not very different from having it under mocket
.
If you want to make it tidier, maybe something like mocket.decorators
for decorators, etc.
|
||
|
||
class MocketBytesResponse(MocketBaseResponse): | ||
def __init__(self, data: bytes | str | bool) -> None: |
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.
MocketBytesResponse
can be created with bytes
/str
/bool
? Isn't it confusing?
I've read the code a bunch of times already, and I have the feeling that Mocket APIs got more complicated than they were before, instead of being simpler and cleaner. |
I'm sorry, this went a "little" overboard 🙈
So I am opening this PR as a draft, to discuss with you what you think.
I refactored the entry, request and response classes to be ABCs and went from there.
This gets us to almost fully typed, introduces new apis, but keeps all old apis available and cleanly marked as backwards-compat.
I have no good idea to split this up in multiple sensible commits.I split this PR intro (hopefully) easy to follow, individually working commits.