ZEDGR / pychallonge

Python Module for the CHALLONGE API
https://challonge.com/api
BSD 2-Clause "Simplified" License
42 stars 11 forks source link

Tournament participants with all-number names get cast to float type #3

Closed GradyMoran closed 6 years ago

GradyMoran commented 6 years ago

https://github.com/ZEDGR/pychal/blob/ebefcc8fc05798ce71f1199eb2481a4b99c84608/challonge/api.py#L121

The value of key 'display_name' in the dictionary returned from participants.index() is a float when the tournament participant's name passes float(v) without throwing ValueError. Thus in the returned dictionary every participant's name is of type str except those that can be interpreted as numbers, which are of type float.

FWIW, pychallonge does not have this issue.

GradyMoran commented 6 years ago

See https://github.com/GradyMoran/pychal/blob/8c0616dec6d684ffbd7541b01ce11cf234966683/challonge/api.py#L114 for the easiest way to fix this I could think of. That doesn't list every field which is guaranteed to be a string. I can open a pull request if you want.

ZEDGR commented 6 years ago

@GradyMoran Thank you for reporting this issue. A PR will be nice

ZEDGR commented 6 years ago

This issue is fixed. Thanks for your PR. If you are using pychal in your module please use 1.8.1