There were lots of tiny modules, which is not idiomatic Python. I have replaced most of those, and simplified the module structure of the client a lot. Most of these are simple moves without a code change.
Apart from that, I have applied isort and black to whole code base. I plan to add them to CI in the short term as well, in another PR.
Below, I list other small changes I did as part of this PR:
Moved types that are mentioned in the public APIs to typing.py
Renamed UpstashException to UpstashError, as the errors that originate from the Exception class are prefixed with Error throughout the standard library and ecosystem.
Converted the type of the rest_encoding parameter from boolean | Literal["base64"] to None | Literal["base64"]. I believe it conveys the message better.
Removed the mix-in class FormattedResponse altogether. It was not providing any benefit other than providing the dict of formatters. I converted it into a simple dictionary.
Converted the rest_retry_interval parameter into a float from int. Time related parameters are generally given as floats that represent seconds. It also makes more sense, as you now able to provide more granular times.
Removed CommandsProtocol altogether. That abstraction was not used at all.
Removed some commented out codes. I don't like the idea of shipping dead code, we can implement them properly later.
There were lots of tiny modules, which is not idiomatic Python. I have replaced most of those, and simplified the module structure of the client a lot. Most of these are simple moves without a code change.
Apart from that, I have applied isort and black to whole code base. I plan to add them to CI in the short term as well, in another PR.
Below, I list other small changes I did as part of this PR:
Exception
class are prefixed with Error throughout the standard library and ecosystem.rest_encoding
parameter fromboolean | Literal["base64"]
toNone | Literal["base64"]
. I believe it conveys the message better.FormattedResponse
altogether. It was not providing any benefit other than providing the dict of formatters. I converted it into a simple dictionary.rest_retry_interval
parameter into afloat
fromint
. Time related parameters are generally given as floats that represent seconds. It also makes more sense, as you now able to provide more granular times.CommandsProtocol
altogether. That abstraction was not used at all.