diff --git a/pynecone/el/constants/pynecone.py b/pynecone/el/constants/pynecone.py index 90e158864..bc3ba4c4e 100644 --- a/pynecone/el/constants/pynecone.py +++ b/pynecone/el/constants/pynecone.py @@ -2,7 +2,7 @@ from collections import defaultdict -from pynecone.utils import to_snake_case +from pynecone.utils import format from .html import ATTR_TO_ELEMENTS from .react import POSSIBLE_STANDARD_NAMES @@ -29,7 +29,7 @@ def attr_to_prop(attr_name: str) -> str: """ if attr_name in ATTR_TO_PROP_OVERRIDES: return ATTR_TO_PROP_OVERRIDES[attr_name] - return to_snake_case(POSSIBLE_STANDARD_NAMES.get(attr_name, attr_name)) + return format.to_snake_case(POSSIBLE_STANDARD_NAMES.get(attr_name, attr_name)) # Names of HTML attributes that are provided by Pynecone out of the box. diff --git a/pynecone/el/element.py b/pynecone/el/element.py index 43c37a51f..849a60305 100644 --- a/pynecone/el/element.py +++ b/pynecone/el/element.py @@ -1,7 +1,7 @@ """Base class definition for raw HTML elements.""" -from pynecone import utils from pynecone.components.component import Component +from pynecone.utils import path_ops class Element(Component): @@ -27,7 +27,7 @@ class Element(Component): style=self.style, class_name=self.class_name, ).set( - contents=utils.join( + contents=path_ops.join( [str(tag.contents)] + [child.render() for child in self.children] ).strip(), ) diff --git a/pynecone/el/precompile.py b/pynecone/el/precompile.py index ca4f0546c..036eec10e 100755 --- a/pynecone/el/precompile.py +++ b/pynecone/el/precompile.py @@ -12,7 +12,7 @@ running this script. import os -from pynecone.compiler.templates import join +from pynecone.utils import path_ops from .constants import ELEMENT_TO_PROPS, ELEMENTS @@ -45,10 +45,10 @@ def compile_pyclass_props(element: str) -> str: Returns: A string containing compiled props for the element. """ - return join(PROP(prop=prop) for prop in ELEMENT_TO_PROPS[element]) + return path_ops.join(PROP(prop=prop) for prop in ELEMENT_TO_PROPS[element]) -PYCLASS = join( +PYCLASS = path_ops.join( [ "", "class {name}(Element): # noqa: E742", @@ -105,4 +105,4 @@ for element in sorted(ELEMENTS): os.makedirs(ELEMENTS_DIR, exist_ok=True) with open(INIT_PY_PATH, "w+") as f: - f.write(join(INIT_PY)) + f.write(path_ops.join(INIT_PY))