-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* initial test * Add class NCTable and move functionality new class to hold data and format of table loading saving of fromat information with json * Delete tool_table.json * Update table_reader_demo.py
- Loading branch information
Showing
3 changed files
with
283 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
"""module with reader for TNC tables""" | ||
import logging | ||
import re | ||
import json | ||
from pathlib import Path | ||
|
||
|
||
class ColumnDescription(): | ||
def __init__(self, column_name, format_str): | ||
self._name = column_name | ||
self._format = format_str | ||
|
||
class TabelFormat(): | ||
def __init__(self): | ||
self.column_definitions = list() | ||
|
||
class GenericTabel(): | ||
@staticmethod | ||
def from_json(json_path): | ||
tf = TabelFormat() | ||
with open(json_path, 'r') as jfp: | ||
data = json.load(jfp) | ||
|
||
for col in data['columns']: | ||
print(col) | ||
cd = ColumnDescription(column_name=col['column_name'], format_str=col['format_str']) | ||
tf.column_definitions.append(cd) | ||
|
||
if __name__ == "__main__": | ||
file = Path('./tool_table.json') | ||
GenericTabel.from_json(file) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.