GitHub PullRequestReviewCommentEvent at 2014-05-03 11:20:21
Repository: gpx2spatialite
Actor: ptrv
Payload: {"comment":{"url":"https://api.github.com/repos/ptrv/gpx2spatialite/pulls/comments/12256006","id":12256006,"diff_hunk":"@@ -0,0 +1,156 @@\n+#!/usr/bin/env python\n+# -*- coding: utf-8 -*-\n+\n+\"\"\"\n+gpx2spatialite_updatelocs\n+2014/04/28 20:30:33\n+\n+Separate script to handle updating locations in the database if you\n+have changed citydefs by adding locations or redifining existing ones.\n+\n+Copyright 2014 Daniel Belasco Rogers danbelasco@yahoo.co.uk\n+\"\"\"\n+\n+import sys\n+from optparse import OptionParser\n+from os import path\n+from datetime import datetime\n+import gpx2spatialite as g2s\n+\n+\n+def parseargs():\n+    \"\"\"\n+    parse command line arguments and define options etc\n+    \"\"\"\n+    usage = \"usage: %prog [options] /path/to/database\"\n+    optparser = OptionParser(usage, version=\"%prog 0.1\")\n+    optparser.add_option(\"-a\",\n+                         \"--all-locations\",\n+                         dest=\"all_locs\",\n+                         default=False,\n+                         action=\"store_true\",\n+                         help=\"Scan all points and reset location,\\\n+not just unknown ones\")\n+\n+    (options, args) = optparser.parse_args()\n+    if len(args) != 1:\n+        optparser.error(\"Please enter a database path\")\n+    dbpath = path.expanduser(args[0])\n+\n+    return dbpath, options.all_locs\n+\n+\n+def updatelocs(locationlist, cursor):\n+    \"\"\"\n+    update the table with the list from getlocations\n+    \"\"\"\n+    for l in locationlist:\n+        sql = \"UPDATE trackpoints SET citydef_uid = {0} \".format(l[0])\n+        sql += \"WHERE trkpt_uid = {0}\".format(l[1])\n+        cursor.execute(sql)\n+\n+    return","path":"bin/gpx2spatialite_updatelocs","position":52,"original_position":52,"commit_id":"434430045e1f6b03c2816c7c0a5df4773eb4a8f5","original_commit_id":"434430045e1f6b03c2816c7c0a5df4773eb4a8f5","user":{"login":"ptrv","id":49775,"avatar_url":"https://avatars.githubusercontent.com/u/49775?","gravatar_id":"7bed46e1c078b29fad9f44f8e0a113bd","url":"https://api.github.com/users/ptrv","html_url":"https://github.com/ptrv","followers_url":"https://api.github.com/users/ptrv/followers","following_url":"https://api.github.com/users/ptrv/following{/other_user}","gists_url":"https://api.github.com/users/ptrv/gists{/gist_id}","starred_url":"https://api.github.com/users/ptrv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ptrv/subscriptions","organizations_url":"https://api.github.com/users/ptrv/orgs","repos_url":"https://api.github.com/users/ptrv/repos","events_url":"https://api.github.com/users/ptrv/events{/privacy}","received_events_url":"https://api.github.com/users/ptrv/received_events","type":"User","site_admin":false},"body":"Is `return` here really needed?","created_at":"2014-05-03T11:20:21Z","updated_at":"2014-05-03T11:20:21Z","html_url":"https://github.com/ptrv/gpx2spatialite/pull/17#discussion_r12256006","pull_request_url":"https://api.github.com/repos/ptrv/gpx2spatialite/pulls/17","_links":{"self":{"href":"https://api.github.com/repos/ptrv/gpx2spatialite/pulls/comments/12256006"},"html":{"href":"https://github.com/ptrv/gpx2spatialite/pull/17#discussion_r12256006"},"pull_request":{"href":"https://api.github.com/repos/ptrv/gpx2spatialite/pulls/17"}}}}