Skip to content

fix: add missing @staticmethod to convert_milliseconds_to_seconds #10

Open
Devguru-codes wants to merge 1 commit intoOSIPI:mainfrom
Devguru-codes:issue9
Open

fix: add missing @staticmethod to convert_milliseconds_to_seconds #10
Devguru-codes wants to merge 1 commit intoOSIPI:mainfrom
Devguru-codes:issue9

Conversation

@Devguru-codes
Copy link

convert_milliseconds_to_seconds in unit_conversion_utils.py is missing the @staticmethod decorator, while its counterpart convert_to_milliseconds has it. This causes silent failures when called from an instance context (as in BaseSequence._extract_common_metadata), where self is consumed as the values parameter.

Fix

One-line change: add @staticmethod above convert_milliseconds_to_seconds.

File Changed

package/src/pyaslreport/utils/unit_conversion_utils.py

+    @staticmethod
     def convert_milliseconds_to_seconds(values: int | float | list[int | float]) -> int | float | list[int | float]:

Before/After Comparison

main branch (before fix)

# Test Status Detail
1 Class-level call (15.0 -> 0.015) PASS Works by accident
2 Instance-level call (15.0 -> 0.015) FAIL self consumed as values
3 @staticmethod present FAIL Missing decorator

Summary: PASSED=1 FAILED=2

fix/bug-2-missing-staticmethod branch (after fix)

# Test Status Detail
1 Class-level call (15.0 -> 0.015) PASS
2 Instance-level call (15.0 -> 0.015) PASS
3 @staticmethod present PASS

Summary: PASSED=3 FAILED=0


Sanity Checks

Check Result
convert_to_milliseconds(1.5) 1500
convert_milliseconds_to_seconds(1500) 1.5
convert_milliseconds_to_seconds([15.0, 30.0]) [0.015, 0.03]
No other files modified Yes

Resolves #9

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.

Missing @staticmethod on convert_milliseconds_to_seconds silently corrupts BIDS metadata extraction

1 participant