|
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 | -----
|
@@ -785,13 +786,11 @@ def _instrument(self, **kwargs):
|
785 | 786 | )
|
786 | 787 |
|
787 | 788 | def _uninstrument(self, **kwargs):
|
788 |
| - import httpx |
789 |
| - |
790 | 789 | unwrap(httpx.HTTPTransport, "handle_request")
|
791 | 790 | unwrap(httpx.AsyncHTTPTransport, "handle_async_request")
|
792 | 791 |
|
793 |
| - def _handle_request_wrapper( |
794 |
| - self, |
| 792 | + @staticmethod |
| 793 | + def _handle_request_wrapper( # pylint: disable=too-many-locals |
795 | 794 | wrapped,
|
796 | 795 | instance,
|
797 | 796 | args,
|
@@ -864,8 +863,8 @@ def _handle_request_wrapper(
|
864 | 863 |
|
865 | 864 | return response
|
866 | 865 |
|
867 |
| - async def _handle_async_request_wrapper( |
868 |
| - self, |
| 866 | + @staticmethod |
| 867 | + async def _handle_async_request_wrapper( # pylint: disable=too-many-locals |
869 | 868 | wrapped,
|
870 | 869 | instance,
|
871 | 870 | args,
|
@@ -982,14 +981,14 @@ def instrument_client(
|
982 | 981 | async_request_hook = request_hook
|
983 | 982 | request_hook = None
|
984 | 983 | else:
|
985 |
| - request_hook = request_hook |
| 984 | + # request_hook already set |
986 | 985 | async_request_hook = None
|
987 | 986 |
|
988 | 987 | if iscoroutinefunction(response_hook):
|
989 | 988 | async_response_hook = response_hook
|
990 | 989 | response_hook = None
|
991 | 990 | else:
|
992 |
| - response_hook = response_hook |
| 991 | + # response_hook already set |
993 | 992 | async_response_hook = None
|
994 | 993 |
|
995 | 994 | if hasattr(client._transport, "handle_request"):
|
|
0 commit comments