Remove unused or read only globals (flake8 F824)

This commit is contained in:
Peter J. A. Cock
2025-10-15 11:37:00 +01:00
committed by Peter Cock
parent e451db211b
commit 4c8696aa82
6 changed files with 5 additions and 13 deletions

View File

@ -100,7 +100,7 @@ def entry(db, id, format=None, field=None):
EFetch, available in Biopython as Bio.Entrez.efetch(...), but that
does not offer field extraction.
"""
global _entry_db_names, _entry_db_fields, fetch_db_formats
global _entry_db_names
if _entry_db_names is None:
_entry_db_names = _get_entry_dbs()
if db not in _entry_db_names:

View File

@ -238,8 +238,7 @@ class DBServer:
"""Add a new database to the server and return it."""
# make the database
sql = (
"INSERT INTO biodatabase (name, authority, description)"
" VALUES (%s, %s, %s)"
"INSERT INTO biodatabase (name, authority, description) VALUES (%s, %s, %s)"
)
self.adaptor.execute(sql, (db_name, authority, description))
return BioSeqDatabase(self.adaptor, db_name)
@ -808,7 +807,6 @@ class BioSeqDatabase:
"""
db_loader = Loader.DatabaseLoader(self.adaptor, self.dbid, fetch_NCBI_taxonomy)
num_records = 0
global _POSTGRES_RULES_PRESENT
for cur_record in record_iterator:
num_records += 1
# Hack to work around BioSQL Bug 2839 - If using PostgreSQL and

View File

@ -74,8 +74,7 @@ def temp_db_filename():
def check_config(dbdriver, dbtype, dbhost, dbuser, dbpasswd, testdb):
"""Verify the database settings work for connecting."""
global DBDRIVER, DBTYPE, DBHOST, DBUSER, DBPASSWD, TESTDB, DBSCHEMA
global SYSTEM, SQL_FILE
global DBDRIVER, DBTYPE, DBHOST, DBUSER, DBPASSWD, TESTDB, DBSCHEMA, SQL_FILE
DBDRIVER = dbdriver
DBTYPE = dbtype
DBHOST = dbhost

View File

@ -42,8 +42,7 @@ SYSTEM = platform.system()
def share_config(dbdriver, dbtype, dbhost, dbuser, dbpasswd, testdb):
"""Make sure we can access the DB settings from this file."""
global DBDRIVER, DBTYPE, DBHOST, DBUSER, DBPASSWD, TESTDB, DBSCHEMA
global SYSTEM, SQL_FILE
global DBDRIVER, DBTYPE, DBHOST, DBUSER, DBPASSWD, TESTDB
DBDRIVER = dbdriver
DBTYPE = dbtype
DBHOST = dbhost
@ -56,8 +55,7 @@ class TaxonomyTest(unittest.TestCase):
"""Test proper insertion and retrieval of taxonomy data."""
def setUp(self):
global DBDRIVER, DBTYPE, DBHOST, DBUSER, DBPASSWD, TESTDB, DBSCHEMA
global SYSTEM, SQL_FILE
global TESTDB
Entrez.email = "biopython@biopython.org"
# create TESTDB

View File

@ -231,7 +231,6 @@ class TestRunner(unittest.TextTestRunner):
output = StringIO()
# Restore the language and thus default encoding (in case a prior
# test changed this, e.g. to help with detecting command line tools)
global SYSTEM_LANG
os.environ["LANG"] = SYSTEM_LANG
# Always run tests from the Tests/ folder where run_tests.py
# should be located (as we assume this with relative paths etc)

View File

@ -228,7 +228,6 @@ for rst in files:
continue
def funct(n, d, f):
global tutorial_base
method = lambda x: None # noqa: E731
if f:
p = os.path.join(tutorial_base, f)
@ -271,7 +270,6 @@ class TutorialTestCase(unittest.TestCase):
)
def tearDown(self):
global original_path
os.chdir(original_path)
# files currently don't get created during test with python3.5 and pypy
# remove files created from chapter_phylo.tex