Skip to content

Commit ef484ed

Browse files
author
Tom Softreck
committed
update
1 parent 0edacf5 commit ef484ed

File tree

3 files changed

+26
-14
lines changed

3 files changed

+26
-14
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
44

55
[project]
66
name = "dialogchain"
7-
version = "0.1.6"
7+
version = "0.1.7"
88
description = "DialogChain - A flexible and extensible dialog processing framework"
99
authors = [
1010
{name = "DialogChain Team", email = "team@dialogchain.org"},

src/dialogchain/cli.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ def run(config, env_file, route, dry_run, verbose):
5959
click.echo(f"❌ Error: {e}", err=True)
6060

6161

62-
@cli.command()
63-
@click.option('--template', '-t', type=click.Choice(['camera', 'grpc', 'email', 'full']),
64-
default='camera', help='Template type to generate')
65-
@click.option('--output', '-o', default='routes.yaml', help='Output file name')
6662
def update_env_file(env_path, required_vars):
6763
"""Update .env file with missing variables."""
6864
env_path = Path(env_path)

src/dialogchain/connectors.py

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,31 @@ async def receive(self) -> AsyncIterator[Dict[str, Any]]:
100100
await asyncio.sleep(self.interval)
101101

102102
def _parse_interval(self, interval_str: str) -> float:
103-
"""Parse interval string to seconds"""
104-
if interval_str.endswith('s'):
105-
return float(interval_str[:-1])
106-
elif interval_str.endswith('m'):
107-
return float(interval_str[:-1]) * 60
108-
elif interval_str.endswith('h'):
109-
return float(interval_str[:-1]) * 3600
110-
else:
111-
return float(interval_str)
103+
"""Parse interval string to seconds
104+
105+
Args:
106+
interval_str: String in format '1s' (seconds), '1m' (minutes), or '1h' (hours)
107+
108+
Returns:
109+
float: Interval in seconds
110+
111+
Raises:
112+
ValueError: If interval_str is empty or invalid
113+
"""
114+
if not interval_str or not isinstance(interval_str, str):
115+
raise ValueError(f"Invalid interval: '{interval_str}'. Must be a non-empty string.")
116+
117+
try:
118+
if interval_str.endswith('s'):
119+
return float(interval_str[:-1])
120+
elif interval_str.endswith('m'):
121+
return float(interval_str[:-1]) * 60
122+
elif interval_str.endswith('h'):
123+
return float(interval_str[:-1]) * 3600
124+
else:
125+
return float(interval_str)
126+
except (ValueError, TypeError) as e:
127+
raise ValueError(f"Invalid interval format: '{interval_str}'. Expected format: '1s', '1m', or '1h'.") from e
112128

113129

114130
class GRPCSource(Source):

0 commit comments

Comments
 (0)