From b3ced5b8c00e5f1f72590de993884c25c029f839 Mon Sep 17 00:00:00 2001 From: Utkarsh Gupta Date: Fri, 7 Dec 2018 14:30:24 +0530 Subject: [PATCH] decimal.pyi: Add overload for Decimal.__round__() (#2674) Fixes #2528 --- stdlib/2and3/decimal.pyi | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/stdlib/2and3/decimal.pyi b/stdlib/2and3/decimal.pyi index 0eebc2e6f..6adff15d0 100644 --- a/stdlib/2and3/decimal.pyi +++ b/stdlib/2and3/decimal.pyi @@ -2,7 +2,7 @@ import numbers import sys from types import TracebackType from typing import ( - Any, Container, Dict, List, NamedTuple, Optional, Sequence, Text, Tuple, Type, TypeVar, Union, + Any, Container, Dict, List, NamedTuple, Optional, overload, Sequence, Text, Tuple, Type, TypeVar, Union, ) _Decimal = Union[Decimal, int] @@ -121,7 +121,12 @@ class Decimal(object): def conjugate(self) -> Decimal: ... def __complex__(self) -> complex: ... if sys.version_info >= (3,): - def __round__(self, n: Optional[int] = ...) -> int: ... + @overload + def __round__(self) -> int: ... + @overload + def __round__(self, ndigits: None) -> int: ... + @overload + def __round__(self, ndigits: int) -> Decimal: ... def __floor__(self) -> int: ... def __ceil__(self) -> int: ... else: