Fix: Cleanup \n 1. Remove PostgreSQL \n 2. Remove comments from Python \n 3. Remove non-demo ERP Python code \n 4. Remove deprecated Python code

This commit is contained in:
2025-03-21 13:33:29 +00:00
parent 2ddfd8e10f
commit a6cbf9a7b7
220 changed files with 151 additions and 34140 deletions

View File

@@ -1,38 +0,0 @@
from abc import abstractmethod
from functools import wraps
import inspect
def Interface_ABC(cls):
abstract_methods = {}
for name, value in vars(cls).items():
if getattr(value, '__isabstractmethod__', False):
if isinstance(value, classmethod):
abstract_methods[name] = 'classmethod'
elif isinstance(value, staticmethod):
abstract_methods[name] = 'staticmethod'
else:
abstract_methods[name] = 'method'
def decorator(subclass):
for method, method_type in abstract_methods.items():
if not hasattr(subclass, method):
raise NotImplementedError(
f"'{subclass.__name__}' must implement abstract {method_type} '{method}' from interface '{cls.__name__}'"
)
subclass_value = getattr(subclass, method)
if method_type == 'classmethod' and not isinstance(subclass_value, classmethod):
raise TypeError(f"'{method}' must be a classmethod in '{subclass.__name__}'")
elif method_type == 'staticmethod' and not isinstance(subclass_value, staticmethod):
raise TypeError(f"'{method}' must be a staticmethod in '{subclass.__name__}'")
elif method_type == 'method' and (isinstance(subclass_value, (classmethod, staticmethod)) or inspect.isfunction(subclass_value)):
# For normal methods, we accept either functions or methods, as unbound methods are functions in Python 3
pass
else:
raise TypeError(f"'{method}' has incorrect type in '{subclass.__name__}'")
return subclass
return decorator

View File

@@ -1,34 +0,0 @@
"""
Project: PARTS Website
Author: Edward Middleton-Smith
Precision And Research Technology Systems Limited
Technology: Helpers
Feature: PostgreSQL Database Helper
"""
# internal
# external
import psycopg2
# from psycopg2 import sql
from pydantic import BaseModel
from flask import Flask
class Helper_DB_PostgreSQL(BaseModel):
app: Flask
def __init__(self, app):
super().__init__(app=app)
# self.app = app
def get_db_connection(self):
return psycopg2.connect(
dbname = self.app.config['DB_NAME'],
user = self.app.config['DB_USER'],
password = self.app.config['DB_PASSWORD'],
host = self.app.config['DB_HOST'],
port = self.app.config['DB_PORT']
)

View File

@@ -12,7 +12,6 @@ Feature: App Helper
# external
from pydantic import BaseModel, ConfigDict
from flask import current_app
# from flask_sqlalchemy import SQLAlchemy
class Helper_App(BaseModel):

View File

@@ -13,7 +13,7 @@ Notes: This architecture does not work with Flask-SQLAlchemy - db connection mus
# external
from pydantic import BaseModel, ConfigDict
from flask import Flask, render_template, jsonify, request, render_template_string, send_from_directory, redirect, url_for, session
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
import uuid
@@ -24,7 +24,6 @@ class Helper_DB_MySQL(BaseModel):
def __init__(self, app):
super().__init__(app=app)
# self.app = app
def get_db_connection(self):
db = SQLAlchemy()