-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
engine: remove deprecated imports #8856
Conversation
This is a continuation of cvat-ai#8626.
WalkthroughThe pull request introduces comprehensive type annotation updates across multiple files in the CVAT engine module. The changes primarily focus on modernizing type hints by using built-in Python types like Changes
Poem
Tip CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (23)
✅ Files skipped from review due to trivial changes (5)
🔇 Additional comments (32)cvat/apps/engine/lazy_list.py (2)
✅ Verification successfulNo stale references to The file has been properly updated to use 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Searching for any leftover references to typing.Iterator
rg -A 2 $'typing.Iterator'
Length of output: 25 Script: #!/bin/bash
# Search for any references to Iterator, including in docstrings and type hints
rg -i "iterator" cvat/apps/engine/lazy_list.py
Length of output: 345 Script: #!/bin/bash
# Search for Iterator in type hints and imports using AST
ast-grep --pattern 'Iterator'
Length of output: 3621 Script: #!/bin/bash
# Search for any references to Iterator in Python files
rg "Iterator" --type py
Length of output: 4296 cvat/apps/engine/migrations/0084_honeypot_support.py (1)
cvat/apps/engine/location.py (2)
✅ Verification successfulLet me verify if there are any remaining references to Let me check the actual usage of Removal of Dict import is safe and correct 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
#!/bin/bash
# Check for leftover references to typing.Dict
rg -A 2 $'from typing import Dict'
Length of output: 138 Script: #!/bin/bash
# Check for Dict usage in location.py
rg -l "Dict" "cvat/apps/engine/location.py"
# Check for Dict type annotations in location.py using ast-grep
ast-grep --pattern 'Dict[' "cvat/apps/engine/location.py"
# Check for any Dict imports or usage in the engine directory
rg -l "Dict" "cvat/apps/engine/"
Length of output: 818 Script: #!/bin/bash
# Check for Dict imports and usage in the relevant engine files
rg -A 2 "Dict" "cvat/apps/engine/serializers.py" "cvat/apps/engine/frame_provider.py" "cvat/apps/engine/filters.py"
# Check if location.py is imported in these files
rg -l "from.*location import" "cvat/apps/engine/"
Length of output: 1938 cvat/apps/engine/view_utils.py (3)
✅ Verification successfulLet me check for any potential import collisions or unused imports by searching for Optional usage in the file. Import of Optional is correctly used and necessary 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Searching for references to typing union usage
rg -A 2 $'from typing import Union'
Length of output: 365 Script: #!/bin/bash
# Search for Optional usage in the specific file
rg -l "Optional" "cvat/apps/engine/view_utils.py"
# Show the content of the file to analyze Optional usage
cat "cvat/apps/engine/view_utils.py"
Length of output: 3351 cvat/apps/engine/migrations/0083_move_to_segment_chunks.py (1)
The change to import cvat/apps/engine/tests/utils.py (2)
The change to import collection types from
Updated type hint from cvat/apps/engine/utils.py (3)
The change consolidates collection type imports from
Updated type hint from
The return type hint update to cvat/apps/engine/filters.py (1)
The changes consistently update type hints to use built-in types instead of those from the typing module, following PEP 585 recommendations. This improves code readability while maintaining the same type safety. Also applies to: 29-29, 138-138, 195-195, 366-366 cvat/apps/engine/mixins.py (1)
The changes align with the codebase-wide effort to use built-in types and collections.abc for type hints, following modern Python practices. Also applies to: 428-428 cvat/apps/engine/frame_provider.py (1)
The changes systematically update type hints across the frame provider implementation to use:
This improves code readability while maintaining type safety. Also applies to: 53-53, 88-88, 108-108, 451-451, 523-523, 576-576 cvat/apps/engine/background.py (1)
The change from cvat/apps/engine/cloud_provider.py (1)
The changes replace deprecated typing module imports with their built-in equivalents:
Also applies to: 251-251, 279-279, 342-342, 371-371 cvat/apps/engine/cache.py (1)
The changes systematically update all type hints to use built-in types:
This modernization improves code consistency and readability while following PEP 585 guidelines. Also applies to: 628-628, 954-954, 964-964 cvat/apps/engine/models.py (2)
The change from Also applies to: 16-16
The parameter type annotation change from cvat/apps/engine/media_extractors.py (2)
The changes properly organize imports by:
Also applies to: 22-22
The return type annotations have been updated to use the built-in Also applies to: 674-674, 681-681, 772-772 cvat/apps/engine/task.py (2)
The changes properly organize imports by:
Also applies to: 18-18
All type annotations have been consistently updated to use built-in collection types (list, dict) instead of their typing module counterparts (List, Dict), following PEP 585 recommendations. Also applies to: 95-95, 98-98, 308-308, 347-347, 386-386, 459-459, 483-483, 515-515, 540-540, 561-561 cvat/apps/engine/serializers.py (4)
The change from
The changes from Also applies to: 539-539
The type annotation updates in storage-related functions follow the same pattern of using built-in types, maintaining consistency throughout the codebase. Also applies to: 3330-3330
The return type annotations in the to_representation methods have been updated to use built-in types, following the same modernization pattern. Also applies to: 3464-3464, 3504-3504 cvat/apps/engine/views.py (2)Line range hint The function implementation is clean with proper error handling and type annotations. It efficiently retrieves jobs from a queue while filtering for a specific user. Line range hint The function has:
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Quality Gate passedIssues Measures |
Motivation and context
This is a continuation of #8626.
How has this been tested?
Checklist
develop
branch[ ] I have created a changelog fragment[ ] I have updated the documentation accordingly[ ] I have added tests to cover my changes[ ] I have linked related issues (see GitHub docs)[ ] I have increased versions of npm packages if it is necessary(cvat-canvas,
cvat-core,
cvat-data and
cvat-ui)
License
Feel free to contact the maintainers if that's a concern.
Summary by CodeRabbit
Release Notes
New Features
Improvements
Bug Fixes
Documentation
Chores