• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python functions.splitDSN函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中b3.functions.splitDSN函数的典型用法代码示例。如果您正苦于以下问题:Python splitDSN函数的具体用法?Python splitDSN怎么用?Python splitDSN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: init_thread

 def init_thread(self, ftpfiledsn):
     self.ftpconfig = functions.splitDSN(ftpfiledsn)
     # the '/' is not part of the uri-path according to RFC 1738 3.1. Common Internet Scheme Syntax
     self.url_path = self.ftpconfig['path'][1:]
     thread1 = threading.Thread(target=self.update)
     self.info("starting ftpytail thread")
     thread1.start()
开发者ID:HaoDrang,项目名称:big-brother-bot,代码行数:7,代码来源:__init__.py


示例2: onLoadConfig

    def onLoadConfig(self):
        """
        Load plugin configuration.
        """
        try:

            if self.config.get('settings', 'output_file')[0:6] == 'ftp://':
                self._ftpstatus = True
                self._ftpinfo = functions.splitDSN(self.config.get('settings', 'output_file'))
                self.debug('using custom remote path for settings/output_file: %s/%s' % (self._ftpinfo['host'], self._ftpinfo['path']))
            else:
                self._outputFile = self.config.getpath('settings', 'output_file')
                self.debug('using custom local path for settings/output_file: %s' % self._outputFile)

        except NoOptionError:
            self._outputFile = os.path.normpath(os.path.expanduser(self._outputFile))
            self.warning('could not find settings/output_file in config file, using default: %s' % self._outputFile)

        self._tkPlugin = self.console.getPlugin('tk')

        try:
            self._interval = self.config.getint('settings', 'interval')
            self.debug('using custom value for settings/interval: %s' % self._interval)
        except NoOptionError:
            self.warning('could not find settings/interval in config file, using default: %s' % self._interval)
        except ValueError, e:
            self.error('could not load settings/interval config value: %s' % e)
            self.debug('using default value (%s) for settings/interval' % self._interval)
开发者ID:82ndab-Bravo17,项目名称:big-brother-bot,代码行数:28,代码来源:__init__.py


示例3: initThread

 def initThread(self, httpfileDSN):
     self.httpconfig = functions.splitDSN(httpfileDSN)
     self.url = httpfileDSN
     self.stop_event.clear()
     self.thread1 = threading.Thread(target=self.update)
     self.info("Starting httpytail thread")
     self.thread1.start()
开发者ID:bdgrell,项目名称:big-brother-bot,代码行数:7,代码来源:__init__.py


示例4: __init__

    def __init__(self, config):
        """
        Object constructor.
        :param config: The main configuration file
        """
        b3.console = self
        self._timeStart = self.time()
        logging.basicConfig(level=b3.output.VERBOSE2, format='%(asctime)s\t%(levelname)s\t%(message)s')
        self.log = logging.getLogger('output')
        self.config = config

        if isinstance(config, b3.config.XmlConfigParser) or isinstance(config, b3.config.CfgConfigParser):
            self.config = b3.config.MainConfig(config)
        elif isinstance(config, b3.config.MainConfig):
            self.config = config
        else:
            self.config = b3.config.MainConfig(b3.config.load(config))

        self.storage = SqliteStorage("sqlite://:memory:", splitDSN("sqlite://:memory:"), self)
        self.storage.connect()
        self.clients = b3.clients.Clients(self)
        self.game = b3.game.Game(self, "fakeGame")
        self.game.mapName = 'ut4_turnpike'
        self.cvars = {}
        self._handlers = {}
        
        if not self.config.has_option('server', 'punkbuster') or self.config.getboolean('server', 'punkbuster'):
            self.PunkBuster = b3.parsers.punkbuster.PunkBuster(self)
        
        self.input = StringIO.StringIO()
        self.working = True
开发者ID:82ndab-Bravo17,项目名称:big-brother-bot,代码行数:31,代码来源:fake.py


示例5: startup

    def startup(self):
        self.debug("startup()")
        
        # create the 'Server' client
        self.clients.newClient('Server', guid='Server', name='Server', hide=True, pbid='Server', team=b3.TEAM_UNKNOWN)

        if self.config.has_option('server','inifile'):
            # open ini file
            ini_file = self.config.get('server','inifile')
            if ini_file[0:6] == 'ftp://':
                    self.ftpconfig = functions.splitDSN(ini_file)
                    self._ini_file = 'ftp'
                    self.bot('ftp supported')
            elif ini_file[0:7] == 'sftp://':
                self.bot('sftp currently not supported')
            else:
                self.bot('Getting configs from %s', ini_file)
                f = self.config.getpath('server', 'inifile')
                if os.path.isfile(f):
                    self.input  = file(f, 'r')
                    self._ini_file = f

        if not self._ini_file:
            self.debug('Incorrect ini file or no ini file specified, map commands other than nextmap not available')
            
        # start crontab to trigger playerlist events
        self._cronTab = b3.cron.CronTab(self.retrievePlayerList, second='*/%s' % self._playerlistInterval)
        self.cron + self._cronTab

        # add specific events
        self.Events.createEvent('EVT_CLIENT_SQUAD_SAY', 'Squad Say')
        self.Events.createEvent('EVT_SERVER_SAY', 'Server Chatter')
        self.Events.createEvent('EVT_CLIENT_CLAN_CHANGE', 'Client Clan Change')
开发者ID:aceofskys,项目名称:big-brother-bot,代码行数:33,代码来源:__init__.py


示例6: update

  def update(self):
    self.debug('Sending heartbeat to B3 master...')
    
    
    def getModule(name):
      mod = __import__(name)
      components = name.split('.')
      for comp in components[1:]:
        mod = getattr(mod, comp)
      return mod
      
    plugins = []
    for pname in self.console._pluginOrder:
      plugins.append("%s/%s" % (pname, getattr(getModule(self.console.getPlugin(pname).__module__), '__version__', 'Unknown Version')))
      
    info = {
      'ip' : self.console._publicIp,
      'port' : self.console._port,
      'version' : getattr(b3, '__version__', 'Unknown Version'),
      'parser' : self.console.gameName,
      'parserversion' : getattr(getModule(self.console.__module__), '__version__', 'Unknown Version'),
      'database' : functions.splitDSN(self.console.storage.dsn)['protocol'],
      'plugins' : ','.join(plugins),
      'os' : os.name
    }
    #self.debug(info)

    f = urllib.urlopen('%s?%s' % (self._url, urllib.urlencode(info)))
    self.debug(f.read())
    f.close()

      
开发者ID:Weeman,项目名称:big-brother-bot,代码行数:30,代码来源:publist.py


示例7: onLoadConfig

    def onLoadConfig(self):
        """
        Load plugin configuration.
        """
        try:

            if self.config.get("settings", "output_file")[0:6] == "ftp://":
                self._ftpstatus = True
                self._ftpinfo = functions.splitDSN(self.config.get("settings", "output_file"))
                self.debug(
                    "using custom remote path for settings/output_file: %s/%s"
                    % (self._ftpinfo["host"], self._ftpinfo["path"])
                )
            else:
                self._outputFile = self.config.getpath("settings", "output_file")
                self.debug("using custom local path for settings/output_file: %s" % self._outputFile)

        except NoOptionError:
            self._outputFile = os.path.normpath(os.path.expanduser(self._outputFile))
            self.warning("could not find settings/output_file in config file, using default: %s" % self._outputFile)

        self._tkPlugin = self.console.getPlugin("tk")

        try:
            self._interval = self.config.getint("settings", "interval")
            self.debug("using custom value for settings/interval: %s" % self._interval)
        except NoOptionError:
            self.warning("could not find settings/interval in config file, using default: %s" % self._interval)
        except ValueError, e:
            self.error("could not load settings/interval config value: %s" % e)
            self.debug("using default value (%s) for settings/interval" % self._interval)
开发者ID:BigBrotherBot,项目名称:big-brother-bot,代码行数:31,代码来源:__init__.py


示例8: update

 def update(self):
     self.debug('Sending heartbeat to B3 master...')
     socket.setdefaulttimeout(10)
     
     plugins = []
     for pname in self.console._pluginOrder:
         plugins.append("%s/%s" % (pname, getattr(getModule(self.console.getPlugin(pname).__module__), '__version__', 'Unknown Version')))
       
     try:
         database = functions.splitDSN(self.console.storage.dsn)['protocol']
     except:
         database = "unknown"
         
     version = getattr(b3, '__version__', 'Unknown Version')
     if b3.functions.main_is_frozen():
         version += " win32"
         
     info = {
         'action' : 'update',
         'ip' : self.console._publicIp,
         'port' : self.console._port,
         'rconPort' : self.console._rconPort,
         'version' : version,
         'parser' : self.console.gameName,
         'parserversion' : getattr(getModule(self.console.__module__), '__version__', 'Unknown Version'),
         'database' : database,
         'plugins' : ','.join(plugins),
         'os' : os.name,
         'python_version': sys.version
     }
     #self.debug(info)
     self.sendInfo(info)
开发者ID:Rhidalin-Bytes,项目名称:big-brother-bot,代码行数:32,代码来源:publist.py


示例9: onLoadConfig

    def onLoadConfig(self):
        if self.config.get('settings','output_file')[0:6] == 'ftp://':
                self._ftpinfo = functions.splitDSN(self.config.get('settings','output_file'))
                self._ftpstatus = True
        else:        
                self._outputFile = os.path.expanduser(self.config.get('settings', 'output_file'))
                
        self._tkPlugin = self.console.getPlugin('tk')
        self._interval = self.config.getint('settings', 'interval')
        try:
            self._enableDBsvarSaving = self.config.getboolean('settings', 'enableDBsvarSaving')
        except:
            self._enableDBsvarSaving = False

        try:
            self._enableDBclientSaving = self.config.getboolean('settings', 'enableDBclientSaving')
        except:
            self._enableDBclientSaving = False

        if self._enableDBsvarSaving:
            sql = "CREATE TABLE IF NOT EXISTS `current_svars` (`id` int(11) NOT NULL auto_increment,`name` varchar(255) NOT NULL,`value` varchar(255) NOT NULL, PRIMARY KEY  (`id`), UNIQUE KEY `name` (`name`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;"
            self.console.storage.query(sql)
        if self._enableDBclientSaving:
            sql = "CREATE TABLE IF NOT EXISTS `current_clients` (`id` INT(3) NOT NULL AUTO_INCREMENT,`Updated` VARCHAR( 255 ) NOT NULL ,`Name` VARCHAR( 255 ) NOT NULL ,`Level` VARCHAR( 255 ) NOT NULL ,`DBID` VARCHAR( 255 ) NOT NULL ,`CID` VARCHAR( 255 ) NOT NULL ,`Joined` VARCHAR( 255 ) NOT NULL ,`Connections` VARCHAR( 255 ) NOT NULL ,`State` VARCHAR( 255 ) NOT NULL ,`Score` VARCHAR( 255 ) NOT NULL ,`IP` VARCHAR( 255 ) NOT NULL ,`GUID` VARCHAR( 255 ) NOT NULL ,`PBID` VARCHAR( 255 ) NOT NULL ,`Team` VARCHAR( 255 ) NOT NULL ,`ColorName` VARCHAR( 255 ) NOT NULL, PRIMARY KEY (`id`)) ENGINE = MYISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;"
            self.console.storage.query(sql)

        if self._cronTab:
            # remove existing crontab
            self.console.cron - self._cronTab

        self._cronTab = b3.cron.PluginCronTab(self, self.update, '*/%s' % self._interval)
        self.console.cron + self._cronTab
开发者ID:Gammelbob,项目名称:big-brother-bot,代码行数:32,代码来源:status.py


示例10: __init__

 def __init__(self, dsn, console):
     self.console = console
     self._lock = thread.allocate_lock()
     self.db = None
     self.dsn = dsn
     self.dsnDict = functions.splitDSN(self.dsn)
     self.connect()
开发者ID:holdensmagicalunicorn,项目名称:big-brother-bot,代码行数:7,代码来源:database.py


示例11: onLoadConfig

 def onLoadConfig(self):
     if self.config.get('settings','output_file')[0:6] == 'ftp://':
         self._ftpinfo = functions.splitDSN(self.config.get('settings','output_file'))
         self._ftpstatus = True
     else:        
         self._outputFile = os.path.expanduser(self.config.get('settings', 'output_file'))
     self._cvars = [var.strip() for var in self.config.get('settings', 'cvars').split(',')]
     self.dump = self.config.get('settings','time').split(':')
开发者ID:Classixz,项目名称:b3bot-codwar,代码行数:8,代码来源:configdump.py


示例12: startup

    def startup(self):
        self.debug("startup()")
        
        # create the 'Server' client
        self.clients.newClient('Server', guid='Server', name='Server', hide=True, pbid='Server', team=b3.TEAM_UNKNOWN)

        if self.config.has_option('server','inifile'):
            # open ini file
            ini_file = self.config.get('server','inifile')
            if ini_file[0:6] == 'ftp://':
                    self.ftpconfig = functions.splitDSN(ini_file)
                    self._ini_file = 'ftp'
                    self.bot('ftp supported')
            elif ini_file[0:7] == 'sftp://':
                self.bot('sftp currently not supported')
            else:
                self.bot('Getting configs from %s', ini_file)
                f = self.config.getpath('server', 'inifile')
                if os.path.isfile(f):
                    self.input  = file(f, 'r')
                    self._ini_file = f

        if not self._ini_file:
            self.debug('Incorrect ini file or no ini file specified, map commands other than nextmap not available')
            
        # start crontab to trigger playerlist events
        self.cron + b3.cron.CronTab(self.retrievePlayerList, second='*/%s' % self._playerlistInterval)

        # add specific events
        self.Events.createEvent('EVT_CLIENT_SQUAD_SAY', 'Squad Say')
        self.Events.createEvent('EVT_SERVER_SAY', 'Server Chatter')
        self.Events.createEvent('EVT_CLIENT_CLAN_CHANGE', 'Client Clan Change')
        self.Events.createEvent('EVT_CLIENT_VOTE_START', 'Client Vote Start')
        self.Events.createEvent('EVT_CLIENT_VOTE', 'Client Vote')
        self.Events.createEvent('EVT_SERVER_VOTE_END', 'Server Vote End')
        #self.Events.createEvent('EVT_CLIENT_SQUAD_CHANGE', 'Client Squad Change')
                
        ## read game server info and store as much of it in self.game wich
        ## is an instance of the b3.game.Game class
        sq = SourceQuery.SourceQuery(self._publicIp, self._port, timeout=10)
        try:
            serverinfo = sq.info()
            self.debug("server info : %r", serverinfo)
            if 'map' in serverinfo:
                self.game.mapName = serverinfo['map'].lower()
            if 'steamid' in serverinfo:
                self.game.steamid = serverinfo['steamid']
            if 'hostname' in serverinfo:
                self.game.sv_hostname = serverinfo['hostname']
            if 'maxplayers' in serverinfo:
                self.game.sv_maxclients = serverinfo['maxplayers']
        except Exception, err:
            self.exception(err)
开发者ID:holdensmagicalunicorn,项目名称:big-brother-bot,代码行数:53,代码来源:__init__.py


示例13: test_getConnection_mysql

    def test_getConnection_mysql(self):
        # mock the pymysql module so we can test in an environement which does not have this module installed
        dsn = "mysql://someuser:[email protected]:someport/somedbname"
        mock_pymysql = Mock()
        mock_pymysql.connect = Mock(return_value=sentinel)
        with patch.dict('sys.modules', {'pymysql': mock_pymysql}):

            # verify that a correct dsn does work as expected
            mock_pymysql.connect.reset_mock()
            storage = MysqlStorage(dsn, splitDSN(dsn), Mock())
            when(storage).getTables().thenReturn(B3_DEFAULT_TABLES)
            storage.connect()
            assert mock_pymysql.connect.called, "expecting pymysql.connect to be called"
            self.assertEqual(sentinel, storage.db)

            # verify that B3 creates necessary tables when they are missing
            mock_pymysql.connect.reset_mock()
            storage = MysqlStorage(dsn, splitDSN(dsn), Mock())
            when(storage).getTables().thenReturn([])
            storage.queryFromFile = Mock()
            storage.connect()
            assert storage.queryFromFile.called, "expecting MysqlStorage.queryFromFile to be called"
            self.assertEqual(sentinel, storage.db)

            # verify that whenever B3 is not able to create necessary tables, it stops
            mock_pymysql.connect.reset_mock()
            console_mock = Mock()
            console_mock.critical = Mock()
            storage = MysqlStorage(dsn, splitDSN(dsn), console_mock)
            storage.shutdown = Mock()
            when(storage).getTables().thenReturn([])
            when(storage).queryFromFile(ANY()).thenRaise(Exception())
            storage.connect()
            assert storage.shutdown.called, "expecting MysqlStorage.shutdown to be called"
            assert console_mock.critical.called, "expecting console_mock.critical to be called"
            self.assertIn("Missing MySQL database tables", console_mock.critical.call_args[0][0])
开发者ID:HaoDrang,项目名称:big-brother-bot,代码行数:36,代码来源:test_database_storage.py


示例14: setUp

    def setUp(self):
        """this method is called before each test"""
        B3TestCase.setUp(self)

        try:
            dsn = "postgresql://%s:%[email protected]%s/%s" % (POSTGRESQL_TEST_USER, POSTGRESQL_TEST_PASSWORD, POSTGRESQL_TEST_HOST, POSTGRESQL_TEST_DB)
            self.storage = self.console.storage = PostgresqlStorage(dsn, splitDSN(dsn), self.console)
            self.storage.connect()

            tables = self.storage.getTables()
            if tables:
                # dont remove the groups table since we would need it in next tests
                tables.remove('groups')
                self.storage.truncateTable(tables)
        except Exception, e:
            self.fail("Error: %s" % e)
开发者ID:82ndab-Bravo17,项目名称:big-brother-bot,代码行数:16,代码来源:test_postgresql.py


示例15: onLoadConfig

    def onLoadConfig(self):
        if self.config.get('settings','output_file')[0:6] == 'ftp://':
                self._ftpinfo = functions.splitDSN(self.config.get('settings','output_file'))
                self._ftpstatus = True
        else:        
                self._outputFile = os.path.expanduser(self.config.get('settings', 'output_file'))
                
        self._tkPlugin = self.console.getPlugin('tk')
        self._interval = self.config.getint('settings', 'interval')

        if self._cronTab:
            # remove existing crontab
            self.console.cron - self._cronTab

        self._cronTab = b3.cron.PluginCronTab(self, self.update, '*/%s' % self._interval)
        self.console.cron + self._cronTab
开发者ID:Rhidalin-Bytes,项目名称:big-brother-bot,代码行数:16,代码来源:status.py


示例16: startup

    def startup(self):
        """
        Called after the parser is created before run().
        """
        self.debug("startup")
        # create the 'Admin' client
        self.clients.newClient('Admin', guid='Server', name='Admin', hide=True, pbid='Server', team=b3.TEAM_UNKNOWN)
        if self.config.has_option('server','ro2admin'):
            self.username = self.config.get('server', 'ro2admin')
        else:
            self.username = "Admin"
        
        if self.config.has_option('server','inifile'):
            # open ini file
            ini_file = self.config.get('server','inifile')
            if ini_file[0:6] == 'ftp://':
                    self.ftpconfig = functions.splitDSN(ini_file)
                    self._ini_file = 'ftp'
                    self.bot('ftp supported')
            elif ini_file[0:7] == 'sftp://':
                self.bot('sftp currently not supported')
            else:
                self.bot('getting configs from %s', ini_file)
                f = self.config.getpath('server', 'inifile')
                if os.path.isfile(f):
                    self.input  = file(f, 'r')
                    self._ini_file = f

        if not self._ini_file:
            self.debug('Incorrect ini file or no ini file specified: map commands other than nextmap not available')

        self.cron.add(b3.cron.CronTab(self.retrievePlayerList, second='*/%s' % self._playerlistInterval))
    
        self.user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
        self.headers = {'User-Agent': self.user_agent,
                        "Accept": "ext/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
                        "Accept-Language": "en-us,en;q =0.5",
                        "Content-type": "application/x-www-form-urlencoded",
                        "Accept-Charset": "ISO-8859-1,utf-8;q=0.7,*;q=0.7",
                        "Referer": ''}

        self.site = self._publicIp + ':' + str(self._rconPort)
        self.login_page = "ServerAdmin"
        self.password = self._rconPassword
        self.password_hash = "$sha1$%s" % hashlib.sha1("%s%s" % (self.password, self.username)).hexdigest()
        self.url = "http://%s/%s" % (self.site, self.login_page)
开发者ID:82ndab-Bravo17,项目名称:big-brother-bot,代码行数:46,代码来源:ro2.py


示例17: update

 def update(self):
     """send an upate heartbeat to B3 master server"""
     self.debug('Sending heartbeat to B3 master...')
     socket.setdefaulttimeout(10)
     
     plugins = []
     for pname in self.console._pluginOrder:
         plugins.append("%s/%s" % (pname, getattr(getModule(self.console.getPlugin(pname).__module__), '__version__', 'Unknown Version')))
       
     try:
         database = functions.splitDSN(self.console.storage.dsn)['protocol']
     except:
         database = "unknown"
         
     version = getattr(b3, '__version__', 'Unknown Version')
     if b3.functions.main_is_frozen():
         version += " win32"
         
     info = {
         'action' : 'update',
         'ip' : self.console._publicIp,
         'port' : self.console._port,
         'rconPort' : self.console._rconPort,
         'version' : version,
         'parser' : self.console.gameName,
         'parserversion' : getattr(getModule(self.console.__module__), '__version__', 'Unknown Version'),
         'database' : database,
         'plugins' : ','.join(plugins),
         'os' : os.name,
         'python_version': sys.version,
         'default_encoding': sys.getdefaultencoding()
     }
     
     if self.console.gameName in ('bfbc2', 'moh'):
         try:
             cvarDescription = self.console.getCvar('serverDescription')
             if cvarDescription is not None:
                 info.update({'serverDescription': cvarDescription.value})
             cvarBannerUrl = self.console.getCvar('bannerUrl')
             if cvarBannerUrl is not None:
                 info.update({'bannerUrl': cvarBannerUrl.value})
         except Exception, err:
             self.debug(err)
开发者ID:Kelso-Utah,项目名称:big-brother-bot,代码行数:43,代码来源:publist.py


示例18: update

    def update(self):
        self.debug("Sending heartbeat to B3 master...")
        socket.setdefaulttimeout(10)

        def getModule(name):
            mod = __import__(name)
            components = name.split(".")
            for comp in components[1:]:
                mod = getattr(mod, comp)
            return mod

        plugins = []
        for pname in self.console._pluginOrder:
            plugins.append(
                "%s/%s"
                % (
                    pname,
                    getattr(getModule(self.console.getPlugin(pname).__module__), "__version__", "Unknown Version"),
                )
            )

        try:
            database = functions.splitDSN(self.console.storage.dsn)["protocol"]
        except:
            database = "unknown"

        version = getattr(b3, "__version__", "Unknown Version")
        if b3.functions.main_is_frozen():
            version += " win32"

        info = {
            "action": "update",
            "ip": self.console._publicIp,
            "port": self.console._port,
            "version": version,
            "parser": self.console.gameName,
            "parserversion": getattr(getModule(self.console.__module__), "__version__", "Unknown Version"),
            "database": database,
            "plugins": ",".join(plugins),
            "os": os.name,
        }
        # self.debug(info)
        self.sendInfo(info)
开发者ID:spacepig,项目名称:big-brother-bot,代码行数:43,代码来源:publist.py


示例19: _write

 def _write(self, text):
     if text.strip() == '':
         self._console.warning('AUTODOC: nothing to write')
         
     dsn = splitDSN(self._outputUrl)
     if dsn['protocol'] == 'ftp':
         self._console.debug('AUTODOC: uploading to FTP server %s' % dsn['host'])
         ftp = FTP(dsn['host'], dsn['user'], passwd=dsn['password'])
         ftp.cwd(os.path.dirname(dsn['path']))
         ftpfile = StringIO.StringIO()
         ftpfile.write(text)
         ftpfile.seek(0)
         ftp.storbinary('STOR ' + os.path.basename(dsn['path']), ftpfile)
     elif dsn['protocol'] == 'file':
         path = getWritableFilePath(dsn['path'], True)
         self._console.debug('AUTODOC: writing to %s', path)
         f = file(path, 'w')
         f.write(text)
         f.close()
     else:
         self._console.error('AUTODOC: protocol [%s] is not supported' % dsn['protocol'])
开发者ID:82ndab-Bravo17,项目名称:big-brother-bot,代码行数:21,代码来源:documentationBuilder.py


示例20: onLoadConfig

    def onLoadConfig(self):
        if self.config.get('settings','bans_file')[0:6] == 'ftp://':
            self._bansFile = self.config.get('settings','bans_file')
            self._remoteBansFile = True
            self._ftpConfig = functions.splitDSN(self._bansFile)
            self.info('Accessing pbbans.dat file in remote mode')
        else:
            self._bansFile = self.console.getAbsolutePath(self.config.get('settings', 'bans_file'))


        self._rebuildBans = self.config.get('settings', 'rebuild_bans')

        if self._cronTab:
            # remove old crontab
            self.console.cron - self._cronTab

        if self._rebuildBans == '0' or self._rebuildBans == 0:
            self._rebuildBans = 0
        else:
            minute, hour, day, month, dow = self._rebuildBans.split(' ')
            self._cronTab = b3.cron.PluginCronTab(self, self.rebuildBans, '0', minute, hour, day, month, dow)
            self.console.cron + self._cronTab
开发者ID:BradyBrenot,项目名称:big-brother-bot,代码行数:22,代码来源:punkbuster.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python abstractParser.AbstractParser类代码示例发布时间:2022-05-24
下一篇:
Python fake.FakeClient类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap