Skip to content

Fixed warnings#437

Closed
idan-h wants to merge 5 commits intodeepdoctection:masterfrom
idan-h:fixed-warnings-and-tests
Closed

Fixed warnings#437
idan-h wants to merge 5 commits intodeepdoctection:masterfrom
idan-h:fixed-warnings-and-tests

Conversation

@idan-h
Copy link

@idan-h idan-h commented Jan 5, 2026

There were some warnings and minor test warning and errors, fixed them.
Also added a bit more info when logging.

Copilot AI review requested due to automatic review settings January 5, 2026 00:59
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses various warnings across the codebase and fixes minor test issues. The changes include deprecation warnings, API usage warnings, Pydantic v2 migration fixes, and enhanced logging.

  • Fixed PyTorch softmax API warning by adding missing dim parameter
  • Updated Pydantic v2 compatibility by replacing deprecated __fields_set__ with model_fields_set
  • Converted asset integrity check failures from errors to warnings to handle Windows CRLF line ending differences
  • Added warning filters for external library deprecation warnings

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/shared_test_utils/src/shared_test_utils/collector.py Fixed escaped parentheses in docstring
packages/shared_test_utils/src/shared_test_utils/assets.py Converted RuntimeError to warnings for asset size/hash mismatches to handle Windows CRLF issues
packages/pyproject.toml Added pytest filter to ignore defusedxml deprecation warning
packages/deepdoctection/src/deepdoctection/pipe/order.py Fixed logic bug by adding missing negation to subset check
packages/deepdoctection/src/deepdoctection/extern/hflm.py Added missing dim parameter to F.softmax call to fix PyTorch warning
packages/deepdoctection/src/deepdoctection/extern/hfdetr.py Suppressed "copying from a non-meta parameter" warning when loading models
packages/dd_core/src/dd_core/utils/env_info.py Updated to Pydantic v2 API using model_fields_set instead of fields_set
packages/dd_core/src/dd_core/mapper/maputils.py Enhanced error logging with more detailed error type and message information
packages/dd_core/src/dd_core/datapoint/annotation.py Added protected_namespaces config to suppress Pydantic warning
Comments suppressed due to low confidence (2)

packages/shared_test_utils/src/shared_test_utils/assets.py:208

  • Converting integrity check failures from RuntimeError to warnings may hide legitimate asset corruption issues. While CRLF line ending differences on Windows are valid edge cases, genuine corruption (wrong file downloaded, partial transfer, etc.) will now silently pass. Consider only downgrading to a warning for small discrepancies that are likely CRLF-related, while still raising errors for significant mismatches.
                warnings.warn(
                    f"Asset '{key}' size mismatch (likely due to CRLF):\n"
                    f"  Expected: {expected_size} bytes\n"
                    f"  Actual:   {actual_size} bytes\n"
                    f"  Path:     {abs_path}"
                )

packages/shared_test_utils/src/shared_test_utils/assets.py:222

  • Converting SHA-256 hash mismatch from RuntimeError to warning is risky. Hash mismatches typically indicate serious issues (file corruption, tampering, incomplete download). While CRLF differences can cause hash mismatches, silently continuing with a potentially corrupted file could lead to unpredictable test failures or incorrect behavior. Consider only downgrading to a warning when the size difference matches expected CRLF conversion (e.g., difference equals line count), while still raising errors for genuine corruption.
                warnings.warn(
                    f"Asset '{key}' SHA-256 mismatch:\n"
                    f"  Expected: {expected_hash}\n"
                    f"  Actual:   {actual_hash}\n"
                    f"  Path:     {abs_path}\n"
                    f"The file may have been modified or corrupted."
                )

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@idan-h idan-h closed this Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants