diff --git a/demo/df.py b/demo/df.py index 987ea53274e8e949e4051fa19cc93ac2c88b0e9b..f80355498a854799dd14f5bde2faf2e82e4d1ff8 100644 --- a/demo/df.py +++ b/demo/df.py @@ -1,15 +1,15 @@ -from pcl_expect import controller -from pcl_expect.popen import popen +from pcl_expect import Controller +from pcl_expect.popen import Popen -df = popen("df -k") +df = Popen("df -k") -x = controller() +x = Controller() while x.loop(): if x.re(df, "Filesystem.*\n"): print "Header:", df.match.group() break -x = controller() +x = Controller() while x.loop(): if x.re(df, "^/.* .*(?=\n)"): print "Normal line:", df.match.group() diff --git a/demo/dualftp.py b/demo/dualftp.py index fcfb0dbb6bcd497cd081e6c681815aaf93d45775..059684f6856a53bf9ecabf117012ad7d695d6447 100644 --- a/demo/dualftp.py +++ b/demo/dualftp.py @@ -15,8 +15,8 @@ import pcl_expect.spawn pcl_expect.spawn.stty_init = "-onlcr -ocrnl -echo" time0 = time.time() -funet = pcl_expect.spawn.spawn("ftp ftp.funet.fi") -sunet = pcl_expect.spawn.spawn("ftp ftp.sunet.se") +funet = pcl_expect.spawn.Spawn("ftp ftp.funet.fi") +sunet = pcl_expect.spawn.Spawn("ftp ftp.sunet.se") def name_cb(ftp): ftp.send("anonymous\n") @@ -55,7 +55,7 @@ pcl_expect.expect_after([(pcl_expect.RE, funet, "Name.*:", name_cb), (pcl_expect.RE, funet, "(?s).*ftp> ", prompt_cb), (pcl_expect.RE, sunet, "(?s).*ftp> ", prompt_cb)]) -x = pcl_expect.controller() +x = pcl_expect.Controller() while x.loop(): if x.timeout(): sys.stdout.write(".") @@ -66,7 +66,7 @@ funet.send("bye\n") pcl_expect.expect_after([]) -x = pcl_expect.controller() +x = pcl_expect.Controller() while x.loop(): if x.eof(sunet): print "SUNET final output:", sunet.consumed @@ -76,7 +76,7 @@ while x.loop(): sys.stdout.write(".") sys.stdout.flush() -x = pcl_expect.controller() +x = pcl_expect.Controller() while x.loop(): if x.eof(funet): print "FUNET final output:", funet.consumed diff --git a/demo/ftp.py b/demo/ftp.py index 5e7aebb520c6c7224f85f230118c992e64b6280d..6fddca2a64b9f789cff2f3e86a1297eb1f7af53b 100644 --- a/demo/ftp.py +++ b/demo/ftp.py @@ -5,9 +5,9 @@ import pcl_expect pcl_expect.spawn.stty_init = "-onlcr -ocrnl" -ftp = pcl_expect.spawn.spawn("ftp ftp.funet.fi") +ftp = pcl_expect.spawn.Spawn("ftp ftp.funet.fi") -x = pcl_expect.controller() +x = pcl_expect.Controller() while x.loop(): if x.re(ftp, "Name.*:"): ftp.send("anonymous\n") @@ -18,21 +18,21 @@ while x.loop(): ftp.send("cd pub\n") -x = pcl_expect.controller() +x = pcl_expect.Controller() while x.loop(): if x.re(ftp, "(?s).*ftp> "): break ftp.send("passive\n") -x = pcl_expect.controller() +x = pcl_expect.Controller() while x.loop(): if x.re(ftp, "(?s).*ftp> "): break ftp.send("dir\n") -x = pcl_expect.controller() +x = pcl_expect.Controller() while x.loop(): if x.re(ftp, "(?s).*ftp> "): print ftp.match.group() diff --git a/demo/ftp.pyex b/demo/ftp.pyex index 48bfecdf80cc4e03228a5388c0f8eeeef77ba7b8..5bd326a9d1ae26c8e34b9c53371516f266b6177b 100644 --- a/demo/ftp.pyex +++ b/demo/ftp.pyex @@ -5,7 +5,7 @@ import pcl_expect.spawn pcl_expect.spawn.stty_init = "-onlcr -ocrnl" -ftp = pcl_expect.spawn.spawn("ftp ftp.funet.fi") +ftp = pcl_expect.spawn.Spawn("ftp ftp.funet.fi") expect: re(ftp, "Name.*:"): diff --git a/demo/ftp_interact.py b/demo/ftp_interact.py index 990a81c682a41924839aa6bd2738d13e601c0454..bee8780845280be2fdbd43938bbbb226345fa709 100644 --- a/demo/ftp_interact.py +++ b/demo/ftp_interact.py @@ -7,7 +7,7 @@ import pcl_expect.user import pcl_expect def prompt(): - x = pcl_expect.controller() + x = pcl_expect.Controller() while x.loop(): if x.re(ftp, "(?s).*ftp> "): break @@ -18,9 +18,9 @@ def cmd(s): pcl_expect.spawn.stty_init = "-onlcr -ocrnl -echo" -ftp = pcl_expect.spawn.spawn("ftp ftp.funet.fi") +ftp = pcl_expect.spawn.Spawn("ftp ftp.funet.fi") -x = pcl_expect.controller() +x = pcl_expect.Controller() while x.loop(): if x.re(ftp, "Name.*:"): ftp.send("anonymous\n") @@ -36,11 +36,11 @@ cmd("cd pub") cmd("cd gnu") cmd("passive") -user_spawn_id = pcl_expect.user.user() +user_spawn_id = pcl_expect.user.User() user_spawn_id.send("ftp> ") buf = "" -x = pcl_expect.controller() +x = pcl_expect.Controller() while x.loop(): if x.re(user_spawn_id, "..*"): s = user_spawn_id.match.group() diff --git a/demo/ftptrad.py b/demo/ftptrad.py index 3b3ac749b681189d1269378cd4cd5f257689e460..a718b4b87854e8e566ce50259d4449be6af9fff5 100644 --- a/demo/ftptrad.py +++ b/demo/ftptrad.py @@ -5,7 +5,7 @@ import pcl_expect.spawn pcl_expect.spawn.stty_init = "-onlcr -ocrnl" -ftp = pcl_expect.spawn.spawn("ftp ftp.funet.fi") +ftp = pcl_expect.spawn.Spawn("ftp ftp.funet.fi") def send_anon(exp): exp.send("anonymous\n") diff --git a/demo/telnet.py b/demo/telnet.py index 9eb4f51b1fe3e7cb130079d3b072bf1092be0795..d58d409355831dbaf0b61821154577c0cb9d8c8f 100644 --- a/demo/telnet.py +++ b/demo/telnet.py @@ -24,21 +24,21 @@ print if len(password) > 0 and password[-1] == "\n": password = password[:-1] -t = pcl_expect.telnet.telnet(host, "23") +t = pcl_expect.telnet.Telnet(host, "23") -x = pcl_expect.controller() +x = pcl_expect.Controller() while x.loop(): if x.re(t, "ogin:"): t.send(user + "\n") break -x = pcl_expect.controller() +x = pcl_expect.Controller() while x.loop(): if x.re(t, "assword:"): t.send(password + "\n") break -x = pcl_expect.controller() +x = pcl_expect.Controller() while x.loop(): if x.re(t, ">|\\$|#"): t.send("uname -a\n") @@ -48,14 +48,14 @@ while x.loop(): t.close() sys.exit(1) -x = pcl_expect.controller() +x = pcl_expect.Controller() while x.loop(): if x.re(t, "(.*)\r?\n.*(>|\\$|#)"): print "SYSTEM ID:", t.match.group(1) t.send("exit\n") break -x = pcl_expect.controller() +x = pcl_expect.Controller() while x.loop(): if x.eof(t): t.close()