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


Python colors.green方法代码示例

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


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

示例1: check_match

# 需要导入模块: import colors [as 别名]
# 或者: from colors import green [as 别名]
def check_match(source):
    try:
        import numpy as np
    except ImportError:
        print("[-] Error importing numpy module.")
        exit(1)
    list_search_images = os.listdir(
        os.path.join(os.getcwd(), target_images_dir_name))
    colors.success("Search image list grabbed ")
    print(
        "\n{}\
        ----------------------------------------------------------------------\
        {}".format(
            colors.red, colors.green
        )
    )
    print("\n\t {}:: Similar images found are :: \n".format(colors.lightgreen))
    for path in list_search_images:
        src_image = cv2.imread(os.path.join(target_images_dir_name, path), 0)
        if custom_hashing(source) == custom_hashing(src_image):
            print("Image : {}".format(path)) 
开发者ID:0xPrateek,项目名称:Photoroid,代码行数:23,代码来源:new_algo.py

示例2: run_test

# 需要导入模块: import colors [as 别名]
# 或者: from colors import green [as 别名]
def run_test(command):
    wrapped_command = "cd %s && %s" % (root_dir, command)
    pipe = subprocess.Popen(
        wrapped_command, shell=True,
    )
    pipe.wait()
    if pipe.returncode == 0:
        print(green("TEST PASSED"))
    else:
        print(red("TEST FAILED"))
    return pipe.returncode

# load the script tests from the .travis.yml file 
开发者ID:datascopeanalytics,项目名称:scrubadub,代码行数:15,代码来源:run.py

示例3: check_match

# 需要导入模块: import colors [as 别名]
# 或者: from colors import green [as 别名]
def check_match():

    list_temp_images = os.listdir(os.path.join(
        os.getcwd(), template_image_dir_name))
    colors.success("Template image list grabbed.")
    list_search_images = os.listdir(
        os.path.join(os.getcwd(), target_images_dir_name))
    colors.success("Search images list grabbed")
    print(
        "\n{}\
        ----------------------------------------------------------------------\
        {}"
        .format(colors.red, colors.green))
    print("\n\t {}:: Similar images found are :: \n".format(colors.lightgreen))

    image_thread_process = []

    for path in list_search_images:
        image_thread_process.append(
            th(
                target=thread_checker,
                args=(path, list_temp_images,)
            )
        )

    for process in image_thread_process:
        process.start()

    for process in image_thread_process:
        process.join()

    colors.success("Threading function completed") 
开发者ID:0xPrateek,项目名称:Photoroid,代码行数:34,代码来源:thread_photo.py

示例4: try_find

# 需要导入模块: import colors [as 别名]
# 或者: from colors import green [as 别名]
def try_find(locations, basename):
    for p in locations:
        maybe = os.path.join(p, basename)
        if os.path.isfile(maybe):
            print(" > " + colors.green("Found " + maybe))
            new_file = os.path.join(bin_dir, basename)
            shutil.copyfile(maybe, new_file)
            st = os.stat(new_file)
            os.chmod(new_file, st.st_mode | stat.S_IEXEC)

            return True
    return False 
开发者ID:lifting-bits,项目名称:mcsema,代码行数:14,代码来源:populate.py

示例5: get_result_color

# 需要导入模块: import colors [as 别名]
# 或者: from colors import green [as 别名]
def get_result_color(self):
        if self.total == 0:
            return colors.magneta

        if self.total == self.success:
            return colors.green

        if self.success == 0:
            return colors.red

        return colors.orange 
开发者ID:lifting-bits,项目名称:mcsema,代码行数:13,代码来源:result_data.py

示例6: nice_router_name

# 需要导入模块: import colors [as 别名]
# 或者: from colors import green [as 别名]
def nice_router_name(router, color=True):
    """
    returns a router name with ~ at the front if it's not a named router
    """
    green = str
    italic = str
    if color:
        green = colors.green
        italic = colors.italic
    if router.name_is_unique:
        return green(router.name)
    return italic('~%s' % router.name) 
开发者ID:meejah,项目名称:carml,代码行数:14,代码来源:util.py

示例7: check_match

# 需要导入模块: import colors [as 别名]
# 或者: from colors import green [as 别名]
def check_match():
    try:
        import numpy as np
    except ImportError:
        print("[-] Error importing numpy module.")
        exit(1)

    list_temp_images = os.listdir(os.path.join(
        os.getcwd(), template_image_dir_name))
    colors.success("Template image list grabbed.")
    list_search_images = os.listdir(
        os.path.join(os.getcwd(), target_images_dir_name))
    colors.success("Search image list grabbed ")
    print(
        "\n{}----------------------------------------------------------------------{}".format(colors.red, colors.green))
    print("\n\t {}:: Similar images found are :: \n".format(colors.lightgreen))

    for path in list_search_images:
        checked = []
        pos = 0

        # Reading images to be matched one by one.
        src_image = cv2.imread(os.path.join(
            target_images_dir_name, path), cv2.IMREAD_COLOR)

        # Converting image to grayscale.
        src_gray = cv2.cvtColor(src_image, cv2.COLOR_BGR2GRAY)

        # Checking if all the templates are there in image or not.
        while pos < 12:
            template_path = list_temp_images[pos]
            template_image = cv2.imread(os.path.join(
                template_image_dir_name, template_path), cv2.IMREAD_GRAYSCALE)

            # Using cv2.matchTemplate() to check if template is found or not.
            result = cv2.matchTemplate(
                src_gray, template_image, cv2.TM_CCOEFF_NORMED)
            thresh = 0.9
            loc = np.where(result > thresh)
            if str(loc[0]) == str(loc[1]):
                checked.append("False")
                break
            else:
                checked.append("True")
            pos += 1

        if "False" not in checked:
            print("Image : {}".format(path)) 
开发者ID:0xPrateek,项目名称:Photoroid,代码行数:50,代码来源:photo.py

示例8: read

# 需要导入模块: import colors [as 别名]
# 或者: from colors import green [as 别名]
def read(self):
    '''Read a packet from the remote server.

    Assuming the initial connection has completed (i.e. #connect has been called, and returned),
    this data will be encrypted, and its authenticity guaranteed.

    Returns (string): the data sent by the remote server.
    '''

    # Read the first <block_len> bytes of the packet, decrypt it if necessary, and parse out the
    # remaining packet length
    initial_packet = self._socket.recv(AES_BLOCK_LEN)
    if self._encryption_negotiated:
      initial_packet = self._aes_server_to_client.decrypt(initial_packet)
    _, packet_len = parse_uint32(initial_packet, 0)

    # Read the remaining bytes of the packet, decrypting if necessary, and checking the MAC
    remaining_msg = self._socket.recv(packet_len - (AES_BLOCK_LEN - 4))
    if self._encryption_negotiated:
      remaining_msg = self._aes_server_to_client.decrypt(remaining_msg)

      # Read and verify the MAC
      received_mac = self._socket.recv(SHA1_LEN)
      calculated_mac = hmac.new(
          self._integrity_key_server_to_client,
          generate_uint32(self._packets_received_counter) + initial_packet + remaining_msg,
          hashlib.sha1
      ).digest()
      assert received_mac == calculated_mac, \
        'MACs did not match: %s != %s' % (repr(received_mac), repr(calculated_mac))
      print colors.cyan('MAC validated correctly!')

    # Pull the payload out of the message
    data = (initial_packet + remaining_msg)[4:]
    index, padding_len = parse_byte(data, 0)
    payload_len = packet_len - padding_len - index
    payload = data[index:payload_len + index]

    self._packets_received_counter += 1
    print colors.green('< Received: %s' % repr(payload))

    return payload 
开发者ID:tetrakai,项目名称:ssh_client,代码行数:44,代码来源:ssh_transport.py


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