FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-sdk/scripts/gen_meta.py at package-scripts · openSUSE-Python/python-sdk · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
openSUSE-Python
/
python-sdk
Public
forked from
agentclientprotocol/python-sdk
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-sdk
/
scripts
/
gen_meta.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
43 lines (33 loc) · 1.17 KB
Breadcrumbs
python-sdk
/
scripts
/
gen_meta.py
Copy path
File metadata and controls
43 lines (33 loc) · 1.17 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env python3
from
__future__
import
annotations
import
json
from
pathlib
import
Path
ROOT
=
Path
(
__file__
).
resolve
().
parents
[
1
]
SCHEMA_DIR
=
ROOT
/
"schema"
VERSION_FILE
=
SCHEMA_DIR
/
"VERSION"
def
main
()
->
None
:
generate_meta
()
def
generate_meta
()
->
None
:
meta_json
=
SCHEMA_DIR
/
"meta.json"
out_py
=
ROOT
/
"src"
/
"acp"
/
"meta.py"
if
not
meta_json
.
exists
():
raise
SystemExit
(
"schema/meta.json not found. Run gen_schema.py first."
)
data
=
json
.
loads
(
meta_json
.
read_text
(
"utf-8"
))
agent_methods
=
data
.
get
(
"agentMethods"
, {})
client_methods
=
data
.
get
(
"clientMethods"
, {})
version
=
data
.
get
(
"version"
,
1
)
header_lines
=
[
"# Generated from schema/meta.json. Do not edit by hand."
]
if
VERSION_FILE
.
exists
():
ref
=
VERSION_FILE
.
read_text
(
"utf-8"
).
strip
()
if
ref
:
header_lines
.
append
(
f"# Schema ref:
{
ref
}
"
)
out_py
.
write_text
(
"
\n
"
.
join
(
header_lines
)
+
"
\n
"
+
f"AGENT_METHODS =
{
agent_methods
!r
}
\n
"
+
f"CLIENT_METHODS =
{
client_methods
!r
}
\n
"
+
f"PROTOCOL_VERSION =
{
int
(
version
)
}
\n
"
,
encoding
=
"utf-8"
,
)
if
__name__
==
"__main__"
:
main
()
Back
|
FazBrowse Home
|
New Git URL