当前位置: 首页>>代码示例>>Python>>正文


Python Cmd.__init__方法代码示例

本文整理汇总了Python中cmd2.Cmd.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Cmd.__init__方法的具体用法?Python Cmd.__init__怎么用?Python Cmd.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cmd2.Cmd的用法示例。


在下文中一共展示了Cmd.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from cmd2 import Cmd [as 别名]
# 或者: from cmd2.Cmd import __init__ [as 别名]
    def __init__(self, verbose=False):
        Cmd.__init__(self)

        self.pp = pprint.PrettyPrinter(indent=4)

        try:
            self.conn = boto.connect_dynamodb()
        except Exception as e:
            self.conn = None
            print e
            print "Cannot connect to dynamodb - Check your credentials in ~/.boto or use the 'login' command"

        # by default readline thinks - and other characters are word delimiters :(
        if readline:
            readline.set_completer_delims(re.sub('[-~]', '', readline.get_completer_delims()))

            path = os.path.join(os.environ.get('HOME', ''), HISTORY_FILE)
            self.history_file = os.path.abspath(path)
        else:
            self.history_file = None

        self.tables = []
        self.table = None
        self.consistent = False
        self.consumed = False
        self.verbose = verbose
        self.next_key = None
        self.schema = {}

        if verbose:
            self._onchange_verbose(None, verbose)
开发者ID:raff,项目名称:dynash,代码行数:33,代码来源:dynash.py

示例2: __init__

# 需要导入模块: from cmd2 import Cmd [as 别名]
# 或者: from cmd2.Cmd import __init__ [as 别名]
 def __init__(self):
     Cmd.__init__(self)
     mixins.bootstrap.BootstrapMixin.__init__(self)
     self._load_config()
     if 'url' in self.config and self.config['url']:
         self._init_stacks()
     self._validate_auth()
开发者ID:drdancain,项目名称:stackdio-python-client,代码行数:9,代码来源:__init__.py

示例3: __init__

# 需要导入模块: from cmd2 import Cmd [as 别名]
# 或者: from cmd2.Cmd import __init__ [as 别名]
 def __init__(self):
     Cmd.__init__(self)
     try:
         import readline
         readline.set_completer_delims(' \t\n"') # initially it was ' \t\n`[email protected]#$^&*()=+[{]}\\|;:\'",<>?', but I dont want to break on too many
     except:
         pass
开发者ID:fqj1994,项目名称:dupan,代码行数:9,代码来源:dupan.py

示例4: __init__

# 需要导入模块: from cmd2 import Cmd [as 别名]
# 或者: from cmd2.Cmd import __init__ [as 别名]
	def __init__(self, namefile):
		Cmd.__init__(self)
		self.last = []
		self.last.append([])
		self.prompt = bcolors.PROMPT + "ForPCAP >>> " + bcolors.ENDC
		self.loadPcap(namefile)
		self.cmd = ""
开发者ID:bl4ckic3,项目名称:ForensicPCAP,代码行数:9,代码来源:forensicPCAP.py

示例5: __init__

# 需要导入模块: from cmd2 import Cmd [as 别名]
# 或者: from cmd2.Cmd import __init__ [as 别名]
 def __init__(self, logical_device_id, get_stub):
     Cmd.__init__(self)
     self.get_stub = get_stub
     self.logical_device_id = logical_device_id
     self.prompt = '(' + self.colorize(
         self.colorize('logical device {}'.format(logical_device_id), 'red'),
         'bold') + ') '
开发者ID:gcgirish-radisys,项目名称:voltha,代码行数:9,代码来源:logical_device.py

示例6: __init__

# 需要导入模块: from cmd2 import Cmd [as 别名]
# 或者: from cmd2.Cmd import __init__ [as 别名]
 def __init__(self, session_obj):
     Cmd.__init__(self)
     self.my_session = session_obj
     self.supported_namespaces = ['poortego', 'cmd2']
     self.namespace = 'poortego'
     self.no_namespace_commands = ['help', 'welcome', 'namespace', 'exit']
     self.get_names_addendum = [] # list of additional class methods not returned from python dir() at runtime
     self.prompt = self.my_session.my_conf.conf_settings['poortego_prompt'] + ' '
开发者ID:ZionOps,项目名称:poortego,代码行数:10,代码来源:cmd2_interface.py

示例7: __init__

# 需要导入模块: from cmd2 import Cmd [as 别名]
# 或者: from cmd2.Cmd import __init__ [as 别名]
 def __init__(self, *args, **kwargs):
     self.user = kwargs.pop("user")
     self.username = kwargs.pop("username")
     self.passwd = kwargs.pop("passwd")
     self.api_auth = HTTPBasicAuth(self.username, self.passwd)
     self.site = Site.objects.get_current()
     self.prompt = "Schemanizer(%s)> " % (self.username)
     Cmd.__init__(self, *args, **kwargs)
开发者ID:killkill,项目名称:schemanizer,代码行数:10,代码来源:signin.py

示例8: __init__

# 需要导入模块: from cmd2 import Cmd [as 别名]
# 或者: from cmd2.Cmd import __init__ [as 别名]
 def __init__(self, device_id, get_stub):
     Cmd.__init__(self)
     self.get_stub = get_stub
     self.device_id = device_id
     self.prompt = '(' + self.colorize(
         self.colorize('device {}'.format(device_id), 'red'), 'bold') + ') '
     self.pm_config_last = None
     self.pm_config_dirty = False
开发者ID:gcgirish-radisys,项目名称:voltha,代码行数:10,代码来源:device.py

示例9: __init__

# 需要导入模块: from cmd2 import Cmd [as 别名]
# 或者: from cmd2.Cmd import __init__ [as 别名]
    def __init__(self):
        Cmd.__init__(self)
        self.cli_parser = argparse.ArgumentParser()

        subparsers = self.cli_parser.add_subparsers(help='internal commands')

        publish_parser = subparsers.add_parser('publish', help='publish')
        publish_parser.add_argument('--to', dest="to", metavar='PATH', type=str,
                                    help='acoustic model directory', required=True)
开发者ID:aurelienmaury,项目名称:zero-console,代码行数:11,代码来源:zero-console.py

示例10: __init__

# 需要导入模块: from cmd2 import Cmd [as 别名]
# 或者: from cmd2.Cmd import __init__ [as 别名]
 def __init__(self, **kwargs):
     Cmd.__init__(self, **kwargs)
     self.prompt = 'BES> '
     #self.do_conf(None)
     
     self.BES_ROOT_SERVER = None
     self.BES_USER_NAME = None
     self.BES_PASSWORD = None
     self.bes_conn = None
开发者ID:CLCMacTeam,项目名称:besapi,代码行数:11,代码来源:bescli.py

示例11: __init__

# 需要导入模块: from cmd2 import Cmd [as 别名]
# 或者: from cmd2.Cmd import __init__ [as 别名]
 def __init__(self, parent):
     Cmd.__init__(self)
     self.parent = parent
     self.prompt = self.parent.prompt[:-2] + "find:: "
     self.machines = []
     self.project = ""
     self.locdata_dirs = []
     self.project_dirs = []
     self.record = self.parent.record
开发者ID:gjcoombes,项目名称:jack,代码行数:11,代码来源:jack.py

示例12: __init__

# 需要导入模块: from cmd2 import Cmd [as 别名]
# 或者: from cmd2.Cmd import __init__ [as 别名]
    def __init__(self):
        package = kolala.actions
        for loader, name, is_pkg in pkgutil.walk_packages(package.__path__):
            module = loader.find_module(name).load_module(name)
            if getattr(module, 'main', None) is not None:
                setattr(self, 'do_' + name, module.main)
            if getattr(module, 'help', None) is not None:
                setattr(self, 'help_' + name, module.help)

        Cmd.__init__(self)
开发者ID:mapledyne,项目名称:kolala,代码行数:12,代码来源:KoLCmd.py

示例13: __init__

# 需要导入模块: from cmd2 import Cmd [as 别名]
# 或者: from cmd2.Cmd import __init__ [as 别名]
 def __init__(self, files, apk):
     Binja.__init__(self)
     self.t = Terminal()
     self.logger = Logger()
     self.files = files
     self.apk = apk
     self.libs = list()
     self.rpc = None
     self.target_library = None
     self._init_binja()
开发者ID:security-geeks,项目名称:MARA_Framework,代码行数:12,代码来源:binja.py

示例14: __init__

# 需要导入模块: from cmd2 import Cmd [as 别名]
# 或者: from cmd2.Cmd import __init__ [as 别名]
    def __init__(self, silent, user, passwd):

        self.base_cmds = ['exec', 'help', 'history','manual', 'quit', 'use', 'contexts', 'script']
        base_cmd2 = ['li', 'load', 'pause', 'py', 'run', 'save', 'shortcuts', 'set', 'show', 'historysession']
        self.base_cmds += base_cmd2

        self._locals = {}
        self._globals = {}

        self.user = user
        self.passwd = ""
        
        self.passwdtype = "ldappass"
        userCred = FGCredential(self.passwdtype,passwd)
        if not self.check_simpleauth(userCred):
            sys.exit()


        #Load Config
        self._conf = fgShellConf()
        
        #Setup log  
        self._log = fgLog(self._conf.getLogFile(), self._conf.getLogLevel(), "FGShell", False)

        self._log.debug("\nReading Configuration file from " + self._conf.getConfigFile() + "\n")

        Cmd.__init__(self)        
        fgShellUtils.__init__(self)        

        #Context        
        self.env = ["repo", "hadoop", "image", "rain", ""]
        self.text = {'image': 'Image Management',
                     'repo':'Image Repository',
                     'rain':'FG Dynamic Provisioning',
                     'hadoop':'Apache Hadoop'}
        self._use = ""
        self._requirements = []
        self._contextOn = [] # initialized contexts

        #Help
        self._docHelp = []
        self._undocHelp = []
        self._specdocHelp = []
        self.getDocUndoc("")

        self.prompt = "fg> "
        self.silent = silent
        if self.silent:
            self.intro = ""
        else:
            self.intro = self.loadBanner()
        ##Load History
        self.loadhist("no argument needed")
开发者ID:futuregrid,项目名称:rain2-donotuse,代码行数:55,代码来源:fgCLI.py

示例15: __init__

# 需要导入模块: from cmd2 import Cmd [as 别名]
# 或者: from cmd2.Cmd import __init__ [as 别名]
    def __init__(self, port, debug):
        Cmd.__init__(self)

        if readline:
            path = os.path.join(os.environ.get('HOME', ''), HISTORY_FILE)
            self.history_file = os.path.abspath(path)
        else:
            self.history_file = None

        self.debug = debug
        self.port = port
        self.init_search()
开发者ID:RomanShestakov,项目名称:elseql,代码行数:14,代码来源:elseql.py


注:本文中的cmd2.Cmd.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。