本文整理汇总了Python中colors.red方法的典型用法代码示例。如果您正苦于以下问题:Python colors.red方法的具体用法?Python colors.red怎么用?Python colors.red使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类colors
的用法示例。
在下文中一共展示了colors.red方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: check_match
# 需要导入模块: import colors [as 别名]
# 或者: from colors import red [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))
示例2: main
# 需要导入模块: import colors [as 别名]
# 或者: from colors import red [as 别名]
def main():
# TODO: Make it portable
locations = [ "/usr/bin", "/bin"]
current = set()
# If `bin` does not exist create it first
if not os.path.isdir(bin_dir):
os.mkdir(bin_dir)
for f in os.listdir(bin_dir):
current.add(f)
for f in os.listdir(tags_dir):
basename = util.strip_whole_config(f)
if not basename:
continue
if basename in current:
print(" > " + basename + " is present in " + tags_dir)
continue
if not try_find(locations, basename):
print(" > " + colors.red(basename + " not found anywhere"))
示例3: main
# 需要导入模块: import colors [as 别名]
# 或者: from colors import red [as 别名]
def main(argv):
# Parse the username, hostname, and keyfile from the command line arguments
username, hostname = argv[1].split('@')
keyfile = argv[2]
# Construct an SSH connection
ssh = SSHConnection(hostname, username, keyfile)
ssh.connect()
# Run an interactive prompt, until the user enters an empty line or closes the input stream
print colors.red(ssh.read())
while True:
try:
command_to_run = raw_input('> ')
except EOFError:
command_to_run = ''
if command_to_run.strip() == '':
break
ssh.send(command_to_run + '\n')
print colors.red(ssh.read())
# Cleanly close the SSH connection
exit_status = ssh.disconnect()
return exit_status
示例4: forward
# 需要导入模块: import colors [as 别名]
# 或者: from colors import red [as 别名]
def forward(port):
try:
import requests
import json
except:
process_display(1,1,"Module not found\n Make sure you have installed 'requirements.txt' and configured DASH")
sys.exit(0)
ngrok = subprocess.Popen(['ngrok','http','-region','ap' ,str(port)],stdout=subprocess.PIPE)
process_display(1,0,"[1/2] Public Server is started.")
time.sleep(3)
tunnel_url = requests.get("http://localhost:4040/api/tunnels").text
j = json.loads(tunnel_url)
try:
tunnel_url = j['tunnels'][0]['public_url']
process_display(0,0,"The link for the page is : "+tunnel_url)
except IndexError:
process_display(1,2,"Rechecking the URLs in 4s :/ ")
time.sleep(4)
tunnel_url = requests.get("http://localhost:4040/api/tunnels").text
j = json.loads(tunnel_url)
tunnel_url = j['tunnels'][0]['public_url']
process_display(0,0,"The link for the page is : "+tunnel_url)
print("\n{}-------------------------------{} _^_ {}-------------------------------{}\n".format(colors.white,colors.red,colors.white,colors.red))
示例5: run_test
# 需要导入模块: import colors [as 别名]
# 或者: from colors import red [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
示例6: banner
# 需要导入模块: import colors [as 别名]
# 或者: from colors import red [as 别名]
def banner():
print(r'''
{}
/▔▔▔▔▔\/▔▔/ /▔▔/▔▔▔▔▔\/▔▔▔▔▔▔▔▔▔▔/▔▔▔▔▔▔\ /▔▔▔▔▔▔▔\/▔▔▔▔▔\/▔▔/▔▔▔▔▔▔\
/ {}/▔▔/{} / / / / {}/▔▔/{} /▔▔▔▔/ /▔▔▔/ {}/▔▔/{} / {}/▔▔/{} / {}/▔▔/{} / / {}/▔ \{} /
/ {}▔▔▔{} / ▔▔ / {}/ /{} / / / / {}/ /{} / {}▔▔{} / {}/ /{} / / {}/ /{} /
/ /▔▔▔▔/ /▔▔/ / {}/ /{} / / / / {}/ /{} / /\ \▔▔/ {}/ /{} / / {}/ /{} /
/ / / / / /\ {}▔▔{} / / / \ {}▔▔{} / / \ \ \{} ▔▔{} / / {}▔▔▔▔{} /
{} ▔▔ ▔▔▔ ▔▔▔ ▔▔▔▔▔ ▔▔ ▔▔▔▔▔▔ ▔▔▔ ▔▔ ▔▔▔▔ ▔▔▔ ▔▔▔▔▔▔▔
{} Made by :- pr0t0n
{} P.S. Project is under Beta mode.
'''.format(color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.red,color.lightgreen,color.blue))
示例7: check_match
# 需要导入模块: import colors [as 别名]
# 或者: from colors import red [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")
示例8: get_result_color
# 需要导入模块: import colors [as 别名]
# 或者: from colors import red [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
示例9: print_ces
# 需要导入模块: import colors [as 别名]
# 或者: from colors import red [as 别名]
def print_ces(self):
for case, ce in self.ces.items():
print(colors.red(self.basename) + ': '+ ('without_args' if not case else case))
print(ce)
示例10: header
# 需要导入模块: import colors [as 别名]
# 或者: from colors import red [as 别名]
def header():
print('\n\t\t{}-{} DASH {}-{}\n'.format(colors.red,colors.white,colors.red,colors.white))
示例11: check_match
# 需要导入模块: import colors [as 别名]
# 或者: from colors import red [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))