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

Side by Side Diff: third_party/twisted_8_1/twisted/conch/ssh/sexpy.py

Issue 12261012: Remove third_party/twisted_8_1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright (c) 2001-2004 Twisted Matrix Laboratories.
2 # See LICENSE for details.
3
4 #
5
6 def parse(s):
7 s = s.strip()
8 expr = []
9 while s:
10 if s[0] == '(':
11 newSexp = []
12 if expr:
13 expr[-1].append(newSexp)
14 expr.append(newSexp)
15 s = s[1:]
16 continue
17 if s[0] == ')':
18 aList = expr.pop()
19 s=s[1:]
20 if not expr:
21 assert not s
22 return aList
23 continue
24 i = 0
25 while s[i].isdigit(): i+=1
26 assert i
27 length = int(s[:i])
28 data = s[i+1:i+1+length]
29 expr[-1].append(data)
30 s=s[i+1+length:]
31 assert 0, "this should not happen"
32
33 def pack(sexp):
34 s = ""
35 for o in sexp:
36 if type(o) in (type(()), type([])):
37 s+='('
38 s+=pack(o)
39 s+=')'
40 else:
41 s+='%i:%s' % (len(o), o)
42 return s
OLDNEW
« no previous file with comments | « third_party/twisted_8_1/twisted/conch/ssh/session.py ('k') | third_party/twisted_8_1/twisted/conch/ssh/transport.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698