fix: VariableStore.get() default parameter and Docker improvements
- Add default parameter to VariableStore.get() method - Install nano in Docker for TUI editor support - Install dearpygui in Docker for GUI support - Add GUI library dependencies (libgl1, libegl1, etc.) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
a39103c2ca
commit
c592b93597
15
Dockerfile
15
Dockerfile
|
|
@ -38,6 +38,18 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
curl \
|
curl \
|
||||||
plantuml \
|
plantuml \
|
||||||
jq \
|
jq \
|
||||||
|
nano \
|
||||||
|
# GUI dependencies for dearpygui
|
||||||
|
libgl1 \
|
||||||
|
libegl1 \
|
||||||
|
libxkbcommon0 \
|
||||||
|
libxcb-cursor0 \
|
||||||
|
libxcb-icccm4 \
|
||||||
|
libxcb-keysyms1 \
|
||||||
|
libxcb-shape0 \
|
||||||
|
libxcb-xinerama0 \
|
||||||
|
libxcb-randr0 \
|
||||||
|
libxcb-render-util0 \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
@ -59,6 +71,9 @@ COPY tests/ ./tests/
|
||||||
# Install Orchestrated Discussions
|
# Install Orchestrated Discussions
|
||||||
RUN pip install --no-cache-dir -e ".[dev]"
|
RUN pip install --no-cache-dir -e ".[dev]"
|
||||||
|
|
||||||
|
# Install dearpygui for GUI (optional, may fail on some systems)
|
||||||
|
RUN pip install --no-cache-dir dearpygui || echo "dearpygui install failed, GUI will use TUI fallback"
|
||||||
|
|
||||||
# Create directories
|
# Create directories
|
||||||
RUN mkdir -p /root/.smarttools /root/.local/bin
|
RUN mkdir -p /root/.smarttools /root/.local/bin
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -246,12 +246,16 @@ class VariableStore:
|
||||||
else:
|
else:
|
||||||
self._store[name] = value
|
self._store[name] = value
|
||||||
|
|
||||||
def get(self, ref: str):
|
def get(self, ref: str, default=None):
|
||||||
"""
|
"""
|
||||||
Get a variable value. Ref can be:
|
Get a variable value. Ref can be:
|
||||||
- $varname - simple lookup
|
- $varname - simple lookup
|
||||||
- $varname.field - JSON field access
|
- $varname.field - JSON field access
|
||||||
- $varname.field.subfield - nested access
|
- $varname.field.subfield - nested access
|
||||||
|
|
||||||
|
Args:
|
||||||
|
ref: Variable reference (e.g., "$varname" or "$varname.field")
|
||||||
|
default: Default value if variable not found
|
||||||
"""
|
"""
|
||||||
if not ref.startswith("$"):
|
if not ref.startswith("$"):
|
||||||
return ref # Literal value
|
return ref # Literal value
|
||||||
|
|
@ -261,7 +265,7 @@ class VariableStore:
|
||||||
|
|
||||||
value = self._store.get(parts[0])
|
value = self._store.get(parts[0])
|
||||||
if value is None:
|
if value is None:
|
||||||
return None
|
return default
|
||||||
|
|
||||||
# Navigate nested fields
|
# Navigate nested fields
|
||||||
for part in parts[1:]:
|
for part in parts[1:]:
|
||||||
|
|
@ -271,9 +275,9 @@ class VariableStore:
|
||||||
idx = int(part)
|
idx = int(part)
|
||||||
value = value[idx] if idx < len(value) else None
|
value = value[idx] if idx < len(value) else None
|
||||||
else:
|
else:
|
||||||
return None
|
return default
|
||||||
if value is None:
|
if value is None:
|
||||||
return None
|
return default
|
||||||
|
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue