Skip to content

Commit 92f816d

Browse files
committed
fix: correct probability spelling
1 parent 076a343 commit 92f816d

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,4 +147,4 @@
147147

148148
### Fix
149149

150-
- changed propabilities to generate more expressions
150+
- changed probabilities to generate more expressions

src/pysource_codegen/_codegen.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,14 @@ class Invalid(Exception):
183183
pass
184184

185185

186-
def propability(parents, child_name):
186+
def probability(parents, child_name):
187187
try:
188-
return propability_try(parents, child_name)
188+
return probability_try(parents, child_name)
189189
except Invalid:
190190
return 0
191191

192192

193-
def propability_try(parents, child_name):
193+
def probability_try(parents, child_name):
194194
parent_types = [p[0] for p in parents]
195195

196196
def inside(types, not_types=()):
@@ -1010,7 +1010,7 @@ def is_valid(node: ast.AST, parents):
10101010
if (
10111011
isinstance(node, (ast.AST))
10121012
and parents
1013-
and propability(
1013+
and probability(
10141014
parents,
10151015
type_name,
10161016
)
@@ -1021,7 +1021,7 @@ def is_valid(node: ast.AST, parents):
10211021
print("node:", node)
10221022

10231023
try:
1024-
propability_try(
1024+
probability_try(
10251025
parents,
10261026
node.__class__.__name__,
10271027
)
@@ -1560,7 +1560,7 @@ def child_node(n, t, q, parents):
15601560

15611561
if isinstance(info, UnionNodeType):
15621562
options_list = [
1563-
(option, propability(parents, option)) for option in info.options
1563+
(option, probability(parents, option)) for option in info.options
15641564
]
15651565

15661566
invalid_option = [
@@ -1663,11 +1663,11 @@ def generate(
16631663

16641664
# design targets:
16651665
# * enumerate "all" possible ast-node combinations
1666-
# * check if propability 0 would produce incorrect code
1666+
# * check if probability 0 would produce incorrect code
16671667
# * the algo should be able to generate every possible syntax combination for every python version.
16681668
# * hypothesis integration
16691669
# * do not use compile() in the implementation
1670-
# * generation should be customizable (custom propabilities and random values)
1670+
# * generation should be customizable (custom probabilities and random values)
16711671

16721672
# features:
16731673
# * node-context: function-scope async-scope type-scope class-scope ...

0 commit comments

Comments
 (0)