Remove some dead code#4615
Conversation
| @@ -27,10 +28,6 @@ | |||
| # Python 2.X and 3.X compatibility | |||
| if sys.version_info[0] < 3: | |||
| from codecs import open | |||
There was a problem hiding this comment.
i believe it should be possible to go for io.open by now
There was a problem hiding this comment.
yeah I thought about this, but decided to leave it for another PR given codecs.open works more like python2.x open:
>>> from codecs import open
>>> with open('f', 'w', encoding='utf-8') as f:
... f.write(b'wat')
...
>>> import io
>>> with io.open('f', 'w', encoding='utf-8') as f:
... f.write(b'wat')
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
TypeError: write() argument 1 must be unicode, not strThere was a problem hiding this comment.
most interesting, but also something we should unify towards the unicode only behaviour in junitxml
| source.lines[:] = self.lines[start:end] | ||
| return source | ||
|
|
||
| def putaround(self, before="", after="", indent=" " * 4): |
There was a problem hiding this comment.
those methods are potentially breaking accidential external api, we should document that as removal
There was a problem hiding this comment.
👍 definitely, I'll make sure to list these out tomorrow in a changelog entry -- already targeting features
There was a problem hiding this comment.
Maybe give a depreciation grace period so we don't have as many breaks as the recent mark changes?
There was a problem hiding this comment.
I agree, IMO we should avoid further breakages. 👍 for adding a deprecation warning.
|
|
||
| def test_getrange(self): | ||
| x = self.source[0:2] | ||
| assert x.isparseable() |
Codecov Report
@@ Coverage Diff @@
## features #4615 +/- ##
============================================
+ Coverage 95.76% 95.76% +<.01%
============================================
Files 111 111
Lines 24683 24566 -117
Branches 2446 2436 -10
============================================
- Hits 23637 23526 -111
+ Misses 739 735 -4
+ Partials 307 305 -2
Continue to review full report at Codecov.
|
| extra_keywords.update(item.extra_keyword_matches) | ||
| return extra_keywords | ||
|
|
||
| def listnames(self): |
There was a problem hiding this comment.
external api breach of node
nicoddemus
left a comment
There was a problem hiding this comment.
Other than removing the potentially external APIs, great work! 😁
| source.lines[:] = self.lines[start:end] | ||
| return source | ||
|
|
||
| def putaround(self, before="", after="", indent=" " * 4): |
There was a problem hiding this comment.
I agree, IMO we should avoid further breakages. 👍 for adding a deprecation warning.
| newsource.lines[:] = deindent(self.lines) | ||
| return newsource | ||
|
|
||
| def isparseable(self, deindent=True): |
There was a problem hiding this comment.
Ditto about deprecating it first.
| # Python 2.X and 3.X compatibility | ||
| if sys.version_info[0] < 3: | ||
| from codecs import open | ||
| else: |
- I wrote a thing: https://github.com/asottile/dead - wanted to try it out, there's lots of false positives and I didn't look through all the things it pointed out but here's some
|
The rtd-bot is activated, but no .github/config.yml found in this repository. |
|
been a bit busy, I put back the potentially public things and I can follow up with those later, don't really have time to document all the deprecations right now but wanted to get at least this bit out |
|
Failures are unrelated: We should fix them on |
|
#4643 fixes the deprecation error. |
through all the things it pointed out but here's some