{"action":"created","comment":{"url":"https://api.github.com/repos/zeekay/decorum/pulls/comments/36437400","id":36437400,"diff_hunk":"@@ -26,40 +29,40 @@ def __init__(self, *args, **kwargs):\n         #: directly to the matching attributes on the decorator.\n         self.assigned = functools.WRAPPER_ASSIGNMENTS\n         if 'assigned' in kwargs:\n-            self.assigned = kwargs['assigned']\n+            self.assigned = kwargs.pop('assigned')\n \n         if args and callable(args[0]):\n             # used as decorator without being called\n             self.init()\n-            self._wrapped = self.__call__(args[0])\n+            self.wraps(args[0])\n         else:\n             # used as decorator and called\n             self.init(*args, **kwargs)\n \n-    def __call__(self, f=None, *args, **kwargs):\n+    def __call__(self, *args, **kwargs):\n         \"\"\"Actually run the decorated function.\n \n         Uses :meth:`wrap` to handle decoration. Restores :attr:`__doc__` and\n         :attr:`__name__`.\n \n         \"\"\"\n-        if not callable(f):\n-            if f:\n-                return self._wrapped(f, *args, **kwargs)\n-            else:\n-                return self._wrapped(*args, **kwargs)\n+        if self._wrapped:\n+            return self.call(*args, **kwargs)\n         else:\n-            wrapped = self.wraps(f)\n-            return wrapped\n+            f = args[0]\n+            return self.wraps(f)\n \n     def wraps(self, f):\n         \"\"\"Wraps the function and returns it\"\"\"\n+        self._wrapped = f","path":"decorum/decorum.py","position":49,"original_position":49,"commit_id":"843156fc59d3a94fc65f6834720a30c8cc311a01","original_commit_id":"843156fc59d3a94fc65f6834720a30c8cc311a01","user":{"login":"benoitbryon","id":235204,"avatar_url":"https://avatars.githubusercontent.com/u/235204?v=3","gravatar_id":"","url":"https://api.github.com/users/benoitbryon","html_url":"https://github.com/benoitbryon","followers_url":"https://api.github.com/users/benoitbryon/followers","following_url":"https://api.github.com/users/benoitbryon/following{/other_user}","gists_url":"https://api.github.com/users/benoitbryon/gists{/gist_id}","starred_url":"https://api.github.com/users/benoitbryon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benoitbryon/subscriptions","organizations_url":"https://api.github.com/users/benoitbryon/orgs","repos_url":"https://api.github.com/users/benoitbryon/repos","events_url":"https://api.github.com/users/benoitbryon/events{/privacy}","received_events_url":"https://api.github.com/users/benoitbryon/received_events","type":"User","site_admin":false},"body":"I wonder about moving this line in both `__init__` and `__call__`, so that, if users forget to call `super(subclass, self).wraps(function)`, they lose the update_wrapper feature, but still have the `self._wrapped` attribute.","created_at":"2015-08-06T16:50:24Z","updated_at":"2015-08-06T16:50:24Z","html_url":"https://github.com/zeekay/decorum/pull/25#discussion_r36437400","pull_request_url":"https://api.github.com/repos/zeekay/decorum/pulls/25","_links":{"self":{"href":"https://api.github.com/repos/zeekay/decorum/pulls/comments/36437400"},"html":{"href":"https://github.com/zeekay/decorum/pull/25#discussion_r36437400"},"pull_request":{"href":"https://api.github.com/repos/zeekay/decorum/pulls/25"}}},"pull_request":{"url":"https://api.github.com/repos/zeekay/decorum/pulls/25","id":41808038,"html_url":"https://github.com/zeekay/decorum/pull/25","diff_url":"https://github.com/zeekay/decorum/pull/25.diff","patch_url":"https://github.com/zeekay/decorum/pull/25.patch","issue_url":"https://api.github.com/repos/zeekay/decorum/issues/25","number":25,"state":"open","locked":false,"title":"Introduce customizable Decorum.call()","user":{"login":"benoitbryon","id":235204,"avatar_url":"https://avatars.githubusercontent.com/u/235204?v=3","gravatar_id":"","url":"https://api.github.com/users/benoitbryon","html_url":"https://github.com/benoitbryon","followers_url":"https://api.github.com/users/benoitbryon/followers","following_url":"https://api.github.com/users/benoitbryon/following{/other_user}","gists_url":"https://api.github.com/users/benoitbryon/gists{/gist_id}","starred_url":"https://api.github.com/users/benoitbryon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benoitbryon/subscriptions","organizations_url":"https://api.github.com/users/benoitbryon/orgs","repos_url":"https://api.github.com/users/benoitbryon/repos","events_url":"https://api.github.com/users/benoitbryon/events{/privacy}","received_events_url":"https://api.github.com/users/benoitbryon/received_events","type":"User","site_admin":false},"body":"Refs #23. The `call()` method makes it easy to pre-process input arguments or post-process results.","created_at":"2015-08-06T16:35:02Z","updated_at":"2015-08-06T16:50:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c2d6b9d466c1bf0f98f879a046bbbfe23af86eb3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/zeekay/decorum/pulls/25/commits","review_comments_url":"https://api.github.com/repos/zeekay/decorum/pulls/25/comments","review_comment_url":"https://api.github.com/repos/zeekay/decorum/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zeekay/decorum/issues/25/comments","statuses_url":"https://api.github.com/repos/zeekay/decorum/statuses/843156fc59d3a94fc65f6834720a30c8cc311a01","head":{"label":"benoitbryon:23-call","ref":"23-call","sha":"843156fc59d3a94fc65f6834720a30c8cc311a01","user":{"login":"benoitbryon","id":235204,"avatar_url":"https://avatars.githubusercontent.com/u/235204?v=3","gravatar_id":"","url":"https://api.github.com/users/benoitbryon","html_url":"https://github.com/benoitbryon","followers_url":"https://api.github.com/users/benoitbryon/followers","following_url":"https://api.github.com/users/benoitbryon/following{/other_user}","gists_url":"https://api.github.com/users/benoitbryon/gists{/gist_id}","starred_url":"https://api.github.com/users/benoitbryon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benoitbryon/subscriptions","organizations_url":"https://api.github.com/users/benoitbryon/orgs","repos_url":"https://api.github.com/users/benoitbryon/repos","events_url":"https://api.github.com/users/benoitbryon/events{/privacy}","received_events_url":"https://api.github.com/users/benoitbryon/received_events","type":"User","site_admin":false},"repo":{"id":24072036,"name":"decorum","full_name":"benoitbryon/decorum","owner":{"login":"benoitbryon","id":235204,"avatar_url":"https://avatars.githubusercontent.com/u/235204?v=3","gravatar_id":"","url":"https://api.github.com/users/benoitbryon","html_url":"https://github.com/benoitbryon","followers_url":"https://api.github.com/users/benoitbryon/followers","following_url":"https://api.github.com/users/benoitbryon/following{/other_user}","gists_url":"https://api.github.com/users/benoitbryon/gists{/gist_id}","starred_url":"https://api.github.com/users/benoitbryon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benoitbryon/subscriptions","organizations_url":"https://api.github.com/users/benoitbryon/orgs","repos_url":"https://api.github.com/users/benoitbryon/repos","events_url":"https://api.github.com/users/benoitbryon/events{/privacy}","received_events_url":"https://api.github.com/users/benoitbryon/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/benoitbryon/decorum","description":"python decorator helper library","fork":true,"url":"https://api.github.com/repos/benoitbryon/decorum","forks_url":"https://api.github.com/repos/benoitbryon/decorum/forks","keys_url":"https://api.github.com/repos/benoitbryon/decorum/keys{/key_id}","collaborators_url":"https://api.github.com/repos/benoitbryon/decorum/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/benoitbryon/decorum/teams","hooks_url":"https://api.github.com/repos/benoitbryon/decorum/hooks","issue_events_url":"https://api.github.com/repos/benoitbryon/decorum/issues/events{/number}","events_url":"https://api.github.com/repos/benoitbryon/decorum/events","assignees_url":"https://api.github.com/repos/benoitbryon/decorum/assignees{/user}","branches_url":"https://api.github.com/repos/benoitbryon/decorum/branches{/branch}","tags_url":"https://api.github.com/repos/benoitbryon/decorum/tags","blobs_url":"https://api.github.com/repos/benoitbryon/decorum/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/benoitbryon/decorum/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/benoitbryon/decorum/git/refs{/sha}","trees_url":"https://api.github.com/repos/benoitbryon/decorum/git/trees{/sha}","statuses_url":"https://api.github.com/repos/benoitbryon/decorum/statuses/{sha}","languages_url":"https://api.github.com/repos/benoitbryon/decorum/languages","stargazers_url":"https://api.github.com/repos/benoitbryon/decorum/stargazers","contributors_url":"https://api.github.com/repos/benoitbryon/decorum/contributors","subscribers_url":"https://api.github.com/repos/benoitbryon/decorum/subscribers","subscription_url":"https://api.github.com/repos/benoitbryon/decorum/subscription","commits_url":"https://api.github.com/repos/benoitbryon/decorum/commits{/sha}","git_commits_url":"https://api.github.com/repos/benoitbryon/decorum/git/commits{/sha}","comments_url":"https://api.github.com/repos/benoitbryon/decorum/comments{/number}","issue_comment_url":"https://api.github.com/repos/benoitbryon/decorum/issues/comments{/number}","contents_url":"https://api.github.com/repos/benoitbryon/decorum/contents/{+path}","compare_url":"https://api.github.com/repos/benoitbryon/decorum/compare/{base}...{head}","merges_url":"https://api.github.com/repos/benoitbryon/decorum/merges","archive_url":"https://api.github.com/repos/benoitbryon/decorum/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/benoitbryon/decorum/downloads","issues_url":"https://api.github.com/repos/benoitbryon/decorum/issues{/number}","pulls_url":"https://api.github.com/repos/benoitbryon/decorum/pulls{/number}","milestones_url":"https://api.github.com/repos/benoitbryon/decorum/milestones{/number}","notifications_url":"https://api.github.com/repos/benoitbryon/decorum/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/benoitbryon/decorum/labels{/name}","releases_url":"https://api.github.com/repos/benoitbryon/decorum/releases{/id}","created_at":"2014-09-15T20:12:41Z","updated_at":"2015-02-11T14:47:58Z","pushed_at":"2015-08-06T16:11:47Z","git_url":"git://github.com/benoitbryon/decorum.git","ssh_url":"git@github.com:benoitbryon/decorum.git","clone_url":"https://github.com/benoitbryon/decorum.git","svn_url":"https://github.com/benoitbryon/decorum","homepage":"","size":144,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"zeekay:master","ref":"master","sha":"855ed75882a5b34bcc5f7385a418c03941263509","user":{"login":"zeekay","id":285707,"avatar_url":"https://avatars.githubusercontent.com/u/285707?v=3","gravatar_id":"","url":"https://api.github.com/users/zeekay","html_url":"https://github.com/zeekay","followers_url":"https://api.github.com/users/zeekay/followers","following_url":"https://api.github.com/users/zeekay/following{/other_user}","gists_url":"https://api.github.com/users/zeekay/gists{/gist_id}","starred_url":"https://api.github.com/users/zeekay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zeekay/subscriptions","organizations_url":"https://api.github.com/users/zeekay/orgs","repos_url":"https://api.github.com/users/zeekay/repos","events_url":"https://api.github.com/users/zeekay/events{/privacy}","received_events_url":"https://api.github.com/users/zeekay/received_events","type":"User","site_admin":false},"repo":{"id":1745576,"name":"decorum","full_name":"zeekay/decorum","owner":{"login":"zeekay","id":285707,"avatar_url":"https://avatars.githubusercontent.com/u/285707?v=3","gravatar_id":"","url":"https://api.github.com/users/zeekay","html_url":"https://github.com/zeekay","followers_url":"https://api.github.com/users/zeekay/followers","following_url":"https://api.github.com/users/zeekay/following{/other_user}","gists_url":"https://api.github.com/users/zeekay/gists{/gist_id}","starred_url":"https://api.github.com/users/zeekay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zeekay/subscriptions","organizations_url":"https://api.github.com/users/zeekay/orgs","repos_url":"https://api.github.com/users/zeekay/repos","events_url":"https://api.github.com/users/zeekay/events{/privacy}","received_events_url":"https://api.github.com/users/zeekay/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zeekay/decorum","description":"Python decorator helper library.","fork":false,"url":"https://api.github.com/repos/zeekay/decorum","forks_url":"https://api.github.com/repos/zeekay/decorum/forks","keys_url":"https://api.github.com/repos/zeekay/decorum/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zeekay/decorum/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zeekay/decorum/teams","hooks_url":"https://api.github.com/repos/zeekay/decorum/hooks","issue_events_url":"https://api.github.com/repos/zeekay/decorum/issues/events{/number}","events_url":"https://api.github.com/repos/zeekay/decorum/events","assignees_url":"https://api.github.com/repos/zeekay/decorum/assignees{/user}","branches_url":"https://api.github.com/repos/zeekay/decorum/branches{/branch}","tags_url":"https://api.github.com/repos/zeekay/decorum/tags","blobs_url":"https://api.github.com/repos/zeekay/decorum/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zeekay/decorum/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zeekay/decorum/git/refs{/sha}","trees_url":"https://api.github.com/repos/zeekay/decorum/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zeekay/decorum/statuses/{sha}","languages_url":"https://api.github.com/repos/zeekay/decorum/languages","stargazers_url":"https://api.github.com/repos/zeekay/decorum/stargazers","contributors_url":"https://api.github.com/repos/zeekay/decorum/contributors","subscribers_url":"https://api.github.com/repos/zeekay/decorum/subscribers","subscription_url":"https://api.github.com/repos/zeekay/decorum/subscription","commits_url":"https://api.github.com/repos/zeekay/decorum/commits{/sha}","git_commits_url":"https://api.github.com/repos/zeekay/decorum/git/commits{/sha}","comments_url":"https://api.github.com/repos/zeekay/decorum/comments{/number}","issue_comment_url":"https://api.github.com/repos/zeekay/decorum/issues/comments{/number}","contents_url":"https://api.github.com/repos/zeekay/decorum/contents/{+path}","compare_url":"https://api.github.com/repos/zeekay/decorum/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zeekay/decorum/merges","archive_url":"https://api.github.com/repos/zeekay/decorum/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zeekay/decorum/downloads","issues_url":"https://api.github.com/repos/zeekay/decorum/issues{/number}","pulls_url":"https://api.github.com/repos/zeekay/decorum/pulls{/number}","milestones_url":"https://api.github.com/repos/zeekay/decorum/milestones{/number}","notifications_url":"https://api.github.com/repos/zeekay/decorum/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zeekay/decorum/labels{/name}","releases_url":"https://api.github.com/repos/zeekay/decorum/releases{/id}","created_at":"2011-05-13T22:05:57Z","updated_at":"2014-09-26T07:19:29Z","pushed_at":"2015-08-06T16:35:02Z","git_url":"git://github.com/zeekay/decorum.git","ssh_url":"git@github.com:zeekay/decorum.git","clone_url":"https://github.com/zeekay/decorum.git","svn_url":"https://github.com/zeekay/decorum","homepage":"","size":260,"stargazers_count":6,"watchers_count":6,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":6,"forks":1,"open_issues":6,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zeekay/decorum/pulls/25"},"html":{"href":"https://github.com/zeekay/decorum/pull/25"},"issue":{"href":"https://api.github.com/repos/zeekay/decorum/issues/25"},"comments":{"href":"https://api.github.com/repos/zeekay/decorum/issues/25/comments"},"review_comments":{"href":"https://api.github.com/repos/zeekay/decorum/pulls/25/comments"},"review_comment":{"href":"https://api.github.com/repos/zeekay/decorum/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zeekay/decorum/pulls/25/commits"},"statuses":{"href":"https://api.github.com/repos/zeekay/decorum/statuses/843156fc59d3a94fc65f6834720a30c8cc311a01"}}}}