Critic my module

Devyn Collier Johnson devyncjohnson at gmail.com
Thu Jul 25 09:24:30 EDT 2013


Aloha Python Users!

    I made a Python3 module that allows users to use certain Linux shell 
commands from Python3 more easily than using os.system(), 
subprocess.Popen(), or subprocess.getoutput(). This module (once placed 
with the other modules) can be used like this

import boash; boash.ls()

    I attached the module. I plan to release it on the Internet soon, 
but feel free to use it now. It is licensed under LGPLv3.

    The name comes from combining "Boa" with "SHell". Notice that the 
module's name almost looks like "BASH", a common Linux shell. The Boa is 
a constrictor snake. This module makes Unix shells easier to use via 
Python3. This brings the system shell closer to the Python shell.


Mahalo,

Devyn Collier Johnson
DevynCJohnson at Gmail.com
-------------- next part --------------
#!/usr/bin/python3
#Made by Devyn Collier Johnson, NCLA, Linux+, LPIC-1, DCTS
#Made using the Geany IDE
#LGPLv3
import re, sys, subprocess, platform
def grep(regex,textf):
#Sample Command: grep.grep("^x",dir())
#Syntax: boash.grep(regexp_string,list_of_strings_to_search)
	version = '0.2a'
	expr = re.compile(regex)
	match = re.findall(expr, textf)
	if match != None:
		print(match)
def ls():
	version = '0.3'
	print(subprocess.getoutput('ls'))
def dir():
	version = '0.3'
	print(subprocess.getoutput('dir'))
def ll():
	version = '0.3'
	print(subprocess.getoutput('ls -l'))
def vdir():
	version = '0.3'
	print(subprocess.getoutput('ls -l'))
def uname():
	version = '0.3'
	print(platform.uname())
def cmd(*arg):
	version = '0.3'
	print(subprocess.getoutput(arg))
def command(*arg):
	version = '0.3'
	print(subprocess.getoutput(arg))
def man(x):
	version = '0.3'
	print(subprocess.getoutput('man' + x))
def apropos(*arg):
	version = '0.3'
	print(subprocess.getoutput('apropos' + arg))
def bash(*arg):
	version = '0.3'
	print(subprocess.getoutput(arg))
def shell(*arg):
	version = '0.3'
	print(subprocess.getoutput(arg))
def clear_bash_history():
	version = '0.3'
	print(subprocess.getoutput('history -c'))
def clear_bash_hist():
	version = '0.3'
	print(subprocess.getoutput('history -c'))
def clear_hist():
	version = '0.3'
	print(subprocess.getoutput('history -c'))
def clear_history():
	version = '0.3'
	print(subprocess.getoutput('history -c'))
def del_bash_hist():
	version = '0.3'
	print(subprocess.getoutput('history -c'))
def delete_bash_hist():
	version = '0.3'
	print(subprocess.getoutput('history -c'))
def del_hist():
	version = '0.3'
	print(subprocess.getoutput('history -c'))
def delete_history():
	version = '0.3'
	print(subprocess.getoutput('history -c'))
def delete_bash_history():
	version = '0.3'
	print(subprocess.getoutput('history -c'))
def delete_hist():
	version = '0.3'
	print(subprocess.getoutput('history -c'))
def firefox():
	version = '0.3'
	print(subprocess.Popen('(firefox &)'))
def opera():
	version = '0.3'
	print(subprocess.Popen('(opera &)'))
def arora():
	version = '0.3'
	print(subprocess.Popen('(arora &)'))
def dolphin():
	version = '0.3'
	print(subprocess.Popen('(dolphin &)'))
def nautilus():
	version = '0.3'
	print(subprocess.Popen('(nautilus &)'))
def konqueror():
	version = '0.3'
	print(subprocess.Popen('(konqueror &)'))
def smplayer():
	version = '0.3'
	print(subprocess.Popen('(smplayer &)'))
def mplayer():
	version = '0.3'
	print(subprocess.Popen('(mplayer &)'))
def vlc():
	version = '0.3'
	print(subprocess.Popen('(vlc &)'))
def qvlc():
	version = '0.3'
	print(subprocess.Popen('(qvlc &)'))
def nvlc():
	version = '0.3'
	jprint(subprocess.Popen('(nvlc &)'))
def svlc():
	version = '0.3'
	print(subprocess.Popen('(svlc &)'))
def rvlc():
	version = '0.3'
	print(subprocess.Popen('(rvlc &)'))
def xterm():
	version = '0.3'
	print(subprocess.Popen('(xterm &)'))
def geany():
	version = '0.3'
	print(subprocess.Popen('(geany &)'))
def lsof():
	version = '0.3'
	print(subprocess.getoutput(lsof))
def free(*arg):
	version = '0.3'
	print(subprocess.getoutput('free' + arg))
def lsof(*arg):
	version = '0.3'
	print(subprocess.getoutput('lsof' + arg))
def pwd():
	version = '0.3'
	print(subprocess.getoutput('pwd'))
def getcwd():
	version = '0.3'
	print(subprocess.getoutput('pwd'))
def whoami():
	version = '0.3'
	print(subprocess.getoutput('whoami'))
def finger():
	version = '0.3'
	print(subprocess.getoutput('finger'))
def hostname():
	version = '0.3'
	print(subprocess.getoutput('hostname'))
def arch():
	version = '0.3'
	print(subprocess.getoutput('arch'))
def architecture():
	version = '0.3'
	print(subprocess.getoutput('arch'))
def go_back():
	version = '0.3'
	print(subprocess.Popen('cd !!:1'))
def repeat():
	version = '0.3'
	print(subprocess.Popen('!!')
def repeat_cmd():
	version = '0.3'
	print(subprocess.Popen('!!'))
def last_cmd():
	version = '0.3'
	print(subprocess.Popen('!!'))
def last_command():
	version = '0.3'
	print(subprocess.Popen('!!'))
def ejcd():
	version = '0.3'
	print(subprocess.Popen('eject cdrom1'))
def eject_cd():
	version = '0.3'
	print(subprocess.Popen('eject cdrom1'))
def eject_cdrom():
	version = '0.3'
	print(subprocess.Popen('eject cdrom1'))
def ejectcd():
	version = '0.3'
	print(subprocess.Popen('eject cdrom1'))
def ejectcdrom():
	version = '0.3'
	print(subprocess.Popen('eject cdrom1'))
def eject_disc():
	version = '0.3'
	print(subprocess.Popen('eject cdrom1'))
def eject_disc_tray():
	version = '0.3'
	print(subprocess.Popen('eject cdrom1'))
def eject_tray():
	version = '0.3'
	print(subprocess.Popen('eject cdrom1'))
def ejectdisc():
	version = '0.3'
	print(subprocess.Popen('eject cdrom1'))
def ejectdisctray():
	version = '0.3'
	print(subprocess.Popen('eject cdrom1'))
def ejecttray():
	version = '0.3'
	print(subprocess.Popen('eject cdrom1'))
def ejtray():
	version = '0.3'
	print(subprocess.Popen('eject cdrom1'))
def ejdvd():
	version = '0.3'
	print(subprocess.Popen('eject cdrom1'))
def eject_dvd():
	version = '0.3'
	print(subprocess.Popen('eject cdrom1'))
def ejectdvd():
	version = '0.3'
	print(subprocess.Popen('eject cdrom1'))
def env():
	version = '0.3'
	print(subprocess.getoutput('env'))
def runlevel():
	version = '0.3'
	print(subprocess.getoutput('runlevel'))
def restart():
	version = '0.3'
	print(subprocess.Popen('shutdown -r now'))
def reboot():
	version = '0.3'
	print(subprocess.Popen('shutdown -r now'))
def shutdown():
	version = '0.3'
	print(subprocess.Popen('shutdown now'))
def shut_down():
	version = '0.3'
	print(subprocess.Popen('shutdown now'))
def halt():
	version = '0.3'
	print(subprocess.Popen('shutdown -h now'))
def poweroff():
	version = '0.3'
	print(subprocess.Popen('shutdown -P now'))
def power_off():
	version = '0.3'
	print(subprocess.Popen('shutdown -P now'))
def powerdown():
	version = '0.3'
	print(subprocess.Popen('shutdown -P now'))
def power_down():
	version = '0.3'
	print(subprocess.Popen('shutdown -P now'))
def nologin():
	version = '0.3'
	print(subprocess.Popen('shutdown -k now'))
def no_login():
	version = '0.3'
	print(subprocess.Popen('shutdown -k now'))
def nologins():
	version = '0.3'
	print(subprocess.Popen('shutdown -k now'))
def no_logins():
	version = '0.3'
	print(subprocess.Popen('shutdown -k now'))
version = '0.6b'


More information about the Python-list mailing list