Skip to main content

Facilitate tree-sitter-epics parsing in python

Project description

PY-TREE-SITTER-EPICS

Based on Tree sitter , tree-sitter-epics and Py-tree-sitter, this module is used to serialize any EPICS files into a Python object usable in a script.

⚠️ For now it is only developped for EPICS CA database but it will support more files in the future.

Installation

The module is available on Pypi. This package currently only works with Python >3.10. The library dependencis is tree-sitter-epics

pip3 install py-tree-sitter-epics

You may need to use this line

pip3 install py-tree-sitter-epics --break-system-packages

Using

This example show how to use the module. It is parsing a file building a python object containing all the fields, infos and links to finally displaying all those infos.

from py_tree_sitter_epics import epicsdb

with Path.open("/tmp/myExample.db") as file:
        code = file.read()
#build the parser
db_parser = epicsdb.DbParser()
#parse the code
db_parser.parse(code)
#build record list from the parser
record_list = db_parser.build_records_list()
for record in reccord_list:
    #print a complete result
    record.print_to_text()
classDiagram
    Record--o Link : 0..1
    class Link {
        set_record_name()
        set_type_link()
        create_link()
        string record_name
        string type_link
    }
    class Record {
        set_record_type()
        set_record_name()
        set_description()
        set_fields()
        set_infos()
        set_links_in()
        set_links_out()
        add_link_out()
        add_link_in()
        print_to_text()
        string record_type 
        string record_name 
        string description 
        tuple[string,string] fields 
        string unit
        string description
        string infos
        List<Link> links_in
        List<Link> links_out
    }
    class DbParser {
        +parse()
        +build_fields()
        +build_comment()
        +build_infos()
        +build_records_list()
        parserTree
        tree
        root_node
        tree
    }

   

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_tree_sitter_epics-0.2.tar.gz (4.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

py_tree_sitter_epics-0.2.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

py_tree_sitter_epics-0.2-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file py_tree_sitter_epics-0.2.tar.gz.

File metadata

  • Download URL: py_tree_sitter_epics-0.2.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.11 Linux/6.12.40

File hashes

Hashes for py_tree_sitter_epics-0.2.tar.gz
Algorithm Hash digest
SHA256 eec0c746d79860a636a9c6c5f9645ed5728051928e824d50e699eb54174431fb
MD5 7673671ec46e345251d93c054e043dd1
BLAKE2b-256 990a0deca8c99d24cf81c7dcdf957f296cab0895d26298b039805130986aad54

See more details on using hashes here.

File details

Details for the file py_tree_sitter_epics-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for py_tree_sitter_epics-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 140271775aecd0a1218d3ea997a29faba0ecd8a45580711eddc9f5bd0c45a5f2
MD5 b8cb35da17f0da6ae107a9a799c071d9
BLAKE2b-256 cf6b4aa32f4cdfa59ec3111c165675f9d9aa56c349dcee4917950bb6258e5a43

See more details on using hashes here.

File details

Details for the file py_tree_sitter_epics-0.2-py3-none-any.whl.

File metadata

  • Download URL: py_tree_sitter_epics-0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.11 Linux/6.12.40

File hashes

Hashes for py_tree_sitter_epics-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 22e89fe6ef0513f87ec260b7df810b7f9949a7dd01e94c4f9d4082d4df0078ba
MD5 d619dc476479e5bdebd053f3f7a01aa5
BLAKE2b-256 4c46461599330084083d0366b95997e413ba49e14dcfdd36ac18cfcbe47fdeff

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page