Karim shoair commited on
Commit
02a714b
·
1 Parent(s): b9977b1

refactor: remove clean up function for Adaptor + make adaptor attributes accessible directly

Browse files
Files changed (1) hide show
  1. scrapling/parser.py +5 -9
scrapling/parser.py CHANGED
@@ -185,15 +185,11 @@ class Adaptor(SelectorsGeneration):
185
  else {}
186
  )
187
 
188
- def __del__(self):
189
- """Ensure cleanup happens"""
190
- if hasattr(self, "_storage") and self._storage:
191
- try:
192
- self._storage.close()
193
- except Exception:
194
- pass
195
- finally:
196
- self._storage = None
197
 
198
  # Node functionalities, I wanted to move to a separate Mixin class, but it had a slight impact on performance
199
  @staticmethod
 
185
  else {}
186
  )
187
 
188
+ def __getitem__(self, key: str) -> TextHandler:
189
+ return self.attrib[key]
190
+
191
+ def __contains__(self, key: str) -> bool:
192
+ return key in self.attrib
 
 
 
 
193
 
194
  # Node functionalities, I wanted to move to a separate Mixin class, but it had a slight impact on performance
195
  @staticmethod