Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ['3.9', '3.10', '3.11', '3.12']
celery-version: ['5.2.*', '5.3.*', '5.4.*', '5.5.*']
tornado-version: ['6.0']
exclude: # https://docs.celeryq.dev/en/v5.2.7/whatsnew-5.2.html#step-5-upgrade-to-celery-5-2
Expand Down
2 changes: 0 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
#
# flower documentation build configuration file, created by
# sphinx-quickstart on Fri Apr 11 17:26:01 2014.
#
Expand Down
2 changes: 1 addition & 1 deletion examples/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def sleep(seconds):

@app.task
def echo(msg, timestamp=False):
return "%s: %s" % (datetime.now(), msg) if timestamp else msg
return f"{datetime.now()}: {msg}" if timestamp else msg


@app.task
Expand Down
2 changes: 1 addition & 1 deletion flower/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def apply_options(prog_name, argv):
try:
parse_config_file(os.path.abspath(options.conf), final=False)
parse_command_line([prog_name] + argv)
except IOError:
except OSError:
if os.path.basename(options.conf) != DEFAULT_CONFIG_FILE:
raise

Expand Down
2 changes: 1 addition & 1 deletion flower/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def bugreport(app=None):
app = app or celery.Celery()

# pylint: disable=consider-using-f-string
return 'flower -> flower:%s tornado:%s humanize:%s%s' % (
return 'flower -> flower:{} tornado:{} humanize:{}{}'.format(
__version__,
tornado.version,
getattr(humanize, '__version__', None) or getattr(humanize, 'VERSION'),
Expand Down
7 changes: 3 additions & 4 deletions flower/utils/broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import json
import logging
import numbers
import socket
import sys
from urllib.parse import quote, unquote, urljoin, urlparse

Expand Down Expand Up @@ -67,7 +66,7 @@ async def queues(self, names):
url, auth_username=username, auth_password=password,
connect_timeout=1.0, request_timeout=2.0,
validate_cert=False)
except (socket.error, httpclient.HTTPError) as e:
except (OSError, httpclient.HTTPError) as e:
logger.error("RabbitMQ management API call failed: %s", e)
return []
finally:
Expand Down Expand Up @@ -106,7 +105,7 @@ def _q_for_pri(self, queue, pri):
if pri not in self.priority_steps:
raise ValueError('Priority not in priority steps')
# pylint: disable=consider-using-f-string
return '{0}{1}{2}'.format(*((queue, self.sep, pri) if pri else (queue, '', '')))
return '{}{}{}'.format(*((queue, self.sep, pri) if pri else (queue, '', '')))

async def queues(self, names):
queue_stats = []
Expand All @@ -115,7 +114,7 @@ async def queues(self, names):
name, pri) for pri in self.priority_steps]
queue_stats.append({
'name': name,
'messages': sum((self.redis.llen(x) for x in priority_names))
'messages': sum(self.redis.llen(x) for x in priority_names)
})
return queue_stats

Expand Down
2 changes: 1 addition & 1 deletion flower/utils/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def parse_search_terms(raw_search_value):
if 'kwargs'not in parsed_search:
parsed_search['kwargs'] = {}
try:
key, value = [p.strip() for p in query_part[len('kwargs:'):].split('=')]
key, value = (p.strip() for p in query_part[len('kwargs:'):].split('='))
except ValueError:
continue
parsed_search['kwargs'][key] = preprocess_search_value(value)
Expand Down
4 changes: 2 additions & 2 deletions flower/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ def format_task(self, task):
return task

def get_active_queue_names(self):
queues = set([])
queues = set()
for _, info in self.application.workers.items():
for queue in info.get('active_queues', []):
queues.add(queue['name'])

if not queues:
queues = set([self.capp.conf.task_default_queue]) |\
queues = {self.capp.conf.task_default_queue} |\
{q.name for q in self.capp.conf.task_queues or [] if q.name}
return sorted(queues)
2 changes: 1 addition & 1 deletion flower/views/workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ async def get(self):
@classmethod
def _as_dict(cls, worker):
if hasattr(worker, '_fields'):
return dict((k, getattr(worker, k)) for k in worker._fields)
return {k: getattr(worker, k) for k in worker._fields}
return cls._info(worker)

@classmethod
Expand Down
2 changes: 0 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ def get_requirements(filename):
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/test_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def test_empty_conf(self):
def test_conf_abs(self):
with tempfile.NamedTemporaryFile() as cf:
with self.mock_option('conf', cf.name), self.mock_option('debug', False):
cf.write('debug=True\n'.encode('utf-8'))
cf.write(b'debug=True\n')
cf.flush()
apply_options('flower', argv=['--conf=%s' % cf.name])
self.assertEqual(cf.name, options.conf)
Expand All @@ -175,7 +175,7 @@ def test_conf_abs(self):
def test_conf_relative(self):
with tempfile.NamedTemporaryFile(dir='.') as cf:
with self.mock_option('conf', cf.name), self.mock_option('debug', False):
cf.write('debug=True\n'.encode('utf-8'))
cf.write(b'debug=True\n')
cf.flush()
apply_options('flower', argv=['--conf=%s' % os.path.basename(cf.name)])
self.assertTrue(options.debug)
Expand All @@ -184,7 +184,7 @@ def test_conf_relative(self):
def test_all_options_documented(self):
def grep(patter, filename):
return int(subprocess.check_output(
'grep "%s" %s|wc -l' % (patter, filename), shell=True))
f'grep "{patter}" {filename}|wc -l', shell=True))

defined = grep('^define(', 'flower/options.py')
documented = grep('^~~', 'docs/config.rst')
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/views/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ def test_authenticate_wildcard_email(self):
self.assertTrue(authenticate("one.*@example.com", "[email protected]"))
self.assertFalse(authenticate(".*@example.com", "[email protected]"))
self.assertFalse(authenticate(".*@corp.example.com", "[email protected]"))
self.assertFalse(authenticate(".*@corp\.example\.com", "[email protected]"))
self.assertFalse(authenticate(r".*@corp\.example\.com", "[email protected]"))
Loading