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


Python ConfigManager.get方法代码示例

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


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

示例1: register_nick_and_username

# 需要导入模块: from config import ConfigManager [as 别名]
# 或者: from config.ConfigManager import get [as 别名]
def register_nick_and_username():
    servconn().send_message(string.join([
        "NICK",
        ConfigManager.get("nick")], " "
    ))

    servconn().send_message(string.join([
        "USER",
        ConfigManager.get("nick"),
        socket.gethostname(),
        ConfigManager.get("server"),
        ConfigManager.get("nick")], " "
    ))
开发者ID:brlafreniere,项目名称:nickenbot,代码行数:15,代码来源:irc.py

示例2: __init__

# 需要导入模块: from config import ConfigManager [as 别名]
# 或者: from config.ConfigManager import get [as 别名]
 def __init__ (self):
   pygame.init()
   pygame.key.set_repeat(10,10)
   res = ConfigManager.get("resolution")
   self.screen = pygame.display.set_mode(res, pygame.DOUBLEBUF)
   self.ball = Ball()
   self.space = Space(res)
开发者ID:lndl,项目名称:spaceship-battle,代码行数:9,代码来源:game.py

示例3: register_default_actions

# 需要导入模块: from config import ConfigManager [as 别名]
# 或者: from config.ConfigManager import get [as 别名]
    def register_default_actions():
        def bot_command_action(bot_command_mo):
            command.execute(
                caller_nick=bot_command_mo.group(1),
                channel=bot_command_mo.group(2),
                command=bot_command_mo.group(4),
                arguments=bot_command_mo.group(5)
            )

        command_prefix_esc = re.escape(ConfigManager.get('command_prefix'))
        nick_esc = re.escape(ConfigManager.get('nick'))
        actions = [Action(
            regex=r"^:([^\s]+)![^\s]+ PRIVMSG ([^\s]+) :(%s|%s: )([\w-]+)[\s]*(.*)" % (command_prefix_esc, nick_esc),
            action=bot_command_action
        ),

        # Pinging
        Action(
            regex=r"^PING .*",
            action=lambda match_object: irc.pong(match_object.group(0))
        ),

        # Connection accepted (AKA RPL_WELCOME, status 001)
        Action(
            regex=r".* 001 %s" % ConfigManager.get('nick'),
            action=lambda match_object: irc.join_config_channels()
        ),

        # Nickname registered already
        # ':[email protected]/services/NickServ NOTICE nickenbot :This nickname is registered and protected.  If it is your'

        Action(
            regex=r"^:[email protected][^\s]+ NOTICE %s :.*registered.*" % ConfigManager.get('nick'),
            action=lambda match_object: irc.identify_with_nickserv()
        )]
        Action.actions = actions
开发者ID:brlafreniere,项目名称:nickenbot,代码行数:38,代码来源:parsing.py

示例4: __init__

# 需要导入模块: from config import ConfigManager [as 别名]
# 或者: from config.ConfigManager import get [as 别名]
    def __init__(self, host='wx.qq.com'):
        super(WeChat, self).__init__(host)

        self.db = None
        self.save_data_folder = ''  # 保存图片,语音,小视频的文件夹
        self.last_login = 0  # 上次退出的时间
        self.time_out = 5  # 同步时间间隔(单位:秒)
        self.msg_handler = None
        self.start_time = time.time()
        self.bot = None

        cm = ConfigManager()
        self.save_data_folders = cm.get_wechat_media_dir()
        self.cookie_file = cm.get_cookie()
        self.pickle_file = cm.get_pickle_files()
        self.log_mode = cm.get('setting', 'log_mode') == 'True'
        self.exit_code = 0
开发者ID:CrackerCat,项目名称:WeixinBot,代码行数:19,代码来源:wechat.py

示例5: ConfigManager

# 需要导入模块: from config import ConfigManager [as 别名]
# 或者: from config.ConfigManager import get [as 别名]
from config import Log
#---------------------------------------------------
from flask import Flask, render_template, send_file, jsonify, request
import threading
import traceback
import os
import logging
import time
#===================================================


cm = ConfigManager()
db = SqliteDB(cm.getpath('database'))
# db = MysqlDB(cm.mysql())
wechat_msg_processor = WeChatMsgProcessor(db)
wechat = WeChat(cm.get('wechat', 'host'))
wechat.db = db
wechat.bot = Bot()
wechat.msg_handler = wechat_msg_processor
wechat_msg_processor.wechat = wechat

PORT = int(cm.get('setting', 'server_port'))
app = Flask(__name__, template_folder='flask_templates')
app.config['UPLOAD_FOLDER'] = cm.getpath('uploaddir')

logger = logging.getLogger('werkzeug')
log_format_str = Constant.SERVER_LOG_FORMAT
formatter = logging.Formatter(log_format_str)
flask_log_handler = logging.FileHandler(cm.getpath('server_log_file'))
flask_log_handler.setLevel(logging.INFO)
flask_log_handler.setFormatter(formatter)
开发者ID:Jolly23,项目名称:WeixinBot,代码行数:33,代码来源:weixin_bot.py

示例6: Ball

# 需要导入模块: from config import ConfigManager [as 别名]
# 或者: from config.ConfigManager import get [as 别名]
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#  
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
#  MA 02110-1301, USA.
#  
#  

import pygame

from config import ConfigManager
from utils import *

WIDTH, HEIGHT = ConfigManager.get("resolution")  
    
class Ball(pygame.sprite.Sprite):
  '''
  Ball class (sprite)
  '''
  
  def __init__ (self):
    pygame.sprite.Sprite.__init__(self)
    self.image = load_image("ship.png")
    self.rect = self.image.get_rect()
    self.rect.centerx = HEIGHT / 2
    self.rect.centery = WIDTH / 2
    self.speed = 10
    self.dir = "UP"
开发者ID:lndl,项目名称:spaceship-battle,代码行数:32,代码来源:ball.py

示例7: join_config_channels

# 需要导入模块: from config import ConfigManager [as 别名]
# 或者: from config.ConfigManager import get [as 别名]
def join_config_channels():
    for channel in ConfigManager.get("channels"):
        join_channel(channel)
开发者ID:brlafreniere,项目名称:nickenbot,代码行数:5,代码来源:irc.py

示例8: identify_with_nickserv

# 需要导入模块: from config import ConfigManager [as 别名]
# 或者: from config.ConfigManager import get [as 别名]
def identify_with_nickserv():
    servconn().send_message(
        COMMANDS['NICKSERV_IDENTIFY'] % (ConfigManager.get("nick"), ConfigManager.get("password"))
    )
开发者ID:brlafreniere,项目名称:nickenbot,代码行数:6,代码来源:irc.py


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