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

Unified Diff: tools/telemetry/third_party/gsutil/third_party/pyasn1-modules/pyasn1_modules/pem.py

Issue 1260493004: Revert "Add gsutil 4.13 to telemetry/third_party" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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: tools/telemetry/third_party/gsutil/third_party/pyasn1-modules/pyasn1_modules/pem.py
diff --git a/tools/telemetry/third_party/gsutil/third_party/pyasn1-modules/pyasn1_modules/pem.py b/tools/telemetry/third_party/gsutil/third_party/pyasn1-modules/pyasn1_modules/pem.py
deleted file mode 100644
index d8d815873e9b123fe41afdc8eb058855769f22a2..0000000000000000000000000000000000000000
--- a/tools/telemetry/third_party/gsutil/third_party/pyasn1-modules/pyasn1_modules/pem.py
+++ /dev/null
@@ -1,51 +0,0 @@
-import base64, sys
-
-stSpam, stHam, stDump = 0, 1, 2
-
-# The markers parameters is in form ('start1', 'stop1'), ('start2', 'stop2')...
-# Return is (marker-index, substrate)
-def readPemBlocksFromFile(fileObj, *markers):
- startMarkers = dict(map(lambda x: (x[1],x[0]),
- enumerate(map(lambda x: x[0], markers))))
- stopMarkers = dict(map(lambda x: (x[1],x[0]),
- enumerate(map(lambda x: x[1], markers))))
- idx = -1; substrate = ''
- state = stSpam
- while 1:
- certLine = fileObj.readline()
- if not certLine:
- break
- certLine = certLine.strip()
- if state == stSpam:
- if certLine in startMarkers:
- certLines = []
- idx = startMarkers[certLine]
- state = stHam
- continue
- if state == stHam:
- if certLine in stopMarkers and stopMarkers[certLine] == idx:
- state = stDump
- else:
- certLines.append(certLine)
- if state == stDump:
- if sys.version_info[0] <= 2:
- substrate = ''.join([ base64.b64decode(x) for x in certLines ])
- else:
- substrate = ''.encode().join([ base64.b64decode(x.encode()) for x in certLines ])
- break
- return idx, substrate
-
-# Backward compatibility routine
-def readPemFromFile(fileObj,
- startMarker='-----BEGIN CERTIFICATE-----',
- endMarker='-----END CERTIFICATE-----'):
- idx, substrate = readPemBlocksFromFile(fileObj, (startMarker, endMarker))
- return substrate
-
-def readBase64FromFile(fileObj):
- if sys.version_info[0] <= 2:
- return ''.join([ base64.b64decode(x) for x in fileObj.readlines() ])
- else:
- return ''.encode().join(
- [ base64.b64decode(x.encode()) for x in fileObj.readlines() ]
- )

Powered by Google App Engine
This is Rietveld 408576698