python类makedir()的实例源码

config.py 文件源码 项目:charm-ceilometer 作者: openstack 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def pre_write(self):
        settings = utils.get_settings('ssh')
        apt_update(fatal=True)
        apt_install(settings['client']['package'])
        if not os.path.exists('/etc/ssh'):
            os.makedir('/etc/ssh')
            # NOTE: don't recurse
            utils.ensure_permissions('/etc/ssh', 'root', 'root', 0o0755,
                                     maxdepth=0)
config.py 文件源码 项目:charm-ceilometer 作者: openstack 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def pre_write(self):
        settings = utils.get_settings('ssh')
        apt_update(fatal=True)
        apt_install(settings['server']['package'])
        if not os.path.exists('/etc/ssh'):
            os.makedir('/etc/ssh')
            # NOTE: don't recurse
            utils.ensure_permissions('/etc/ssh', 'root', 'root', 0o0755,
                                     maxdepth=0)
config.py 文件源码 项目:charm-ceilometer 作者: openstack 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def pre_write(self):
        settings = utils.get_settings('ssh')
        apt_update(fatal=True)
        apt_install(settings['client']['package'])
        if not os.path.exists('/etc/ssh'):
            os.makedir('/etc/ssh')
            # NOTE: don't recurse
            utils.ensure_permissions('/etc/ssh', 'root', 'root', 0o0755,
                                     maxdepth=0)
config.py 文件源码 项目:charm-ceilometer 作者: openstack 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def pre_write(self):
        settings = utils.get_settings('ssh')
        apt_update(fatal=True)
        apt_install(settings['server']['package'])
        if not os.path.exists('/etc/ssh'):
            os.makedir('/etc/ssh')
            # NOTE: don't recurse
            utils.ensure_permissions('/etc/ssh', 'root', 'root', 0o0755,
                                     maxdepth=0)
config.py 文件源码 项目:charm-ceilometer 作者: openstack 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def pre_write(self):
        settings = utils.get_settings('ssh')
        apt_update(fatal=True)
        apt_install(settings['client']['package'])
        if not os.path.exists('/etc/ssh'):
            os.makedir('/etc/ssh')
            # NOTE: don't recurse
            utils.ensure_permissions('/etc/ssh', 'root', 'root', 0o0755,
                                     maxdepth=0)
config.py 文件源码 项目:charm-ceph 作者: openstack 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def pre_write(self):
        settings = utils.get_settings('ssh')
        apt_update(fatal=True)
        apt_install(settings['client']['package'])
        if not os.path.exists('/etc/ssh'):
            os.makedir('/etc/ssh')
            # NOTE: don't recurse
            utils.ensure_permissions('/etc/ssh', 'root', 'root', 0o0755,
                                     maxdepth=0)
config.py 文件源码 项目:charm-ceph 作者: openstack 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def pre_write(self):
        settings = utils.get_settings('ssh')
        apt_update(fatal=True)
        apt_install(settings['server']['package'])
        if not os.path.exists('/etc/ssh'):
            os.makedir('/etc/ssh')
            # NOTE: don't recurse
            utils.ensure_permissions('/etc/ssh', 'root', 'root', 0o0755,
                                     maxdepth=0)
points_stuff.py 文件源码 项目:Basic-discord-bot 作者: TheWizoid 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def add_points(message):
    """
    Every time someone sends a message, they gain one point.
    This is because any time based ones would result in mobile users having
    the same amount of each, due to idling.
    """

    split_message = message.content.split()

    message.author.name = message.author.name.lower()
    points = load_points(message, message.author.name)
    message_amount = messages.load_messages(message, message.author.name)

    non_trigger = ["!points","!roulette","!userpoints","!givepoints","!barryroulette","!rps","!rockpaperscissors"]
    non_message_trigger = ["!usermessages","!messages"]
    if message.author.name not in message_amount:
        message_amount[message.author.name] = 0
    elif len(split_message) == 0 or split_message[0] not in non_message_trigger:
        message_amount[message.author.name] += 1

    if message.author.name not in points:
        points[message.author.name] = 0
    elif len(split_message) == 0 or split_message[0] not in non_trigger:
        points[message.author.name] += 1

    try:
        pickle.dump(points, open("{0}/{0}_points.txt".format(str(message.server)),"wb"))
    except FileNotFoundError:
        try:
            os.makedir("{}".format(message.server))
        except FileExistsError:
            temp_points = open("{0}/{0}_points.txt".format(str(message.server)),"w")
            temp_points.close()
        pickle.dump(points, open("{0}/{0}_points.txt".format(str(message.server)),"wb"))
    pickle.dump(message_amount, open("{0}/{0}_messages.txt".format(str(message.server)),"wb"))
    return True

#Sets emotes in points, is its own function due to me using it twice.
config.py 文件源码 项目:charm-ceph-radosgw 作者: openstack 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def pre_write(self):
        settings = utils.get_settings('ssh')
        apt_update(fatal=True)
        apt_install(settings['client']['package'])
        if not os.path.exists('/etc/ssh'):
            os.makedir('/etc/ssh')
            # NOTE: don't recurse
            utils.ensure_permissions('/etc/ssh', 'root', 'root', 0o0755,
                                     maxdepth=0)
config.py 文件源码 项目:charm-ceph-radosgw 作者: openstack 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def pre_write(self):
        settings = utils.get_settings('ssh')
        apt_update(fatal=True)
        apt_install(settings['server']['package'])
        if not os.path.exists('/etc/ssh'):
            os.makedir('/etc/ssh')
            # NOTE: don't recurse
            utils.ensure_permissions('/etc/ssh', 'root', 'root', 0o0755,
                                     maxdepth=0)
config.py 文件源码 项目:charm-swift-storage 作者: openstack 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def pre_write(self):
        settings = utils.get_settings('ssh')
        apt_update(fatal=True)
        apt_install(settings['client']['package'])
        if not os.path.exists('/etc/ssh'):
            os.makedir('/etc/ssh')
            # NOTE: don't recurse
            utils.ensure_permissions('/etc/ssh', 'root', 'root', 0o0755,
                                     maxdepth=0)
config.py 文件源码 项目:charm-swift-storage 作者: openstack 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def pre_write(self):
        settings = utils.get_settings('ssh')
        apt_update(fatal=True)
        apt_install(settings['server']['package'])
        if not os.path.exists('/etc/ssh'):
            os.makedir('/etc/ssh')
            # NOTE: don't recurse
            utils.ensure_permissions('/etc/ssh', 'root', 'root', 0o0755,
                                     maxdepth=0)
config.py 文件源码 项目:charm-swift-storage 作者: openstack 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def pre_write(self):
        settings = utils.get_settings('ssh')
        apt_update(fatal=True)
        apt_install(settings['client']['package'])
        if not os.path.exists('/etc/ssh'):
            os.makedir('/etc/ssh')
            # NOTE: don't recurse
            utils.ensure_permissions('/etc/ssh', 'root', 'root', 0o0755,
                                     maxdepth=0)
config.py 文件源码 项目:charm-swift-storage 作者: openstack 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def pre_write(self):
        settings = utils.get_settings('ssh')
        apt_update(fatal=True)
        apt_install(settings['server']['package'])
        if not os.path.exists('/etc/ssh'):
            os.makedir('/etc/ssh')
            # NOTE: don't recurse
            utils.ensure_permissions('/etc/ssh', 'root', 'root', 0o0755,
                                     maxdepth=0)
config.py 文件源码 项目:charm-swift-storage 作者: openstack 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def pre_write(self):
        settings = utils.get_settings('ssh')
        apt_update(fatal=True)
        apt_install(settings['client']['package'])
        if not os.path.exists('/etc/ssh'):
            os.makedir('/etc/ssh')
            # NOTE: don't recurse
            utils.ensure_permissions('/etc/ssh', 'root', 'root', 0o0755,
                                     maxdepth=0)
config.py 文件源码 项目:charm-swift-storage 作者: openstack 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def pre_write(self):
        settings = utils.get_settings('ssh')
        apt_update(fatal=True)
        apt_install(settings['client']['package'])
        if not os.path.exists('/etc/ssh'):
            os.makedir('/etc/ssh')
            # NOTE: don't recurse
            utils.ensure_permissions('/etc/ssh', 'root', 'root', 0o0755,
                                     maxdepth=0)
config.py 文件源码 项目:charm-swift-storage 作者: openstack 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def pre_write(self):
        settings = utils.get_settings('ssh')
        apt_update(fatal=True)
        apt_install(settings['server']['package'])
        if not os.path.exists('/etc/ssh'):
            os.makedir('/etc/ssh')
            # NOTE: don't recurse
            utils.ensure_permissions('/etc/ssh', 'root', 'root', 0o0755,
                                     maxdepth=0)
config.py 文件源码 项目:equlipse 作者: konono 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def pre_write(self):
        settings = utils.get_settings('ssh')
        apt_update(fatal=True)
        apt_install(settings['client']['package'])
        if not os.path.exists('/etc/ssh'):
            os.makedir('/etc/ssh')
            # NOTE: don't recurse
            utils.ensure_permissions('/etc/ssh', 'root', 'root', 0o0755,
                                     maxdepth=0)
config.py 文件源码 项目:equlipse 作者: konono 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def pre_write(self):
        settings = utils.get_settings('ssh')
        apt_update(fatal=True)
        apt_install(settings['server']['package'])
        if not os.path.exists('/etc/ssh'):
            os.makedir('/etc/ssh')
            # NOTE: don't recurse
            utils.ensure_permissions('/etc/ssh', 'root', 'root', 0o0755,
                                     maxdepth=0)
config.py 文件源码 项目:equlipse 作者: konono 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def pre_write(self):
        settings = utils.get_settings('ssh')
        apt_update(fatal=True)
        apt_install(settings['client']['package'])
        if not os.path.exists('/etc/ssh'):
            os.makedir('/etc/ssh')
            # NOTE: don't recurse
            utils.ensure_permissions('/etc/ssh', 'root', 'root', 0o0755,
                                     maxdepth=0)


问题


面经


文章

微信
公众号

扫码关注公众号