internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: joke2k/faker

Issue:
pydict(variable_nb_elements=False) returns dicts with varying number of elements
* Faker version: 4.0.1
* OS: OS X 10.15.3

pydict with `variable_nb_elements=False` still has varying number of elements.

### Steps to reproduce

```
from faker import Faker

fake = Faker()

nb = 80
for _ in range(30):  # nb is large and the faker function is called 30 times to increase the probability of reproducing the bug.
    fake_dict = fake.pydict(nb_elements=nb, variable_nb_elements=False)
    nb_reality = len(fake_dict)
    if nb_reality != nb:
        print(nb_reality)
```

### Expected behavior

The length of the dictionary should always be `nb`. 

### Actual behavior

It is often shorter as the keys are generated with [`self.generator.words(nb_elements)`](https://github.com/joke2k/faker/blob/master/faker/providers/python/__init__.py#L166). If the keys are not unique, the element is dropped.



Discussion:
Thank you for the report @lillitm.

I think the problem is in https://github.com/joke2k/faker/blob/master/faker/providers/python/__init__.py#L166:

```python
        return dict(zip(
            self.generator.words(nb_elements),
            self._pyiterable(nb_elements, False, *value_types),
        ))
```

If we'd call `self.generator.words(nb_elements, unique=True)`, the `dict` won't any duplicate keys to drop.

Feel free to submit a PR and I'll be happy to review it :)

Resolving patch:
diff --git a/faker/providers/python/__init__.py b/faker/providers/python/__init__.py
--- a/faker/providers/python/__init__.py
+++ b/faker/providers/python/__init__.py
@@ -163,7 +163,7 @@ def pydict(self, nb_elements=10, variable_nb_elements=True, *value_types):
             nb_elements = self.randomize_nb_elements(nb_elements, min=1)
 
         return dict(zip(
-            self.generator.words(nb_elements),
+            self.generator.words(nb_elements, unique=True),
             self._pyiterable(nb_elements, False, *value_types),
         ))
 


Test patch:
Repository: joke2k/faker

Issue:
Missing implementation of no_NO license plates.
* Faker version:
* OS:

no_NO license plates are not implemeted.

### Steps to reproduce

### Expected behavior

Should be of the form 

> AB 12345

### Actual behavior
#1140 



Discussion:

Resolving patch:
diff --git a/faker/providers/automotive/no_NO/__init__.py b/faker/providers/automotive/no_NO/__init__.py
new file mode 100644
--- /dev/null
+++ b/faker/providers/automotive/no_NO/__init__.py
@@ -0,0 +1,9 @@
+from .. import Provider as AutomotiveProvider
+
+
+class Provider(AutomotiveProvider):
+    # Source: https://en.wikipedia.org/wiki/Vehicle_registration_plates_of_Norway
+    license_formats = (
+        # Classic format
+        '?? #####',
+    )


Test patch:
diff --git a/tests/providers/test_automotive.py b/tests/providers/test_automotive.py
--- a/tests/providers/test_automotive.py
+++ b/tests/providers/test_automotive.py
@@ -148,6 +148,17 @@ def test_fr_FR_plate_format(self):
         assert self.pattern.match(plate)
 
 
+class TestNoNO(unittest.TestCase):
+
+    def setUp(self):
+        self.fake = Faker('no_NO')
+        Faker.seed(0)
+
+    def test_sv_SE_plate_format(self):
+        plate = self.fake.license_plate()
+        assert re.match(r"^[A-Z]{2} \d{5}$", plate), "%s is not in the correct format." % plate
+
+
 class TestEsES(unittest.TestCase):
 
     def setUp(self):
Repository: joke2k/faker

Issue:
Webargs email validation failed with Armenian company emails
* Faker version: 4.1.0
* OS: Linux/Ubuntu

Brief summary of the issue goes here.

Company emails with hy_AM (Armenian) localization can contain a last_name company that is considered as invalid by Webargs/Marshmallow (email domains can not contain underscores). I verified that {{last_name}} is a token in the company name format (Is that suspicious? Is it a non-replaced token?)

### Steps to reproduce

1) create a Armenian Faker
> fake = Faker('hy_AM')

2) Produce a number of company_email
> fake.company_email()
'tsormotyansyowzanna@karamanowkyan.biz'
> fake.company_email()
'pvazigeghtsyan@last_name.com'


### Expected behavior

Emails should not contain @last_name domains

### Actual behavior

Armenian emails can contain @last_name domains. I tried with other locales and found no issues




Discussion:
The `company_email` method depends on `domain_name` which depends on `domain_word` which depends on `company`. There is a localization available for the `company` method under `hy_AM`, and under this localization, one of the formats has a missing `}` character as shown [here](https://github.com/joke2k/faker/blob/53a8b4aa65471791c80b0708a0c2ae8243e9e713/faker/providers/company/hy_AM/__init__.py#L8).

Whenever this format is randomly selected, the `{{last_name}` portion gets rendered as a literal instead of a valid generator token that will call the `last_name` method. Further "ascii-fication" converts this into the literal `last_name` you have observed in the output.

The issue is caused by a minor typo, and the fix is very simple. If you or any aspiring contributor would like to submit a patch, please feel free to do so. I will submit a PR if there are no takers by next week.

Resolving patch:
diff --git a/faker/providers/company/hy_AM/__init__.py b/faker/providers/company/hy_AM/__init__.py
--- a/faker/providers/company/hy_AM/__init__.py
+++ b/faker/providers/company/hy_AM/__init__.py
@@ -5,7 +5,7 @@ class Provider(CompanyProvider):
 
     formats = (
         '{{first_name}} և {{first_name}} {{company_suffix}}',
-        '{{last_name} {{company_suffix}}',
+        '{{last_name}} {{company_suffix}}',
         '{{last_name}} և {{last_name}} {{company_suffix}}'
         '{{last_name}}, {{last_name}} և {{last_name}} {{company_suffix}}',
     )


Test patch:
Repository: joke2k/faker

Issue:
French IBAN should be 27 char of length
* Faker version: 4.1.1

### Steps to reproduce

```
import faker
from faker import Faker
fake = Faker('fr_FR')
fr_iban = fake.iban()
fr_iban
'FR96505438725498141631455686'
len(fr_iban)
28
```


### Expected behavior

```
>>> len(fr_iban)
27
```

[As stated on wikipedia in France row](https://en.wikipedia.org/wiki/International_Bank_Account_Number#IBAN_formats_by_country)

### Actual behavior

```
>>> len(fr_iban)
28
```



Discussion:

Resolving patch:
diff --git a/faker/providers/bank/fr_FR/__init__.py b/faker/providers/bank/fr_FR/__init__.py
--- a/faker/providers/bank/fr_FR/__init__.py
+++ b/faker/providers/bank/fr_FR/__init__.py
@@ -2,5 +2,5 @@
 
 
 class Provider(BankProvider):
-    bban_format = '########################'
+    bban_format = '#######################'
     country_code = 'FR'


Test patch:
diff --git a/tests/providers/test_bank.py b/tests/providers/test_bank.py
--- a/tests/providers/test_bank.py
+++ b/tests/providers/test_bank.py
@@ -131,6 +131,22 @@ def test_iban(self):
         assert re.match(r"ES\d{22}", iban)
 
 
+class TestFrFR(unittest.TestCase):
+    """Tests the bank provider for fr_FR locale"""
+
+    def setUp(self):
+        self.fake = Faker('fr_FR')
+        Faker.seed(0)
+
+    def test_bban(self):
+        bban = self.fake.bban()
+        assert re.match(r"\d{23}", bban)
+
+    def test_iban(self):
+        iban = self.fake.iban()
+        assert re.match(r"FR\d{25}", iban)
+
+
 class TestEnPh:
 
     def test_swift(self, faker, num_samples):
Repository: joke2k/faker

Issue:
Turkish translation for Automotive provider
* Faker version:
* OS:

The job provider does not contain Turkish translation. It is using the base automotive provider (`license_plate`).

### Steps to reproduce

import faker
f = faker.Faker('tr_TR')
lp = f.license_plate()

### Expected behavior

`lp` will needs to hold a license plate sample in Turkish(e.g: `25 MOT 93`)

### Actual behavior

`lp` is holding a license plate in English(e.g: `552 YFC`)



Discussion:

Resolving patch:
diff --git a/faker/providers/automotive/tr_TR/__init__.py b/faker/providers/automotive/tr_TR/__init__.py
new file mode 100644
--- /dev/null
+++ b/faker/providers/automotive/tr_TR/__init__.py
@@ -0,0 +1,31 @@
+import re
+
+from .. import Provider as AutomotiveProvider
+
+
+class Provider(AutomotiveProvider):
+    """Implement automotive provider for ``tr_TR`` locale.
+
+    Sources:
+
+    - https://en.wikipedia.org/wiki/Vehicle_registration_plates_of_Turkey
+    """
+
+    license_formats = (
+        '## ? ####',
+        '## ? #####',
+        '## ?? ###',
+        '## ?? ####',
+        '## ??? ##',
+        '## ??? ###',
+    )
+    ascii_uppercase_turkish = 'ABCDEFGHIJKLMNOPRSTUVYZ'
+
+    def license_plate(self) -> str:
+        """Generate a license plate."""
+        temp = re.sub(r'\?',
+                      lambda x: self.random_element(self.ascii_uppercase_turkish),
+                      self.random_element(self.license_formats))
+        temp = temp.replace('##', '{:02d}', 1)
+        temp = temp.format(self.random_element(range(1, 82)))
+        return self.numerify(temp)


Test patch:
diff --git a/tests/providers/test_automotive.py b/tests/providers/test_automotive.py
--- a/tests/providers/test_automotive.py
+++ b/tests/providers/test_automotive.py
@@ -3,6 +3,7 @@
 from faker.providers.automotive.de_DE import Provider as DeDeAutomotiveProvider
 from faker.providers.automotive.es_ES import Provider as EsEsAutomotiveProvider
 from faker.providers.automotive.ru_RU import Provider as RuRuAutomotiveProvider
+from faker.providers.automotive.tr_TR import Provider as TrTrAutomotiveProvider
 
 
 class _SimpleAutomotiveTestMixin:
@@ -158,3 +159,20 @@ def test_plate_format(self, faker):
         plate = faker.license_plate()
         assert isinstance(plate, str)
         assert self.new_format_pattern.match(plate) or self.old_format_pattern.match(plate)
+
+
+class TestTrTr(_SimpleAutomotiveTestMixin):
+    """Test tr_TR automotive provider methods"""
+    license_plate_pattern = re.compile(
+        r'\d{2} [A-Z] \d{4}|'
+        r'\d{2} [A-Z] \d{5}|'
+        r'\d{2} [A-Z]{2} \d{3}|'
+        r'\d{2} [A-Z]{2} \d{4}|'
+        r'\d{2} [A-Z]{3} \d{2}|'
+        r'\d{2} [A-Z]{3} \d{3}',
+    )
+
+    def perform_extra_checks(self, license_plate, match):
+        [city_code, letters, _] = license_plate.split(' ')
+        assert int(city_code) in range(1, 82)
+        assert all(letter in TrTrAutomotiveProvider.ascii_uppercase_turkish for letter in letters)
Repository: joke2k/faker

Issue:
test_date_pattern fails on 4.18.0
* Faker version: 4.18.0
* OS: Alpine Linux

Brief summary of the issue goes here.

```
======================================================================
FAIL: test_date_pattern (tests.providers.test_date_time.TestThTh)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/sircmpwn/sources/aports/community/py3-faker/src/Faker-4.18.0/tests/providers/test_date_time.py", line 942, in test_date_pattern
    assert date == "Q"
AssertionError

----------------------------------------------------------------------
```
test_date_pattern fails on 4.18.0
* Faker version: 4.18.0
* OS: Alpine Linux

Brief summary of the issue goes here.

```
======================================================================
FAIL: test_date_pattern (tests.providers.test_date_time.TestThTh)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/sircmpwn/sources/aports/community/py3-faker/src/Faker-4.18.0/tests/providers/test_date_time.py", line 942, in test_date_pattern
    assert date == "Q"
AssertionError

----------------------------------------------------------------------
```


Discussion:
@bact Can you take a look into this?
Thank you. Will look at this.
This is reproducible on 5.0.0.
@bact Can you take a look into this?
Thank you. Will look at this.
This is reproducible on 5.0.0.

Resolving patch:
diff --git a/faker/providers/date_time/th_TH/__init__.py b/faker/providers/date_time/th_TH/__init__.py
--- a/faker/providers/date_time/th_TH/__init__.py
+++ b/faker/providers/date_time/th_TH/__init__.py
@@ -64,11 +64,10 @@ def _std_strftime(dt_obj: datetime, fmt_char: str) -> str:
     str_ = ""
     try:
         str_ = dt_obj.strftime("%{}".format(fmt_char))
-        if str_ == "%{}".format(fmt_char):
+        if not str_ or str_ == "%{}".format(fmt_char):
             # normalize outputs for unsupported directives
             # in different platforms
-            # unsupported "%Q" in platform A may return "Q"
-            # unsupported "%Q" in platform A may return "%Q"
+            # "%Q" may result "%Q", "Q", or "", make it "Q"
             str_ = fmt_char
     except ValueError as err:  # pragma: no cover
         # Unsupported directives may raise ValueError on Windows,


Test patch:
Repository: joke2k/faker

Issue:
Can `Jasperdr.` be deleted from `person/nl_NL`
* Faker version: v0.4.1
* OS: any

The surname 'Jasperdr.' should be removed from the nl_NL locale. It looks like its a combination of the Dutch first name 'Jasper' and the abbreviation 'dr.' (meaning Doctor, holder of an academic degree).

I'm willing to provide a pull request for this.


Discussion:
Thank you for the report! Feel free to submit your Pull Request whenever you have time :)

Resolving patch:
diff --git a/faker/providers/person/nl_NL/__init__.py b/faker/providers/person/nl_NL/__init__.py
--- a/faker/providers/person/nl_NL/__init__.py
+++ b/faker/providers/person/nl_NL/__init__.py
@@ -144,7 +144,7 @@ class Provider(PersonProvider):
         'Huisman', 'Huls', 'Hulshouts', 'Hulskes', 'Hulst', 'Huurdeman',
         'Höning', 'Jaceps', 'Jacobi', 'Jacobs', 'Jacobs', 'Jacquot', 'Jans',
         'Jansdr', 'Janse', 'Jansen', 'Jansen', 'Jansen', 'Jansse', 'Janssen',
-        'Janssen', 'Janssens', 'Jasperdr.', 'Jdotte', 'Jeggij', 'Jekel',
+        'Janssen', 'Janssens', 'Jdotte', 'Jeggij', 'Jekel',
         'Jerusalem', 'Jochems', 'Jones', 'Jonker', 'Jonkman', 'Joosten',
         'Jorlink', 'Jorrisen', 'Jurrijens', 'Kallen', 'Kalman', 'Kamp',
         'Kamper', 'Karels', 'Kas', 'Kathagen', 'Keijser', 'Keijzer',


Test patch:
Repository: joke2k/faker

Issue:
Russian name transliteration chokes on "тов.", etc.
* Faker version: 4.16
* OS: macOS Catalina 10.15.7

When generating person names, including Russian locale, `faker.providers.person.ru_RU.translit` crashes on names that include ".". These are included in the provided Russian names.

### Steps to reproduce

```
from collections import OrderedDict

from faker import Faker
from faker.providers.person.ru_RU import translit

LOCALES = OrderedDict(
    [
        ("ru_RU", 200),
    ]
)

i18n_fake = Faker(LOCALES)
for _ in range(5000):
    i18n_fake = fake.name()
    name = translit(name)
```
### Expected behavior

It should handle the "." character when transliterating them.

### Actual behavior

It crashes with this error:

```
  File ".../faker/providers/person/ru_RU/__init__.py", line 18, in translit
    text = text.replace(letter, translit_dict[letter])
KeyError: '.'
```

### Current workaround
```
        if re.match("\\p{Cyrillic}", name):
            name = name.replace(
                ".", ""
            )  # Work around bug in faker.providers.person.ru_RU#translit
            name = translit(name)
```



Discussion:
Thank you for the report, @jeremywadsack ! Could you submit a Pull Request?

Resolving patch:
diff --git a/faker/providers/person/ru_RU/__init__.py b/faker/providers/person/ru_RU/__init__.py
--- a/faker/providers/person/ru_RU/__init__.py
+++ b/faker/providers/person/ru_RU/__init__.py
@@ -12,10 +12,10 @@ def translit(text):
       'я': 'ya', 'А': 'A', 'Б': 'B', 'В': 'V', 'Г': 'G', 'Д': 'D', 'Е': 'Ye', 'Ë': 'E', 'Ж': 'Zh', 'З': 'Z', 'И': 'I',
       'Й': 'Y', 'К': 'K', 'Л': 'L', 'М': 'M', 'Н': 'N', 'О': 'O', 'П': 'P', 'Р': 'R', 'С': 'S', 'Т': 'T', 'У': 'U',
       'Ф': 'F', 'Х': 'Kh', 'Ц': 'Ts', 'Ч': 'Ch', 'Ш': 'Sh', 'Щ': 'Shch', 'Ы': 'Y', 'Э': 'E', 'Ю': 'Yu', 'Я': 'Ya',
-      ' ': ' ', '-': '-', "'": "'",
      }
     for letter in text:
-        text = text.replace(letter, translit_dict[letter])
+        if letter.isalpha():
+            text = text.replace(letter, translit_dict[letter])
     return text
 
 


Test patch:
diff --git a/tests/providers/test_person.py b/tests/providers/test_person.py
--- a/tests/providers/test_person.py
+++ b/tests/providers/test_person.py
@@ -639,6 +639,11 @@ def test_translit(self):
         assert translit('Маяковский') == 'Mayakovskiy'
         assert translit('Петров-Водкин') == 'Petrov-Vodkin'
         assert translit('Воронцова-Дашкова') == 'Vorontsova-Dashkova'
+        assert translit('А.С.Пушкин') == 'A.S.Pushkin'
+        assert translit('А. С. Пушкин') == 'A. S. Pushkin'
+        assert translit('тов. И.И.Сидоров') == 'tov. I.I.Sidorov'
+        assert translit('г-н А.Б.Петров') == 'g-n A.B.Petrov'
+        assert translit('г-жа Ю.М.Петрова') == 'g-zha Yu.M.Petrova'
 
     def test_name_female(self):
         first_name = self.fake.first_name_female()
Repository: joke2k/faker

Issue:
pytuple can occassionally return fewer than expected elements
* Faker version: 6.1.1
* OS: Mac OSX 10.15.5

Sporadically using pytuple may result in the tuple having less than the requested elements (`nb_elements`) even when `variable_nb_elements` is set to False.

This happens because pytuple relies on pyset, returning `tuple(self.pyset(...))`. Because it delegates to a set rather than a list, any duplicate numbers generated will result in the set, and following that the tuple, having fewer numbers than expected.

Suggest that the appropriate fix might be to use `pylist` instead of `pyset`

### Steps to reproduce

1. Specify `nb_elements = 3` in a call to pytuple, `variable_nb_elements= False`
2. Repeat until the tuple 'randomly' contains less than 3 elements  

```python
import faker

fake = faker.Faker()

for x in range(10000):
    random_tuple = fake.pytuple(nb_elements=3, variable_nb_elements=False, value_types=[int])
    assert len(random_tuple) == 3, f"Tuple {random_tuple} not len 3 at iteration {x}"
```

### Expected behavior

When calling pytuple with `nb_elements = 3` and `variable_nb_elements = False` the tuple should always contain 3 elements, even if there are duplicate values.

### Actual behavior

Sporadically the tuple contains less than 3 elements.



Discussion:

Resolving patch:
diff --git a/faker/providers/python/__init__.py b/faker/providers/python/__init__.py
--- a/faker/providers/python/__init__.py
+++ b/faker/providers/python/__init__.py
@@ -123,7 +123,7 @@ def pydecimal(self, left_digits=None, right_digits=None, positive=False,
 
     def pytuple(self, nb_elements=10, variable_nb_elements=True, value_types=None, *allowed_types):
         return tuple(
-            self.pyset(
+            self._pyiterable(
                 nb_elements,
                 variable_nb_elements,
                 value_types,


Test patch:
diff --git a/tests/providers/test_python.py b/tests/providers/test_python.py
--- a/tests/providers/test_python.py
+++ b/tests/providers/test_python.py
@@ -195,6 +195,21 @@ def py_str(self):
         with self.assertRaises(AssertionError):
             self.factory.pystr(min_chars=5, max_chars=5)
 
+    def test_pytuple(self):
+        with warnings.catch_warnings(record=True) as w:
+            some_tuple = Faker().pytuple()
+            assert len(w) == 0
+        assert some_tuple
+        assert isinstance(some_tuple, tuple)
+
+    def test_pytuple_size(self):
+        def mock_pyint(self, *args, **kwargs):
+            return 1
+
+        with patch('faker.providers.python.Provider.pyint', mock_pyint):
+            some_tuple = Faker().pytuple(nb_elements=3, variable_nb_elements=False, value_types=[int])
+            assert some_tuple == (1, 1, 1)
+
     def test_pylist(self):
         with warnings.catch_warnings(record=True) as w:
             some_list = self.factory.pylist()
Repository: joke2k/faker

Issue:
Faker adds path objects to sys.path_importer_cache, breaking other packages
* Faker version: 6.6.3
* OS: Gentoo Linux

After importing `faker`, entries with `PosixPath` objects are added as keys to `sys.path_importer_cache`. However, the keys are supposed to be regular `str`s there, and the wrong type breaks software relying on `str` methods being available, e.g. astroid:

```
___________________________________________ ClassNodeTest.test_slots_added_dynamically_still_inferred ____________________________________________

self = <tests.unittest_scoped_nodes.ClassNodeTest testMethod=test_slots_added_dynamically_still_inferred>

    def tearDown(self):
        del sys.path[0]
        datadir = find("")
        for key in list(sys.path_importer_cache):
>           if key.startswith(datadir):
E           AttributeError: 'PosixPath' object has no attribute 'startswith'

tests/resources.py:41: AttributeError
```

Note that since Faker installs a pytest plugin, it is autoloaded by default in all programs' test suites.

### Steps to reproduce

```
import sys
import faker
print(sys.path_importer_cache)
```

### Expected behavior

The printed dict should only contain `str` keys.

### Actual behavior

```
[...] PosixPath('/usr/lib/python3.9/site-packages/faker/providers/address'): FileFinder(PosixPath('/usr/lib/python3.9/site-packages/faker/providers/address')), PosixPath('/usr/lib/python3.9/site-packages/faker/providers/automotive'): FileFinder(PosixPath('/usr/lib/python3.9/site-packages/faker/providers/automotive')), [...]
```



Discussion:
Thank you for the repot @mgorny ! Would you mind submitting a Pull Request?
I actually hoped you know the code better and know where these paths are added. If you can tell me that, I can try. However, I'm really short on time these days.
@mgorny

I think the root of the problem is [this line](https://github.com/joke2k/faker/blob/master/faker/utils/loading.py#L25), where we're returning a `Path` objects instead of a string.

I can write the Pull Request, but I'd like for you to try my changes to see if they fix your issue.

Resolving patch:
diff --git a/faker/utils/loading.py b/faker/utils/loading.py
--- a/faker/utils/loading.py
+++ b/faker/utils/loading.py
@@ -22,7 +22,7 @@ def get_path(module: ModuleType) -> str:
     else:
         # unfrozen
         path = Path(module.__file__).parent
-    return path
+    return str(path)
 
 
 def list_module(module: ModuleType) -> List[str]:


Test patch: