mirror of
https://github.com/allenai/olmocr.git
synced 2025-09-27 01:10:31 +00:00
Lints
This commit is contained in:
parent
1e42e5ea9a
commit
f2951f3f78
@ -16,7 +16,6 @@ import json
|
|||||||
import os
|
import os
|
||||||
import pathlib
|
import pathlib
|
||||||
import re
|
import re
|
||||||
import shutil
|
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import threading
|
import threading
|
||||||
import unittest
|
import unittest
|
||||||
@ -28,6 +27,7 @@ from playwright.sync_api import sync_playwright
|
|||||||
|
|
||||||
# --- New SQLite Cache Implementation ---
|
# --- New SQLite Cache Implementation ---
|
||||||
|
|
||||||
|
|
||||||
class EquationCache:
|
class EquationCache:
|
||||||
def __init__(self, db_path: Optional[str] = None):
|
def __init__(self, db_path: Optional[str] = None):
|
||||||
if db_path is None:
|
if db_path is None:
|
||||||
@ -44,14 +44,16 @@ class EquationCache:
|
|||||||
conn = sqlite3.connect(self.db_path)
|
conn = sqlite3.connect(self.db_path)
|
||||||
c = conn.cursor()
|
c = conn.cursor()
|
||||||
# Added an 'error' column to store rendering errors
|
# Added an 'error' column to store rendering errors
|
||||||
c.execute('''
|
c.execute(
|
||||||
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS equations (
|
CREATE TABLE IF NOT EXISTS equations (
|
||||||
eq_hash TEXT PRIMARY KEY,
|
eq_hash TEXT PRIMARY KEY,
|
||||||
mathml TEXT,
|
mathml TEXT,
|
||||||
spans TEXT,
|
spans TEXT,
|
||||||
error TEXT
|
error TEXT
|
||||||
)
|
)
|
||||||
''')
|
"""
|
||||||
|
)
|
||||||
conn.commit()
|
conn.commit()
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
@ -126,6 +128,7 @@ equation_cache = EquationCache()
|
|||||||
# Thread-local storage for Playwright and browser instances
|
# Thread-local storage for Playwright and browser instances
|
||||||
_thread_local = threading.local()
|
_thread_local = threading.local()
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class BoundingBox:
|
class BoundingBox:
|
||||||
x: float
|
x: float
|
||||||
|
Loading…
x
Reference in New Issue
Block a user