Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions stdlib/random.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,14 @@ class Random(_random.Random):
def betavariate(self, alpha: float, beta: float) -> float: ...
def expovariate(self, lambd: float) -> float: ...
def gammavariate(self, alpha: float, beta: float) -> float: ...
def gauss(self, mu: float, sigma: float) -> float: ...
if sys.version_info >= (3, 11):
def gauss(self, mu: float = ..., sigma: float = ...) -> float: ...
def normalvariate(self, mu: float = ..., sigma: float = ...) -> float: ...
else:
def gauss(self, mu: float, sigma: float) -> float: ...
def normalvariate(self, mu: float, sigma: float) -> float: ...

def lognormvariate(self, mu: float, sigma: float) -> float: ...
def normalvariate(self, mu: float, sigma: float) -> float: ...
def vonmisesvariate(self, mu: float, kappa: float) -> float: ...
def paretovariate(self, alpha: float) -> float: ...
def weibullvariate(self, alpha: float, beta: float) -> float: ...
Expand Down Expand Up @@ -154,9 +159,16 @@ def triangular(low: float = ..., high: float = ..., mode: float | None = ...) ->
def betavariate(alpha: float, beta: float) -> float: ...
def expovariate(lambd: float) -> float: ...
def gammavariate(alpha: float, beta: float) -> float: ...
def gauss(mu: float, sigma: float) -> float: ...

if sys.version_info >= (3, 11):
def gauss(mu: float = ..., sigma: float = ...) -> float: ...
def normalvariate(mu: float = ..., sigma: float = ...) -> float: ...

else:
def gauss(mu: float, sigma: float) -> float: ...
def normalvariate(mu: float, sigma: float) -> float: ...
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if replacing these with pkg_resources.WorkingSet style aliases would be possible, to better match to runtime.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, we should do that. I think for a long time pytype did not support bound methods, but now it does.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, seems like we should be able to do this now: #4817 (comment)


def lognormvariate(mu: float, sigma: float) -> float: ...
def normalvariate(mu: float, sigma: float) -> float: ...
def vonmisesvariate(mu: float, kappa: float) -> float: ...
def paretovariate(alpha: float) -> float: ...
def weibullvariate(alpha: float, beta: float) -> float: ...