##// END OF EJS Templates
black: make codebase compatible with black v21.4b2 and v20.8b1...
Kyle Lippincott -
r47856:f38bf44e stable
parent child Browse files
Show More
@@ -168,7 +168,7 b' class Table(object):'
168 168
169 169
170 170 class Translator(nodes.NodeVisitor):
171 """"""
171 """ """
172 172
173 173 words_and_spaces = re.compile(r'\S+| +|\n')
174 174 document_start = """Man page generated from reStructuredText."""
@@ -527,5 +527,5 b' class convert_git(common.converter_sourc'
527 527 return bookmarks
528 528
529 529 def checkrevformat(self, revstr, mapname=b'splicemap'):
530 """ git revision string is a 40 byte hex """
530 """git revision string is a 40 byte hex"""
531 531 self.checkhexformat(revstr, mapname)
@@ -729,5 +729,5 b' class mercurial_source(common.converter_'
729 729 return bookmarks.listbookmarks(self.repo)
730 730
731 731 def checkrevformat(self, revstr, mapname=b'splicemap'):
732 """ Mercurial, revision string is a 40 byte hex """
732 """Mercurial, revision string is a 40 byte hex"""
733 733 self.checkhexformat(revstr, mapname)
@@ -778,7 +778,7 b' class svn_source(converter_source):'
778 778 return revcommit
779 779
780 780 def checkrevformat(self, revstr, mapname=b'splicemap'):
781 """ fails if revision format does not match the correct format"""
781 """fails if revision format does not match the correct format"""
782 782 if not re.match(
783 783 br'svn:[0-9a-f]{8,8}-[0-9a-f]{4,4}-'
784 784 br'[0-9a-f]{4,4}-[0-9a-f]{4,4}-[0-9a-f]'
@@ -37,7 +37,7 b' svn_config = None'
37 37
38 38
39 39 def _create_auth_baton(pool):
40 """Create a Subversion authentication baton. """
40 """Create a Subversion authentication baton."""
41 41 import svn.client
42 42
43 43 # Give the client context baton a suite of authentication
@@ -221,7 +221,7 b' else:'
221 221
222 222
223 223 def _win32_strerror(err):
224 """ expand a win32 error code into a human readable message """
224 """expand a win32 error code into a human readable message"""
225 225
226 226 # FormatMessage will allocate memory and assign it here
227 227 buf = ctypes.c_char_p()
@@ -303,20 +303,20 b' class CommandError(WatchmanError):'
303 303
304 304
305 305 class Transport(object):
306 """ communication transport to the watchman server """
306 """communication transport to the watchman server"""
307 307
308 308 buf = None
309 309
310 310 def close(self):
311 """ tear it down """
311 """tear it down"""
312 312 raise NotImplementedError()
313 313
314 314 def readBytes(self, size):
315 """ read size bytes """
315 """read size bytes"""
316 316 raise NotImplementedError()
317 317
318 318 def write(self, buf):
319 """ write some data """
319 """write some data"""
320 320 raise NotImplementedError()
321 321
322 322 def setTimeout(self, value):
@@ -348,7 +348,7 b' class Transport(object):'
348 348
349 349
350 350 class Codec(object):
351 """ communication encoding for the watchman server """
351 """communication encoding for the watchman server"""
352 352
353 353 transport = None
354 354
@@ -366,7 +366,7 b' class Codec(object):'
366 366
367 367
368 368 class UnixSocketTransport(Transport):
369 """ local unix domain socket transport """
369 """local unix domain socket transport"""
370 370
371 371 sock = None
372 372
@@ -449,7 +449,7 b' def _get_overlapped_result_ex_impl(pipe,'
449 449
450 450
451 451 class WindowsNamedPipeTransport(Transport):
452 """ connect to a named pipe """
452 """connect to a named pipe"""
453 453
454 454 def __init__(self, sockpath, timeout):
455 455 self.sockpath = sockpath
@@ -700,7 +700,7 b' class CLIProcessTransport(Transport):'
700 700
701 701
702 702 class BserCodec(Codec):
703 """ use the BSER encoding. This is the default, preferred codec """
703 """use the BSER encoding. This is the default, preferred codec"""
704 704
705 705 def __init__(self, transport, value_encoding, value_errors):
706 706 super(BserCodec, self).__init__(transport)
@@ -752,7 +752,7 b' class ImmutableBserCodec(BserCodec):'
752 752
753 753
754 754 class Bser2WithFallbackCodec(BserCodec):
755 """ use BSER v2 encoding """
755 """use BSER v2 encoding"""
756 756
757 757 def __init__(self, transport, value_encoding, value_errors):
758 758 super(Bser2WithFallbackCodec, self).__init__(
@@ -824,7 +824,7 b' class ImmutableBser2Codec(Bser2WithFallb'
824 824
825 825
826 826 class JsonCodec(Codec):
827 """ Use json codec. This is here primarily for testing purposes """
827 """Use json codec. This is here primarily for testing purposes"""
828 828
829 829 json = None
830 830
@@ -861,7 +861,7 b' class JsonCodec(Codec):'
861 861
862 862
863 863 class client(object):
864 """ Handles the communication with the watchman service """
864 """Handles the communication with the watchman service"""
865 865
866 866 sockpath = None
867 867 transport = None
@@ -1011,7 +1011,7 b' class client(object):'
1011 1011 return result["sockname"]
1012 1012
1013 1013 def _connect(self):
1014 """ establish transport connection """
1014 """establish transport connection"""
1015 1015
1016 1016 if self.recvConn:
1017 1017 if self.pid != os.getpid():
@@ -1176,7 +1176,7 b' class client(object):'
1176 1176 raise
1177 1177
1178 1178 def capabilityCheck(self, optional=None, required=None):
1179 """ Perform a server capability check """
1179 """Perform a server capability check"""
1180 1180 res = self.query(
1181 1181 "version", {"optional": optional or [], "required": required or []}
1182 1182 )
@@ -76,7 +76,7 b' class gpg(object):'
76 76 return procutil.filter(data, gpgcmd)
77 77
78 78 def verify(self, data, sig):
79 """ returns of the good and bad signatures"""
79 """returns of the good and bad signatures"""
80 80 sigfile = datafile = None
81 81 try:
82 82 # create temporary files
@@ -510,7 +510,7 b' class histeditaction(object):'
510 510 return cls(state, rev)
511 511
512 512 def verify(self, prev, expected, seen):
513 """ Verifies semantic correctness of the rule"""
513 """Verifies semantic correctness of the rule"""
514 514 repo = self.repo
515 515 ha = hex(self.node)
516 516 self.node = scmutil.resolvehexnodeidprefix(repo, ha)
@@ -819,7 +819,7 b' class edit(histeditaction):'
819 819 @action([b'fold', b'f'], _(b'use commit, but combine it with the one above'))
820 820 class fold(histeditaction):
821 821 def verify(self, prev, expected, seen):
822 """ Verifies semantic correctness of the fold rule"""
822 """Verifies semantic correctness of the fold rule"""
823 823 super(fold, self).verify(prev, expected, seen)
824 824 repo = self.repo
825 825 if not prev:
@@ -2403,7 +2403,7 b' def ruleeditor(repo, ui, actions, editco'
2403 2403
2404 2404
2405 2405 def parserules(rules, state):
2406 """Read the histedit rules string and return list of action objects """
2406 """Read the histedit rules string and return list of action objects"""
2407 2407 rules = [
2408 2408 l
2409 2409 for l in (r.strip() for r in rules.splitlines())
@@ -102,7 +102,7 b' class lazyremotenamedict(mutablemapping)'
102 102 self.loaded = False
103 103
104 104 def _load(self):
105 """ Read the remotenames file, store entries matching selected kind """
105 """Read the remotenames file, store entries matching selected kind"""
106 106 self.loaded = True
107 107 repo = self._repo
108 108 for node, rpath, rname in logexchange.readremotenamefile(
@@ -112,7 +112,7 b' class lazyremotenamedict(mutablemapping)'
112 112 self.potentialentries[name] = (node, rpath, name)
113 113
114 114 def _resolvedata(self, potentialentry):
115 """ Check that the node for potentialentry exists and return it """
115 """Check that the node for potentialentry exists and return it"""
116 116 if not potentialentry in self.potentialentries:
117 117 return None
118 118 node, remote, name = self.potentialentries[potentialentry]
@@ -160,13 +160,13 b' class lazyremotenamedict(mutablemapping)'
160 160 return None
161 161
162 162 def keys(self):
163 """ Get a list of bookmark or branch names """
163 """Get a list of bookmark or branch names"""
164 164 if not self.loaded:
165 165 self._load()
166 166 return self.potentialentries.keys()
167 167
168 168 def iteritems(self):
169 """ Iterate over (name, node) tuples """
169 """Iterate over (name, node) tuples"""
170 170
171 171 if not self.loaded:
172 172 self._load()
@@ -190,7 +190,7 b' class remotenames(object):'
190 190 self.clearnames()
191 191
192 192 def clearnames(self):
193 """ Clear all remote names state """
193 """Clear all remote names state"""
194 194 self.bookmarks = lazyremotenamedict(b"bookmarks", self._repo)
195 195 self.branches = lazyremotenamedict(b"branches", self._repo)
196 196 self._invalidatecache()
@@ -220,7 +220,7 b' class branchcache(object):'
220 220 self._hasnode = lambda x: True
221 221
222 222 def _verifyclosed(self):
223 """ verify the closed nodes we have """
223 """verify the closed nodes we have"""
224 224 if self._closedverified:
225 225 return
226 226 for node in self._closednodes:
@@ -230,7 +230,7 b' class branchcache(object):'
230 230 self._closedverified = True
231 231
232 232 def _verifybranch(self, branch):
233 """ verify head nodes for the given branch. """
233 """verify head nodes for the given branch."""
234 234 if branch not in self._entries or branch in self._verifiedbranches:
235 235 return
236 236 for n in self._entries[branch]:
@@ -240,7 +240,7 b' class branchcache(object):'
240 240 self._verifiedbranches.add(branch)
241 241
242 242 def _verifyall(self):
243 """ verifies nodes of all the branches """
243 """verifies nodes of all the branches"""
244 244 needverification = set(self._entries.keys()) - self._verifiedbranches
245 245 for b in needverification:
246 246 self._verifybranch(b)
@@ -267,7 +267,7 b' class branchcache(object):'
267 267 items = iteritems
268 268
269 269 def hasbranch(self, label):
270 """ checks whether a branch of this name exists or not """
270 """checks whether a branch of this name exists or not"""
271 271 self._verifybranch(label)
272 272 return label in self._entries
273 273
@@ -385,7 +385,7 b' class branchcache(object):'
385 385 yield (bn, heads) + self._branchtip(heads)
386 386
387 387 def iterheads(self):
388 """ returns all the heads """
388 """returns all the heads"""
389 389 self._verifyall()
390 390 return pycompat.itervalues(self._entries)
391 391
@@ -784,7 +784,7 b' class revbranchcache(object):'
784 784 wlock.release()
785 785
786 786 def _writenames(self, repo):
787 """ write the new branch names to revbranchcache """
787 """write the new branch names to revbranchcache"""
788 788 if self._rbcnamescount != 0:
789 789 f = repo.cachevfs.open(_rbcnames, b'ab')
790 790 if f.tell() == self._rbcsnameslen:
@@ -809,7 +809,7 b' class revbranchcache(object):'
809 809 self._rbcnamescount = len(self._names)
810 810
811 811 def _writerevs(self, repo, start):
812 """ write the new revs to revbranchcache """
812 """write the new revs to revbranchcache"""
813 813 revs = min(len(repo.changelog), len(self._rbcrevs) // _rbcrecsize)
814 814 with repo.cachevfs.open(_rbcrevs, b'ab') as f:
815 815 if f.tell() != start:
@@ -829,7 +829,7 b' class unbundle20(unpackermixin):'
829 829 return params
830 830
831 831 def _processallparams(self, paramsblock):
832 """"""
832 """ """
833 833 params = util.sortdict()
834 834 for p in paramsblock.split(b' '):
835 835 p = p.split(b'=', 1)
@@ -326,7 +326,7 b' def resolvecommitoptions(ui, opts):'
326 326
327 327
328 328 def checknotesize(ui, opts):
329 """ make sure note is of valid format """
329 """make sure note is of valid format"""
330 330
331 331 note = opts.get(b'note')
332 332 if not note:
@@ -972,7 +972,7 b' def findcmd(cmd, table, strict=True):'
972 972
973 973
974 974 def changebranch(ui, repo, revs, label, opts):
975 """ Change the branch name of given revs to label """
975 """Change the branch name of given revs to label"""
976 976
977 977 with repo.wlock(), repo.lock(), repo.transaction(b'branches'):
978 978 # abort in case of uncommitted merge or dirty wdir
@@ -1108,7 +1108,7 b' def bailifchanged(repo, merge=True, hint'
1108 1108
1109 1109
1110 1110 def logmessage(ui, opts):
1111 """ get the log message according to -m and -l option """
1111 """get the log message according to -m and -l option"""
1112 1112
1113 1113 check_at_most_one_arg(opts, b'message', b'logfile')
1114 1114
@@ -3920,7 +3920,7 b' def readgraftstate(repo, graftstate):'
3920 3920
3921 3921
3922 3922 def hgabortgraft(ui, repo):
3923 """ abort logic for aborting graft using 'hg abort'"""
3923 """abort logic for aborting graft using 'hg abort'"""
3924 3924 with repo.wlock():
3925 3925 graftstate = statemod.cmdstate(repo, b'graftstate')
3926 3926 return abortgraft(ui, repo, graftstate)
@@ -366,7 +366,7 b' class server(object):'
366 366 os.chdir(self.cwd)
367 367
368 368 def getencoding(self):
369 """ writes the current encoding to the result channel """
369 """writes the current encoding to the result channel"""
370 370 self.cresult.write(encoding.encoding)
371 371
372 372 def serveone(self):
@@ -331,7 +331,7 b' class uihunkline(patchnode):'
331 331
332 332
333 333 class uihunk(patchnode):
334 """ui patch hunk, wraps a hunk and keep track of ui behavior """
334 """ui patch hunk, wraps a hunk and keep track of ui behavior"""
335 335
336 336 maxcontext = 3
337 337
@@ -2909,7 +2909,7 b' def debugrename(ui, repo, *pats, **opts)'
2909 2909
2910 2910 @command(b'debugrequires|debugrequirements', [], b'')
2911 2911 def debugrequirements(ui, repo):
2912 """ print the current repo requirements """
2912 """print the current repo requirements"""
2913 2913 for r in sorted(repo.requirements):
2914 2914 ui.write(b"%s\n" % r)
2915 2915
@@ -269,7 +269,7 b' def validateconfig(ui):'
269 269
270 270 def codec2iana(cs):
271 271 # type: (str) -> str
272 ''''''
272 ''' '''
273 273 cs = email.charset.Charset(cs).input_charset.lower()
274 274
275 275 # "latin1" normalizes to "iso8859-1", standard calls for "iso-8859-1"
@@ -307,11 +307,11 b' class _mergestate_base(object):'
307 307 yield f
308 308
309 309 def allextras(self):
310 """ return all extras information stored with the mergestate """
310 """return all extras information stored with the mergestate"""
311 311 return self._stateextras
312 312
313 313 def extras(self, filename):
314 """ return extras stored with the mergestate for the given filename """
314 """return extras stored with the mergestate for the given filename"""
315 315 return self._stateextras[filename]
316 316
317 317 def _resolve(self, preresolve, dfile, wctx):
@@ -133,7 +133,7 b' def update_persistent_nodemap(revlog):'
133 133
134 134
135 135 def delete_nodemap(tr, repo, revlog):
136 """ Delete nodemap data on disk for a given revlog"""
136 """Delete nodemap data on disk for a given revlog"""
137 137 if revlog.nodemap_file is None:
138 138 msg = "calling persist nodemap on a revlog without the feature enabled"
139 139 raise error.ProgrammingError(msg)
@@ -1563,7 +1563,7 b' def filterrequirements(requirements):'
1563 1563
1564 1564
1565 1565 def istreemanifest(repo):
1566 """ returns whether the repository is using treemanifest or not """
1566 """returns whether the repository is using treemanifest or not"""
1567 1567 return requirementsmod.TREEMANIFEST_REQUIREMENT in repo.requirements
1568 1568
1569 1569
@@ -188,7 +188,7 b' class _statecheck(object):'
188 188 return self._cmdmsg
189 189
190 190 def continuemsg(self):
191 """ returns appropriate continue message corresponding to command"""
191 """returns appropriate continue message corresponding to command"""
192 192 return _(b'hg %s --continue') % (self._opname)
193 193
194 194 def isunfinished(self, repo):
@@ -629,7 +629,7 b' class fncache(object):'
629 629 fp.close()
630 630
631 631 def _checkentries(self, fp, warn):
632 """ make sure there is no empty string in entries """
632 """make sure there is no empty string in entries"""
633 633 if b'' in self.entries:
634 634 fp.seek(0)
635 635 for n, line in enumerate(util.iterfile(fp)):
@@ -847,11 +847,11 b' class UpgradeOperation(object):'
847 847 self.ui.status(_(b'%s\n %s\n\n') % (i.name, i.description))
848 848
849 849 def has_upgrade_action(self, name):
850 """ Check whether the upgrade operation will perform this action """
850 """Check whether the upgrade operation will perform this action"""
851 851 return name in self._upgrade_actions_names
852 852
853 853 def print_post_op_messages(self):
854 """ print post upgrade operation warning messages """
854 """print post upgrade operation warning messages"""
855 855 for a in self.upgrade_actions:
856 856 if a.postupgrademessage is not None:
857 857 self.ui.warn(b'%s\n' % a.postupgrademessage)
@@ -134,7 +134,7 b' def _perform_clone('
134 134 sidedatacompanion,
135 135 oncopiedrevision,
136 136 ):
137 """ returns the new revlog object created"""
137 """returns the new revlog object created"""
138 138 newrl = None
139 139 if matchrevlog(upgrade_op.revlogs_to_process, rl_type):
140 140 ui.note(
@@ -143,7 +143,7 b' username = platform.username'
143 143
144 144 def setumask(val):
145 145 # type: (int) -> None
146 ''' updates the umask. used by chg server '''
146 '''updates the umask. used by chg server'''
147 147 if pycompat.iswindows:
148 148 return
149 149 os.umask(val)
General Comments 0
You need to be logged in to leave comments. Login now