Giter Site home page Giter Site logo

Comments (1)

JasonMendoza2008 avatar JasonMendoza2008 commented on September 15, 2024

To fix the bug, one should probably replace:
latest_event_ts = sorted(latest_event_with_ts)[-1]
by:
latest_event_ts: tuple[datetime.timedelta, Position] = sorted(latest_event_with_ts, key=lambda ts_p: ts_p[0])[-1]

Although this whole sequence

        # The latest position is either from the latest event or from the participant timeline frame
        latest_frame_ts = self._latest_frame.timestamp
        latest_event_with_ts = [(getattr(event, 'timestamp', None), getattr(event, 'position', None)) for event in self._processed_events]
        latest_event_with_ts = [(ts, p) for ts, p in latest_event_with_ts if ts is not None and p is not None]
        latest_event_ts = sorted(latest_event_with_ts)[-1]
        if latest_frame_ts > latest_event_ts[0]:
            return self._latest_frame.position
        else:
            return latest_event_ts[1]

sounds non optimal from a complexity point of view (and also has bugs when latest_event_with_ts is an empty sequence cf #425).

I could recode it and add appropriate unit tests and type-hinting but I'm not sure I know how yall work on this library. Feel free to add me on discord to discuss about it Jasonnn#2960.

from cassiopeia.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.