Mercurial > public > mercurial-scm > hg
comparison mercurial/sshpeer.py @ 37321:e826fe7a08c7
peer: make ui an attribute
With abc interfaces, instance attributes could not satisfy
@abc.abstractproperty requirements because interface conformance
was tested at type creation time. When we created the abc
peer interfaces, we had to make "ui" a @property to satisfy
abc.
Now that peer interfaces are using zope.interface and there is no
import time validation (but there are tests validating instances
conform to the interface), we can go back to using regular object
attributes.
Differential Revision: https://phab.mercurial-scm.org/D3069
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Fri, 30 Mar 2018 18:57:13 -0700 |
parents | 39f7d4ee8bcd |
children | afcfdf53e4b5 |
comparison
equal
deleted
inserted
replaced
37320:39f7d4ee8bcd | 37321:e826fe7a08c7 |
---|---|
352 ``caps`` is a set of capabilities supported by the remote. | 352 ``caps`` is a set of capabilities supported by the remote. |
353 ``autoreadstderr`` denotes whether to automatically read from | 353 ``autoreadstderr`` denotes whether to automatically read from |
354 stderr and to forward its output. | 354 stderr and to forward its output. |
355 """ | 355 """ |
356 self._url = url | 356 self._url = url |
357 self._ui = ui | 357 self.ui = ui |
358 # self._subprocess is unused. Keeping a handle on the process | 358 # self._subprocess is unused. Keeping a handle on the process |
359 # holds a reference and prevents it from being garbage collected. | 359 # holds a reference and prevents it from being garbage collected. |
360 self._subprocess = proc | 360 self._subprocess = proc |
361 | 361 |
362 # And we hook up our "doublepipe" wrapper to allow querying | 362 # And we hook up our "doublepipe" wrapper to allow querying |
376 _FRAMED_COMMANDS = { | 376 _FRAMED_COMMANDS = { |
377 'batch', | 377 'batch', |
378 } | 378 } |
379 | 379 |
380 # Begin of ipeerconnection interface. | 380 # Begin of ipeerconnection interface. |
381 | |
382 @util.propertycache | |
383 def ui(self): | |
384 return self._ui | |
385 | 381 |
386 def url(self): | 382 def url(self): |
387 return self._url | 383 return self._url |
388 | 384 |
389 def local(self): | 385 def local(self): |