create documentation in detail and explain code line by line and create a flow chart…
- User
create documentation in detail and explain code line by line and create a flow chart also
import time import schedule from settings import * from services.waferservice import WaferService from utils.defecthelper import * from datetime import datetime from modules.quadtree import Point, Rect, QuadTree
logger = logging.getLogger('service-logger') wafer_service = WaferService()
def main(): try: # get tolerance value for calculation tolerance = wafer_service.get_tolerance() tolerance = micro_to_mm(tolerance) wafer_status = wafer_service.get_wafer_status() check_process = "" for wafer in wafer_status: lot_id = wafer.get("lotId") wafer_number = wafer.get("waferNumber") # if lot_id + wafer_number == check_process: # # if the process is already checked continue to next iteration. # pass #continue removed process check to diffrenetiate testNO wafer_id = wafer.get("waferId") process = wafer_service.get_process(lot_id, wafer_number,wafer) start_time = time.time() if len(process) > 1: check_process = lot_id + wafer_number for count, proc in enumerate(process): wafer_inspection = wafer_service.get_wafer_inspection_data( proc.get("waferId")) if wafer_inspection: if not wafer_inspection.get("inspectionStatus", 0): # lock the wafer inspection by changing the status to 2. wafer_service.update_inspection_status( proc.get("waferId"), INSPECTION_STATUS.get("ADDER_CALCULATION_STARTED")) process_quadtree(proc, process, count, tolerance, False)
recalculation_needed = check_for_recalculation( process) if recalculation_needed and count: # recalculate the adders for previous processes recalculate_adder(process, count, tolerance) else: logger.error("Inspection Record not found for process %s (lotId : %s, waferNumber : %s) ", proc.get("stepId"), lot_id, wafer_number) else: wafer_inspection = wafer_service.get_wafer_inspection_data( wafer.get("waferId")) if wafer_inspection: # if only one process, set all the defects for that wafer as adder if not wafer_inspection.get("inspectionStatus", 0): # change the inspection status to 2 wafer_service.update_inspection_status(wafer.get("waferId"), INSPECTION_STATUS.get("ADDER_CALCULATION_STARTED")) logger.info("Service Started at : %s for process %s " "(lotId: %s, waferNumber: %s)", datetime.now().strftime( "%d/%m/%Y %H:%M:%S"), wafer.get("stepId"), lot_id, wafer_number) wafer_id = wafer.get("waferId") wafer_service.set_adder(wafer_id) defects = wafer_service.get_wafer_defects(wafer_id) # update wafer summary wafer_service.update_wafer_summary( wafer_id, len(defects)) # change the inspection status to 1 wafer_service.update_inspection_status(wafer.get("waferId"), INSPECTION_STATUS.get("ACTIVE")) logger.info("%s Adders found for process %s " "(lotId : %s, waferNumber : %s) in %s seconds with tolerance %sμm", len(defects), wafer.get( "stepId"), lot_id, wafer_number, (time.time() - start_time), mm_to_micro(tolerance)) else: logger.error("Inspection Record not found for process %s (lotId : %s, waferNumber : %s) ", wafer.get("stepId"), lot_id, wafer_number) except Exception as e: logger.error(e, exc_info=False)
- Assistant
- User
Update the previous result by adding line by line documentation, include function names , if conditions in it. Create a detailed documentation
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.