-
Notifications
You must be signed in to change notification settings - Fork 44
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 connection classes #107
Merged
Merged
Conversation
This file contains 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
…ltiple virtual environments
@long2ice , all checks have been passed, shall we review this PR? UPD: Done, the PR is considered final and ready for code review. |
@long2ice , let's have this PR reviewed? |
Thanks! |
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.
This PR entails the PR #106 .
The features brought:
asynch.Connection
class get more unburden: now itsparse_dsn()
method is moved aside into the standalone util function. The reasons are as follows: 1) having DSN parsing logic in one place that may be used not only by theasynch.Connection
class instances; 2) it can be tested "per se", not needing theasynch.Connection
class being instantiated first.asynch.Connection
class can support the interface of an asynchronous context manager: no more necessity for making an end-user invoking theconnect()
method and remember to call theclose()
method for resource clean-up.asynch.Connection
gets a semi-implicitcreated
state (status). It can be seen as the result of calling the__repr__()
method on a created connection (cn = Connection(...)
which were not neither opened nor closed. When created, if thecn.closed
is False, then we can falsely assume that it was closed somewhere before which can be not this case. The same reasoning when thecn.connected
is False - was it connected before or not? But when created andcn.connected
andcn.closed
are None, we understand that the connection were neither opened nor closed. For more details, please see the PR Update project dependencies and metadata #106 .Other non-critical feature:
The tests were run under the Python v3.9, however the
.python-version
file is added into the.gitignore
file because the project is expected to be run in multiple virtual environments. Apart introducing themypy
package, intoxicating the project with thetox
testing tool would be nice, but in one of the next PRs.