Commit 4ec817b
authored
[Data] Fix MCAP datasource import for better compatibility (#57964)
## Description
This PR fixes the import statement in `MCAPDatasource` to follow Python
best practices for explicit imports.
**Change**: Updated from `import mcap` + `mcap.reader.make_reader(f)` to
`from mcap.reader import make_reader` for cleaner, more explicit
importing.
**Why this is needed**:
- Follows Python best practices for explicit imports (PEP 8)
- Improves code readability by making it clear what's being used
- Better compatibility with different mcap package versions
- Reduces namespace pollution
## Related issues
None - this is a code quality improvement.
## Additional information
### What changed
**Before:**
```python
import mcap
reader = mcap.reader.make_reader(f)
```
**After:**
```python
from mcap.reader import make_reader
reader = make_reader(f)
```
### Impact
- **Minimal risk**: This is a refactoring of the import statement only
- **No API changes**: The `MCAPDatasource` public API remains unchanged
- **No behavioral changes**: The functionality is identical
- **Tested**: All ruff lint checks pass
### File modified
- `python/ray/data/_internal/datasource/mcap_datasource.py` (2 lines
changed)
This change makes the code more maintainable and follows modern Python
conventions for explicit imports.
Signed-off-by: soffer-anyscale <[email protected]>1 parent 4181b44 commit 4ec817b
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
| 142 | + | |
143 | 143 | | |
144 | | - | |
| 144 | + | |
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
| |||
0 commit comments