|
11 | 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | 12 | # See the License for the specific language governing permissions and |
13 | 13 | # limitations under the License. |
| 14 | +# pylint: disable=too-many-lines |
14 | 15 | """ |
15 | 16 | Usage |
16 | 17 | ----- |
@@ -782,13 +783,11 @@ def _instrument(self, **kwargs): |
782 | 783 | ) |
783 | 784 |
|
784 | 785 | def _uninstrument(self, **kwargs): |
785 | | - import httpx |
786 | | - |
787 | 786 | unwrap(httpx.HTTPTransport, "handle_request") |
788 | 787 | unwrap(httpx.AsyncHTTPTransport, "handle_async_request") |
789 | 788 |
|
790 | | - def _handle_request_wrapper( |
791 | | - self, |
| 789 | + @staticmethod |
| 790 | + def _handle_request_wrapper( # pylint: disable=too-many-locals |
792 | 791 | wrapped, |
793 | 792 | instance, |
794 | 793 | args, |
@@ -861,8 +860,8 @@ def _handle_request_wrapper( |
861 | 860 |
|
862 | 861 | return response |
863 | 862 |
|
864 | | - async def _handle_async_request_wrapper( |
865 | | - self, |
| 863 | + @staticmethod |
| 864 | + async def _handle_async_request_wrapper( # pylint: disable=too-many-locals |
866 | 865 | wrapped, |
867 | 866 | instance, |
868 | 867 | args, |
@@ -979,14 +978,14 @@ def instrument_client( |
979 | 978 | async_request_hook = request_hook |
980 | 979 | request_hook = None |
981 | 980 | else: |
982 | | - request_hook = request_hook |
| 981 | + # request_hook already set |
983 | 982 | async_request_hook = None |
984 | 983 |
|
985 | 984 | if iscoroutinefunction(response_hook): |
986 | 985 | async_response_hook = response_hook |
987 | 986 | response_hook = None |
988 | 987 | else: |
989 | | - response_hook = response_hook |
| 988 | + # response_hook already set |
990 | 989 | async_response_hook = None |
991 | 990 |
|
992 | 991 | if hasattr(client._transport, "handle_request"): |
|
0 commit comments