Skip to content
This repository was archived by the owner on Jan 1, 2026. It is now read-only.

Commit 99ca1fb

Browse files
committed
Add talks examples for Forth Day 2024
1 parent 2be39d4 commit 99ca1fb

13 files changed

Lines changed: 127 additions & 25 deletions

File tree

forthic-py/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ readme = "README.md"
1010
version = "4.0.0"
1111
description = "A stack-based language for concisely building tweakable apps"
1212
dependencies = [
13-
"urllib3",
13+
"urllib3 == 1.26.15",
1414
"pytz",
1515
"cryptography",
1616
"python-dateutil",

forthic-py/src/forthic/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from .interpreter import Interpreter
2+
from .modules.cache_module import CacheModule
3+
from .modules.org_module import OrgModule, OrgContext
4+
from .modules.jira_module import JiraModule, JiraContext

forthic-py/src/forthic/modules/jira_module.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from ..global_module import drill_for_value
1010
from collections import defaultdict
1111
from ..utils.errors import JiraError, UnauthorizedError
12+
import certifi
1213
from ..interfaces import IInterpreter
1314
from typing import List, Any, Dict, Optional
1415

@@ -954,7 +955,10 @@ def get_flags(self):
954955
class JiraContext:
955956
"""Override this and pass to PUSH-CONTEXT! in order to make Jira calls"""
956957

957-
def __init__(self):
958+
def __init__(self, host, username, password):
959+
self.host = host
960+
self.username = username
961+
self.password = password
958962
self.field_map = self.get_field_map()
959963
self.field_name_to_id = self.make_field_name_to_id()
960964
self.field_to_schema = self.make_field_schema()
@@ -1050,21 +1054,21 @@ def requests_put(self, api_url, json=None, session=None):
10501054
)
10511055
return result
10521056

1057+
# Override this to supply the path to the cert file to use. Use False to skip verification
1058+
def get_cert_verify(self):
1059+
return certifi.where()
1060+
10531061
def get_field(self):
1054-
return None
1062+
return "JIRA"
10551063

10561064
def get_host(self):
1057-
return None
1058-
1059-
# Override this to supply the path to the cert file to use. Use False to skip verification
1060-
def get_cert_verify(self):
1061-
return False
1065+
return self.host
10621066

10631067
def get_username(self):
1064-
return None
1068+
return self.username
10651069

10661070
def get_password(self):
1067-
return None
1071+
return self.password
10681072

10691073

10701074
JIRA_FORTHIC = """
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
["simple"] USE-MODULES
22

3-
: RUN 2 3 + 4 *;
3+
: RUN 2 5 + 4 *;
44
: MAIN-PAGE ["<code>" RUN >JSON "</code>"] CONCAT;

server/apps/talks/jira/config.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"forthic_version": "v3",
3+
"tags": ["coding-forthic", "cache"]
4+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
["jira" "contexts" "cache"] USE-MODULES
2+
3+
contexts.JIRA-PROD jira.PUSH-CONTEXT!
4+
5+
: JQL "resolution = null and updated > -60d";
6+
: FIELDS ["Summary" "Assignee" "Status"];
7+
: TICKETS JQL FIELDS jira.SEARCH;
8+
9+
TICKETS
10+
# TICKETS "Assignee" GROUP-BY-FIELD "LENGTH" MAP "tickets" cache.CACHE!
11+

server/apps/talks/map/config.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"forthic_version": "v3",
3+
"tags": ["coding-forthic", "cache"]
4+
}

server/apps/talks/map/main.forthic

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[1 2 3] "3 *" MAP
2+
3+
# [
4+
# ["alpha" 1]
5+
# ["beta" 2]
6+
# ["gamma" 3]
7+
# ] REC "3 *" MAP
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"forthic_version": "v3",
3+
"tags": ["coding-forthic", "cache"]
4+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
: VAL 2 5 + 4 *;
2+
[VAL 1 2 3] "3 *" MAP

0 commit comments

Comments
 (0)