Skip to content

Feature/update grip structs #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 137 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
.DS_Store# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# IDE
.idea/

# scratch
tmp/
.DS_Store
gencli
23 changes: 13 additions & 10 deletions cmd/gen_dir/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"
"strings"

"github.com/bmeg/grip/gripql"
"github.com/bmeg/jsonschemagraph/graph"
"github.com/bmeg/jsonschemagraph/util"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -124,19 +125,21 @@ var Cmd = &cobra.Command{
}

var IedgeInit, VertexInit, OedegeInit = true, true, true
jum := gripql.NewFlattenMarshaler()
for line := range procChan {
if result, err := out.Generate(ClassName, line, false, mapstringArgs); err == nil {
for _, lin := range result {
if b, err := json.Marshal(lin.Edge); err == nil {
IedgeInit = util.Write_line(IedgeInit, b, InEdge_file, InEdge_gzWriter)
}
if b, err := json.Marshal(lin.Edge); err == nil {
OedegeInit = util.Write_line(OedegeInit, b, OutEdege_file, OutEdge_gzWriter)

}
if b, err := json.Marshal(lin.Vertex); err == nil {
VertexInit = util.Write_line(VertexInit, b, vertex_file, Vertex_gzwriter)

if lin.Edge != nil {
if b, err := jum.Marshal(lin.Edge); err == nil {
IedgeInit = util.Write_line(IedgeInit, b, InEdge_file, InEdge_gzWriter)
}
if b, err := jum.Marshal(lin.Edge); err == nil {
OedegeInit = util.Write_line(OedegeInit, b, OutEdege_file, OutEdge_gzWriter)
}
} else if lin.Vertex != nil {
if b, err := jum.Marshal(lin.Vertex); err == nil {
VertexInit = util.Write_line(VertexInit, b, vertex_file, Vertex_gzwriter)
}
}
}
} else if err != nil {
Expand Down
22 changes: 13 additions & 9 deletions cmd/gen_graph/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"
"strings"

"github.com/bmeg/grip/gripql"
"github.com/bmeg/jsonschemagraph/graph"
"github.com/bmeg/jsonschemagraph/util"

Expand Down Expand Up @@ -119,18 +120,21 @@ var Cmd = &cobra.Command{
}

var IedgeInit, VertexInit, OedegeInit = true, true, true

jum := gripql.NewFlattenMarshaler()
for line := range procChan {
if result, err := out.Generate(args[3], line, false, mapstringArgs); err == nil {
for _, lin := range result {
if b, err := json.Marshal(lin.Edge); err == nil {
IedgeInit = util.Write_line(IedgeInit, b, InEdge_file, InEdge_gzWriter)
}
if b, err := json.Marshal(lin.Edge); err == nil {
OedegeInit = util.Write_line(OedegeInit, b, OutEdege_file, OutEdge_gzWriter)
}
if b, err := json.Marshal(lin.Vertex); err == nil {
VertexInit = util.Write_line(VertexInit, b, vertex_file, Vertex_gzwriter)
if lin.Edge != nil {
if b, err := jum.Marshal(lin.Edge); err == nil {
IedgeInit = util.Write_line(IedgeInit, b, InEdge_file, InEdge_gzWriter)
}
if b, err := jum.Marshal(lin.Edge); err == nil {
OedegeInit = util.Write_line(OedegeInit, b, OutEdege_file, OutEdge_gzWriter)
}
} else if lin.Vertex != nil {
if b, err := jum.Marshal(lin.Vertex); err == nil {
VertexInit = util.Write_line(VertexInit, b, vertex_file, Vertex_gzwriter)
}
}
}
} else if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions cmd/gen_graphql/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package gen_graphql

import (
"fmt"
"io/ioutil"
"log"
"os"

schema "github.com/bmeg/jsonschemagraph/graphql"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -32,7 +32,7 @@ var Cmd = &cobra.Command{

config := Config{DependencyOrder: []string{}}
if configPath != "" {
data, err := ioutil.ReadFile(configPath)
data, err := os.ReadFile(configPath)
if err != nil {
log.Fatalf("Failed to read YAML file: %v", err)
}
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ toolchain go1.24.0

require (
github.com/bmeg/golib v0.0.0-20200725232156-e799a31439fc
github.com/bmeg/grip v0.0.0-20250328235822-525777e2873c
github.com/bmeg/grip v0.0.0-20250421161012-b9b392fc8721
github.com/bmeg/jsonschema/v5 v5.3.4-0.20241111204732-55db82022a92
github.com/google/uuid v1.6.0
github.com/spf13/cobra v1.8.1
Expand All @@ -31,6 +31,6 @@ require (
golang.org/x/net v0.35.0 // indirect
golang.org/x/sys v0.30.0 // indirect
golang.org/x/term v0.29.0 // indirect
google.golang.org/genproto v0.0.0-20230303212802-e74f57abe488 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
google.golang.org/grpc v1.70.0 // indirect
)
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
github.com/bmeg/golib v0.0.0-20200725232156-e799a31439fc h1:/0v/ZcXYjGs44InmjECrls31onIbVKVu1Q/E2cmnCEU=
github.com/bmeg/golib v0.0.0-20200725232156-e799a31439fc/go.mod h1:hoSeuZtqe58ANXHuWpeODx4bDHGV36QXlCs1yrUvK6M=
github.com/bmeg/grip v0.0.0-20250328235822-525777e2873c h1:QN0mMO3fEBfwskX3VMimiVQ9OWV2UNlf9zU4VNarwIQ=
github.com/bmeg/grip v0.0.0-20250328235822-525777e2873c/go.mod h1:QSP37ElaIjyvmMZf+F1z3ZkfGWcVuFjoaujZiqhMyts=
github.com/bmeg/grip v0.0.0-20250421161012-b9b392fc8721 h1:roEYW8/n2JHUWgIvF0d/o4N8xpK01FKLenVSwret5po=
github.com/bmeg/grip v0.0.0-20250421161012-b9b392fc8721/go.mod h1:HZ9XI515z+VZe2YbBocZZHIswWLAJKj5mPDW7r38vyM=
github.com/bmeg/jsonschema/v5 v5.3.4-0.20241111204732-55db82022a92 h1:Myx/j+WxfEg+P3nDaizR1hBpjKSLgvr4ydzgp1/1pAU=
github.com/bmeg/jsonschema/v5 v5.3.4-0.20241111204732-55db82022a92/go.mod h1:6v27bSBKXyIDFqlKQbUSnHlekE1y6bDkgWCuVEaDPng=
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
Expand Down Expand Up @@ -75,8 +75,8 @@ golang.org/x/term v0.29.0 h1:L6pJp37ocefwRRtYPKSWOWzOtWSxVajvz2ldH/xi3iU=
golang.org/x/term v0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s=
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
google.golang.org/genproto v0.0.0-20230303212802-e74f57abe488 h1:QQF+HdiI4iocoxUjjpLgvTYDHKm99C/VtTBFnfiCJos=
google.golang.org/genproto v0.0.0-20230303212802-e74f57abe488/go.mod h1:TvhZT5f700eVlTNwND1xoEZQeWTB2RY/65kplwl/bFA=
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A=
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU=
google.golang.org/grpc v1.70.0 h1:pWFv03aZoHzlRKHWicjsZytKAiYCtNS0dHbXnIdq7jQ=
google.golang.org/grpc v1.70.0/go.mod h1:ofIJqVKDXx/JiXrwr2IG4/zwdH9txy3IlF40RmcJSQw=
google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=
Expand Down
Loading