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

Unified Diff: third_party/gsutil/third_party/pyasn1/pyasn1/compat/octets.py

Issue 1377933002: [catapult] - Copy Telemetry's gsutilz over to third_party. (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: Rename to gsutil. Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/gsutil/third_party/pyasn1/pyasn1/compat/octets.py
diff --git a/third_party/gsutil/third_party/pyasn1/pyasn1/compat/octets.py b/third_party/gsutil/third_party/pyasn1/pyasn1/compat/octets.py
new file mode 100644
index 0000000000000000000000000000000000000000..f7f2a29bf5617b2273dedd7134d7f9516c8137d3
--- /dev/null
+++ b/third_party/gsutil/third_party/pyasn1/pyasn1/compat/octets.py
@@ -0,0 +1,20 @@
+from sys import version_info
+
+if version_info[0] <= 2:
+ int2oct = chr
+ ints2octs = lambda s: ''.join([ int2oct(x) for x in s ])
+ null = ''
+ oct2int = ord
+ octs2ints = lambda s: [ oct2int(x) for x in s ]
+ str2octs = lambda x: x
+ octs2str = lambda x: x
+ isOctetsType = lambda s: isinstance(s, str)
+else:
+ ints2octs = bytes
+ int2oct = lambda x: ints2octs((x,))
+ null = ints2octs()
+ oct2int = lambda x: x
+ octs2ints = lambda s: [ x for x in s ]
+ str2octs = lambda x: x.encode()
+ octs2str = lambda x: x.decode()
+ isOctetsType = lambda s: isinstance(s, bytes)
« no previous file with comments | « third_party/gsutil/third_party/pyasn1/pyasn1/compat/__init__.py ('k') | third_party/gsutil/third_party/pyasn1/pyasn1/debug.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698