Skip to content

Commit db65d40

Browse files
committed
chore(ruff): var name changes; unused import; formatting
Handle vars variable hiding builting vars(). Use more descripting variable name. Remove unused sys import. Add double lines where needed.
1 parent 8e0c7e1 commit db65d40

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

roundup/backends/__init__.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
'''
2020
__docformat__ = 'restructuredtext'
2121

22-
import sys
23-
2422
# These names are used to suppress import errors.
2523
# If get_backend raises an ImportError with appropriate
2624
# module name, have_backend quietly returns False.
@@ -31,18 +29,20 @@
3129
'sqlite': ('sqlite3', '_sqlite3'),
3230
}
3331

32+
3433
def get_backend(name):
3534
'''Get a specific backend by name.'''
36-
vars = globals()
35+
global_vars = globals()
3736
# if requested backend has been imported yet, return current instance
38-
if name in vars:
39-
return vars[name]
37+
if name in global_vars:
38+
return global_vars[name]
4039
# import the backend module
4140
module_name = 'back_%s' % name
42-
module = __import__(module_name, vars, level=1)
43-
vars[name] = module
41+
module = __import__(module_name, global_vars, level=1)
42+
global_vars[name] = module
4443
return module
4544

45+
4646
def have_backend(name):
4747
'''Is backend "name" available?'''
4848
try:
@@ -62,6 +62,7 @@ def have_backend(name):
6262
raise
6363
return 0
6464

65+
6566
def list_backends():
6667
'''List all available backend names.
6768
@@ -75,10 +76,10 @@ def list_backends():
7576
because we do not need to monkey-patch list_backends.
7677
7778
'''
78-
l = []
79+
backend_list = []
7980
for name in 'anydbm', 'mysql', 'sqlite', 'postgresql', 'memorydb':
8081
if have_backend(name):
81-
l.append(name)
82-
return l
82+
backend_list.append(name)
83+
return backend_list
8384

8485
# vim: set filetype=python sts=4 sw=4 et si :

0 commit comments

Comments
 (0)