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


Python Output.debug方法代码示例

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


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

示例1: HandleData

# 需要导入模块: from output import Output [as 别名]
# 或者: from output.Output import debug [as 别名]
	def HandleData(self, Pesticide, szData, Answer):
		szAnswer = ""
		dicData = {}

		dicData = utils.ParseAnswer(szData)
		if dicData == None:
			return False

		# Analyze command 
		if dicData["CODE"] == "LIST":
			Output.debug("Command LIST received")
			if self.__HandleList(Pesticide, dicData, Answer) == False:
				return False
		elif dicData["CODE"] == "INFO":
			Output.debug("Command INFO received")
			if self.__HandleInfo(VERSION, PROTOCOL, DESC, STATUS, dicData, Answer) == False:
				return False
		elif dicData["CODE"] == "INC":
			Output.debug("Command INC received")
			if self.__HandleInc(Pesticide, dicData, Answer) == False:
				return False
		elif dicData["CODE"] == "DEC":
			Output.debug("Command DEC received")
			if self.__HandleDec(Pesticide, dicData, Answer) == False:
				return False
		else:
			Output.debug("Unknown command \"%s\"" % dicData["CODE"])
			return False

		return True
开发者ID:v-p-b,项目名称:buherablog-ictf2013,代码行数:32,代码来源:pesticides-control.py

示例2: ReadTextFile

# 需要导入模块: from output import Output [as 别名]
# 或者: from output.Output import debug [as 别名]
def ReadTextFile(szFilePath):
	try:
		f = open(szFilePath, "r")
		try:
			return f.read()
		finally:
			f.close()
			Output.debug('File "%s" successfully loaded' % szFilePath)
	except:
		Output.exception('Exception while trying to read file "%s"' % szFilePath)
		return None
开发者ID:v-p-b,项目名称:buherablog-ictf2013,代码行数:13,代码来源:myutils.py

示例3: __HandleDec

# 需要导入模块: from output import Output [as 别名]
# 或者: from output.Output import debug [as 别名]
	def __HandleDec(self, Pesticide, dicData, Answer):
		if dicData.has_key("INGREDIENT") == False:
			Output.debug("Missing ingredient")
			return False
		if dicData.has_key("VALUE") == False:
			Output.debug("Missing value")
			return False
		iValue = int(dicData["VALUE"])
		if Pesticide.DecIngredient(dicData["INGREDIENT"], iValue) == False:
			return False
		Answer.S("OK")
		return True
开发者ID:v-p-b,项目名称:buherablog-ictf2013,代码行数:14,代码来源:pesticides-control.py

示例4: SetPosition

# 需要导入模块: from output import Output [as 别名]
# 或者: from output.Output import debug [as 别名]
	def SetPosition(self, X, Y):
		iDiff = int(math.sqrt((X-self.Px) ** 2 + (Y-self.Py) ** 2))
		if iDiff > 100:
			Output.debug("Trying to update position of a too big value: %d" % iDiff)
			return False

		Output.debug("Update position of value: %d" % iDiff)
		self.Px = X
		self.Py = Y
		Output.debug("Position of airplane %s is now [%d,%d]" % (self.__szId, self.Px, self.Py))
		angle = math.atan(float(abs(self.Dy-self.Py))/float(abs(self.Dx-self.Px)))
		Output.debug("Angle is %f (was %f)" % (angle, self.angle))
		return True
开发者ID:v-p-b,项目名称:buherablog-ictf2013,代码行数:15,代码来源:cairplane.py

示例5: ParseAnswer

# 需要导入模块: from output import Output [as 别名]
# 或者: from output.Output import debug [as 别名]
def ParseAnswer(szData):
	# Extract the command
	lstData = szData.split('\n')
	if len(lstData[0]) == 0:
		return None

	# Parse the data
	dicData = {}
	for szLine in lstData:
		if len(szLine) == 0:
			continue
		m = re.search("([^=]+)=(.+)", szLine)
		if m == None:
			Output.debug("Invalid line \"%s\"" % szLine)
			print szData
			return None
		else:
			dicData[m.group(1)] = m.group(2)

	return dicData
开发者ID:v-p-b,项目名称:buherablog-ictf2013,代码行数:22,代码来源:utils.py

示例6: DecIngredient

# 需要导入模块: from output import Output [as 别名]
# 或者: from output.Output import debug [as 别名]
	def DecIngredient(self, szIngredient, iValue):
		if self.d.has_key(szIngredient) == False:
			Output.debug("Ingredient %s not present" % szIngredient)
			return False
		if self.d[szIngredient] <= iValue:
			Output.debug("Impossible to decrement %s of %d mg" % (szIngredient, iValue))
			return False

		self.d[szIngredient] -= iValue
		Output.debug("Ingredient %s is now at %d mg" % (szIngredient, self.d[szIngredient]))
		return True
开发者ID:v-p-b,项目名称:buherablog-ictf2013,代码行数:13,代码来源:cpesticide.py

示例7: IncIngredient

# 需要导入模块: from output import Output [as 别名]
# 或者: from output.Output import debug [as 别名]
	def IncIngredient(self, szIngredient, iValue):
		if self.d.has_key(szIngredient) == False:
			Output.debug("Ingredient %s not present" % szIngredient)
			return False
		if self.d[szIngredient] + iValue >= 1000:
			Output.debug("Impossible to increment %s of %d mg; Amount would be higher than critical threshold" % (szIngredient, iValue))
			return False

		self.d[szIngredient] += iValue
		Output.debug("Ingredient %s is now at %d mg" % (szIngredient, self.d[szIngredient]))
		return True
开发者ID:v-p-b,项目名称:buherablog-ictf2013,代码行数:13,代码来源:cpesticide.py

示例8: Usage

# 需要导入模块: from output import Output [as 别名]
# 或者: from output.Output import debug [as 别名]
	elif o == '-i':
		INTERACTIVE=True
	elif o == '-v':
		if OUTPUT_LEVEL == logging.INFO:
			OUTPUT_LEVEL = logging.DEBUG
		elif OUTPUT_LEVEL > 0:
			OUTPUT_LEVEL -= 10
	elif o == "-h":
		Usage()
	else:
		Output.error('Invalid option "%s"' % o)
		Usage(-1)

Output.setLevel(OUTPUT_LEVEL)

Output.debug("Starting server on %s:%s" % (LISTEN, PORT))
Server = ThreadedTCPServer((LISTEN, PORT), ThreadedTCPRequestHandler)
ServerThread = threading.Thread(target=Server.serve_forever)
ServerThread.daemon = True
ServerThread.start()
Output.debug("Server successfully started")
if INTERACTIVE == True:
	while True:
		sys.stdout.write("> ")
		szCmd = sys.stdin.readline().rstrip('\n')
		if len(szCmd) == 0:
			continue
		elif szCmd == "quit":
			break
		else:
			Output.error("Invalid command \"%s\"" % szCmd)
开发者ID:v-p-b,项目名称:buherablog-ictf2013,代码行数:33,代码来源:pesticides-control.py


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