Skip to content

Commit

Permalink
Fix style
Browse files Browse the repository at this point in the history
  • Loading branch information
tammy-baylis-swi committed Oct 29, 2024
1 parent b40faf2 commit c461544
Showing 1 changed file with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -282,26 +282,28 @@ def __init__(
self.connect_module = connect_module
self.commenter_data = self.calculate_commenter_data()

def _get_db_version(
self,
db_driver,
):
if db_driver in _DB_DRIVER_ALIASES:
return util_version(_DB_DRIVER_ALIASES[db_driver])
db_version = ""
try:
db_version = self.connect_module.__version__
except AttributeError:
db_version = "unknown"
return db_version

def calculate_commenter_data(
self,
):
commenter_data = {}
if not self.enable_commenter:
return commenter_data

try:
db_driver = self.connect_module.__name__
except AttributeError:
db_driver = "unknown"

db_version = ""
if db_driver in _DB_DRIVER_ALIASES:
db_version = util_version(_DB_DRIVER_ALIASES[db_driver])
else:
try:
db_version = self.connect_module.__version__
except AttributeError:
db_version = "unknown"
db_driver = getattr(self.connect_module, "__name__", "unknown")
db_version = self._get_db_version(db_driver)

commenter_data = {
"db_driver": f"{db_driver}:{db_version.split(' ')[0]}",
Expand Down

0 comments on commit c461544

Please sign in to comment.