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


Python lib.GlobalData类代码示例

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


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

示例1: ValueError

	elif ruleElement.type == "second":

		logString = ("%s second " % spaceString
			+ "(start=%d, " % ruleElement.element.start
			+ "end=%d)") % ruleElement.element.end
		logging.info("[%s]: %s" % (fileName, logString))

	else:
		raise ValueError("Rule has invalid type: '%s'." % ruleElement.type)


if __name__ == '__main__':

	# generate object of the global needed data
	globalData = GlobalData()

	fileName = os.path.basename(__file__)

	# parse config file, get logfile configurations
	# and initialize logging
	try:
		configRoot = xml.etree.ElementTree.parse(
			globalData.configFile).getroot()

		logfile = str(configRoot.find("general").find("log").attrib["file"])

		# parse chosen log level
		tempLoglevel = str(
			configRoot.find("general").find("log").attrib["level"])
		tempLoglevel = tempLoglevel.upper()
开发者ID:guyforest,项目名称:alertR,代码行数:30,代码来源:alertRserver.py

示例2: GlobalData

from lib import ServerCommunication, ConnectionWatchdog
from lib import SMTPAlert
from lib import LightningmapSensor, LightningmapDataCollector, SensorExecuter
from lib import UpdateChecker
from lib import GlobalData
import logging
import time
import socket
import random
import xml.etree.ElementTree


if __name__ == '__main__':

	# generate object of the global needed data
	globalData = GlobalData()

	fileName = os.path.basename(__file__)

	# parse config file, get logfile configurations
	# and initialize logging
	try:
		configRoot = xml.etree.ElementTree.parse(
			globalData.configFile).getroot()

		logfile = str(configRoot.find("general").find("log").attrib["file"])

		# parse chosen log level
		tempLoglevel = str(
			configRoot.find("general").find("log").attrib["level"])
		tempLoglevel = tempLoglevel.upper()
开发者ID:Mbugua,项目名称:alertR,代码行数:31,代码来源:alertRclient.py

示例3: print

    # Do nothing if the given location is an absolute path.
    if inputLocation[0] == "/":
        return inputLocation
    # Replace ~ with the home directory.
    elif inputLocation[0] == "~":
        return os.environ["HOME"] + inputLocation[1:]
    # Assume we have a given relative path.
    return os.path.dirname(os.path.abspath(__file__)) + "/" + inputLocation


if __name__ == '__main__':

    print(asciiLogo)

    # generate object of the global needed data
    globalData = GlobalData()

    fileName = os.path.basename(__file__)

    # parse config file, get logfile configurations
    # and initialize logging
    try:
        configRoot = xml.etree.ElementTree.parse(
            globalData.configFile).getroot()

        logfile = makePath(
            str(configRoot.find("general").find("log").attrib["file"]))

        # parse chosen log level
        tempLoglevel = str(
            configRoot.find("general").find("log").attrib["level"])
开发者ID:sqall01,项目名称:alertR,代码行数:31,代码来源:alertRclient.py

示例4: makePath

# Function creates a path location for the given user input.
def makePath(inputLocation):
    # Do nothing if the given location is an absolute path.
    if inputLocation[0] == "/":
        return inputLocation
    # Replace ~ with the home directory.
    elif inputLocation[0] == "~":
        return os.environ["HOME"] + inputLocation[1:]
    # Assume we have a given relative path.
    return os.path.dirname(os.path.abspath(__file__)) + "/" + inputLocation


if __name__ == '__main__':

    # generate object of the global needed data
    globalData = GlobalData()

    fileName = os.path.basename(__file__)

    # parse config file, get logfile configurations
    # and initialize logging
    try:
        configRoot = xml.etree.ElementTree.parse(
            globalData.configFile).getroot()

        logfile = makePath(
            str(configRoot.find("general").find("log").attrib["file"]))

        # parse chosen log level
        tempLoglevel = str(
            configRoot.find("general").find("log").attrib["level"])
开发者ID:sqall01,项目名称:alertR,代码行数:31,代码来源:alertRclient.py

示例5: ValueError

	elif ruleElement.type == "second":

		logString = ("%s second " % spaceString
			+ "(start=%d, " % ruleElement.element.start
			+ "end=%d)") % ruleElement.element.end
		logging.info("[%s]: %s" % (fileName, logString))

	else:
		raise ValueError("Rule has invalid type: '%s'." % ruleElement.type)


if __name__ == '__main__':

	# generate object of the global needed data
	globalData = GlobalData()

	fileName = os.path.basename(__file__)

	# parse config file, get logfile configurations
	# and initialize logging
	try:
		configRoot = xml.etree.ElementTree.parse(
			globalData.configFile).getroot()

		globalData.logdir = makePath(str(configRoot.find("general").find(
			"log").attrib["dir"]))

		# parse chosen log level
		tempLoglevel = str(
			configRoot.find("general").find("log").attrib["level"])
开发者ID:catding,项目名称:alertR,代码行数:30,代码来源:alertRserver.py

示例6: print

            + "(Optional)",
        default=False)
    parser.add_option_group(optGroup)

    (options, args) = parser.parse_args()

    showHelp = (options.add
        or options.delete
        or options.modify
        or options.list)
    if showHelp is False:
        print("Use --help to get all available options.")
        sys.exit(0)

    # Generate object of the global needed data.
    globalData = GlobalData()

    fileName = os.path.basename(__file__)
    instanceLocation = os.path.dirname(os.path.abspath(__file__)) + "/"

    validNodeTypes = ["sensor", "manager", "alert"]

    # Parse config file.
    try:
        configRoot = xml.etree.ElementTree.parse(instanceLocation +
                "/config/config.xml").getroot()

        # Parse chosen log level
        tempLoglevel = str(
            configRoot.find("general").find("log").attrib["level"])
        tempLoglevel = tempLoglevel.upper()
开发者ID:sqall01,项目名称:alertR,代码行数:31,代码来源:manageUsers.py

示例7: GlobalData

		default=False)
	parser.add_option("-f", "--force", dest="force", action="store_true",
		help="Do not check the version. Just update all files.",
		default=False)
	(options, args) = parser.parse_args()

	if options.update is False:
		print "Use --help to get all available options."
		sys.exit(0)


	protocolUpdate = False
	configUpdate = False

	# generate object of the global needed data
	globalData = GlobalData()

	fileName = os.path.basename(__file__)
	instanceLocation = os.path.dirname(os.path.abspath(__file__)) + "/"

	try:
		# parse config file
		configRoot = xml.etree.ElementTree.parse(instanceLocation +
			"/config/config.xml").getroot()

		# parse chosen log level
		tempLoglevel = str(
			configRoot.find("general").find("log").attrib["level"])
		tempLoglevel = tempLoglevel.upper()
		if tempLoglevel == "DEBUG":
			loglevel = logging.DEBUG
开发者ID:catding,项目名称:alertR,代码行数:31,代码来源:alertRupdate.py

示例8: GlobalData

    if inputLocation[0] == "/":
        return inputLocation
    # Replace ~ with the home directory.
    elif inputLocation[0] == "~":
        return os.environ["HOME"] + inputLocation[1:]
    # Assume we have a given relative path.
    return os.path.dirname(os.path.abspath(__file__)) + "/" + inputLocation


if __name__ == '__main__':

    fileName = os.path.basename(__file__)
    instanceLocation = os.path.dirname(os.path.abspath(__file__)) + "/"

    # generate object of the global needed data
    globalData = GlobalData()

    try:
        # parse config file
        configRoot = xml.etree.ElementTree.parse(instanceLocation +
            "/config/config.xml").getroot()

        # parse chosen log level
        tempLoglevel = str(
            configRoot.find("general").find("log").attrib["level"])
        tempLoglevel = tempLoglevel.upper()
        if tempLoglevel == "DEBUG":
            loglevel = logging.DEBUG
        elif tempLoglevel == "INFO":
            loglevel = logging.INFO
        elif tempLoglevel == "WARNING":
开发者ID:sqall01,项目名称:alertR,代码行数:31,代码来源:testPushConfiguration.py


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