Repository: joke2k/faker

Issue:
flake8 job for tox fails with "C417 Unnecessary use of map"
* Faker version: 15.3.3
* OS: Ubuntu 22.04

When running checks locally with tox, the `flake8` job fails with multiple instances of  "C417 Unnecessary use of map". This warning is emitted by the flake8-comprehensions plugin, see [here](https://github.com/adamchainz/flake8-comprehensions#c417-unnecessary-map-usage---rewrite-using-a-generator-expressionlistsetdict-comprehension) for details.

### Steps to reproduce

1. Clone this repo or its fork to your machine, install tox if necessary 
2. Run `tox -e flake8`

### Expected behavior

```
  flake8: commands succeeded
  congratulations :)
```

### Actual behavior

```
faker/providers/geo/el_GR/__init__.py:20:21: C417 Unnecessary use of map - use a list comprehension instead.
faker/providers/geo/el_GR/__init__.py:26:22: C417 Unnecessary use of map - use a list comprehension instead.
faker/providers/internet/__init__.py:595:25: C417 Unnecessary use of map - use a generator expression instead.
faker/providers/internet/el_GR/__init__.py:71:17: C417 Unnecessary use of map - use a generator expression instead.
tests/providers/test_person.py:214:20: C417 Unnecessary use of map - use a generator expression instead.
tests/providers/test_person.py:219:20: C417 Unnecessary use of map - use a generator expression instead.
tests/providers/test_person.py:224:20: C417 Unnecessary use of map - use a generator expression instead.
tests/providers/test_person.py:229:20: C417 Unnecessary use of map - use a generator expression instead.
...
ERROR:   flake8: commands failed
```



Discussion:

Resolving patch:
diff --git a/faker/providers/geo/el_GR/__init__.py b/faker/providers/geo/el_GR/__init__.py
--- a/faker/providers/geo/el_GR/__init__.py
+++ b/faker/providers/geo/el_GR/__init__.py
@@ -17,13 +17,13 @@ def local_latlng(self, *args: Any, **kwargs: Any) -> Tuple[str, str]:
         return str(self.local_latitude()), str(self.local_longitude())
 
     def local_latitude(self) -> Decimal:
-        latitudes = list(map(lambda t: int(Decimal(t[0]) * 10000000), self.poly))
+        latitudes = [int(Decimal(t[0]) * 10000000) for t in self.poly]
         return Decimal(str(self.generator.random.randint(min(latitudes), max(latitudes)) / 10000000)).quantize(
             Decimal(".000001")
         )
 
     def local_longitude(self) -> Decimal:
-        longitudes = list(map(lambda t: int(Decimal(t[1]) * 10000000), self.poly))
+        longitudes = [int(Decimal(t[1]) * 10000000) for t in self.poly]
         return Decimal(str(self.generator.random.randint(min(longitudes), max(longitudes)) / 10000000)).quantize(
             Decimal(".000001")
         )
diff --git a/faker/providers/internet/__init__.py b/faker/providers/internet/__init__.py
--- a/faker/providers/internet/__init__.py
+++ b/faker/providers/internet/__init__.py
@@ -592,7 +592,7 @@ def ipv6(self, network: bool = False) -> str:
 
     def mac_address(self) -> str:
         mac = [self.generator.random.randint(0x00, 0xFF) for _ in range(0, 6)]
-        return ":".join(map(lambda x: "%02x" % x, mac))
+        return ":".join("%02x" % x for x in mac)
 
     def port_number(self, is_system: bool = False, is_user: bool = False, is_dynamic: bool = False) -> int:
         """Returns a network port number
diff --git a/faker/providers/internet/el_GR/__init__.py b/faker/providers/internet/el_GR/__init__.py
--- a/faker/providers/internet/el_GR/__init__.py
+++ b/faker/providers/internet/el_GR/__init__.py
@@ -68,7 +68,7 @@ def replace_double_character(match):
 
     def replace_greek_character(match):
         matched = list(match.group(0))
-        value = map(lambda l: replace[search.find(l)], matched)
+        value = (replace[search.find(char)] for char in matched)
         return "".join(value)
 
     return re.sub(


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
@@ -211,22 +211,22 @@ def test_person(self):
         first_name_pair = self.fake.first_name_pair()
         assert first_name_pair
         assert len(first_name_pair) == 3
-        assert all(map(lambda s: isinstance(s, str), first_name_pair))
+        assert all(isinstance(s, str) for s in first_name_pair)
 
         first_name_male_pair = self.fake.first_name_male_pair()
         assert first_name_male_pair
         assert len(first_name_male_pair) == 3
-        assert all(map(lambda s: isinstance(s, str), first_name_male_pair))
+        assert all(isinstance(s, str) for s in first_name_male_pair)
 
         first_name_female_pair = self.fake.first_name_female_pair()
         assert first_name_female_pair
         assert len(first_name_female_pair) == 3
-        assert all(map(lambda s: isinstance(s, str), first_name_female_pair))
+        assert all(isinstance(s, str) for s in first_name_female_pair)
 
         last_name_pair = self.fake.last_name_pair()
         assert last_name_pair
         assert len(last_name_pair) == 3
-        assert all(map(lambda s: isinstance(s, str), last_name_pair))
+        assert all(isinstance(s, str) for s in last_name_pair)
 
 
 class TestNeNP(unittest.TestCase):