mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-08 00:58:12 +08:00
Replaces format with f-strings
This commit is contained in:
@@ -8,34 +8,44 @@ from django_q.monitor import info, get_ids
|
||||
|
||||
class Command(BaseCommand):
|
||||
# Translators: help text for qinfo management command
|
||||
help = _('General information over all clusters.')
|
||||
help = _("General information over all clusters.")
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument(
|
||||
'--config',
|
||||
action='store_true',
|
||||
dest='config',
|
||||
"--config",
|
||||
action="store_true",
|
||||
dest="config",
|
||||
default=False,
|
||||
help='Print current configuration.',
|
||||
help="Print current configuration.",
|
||||
)
|
||||
parser.add_argument(
|
||||
'--ids',
|
||||
action='store_true',
|
||||
dest='ids',
|
||||
"--ids",
|
||||
action="store_true",
|
||||
dest="ids",
|
||||
default=False,
|
||||
help='Print cluster task ID(s) (PIDs).',
|
||||
help="Print cluster task ID(s) (PIDs).",
|
||||
)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
if options.get('ids', True):
|
||||
if options.get("ids", True):
|
||||
get_ids()
|
||||
elif options.get('config', False):
|
||||
hide = ['conf', 'IDLE', 'STOPPING', 'STARTING', 'WORKING', 'SIGNAL_NAMES', 'STOPPED']
|
||||
settings = [a for a in dir(Conf) if not a.startswith('__') and a not in hide]
|
||||
self.stdout.write('VERSION: {}'.format('.'.join(str(v) for v in VERSION)))
|
||||
elif options.get("config", False):
|
||||
hide = [
|
||||
"conf",
|
||||
"IDLE",
|
||||
"STOPPING",
|
||||
"STARTING",
|
||||
"WORKING",
|
||||
"SIGNAL_NAMES",
|
||||
"STOPPED",
|
||||
]
|
||||
settings = [
|
||||
a for a in dir(Conf) if not a.startswith("__") and a not in hide
|
||||
]
|
||||
self.stdout.write(f"VERSION: {'.'.join(str(v) for v in VERSION)}")
|
||||
for setting in settings:
|
||||
value = getattr(Conf, setting)
|
||||
if value is not None:
|
||||
self.stdout.write('{}: {}'.format(setting, value))
|
||||
self.stdout.write(f"{setting}: {value}")
|
||||
else:
|
||||
info()
|
||||
|
||||
Reference in New Issue
Block a user