diff options
author | Stefan Scherfke <stefan@sofa-rockers.org> | 2019-11-06 20:37:20 +0100 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2019-11-06 20:37:20 +0100 |
commit | 501f73b53820a96df01a2438c5e91c3f3a1fe94a (patch) | |
tree | ca7bac6d7b6ded84c907d73f94f5e0922eb9024b | |
parent | 4a244535ecb5530a1c346f8bd39800f3282f3396 (diff) | |
download | astroid-git-501f73b53820a96df01a2438c5e91c3f3a1fe94a.tar.gz |
Add brain for "responses" (#717)
Fixes: #716
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | astroid/brain/brain_responses.py | 73 |
2 files changed, 75 insertions, 0 deletions
@@ -7,6 +7,8 @@ What's New in astroid 2.4.0? Release Date: TBA * Added transform for ``scipy.gaussian`` +* Added a brain for ``responses`` + What's New in astroid 2.3.2? ============================ diff --git a/astroid/brain/brain_responses.py b/astroid/brain/brain_responses.py new file mode 100644 index 00000000..3a441298 --- /dev/null +++ b/astroid/brain/brain_responses.py @@ -0,0 +1,73 @@ +""" +Astroid hooks for responses. + +It might need to be manually updated from the public methods of +:class:`responses.RequestsMock`. + +See: https://github.com/getsentry/responses/blob/master/responses.py + +""" +import astroid + + +def responses_funcs(): + return astroid.parse( + """ + DELETE = "DELETE" + GET = "GET" + HEAD = "HEAD" + OPTIONS = "OPTIONS" + PATCH = "PATCH" + POST = "POST" + PUT = "PUT" + response_callback = None + + def reset(): + return + + def add( + method=None, # method or ``Response`` + url=None, + body="", + adding_headers=None, + *args, + **kwargs + ): + return + + def add_passthru(prefix): + return + + def remove(method_or_response=None, url=None): + return + + def replace(method_or_response=None, url=None, body="", *args, **kwargs): + return + + def add_callback( + method, url, callback, match_querystring=False, content_type="text/plain" + ): + return + + calls = [] + + def __enter__(): + return + + def __exit__(type, value, traceback): + success = type is None + return success + + def activate(func): + return func + + def start(): + return + + def stop(allow_assert=True): + return + """ + ) + + +astroid.register_module_extender(astroid.MANAGER, "responses", responses_funcs) |