comparison roundup/configuration.py @ 7810:890097bc4cd0

chore(ruff): sort imports
author John Rouillard <rouilj@ieee.org>
date Sat, 16 Mar 2024 19:41:36 -0400
parents be6cb2e0d471
children a4b71f16c264
comparison
equal deleted inserted replaced
7809:be6cb2e0d471 7810:890097bc4cd0
5 # Some systems have a backport of the Python 3 configparser module to 5 # Some systems have a backport of the Python 3 configparser module to
6 # Python 2: <https://pypi.org/project/configparser/>. That breaks 6 # Python 2: <https://pypi.org/project/configparser/>. That breaks
7 # Roundup if used with Python 2 because it generates unicode objects 7 # Roundup if used with Python 2 because it generates unicode objects
8 # where not expected by the Python code. Thus, a version check is 8 # where not expected by the Python code. Thus, a version check is
9 # used here instead of try/except. 9 # used here instead of try/except.
10 import sys 10 import binascii
11 import errno
11 import getopt 12 import getopt
12 import errno
13 import logging 13 import logging
14 import logging.config 14 import logging.config
15 import os 15 import os
16 import re 16 import re
17 import smtplib
18 import sys
17 import time 19 import time
18 import smtplib
19 20
20 import roundup.date 21 import roundup.date
21 22 from roundup.anypy import random_
22 from roundup.anypy.strings import b2s 23 from roundup.anypy.strings import b2s
23 import roundup.anypy.random_ as random_ 24 from roundup.backends import list_backends
24 import binascii
25 from roundup.i18n import _ 25 from roundup.i18n import _
26 26
27 from roundup.backends import list_backends
28
29 if sys.version_info[0] > 2: 27 if sys.version_info[0] > 2:
30 import configparser # Python 3 28 import configparser # Python 3
31 else: 29 else:
32 import ConfigParser as configparser # Python 2 30 import ConfigParser as configparser # Python 2
33 31
34 from roundup.exceptions import RoundupException 32 from roundup.exceptions import RoundupException
35 33
895 # unset will choose default 893 # unset will choose default
896 return 894 return
897 895
898 redis_available = False 896 redis_available = False
899 try: 897 try:
900 import redis # noqa: F401 898 import redis # noqa: F401
901 redis_available = True 899 redis_available = True
902 except ImportError: 900 except ImportError:
903 if sessiondb_backend == 'redis': 901 if sessiondb_backend == 'redis':
904 valid_session_backends = ', '.join(sorted(list( 902 valid_session_backends = ', '.join(sorted(list(
905 [x[1] for x in self.compatibility_matrix 903 [x[1] for x in self.compatibility_matrix
1009 return _val 1007 return _val
1010 else: 1008 else:
1011 raise OptionValueError(self, value, self.class_description) 1009 raise OptionValueError(self, value, self.class_description)
1012 1010
1013 try: 1011 try:
1014 import jinja2 # noqa: F401 1012 import jinja2 # noqa: F401
1015 jinja2_avail = "Available found" 1013 jinja2_avail = "Available found"
1016 except ImportError: 1014 except ImportError:
1017 jinja2_avail = "Unavailable needs" 1015 jinja2_avail = "Unavailable needs"
1018 1016
1019 # Main configuration layout. 1017 # Main configuration layout.

Roundup Issue Tracker: http://roundup-tracker.org/