/usr/lib/python3/dist-packages/pylibmc/__main__.py is in python3-pylibmc 1.5.0-4build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | """Interactive shell"""
import sys
import code
import random
import pylibmc
tips = [
"Want to use 127.0.0.1? Just hit Enter immediately.",
"Hit Enter immediately and you'll connect to 127.0.0.1.",
"Did you know there's a --binary flag? Try it!",
"Want to use binary mode? Pass --binary as a sole argument."
]
def print_header(outf=sys.stdout):
outf.write("pylibmc interactive shell\n\n")
outf.write("Input list of servers, terminating by a blank line.\n")
outf.write(random.choice(tips) + "\n")
def collect_servers():
try:
in_addr = raw_input("Address [127.0.0.1]: ")
except:
in_addr = input("Address [127.0.0.1]: ")
if in_addr:
while in_addr:
yield in_addr
try:
in_addr = raw_input("Address [<stop>]: ")
except:
in_addr = input("Address [<stop>]: ")
else:
yield "127.0.0.1"
banner = "\nmc client available as `mc`\n"
def interact(servers, banner=banner, binary=False):
mc = pylibmc.Client(servers, binary=binary)
local = {"pylibmc": pylibmc,
"mc": mc}
code.interact(banner=banner, local=local)
def main():
binary = False
if sys.argv[1:] == ["--binary"]:
binary = True
print_header()
interact(list(collect_servers()), binary=binary)
if __name__ == "__main__":
main()
|