Mercurial > kallithea
view scripts/pyflakes @ 8835:385d1b31f386
celery: upgrade to Celery 5.0 ... and adjust for Click API
Celery 5 has apparently no relevant API or config changes.
Celery is however switching to click. run_from_argv goes away, and there is no
simple way to do as before and start the worker with our Celery app but still
use Celery's own command line parser.
Apply hacks to make sure it still is possible to run like:
kallithea-cli celery-run -c my.ini -- --help
kallithea-cli celery-run -c my.ini -- --loglevel=ERROR broker_url=amqp://u:p@localhost:5672/v
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Thu, 07 Jan 2021 03:47:21 +0100 |
parents | abb83e4edfd9 |
children |
line wrap: on
line source
#!/usr/bin/env python3 """ pyflakes with filter configuration for Kallithea. Inspired by pyflakes/api.py and flake8/plugins/pyflakes.py . """ import sys import pyflakes.api import pyflakes.messages class Reporter: warned = False def flake(self, warning): # ignore known warnings if isinstance(warning, pyflakes.messages.UnusedVariable): return if warning.filename == 'kallithea/bin/kallithea_cli_ishell.py': if isinstance(warning, pyflakes.messages.ImportStarUsed) and warning.message_args == ('kallithea.model.db',): return if isinstance(warning, pyflakes.messages.UnusedImport) and warning.message_args == ('kallithea.model.db.*',): return print('%s:%s %s [%s %s]' % (warning.filename, warning.lineno, warning.message % warning.message_args, type(warning).__name__, warning.message_args)) self.warned = True def unexpectedError(self, filename, msg): print('Unexpected error for %s: %s' % (filename, msg)) reporter = Reporter() for filename in sorted(set(sys.argv[1:])): pyflakes.api.checkPath(filename, reporter=reporter) if reporter.warned: raise SystemExit(1)