)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"8536a7b8a8665b2e5d608420e3b672e8cf4b2468","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"b3ef0076_3eba57c1","updated":"2022-03-09 13:34:43.000000000","message":"I think this makes sense.  (See my comment inline.)","commit_id":"369af76f88ce871414937342d5ccb9423e3067b3"},{"author":{"_account_id":20813,"name":"Sofia Enriquez","email":"lsofia.enriquez@gmail.com","username":"enriquetaso"},"change_message_id":"0e93d4b36c21aa4e4d703d86610427af8d42a49d","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"10d707f6_9c3bd154","updated":"2022-03-09 18:27:23.000000000","message":"Looks good to me!","commit_id":"369af76f88ce871414937342d5ccb9423e3067b3"}],"cinder/db/sqlalchemy/api.py":[{"author":{"_account_id":20813,"name":"Sofia Enriquez","email":"lsofia.enriquez@gmail.com","username":"enriquetaso"},"change_message_id":"4759c03bd9128e3527f35540a72b55d5525de2fb","unresolved":true,"context_lines":[{"line_number":166,"context_line":"        if not is_admin_context(args[0]):"},{"line_number":167,"context_line":"            raise exception.AdminRequired()"},{"line_number":168,"context_line":"        return f(*args, **kwargs)"},{"line_number":169,"context_line":"    wrapper.__signature__ \u003d inspect.signature(f)"},{"line_number":170,"context_line":"    return wrapper"},{"line_number":171,"context_line":""},{"line_number":172,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"c731c7d2_8623b4ca","line":169,"updated":"2022-03-02 14:57:12.000000000","message":"Sorry if my question is too obvious but why do we need to set the signature of the wrapper? I can\u0027t find this use in any part of the code to use as a reference. I guess it\u0027s because backward compatibility but If you have more info to add, please let me know. \nhttps://docs.python.org/3/library/inspect.html#inspect.signature","commit_id":"369af76f88ce871414937342d5ccb9423e3067b3"},{"author":{"_account_id":27615,"name":"Rajat Dhasmana","email":"rajatdhasmana@gmail.com","username":"whoami-rajat"},"change_message_id":"5926b8cb82cccf8455799089637e4450c461cfeb","unresolved":false,"context_lines":[{"line_number":166,"context_line":"        if not is_admin_context(args[0]):"},{"line_number":167,"context_line":"            raise exception.AdminRequired()"},{"line_number":168,"context_line":"        return f(*args, **kwargs)"},{"line_number":169,"context_line":"    wrapper.__signature__ \u003d inspect.signature(f)"},{"line_number":170,"context_line":"    return wrapper"},{"line_number":171,"context_line":""},{"line_number":172,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"28954f26_8cf6298c","line":169,"in_reply_to":"4cb86ec0_2a96fe07","updated":"2022-03-09 18:43:42.000000000","message":"I\u0027m still not 100% sure why it is done this way and not with functools.wraps\nThis does preserve the signature but not the name (f.__name__) or docstring (f.__doc__) of the wrapped method which are lost. functools handles all properties of the original method so again why are we doing it like this?","commit_id":"369af76f88ce871414937342d5ccb9423e3067b3"},{"author":{"_account_id":20813,"name":"Sofia Enriquez","email":"lsofia.enriquez@gmail.com","username":"enriquetaso"},"change_message_id":"0e93d4b36c21aa4e4d703d86610427af8d42a49d","unresolved":false,"context_lines":[{"line_number":166,"context_line":"        if not is_admin_context(args[0]):"},{"line_number":167,"context_line":"            raise exception.AdminRequired()"},{"line_number":168,"context_line":"        return f(*args, **kwargs)"},{"line_number":169,"context_line":"    wrapper.__signature__ \u003d inspect.signature(f)"},{"line_number":170,"context_line":"    return wrapper"},{"line_number":171,"context_line":""},{"line_number":172,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"4cb86ec0_2a96fe07","line":169,"in_reply_to":"95455b30_c7ec6ec3","updated":"2022-03-09 18:27:23.000000000","message":"Ack! Thanks Brian! The patch looks good. @stephenfin: please add more context on the commit msg next time.","commit_id":"369af76f88ce871414937342d5ccb9423e3067b3"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"8536a7b8a8665b2e5d608420e3b672e8cf4b2468","unresolved":true,"context_lines":[{"line_number":166,"context_line":"        if not is_admin_context(args[0]):"},{"line_number":167,"context_line":"            raise exception.AdminRequired()"},{"line_number":168,"context_line":"        return f(*args, **kwargs)"},{"line_number":169,"context_line":"    wrapper.__signature__ \u003d inspect.signature(f)"},{"line_number":170,"context_line":"    return wrapper"},{"line_number":171,"context_line":""},{"line_number":172,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"95455b30_c7ec6ec3","line":169,"in_reply_to":"c731c7d2_8623b4ca","updated":"2022-03-09 13:34:43.000000000","message":"This is from PEP-362.  Basically, what\u0027s going on is that if we use inspect.signature() on this thing, we want it to give us the signature of the wrapped function, not the signature of the wrapper.\n\nThe other functions in this file that use the \u0027@functools.wraps\u0027 decorator don\u0027t get a __signature__ set on them manually by us (or by functools), but functools.update_wrapper() (which is applied by the decorator) does set enough other attributes on them so that when you call inspect.signature(), the correct signature is returned.\n\nYou\u0027re correct that we don\u0027t currently have any tests that take advantage of this, so this is basically future-proofing to save someone time later when they use inspect and find that some stuff is working as expected and some isn\u0027t.","commit_id":"369af76f88ce871414937342d5ccb9423e3067b3"}]}
