GitHub PullRequestReviewCommentEvent at 2014-12-07 13:11:29
Repository: vital.vim
Actor: haya14busa
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/vim-jp/vital.vim/pulls/comments/21424387","id":21424387,"diff_hunk":"@@ -0,0 +1,251 @@\n+let s:save_cpo = &cpo\n+set cpo&vim\n+\n+let s:TRUE = !0\n+let s:FALSE = 0\n+\n+function! s:set(...) abort\n+  return s:set._new(get(a:, 1, []))\n+endfunction\n+\n+function! s:frozenset(...) abort\n+  return s:frozenset._new(get(a:, 1, []))\n+endfunction\n+\n+let s:_base_set = {\n+\\   '_is_set' : s:TRUE,\n+\\   '_data' : {}\n+\\ }\n+\n+function! s:_base_set._new(...) abort\n+  let obj = deepcopy(self)\n+  let obj._data = {}\n+  let xs = a:0 > 1 ? a:000 : get(a:, 1, [])\n+  call obj._update(xs)\n+  return obj\n+endfunction\n+\n+\"\" Return the union of two sets as a new set.\n+\" (I.e. all elements that are in either set.)\n+function! s:_base_set.union(t) abort\n+  let r = deepcopy(self)\n+  call r._update(a:t)\n+  return r\n+endfunction\n+let s:_base_set.or = s:_base_set.union\n+\n+\"\" Return the intersection of two sets as a new set.\n+\" (I.e. all elements that are in both sets.)\n+function! s:_base_set.intersection(t) abort\n+  let t = self._to_set(a:t)\n+  let [little, big] = self.len() <= t.len() ? [self, t] : [t, self]\n+  return self._new(filter(copy(big.to_list()), 'little.__contains__(v:val)'))\n+endfunction\n+let s:_base_set.and = s:_base_set.intersection\n+\n+\"\" Return the symmetric difference of two sets as a new set.\n+\" (I.e. all elements that are in exactly one of the sets.)\n+function! s:_base_set.symmetric_difference(t) abort\n+  let t = self._to_set(a:t)\n+  return self._new(filter(copy(self.to_list()), '!t.__contains__(v:val)')\n+  \\             + filter(copy(t.to_list()), '!self.__contains__(v:val)'))\n+endfunction\n+let s:_base_set.xor = s:_base_set.symmetric_difference\n+\n+\"\" Return the difference of two sets as a new Set.\n+function! s:_base_set.difference(t) abort\n+  let t = self._to_set(a:t)\n+  return self._new(filter(copy(self.to_list()), '!t.__contains__(v:val)'))\n+endfunction\n+let s:_base_set.sub = s:_base_set.difference\n+\n+\"\" Report whether another set contains this set.\n+function! s:_base_set.issubset(t) abort\n+  let t = self._to_set(a:t)\n+  return self.len() > t.len() ? s:FALSE\n+  \\   : empty(filter(copy(self.to_list()), '!t.__contains__(v:val)'))\n+endfunction\n+\n+\"\" Report whether this set contains another set.\n+function! s:_base_set.issuperset(t) abort\n+  let t = self._to_set(a:t)\n+  return self.len() < t.len() ? s:FALSE\n+  \\   : empty(filter(copy(t.to_list()), '!self.__contains__(v:val)'))\n+endfunction\n+\n+\" less than equal & greater than equal\n+let s:_base_set.le = s:_base_set.issubset\n+let s:_base_set.ge = s:_base_set.issuperset\n+\n+\" less than\n+function! s:_base_set.lt(t) abort\n+  let t = self._to_set(a:t)\n+  return self.len() < t.len() && self.issubset(t)\n+endfunction\n+\n+\" greater than\n+function! s:_base_set.gt(t) abort\n+  let t = self._to_set(a:t)\n+  return self.len() > t.len() && self.issuperset(t)\n+endfunction\n+\n+function! s:_base_set.len() abort\n+  return len(self._data)\n+endfunction\n+\n+function! s:_base_set.to_list() abort\n+  return values(self._data)\n+endfunction\n+\n+function! s:_base_set._update(xs) abort\n+  if s:_is_set(a:xs)\n+    call self.update(a:xs.to_list())\n+    return\n+  endif\n+  for X in a:xs\n+    call self._add(X)\n+    unlet X | endfor\n+endfunction\n+\n+function! s:_base_set._add(x) abort\n+  let self._data[string(a:x)] = a:x","path":"autoload/vital/__latest__/Data/Set.vim","position":111,"original_position":111,"commit_id":"2a338ecec24b0a27f44301e250e5108660ae8cc1","original_commit_id":"2a338ecec24b0a27f44301e250e5108660ae8cc1","user":{"login":"haya14busa","id":3797062,"avatar_url":"https://avatars.githubusercontent.com/u/3797062?v=3","gravatar_id":"","url":"https://api.github.com/users/haya14busa","html_url":"https://github.com/haya14busa","followers_url":"https://api.github.com/users/haya14busa/followers","following_url":"https://api.github.com/users/haya14busa/following{/other_user}","gists_url":"https://api.github.com/users/haya14busa/gists{/gist_id}","starred_url":"https://api.github.com/users/haya14busa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haya14busa/subscriptions","organizations_url":"https://api.github.com/users/haya14busa/orgs","repos_url":"https://api.github.com/users/haya14busa/repos","events_url":"https://api.github.com/users/haya14busa/events{/privacy}","received_events_url":"https://api.github.com/users/haya14busa/received_events","type":"User","site_admin":false},"body":"うー確かに...\r\n\r\n> !!!TypeError: unhashable type: 'dict'!!!\r\n\r\npythonだと `dict` や `list`に対してはそもそも受け入れてないですね.(ならそもそも弾けという話ではある)\r\n \r\nつまりこれを実装したら解決しそうデスかね https://github.com/vim-jp/vital.vim/pull/239#issuecomment-65936059","created_at":"2014-12-07T13:11:29Z","updated_at":"2014-12-07T13:11:29Z","html_url":"https://github.com/vim-jp/vital.vim/pull/239#discussion_r21424387","pull_request_url":"https://api.github.com/repos/vim-jp/vital.vim/pulls/239","_links":{"self":{"href":"https://api.github.com/repos/vim-jp/vital.vim/pulls/comments/21424387"},"html":{"href":"https://github.com/vim-jp/vital.vim/pull/239#discussion_r21424387"},"pull_request":{"href":"https://api.github.com/repos/vim-jp/vital.vim/pulls/239"}}},"pull_request":{"url":"https://api.github.com/repos/vim-jp/vital.vim/pulls/239","id":25629801,"html_url":"https://github.com/vim-jp/vital.vim/pull/239","diff_url":"https://github.com/vim-jp/vital.vim/pull/239.diff","patch_url":"https://github.com/vim-jp/vital.vim/pull/239.patch","issue_url":"https://api.github.com/repos/vim-jp/vital.vim/issues/239","number":239,"state":"open","locked":false,"title":"Add Data.Set module","user":{"login":"haya14busa","id":3797062,"avatar_url":"https://avatars.githubusercontent.com/u/3797062?v=3","gravatar_id":"","url":"https://api.github.com/users/haya14busa","html_url":"https://github.com/haya14busa","followers_url":"https://api.github.com/users/haya14busa/followers","following_url":"https://api.github.com/users/haya14busa/following{/other_user}","gists_url":"https://api.github.com/users/haya14busa/gists{/gist_id}","starred_url":"https://api.github.com/users/haya14busa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haya14busa/subscriptions","organizations_url":"https://api.github.com/users/haya14busa/orgs","repos_url":"https://api.github.com/users/haya14busa/repos","events_url":"https://api.github.com/users/haya14busa/events{/privacy}","received_events_url":"https://api.github.com/users/haya14busa/received_events","type":"User","site_admin":false},"body":"python の 2.7 のset ライブラリと 3.4 の仕様(と少しソースコード)を参考に vitalに移植してみました\r\n\r\n- ref: https://docs.python.org/3.4/library/stdtypes.html#set-types-set-frozenset","created_at":"2014-12-07T08:40:07Z","updated_at":"2014-12-07T13:11:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0a219b4567c1f9eb1f612f11964653cf0de93067","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/vim-jp/vital.vim/pulls/239/commits","review_comments_url":"https://api.github.com/repos/vim-jp/vital.vim/pulls/239/comments","review_comment_url":"https://api.github.com/repos/vim-jp/vital.vim/pulls/comments/{number}","comments_url":"https://api.github.com/repos/vim-jp/vital.vim/issues/239/comments","statuses_url":"https://api.github.com/repos/vim-jp/vital.vim/statuses/2a338ecec24b0a27f44301e250e5108660ae8cc1","head":{"label":"haya14busa:add-set-module","ref":"add-set-module","sha":"2a338ecec24b0a27f44301e250e5108660ae8cc1","user":{"login":"haya14busa","id":3797062,"avatar_url":"https://avatars.githubusercontent.com/u/3797062?v=3","gravatar_id":"","url":"https://api.github.com/users/haya14busa","html_url":"https://github.com/haya14busa","followers_url":"https://api.github.com/users/haya14busa/followers","following_url":"https://api.github.com/users/haya14busa/following{/other_user}","gists_url":"https://api.github.com/users/haya14busa/gists{/gist_id}","starred_url":"https://api.github.com/users/haya14busa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haya14busa/subscriptions","organizations_url":"https://api.github.com/users/haya14busa/orgs","repos_url":"https://api.github.com/users/haya14busa/repos","events_url":"https://api.github.com/users/haya14busa/events{/privacy}","received_events_url":"https://api.github.com/users/haya14busa/received_events","type":"User","site_admin":false},"repo":{"id":15549697,"name":"vital.vim","full_name":"haya14busa/vital.vim","owner":{"login":"haya14busa","id":3797062,"avatar_url":"https://avatars.githubusercontent.com/u/3797062?v=3","gravatar_id":"","url":"https://api.github.com/users/haya14busa","html_url":"https://github.com/haya14busa","followers_url":"https://api.github.com/users/haya14busa/followers","following_url":"https://api.github.com/users/haya14busa/following{/other_user}","gists_url":"https://api.github.com/users/haya14busa/gists{/gist_id}","starred_url":"https://api.github.com/users/haya14busa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haya14busa/subscriptions","organizations_url":"https://api.github.com/users/haya14busa/orgs","repos_url":"https://api.github.com/users/haya14busa/repos","events_url":"https://api.github.com/users/haya14busa/events{/privacy}","received_events_url":"https://api.github.com/users/haya14busa/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/haya14busa/vital.vim","description":"A comprehensive Vim utility functions for Vim plugins","fork":true,"url":"https://api.github.com/repos/haya14busa/vital.vim","forks_url":"https://api.github.com/repos/haya14busa/vital.vim/forks","keys_url":"https://api.github.com/repos/haya14busa/vital.vim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/haya14busa/vital.vim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/haya14busa/vital.vim/teams","hooks_url":"https://api.github.com/repos/haya14busa/vital.vim/hooks","issue_events_url":"https://api.github.com/repos/haya14busa/vital.vim/issues/events{/number}","events_url":"https://api.github.com/repos/haya14busa/vital.vim/events","assignees_url":"https://api.github.com/repos/haya14busa/vital.vim/assignees{/user}","branches_url":"https://api.github.com/repos/haya14busa/vital.vim/branches{/branch}","tags_url":"https://api.github.com/repos/haya14busa/vital.vim/tags","blobs_url":"https://api.github.com/repos/haya14busa/vital.vim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/haya14busa/vital.vim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/haya14busa/vital.vim/git/refs{/sha}","trees_url":"https://api.github.com/repos/haya14busa/vital.vim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/haya14busa/vital.vim/statuses/{sha}","languages_url":"https://api.github.com/repos/haya14busa/vital.vim/languages","stargazers_url":"https://api.github.com/repos/haya14busa/vital.vim/stargazers","contributors_url":"https://api.github.com/repos/haya14busa/vital.vim/contributors","subscribers_url":"https://api.github.com/repos/haya14busa/vital.vim/subscribers","subscription_url":"https://api.github.com/repos/haya14busa/vital.vim/subscription","commits_url":"https://api.github.com/repos/haya14busa/vital.vim/commits{/sha}","git_commits_url":"https://api.github.com/repos/haya14busa/vital.vim/git/commits{/sha}","comments_url":"https://api.github.com/repos/haya14busa/vital.vim/comments{/number}","issue_comment_url":"https://api.github.com/repos/haya14busa/vital.vim/issues/comments/{number}","contents_url":"https://api.github.com/repos/haya14busa/vital.vim/contents/{+path}","compare_url":"https://api.github.com/repos/haya14busa/vital.vim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/haya14busa/vital.vim/merges","archive_url":"https://api.github.com/repos/haya14busa/vital.vim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/haya14busa/vital.vim/downloads","issues_url":"https://api.github.com/repos/haya14busa/vital.vim/issues{/number}","pulls_url":"https://api.github.com/repos/haya14busa/vital.vim/pulls{/number}","milestones_url":"https://api.github.com/repos/haya14busa/vital.vim/milestones{/number}","notifications_url":"https://api.github.com/repos/haya14busa/vital.vim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/haya14busa/vital.vim/labels{/name}","releases_url":"https://api.github.com/repos/haya14busa/vital.vim/releases{/id}","created_at":"2013-12-31T12:39:12Z","updated_at":"2013-12-31T13:42:33Z","pushed_at":"2014-12-07T08:37:20Z","git_url":"git://github.com/haya14busa/vital.vim.git","ssh_url":"git@github.com:haya14busa/vital.vim.git","clone_url":"https://github.com/haya14busa/vital.vim.git","svn_url":"https://github.com/haya14busa/vital.vim","homepage":"","size":1358,"stargazers_count":0,"watchers_count":0,"language":"VimL","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":"vim-jp:master","ref":"master","sha":"f4b1e536ccf5c7a26428dc4e49e18fa43f4b31de","user":{"login":"vim-jp","id":1051958,"avatar_url":"https://avatars.githubusercontent.com/u/1051958?v=3","gravatar_id":"","url":"https://api.github.com/users/vim-jp","html_url":"https://github.com/vim-jp","followers_url":"https://api.github.com/users/vim-jp/followers","following_url":"https://api.github.com/users/vim-jp/following{/other_user}","gists_url":"https://api.github.com/users/vim-jp/gists{/gist_id}","starred_url":"https://api.github.com/users/vim-jp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vim-jp/subscriptions","organizations_url":"https://api.github.com/users/vim-jp/orgs","repos_url":"https://api.github.com/users/vim-jp/repos","events_url":"https://api.github.com/users/vim-jp/events{/privacy}","received_events_url":"https://api.github.com/users/vim-jp/received_events","type":"Organization","site_admin":false},"repo":{"id":1308435,"name":"vital.vim","full_name":"vim-jp/vital.vim","owner":{"login":"vim-jp","id":1051958,"avatar_url":"https://avatars.githubusercontent.com/u/1051958?v=3","gravatar_id":"","url":"https://api.github.com/users/vim-jp","html_url":"https://github.com/vim-jp","followers_url":"https://api.github.com/users/vim-jp/followers","following_url":"https://api.github.com/users/vim-jp/following{/other_user}","gists_url":"https://api.github.com/users/vim-jp/gists{/gist_id}","starred_url":"https://api.github.com/users/vim-jp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vim-jp/subscriptions","organizations_url":"https://api.github.com/users/vim-jp/orgs","repos_url":"https://api.github.com/users/vim-jp/repos","events_url":"https://api.github.com/users/vim-jp/events{/privacy}","received_events_url":"https://api.github.com/users/vim-jp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/vim-jp/vital.vim","description":"A comprehensive Vim utility functions for Vim plugins","fork":false,"url":"https://api.github.com/repos/vim-jp/vital.vim","forks_url":"https://api.github.com/repos/vim-jp/vital.vim/forks","keys_url":"https://api.github.com/repos/vim-jp/vital.vim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vim-jp/vital.vim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vim-jp/vital.vim/teams","hooks_url":"https://api.github.com/repos/vim-jp/vital.vim/hooks","issue_events_url":"https://api.github.com/repos/vim-jp/vital.vim/issues/events{/number}","events_url":"https://api.github.com/repos/vim-jp/vital.vim/events","assignees_url":"https://api.github.com/repos/vim-jp/vital.vim/assignees{/user}","branches_url":"https://api.github.com/repos/vim-jp/vital.vim/branches{/branch}","tags_url":"https://api.github.com/repos/vim-jp/vital.vim/tags","blobs_url":"https://api.github.com/repos/vim-jp/vital.vim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vim-jp/vital.vim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vim-jp/vital.vim/git/refs{/sha}","trees_url":"https://api.github.com/repos/vim-jp/vital.vim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vim-jp/vital.vim/statuses/{sha}","languages_url":"https://api.github.com/repos/vim-jp/vital.vim/languages","stargazers_url":"https://api.github.com/repos/vim-jp/vital.vim/stargazers","contributors_url":"https://api.github.com/repos/vim-jp/vital.vim/contributors","subscribers_url":"https://api.github.com/repos/vim-jp/vital.vim/subscribers","subscription_url":"https://api.github.com/repos/vim-jp/vital.vim/subscription","commits_url":"https://api.github.com/repos/vim-jp/vital.vim/commits{/sha}","git_commits_url":"https://api.github.com/repos/vim-jp/vital.vim/git/commits{/sha}","comments_url":"https://api.github.com/repos/vim-jp/vital.vim/comments{/number}","issue_comment_url":"https://api.github.com/repos/vim-jp/vital.vim/issues/comments/{number}","contents_url":"https://api.github.com/repos/vim-jp/vital.vim/contents/{+path}","compare_url":"https://api.github.com/repos/vim-jp/vital.vim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vim-jp/vital.vim/merges","archive_url":"https://api.github.com/repos/vim-jp/vital.vim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vim-jp/vital.vim/downloads","issues_url":"https://api.github.com/repos/vim-jp/vital.vim/issues{/number}","pulls_url":"https://api.github.com/repos/vim-jp/vital.vim/pulls{/number}","milestones_url":"https://api.github.com/repos/vim-jp/vital.vim/milestones{/number}","notifications_url":"https://api.github.com/repos/vim-jp/vital.vim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vim-jp/vital.vim/labels{/name}","releases_url":"https://api.github.com/repos/vim-jp/vital.vim/releases{/id}","created_at":"2011-01-30T08:40:37Z","updated_at":"2014-12-05T02:32:35Z","pushed_at":"2014-12-05T14:57:54Z","git_url":"git://github.com/vim-jp/vital.vim.git","ssh_url":"git@github.com:vim-jp/vital.vim.git","clone_url":"https://github.com/vim-jp/vital.vim.git","svn_url":"https://github.com/vim-jp/vital.vim","homepage":"","size":5229,"stargazers_count":151,"watchers_count":151,"language":"VimL","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":32,"mirror_url":null,"open_issues_count":47,"forks":32,"open_issues":47,"watchers":151,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/vim-jp/vital.vim/pulls/239"},"html":{"href":"https://github.com/vim-jp/vital.vim/pull/239"},"issue":{"href":"https://api.github.com/repos/vim-jp/vital.vim/issues/239"},"comments":{"href":"https://api.github.com/repos/vim-jp/vital.vim/issues/239/comments"},"review_comments":{"href":"https://api.github.com/repos/vim-jp/vital.vim/pulls/239/comments"},"review_comment":{"href":"https://api.github.com/repos/vim-jp/vital.vim/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/vim-jp/vital.vim/pulls/239/commits"},"statuses":{"href":"https://api.github.com/repos/vim-jp/vital.vim/statuses/2a338ecec24b0a27f44301e250e5108660ae8cc1"}}}}