File tree Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ mod decoder;
44mod enums;
55mod geo;
66mod ifd;
7+ mod reader;
78mod thread_pool;
89mod tiff;
910mod tile;
Original file line number Diff line number Diff line change 1+ use pyo3:: exceptions:: PyTypeError ;
2+ use pyo3:: intern;
3+ use pyo3:: prelude:: * ;
4+ use pyo3:: pybacked:: PyBackedStr ;
5+
6+ struct AiohttpSession ( PyObject ) ;
7+
8+ impl < ' py > FromPyObject < ' py > for AiohttpSession {
9+ fn extract_bound ( ob : & Bound < ' py , PyAny > ) -> PyResult < Self > {
10+ let py = ob. py ( ) ;
11+ let cls = ob. getattr ( intern ! ( py, "__class__" ) ) ?;
12+ let module = cls
13+ . getattr ( intern ! ( py, "__module__" ) ) ?
14+ . extract :: < PyBackedStr > ( ) ?;
15+ let class_name = cls
16+ . getattr ( intern ! ( py, "__name__" ) ) ?
17+ . extract :: < PyBackedStr > ( ) ?;
18+ if module. starts_with ( "aiohttp" ) && class_name == "ClientSession" {
19+ todo ! ( )
20+ } else {
21+ let msg = format ! (
22+ "Expected aiohttp.ClientSession, got {}.{}" ,
23+ module, class_name
24+ ) ;
25+ Err ( PyTypeError :: new_err ( msg) )
26+ }
27+ }
28+ }
Original file line number Diff line number Diff line change 1+ mod aiohttp;
You can’t perform that action at this time.
0 commit comments