Skip to content

Missing @staticmethod on convert_milliseconds_to_seconds silently corrupts BIDS metadata extraction #9

Open

Description

@Devguru-codes

Location

package/src/pyaslreport/utils/unit_conversion_utils.py:33

Description

convert_milliseconds_to_seconds is missing the @staticmethod decorator, while its sibling convert_to_milliseconds has it. When called from a class instance (e.g., BaseSequence._extract_common_metadata), Python passes the instance as the first positional argument (values), silently corrupting the conversion.

Reproduction (on main branch)

Script

from pyaslreport.utils.unit_conversion_utils import UnitConverterUtils

# Test 1: Class-level call
r = UnitConverterUtils.convert_milliseconds_to_seconds(15.0)  # works by accident

# Test 2: Instance-level call (how BaseSequence uses it)
r = UnitConverterUtils().convert_milliseconds_to_seconds(15.0)  # self consumed as values

# Test 3: Introspection
d = UnitConverterUtils.__dict__
isinstance(d['convert_milliseconds_to_seconds'], staticmethod)  # False — BUG

Results on main branch

# Test Status Detail
1 Class-level call PASS Works by accident (no self when called on class)
2 Instance-level call FAIL self consumed as values param, real arg ignored
3 @staticmethod present FAIL Decorator missing from convert_milliseconds_to_seconds

Summary: PASSED=1, FAILED=2

I have worked on this. This is just the issues i made in your private repo. Now, it is part of OSIPI, I will make the report the issues again here and make the PR in this repo.

Activity

  1. added a commit that references this issue on Mar 23, 2026
    9a1a905
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions