mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-python
synced 2026-01-15 09:53:32 +01:00
Consistently replace def run() by async def run()
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
8a74e030dc
commit
a85f0929c6
4 changed files with 9 additions and 9 deletions
|
|
@ -354,7 +354,7 @@ class Cmd(jwutils.Cmd):
|
||||||
#slog(NOTICE, "replacements =", self.replacements)
|
#slog(NOTICE, "replacements =", self.replacements)
|
||||||
|
|
||||||
# overriding
|
# overriding
|
||||||
def run(self, args):
|
async def run(self, args):
|
||||||
self._init(args)
|
self._init(args)
|
||||||
files = []
|
files = []
|
||||||
if args.name_regex is not None:
|
if args.name_regex is not None:
|
||||||
|
|
@ -461,7 +461,7 @@ class CmdCppReplaceSymbols(Cmd):
|
||||||
return p
|
return p
|
||||||
|
|
||||||
# overriding
|
# overriding
|
||||||
def run(self, args):
|
async def run(self, args):
|
||||||
if args.name_regex is not None:
|
if args.name_regex is not None:
|
||||||
return super(CmdCppReplaceSymbols, self).run(args)
|
return super(CmdCppReplaceSymbols, self).run(args)
|
||||||
self._init(args)
|
self._init(args)
|
||||||
|
|
@ -547,7 +547,7 @@ class CmdCppAddNamespace(Cmd):
|
||||||
return p
|
return p
|
||||||
|
|
||||||
# overriding
|
# overriding
|
||||||
def run(self, args):
|
async def run(self, args):
|
||||||
if args.name_regex is not None:
|
if args.name_regex is not None:
|
||||||
return super(CmdCppAddNamespace, self).run(args)
|
return super(CmdCppAddNamespace, self).run(args)
|
||||||
self._init(args)
|
self._init(args)
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ class TrimSourceCmd(jwutils.Cmd):
|
||||||
super(TrimSourceCmd, self).__init__(name, help=help)
|
super(TrimSourceCmd, self).__init__(name, help=help)
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def _run(self, args, mime, path, contents):
|
async def _run(self, args, mime, path, contents):
|
||||||
raise Exception("_run() method not implemented")
|
raise Exception("_run() method not implemented")
|
||||||
|
|
||||||
def add_parser(self, parsers):
|
def add_parser(self, parsers):
|
||||||
|
|
@ -23,7 +23,7 @@ class TrimSourceCmd(jwutils.Cmd):
|
||||||
p.add_argument("input", help="input files", nargs='+')
|
p.add_argument("input", help="input files", nargs='+')
|
||||||
return p
|
return p
|
||||||
|
|
||||||
def run(self, args):
|
async def run(self, args):
|
||||||
ms = magic.open(magic.NONE)
|
ms = magic.open(magic.NONE)
|
||||||
ms.load()
|
ms.load()
|
||||||
for path in args.input:
|
for path in args.input:
|
||||||
|
|
@ -72,7 +72,7 @@ class CmdBeautify(TrimSourceCmd):
|
||||||
r += line.rstrip() + '\n'
|
r += line.rstrip() + '\n'
|
||||||
return r
|
return r
|
||||||
|
|
||||||
def _run(self, args, mime, path, contents):
|
async def _run(self, args, mime, path, contents):
|
||||||
slog(NOTICE, "formatting", path, "of type", mime)
|
slog(NOTICE, "formatting", path, "of type", mime)
|
||||||
method = getattr(self, '_process' + ''.join(s.capitalize() for s in re.split('[/-]', mime)))
|
method = getattr(self, '_process' + ''.join(s.capitalize() for s in re.split('[/-]', mime)))
|
||||||
if method is None:
|
if method is None:
|
||||||
|
|
|
||||||
|
|
@ -7,14 +7,14 @@ ABC = abc.ABCMeta('ABC', (object,), {'__slots__': ()})
|
||||||
class Cmd(ABC): # export
|
class Cmd(ABC): # export
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def run(self, args):
|
async def run(self, args):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def __init__(self, name, help):
|
def __init__(self, name, help):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.help = help
|
self.help = help
|
||||||
|
|
||||||
def _run(self, args):
|
async def _run(self, args):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def add_parser(self, parsers):
|
def add_parser(self, parsers):
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ class Cmds: # export
|
||||||
cmd.add_parser(subparsers)
|
cmd.add_parser(subparsers)
|
||||||
|
|
||||||
async def __run(self):
|
async def __run(self):
|
||||||
#def __run(self):
|
#async def __run(self):
|
||||||
args = self.__parser.parse_args()
|
args = self.__parser.parse_args()
|
||||||
jwutils.log.set_level(args.log_level)
|
jwutils.log.set_level(args.log_level)
|
||||||
jwutils.log.set_flags(args.log_flags)
|
jwutils.log.set_flags(args.log_flags)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue