Task: Implement a minimal DXF reader module named ezdxf in /app/ezdxf.py (as a single module or as a package under /app/ezdxf/). The module must satisfy the following expectations used by the provided pytest tests.
What to implement
A function readfile(filename: str) -> DXFDocument that reads a DXF file and returns a DXFDocument object.
A lightweight DXFDocument class with a method modelspace() -> ModelSpace.
A ModelSpace class with a method query(entity_type: str) -> List[DXFPointEntity], which returns entities of the given type.
A DXFPointEntity (or compatible object) with an attribute dxf such that:
dxf.location is an iterable of length 3 representing the 3D coordinates (x, y, z) of the point.
The tests specifically use:
doc = ezdxf.readfile(filename)
msp = doc.modelspace()
points = list(msp.query("POINT"))
len(points) == 11
len(points[0].dxf.location) == 3
Expected behavior and parsing details
The DXF parser should handle the simplest ASCII DXF subset sufficient for POINT entities:
Detect a POINT entity by the group code 0 with value "POINT".
Extract the coordinates from group codes 10 (X), 20 (Y), and 30 (Z). These values are numbers (floats).
Create a Point-like entity for each POINT with a .dxf.location = (x, y, z).
Unknown DXF entities should be ignored.
If any of x, y, or z are missing for a POINT, default that coordinate to 0.0.
The implementation must not rely on external libraries and should be self-contained in /app/ezdxf.py.
Notes
The provided test will skip if the file data/Leica_Disto_S910.dxf is not present, so implement the parser to gracefully handle typical DXF formatting but not require any external resources.
The solution should be resilient to extra whitespace and non-POINT sections in the DXF file.
Placement
Implement all of the above in /app/ezdxf.py (or in /app/ezdxf/init.py if you choose to implement ezdxf as a package).