Skip to content

Commit 57f3364

Browse files
authored
Allow zero values for mu and sigma (#60)
* Allow setting mu and sigma to 0 * Make doctests pass * Add changelog fragment
1 parent 2667ddb commit 57f3364

File tree

7 files changed

+18
-10
lines changed

7 files changed

+18
-10
lines changed

CODE_OF_CONDUCT.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ If a community member engages in unacceptable behavior, the community organizers
5959

6060
If you are subject to or witness unacceptable behavior, or have any other concerns, please notify a community organizer as soon as possible. taven@opendebates.net.
6161

62-
[Reporting guidelines](https://hq.opendebates.net/w/grievances/)
62+
[Reporting guidelines](https://wiki.opendebates.net/en/grievances)
6363

6464
Additionally, community organizers are available to help community members engage with local law enforcement or to otherwise help those experiencing unacceptable behavior feel safe. In the context of in-person events, organizers will also provide escorts as desired by the person experiencing distress.
6565

6666
## 8. Addressing Grievances
6767

68-
If you feel you have been falsely or unfairly accused of violating this Code of Conduct, you should notify Open Debates Project with a concise description of your grievance. Your grievance will be handled in accordance with our existing governing policies. [Policy](https://hq.opendebates.net/w/grievances/)
68+
If you feel you have been falsely or unfairly accused of violating this Code of Conduct, you should notify Open Debates Project with a concise description of your grievance. Your grievance will be handled in accordance with our existing governing policies. [Policy](https://wiki.opendebates.net/en/grievances)
6969

7070
We will investigate any claims made in the report thoroughly and sufficient evidence is required for us to take action. We will not disclose any information that is sensitive and may damage the reputation of any community members
7171

@@ -81,7 +81,7 @@ taven@opendebates.net
8181

8282
## 11. License and attribution
8383

84-
The Citizen Code of Conduct is distributed by [Stumptown Syndicate](http://stumptownsyndicate.org) under a [Creative Commons Attribution-ShareAlike license](http://creativecommons.org/licenses/by-sa/3.0/).
84+
The Citizen Code of Conduct is distributed by [Stumptown Syndicate](http://stumptownsyndicate.org) under a [Creative Commons Attribution-ShareAlike license](http://creativecommons.org/licenses/by-sa/3.0/).
8585

8686
Portions of text derived from the [Django Code of Conduct](https://www.djangoproject.com/conduct/) and the [Geek Feminism Anti-Harassment Policy](http://geekfeminism.wikia.com/wiki/Conference_anti-harassment/Policy).
8787

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pip install openskill
2020
>>> from openskill import Rating, rate
2121
>>> a1 = Rating()
2222
>>> a1
23-
Rating(mu=25, sigma=8.333333333333334)
23+
Rating(mu=25.0, sigma=8.333333333333334)
2424
>>> a2 = Rating(mu=32.444, sigma=5.123)
2525
>>> a2
2626
Rating(mu=32.444, sigma=5.123)

changes/60.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Allow setting ``mu`` and ``sigma`` to 0 for ``Rating`` objects.

docs/manual.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Usage
1313
>>> from openskill import Rating, rate
1414
>>> a1 = Rating()
1515
>>> a1
16-
Rating(mu=25, sigma=8.333333333333334)
16+
Rating(mu=25.0, sigma=8.333333333333334)
1717
>>> a2 = Rating(mu=32.444, sigma=5.123)
1818
>>> a2
1919
Rating(mu=32.444, sigma=5.123)

openskill/constants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ def z(**options) -> float:
22
if "z" in options:
33
return options["z"]
44
else:
5-
return 3
5+
return 3.0
66

77

88
def mu(**options) -> float:
99
if "mu" in options:
1010
return options["mu"]
1111
else:
12-
return 25
12+
return 25.0
1313

1414

1515
def sigma(**options) -> float:

openskill/rate.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,15 @@ def __init__(
2525
self, mu: Optional[float] = None, sigma: Optional[float] = None, **options
2626
):
2727
# Calculate Mu and Sigma
28-
self.mu = mu if mu else default_mu(**options)
29-
self.sigma = sigma if sigma else default_sigma(**options)
28+
if isinstance(mu, (float, int)):
29+
self.mu = mu
30+
else:
31+
self.mu = default_mu(**options)
32+
33+
if isinstance(sigma, (float, int)):
34+
self.sigma = sigma
35+
else:
36+
self.sigma = default_sigma(**options)
3037

3138
def __repr__(self):
3239
return f"Rating(mu={self.mu}, sigma={self.sigma})"

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description = A faster, open-license alternative to Microsoft TrueSkill
55
author = Taven <taven@outlook.in>
66
author_email = contact@taven.me
77
license = mit
8-
license_file = LICENSE
8+
license_files = LICENSE
99
url = https://github.com/OpenDebates/openskill.py
1010
long_description = file: README.md
1111
long_description_content_type = text/markdown; charset=UTF-8

0 commit comments

Comments
 (0)