Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upresolve weird klein.resource namespace conflict, gently as possible #247
Conversation
glyph
requested a review
from twisted/twisted-contributors
Jun 26, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
glyph
Jun 26, 2018
Member
To crib from the original bug description:
>>> import klein.resource
>>> from klein import resource as resource
>>> resource
<special bound method/module klein.resource>
>>> resource()
<klein._resource.KleinResource object at 0x109336b70>
>>> resource.KleinResource
<class 'klein._resource.KleinResource'>and
>>> from klein import resource as resource
>>> resource
<special bound method/module klein.resource>
>>> resource()
<klein._resource.KleinResource object at 0x10ed26cf8>
>>> resource.KleinResource
<class 'klein._resource.KleinResource'>It's a tiny bit weird but it's totally consistent and not buggy.
|
To crib from the original bug description: >>> import klein.resource
>>> from klein import resource as resource
>>> resource
<special bound method/module klein.resource>
>>> resource()
<klein._resource.KleinResource object at 0x109336b70>
>>> resource.KleinResource
<class 'klein._resource.KleinResource'>and >>> from klein import resource as resource
>>> resource
<special bound method/module klein.resource>
>>> resource()
<klein._resource.KleinResource object at 0x10ed26cf8>
>>> resource.KleinResource
<class 'klein._resource.KleinResource'>It's a tiny bit weird but it's totally consistent and not buggy. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
codecov
Jun 26, 2018
Codecov Report
Merging #247 into master will increase coverage by
0.02%.
The diff coverage is100%.
@@ Coverage Diff @@
## master #247 +/- ##
==========================================
+ Coverage 96.59% 96.62% +0.02%
==========================================
Files 34 34
Lines 2584 2605 +21
Branches 175 175
==========================================
+ Hits 2496 2517 +21
Misses 74 74
Partials 14 14| Impacted Files | Coverage Δ | |
|---|---|---|
| src/klein/test/test_resource.py | 97.06% <100%> (+0.02%) |
|
| src/klein/__init__.py | 100% <100%> (ø) |
|
| src/klein/resource.py | 100% <100%> (ø) |
|
| src/klein/test/test_exports.py | 100% <100%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered by Codecov. Last update 7f17daa...afbf9c7. Read the comment docs.
codecov
commented
Jun 26, 2018
•
Codecov Report
@@ Coverage Diff @@
## master #247 +/- ##
==========================================
+ Coverage 96.59% 96.62% +0.02%
==========================================
Files 34 34
Lines 2584 2605 +21
Branches 175 175
==========================================
+ Hits 2496 2517 +21
Misses 74 74
Partials 14 14
Continue to review full report at Codecov.
|
glyph
added some commits
Jun 26, 2018
moshez
approved these changes
Jun 28, 2018
Thanks for untangling this!
Possibly make sure that there is less potential confusion by importing resource as _resource in resource.py, and either way this is good to merge.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Thanks for the review @moshez ! |
glyph commentedJun 26, 2018
Fixes #224
Supersedes #225
I think we should probably eventually deprecate
klein.resource.KleinResourceas the public name and expose it somewhere else, but for the time being, let's resolve things in as friendly a way as possible, so that everything keeps working regardless of what order you import things in.