Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/astroid/brain/brain_responses.py: 86%
7 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 06:53 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 06:53 +0000
1# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
2# For details: https://github.com/pylint-dev/astroid/blob/main/LICENSE
3# Copyright (c) https://github.com/pylint-dev/astroid/blob/main/CONTRIBUTORS.txt
5"""
6Astroid hooks for responses.
8It might need to be manually updated from the public methods of
9:class:`responses.RequestsMock`.
11See: https://github.com/getsentry/responses/blob/master/responses.py
12"""
13from astroid.brain.helpers import register_module_extender
14from astroid.builder import parse
15from astroid.manager import AstroidManager
18def responses_funcs():
19 return parse(
20 """
21 DELETE = "DELETE"
22 GET = "GET"
23 HEAD = "HEAD"
24 OPTIONS = "OPTIONS"
25 PATCH = "PATCH"
26 POST = "POST"
27 PUT = "PUT"
28 response_callback = None
30 def reset():
31 return
33 def add(
34 method=None, # method or ``Response``
35 url=None,
36 body="",
37 adding_headers=None,
38 *args,
39 **kwargs
40 ):
41 return
43 def add_passthru(prefix):
44 return
46 def remove(method_or_response=None, url=None):
47 return
49 def replace(method_or_response=None, url=None, body="", *args, **kwargs):
50 return
52 def add_callback(
53 method, url, callback, match_querystring=False, content_type="text/plain"
54 ):
55 return
57 calls = []
59 def __enter__():
60 return
62 def __exit__(type, value, traceback):
63 success = type is None
64 return success
66 def activate(func):
67 return func
69 def start():
70 return
72 def stop(allow_assert=True):
73 return
74 """
75 )
78register_module_extender(AstroidManager(), "responses", responses_funcs)