예제 #1
0
	def set_difficulty_limit(self, limit):
		if not cross_version.isinteger(limit):
			raise ValueError("Difficulty limit must be integer format")

		if limit == 0:
			self.__difficulty = None
		else:
			self.__difficulty = limit
예제 #2
0
    def set_difficulty_limit(self, limit):
        if not cross_version.isinteger(limit):
            raise ValueError("Difficulty limit must be integer format")

        if limit == 0:
            self.__difficulty = None
        else:
            self.__difficulty = limit
예제 #3
0
	def set_difficulty(self, difficulty):
		if cross_version.isinteger(difficulty):
			if difficulty >= 1 and difficulty <= 3:
				self.__difficulty = difficulty
			else:
				raise ValueError("Invalid difficulty number ( Must be 1 - 3 )")
				return
		elif cross_version.isstring(difficulty):
			self.__difficulty = convert_difficulty(difficulty)
		else:
			raise ValueError("Invalid type for difficulty")
예제 #4
0
 def set_difficulty(self, difficulty):
     if cross_version.isinteger(difficulty):
         if difficulty >= 1 and difficulty <= 3:
             self.__difficulty = difficulty
         else:
             raise ValueError("Invalid difficulty number ( Must be 1 - 3 )")
             return
     elif cross_version.isstring(difficulty):
         self.__difficulty = convert_difficulty(difficulty)
     else:
         raise ValueError("Invalid type for difficulty")
예제 #5
0
	def has_difficulty(self, search):

		if cross_version.isstring(search):
			search = convert_difficulty(search)

		if not cross_version.isinteger(search):
			raise ValueError("Invalid difficulty")

		for vuln in self.__vulnerability_list:
			if self.__vulnerability_list[vuln].get_difficulty() <= search or self.__vulnerability_list[vuln].get_difficulty() == None:
				return True

		return False
예제 #6
0
    def has_difficulty(self, search):

        if cross_version.isstring(search):
            search = convert_difficulty(search)

        if not cross_version.isinteger(search):
            raise ValueError("Invalid difficulty")

        for vuln in self.__vulnerability_list:
            if (
                self.__vulnerability_list[vuln].get_difficulty() <= search
                or self.__vulnerability_list[vuln].get_difficulty() == None
            ):
                return True

        return False
예제 #7
0
def isinteger_tests():
    assert cross_version.isinteger("hi there") == False
    assert cross_version.isinteger(1) == True
    assert cross_version.isinteger(1.01) == False
    assert cross_version.isinteger({1: 2}) == False
def isinteger_tests():
	assert cross_version.isinteger("hi there") == False
	assert cross_version.isinteger(1) == True
	assert cross_version.isinteger(1.01) == False
	assert cross_version.isinteger({1: 2}) == False