當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。