Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def take():
parser = argparse.ArgumentParser(description='update version records of nvchecker')
core.add_common_arguments(parser)
parser.add_argument('--all', action='store_true',
help='take all updates')
parser.add_argument('--ignore-nonexistent', action='store_true',
help='ignore nonexistent names')
parser.add_argument('names', metavar='NAME', nargs='*',
help='software name to be updated')
args = parser.parse_args()
if core.process_common_arguments(args):
return
s = core.Source(args.file)
if not s.oldver or not s.newver:
logger.critical(
"doesn't have both 'oldver' and 'newver' set.", source=s,
)
sys.exit(2)
oldvers = core.read_verfile(s.oldver)
newvers = core.read_verfile(s.newver)
if args.all:
oldvers.update(newvers)
else:
for name in args.names:
def main():
global args
parser = argparse.ArgumentParser(description='New version checker for software')
parser.add_argument('-n', '--notify', action='store_true', default=False,
help='show desktop notifications when a new version is available')
parser.add_argument('-t', '--tries', default=1, type=int, metavar='N',
help='try N times when errors occur')
core.add_common_arguments(parser)
args = parser.parse_args()
if core.process_common_arguments(args):
return
if not args.file:
return
s = Source(args.file, args.tries)
ioloop = asyncio.get_event_loop()
ioloop.run_until_complete(s.check())
def cmp():
parser = argparse.ArgumentParser(description='compare version records of nvchecker')
core.add_common_arguments(parser)
args = parser.parse_args()
if core.process_common_arguments(args):
return
s = core.Source(args.file)
oldvers = core.read_verfile(s.oldver) if s.oldver else {}
newvers = core.read_verfile(s.newver)
for name, newver in sorted(newvers.items()):
oldver = oldvers.get(name, None)
if oldver != newver:
print('%s %s -> %s' % (name, oldver, newver))