pyne/pyne.py

48 lines
1.1 KiB
Python
Raw Normal View History

2023-04-08 20:07:28 +00:00
from argparse import ArgumentParser
from dataclasses import dataclass
from decorators import deprecated, todo, wip
from enum import Enum
from pyne_errors import ParserError, FileError
import datatypes
import sys
@dataclass
class PyneObject:
value: int
datatype: datatypes.Datatype
class Pyne:
def __init__(self, path: str, args: list[str]):
self.args = args
self.path = path if self._validate(path) else None
@todo()
def parse(self) -> PyneObject:
return PyneObject(None, datatypes.Datatype.NONE)
def _validate(self, path: str) -> bool:
"""
Validates the path and checks if it exists or not.
"""
with open(path) as f:
f.seek(1)
return True
@todo("Project is a work in progress")
def main() -> int:
parser = ArgumentParser(description="A simple language written in Python")
parser.add_argument("file", nargs=1)
args = parser.parse_args()
print(args)
pyne = Pyne(args.file[0], None)
print(pyne.parse())
return 0
if __name__ == "__main__":
raise SystemExit(main())