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

Side by Side Diff: third_party/google-endpoints/pyasn1/compat/octets.py

Issue 2666783008: Add google-endpoints to third_party/. (Closed)
Patch Set: Created 3 years, 10 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
OLDNEW
(Empty)
1 from sys import version_info
2
3 if version_info[0] <= 2:
4 int2oct = chr
5 ints2octs = lambda s: ''.join([ int2oct(x) for x in s ])
6 null = ''
7 oct2int = ord
8 octs2ints = lambda s: [ oct2int(x) for x in s ]
9 str2octs = lambda x: x
10 octs2str = lambda x: x
11 isOctetsType = lambda s: isinstance(s, str)
12 isStringType = lambda s: isinstance(s, (str, unicode))
13 else:
14 ints2octs = bytes
15 int2oct = lambda x: ints2octs((x,))
16 null = ints2octs()
17 oct2int = lambda x: x
18 octs2ints = lambda s: [ x for x in s ]
19 str2octs = lambda x: x.encode()
20 octs2str = lambda x: x.decode()
21 isOctetsType = lambda s: isinstance(s, bytes)
22 isStringType = lambda s: isinstance(s, str)
OLDNEW
« no previous file with comments | « third_party/google-endpoints/pyasn1/compat/binary.py ('k') | third_party/google-endpoints/pyasn1/debug.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698