Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for corner shots #176

Merged

Conversation

DriesDeprest
Copy link
Contributor

The code used to break when a corner shot event was present in the events as we handled all corner events as passes, resulting in the following error:

Traceback (most recent call last):
  File "/Users/driesdeprest/Documents/MyGamePlan/code/python/kloppy/kloppy/_providers/wyscout.py", line 45, in load
    return deserializer.deserialize(
  File "/Users/driesdeprest/Documents/MyGamePlan/code/python/kloppy/kloppy/infra/serializers/event/wyscout/deserializer_v3.py", line 369, in deserialize
    set_piece_event_args = _parse_set_piece(
  File "/Users/driesdeprest/Documents/MyGamePlan/code/python/kloppy/kloppy/infra/serializers/event/wyscout/deserializer_v3.py", line 229, in _parse_set_piece
    result = _parse_pass(raw_event, next_event, team)
  File "/Users/driesdeprest/Documents/MyGamePlan/code/python/kloppy/kloppy/infra/serializers/event/wyscout/deserializer_v3.py", line 147, in _parse_pass
    if raw_event["pass"]["accurate"] is True:
TypeError: 'NoneType' object is not subscriptable

This issue is now fixed by handling a corner as a pass or shot based on its secondary event type.

@DriesDeprest
Copy link
Contributor Author

DriesDeprest commented Mar 15, 2023

@koenvo Would it be possible, to after/if this PR's gets merged, create a new release 3.9.1, so that I can use it in my project?
Thanks in advance and apologies for missing this bug in the prior PR!

@koenvo
Copy link
Contributor

koenvo commented Mar 15, 2023

Please add a test that proves the bug is fixed. This test should fail without your fix

@DriesDeprest
Copy link
Contributor Author

@koenvo test has been added :-)

@DriesDeprest
Copy link
Contributor Author

@koenvo, do you need anything more from my side? Again, sorry for the impatience, but this bug is blocking me to use the Wyscout deserializer in our project. Thanks in advance :-)

@koenvo koenvo merged commit 89b6ba8 into PySport:master Mar 24, 2023
16 checks passed
@koenvo
Copy link
Contributor

koenvo commented Mar 24, 2023

Thanks for the PR Dries!

@DriesDeprest DriesDeprest deleted the bugfix/wyscout-corner-shot-support branch July 4, 2023 13:19
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.

None yet

2 participants