Skip to content

Commit 207cf19

Browse files
committed
variable name and docstring cleanup
1 parent 6238383 commit 207cf19

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/reactpy_django/forms/transforms.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,14 @@ def infer_key_from_attributes(vdom_tree: VdomDict) -> VdomDict:
7474
attributes = vdom_tree.get("attributes", {})
7575

7676
# Infer 'key' from 'id'
77-
_id = attributes.get("id")
77+
key = attributes.get("id")
7878

7979
# Fallback: Infer 'key' from 'name'
80-
if not _id and vdom_tree["tagName"] in {"input", "select", "textarea"}:
81-
_id = attributes.get("name")
80+
if not key and vdom_tree["tagName"] in {"input", "select", "textarea"}:
81+
key = attributes.get("name")
8282

83-
if _id:
84-
vdom_tree["key"] = _id
83+
if key:
84+
vdom_tree["key"] = key
8585

8686
return vdom_tree
8787

@@ -479,7 +479,8 @@ def _do_nothing_event(*args, **kwargs):
479479
+ SCRIPT_PROPS
480480
)
481481

482-
# lowercase the prop name as the key, and have values be the original react prop name
482+
# Old Prop (Key) : New Prop (Value)
483+
# Also includes some special cases like 'class' -> 'className'
483484
REACT_PROP_SUBSTITUTIONS = {prop.lower(): prop for prop in KNOWN_REACT_PROPS} | {
484485
"for": "htmlFor",
485486
"class": "className",

src/reactpy_django/utils.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Generic functions that are used throughout the ReactPy Django package."""
2+
13
from __future__ import annotations
24

35
import contextlib

0 commit comments

Comments
 (0)