Skip to content

Commit

Permalink
Fix F401 unused imports and F821 undefined logger
Browse files Browse the repository at this point in the history
- Added necessary imports to `__all__` to ensure they are part of the public API and avoid F401 warnings.
- Removed unnecessary imports that were not being used in the code.
- Moved logger initialization to after imports, ensuring compliance with PEP 8 guidelines and resolving F821 (undefined logger) error.
- Ensured that all module-level imports remain at the top of the file as per PEP 8 to avoid E402 errors.

This commit cleans up the codebase to resolve Ruff linter warnings and ensures better readability and compliance with Python best practices.
  • Loading branch information
HD-Codes committed Sep 5, 2024
1 parent 49b712b commit e3c932c
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions package/MDAnalysis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,6 @@
"""



import logging
import warnings
from typing import Dict
Expand All @@ -161,11 +159,14 @@
try:
from .authors import __authors__
except ImportError:
logger = logging.getLogger("MDAnalysis.__init__")
logger.info('Could not find authors.py, __authors__ will be empty.')
__authors__ = []

__all__ = ['Universe', 'Writer',
'AtomGroup', 'ResidueGroup', 'SegmentGroup']
__all__ = ['Universe', 'Writer', 'AtomGroup', 'ResidueGroup', 'SegmentGroup', '__version__',
'SelectionError', 'NoDataError', 'ApplicationError', 'SelectionWarning',
'MissingDataWarning', 'ConversionWarning', 'FileFormatWarning', 'StreamWarning',
'start_logging', 'stop_logging', 'units', 'Merge', 'converters']

# custom exceptions and warnings
from .exceptions import (
Expand All @@ -188,8 +189,6 @@

from .due import due, Doi, BibTeX

logger = logging.getLogger("MDAnalysis.__init__")

# Registry of Readers, Parsers and Writers known to MDAnalysis
# Metaclass magic fills these as classes are declared.
_READERS: Dict = {}
Expand Down

0 comments on commit e3c932c

Please sign in to comment.