Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork940
Commitc34a466
committed
Have Repo.__init__ convert epath to str first instead
Ine133018 before this, I had noticed that Repo.__init__ implicitlyrelied on the implementation detail of cygpath that it converts itsargument to str immediately. That detail was not reflected in theparameter type annotation, which could've been broader, so I hadfixed the mypy error in Repo.__init__ by broadening cygpath'sparameter type annotation.This undoes that change, putting the cygpath annotations back asbefore, and fixes the mypy error in another way, by havingRepo.__init__ pass `str(epath)` instead of `epath` to cygpath.The reason is the concern noted in thee133018 commit message,that broadening the annotation made the way cygpath documents itsrelationshp to Git.polish_url no longer correct, and that it is notclear that the str(path) step in cygpath really ought to be mademore than an implementation detail (which if done may require somedocumentation to be changed).Instances of str are usually direct instances (rather than of asubclass of str), in which case an extra call to str will (at leastin CPython, and probably in all implementations) just return thesame str object that was passed in. The performance penalty of thisextra call to str should therefore be extremely small.1 parente133018 commitc34a466
2 files changed
+4
-7
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
218 | 218 |
| |
219 | 219 |
| |
220 | 220 |
| |
221 |
| - | |
| 221 | + | |
222 | 222 |
| |
223 | 223 |
| |
224 | 224 |
| |
|
Lines changed: 3 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
404 | 404 |
| |
405 | 405 |
| |
406 | 406 |
| |
407 |
| - | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
408 | 410 |
| |
409 | 411 |
| |
410 | 412 |
| |
| |||
420 | 422 |
| |
421 | 423 |
| |
422 | 424 |
| |
423 |
| - | |
424 |
| - | |
425 |
| - | |
426 |
| - | |
427 |
| - | |
428 | 425 |
| |
429 | 426 |
| |
430 | 427 |
| |
|
0 commit comments
Comments
(0)