Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(563)

Side by Side Diff: client/libs/logdog/varint.py

Issue 2013943002: Changing license header, again! (Closed) Base URL: git@github.com:luci/luci-py.git@master
Patch Set: Fixed third parties Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « client/libs/logdog/tests/varint_test.py ('k') | client/run_isolated.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The LUCI Authors. All rights reserved. 1 # Copyright 2016 The LUCI Authors. All rights reserved.
2 # Use of this source code is governed by the Apache v2.0 license that can be 2 # Use of this source code is governed under the Apache License, Version 2.0
3 # found in the LICENSE file. 3 # that can be found in the LICENSE file.
4 4
5 import os 5 import os
6 import sys 6 import sys
7 7
8 8
9 def write_uvarint(w, val): 9 def write_uvarint(w, val):
10 """Writes a varint value to the supplied file-like object. 10 """Writes a varint value to the supplied file-like object.
11 11
12 Args: 12 Args:
13 w (object): A file-like object to write to. Must implement write. 13 w (object): A file-like object to write to. Must implement write.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 byte = r.read(1) 54 byte = r.read(1)
55 if len(byte) == 0: 55 if len(byte) == 0:
56 raise ValueError('UVarint was not terminated') 56 raise ValueError('UVarint was not terminated')
57 57
58 byte = ord(byte) 58 byte = ord(byte)
59 result |= ((byte & 0b01111111) << (7 * count)) 59 result |= ((byte & 0b01111111) << (7 * count))
60 count += 1 60 count += 1
61 if byte & 0b10000000 == 0: 61 if byte & 0b10000000 == 0:
62 break 62 break
63 return result, count 63 return result, count
OLDNEW
« no previous file with comments | « client/libs/logdog/tests/varint_test.py ('k') | client/run_isolated.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698