)]}'
{"neutron/agent/linux/dhcp.py":[{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"14af2e5e6c1e965699e67d449179b7a63e191a80","unresolved":false,"context_lines":[{"line_number":595,"context_line":"        try:"},{"line_number":596,"context_line":"            with open(filename) as f:"},{"line_number":597,"context_line":"                for l in f.readlines():"},{"line_number":598,"context_line":"                    host \u003d l.strip().split(\u0027,\u0027)"},{"line_number":599,"context_line":"                    mac \u003d host.pop(0)"},{"line_number":600,"context_line":""},{"line_number":601,"context_line":"                    client_id \u003d None"}],"source_content_type":"text/x-python","patch_set":3,"id":"3afb71cf_70b7b986","line":598,"updated":"2015-06-08 19:07:10.000000000","message":"ah, now you can see why I prefer to avoid popping ;-)\nHere\u0027s one more option but I won\u0027t block if you want to stay with the conditional pop.\n\nparts \u003d l.strip().split(\u0027,\u0027)\nmac \u003d parts[0]\nclient_id \u003d (parts[1][len(self._ID):]\n             if parts[1].startswith(self._ID) else None)\nip \u003d (parts[3] if client_id else parts[2]).strip(\u0027[]\u0027)","commit_id":"ac8ce483d44cd770d5908861b7f52d0d76beea30"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"07d75626f77a872bb91cc9f1310f865ad2c9a186","unresolved":false,"context_lines":[{"line_number":595,"context_line":"        try:"},{"line_number":596,"context_line":"            with open(filename) as f:"},{"line_number":597,"context_line":"                for l in f.readlines():"},{"line_number":598,"context_line":"                    host \u003d l.strip().split(\u0027,\u0027)"},{"line_number":599,"context_line":"                    mac \u003d host.pop(0)"},{"line_number":600,"context_line":""},{"line_number":601,"context_line":"                    client_id \u003d None"}],"source_content_type":"text/x-python","patch_set":3,"id":"3afb71cf_c9402ea8","line":598,"updated":"2015-06-08 05:52:18.000000000","message":"instead of this popping business, what do you think of just unpacking it all in the split? It doesn\u0027t look like we handle missing fields or anything.\n\nmac, client_id, name, ip \u003d l.strip().split(\u0027,\u0027)[0:4]","commit_id":"ac8ce483d44cd770d5908861b7f52d0d76beea30"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"9a6e3d35f5f73dbbbd3b387b526829b0f382d637","unresolved":false,"context_lines":[{"line_number":595,"context_line":"        try:"},{"line_number":596,"context_line":"            with open(filename) as f:"},{"line_number":597,"context_line":"                for l in f.readlines():"},{"line_number":598,"context_line":"                    host \u003d l.strip().split(\u0027,\u0027)"},{"line_number":599,"context_line":"                    mac \u003d host.pop(0)"},{"line_number":600,"context_line":""},{"line_number":601,"context_line":"                    client_id \u003d None"}],"source_content_type":"text/x-python","patch_set":3,"id":"3afb71cf_b85628d0","line":598,"in_reply_to":"3afb71cf_3c435a44","updated":"2015-06-09 05:16:11.000000000","message":"I would just stick with the pop method over that because it still doesn\u0027t address the main issue I have which is the \u0027side-effect-driven\u0027 logic. (i.e. next() and pop() both return something but mutate something else at the same time so they have to be called a specific number of times to get what you are looking for)\n\nWhatever you decide, it would be good to separate the parsing code into a little staticmethod so we can write some easy unit tests without having to check how \u0027leases\u0027 is modified.","commit_id":"ac8ce483d44cd770d5908861b7f52d0d76beea30"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"aabd9200001343d83836a6ec207c43b8558a1535","unresolved":false,"context_lines":[{"line_number":595,"context_line":"        try:"},{"line_number":596,"context_line":"            with open(filename) as f:"},{"line_number":597,"context_line":"                for l in f.readlines():"},{"line_number":598,"context_line":"                    host \u003d l.strip().split(\u0027,\u0027)"},{"line_number":599,"context_line":"                    mac \u003d host.pop(0)"},{"line_number":600,"context_line":""},{"line_number":601,"context_line":"                    client_id \u003d None"}],"source_content_type":"text/x-python","patch_set":3,"id":"3afb71cf_3c435a44","line":598,"in_reply_to":"3afb71cf_70b7b986","updated":"2015-06-08 20:20:45.000000000","message":"Hmmm.  That has readability problems of its own IMO.  What if I can do something like below.  I think the idea of a cursor avoids absolute positions at all.  IMO, the peek/next pattern for client_id communicates the dependence of the rest of the positions on the existence of this column.\n\n                    cursor \u003d utils.LookaheadIterator(l.strip().split(\u0027,\u0027))\n                    mac \u003d cursor.next()\n\n                    client_id \u003d None\n                    if cursor.peek().startswith(self._ID):\n                        client_id \u003d cursor.next()[len(self._ID):]\n\n                    # Ignore the name field in the file.\n                    cursor.next()\n\n                    ip \u003d cursor.next().strip(\u0027[]\u0027)\n\n                    # Also ignoring the last optional \"set:port_id\" field\n\n                    leases.add((ip, mac, client_id))","commit_id":"ac8ce483d44cd770d5908861b7f52d0d76beea30"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"301e1684a8eb7aed053cafc211bb3122918bbbbf","unresolved":false,"context_lines":[{"line_number":595,"context_line":"        try:"},{"line_number":596,"context_line":"            with open(filename) as f:"},{"line_number":597,"context_line":"                for l in f.readlines():"},{"line_number":598,"context_line":"                    host \u003d l.strip().split(\u0027,\u0027)"},{"line_number":599,"context_line":"                    mac \u003d host.pop(0)"},{"line_number":600,"context_line":""},{"line_number":601,"context_line":"                    client_id \u003d None"}],"source_content_type":"text/x-python","patch_set":3,"id":"3afb71cf_534172a8","line":598,"in_reply_to":"3afb71cf_89ab561d","updated":"2015-06-08 15:38:14.000000000","message":"+1 to @Gal\u0027s response.  I\u0027m open to alternatives but I did look at split and there doesn\u0027t seem to be an elegant way to use split.","commit_id":"ac8ce483d44cd770d5908861b7f52d0d76beea30"},{"author":{"_account_id":11343,"name":"Gal Sagie","email":"gal.sagie@gmail.com","username":"GalSagie"},"change_message_id":"8646ad631837023942b9b73bbaaeefa91e8256a3","unresolved":false,"context_lines":[{"line_number":595,"context_line":"        try:"},{"line_number":596,"context_line":"            with open(filename) as f:"},{"line_number":597,"context_line":"                for l in f.readlines():"},{"line_number":598,"context_line":"                    host \u003d l.strip().split(\u0027,\u0027)"},{"line_number":599,"context_line":"                    mac \u003d host.pop(0)"},{"line_number":600,"context_line":""},{"line_number":601,"context_line":"                    client_id \u003d None"}],"source_content_type":"text/x-python","patch_set":3,"id":"3afb71cf_89ab561d","line":598,"in_reply_to":"3afb71cf_c9402ea8","updated":"2015-06-08 06:12:00.000000000","message":"If i understood the code correctly, the location of the host depends if there is a client_id or not (and hence also the location of the ip)","commit_id":"ac8ce483d44cd770d5908861b7f52d0d76beea30"}]}
