def _main_init(): parser = _ArgumentParser() parser.add_argument( '--virtual-client', type=str, help='initialize virtual client "address port [timeout]"') parser.add_argument('--virtual-server', type=str, help='start virtual server "address port [timeout]"') parser.add_argument('--root', help='root directory to search for the library') parser.add_argument('--path', help='the exact path of the library') args = parser.parse_args() if args.virtual_server and _SYS_IS_WIN: raw_args = args.virtual_server.split(' ') vs_args = ((raw_args[0], int(raw_args[1])), ) vs_args += (int(raw_args[2]), ) if len(raw_args) > 2 else () _Thread(target=enable_virtualization, args=vs_args).start() if args.virtual_client: raw_args = args.virtual_client.split(' ') vc_args = ((raw_args[0], int(raw_args[1])), ) vc_args += (int(raw_args[2]), ) if len(raw_args) > 2 else () admin_init(*vc_args) if args.path: vinit(dllpath=args.path) if args.virtual_client else init( dllpath=args.path) elif args.root: vinit(root=args.root) if args.virtual_client else init(root=args.root)
def parse_args(): parser = _ArgumentParser() parser.add_argument('-p', '--path', required=True, help='path to contest source') parser.add_argument('-c', '--config', required=True, help='path to user config') parser.add_argument('-d', '--dest', help='path to contest archive destination') parser.add_argument('-t', '--templates', default='templates/default', help='path to templates') parser.add_argument( '-n', '--name', required=False, help='explicit set contest name (dirname is used if argument omitted)') parser.add_argument('-v', '--verbose', action='store_true', help='be more verbosity') return normalize_args(parser.parse_args())
def __init__(self, prog=sys.argv[0], description='', schema=None): self._argument_parser = _ArgumentParser(prog=prog, description=description) self._config = {} self._schema = Schema({}) if schema is None else schema for arg, dest, help_ in _argument_from_voluptuous(self._schema.schema): self.add_config_updater(arg, help_, dest=dest)
def parse_args(args=None): DEFAULT_PROMPT = 'Query: ' parser = _ArgumentParser(description='Display a graphical window' + ' with a text entry box. Print the ' + 'input text to stdout. The menu uses rofi. ', ) parser.add_argument( '-p', '--prompt', help="Set the prompt text on the left side of the box" + ". Defaults to '{}'".format(DEFAULT_PROMPT), default=DEFAULT_PROMPT, dest='p', ) parser.add_argument( '-pw', '--password', help="Show *** in entry box", action='store_true', dest='password', ) parser.add_argument( '-f', '--font', type=str, help='Font to use in menu', default='sans 20', dest='font', ) d_args = vars(parser.parse_args()) return d_args
def _main_init(): parser = _ArgumentParser() parser.add_argument('--virtual-client', type=str, help='initialize virtual client "address port [timeout]"') parser.add_argument( '--virtual-server', type=str, help='start virtual server "address port [timeout]"' ) parser.add_argument( '--root', help = 'root directory to search for the library' ) parser.add_argument( '--path', help='the exact path of the library' ) args = parser.parse_args() if args.virtual_server and _SYS_IS_WIN: raw_args = args.virtual_server.split(' ') vs_args = ((raw_args[0],int(raw_args[1])),) vs_args += (int(raw_args[2]),) if len(raw_args) > 2 else () _Thread( target=enable_virtualization, args=vs_args).start() if args.virtual_client: raw_args = args.virtual_client.split(' ') vc_args = ((raw_args[0],int(raw_args[1])),) vc_args += (int(raw_args[2]),) if len(raw_args) > 2 else () admin_init( *vc_args ) if args.path: vinit(dllpath=args.path) if args.virtual_client else init(dllpath=args.path) elif args.root: vinit(root=args.root) if args.virtual_client else init(root=args.root)
def _main_init(): global args parser = _ArgumentParser() parser.add_argument('--virtual-client', type=str, help='initialize virtual client "address port [timeout]"') parser.add_argument('--virtual-server', type=str, help='start virtual server "address port [timeout]"') parser.add_argument('--root', help='root directory to search for the library') parser.add_argument('--path', help='the exact path of the library') parser.add_argument('--auth', help='password to use for authentication') parser.add_argument('-v', '--verbose', action="store_true", help='extra info to stdout about client connection(s)') args = parser.parse_args() #remove quotes if args.auth: args.auth = args.auth.strip("'").strip('"') if args.virtual_server and _SYS_IS_WIN: raw_args = args.virtual_server.split(' ') try: vs_args = ((raw_args[0],int(raw_args[1])),) except IndexError: print("usage: tosdb --virtual-server 'address port [timeout]'",file=_stderr) exit(1) vs_args += (args.auth,) vs_args += (int(raw_args[2]),) if len(raw_args) > 2 else (DEF_TIMEOUT,) vs_args += (args.verbose,) #spin off so we don't block on exit _Thread(target=enable_virtualization,args=vs_args).start() if args.virtual_client: raw_args = args.virtual_client.split(' ') try: vc_args = ((raw_args[0],int(raw_args[1])),) except IndexError: print("usage: tosdb --virtual-client 'address port [timeout]'",file=_stderr) exit(1) vc_args += (args.auth,) vc_args += (int(raw_args[2]),) if len(raw_args) > 2 else (DEF_TIMEOUT,) admin_init(*vc_args) if args.virtual_client: if args.path: vinit(dllpath=args.path) elif args.root: vinit(root=args.root) else: if args.path: init(dllpath=args.path) elif args.root: init(root=args.root)
def _main_init(): global args parser = _ArgumentParser() parser.add_argument('--virtual-client', type=str, help='initialize virtual client "address port [timeout]"') parser.add_argument('--virtual-server', type=str, help='start virtual server "address port [timeout]"') parser.add_argument('--root', help='root directory to search for the library') parser.add_argument('--path', help='the exact path of the library') parser.add_argument('--auth', help='password to use for authentication') args = parser.parse_args() if args.virtual_server and _SYS_IS_WIN: raw_args = args.virtual_server.split(' ') try: vs_args = ((raw_args[0],int(raw_args[1])),) except IndexError: print("usage: tosdb --virtual-server 'address port [timeout]'",file=_stderr) exit(1) vs_args += (int(raw_args[2]),) if len(raw_args) > 2 else () if args.auth: vs_args = vs_args[:2] + (args.auth,) + vs_args[2:] #spin off so we don't block on exit _Thread(target=enable_virtualization,args=vs_args).start() if args.virtual_client: raw_args = args.virtual_client.split(' ') try: vc_args = ((raw_args[0],int(raw_args[1])),) except IndexError: print("usage: tosdb --virtual-client 'address port [timeout]'",file=_stderr) exit(1) vc_args += (int(raw_args[2]),) if len(raw_args) > 2 else () if args.auth: vc_args = vc_args[:2] + (args.auth,) + vc_args[2:] admin_init(*vc_args) if args.virtual_client: if args.path: vinit(dllpath=args.path) elif args.root: vinit(root=args.root) if args.path or args.root and not vconnected(): raise TOSDB_Error("could not connect to service/engine") else: if args.path: init(dllpath=args.path) elif args.root: init(root=args.root) if args.path or args.root and not connected(): raise TOSDB_Error("could not connect to service/engine")
def _main_init(): global args parser = _ArgumentParser() parser.add_argument( '--virtual-client', type=str, help='initialize virtual client "address port [timeout]"') parser.add_argument('--virtual-server', type=str, help='start virtual server "address port [timeout]"') parser.add_argument('--root', help='root directory to search for the library') parser.add_argument('--path', help='the exact path of the library') args = parser.parse_args() if args.virtual_server and _SYS_IS_WIN: raw_args = args.virtual_server.split(' ') try: vs_args = ((raw_args[0], int(raw_args[1])), ) except IndexError: print("usage: tosdb --virtual-server 'address port [timeout]'", file=_stderr) exit(1) vs_args += (int(raw_args[2]), ) if len(raw_args) > 2 else () _Thread(target=enable_virtualization, args=vs_args).start() if args.virtual_client: raw_args = args.virtual_client.split(' ') try: vc_args = ((raw_args[0], int(raw_args[1])), ) except IndexError: print("usage: tosdb --virtual-client 'address port [timeout]'", file=_stderr) exit(1) vc_args += (int(raw_args[2]), ) if len(raw_args) > 2 else () admin_init(*vc_args) if args.virtual_client: if args.path: vinit(dllpath=args.path) elif args.root: vinit(root=args.root) if args.path or args.root and not vconnected(): raise TOSDB_Error("could not connect to service/engine") else: if args.path: init(dllpath=args.path) elif args.root: init(root=args.root) if args.path or args.root and not connected(): raise TOSDB_Error("could not connect to service/engine")
def __init__(self, *args, meta_tag=None, meta_title=None, meta_desc=None, meta_epilog=None, **kwargs): subj = _ArgumentParser(*args, **kwargs) if meta_title is None: meta_title = "### %s\n" % (subj.prog or sys.argv[0]) super().__init__(subj, meta_tag=meta_tag, meta_title=meta_title, meta_desc=meta_desc, meta_epilog=meta_epilog)
def init(): global args parser = _ArgumentParser() parser.add_argument('build', type=str, help='build: x86 or x64') args = parser.parse_args() if args.build not in ('x86', 'x64'): print('invalid build argument', file=_stderr) print('usage: tosdb_test.py [x86|x64]', file=_stderr) return bdir = "../bin/Release/" + ("Win32" if args.build == 'x86' else "x64") if not tosdb.init(root=bdir): print("--- INIT FAILED ---", file=_stderr) return False print() return True
from pygrader import color as _color from pygrader.email import test_smtp as _test_smtp from pygrader.email import Responder as _Responder from pygrader.mailpipe import mailpipe as _mailpipe from pygrader.storage import initialize as _initialize from pygrader.storage import load_course as _load_course from pygrader.tabulate import tabulate as _tabulate from pygrader.template import assignment_email as _assignment_email from pygrader.template import course_email as _course_email from pygrader.template import student_email as _student_email from pygrader.todo import print_todo as _todo if __name__ == '__main__': from argparse import ArgumentParser as _ArgumentParser parser = _ArgumentParser(description=__doc__) parser.add_argument('-v', '--version', action='version', version='%(prog)s {}'.format(_pgp_mime.__version__)) parser.add_argument('-d', '--base-dir', dest='basedir', default='.', help='Base directory containing grade data') parser.add_argument('-e', '--encoding', dest='encoding', default='utf-8', help=('Override the default file encoding selection ' '(useful when running from procmail)'))
+ s.replace('/','-S-').replace('$','-D-').replace('.','-P-') \ +'_' + _val_type + '_' + str(self._intrvl) + 'min.tosdb' iobj = _Goti.send_to_file(blk, s, p, _TI.vals[isec], isec/10) print(repr(iobj), file=_stderr) self._iobjs.append(iobj) for i in self._iobjs: if i: i.join() while(True): # why?? _sleep(10) if __name__ == '__main__': parser = _ArgumentParser() parser.add_argument('addr', type=str, help = 'address of Windows implementation "address port"') parser.add_argument('dllroot', type=str, help = 'root path of Windows implementation C Library') parser.add_argument('outdir', type=str, help = 'directory to output data to') parser.add_argument('pidfile', type=str, help = 'path of pid file') parser.add_argument('errorfile', type=str, help = 'path of error file') parser.add_argument('intrvl', type=int, choices=tuple(map( lambda x: int(x/60), sorted(_TI.val_dict.keys()) )), help="interval size(minutes)" ) parser.add_argument('--ohlc', action="store_true", help="use open/high/low/close instead of close") parser.add_argument('--vol', action="store_true", help="use volume") parser.add_argument('vars', nargs='*', help="symbols to pull")
def main(argv=None): # verify utf8 support _utils.verify_python3_env() if not argv: argv = _sys.argv parser = _ArgumentParser(prog='npm2deb') parser.add_argument('-D', '--debug', type=int, help='set debug level') parser.add_argument( '-v', '--version', action='version', version='%(prog)s ' + _.VERSION) subparsers = parser.add_subparsers(title='commands') parser_create = subparsers.add_parser( 'create', help='create the debian files') parser_create.add_argument( '-n', '--noclean', action="store_true", default=False, help='do not remove files downloaded with npm') parser_create.add_argument( '--debhelper', default=_.DEBHELPER, help='specify debhelper version [default: %(default)s]') parser_create.add_argument( '--standards-version', default=_utils.get_latest_debian_standards_version(), help='set standards-version [default: %(default)s]') parser_create.add_argument( '--upstream-author', default=None, help='set upstream author if not automatically recognized') parser_create.add_argument( '--upstream-homepage', default=None, help='set upstream homepage if not automatically recognized') parser_create.add_argument( '--upstream-license', default=None, help='set upstream license if not automatically recognized') parser_create.add_argument( '--debian-license', default=None, help='license used for debian files [default: the same of upstream]') parser_create.add_argument( 'node_module', help='node module available via npm') parser_create.set_defaults(func=create) parser_view = subparsers.add_parser( 'view', help="a summary view of a node module") parser_view.add_argument( '-j', '--json', action="store_true", default=False, help='print verbose information in json format') parser_view.add_argument( 'node_module', help='node module available via npm') parser_view.set_defaults(func=print_view) parser_depends = subparsers.add_parser( 'depends', help='show module dependencies in npm and debian') parser_depends.add_argument( '-r', '--recursive', action="store_true", default=False, help='look for binary dependencies recursively') parser_depends.add_argument( '-f', '--force', action="store_true", default=False, help='force inspection for modules already in debian') parser_depends.add_argument( '-b', '--binary', action="store_true", default=False, help='show binary dependencies') parser_depends.add_argument( '-B', '--builddeb', action="store_true", default=False, help='show build dependencies') parser_depends.add_argument( 'node_module', help='node module available via npm') parser_depends.set_defaults(func=show_dependencies) parser_rdepends = subparsers.add_parser( 'rdepends', help='show the reverse dependencies for module') parser_rdepends.add_argument( 'node_module', help='node module available via npm') parser_rdepends.set_defaults(func=show_reverse_dependencies) parser_search = subparsers.add_parser( 'search', help="look for module in debian project") parser_search.add_argument( '-b', '--bug', action="store_true", default=False, help='search for existing bug in wnpp') parser_search.add_argument( '-d', '--debian', action="store_true", default=False, help='search for existing package in debian') parser_search.add_argument( '-r', '--repository', action="store_true", default=False, help='search for existing repository in alioth') parser_search.add_argument( 'node_module', help='node module available via npm') parser_search.set_defaults(func=search_for_module) parser_itp = subparsers.add_parser('itp', help="print a itp bug template") parser_itp.add_argument( 'node_module', help='node module available via npm') parser_itp.set_defaults(func=print_itp) parser_license = subparsers.add_parser( 'license', help='print license template and exit') parser_license.add_argument( '-l', '--list', action="store_true", default=False, help='show the available licenses') parser_license.add_argument( 'name', nargs='?', help='the license name to show') parser_license.set_defaults(func=print_license) if len(argv) == 1: parser.error("Please specify an option.") else: args = parser.parse_args(argv[1:]) if args.debug: _utils.DEBUG_LEVEL = args.debug args.func(args)
s.replace('/','-S-').replace('$','-D-').replace('.','-P-') + \ '_' + _val_type + '_' + str(self._intrvl) + 'min.tosdb' iobj = _Goti.send_to_file(blk, s, p, _TI.vals[isec], isec / 10) print(repr(iobj), file=_stderr) self._iobjs.append(iobj) for i in self._iobjs: if i: i.join() while (True): _sleep(10) if __name__ == '__main__': parser = _ArgumentParser() parser.add_argument('addr', type=str, help='address of core(Windows) ' + 'implementation " address port "') parser.add_argument('dllroot', type=str, help='root of the path of core' '(Windows) implementation DLL') parser.add_argument('outdir', type=str, help='directory to output ' + ' data/files to') parser.add_argument('pidfile', type=str, help='path of pid file') parser.add_argument('errorfile', type=str, help='path of error file') parser.add_argument('intrvl', type=int,
def main(argv=None): if not argv: argv = _sys.argv parser = _ArgumentParser(prog='npm2deb') parser.add_argument('-D', '--debug', type=int, help='set debug level') parser.add_argument('-v', '--version', action='version', version='%(prog)s ' + _.VERSION) subparsers = parser.add_subparsers(title='commands') parser_create = subparsers.add_parser('create', help='create the debian files') parser_create.add_argument('-n', '--noclean', action="store_true", default=False, help='do not remove files downloaded with npm') parser_create.add_argument( '--debhelper', default=_.DEBHELPER, help='specify debhelper version [default: %(default)s]') parser_create.add_argument( '--standards-version', default=_.STANDARDS_VERSION, help='set standards-version [default: %(default)s]') parser_create.add_argument( '--upstream-author', default=None, help='set upstream author if not automatically recognized') parser_create.add_argument( '--upstream-homepage', default=None, help='set upstream homepage if not automatically recognized') parser_create.add_argument( '--upstream-license', default=None, help='set upstream license if not automatically recognized') parser_create.add_argument( '--debian-license', default=None, help='license used for debian files [default: the same of upstream]') parser_create.add_argument('node_module', help='node module available via npm') parser_create.set_defaults(func=create) parser_view = subparsers.add_parser('view', help="a summary view of a node module") parser_view.add_argument('-j', '--json', action="store_true", default=False, help='print verbose information in json format') parser_view.add_argument('node_module', help='node module available via npm') parser_view.set_defaults(func=print_view) parser_depends = subparsers.add_parser( 'depends', help='show module dependencies in npm and debian') parser_depends.add_argument( '-r', '--recursive', action="store_true", default=False, help='look for binary dependencies recursively') parser_depends.add_argument( '-f', '--force', action="store_true", default=False, help='force inspection for modules already in debian') parser_depends.add_argument('-b', '--binary', action="store_true", default=False, help='show binary dependencies') parser_depends.add_argument('-B', '--builddeb', action="store_true", default=False, help='show build dependencies') parser_depends.add_argument('node_module', help='node module available via npm') parser_depends.set_defaults(func=show_dependencies) parser_rdepends = subparsers.add_parser( 'rdepends', help='show the reverse dependencies for module') parser_rdepends.add_argument('node_module', help='node module available via npm') parser_rdepends.set_defaults(func=show_reverse_dependencies) parser_search = subparsers.add_parser( 'search', help="look for module in debian project") parser_search.add_argument('-b', '--bug', action="store_true", default=False, help='search for existing bug in wnpp') parser_search.add_argument('-d', '--debian', action="store_true", default=False, help='search for existing package in debian') parser_search.add_argument('-r', '--repository', action="store_true", default=False, help='search for existing repository in alioth') parser_search.add_argument('node_module', help='node module available via npm') parser_search.set_defaults(func=search_for_module) parser_itp = subparsers.add_parser('itp', help="print a itp bug template") parser_itp.add_argument('node_module', help='node module available via npm') parser_itp.set_defaults(func=print_itp) parser_license = subparsers.add_parser( 'license', help='print license template and exit') parser_license.add_argument('-l', '--list', action="store_true", default=False, help='show the available licenses') parser_license.add_argument('name', nargs='?', help='the license name to show') parser_license.set_defaults(func=print_license) if len(argv) == 1: parser.error("Please specify an option.") else: args = parser.parse_args(argv[1:]) if args.debug: _utils.DEBUG_LEVEL = args.debug args.func(args)
##################################### # Import Modules ##################################### from argparse import ArgumentParser as _ArgumentParser from numpy import savetxt as _savetxt, arange as _arange, asarray as _asarray, array as _array, sort as _sort, ones as _ones, zeros as _zeros from rdkit.Chem import SmilesMolSupplier as _SmilesMolSupplier, MolFromMol2Block as _MolFromMol2Block, SDMolSupplier as _SDMolSupplier, MolToSmiles as _MolToSmiles, PathToSubmol as _PathToSubmol, FindAtomEnvironmentOfRadiusN as _FindAtomEnvironmentOfRadiusN from operator import add as _add from rdkit.Chem.AllChem import GetMorganFingerprintAsBitVect as _GetMorganFingerprintAsBitVect, GetMorganFingerprint as _GetMorganFingerprint from os.path import splitext as _splitext, exists as _exists from os import makedirs as _makedirs from rdkit.Chem.Draw import MolToFile as _MolToFile import sys ############# # Arguments passed to the script parser = _ArgumentParser(prog='PROG',description='Get Morgan Fingerprints for compounds codified in either SMILES or SDF format using RDkit. Isidro Cortes Ciriano. August/September 2013') parser.add_argument('-bits', required='TRUE',type=int, help="Size of the hashed Morgan Fingerprints (binary and with counts)") parser.add_argument('-radii', nargs="+", type=int, required='TRUE',help="Radii to be considered for the calculation of the fingerprints") parser.add_argument('-mols', type=str,help="File containing the molecules {.smi|.smiles|.sdf|.mol2}. If the format is smiles, each line should contain the smiles and the name separated by a comma (in this order)") parser.add_argument('-image', action='store_true', help="Write --image if you want the images of the substructures") parser.add_argument('-unhashed', action='store_true', help="Write --unhashed if you want the unhashed fingerprints") parser.add_argument('-molsEXT',type=str,help="External file") parser.add_argument('-unhashedEXT', action='store_true', help="Write --unhashedEXT if you want the unhashed fingerprints for the external file. The substructures of the molecules in the external file will be compared to the pool of substructures contained in the molecules of the main file") parser.add_argument('-RDkitPath', required='TRUE', type=str, help="Path to the directory where the RDkit files are") parser.add_argument('-output', required='TRUE', type=str, help="Name of the output files") args = vars(parser.parse_args()) ############# image=args['image'] unhashed=args['unhashed'] nbBits=int(args['bits'])
def main(): parser = _ArgumentParser(prog=__appname__) parser.add_argument('-D', '--debug', type=int, help='set debug level') parser.add_argument('-v', '--version', action='version', version='%(prog)s ' + _VERSION) parser.add_argument( '-c', '--command', help="exec the given command instead of entry the interactive shell") parser.add_argument( '-d', '--delete', action="store_true", default=False, help="delete venv for release") parser.add_argument( '-l', '--list', action="store_true", help="list all venv installed in your system") parser.add_argument( '-u', '--update', action="store_true", help="update the apt indexes") parser.add_argument( 'release', nargs='?', help="the debian/ubuntu release") args = parser.parse_args() if 'APT_VENV' in _os.environ: print("You can't run apt-venv inside apt-venv session") exit(1) if args.debug: _utils.DEBUG_LEVEL = args.debug if args.list: data_path = _BaseDirectory.save_data_path(__appname__) dirs = _os.listdir(data_path) if len(dirs) > 0: print("Installed apt-venv:\n %s" % "\n ".join(dirs)) exit(0) else: print("There is no apt-venv on your system") exit(1) try: venv = _AptVenv(args.release) if args.delete: venv.delete() else: if not venv.exists(): venv.create() print( "Welcome to apt virtual environment for {} release." .format(venv.release)) print( "All the configuration is available in {}" .format(venv.config_path)) print("You may want run first \"apt-get update\"") if args.update: venv.update() else: venv.run(command=args.command) except ValueError as exception: print (str(exception)) exit(1)
"""Master plugin for the Le bot. This plugins makes it possible to configure a Le bot to recognize a user as it's Master. """ from argparse import ArgumentParser as _ArgumentParser from telegram.ext import CommandHandler as _CommandHandler _parser = _ArgumentParser(add_help=False, fromfile_prefix_chars='@') _parser.add_argument('-m', '--master-id', required=True) _args, _ = _parser.parse_known_args() master_id = _args.master_id def _say_who_is_master(bot, update): """Respond telling the name of the master.""" name = bot.get_chat(master_id).username bot.send_message( update.message.chat_id, 'My master is @{name}.'.format(name=name) ) _handler = _CommandHandler('master', _say_who_is_master)
##################################### from argparse import ArgumentParser as _ArgumentParser from numpy import savetxt as _savetxt, arange as _arange, asarray as _asarray, array as _array, sort as _sort, ones as _ones, zeros as _zeros from rdkit.Chem import SmilesMolSupplier as _SmilesMolSupplier, MolFromMol2Block as _MolFromMol2Block, SDMolSupplier as _SDMolSupplier, MolToSmiles as _MolToSmiles, PathToSubmol as _PathToSubmol, FindAtomEnvironmentOfRadiusN as _FindAtomEnvironmentOfRadiusN from operator import add as _add from rdkit.Chem.AllChem import GetMorganFingerprintAsBitVect as _GetMorganFingerprintAsBitVect, GetMorganFingerprint as _GetMorganFingerprint from os.path import splitext as _splitext, exists as _exists from os import makedirs as _makedirs from rdkit.Chem.Draw import MolToFile as _MolToFile import sys ############# # Arguments passed to the script parser = _ArgumentParser( prog='PROG', description= 'Get Morgan Fingerprints for compounds codified in either SMILES or SDF format using RDkit. Isidro Cortes Ciriano. August/September 2013' ) parser.add_argument( '-bits', required='TRUE', type=int, help="Size of the hashed Morgan Fingerprints (binary and with counts)") parser.add_argument( '-radii', nargs="+", type=int, required='TRUE', help="Radii to be considered for the calculation of the fingerprints") parser.add_argument( '-mols',
from pygrader.email import test_smtp as _test_smtp from pygrader.email import Responder as _Responder from pygrader.mailpipe import mailpipe as _mailpipe from pygrader.storage import initialize as _initialize from pygrader.storage import load_course as _load_course from pygrader.tabulate import tabulate as _tabulate from pygrader.template import assignment_email as _assignment_email from pygrader.template import course_email as _course_email from pygrader.template import student_email as _student_email from pygrader.todo import print_todo as _todo if __name__ == '__main__': from argparse import ArgumentParser as _ArgumentParser parser = _ArgumentParser(description=__doc__) parser.add_argument( '-v', '--version', action='version', version='%(prog)s {}'.format(_pgp_mime.__version__)) parser.add_argument( '-d', '--base-dir', dest='basedir', default='.', help='Base directory containing grade data') parser.add_argument( '-e', '--encoding', dest='encoding', default='utf-8', help=('Override the default file encoding selection ' '(useful when running from procmail)')) parser.add_argument( '-c', '--color', default=False, action='store_const', const=True, help='Color printed output with ANSI escape sequences') parser.add_argument( '-V', '--verbose', default=0, action='count',
def main(): parser = _ArgumentParser(prog=__appname__) parser.add_argument('-D', '--debug', type=int, help='set debug level') parser.add_argument('-v', '--version', action='version', version='%(prog)s ' + _VERSION) parser.add_argument( '-c', '--command', help="exec the given command instead of entry the interactive shell") parser.add_argument('-d', '--delete', action="store_true", default=False, help="delete venv for release") parser.add_argument('-l', '--list', action="store_true", help="list all venv installed in your system") parser.add_argument('-u', '--update', action="store_true", help="update the apt indexes") parser.add_argument('release', nargs='?', help="the debian/ubuntu release") args = parser.parse_args() if 'APT_VENV' in _os.environ: print("You can't run apt-venv inside apt-venv session") exit(1) if args.debug: _utils.DEBUG_LEVEL = args.debug if args.list: data_path = _BaseDirectory.save_data_path(__appname__) dirs = _os.listdir(data_path) if len(dirs) > 0: print("Installed apt-venv:\n %s" % "\n ".join(dirs)) exit(0) else: print("There is no apt-venv on your system") exit(1) try: venv = _AptVenv(args.release) if args.delete: venv.delete() else: if not venv.exists(): venv.create() print("Welcome to apt virtual environment for {} release.". format(venv.release)) print("All the configuration is available in {}".format( venv.config_path)) print("You may want run first \"apt-get update\"") if args.update: venv.update() else: venv.run(command=args.command) except ValueError as exception: print(str(exception)) exit(1)
def _main_init(): global args parser = _ArgumentParser() parser.add_argument( '--virtual-client', type=str, help='initialize virtual client "address port [timeout]"') parser.add_argument('--virtual-server', type=str, help='start virtual server "address port [timeout]"') parser.add_argument('--root', help='root directory to search for the library') parser.add_argument('--path', help='the exact path of the library') parser.add_argument('--auth', help='password to use for authentication') parser.add_argument('-v', '--verbose', action="store_true", help='extra info to stdout about client connection(s)') args = parser.parse_args() #remove quotes if args.auth: args.auth = args.auth.strip("'").strip('"') if args.virtual_server and _SYS_IS_WIN: raw_args = args.virtual_server.split(' ') try: vs_args = ((raw_args[0], int(raw_args[1])), ) except IndexError: print("usage: tosdb --virtual-server 'address port [timeout]'", file=_stderr) exit(1) vs_args += (args.auth, ) vs_args += (int( raw_args[2]), ) if len(raw_args) > 2 else (DEF_TIMEOUT, ) vs_args += (args.verbose, ) #spin off so we don't block on exit _Thread(target=enable_virtualization, args=vs_args).start() if args.virtual_client: raw_args = args.virtual_client.split(' ') try: vc_args = ((raw_args[0], int(raw_args[1])), ) except IndexError: print("usage: tosdb --virtual-client 'address port [timeout]'", file=_stderr) exit(1) vc_args += (args.auth, ) vc_args += (int( raw_args[2]), ) if len(raw_args) > 2 else (DEF_TIMEOUT, ) admin_init(*vc_args) if args.virtual_client: if args.path: vinit(dllpath=args.path) elif args.root: vinit(root=args.root) else: if args.path: init(dllpath=args.path) elif args.root: init(root=args.root)