Skip to content

Commit c9dcca1

Browse files
Lkruitwagendanthedeckie
authored andcommitted
delint and add contib to README
1 parent 4835603 commit c9dcca1

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Diff for: simpleeval.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
- edgarrmondragon (Edgar Ramírez-Mondragón) Address Python 3.12+ deprecation warnings
6363
- cedk (Cédric Krier) <ced@b2ck.com> Allow running tests with Werror
6464
- decorator-factory <decorator-factory@protonmail.com> More security fixes
65+
- lkruitwagen (Lucas Kruitwagen) Adding support for dict comprehensions
6566
6667
-------------------------------------
6768
Basic Usage:
@@ -700,7 +701,6 @@ def _eval_set(self, node):
700701
return set(self._eval(x) for x in node.elts)
701702

702703
def _eval_comprehension(self, node):
703-
704704
if isinstance(node, ast.DictComp):
705705
to_return = {}
706706
else:

Diff for: test_simpleeval.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -730,22 +730,22 @@ def test_nested_unpack(self):
730730
self.t("[a+b+c for a, (b, c) in ((1,(1,1)),(3,(2,2)))]", [3, 7])
731731

732732
def test_dictcomp_basic(self):
733-
self.t("{a:a + 1 for a in [1,2,3]}", {1:2, 2:3, 3:4})
733+
self.t("{a:a + 1 for a in [1,2,3]}", {1: 2, 2: 3, 3: 4})
734734

735735
def test_dictcomp_with_self_reference(self):
736-
self.t("{a:a + a for a in [1,2,3]}", {1:2, 2:4, 3:6})
736+
self.t("{a:a + a for a in [1,2,3]}", {1: 2, 2: 4, 3: 6})
737737

738738
def test_dictcomp_with_if(self):
739-
self.t("{a:a for a in [1,2,3,4,5] if a <= 3}", {1:1, 2:2, 3:3})
739+
self.t("{a:a for a in [1,2,3,4,5] if a <= 3}", {1: 1, 2: 2, 3: 3})
740740

741741
def test_dictcomp_with_multiple_if(self):
742-
self.t("{a:a for a in [1,2,3,4,5] if a <= 3 and a > 1 }", {2:2, 3:3})
742+
self.t("{a:a for a in [1,2,3,4,5] if a <= 3 and a > 1 }", {2: 2, 3: 3})
743743

744744
def test_dictcomp_unpack(self):
745-
self.t("{a:a+b for a,b in ((1,2),(3,4))}", {1:3, 3:7})
745+
self.t("{a:a+b for a,b in ((1,2),(3,4))}", {1: 3, 3: 7})
746746

747747
def test_dictcomp_nested_unpack(self):
748-
self.t("{a:a+b+c for a, (b, c) in ((1,(1,1)),(3,(2,2)))}", {1:3, 3:7})
748+
self.t("{a:a+b+c for a, (b, c) in ((1,(1,1)),(3,(2,2)))}", {1: 3, 3: 7})
749749

750750
def test_other_places(self):
751751
self.s.functions = {"sum": sum}

0 commit comments

Comments
 (0)