| 125 | raise |
| 126 | |
| 127 | def exists( |
| 128 | self, |
| 129 | key, # type: str |
| 130 | *opts, # type: ExistsOptions |
| 131 | **kwargs, # type: Dict[str, Any] |
| 132 | ) -> Deferred[ExistsResult]: |
| 133 | instruments = self._impl.observability_instruments |
| 134 | obs_handler = ObservableRequestHandler.create_or_none(KeyValueOperationType.Exists, instruments) |
| 135 | try: |
| 136 | req = self._impl.request_builder.build_exists_request(key, obs_handler, *opts, **kwargs) |
| 137 | d = self._impl.exists_deferred(req, obs_handler) |
| 138 | d.addBoth(self._impl._finish_span, obs_handler) |
| 139 | return d |
| 140 | except Exception as e: |
| 141 | if obs_handler is not None: |
| 142 | obs_handler.__exit__(type(e), e, e.__traceback__) |
| 143 | raise |
| 144 | |
| 145 | def insert( |
| 146 | self, |