Structure Python package.
This commit is contained in:
8
AuDaGe.code-workspace
Normal file
8
AuDaGe.code-workspace
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "."
|
||||
}
|
||||
],
|
||||
"settings": {}
|
||||
}
|
||||
30
pyproject.toml
Normal file
30
pyproject.toml
Normal file
@@ -0,0 +1,30 @@
|
||||
[build-system]
|
||||
requires = ["uv_build >= 0.11.6"]
|
||||
build-backend = "uv_build"
|
||||
|
||||
[project]
|
||||
name = "AuDaGe"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"pandas",
|
||||
]
|
||||
authors = [
|
||||
{ name="Joshua Lucas", email="j.lucas@prime-controls.com" },
|
||||
]
|
||||
description = "A small example package"
|
||||
readme = "readme.md"
|
||||
requires-python = ">=3.12"
|
||||
classifiers = [
|
||||
"Programming Language :: Python :: 3",
|
||||
"Operating System :: OS Independent",
|
||||
]
|
||||
license = "LicenseRef-Proprietary"
|
||||
license-files = ["licen[cs]e*"]
|
||||
|
||||
[project.urls]
|
||||
Homepage = "https://github.com/jlucas-primecontrols/AuDaGe"
|
||||
Issues = "https://github.com/jlucas-primecontrols/AuDaGe/issues"
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
where = ["src"]
|
||||
# namespaces = false
|
||||
0
src/AuDaGe/AuDaGe.py
Normal file
0
src/AuDaGe/AuDaGe.py
Normal file
0
src/AuDaGe/__init__.py
Normal file
0
src/AuDaGe/__init__.py
Normal file
0
src/AuDaGe/formats/__init__.py
Normal file
0
src/AuDaGe/formats/__init__.py
Normal file
0
src/AuDaGe/formats/controlexpert/__init__.py
Normal file
0
src/AuDaGe/formats/controlexpert/__init__.py
Normal file
@@ -1,11 +1,13 @@
|
||||
import os
|
||||
import pandas as pd
|
||||
import sys
|
||||
from collections.abc import Sequence
|
||||
|
||||
from collections.abc import Iterable
|
||||
from iec import datatypes, ElementaryVariable, UDT
|
||||
import pandas as pd
|
||||
from pandas import DataFrame
|
||||
|
||||
import AuDaGe
|
||||
from AuDaGe.iec import datatypes, ElementaryVariable, UDT
|
||||
|
||||
class XSY():
|
||||
"""Schneider Electric EcoStruxure Control Expert variable exchange file
|
||||
(XSY).
|
||||
@@ -32,7 +34,7 @@ class XSY():
|
||||
self,
|
||||
xsy_path: os.path,
|
||||
dir_path: os.path = '',
|
||||
def_paths: Iterable[os.path] = [],
|
||||
def_paths: Sequence[os.path] = [],
|
||||
db_ss_path: os.path = 'flatten_datablock.xslt',
|
||||
ddt_ss_path: os.path = 'flatten_ddtsource.xslt',
|
||||
) -> None:
|
||||
@@ -103,44 +105,44 @@ class XSY():
|
||||
pass
|
||||
|
||||
# Run this module as a script to test.
|
||||
if __name__ == '__main__':
|
||||
# Argument 1: path to XSY
|
||||
try:
|
||||
xsy_path = sys.argv[1]
|
||||
except:
|
||||
xsy_path = 'test/hsps.xsy'
|
||||
# Argument 2: path to dataBlock stylesheet.
|
||||
try:
|
||||
db_ss_path = sys.argv[2]
|
||||
except:
|
||||
db_ss_path = 'flatten_datablock.xslt'
|
||||
# Argument 3: path to DDTSource stylesheet.
|
||||
try:
|
||||
ddt_ss_path = sys.argv[3]
|
||||
except:
|
||||
ddt_ss_path = 'flatten_ddtsource.xslt'
|
||||
# Argument 4: path to other definition files
|
||||
try:
|
||||
def_paths = [sys.argv[3].split(',')]
|
||||
except:
|
||||
def_paths = ['builtins.xsy']
|
||||
# Argument 5: path to output file.
|
||||
try:
|
||||
out_path = sys.argv[5]
|
||||
except:
|
||||
out_path = 'test/test'
|
||||
dir_path: os.path = ('D:/OneDrive - Prime Controls/Repositories'
|
||||
'/AuDaGe/formats/controlexpert/')
|
||||
xsy = XSY(
|
||||
xsy_path,
|
||||
dir_path,
|
||||
def_paths = def_paths,
|
||||
db_ss_path = db_ss_path,
|
||||
ddt_ss_path = ddt_ss_path,
|
||||
)
|
||||
xsy.read_datablock()
|
||||
xsy.read_defs()
|
||||
xsy.expand_datablock()
|
||||
xsy.datablock.to_csv(out_path + '_db.csv', index=False)
|
||||
xsy.defs.to_csv(out_path + '_ddt.csv', index=False)
|
||||
# if __name__ == '__main__':
|
||||
# # Argument 1: path to XSY
|
||||
# try:
|
||||
# xsy_path = sys.argv[1]
|
||||
# except:
|
||||
# xsy_path = 'test/hsps.xsy'
|
||||
# # Argument 2: path to dataBlock stylesheet.
|
||||
# try:
|
||||
# db_ss_path = sys.argv[2]
|
||||
# except:
|
||||
# db_ss_path = 'flatten_datablock.xslt'
|
||||
# # Argument 3: path to DDTSource stylesheet.
|
||||
# try:
|
||||
# ddt_ss_path = sys.argv[3]
|
||||
# except:
|
||||
# ddt_ss_path = 'flatten_ddtsource.xslt'
|
||||
# # Argument 4: path to other definition files
|
||||
# try:
|
||||
# def_paths = [sys.argv[3].split(',')]
|
||||
# except:
|
||||
# def_paths = ['builtins.xsy']
|
||||
# # Argument 5: path to output file.
|
||||
# try:
|
||||
# out_path = sys.argv[5]
|
||||
# except:
|
||||
# out_path = 'test/test'
|
||||
# dir_path: os.path = ('D:/OneDrive - Prime Controls/Repositories'
|
||||
# '/AuDaGe/formats/controlexpert/')
|
||||
# xsy = XSY(
|
||||
# xsy_path,
|
||||
# dir_path,
|
||||
# def_paths = def_paths,
|
||||
# db_ss_path = db_ss_path,
|
||||
# ddt_ss_path = ddt_ss_path,
|
||||
# )
|
||||
# xsy.read_datablock()
|
||||
# xsy.read_defs()
|
||||
# xsy.expand_datablock()
|
||||
# xsy.datablock.to_csv(out_path + '_db.csv', index=False)
|
||||
# xsy.defs.to_csv(out_path + '_ddt.csv', index=False)
|
||||
|
||||
0
src/AuDaGe/formats/ftae/__init__.py
Normal file
0
src/AuDaGe/formats/ftae/__init__.py
Normal file
3
tests/xsy/xsy.py
Normal file
3
tests/xsy/xsy.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from AuDaGe.formats.controlexpert.xsy import XSY
|
||||
|
||||
print(XSY("hsps.xsy"))
|
||||
Reference in New Issue
Block a user