Skip to content

Commit ce8812d

Browse files
committed
Merge branch 'master' of github.com:i2mint/rh
2 parents 89319ca + f7bfd18 commit ce8812d

File tree

13 files changed

+68
-67
lines changed

13 files changed

+68
-67
lines changed

misc/wip/debug_app.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,14 @@ def debug_temperature_converter():
9898
if head_start != -1:
9999
head_section = html_content[head_start:head_end]
100100
print("\n 📋 HEAD Section (CDN links):")
101-
lines = head_section.split('\n')
101+
lines = head_section.split("\n")
102102
for line in lines:
103-
if 'src=' in line or 'href=' in line:
103+
if "src=" in line or "href=" in line:
104104
print(f" {line.strip()}")
105105

106106
# Extract script sections
107107
print("\n 📋 JavaScript Sections:")
108-
script_count = html_content.count('<script>')
108+
script_count = html_content.count("<script>")
109109
print(f" Found {script_count} script tags")
110110

111111
# Show the first few lines of the form initialization

misc/wip/debug_forms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def create_debug_version():
7878
"""
7979

8080
# Insert debug script before </body>
81-
debug_html = html_content.replace('</body>', debug_js + '\n</body>')
81+
debug_html = html_content.replace("</body>", debug_js + "\n</body>")
8282

8383
# Write debug version
8484
debug_path = app_path.parent / "debug_index.html"

misc/wip/demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def demo_temperature_converter():
5656
# Show a snippet of the generated HTML
5757
html_content = app_path.read_text()
5858
print("🔍 HTML Preview:")
59-
lines = html_content.split('\n')
59+
lines = html_content.split("\n")
6060
for i, line in enumerate(lines[:10]):
6161
print(f" {i+1:2d}: {line}")
6262
print(" ...")

misc/wip/manual_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def main():
9999
import json
100100

101101
config_match = re.search(
102-
r'const meshConfig = ({.*?});', html_content, re.DOTALL
102+
r"const meshConfig = ({.*?});", html_content, re.DOTALL
103103
)
104104
if config_match:
105105
config_obj = json.loads(config_match.group(1))
@@ -108,7 +108,7 @@ def main():
108108
print(f" Reverse: {config_obj['reverseMesh']}")
109109

110110
form_config_match = re.search(
111-
r'const formConfig = ({.*?});', html_content, re.DOTALL
111+
r"const formConfig = ({.*?});", html_content, re.DOTALL
112112
)
113113
if form_config_match:
114114
form_obj = json.loads(form_config_match.group(1))

misc/wip/test_app_directory.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ def test_app_directory_naming():
1818
# Test app name inference from title
1919
with tempfile.TemporaryDirectory() as tmpdir:
2020
# Override environment variable for this test
21-
original_env = os.environ.get('RH_APP_FOLDER')
22-
os.environ['RH_APP_FOLDER'] = tmpdir
21+
original_env = os.environ.get("RH_APP_FOLDER")
22+
os.environ["RH_APP_FOLDER"] = tmpdir
2323

2424
try:
2525
# Clear any cached imports
@@ -50,9 +50,9 @@ def test_app_directory_naming():
5050
finally:
5151
# Restore original environment
5252
if original_env is not None:
53-
os.environ['RH_APP_FOLDER'] = original_env
54-
elif 'RH_APP_FOLDER' in os.environ:
55-
del os.environ['RH_APP_FOLDER']
53+
os.environ["RH_APP_FOLDER"] = original_env
54+
elif "RH_APP_FOLDER" in os.environ:
55+
del os.environ["RH_APP_FOLDER"]
5656

5757
# Reload to reset to original state
5858
importlib.reload(rh.util)

rh/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88

99
from .core import MeshBuilder
1010

11-
__all__ = ['MeshBuilder']
11+
__all__ = ["MeshBuilder"]

rh/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def _generate_ui_schema(self) -> Dict[str, Any]:
139139
{
140140
k: v
141141
for k, v in self.field_overrides[var_name].items()
142-
if k.startswith('ui:')
142+
if k.startswith("ui:")
143143
}
144144
)
145145

@@ -202,7 +202,7 @@ def _resolve_functions(self) -> str:
202202
js_functions = []
203203
for name, code in self.functions_spec.items():
204204
# For inline functions, wrap in function syntax
205-
if isinstance(code, str) and not code.strip().startswith('function'):
205+
if isinstance(code, str) and not code.strip().startswith("function"):
206206
args = self.mesh.get(name, [])
207207
func_code = f"function({', '.join(args)}) {{ {code} }}"
208208
else:

rh/generators/html.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def _generate_base_html(
4646
app_initialization: str,
4747
) -> str:
4848
"""Generate the base HTML template with all components."""
49-
return f'''<!DOCTYPE html>
49+
return f"""<!DOCTYPE html>
5050
<html lang="en">
5151
<head>
5252
<meta charset="UTF-8">
@@ -176,11 +176,11 @@ def _generate_base_html(
176176
{app_initialization}
177177
</script>
178178
</body>
179-
</html>'''
179+
</html>"""
180180

181181
def _generate_mesh_propagator_js(self, mesh_config_js: str) -> str:
182182
"""Generate the mesh propagator JavaScript class."""
183-
return f'''class MeshPropagator {{
183+
return f"""class MeshPropagator {{
184184
constructor(mesh, functions, reverseMesh) {{
185185
this.mesh = mesh;
186186
this.functions = functions;
@@ -250,7 +250,7 @@ def _generate_mesh_propagator_js(self, mesh_config_js: str) -> str:
250250
meshConfig.mesh,
251251
meshFunctions,
252252
meshConfig.reverseMesh
253-
);'''
253+
);"""
254254

255255
def _generate_app_initialization(self, config: Dict[str, Any]) -> str:
256256
"""Generate the main app initialization JavaScript."""
@@ -260,7 +260,7 @@ def _generate_app_initialization(self, config: Dict[str, Any]) -> str:
260260
"formData": config["initial_values"],
261261
}
262262

263-
return f'''// Initialize form with fallback support
263+
return f"""// Initialize form with fallback support
264264
console.log("Starting app initialization...");
265265
266266
// Check if all dependencies are loaded
@@ -407,4 +407,4 @@ def _generate_app_initialization(self, config: Dict[str, Any]) -> str:
407407
console.error("Error in app initialization:", error);
408408
document.getElementById('rjsf-form').innerHTML =
409409
'<div class="alert alert-danger">App initialization failed: ' + error.message + '</div>';
410-
}}'''
410+
}}"""

rh/templates/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
"""Templates directory marker"""
2+
23
# Templates directory marker

rh/tests/test_app_directory.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ def test_app_directory_naming():
1818
# Test app name inference from title
1919
with tempfile.TemporaryDirectory() as tmpdir:
2020
# Override environment variable for this test
21-
original_env = os.environ.get('RH_APP_FOLDER')
22-
os.environ['RH_APP_FOLDER'] = tmpdir
21+
original_env = os.environ.get("RH_APP_FOLDER")
22+
os.environ["RH_APP_FOLDER"] = tmpdir
2323

2424
try:
2525
# Reload util to pick up env change
@@ -50,9 +50,9 @@ def test_app_directory_naming():
5050
finally:
5151
# Restore original environment
5252
if original_env is not None:
53-
os.environ['RH_APP_FOLDER'] = original_env
54-
elif 'RH_APP_FOLDER' in os.environ:
55-
del os.environ['RH_APP_FOLDER']
53+
os.environ["RH_APP_FOLDER"] = original_env
54+
elif "RH_APP_FOLDER" in os.environ:
55+
del os.environ["RH_APP_FOLDER"]
5656

5757
# Reload to reset to original state
5858
importlib.reload(rh.util)

0 commit comments

Comments
 (0)