At Tue, 9 Oct 2018 21:02:04 +0900, Yuya Nishihara wrote: > > On Tue, 09 Oct 2018 02:34:38 +0900, FUJIWARA Katsunori wrote: > > # HG changeset patch > > # User FUJIWARA Katsunori <fo...@lares.dti.ne.jp> > > # Date 1534994754 -32400 > > # Thu Aug 23 12:25:54 2018 +0900 > > # Node ID 92d0e6f411c72800b59adafccf50ac0b0d15ba17 > > # Parent ecf28733d6b95c39068d7f593c0b9a98a068509f > > # Available At https://bitbucket.org/foozy/mercurial-wip > > # hg pull https://bitbucket.org/foozy/mercurial-wip -r > > 92d0e6f411c7 > > # EXP-Topic contrib-improve-import-checker > > contrib: add an utility module to parse test scripts > > I just quickly scanned this, but felt comfortable how things are organized. > > > + def opentext(f): > > + return open(f, 'rb') > > Nit: want which? text or binary?
Oops, that name certainly seems strange :-< I've wanted to define "the function to open a (text) file in byte-sequence mode". The name "opentext" comes from similar code below in contrib/check-code.py at first, and "b" was added to mode at making it executable with python3 later. if sys.version_info[0] < 3: opentext = open else: def opentext(f): return open(f, encoding='latin1') > > + commands = {} > > + def command(name, desc): > > + def wrap(func): > > + commands[name] = (desc, func) > > + return wrap > > We could use argparse to model a subcommand parser. > Oh, I overlooked it. Thanks for pointing. -- ---------------------------------------------------------------------- [FUJIWARA Katsunori] fo...@lares.dti.ne.jp _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel