Skip to content

Commit

Permalink
cleanup: use extism.output in example
Browse files Browse the repository at this point in the history
  • Loading branch information
zshipko committed Oct 16, 2024
1 parent 113da4d commit ce41044
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion examples/count-vowels.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import extism
import json
from dataclasses import dataclass

@dataclass
class Count(extism.Json):
count: int

@extism.plugin_fn
def count_vowels():
Expand All @@ -9,5 +14,5 @@ def count_vowels():
if ch in ['A', 'a', 'E', 'e', 'I', 'i', 'O', 'o', 'U', 'u']:
total += 1
extism.log(extism.LogLevel.Info, "Hello!")
extism.output_json({"count": total})
extism.output(Count(total))

0 comments on commit ce41044

Please sign in to comment.