Repository: joke2k/faker

Issue:
`ElementsType` requires `Sequence[T]`, not just `Iterable[T]`?
The definition for `ElementsType` currently requires a sequence, or dict keys:

https://github.com/joke2k/faker/blob/7093e5ab9b5e894e04807130b75dc940c7a9d53a/faker/providers/__init__.py#L18

I can't see why it needs to be a _sequence_ though, i.e. having any order - wouldn't `Iterable[T]` suffice?

I hit this by using `random_element(elements)`, where `elements: Set[str]`. I can work around it for now as `random_element(tuple(elements))` of course.

Comments:

Patch:
diff --git a/.bumpversion.cfg b/.bumpversion.cfg
index b511b0b9..538a3a02 100644
--- a/.bumpversion.cfg
+++ b/.bumpversion.cfg
@@ -1,5 +1,5 @@
 [bumpversion]
-current_version = 9.8.0
+current_version = 9.8.1
 files = VERSION faker/__init__.py docs/conf.py
 commit = True
 tag = True
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bd385890..967a9611 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
 ## Changelog
 
+### [v9.8.1 - 2021-11-12](https://github.com/joke2k/faker/compare/v9.8.0...v9.8.1)
+
+* Fix ``pydecimal`` with ``left_digits=0`` not setting the left digit to 0. Thanks @ndrwkim.
+
 ### [v9.8.0 - 2021-11-02](https://github.com/joke2k/faker/compare/v9.7.1...v9.8.0)
 
 *  Add ``es_CO`` localized providers. Thank you @healarconr.
diff --git a/VERSION b/VERSION
index 834eb3fa..31476ce1 100644
--- a/VERSION
+++ b/VERSION
@@ -1,1 +1,1 @@
-9.8.0
+9.8.1
diff --git a/docs/conf.py b/docs/conf.py
index 17466971..0a0138e8 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -51,9 +51,9 @@ copyright = "2014, Daniele Faraglia"
 # built documents.
 #
 # The short X.Y version.
-version = "9.8.0"
+version = "9.8.1"
 # The full version, including alpha/beta/rc tags.
-release = "9.8.0"
+release = "9.8.1"
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff --git a/faker/__init__.py b/faker/__init__.py
index 7b64a32b..133b01e8 100644
--- a/faker/__init__.py
+++ b/faker/__init__.py
@@ -2,6 +2,6 @@ from faker.factory import Factory
 from faker.generator import Generator
 from faker.proxy import Faker
 
-VERSION = "9.8.0"
+VERSION = "9.8.1"
 
 __all__ = ("Factory", "Generator", "Faker")
diff --git a/faker/providers/__init__.py b/faker/providers/__init__.py
index 84e7b2f1..2a9e16ea 100644
--- a/faker/providers/__init__.py
+++ b/faker/providers/__init__.py
@@ -2,7 +2,7 @@ import re
 import string
 
 from collections import OrderedDict
-from typing import Any, Dict, KeysView, List, Optional, Sequence, TypeVar, Union
+from typing import Any, Collection, List, Optional, Sequence, TypeVar, Union
 
 from ..generator import Generator
 from ..utils.distribution import choices_distribution, choices_distribution_unique
@@ -15,7 +15,7 @@ _re_qm = re.compile(r"\?")
 _re_cir = re.compile(r"\^")
 
 T = TypeVar("T")
-ElementsType = Union[Sequence[T], Dict[T, float], KeysView[T]]
+ElementsType = Collection[T]
 
 
 class BaseProvider:
diff --git a/faker/providers/python/__init__.py b/faker/providers/python/__init__.py
index bee5084d..bf989fdb 100644
--- a/faker/providers/python/__init__.py
+++ b/faker/providers/python/__init__.py
@@ -193,14 +193,16 @@ class Provider(BaseProvider):
                 left_number = str(self.random_int(max(min_value or 0, 0), max_value))
             else:
                 min_left_digits = math.ceil(math.log10(max(min_value or 1, 1)))
-                left_digits = left_digits or self.random_int(min_left_digits, max_left_random_digits)
+                if left_digits is None:
+                    left_digits = self.random_int(min_left_digits, max_left_random_digits)
                 left_number = "".join([str(self.random_digit()) for i in range(0, left_digits)]) or "0"
         else:
             if min_value is not None:
                 left_number = str(self.random_int(max(max_value or 0, 0), abs(min_value)))
             else:
                 min_left_digits = math.ceil(math.log10(abs(min(max_value or 1, 1))))
-                left_digits = left_digits or self.random_int(min_left_digits, max_left_random_digits)
+                if left_digits is None:
+                    left_digits = self.random_int(min_left_digits, max_left_random_digits)
                 left_number = "".join([str(self.random_digit()) for i in range(0, left_digits)]) or "0"
 
         if right_digits is None:


Test patch:
diff --git a/tests/providers/test_python.py b/tests/providers/test_python.py
index 68f2b1d4..ac8b0b4d 100644
--- a/tests/providers/test_python.py
+++ b/tests/providers/test_python.py
@@ -235,6 +235,14 @@ class TestPydecimal(unittest.TestCase):
         left_digits = len(str(abs(int(result))))
         self.assertGreaterEqual(expected_left_digits, left_digits)
 
+    def test_left_digits_can_be_zero(self):
+        expected_left_digits = 0
+
+        result = self.fake.pydecimal(left_digits=expected_left_digits)
+
+        left_digits = int(result)
+        self.assertEqual(expected_left_digits, left_digits)
+
     def test_right_digits(self):
         expected_right_digits = 10