Comments (1)
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)
- player stats: dragon_kills and baron_kills does not work HOT 1
- Summoner `league_entries` broken for some HOT 3
- summoner.name throws AttributeError HOT 3
- TypeError: list indices must be integers or slices, not Summoner
- Slow rate of requests HOT 2
- Unknown patch name 12.12 HOT 1
- 'Match' object has no attribute '_lazy__timeline' HOT 1
- keeps throwing 403 error while my api key works elsewhere HOT 2
- Get champions owned (summoner) HOT 1
- AttributeError: 'Match' object has no attribute '_lazy__timeline'
- AttributeError: 'Match' object has no attribute '_lazy__timeline' HOT 1
- Add SEA region for OC1 HOT 1
- IndexError: list index out of range when requesting the position too early in the game HOT 4
- Lane information
- Type-hinting of Match.participants is wrong? HOT 3
- How to get positions more than once every minute?
- Method __str__ of class SummonerSpell doesn't work as intended HOT 8
- CumulativeTimeline object doesn't have all the info available in the API HOT 2
- Missing platforms in Region Enum HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cassiopeia.