{"action":"created","comment":{"url":"https://api.github.com/repos/9livesdata/whylog/pulls/comments/51312330","id":51312330,"diff_hunk":"@@ -0,0 +1,46 @@\n+from abc import ABCMeta, abstractmethod\n+from os import SEEK_SET\n+\n+\n+class AbstractSearcher(object):\n+    pass\n+\n+\n+class IndexSearcher(AbstractSearcher):\n+    pass\n+\n+\n+class DatabaseSearcher(AbstractSearcher):\n+    pass\n+\n+\n+class BacktrackSearcher(AbstractSearcher):\n+    def __init__(self, file_path):\n+        self._file_path = file_path\n+\n+    def _reverse_from_offset(self, offset, buf_size=8192):\n+        \"\"\"\n+\t\ta generator that returns the lines of a file in reverse order\n+\t\tbeginning with the specified offset\n+\t\t\"\"\"\n+        with open(self._file_path) as fh:\n+            fh.seek(offset)\n+            total_size = remaining_size = fh.tell()\n+            reverse_offset = 0\n+            truncated = None\n+            while remaining_size > 0:\n+                reverse_offset = min(total_size, reverse_offset + buf_size)\n+                fh.seek(total_size - reverse_offset, SEEK_SET)\n+                buffer_ = fh.read(min(remaining_size, buf_size))\n+                lines = buffer_.split('\\n')\n+                remaining_size -= buf_size\n+                if truncated is not None:\n+                    if buffer_[-1] is not '\\n':\n+                        lines[-1] += truncated\n+                    else:\n+                        yield truncated\n+                truncated = lines[0]\n+                for index in range(len(lines) - 1, 0, -1):","path":"whylog/client/searchers.py","position":43,"original_position":43,"commit_id":"133630a9a1787693c34f5a2b86f0bf611f44e9c9","original_commit_id":"133630a9a1787693c34f5a2b86f0bf611f44e9c9","user":{"login":"ppolewicz","id":726553,"avatar_url":"https://avatars.githubusercontent.com/u/726553?v=3","gravatar_id":"","url":"https://api.github.com/users/ppolewicz","html_url":"https://github.com/ppolewicz","followers_url":"https://api.github.com/users/ppolewicz/followers","following_url":"https://api.github.com/users/ppolewicz/following{/other_user}","gists_url":"https://api.github.com/users/ppolewicz/gists{/gist_id}","starred_url":"https://api.github.com/users/ppolewicz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ppolewicz/subscriptions","organizations_url":"https://api.github.com/users/ppolewicz/orgs","repos_url":"https://api.github.com/users/ppolewicz/repos","events_url":"https://api.github.com/users/ppolewicz/events{/privacy}","received_events_url":"https://api.github.com/users/ppolewicz/received_events","type":"User","site_admin":false},"body":"Isn't this just\r\n```python\r\nfor line in reversed(lines):\r\n    yield line\r\n```\r\n?\r\n\r\nAnyway, using range here is not a real fix (you need to use `six` or something)","created_at":"2016-01-29T20:36:33Z","updated_at":"2016-01-29T20:36:33Z","html_url":"https://github.com/9livesdata/whylog/pull/42#discussion_r51312330","pull_request_url":"https://api.github.com/repos/9livesdata/whylog/pulls/42","_links":{"self":{"href":"https://api.github.com/repos/9livesdata/whylog/pulls/comments/51312330"},"html":{"href":"https://github.com/9livesdata/whylog/pull/42#discussion_r51312330"},"pull_request":{"href":"https://api.github.com/repos/9livesdata/whylog/pulls/42"}}},"pull_request":{"url":"https://api.github.com/repos/9livesdata/whylog/pulls/42","id":55942350,"html_url":"https://github.com/9livesdata/whylog/pull/42","diff_url":"https://github.com/9livesdata/whylog/pull/42.diff","patch_url":"https://github.com/9livesdata/whylog/pull/42.patch","issue_url":"https://api.github.com/repos/9livesdata/whylog/issues/42","number":42,"state":"open","locked":false,"title":"Client interface basics & _reverse_from_offset in BacktrackSearcher implemented","user":{"login":"konefalg","id":15250752,"avatar_url":"https://avatars.githubusercontent.com/u/15250752?v=3","gravatar_id":"","url":"https://api.github.com/users/konefalg","html_url":"https://github.com/konefalg","followers_url":"https://api.github.com/users/konefalg/followers","following_url":"https://api.github.com/users/konefalg/following{/other_user}","gists_url":"https://api.github.com/users/konefalg/gists{/gist_id}","starred_url":"https://api.github.com/users/konefalg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/konefalg/subscriptions","organizations_url":"https://api.github.com/users/konefalg/orgs","repos_url":"https://api.github.com/users/konefalg/repos","events_url":"https://api.github.com/users/konefalg/events{/privacy}","received_events_url":"https://api.github.com/users/konefalg/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-01-13T19:18:51Z","updated_at":"2016-01-29T20:36:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"564f54ea266eddad8903771082d60ad965258678","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/9livesdata/whylog/pulls/42/commits","review_comments_url":"https://api.github.com/repos/9livesdata/whylog/pulls/42/comments","review_comment_url":"https://api.github.com/repos/9livesdata/whylog/pulls/comments{/number}","comments_url":"https://api.github.com/repos/9livesdata/whylog/issues/42/comments","statuses_url":"https://api.github.com/repos/9livesdata/whylog/statuses/133630a9a1787693c34f5a2b86f0bf611f44e9c9","head":{"label":"konefalg:clientImplementation","ref":"clientImplementation","sha":"133630a9a1787693c34f5a2b86f0bf611f44e9c9","user":{"login":"konefalg","id":15250752,"avatar_url":"https://avatars.githubusercontent.com/u/15250752?v=3","gravatar_id":"","url":"https://api.github.com/users/konefalg","html_url":"https://github.com/konefalg","followers_url":"https://api.github.com/users/konefalg/followers","following_url":"https://api.github.com/users/konefalg/following{/other_user}","gists_url":"https://api.github.com/users/konefalg/gists{/gist_id}","starred_url":"https://api.github.com/users/konefalg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/konefalg/subscriptions","organizations_url":"https://api.github.com/users/konefalg/orgs","repos_url":"https://api.github.com/users/konefalg/repos","events_url":"https://api.github.com/users/konefalg/events{/privacy}","received_events_url":"https://api.github.com/users/konefalg/received_events","type":"User","site_admin":false},"repo":{"id":46664714,"name":"whylog","full_name":"konefalg/whylog","owner":{"login":"konefalg","id":15250752,"avatar_url":"https://avatars.githubusercontent.com/u/15250752?v=3","gravatar_id":"","url":"https://api.github.com/users/konefalg","html_url":"https://github.com/konefalg","followers_url":"https://api.github.com/users/konefalg/followers","following_url":"https://api.github.com/users/konefalg/following{/other_user}","gists_url":"https://api.github.com/users/konefalg/gists{/gist_id}","starred_url":"https://api.github.com/users/konefalg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/konefalg/subscriptions","organizations_url":"https://api.github.com/users/konefalg/orgs","repos_url":"https://api.github.com/users/konefalg/repos","events_url":"https://api.github.com/users/konefalg/events{/privacy}","received_events_url":"https://api.github.com/users/konefalg/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/konefalg/whylog","description":"","fork":true,"url":"https://api.github.com/repos/konefalg/whylog","forks_url":"https://api.github.com/repos/konefalg/whylog/forks","keys_url":"https://api.github.com/repos/konefalg/whylog/keys{/key_id}","collaborators_url":"https://api.github.com/repos/konefalg/whylog/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/konefalg/whylog/teams","hooks_url":"https://api.github.com/repos/konefalg/whylog/hooks","issue_events_url":"https://api.github.com/repos/konefalg/whylog/issues/events{/number}","events_url":"https://api.github.com/repos/konefalg/whylog/events","assignees_url":"https://api.github.com/repos/konefalg/whylog/assignees{/user}","branches_url":"https://api.github.com/repos/konefalg/whylog/branches{/branch}","tags_url":"https://api.github.com/repos/konefalg/whylog/tags","blobs_url":"https://api.github.com/repos/konefalg/whylog/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/konefalg/whylog/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/konefalg/whylog/git/refs{/sha}","trees_url":"https://api.github.com/repos/konefalg/whylog/git/trees{/sha}","statuses_url":"https://api.github.com/repos/konefalg/whylog/statuses/{sha}","languages_url":"https://api.github.com/repos/konefalg/whylog/languages","stargazers_url":"https://api.github.com/repos/konefalg/whylog/stargazers","contributors_url":"https://api.github.com/repos/konefalg/whylog/contributors","subscribers_url":"https://api.github.com/repos/konefalg/whylog/subscribers","subscription_url":"https://api.github.com/repos/konefalg/whylog/subscription","commits_url":"https://api.github.com/repos/konefalg/whylog/commits{/sha}","git_commits_url":"https://api.github.com/repos/konefalg/whylog/git/commits{/sha}","comments_url":"https://api.github.com/repos/konefalg/whylog/comments{/number}","issue_comment_url":"https://api.github.com/repos/konefalg/whylog/issues/comments{/number}","contents_url":"https://api.github.com/repos/konefalg/whylog/contents/{+path}","compare_url":"https://api.github.com/repos/konefalg/whylog/compare/{base}...{head}","merges_url":"https://api.github.com/repos/konefalg/whylog/merges","archive_url":"https://api.github.com/repos/konefalg/whylog/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/konefalg/whylog/downloads","issues_url":"https://api.github.com/repos/konefalg/whylog/issues{/number}","pulls_url":"https://api.github.com/repos/konefalg/whylog/pulls{/number}","milestones_url":"https://api.github.com/repos/konefalg/whylog/milestones{/number}","notifications_url":"https://api.github.com/repos/konefalg/whylog/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/konefalg/whylog/labels{/name}","releases_url":"https://api.github.com/repos/konefalg/whylog/releases{/id}","deployments_url":"https://api.github.com/repos/konefalg/whylog/deployments","created_at":"2015-11-22T14:45:25Z","updated_at":"2016-01-18T19:38:18Z","pushed_at":"2016-01-29T08:30:30Z","git_url":"git://github.com/konefalg/whylog.git","ssh_url":"git@github.com:konefalg/whylog.git","clone_url":"https://github.com/konefalg/whylog.git","svn_url":"https://github.com/konefalg/whylog","homepage":null,"size":163,"stargazers_count":0,"watchers_count":0,"language":"PowerShell","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":"9livesdata:master","ref":"master","sha":"d67fade8e7450503472a617cc8c4d6c1aa984a1f","user":{"login":"9livesdata","id":15250580,"avatar_url":"https://avatars.githubusercontent.com/u/15250580?v=3","gravatar_id":"","url":"https://api.github.com/users/9livesdata","html_url":"https://github.com/9livesdata","followers_url":"https://api.github.com/users/9livesdata/followers","following_url":"https://api.github.com/users/9livesdata/following{/other_user}","gists_url":"https://api.github.com/users/9livesdata/gists{/gist_id}","starred_url":"https://api.github.com/users/9livesdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/9livesdata/subscriptions","organizations_url":"https://api.github.com/users/9livesdata/orgs","repos_url":"https://api.github.com/users/9livesdata/repos","events_url":"https://api.github.com/users/9livesdata/events{/privacy}","received_events_url":"https://api.github.com/users/9livesdata/received_events","type":"Organization","site_admin":false},"repo":{"id":44754618,"name":"whylog","full_name":"9livesdata/whylog","owner":{"login":"9livesdata","id":15250580,"avatar_url":"https://avatars.githubusercontent.com/u/15250580?v=3","gravatar_id":"","url":"https://api.github.com/users/9livesdata","html_url":"https://github.com/9livesdata","followers_url":"https://api.github.com/users/9livesdata/followers","following_url":"https://api.github.com/users/9livesdata/following{/other_user}","gists_url":"https://api.github.com/users/9livesdata/gists{/gist_id}","starred_url":"https://api.github.com/users/9livesdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/9livesdata/subscriptions","organizations_url":"https://api.github.com/users/9livesdata/orgs","repos_url":"https://api.github.com/users/9livesdata/repos","events_url":"https://api.github.com/users/9livesdata/events{/privacy}","received_events_url":"https://api.github.com/users/9livesdata/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/9livesdata/whylog","description":"","fork":false,"url":"https://api.github.com/repos/9livesdata/whylog","forks_url":"https://api.github.com/repos/9livesdata/whylog/forks","keys_url":"https://api.github.com/repos/9livesdata/whylog/keys{/key_id}","collaborators_url":"https://api.github.com/repos/9livesdata/whylog/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/9livesdata/whylog/teams","hooks_url":"https://api.github.com/repos/9livesdata/whylog/hooks","issue_events_url":"https://api.github.com/repos/9livesdata/whylog/issues/events{/number}","events_url":"https://api.github.com/repos/9livesdata/whylog/events","assignees_url":"https://api.github.com/repos/9livesdata/whylog/assignees{/user}","branches_url":"https://api.github.com/repos/9livesdata/whylog/branches{/branch}","tags_url":"https://api.github.com/repos/9livesdata/whylog/tags","blobs_url":"https://api.github.com/repos/9livesdata/whylog/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/9livesdata/whylog/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/9livesdata/whylog/git/refs{/sha}","trees_url":"https://api.github.com/repos/9livesdata/whylog/git/trees{/sha}","statuses_url":"https://api.github.com/repos/9livesdata/whylog/statuses/{sha}","languages_url":"https://api.github.com/repos/9livesdata/whylog/languages","stargazers_url":"https://api.github.com/repos/9livesdata/whylog/stargazers","contributors_url":"https://api.github.com/repos/9livesdata/whylog/contributors","subscribers_url":"https://api.github.com/repos/9livesdata/whylog/subscribers","subscription_url":"https://api.github.com/repos/9livesdata/whylog/subscription","commits_url":"https://api.github.com/repos/9livesdata/whylog/commits{/sha}","git_commits_url":"https://api.github.com/repos/9livesdata/whylog/git/commits{/sha}","comments_url":"https://api.github.com/repos/9livesdata/whylog/comments{/number}","issue_comment_url":"https://api.github.com/repos/9livesdata/whylog/issues/comments{/number}","contents_url":"https://api.github.com/repos/9livesdata/whylog/contents/{+path}","compare_url":"https://api.github.com/repos/9livesdata/whylog/compare/{base}...{head}","merges_url":"https://api.github.com/repos/9livesdata/whylog/merges","archive_url":"https://api.github.com/repos/9livesdata/whylog/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/9livesdata/whylog/downloads","issues_url":"https://api.github.com/repos/9livesdata/whylog/issues{/number}","pulls_url":"https://api.github.com/repos/9livesdata/whylog/pulls{/number}","milestones_url":"https://api.github.com/repos/9livesdata/whylog/milestones{/number}","notifications_url":"https://api.github.com/repos/9livesdata/whylog/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/9livesdata/whylog/labels{/name}","releases_url":"https://api.github.com/repos/9livesdata/whylog/releases{/id}","deployments_url":"https://api.github.com/repos/9livesdata/whylog/deployments","created_at":"2015-10-22T15:28:20Z","updated_at":"2016-01-11T19:52:23Z","pushed_at":"2016-01-29T08:30:31Z","git_url":"git://github.com/9livesdata/whylog.git","ssh_url":"git@github.com:9livesdata/whylog.git","clone_url":"https://github.com/9livesdata/whylog.git","svn_url":"https://github.com/9livesdata/whylog","homepage":null,"size":455,"stargazers_count":0,"watchers_count":0,"language":"PowerShell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":14,"forks":5,"open_issues":14,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/9livesdata/whylog/pulls/42"},"html":{"href":"https://github.com/9livesdata/whylog/pull/42"},"issue":{"href":"https://api.github.com/repos/9livesdata/whylog/issues/42"},"comments":{"href":"https://api.github.com/repos/9livesdata/whylog/issues/42/comments"},"review_comments":{"href":"https://api.github.com/repos/9livesdata/whylog/pulls/42/comments"},"review_comment":{"href":"https://api.github.com/repos/9livesdata/whylog/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/9livesdata/whylog/pulls/42/commits"},"statuses":{"href":"https://api.github.com/repos/9livesdata/whylog/statuses/133630a9a1787693c34f5a2b86f0bf611f44e9c9"}}}}