Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commandserver.py @ 49037:642e31cb55f0
py3: use class X: instead of class X(object):
The inheritance from object is implied in Python 3. So this should
be equivalent.
This change was generated via an automated search and replace. So there
may have been some accidental changes.
Differential Revision: https://phab.mercurial-scm.org/D12352
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 21 Feb 2022 13:08:28 -0700 |
parents | 6000f5b25c9b |
children | 311fcc5a65f6 |
comparison
equal
deleted
inserted
replaced
49036:55d132525155 | 49037:642e31cb55f0 |
---|---|
37 cborutil, | 37 cborutil, |
38 procutil, | 38 procutil, |
39 ) | 39 ) |
40 | 40 |
41 | 41 |
42 class channeledoutput(object): | 42 class channeledoutput: |
43 """ | 43 """ |
44 Write data to out in the following format: | 44 Write data to out in the following format: |
45 | 45 |
46 data length (unsigned int), | 46 data length (unsigned int), |
47 data | 47 data |
66 if attr in ('isatty', 'fileno', 'tell', 'seek'): | 66 if attr in ('isatty', 'fileno', 'tell', 'seek'): |
67 raise AttributeError(attr) | 67 raise AttributeError(attr) |
68 return getattr(self.out, attr) | 68 return getattr(self.out, attr) |
69 | 69 |
70 | 70 |
71 class channeledmessage(object): | 71 class channeledmessage: |
72 """ | 72 """ |
73 Write encoded message and metadata to out in the following format: | 73 Write encoded message and metadata to out in the following format: |
74 | 74 |
75 data length (unsigned int), | 75 data length (unsigned int), |
76 encoded message and metadata, as a flat key-value dict. | 76 encoded message and metadata, as a flat key-value dict. |
95 | 95 |
96 def __getattr__(self, attr): | 96 def __getattr__(self, attr): |
97 return getattr(self._cout, attr) | 97 return getattr(self._cout, attr) |
98 | 98 |
99 | 99 |
100 class channeledinput(object): | 100 class channeledinput: |
101 """ | 101 """ |
102 Read data from in_. | 102 Read data from in_. |
103 | 103 |
104 Requests for input are written to out in the following format: | 104 Requests for input are written to out in the following format: |
105 channel identifier - 'I' for plain input, 'L' line based (1 byte) | 105 channel identifier - 'I' for plain input, 'L' line based (1 byte) |
198 raise error.Abort( | 198 raise error.Abort( |
199 b'no supported message encodings: %s' % b' '.join(encnames) | 199 b'no supported message encodings: %s' % b' '.join(encnames) |
200 ) | 200 ) |
201 | 201 |
202 | 202 |
203 class server(object): | 203 class server: |
204 """ | 204 """ |
205 Listens for commands on fin, runs them and writes the output on a channel | 205 Listens for commands on fin, runs them and writes the output on a channel |
206 based stream to fout. | 206 based stream to fout. |
207 """ | 207 """ |
208 | 208 |
448 targetuis.add(repo.ui) | 448 targetuis.add(repo.ui) |
449 for u in targetuis: | 449 for u in targetuis: |
450 u.setlogger(b'cmdserver', logger) | 450 u.setlogger(b'cmdserver', logger) |
451 | 451 |
452 | 452 |
453 class pipeservice(object): | 453 class pipeservice: |
454 def __init__(self, ui, repo, opts): | 454 def __init__(self, ui, repo, opts): |
455 self.ui = ui | 455 self.ui = ui |
456 self.repo = repo | 456 self.repo = repo |
457 | 457 |
458 def init(self): | 458 def init(self): |
523 except IOError as inst: | 523 except IOError as inst: |
524 if inst.errno != errno.EPIPE: | 524 if inst.errno != errno.EPIPE: |
525 raise | 525 raise |
526 | 526 |
527 | 527 |
528 class unixservicehandler(object): | 528 class unixservicehandler: |
529 """Set of pluggable operations for unix-mode services | 529 """Set of pluggable operations for unix-mode services |
530 | 530 |
531 Almost all methods except for createcmdserver() are called in the main | 531 Almost all methods except for createcmdserver() are called in the main |
532 process. You can't pass mutable resource back from createcmdserver(). | 532 process. You can't pass mutable resource back from createcmdserver(). |
533 """ | 533 """ |
557 """Create new command server instance; called in the process that | 557 """Create new command server instance; called in the process that |
558 serves for the current connection""" | 558 serves for the current connection""" |
559 return server(self.ui, repo, fin, fout, prereposetups) | 559 return server(self.ui, repo, fin, fout, prereposetups) |
560 | 560 |
561 | 561 |
562 class unixforkingservice(object): | 562 class unixforkingservice: |
563 """ | 563 """ |
564 Listens on unix domain socket and forks server per connection | 564 Listens on unix domain socket and forks server per connection |
565 """ | 565 """ |
566 | 566 |
567 def __init__(self, ui, repo, opts, handler=None): | 567 def __init__(self, ui, repo, opts, handler=None): |