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

Release 0.2.0 #10

Merged
merged 29 commits into from
Apr 27, 2024
Merged

Release 0.2.0 #10

merged 29 commits into from
Apr 27, 2024

Conversation

mberk
Copy link
Owner

@mberk mberk commented Apr 27, 2024

No description provided.

peterschutt and others added 29 commits January 30, 2024 12:24
This change declares the type of `p` to accept either the list of mapping return type.
Means we don't lose the information about whether the param `odds` is a mapping or other collection, and therefore we don't need to early capture `keys`.

Also, `_class` was unused, so removed, however we probably can support returning the same type of mapping as the user inputs.
This allows us to use the nicer union syntax, `A | B`.
Sequences have specific order, important as the output list is ordered the same as the input sequence.
…ities`

Makes all arguments other than `odds` kw only, this drastically reduces the number of required overloads to type the signature properly.

```py
# still works
calculate_implied_probabilities([2.0, 2.0])
calculate_implied_probabilities(odds=[2.0, 2.0])
calculate_implied_probabilities([2.0, 2.0], full_output=True)
## also any other combination of passing arguments as keyword args remains the same

# patterns of passing any arg other than `odds` as positional breaks
calculate_implied_probabilibies([2.0, 2.0], 1000)
calculate_impolied_probabilities([2.0, 2.0], 1000, 1e-12, True)
```

This encourages clarity at the callsite and also helps from a library perspective as it is easier to add new kw only args to an api without breaking downstream.

Adds overloads and tests for combination of input types and value of `full_output` flag.
Allows the key type of returned dict to match the input key type.

Previously, and input of `{"home": 2.0, "away": 2.0}` would return type `dict[Any, float]`. This change allows that to return `dict[str, float]`.
Instead of returning a dict that loses the type of the implied probabilities, we can return an object that is generic on the implied probability return type.

This means that as far as mypy is concerned, the following two are equivalent:

```py
calculate_implied_probabilities([2.0, 2.0])
calculate_implied_probabilities([2.0, 2.0], full_output=True).implied_probabilities
```
Configures mypy to run on tests as well as library code.

Refactors tests to deal with type errors caused by reused variable names inside the mono-test.
Reflects changes introduced in #5.

Closes #7
Bumps [black](https://github.com/psf/black) from 23.10.1 to 24.3.0.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md)
- [Commits](psf/black@23.10.1...24.3.0)

---
updated-dependencies:
- dependency-name: black
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
@mberk mberk self-assigned this Apr 27, 2024
@mberk mberk merged commit d54f466 into master Apr 27, 2024
18 checks passed
@mberk mberk deleted the release-0.2.0 branch April 27, 2024 06:45
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.

2 participants