How to use not_ method in Lemoncheesecake

Best Python code snippet using lemoncheesecake

cleaba_atter_cal_and_dataSet_create.py

Source:cleaba_atter_cal_and_dataSet_create.py Github

copy

Full Screen

1import os2from shutil import copyfile3from tqdm import tqdm4import argparse5argparse6parser = argparse.ArgumentParser()7parser.add_argument('--celeba_path', type=str, default='./datasets/CelebA', help='Path to celeba dataset.')8parser.add_argument('--celeba_anno_path', type=str, default='/Anno/list_attr_celeba.txt', help='path to celebe annotation file')9parser.add_argument('--celeba_path_list_eval_partition', type=str, default='/Eval/list_eval_partition.txt', help='path to celebe list_eval_partition')10parser.add_argument('--main_tag', type=str, default='Eyeglasses', help='main annotation to split celeba data by, one of: \'Male\' \'Blond_Hair\' \'Eyeglasses\' \'Gray_Hair\' \'Black_Hair\' \'Brown_Hair\'')11parser.add_argument('--sub_tag', type=str, default='Eyeglasses', help='sub annotation to split celeba data by, one of: \'Male\' \'Blond_Hair\' \'Eyeglasses\' \'Gray_Hair\' \'Black_Hair\' \'Brown_Hair\'')12opts = parser.parse_args()13path = opts.celeba_path14DataPath = os.path.join(path, 'Img/img_align_celeba')15f = open(path + opts.celeba_anno_path, "r")16f_eval = open(path + opts.celeba_path_list_eval_partition, "r")17num_of_images = int(f.readline())18tags = f.readline().split()19print('num of images: ' + str(num_of_images))20print('tags:')21print(str(tags))22tag_to_use_main = opts.main_tag23tag_to_use_sub = opts.sub_tag # 'Male' # 'Blond_Hair' # 'Eyeglasses' # 'Gray_Hair' # 'Black_Hair' #' Brown_Hair'24index_main = tags.index(tag_to_use_main) + 125index_sub = tags.index(tag_to_use_sub) + 126if not os.path.exists(os.path.join(path, tag_to_use_main, tag_to_use_sub, tag_to_use_main, tag_to_use_sub)):27 os.makedirs(os.path.join(path, tag_to_use_main, tag_to_use_sub, tag_to_use_main, tag_to_use_sub))28if not os.path.exists(os.path.join(path, tag_to_use_main, tag_to_use_sub, tag_to_use_main,'not_' + tag_to_use_sub)):29 os.makedirs(os.path.join(path, tag_to_use_main, tag_to_use_sub, tag_to_use_main, 'not_' + tag_to_use_sub))30if not os.path.exists(os.path.join(path, tag_to_use_main, tag_to_use_sub, 'not_' + tag_to_use_main, tag_to_use_sub)):31 os.makedirs(os.path.join(path, tag_to_use_main, tag_to_use_sub, 'not_' + tag_to_use_main, tag_to_use_sub))32if not os.path.exists(os.path.join(path, tag_to_use_main, tag_to_use_sub, 'not_' + tag_to_use_main , 'not_' + tag_to_use_sub)):33 os.makedirs(os.path.join(path, tag_to_use_main, tag_to_use_sub, 'not_' + tag_to_use_main, 'not_' + tag_to_use_sub))34if not os.path.exists(os.path.join(path, tag_to_use_main, tag_to_use_sub, tag_to_use_main, tag_to_use_sub + '_test')):35 os.makedirs(os.path.join(path, tag_to_use_main, tag_to_use_sub, tag_to_use_main, tag_to_use_sub + '_test'))36if not os.path.exists(os.path.join(path, tag_to_use_main,tag_to_use_sub, tag_to_use_main, 'not_' + tag_to_use_sub + '_test')):37 os.makedirs(os.path.join(path, tag_to_use_main, tag_to_use_sub, tag_to_use_main, 'not_' + tag_to_use_sub + '_test'))38if not os.path.exists(os.path.join(path, tag_to_use_main, tag_to_use_sub, 'not_' + tag_to_use_main, tag_to_use_sub + '_test')):39 os.makedirs(os.path.join(path, tag_to_use_main, tag_to_use_sub, 'not_' + tag_to_use_main, tag_to_use_sub + '_test'))40if not os.path.exists(os.path.join(path, tag_to_use_main, tag_to_use_sub, 'not_' + tag_to_use_main, 'not_' + tag_to_use_sub + '_test')):41 os.makedirs(os.path.join(path, tag_to_use_main, tag_to_use_sub, 'not_' + tag_to_use_main, 'not_' + tag_to_use_sub + '_test'))42f_A_1 = open(os.path.join(path, tag_to_use_main, tag_to_use_sub, tag_to_use_main, tag_to_use_sub, tag_to_use_main + '_' + tag_to_use_sub + ".txt"), "w")43f_A_2 = open(os.path.join(path, tag_to_use_main, tag_to_use_sub, tag_to_use_main, tag_to_use_sub, tag_to_use_main + '_not_' + tag_to_use_sub + ".txt"), "w")44f_B_1 = open(os.path.join(path, tag_to_use_main, tag_to_use_sub, 'not_' + tag_to_use_main, tag_to_use_sub, 'not_' + tag_to_use_main + '_' + tag_to_use_sub + ".txt"), "w")45f_B_2 = open(os.path.join(path, tag_to_use_main, tag_to_use_sub, 'not_' + tag_to_use_main, tag_to_use_sub, 'not_' + tag_to_use_main + '_not_' + tag_to_use_sub + ".txt"), "w")46f_all_info = open(os.path.join(path,tag_to_use_main, tag_to_use_sub, tag_to_use_main + '_' + tag_to_use_sub + "_info.txt"), "w")47# print(index_main)48# print(index_sub)49numOf_A_1 = 050numOf_A_2 = 051numOf_B_1 = 052numOf_B_2 = 053for line in tqdm(f, total=num_of_images):54 curr_line = line.split()55 eval_partition = int(f_eval.readline().split()[1])56 addTest = ''57 add_eval = ''58 if eval_partition != 0:59 addTest = '_test'60 add_eval = str(eval_partition) + '_'61 fileEnder = 'png'62 file_name = curr_line[0].split('.')[0] + '.' + fileEnder63 srcFile = DataPath + '/' + file_name64 if int(curr_line[index_main]) == 1:65 if int(curr_line[index_sub]) == 1:66 destFile = os.path.join(path, tag_to_use_main, tag_to_use_sub, tag_to_use_main, tag_to_use_sub + addTest, add_eval + curr_line[0] + '.' + fileEnder)67 numOf_A_1 += 168 f_A_1.write(curr_line[0] + '\n')69 copyfile(srcFile, destFile)70 else:71 destFile = os.path.join(path, tag_to_use_main, tag_to_use_sub, tag_to_use_main, 'not_' + tag_to_use_sub + addTest, add_eval + curr_line[0] + '.' + fileEnder)72 numOf_A_2 += 173 f_A_2.write(curr_line[0] + '\n')74 copyfile(srcFile, destFile)75 else:76 if int(curr_line[index_sub]) == 1:77 destFile = os.path.join(path, tag_to_use_main, tag_to_use_sub, 'not_' + tag_to_use_main, tag_to_use_sub + addTest, add_eval + curr_line[0] + '.' + fileEnder)78 numOf_B_1 += 179 f_B_1.write(curr_line[0] + '\n')80 copyfile(srcFile, destFile)81 else:82 destFile = os.path.join(path, tag_to_use_main, tag_to_use_sub, 'not_' + tag_to_use_main, 'not_' + tag_to_use_sub + addTest, add_eval + curr_line[0] + '.' + fileEnder)83 numOf_B_2 += 184 f_B_1.write(curr_line[0] + '\n')85 copyfile(srcFile, destFile)86tot_A = numOf_A_1 + numOf_A_287tot_B = numOf_B_1 + numOf_B_288print('Total ' + tag_to_use_main + ': ' + str(tot_A))89f_all_info.write('Total ' + tag_to_use_main + ': ' + str(tot_A) + '\n')90print('Total not_' + tag_to_use_main + ': ' + str(tot_B))91f_all_info.write('Total_not ' + tag_to_use_main + ': ' + str(tot_B) + '\n')92print('Total ' + tag_to_use_main + ' + ' + tag_to_use_sub + ': ' + str(numOf_A_1))93f_all_info.write('Total ' + tag_to_use_main + ' + ' + tag_to_use_sub + ': ' + str(numOf_A_1) + '\n')94print('Total ' + tag_to_use_main + ' + not_' + tag_to_use_sub + ': ' + str(numOf_A_2))95f_all_info.write('Total ' + tag_to_use_main + ' + not_' + tag_to_use_sub + ': ' + str(numOf_A_2) + '\n')96print('Total not_' + tag_to_use_main + ' + ' + tag_to_use_sub + ': ' + str(numOf_B_1))97f_all_info.write('Total not_' + tag_to_use_main + ' + ' + tag_to_use_sub + ': ' + str(numOf_B_1) + '\n')98print('Total not_' + tag_to_use_main + ' + not_' + tag_to_use_sub + ': ' + str(numOf_B_2))99f_all_info.write('Total not_' + tag_to_use_main + ' + not_' + tag_to_use_sub + ': ' + str(numOf_B_2) + '\n')100ratio_A_1 = numOf_A_1 / tot_A101ratio_A_2 = numOf_A_2 / tot_A102ratio_B_1 = numOf_B_1 / tot_B103ratio_B_2 = numOf_B_2 / tot_B104ratio_A_1_str = "{:.3f}".format(ratio_A_1)105ratio_A_2_str = "{:.3f}".format(ratio_A_2)106ratio_B_1_str = "{:.3f}".format(ratio_B_1)107ratio_B_2_str = "{:.3f}".format(ratio_B_2)108f_all_info.write('---------------------------\n')109print(tag_to_use_main + ' : ' + tag_to_use_sub + '/not_' + tag_to_use_sub + ' : ' + ratio_A_1_str + '/' + ratio_A_2_str)110f_all_info.write(tag_to_use_main + ' : ' + tag_to_use_sub + '/not_' + tag_to_use_sub + ' : ' + ratio_A_1_str + '/' + ratio_A_2_str + '\n')111print('not_' + tag_to_use_main + ' : ' + tag_to_use_sub + '/not_' + tag_to_use_sub + ' : ' + ratio_B_1_str + '/' + ratio_B_2_str)112f_all_info.write('not_' + tag_to_use_main + ' : ' + tag_to_use_sub + '/not_' + tag_to_use_sub + ' : ' + ratio_B_1_str + '/' + ratio_B_2_str + '\n')113f.close()114f_eval.close()115f_A_1.close()116f_A_2.close()117f_B_1.close()118f_B_2.close()...

Full Screen

Full Screen

not_.py

Source:not_.py Github

copy

Full Screen

1import warnings2from typing import Any3from core.utils.selene.core import match as _match4from core.utils.selene.core.condition import Condition5from core.utils.selene.core.entity import Element, Collection, Browser6visible: Condition[[], Element] = _match.element_is_visible.not_7hidden: Condition[[], Element] = _match.element_is_hidden.not_8present: Condition[[], Element] = _match.element_is_present.not_9in_dom: Condition[[], Element] = _match.element_is_present.not_10existing: Condition[[], Element] = _match.element_is_present.not_11absent: Condition[[], Element] = _match.element_is_absent.not_12enabled: Condition[[], Element] = _match.element_is_enabled.not_13disabled: Condition[[], Element] = _match.element_is_disabled.not_14blank: Condition[[], Element] = _match.element_is_blank.not_15def exact_text(value) -> Condition[[], Element]:16 return _match.element_has_exact_text(value).not_17def text(partial_value) -> Condition[[], Element]:18 return _match.element_has_text(partial_value).not_19def attribute(name: str, value: str = None):20 if value:21 warnings.warn(22 'passing second argument is deprecated; use have.attribute(foo).value(bar) instead',23 DeprecationWarning,24 )25 return _match.element_has_attribute(name).value(value).not_26 original = _match.element_has_attribute(name)27 negated = original.not_28 def value(self, expected: str, ignore_case=False) -> Condition[[], Element]:29 return original.value(expected, ignore_case).not_30 def value_containing(31 self, expected: str, ignore_case=False32 ) -> Condition[[], Element]:33 return original.value_containing(expected, ignore_case).not_34 def values(self, *expected: str) -> Condition[[], Collection]:35 return original.values(*expected).not_36 def values_containing(self, *expected: str) -> Condition[[], Collection]:37 return original.values_containing(*expected).not_38 negated.value = value39 negated.value_containing = value_containing40 negated.values = values41 negated.values_containing = values_containing42 return negated43def js_property(name: str, value: str = None):44 if value:45 warnings.warn(46 'passing second argument is deprecated; use have.js_property(foo).value(bar) instead',47 DeprecationWarning,48 )49 return _match.element_has_js_property(name).value(value).not_50 original = _match.element_has_js_property(name)51 negated = original.not_52 def value(self, expected: str) -> Condition[[], Element]:53 return original.value(expected).not_54 def value_containing(self, expected: str) -> Condition[[], Element]:55 return original.value_containing(expected).not_56 def values(self, *expected: str) -> Condition[[], Collection]:57 return original.values(*expected).not_58 def values_containing(self, *expected: str) -> Condition[[], Collection]:59 return original.values_containing(*expected).not_60 negated.value = value61 negated.value_containing = value_containing62 negated.values = values63 negated.values_containing = values_containing64 return negated65def css_property(name: str, value: str = None):66 if value:67 warnings.warn(68 'passing second argument is deprecated; use have.css_property(foo).value(bar) instead',69 DeprecationWarning,70 )71 return _match.element_has_css_property(name).value(value).not_72 original = _match.element_has_css_property(name)73 negated = original.not_74 def value(self, expected: str) -> Condition[[], Element]:75 return original.value(expected).not_76 def value_containing(self, expected: str) -> Condition[[], Element]:77 return original.value_containing(expected).not_78 def values(self, *expected: str) -> Condition[[], Collection]:79 return original.values(*expected).not_80 def values_containing(self, *expected: str) -> Condition[[], Collection]:81 return original.values_containing(*expected).not_82 negated.value = value83 negated.value_containing = value_containing84 negated.values = values85 negated.values_containing = values_containing86 return negated87def value(text) -> Condition[[], Element]:88 return _match.element_has_value(text).not_89def value_containing(partial_text) -> Condition[[], Element]:90 return _match.element_has_value_containing(partial_text).not_91def css_class(name) -> Condition[[], Element]:92 return _match.element_has_css_class(name).not_93def tag(name: str) -> Condition[[], Element]:94 return _match.element_has_tag(name).not_95def tag_containing(name: str) -> Condition[[], Element]:96 return _match.element_has_tag_containing(name).not_97def size(number: int) -> Condition[[], Collection]:98 return _match.collection_has_size(number).not_99def size_less_than(number: int) -> Condition[[], Collection]:100 return _match.collection_has_size_less_than(number).not_101def size_less_than_or_equal(number: int) -> Condition[[], Collection]:102 return _match.collection_has_size_less_than_or_equal(number).not_103def size_greater_than(number: int) -> Condition[[], Collection]:104 return _match.collection_has_size_greater_than(number).not_105def size_at_least(number: int) -> Condition[[], Collection]:106 warnings.warn(107 'might be deprecated; use have.size_greater_than_or_equal instead',108 PendingDeprecationWarning,109 )110 return _match.collection_has_size_greater_than_or_equal(number).not_111def size_greater_than_or_equal(number: int) -> Condition[[], Collection]:112 return _match.collection_has_size_greater_than_or_equal(number).not_113def texts(*partial_values: str) -> Condition[[], Collection]:114 return _match.collection_has_texts(*partial_values).not_115def exact_texts(*values: str) -> Condition[[], Collection]:116 return _match.collection_has_exact_texts(*values).not_117def url(exact_value: str) -> Condition[[], Browser]:118 return _match.browser_has_url(exact_value).not_119def url_containing(partial_value: str) -> Condition[[], Browser]:120 return _match.browser_has_url_containing(partial_value).not_121def title(exact_value: str) -> Condition[[], Browser]:122 return _match.browser_has_title(exact_value).not_123def title_containing(partial_value: str) -> Condition[[], Browser]:124 return _match.browser_has_title_containing(partial_value).not_125def tabs_number(value: int) -> Condition[[], Browser]:126 return _match.browser_has_tabs_number(value).not_127def tabs_number_less_than(value: int) -> Condition[[], Browser]:128 return _match.browser_has_tabs_number_less_than(value).not_129def tabs_number_less_than_or_equal(value: int) -> Condition[[], Browser]:130 return _match.browser_has_tabs_number_less_than_or_equal(value).not_131def tabs_number_greater_than(value: int) -> Condition[[], Browser]:132 return _match.browser_has_tabs_number_greater_than(value).not_133def tabs_number_greater_than_or_equal(value: int) -> Condition[[], Browser]:134 return _match.browser_has_tabs_number_greater_than_or_equal(value).not_135def js_returned_true(script_to_return_bool: str) -> Condition[[], Browser]:136 warnings.warn(137 'might be deprecated; use have.js_returned(True, ...) instead',138 PendingDeprecationWarning,139 )140 return _match.browser_has_js_returned(True, script_to_return_bool).not_141def js_returned(expected: Any, script: str, *args) -> Condition[[], Browser]:...

Full Screen

Full Screen

results.py

Source:results.py Github

copy

Full Screen

...33avg std min max3496706.3 2651.17 80156 9806235100318 1131.11 91302 10094036100649 1752.85 87910 10176237and_(or_(and_(IN9, or_(IN5, IN3)), and_(or_(and_(or_(and_(IN13, IN12), not_(not_(IN8))), IN16), and_(or_(and_(not_(not_(IN8)), or_(IN2, IN4)), or_(and_(and_(or_(and_(IN7, or_(IN3, IN3)), IN10), or_(and_(and_(not_(not_(IN8)), and_(or_(and_(IN7, or_(and_(IN7, or_(IN3, IN3)), not_(IN8))), IN10), or_(IN5, IN4))), IN16), IN2)), IN16), and_(or_(and_(not_(not_(IN1)), or_(IN2, and_(IN7, or_(or_(IN3, IN5), or_(and_(IN2, IN4), IN10))))), IN15), or_(IN12, and_(IN6, IN11))))), or_(IN2, and_(IN7, or_(or_(IN3, IN5), or_(and_(IN2, IN4), IN10)))))), or_(and_(or_(and_(IN7, or_(and_(IN7, or_(IN3, IN3)), or_(and_(IN6, IN8), IN10))), IN10), or_(IN5, IN4)), and_(or_(and_(or_(IN4, not_(not_(IN8))), IN16), and_(or_(and_(not_(not_(IN8)), or_(IN7, IN4)), IN15), or_(not_(not_(and_(IN13, IN3))), and_(IN6, IN11)))), IN12)))), or_(and_(or_(or_(and_(IN2, IN4), IN10), IN15), or_(not_(not_(and_(IN13, IN12))), and_(IN6, IN11))), or_(and_(and_(or_(and_(IN7, or_(IN3, IN3)), IN10), or_(and_(and_(or_(and_(IN7, or_(IN3, IN3)), IN13), and_(or_(and_(IN7, or_(and_(IN7, or_(IN3, IN3)), not_(IN8))), IN10), or_(and_(or_(and_(IN7, or_(and_(IN7, or_(IN3, IN3)), not_(IN8))), IN10), or_(IN5, IN4)), IN4))), IN16), IN2)), IN16), and_(or_(and_(not_(not_(IN1)), or_(IN2, and_(IN7, or_(or_(IN3, IN5), or_(and_(IN2, IN4), IN10))))), IN15), or_(not_(not_(IN8)), and_(IN6, IN11))))))3898445.8 491.316 95088 988623992616.2 2998.54 74400 938804096612.7 3473.9 73164 984344196469.9 1417.88 87818 976344298469.3 2206.32 87930 996764397442.4 2274.31 83064 98402...

Full Screen

Full Screen

text_preprocessing.py

Source:text_preprocessing.py Github

copy

Full Screen

1from nltk.stem import SnowballStemmer2stemmer = SnowballStemmer('english')3def _coll_neg(text):4 text = text.replace("n't", " not")5 text = text.replace(" dont ", " do_not_")6 text = text.replace(" isnt ", " is not_")7 text = text.replace("not ", "not_")8 text = text.replace("'", "")9 #text = text.replace("dont ", "dont_")10 # won't -> will not11 # 's not -> is not_12 # "isnt" -> is not_13 # "wasnt" -> was not_14 # is not -> is not_15 # don't -> do not_16 # doesn't -> does not_17 # ("n't" -> " not_")18 return text19def add_negation(texts):20 return map(_coll_neg, texts)21def stem(text):22 text = text.lower()23 text = [' '.join(map(stemmer.stem, text.split()))]...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Lemoncheesecake automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful