Skip to content
Open
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
3 changes: 3 additions & 0 deletions .licenserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ header: # `header` section is configurations for source codes license header.
- '**/poetry.lock'
- '.github/**/*'
- 'docker/**/*'
- '**/*.interp'
- '**/*.tokens'
- '**/*.csv'

comment: on-failure
# on what condition license-eye will comment on the pull request, `on-failure`, `always`, `never`.
Expand Down
27 changes: 27 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ addopts = "--strict-markers --strict-config"
[tool.ruff]
line-length = 120
target-version = "py310"
extend-exclude = [
"text2gremlin/AST_Text2Gremlin/base/gremlin/*.py",
]

[tool.ruff.lint]
# Select a broad set of rules for comprehensive checks.
Expand All @@ -188,6 +191,30 @@ ignore = [
"tests/**/*.py" = ["T20"]
"hugegraph-ml/src/hugegraph_ml/examples/**/*.py" = ["T20"]
"hugegraph-python-client/src/pyhugegraph/structure/*.py" = ["N802"]
"text2gremlin/AST_Text2Gremlin/base/*.py" = [
"N999", # Keep existing standalone module names such as GremlinBase.py.
]
Comment on lines +194 to +196

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

PEP 8 recommends using short, all-lowercase names for modules and packages, with underscores only if they improve readability (e.g., ast_text2gremlin, gremlin_base.py, gremlin_trans_visitor.py, traversal_generator.py).\n\nSince this is a brand new feature being introduced to the repository, it is highly recommended to rename these directories and files to follow standard snake_case naming conventions. This will improve maintainability, align with the rest of the codebase, and eliminate the need for suppressing N999 (invalid module name) lint errors.

References
  1. PEP 8 recommends using short, all-lowercase names for modules and packages, with underscores only if they improve readability. (link)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not changing this in PR1. Renaming AST_Text2Gremlin and the existing visitor/generator modules would affect imports, docs, and follow-up split PR boundaries. This series is intentionally splitting the existing implementation for review without doing a broad rename/refactor; naming cleanup can be handled as a separate follow-up if maintainers want it.

"text2gremlin/AST_Text2Gremlin/analyze_syntax.py" = ["T20"]
"text2gremlin/AST_Text2Gremlin/generate_corpus.py" = ["T20"]
"text2gremlin/AST_Text2Gremlin/run_llm_pipeline.py" = ["T20"]
"text2gremlin/AST_Text2Gremlin/base/GremlinBase.py" = ["T20"]
"text2gremlin/AST_Text2Gremlin/base/GremlinTransVisitor.py" = [
"F403", # ANTLR visitor compatibility import style.
"F811", # Visitor methods mirror grammar alternatives and may intentionally repeat names.
"T20", # Parser diagnostics are printed by the standalone visitor helper.
]
Comment on lines +201 to +205

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

In Python, defining multiple methods with the same name within a class will silently overwrite the previous definitions (as Python does not support method overloading). If the upcoming GremlinTransVisitor.py indeed repeats method names, only the last one defined will be executed, which is likely a bug.\n\nANTLR4 typically generates unique visitor method names for each labeled alternative (e.g., visitAdd, visitSub). Please verify if F811 is truly needed, or if the visitor implementation needs to be corrected to avoid duplicate method definitions.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not changing this in PR1. This PR only prepares project plumbing and does not include GremlinTransVisitor.py. I verified the concern against the full Text2Gremlin branch; duplicate visitor method names need to be handled or justified in the later core/quality PR where the visitor implementation is actually introduced.

"text2gremlin/AST_Text2Gremlin/base/TraversalGenerator.py" = [
"E501", # Long generated traversal fragments are kept readable.
"E741", # Gremlin examples may use compact variable names in local comprehensions.
"RUF012", # Class-level step configuration dictionaries are constants in practice.
"SIM102", # Keep complex traversal-generation branching explicit.
"SIM108", # Keep complex traversal-generation branching explicit.
]
"text2gremlin/AST_Text2Gremlin/llm_augment/*.py" = [
"E501", # Long prompts are kept readable.
"RUF002", # Chinese prompt text intentionally uses full-width punctuation.
"T20", # Standalone data-generation scripts write progress to stdout.
]

[tool.ruff.lint.isort]
known-first-party = ["hugegraph_llm", "hugegraph_python_client", "hugegraph_ml", "vermeer_python_client"]
Expand Down
13 changes: 13 additions & 0 deletions text2gremlin/AST_Text2Gremlin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 配置文件
config.json
.env
output/

# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
*.egg-info/
.eggs/
5 changes: 5 additions & 0 deletions text2gremlin/AST_Text2Gremlin/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
antlr4-python3-runtime==4.13.1
openai~=1.61.0
pandas~=2.2.3
pydantic~=2.10.6
pytest~=8.0.0
Loading