How to use create_folder method in SeleniumBase

Best Python code snippet using SeleniumBase

factory.py

Source:factory.py Github

copy

Full Screen

...8from . import cars1969from . import stanford_online_products10from . import afew11from . import affect12def create_folder(pathname, name): 13 # create path name dir 14 pathname = os.path.join(pathname, name )15 if not os.path.exists(pathname):16 os.makedirs(pathname)17 return pathname18class FactoryDataset(object):19 20 training = 'train'21 validation = 'val'22 test = 'test'23 mnist='mnist'24 fashion='fashion'25 emnist='emnist'26 cifar10='cifar10'27 cifar100='cifar100'28 stl10='stl10'29 svhn='svhn'30 imaterialist='imaterialist'31 32 ferp='ferp'33 ck='ck'34 jaffe='jaffe'35 bu3dfe='bu3dfe'36 afew='afew'37 affect='affectnet'38 affectdark='affectnetdark'39 cub2011='cub2011'40 cars196='cars196'41 stanford_online_products='stanford_online_products'42 cub2011metric='cub2011metric'43 cars196metric='cars196metric'44 45 @classmethod46 def _checksubset(self, subset): 47 return subset=='train' or subset=='val' or subset=='test'48 @classmethod49 def factory(self, 50 pathname,51 name,52 subset='train',53 download=False,54 transform=None,55 ):56 """Factory dataset57 """58 assert( self._checksubset(subset) )59 pathname = os.path.expanduser(pathname)60 61 # pythorch vision dataset soported62 if name == 'mnist': 63 btrain=(subset=='train')64 pathname = create_folder(pathname, name)65 data = datasets.MNIST( pathname, train=btrain, transform=transform, download=download) 66 data.labels = np.array( data.targets ) 67 elif name == 'fashion':68 btrain=(subset=='train')69 pathname = create_folder(pathname, name)70 data = datasets.FashionMNIST(pathname, train=btrain, transform=transform, download=download)71 data.labels = np.array( data.targets )72 elif name == 'emnist': 73 btrain=(subset=='train')74 pathname = create_folder(pathname, name)75 data = datasets.EMNIST(pathname, split='byclass', train=btrain, transform=transform, download=download)76 data.labels = np.array( data.targets ) 77 elif name == 'cifar10': 78 btrain=(subset=='train') 79 pathname = create_folder(pathname, name) 80 data = datasets.CIFAR10(pathname, train=btrain, transform=transform, download=download)81 data.labels = np.array( data.targets ) 82 elif name == 'cifar100': 83 btrain=(subset=='train') 84 pathname = create_folder(pathname, name) 85 data = datasets.CIFAR100(pathname, train=btrain, transform=transform, download=download)86 data.labels = np.array( data.targets )87 elif name == 'stl10': 88 split= 'train' if (subset=='train') else 'test'89 pathname = create_folder(pathname, name) 90 data = datasets.STL10(pathname, split=split, transform=transform, download=download)91 elif name == 'svhn':92 split= 'train' if (subset=='train') else 'test'93 pathname = create_folder(pathname, name) 94 data = datasets.SVHN(pathname, split=split, transform=transform, download=download)95 data.classes = np.unique( data.labels )96 # internet dataset97 98 elif name == 'cub2011': 99 btrain=(subset=='train')100 pathname = create_folder(pathname, name) 101 data = cub2011.CUB2011(pathname, train=btrain, download=download)102 data.labels = np.array( data.targets ) 103 elif name == 'cars196': 104 btrain=(subset=='train')105 pathname = create_folder(pathname, name) 106 data = cars196.Cars196(pathname, train=btrain, download=download)107 data.labels = np.array( data.targets ) 108 elif name == 'stanford_online_products': 109 btrain=(subset=='train')110 pathname = create_folder(pathname, name) 111 data = stanford_online_products.StanfordOnlineProducts(pathname, train=btrain, download=download)112 data.labels = np.array( data.targets ) 113 data.btrain = btrain114 # kaggle dataset115 elif name == 'imaterialist':116 pathname = create_folder(pathname, name)117 data = imaterialist.IMaterialistDatset(pathname, subset, 'jpg')118 # fer datasets119 elif name == 'ferp':120 pathname = create_folder(pathname, name) 121 if subset=='train': subfolder = ferp.train 122 elif subset=='val': subfolder = ferp.valid123 elif subset=='test': subfolder = ferp.test124 else: assert(False) 125 data = ferp.FERPDataset(pathname, subfolder, download=download)126 elif name == 'ck':127 btrain=(subset=='train') 128 pathname = create_folder(pathname, name)129 data = fer.FERClassicDataset(pathname, 'ck', idenselect=[], train=btrain)130 elif name == 'ckp':131 btrain=(subset=='train')132 pathname = create_folder(pathname, name)133 data = fer.FERClassicDataset(pathname, 'ckp', idenselect=[], train=btrain)134 elif name == 'jaffe':135 btrain=(subset=='train')136 pathname = create_folder(pathname, name)137 data = fer.FERClassicDataset(pathname, 'jaffe', idenselect=[], train=btrain)138 139 elif name == 'bu3dfe':140 btrain=(subset=='train')141 pathname = create_folder(pathname, name) 142 data = fer.FERClassicDataset(pathname, 'bu3dfe', idenselect=[], train=btrain)143 elif name == 'afew': 144 btrain=(subset=='train')145 pathname = create_folder(pathname, name) 146 data = afew.Afew(pathname, train=btrain, download=download)147 data.labels = np.array( data.targets ) 148 149 elif name == 'affectnet':150 btrain=(subset=='train')151 pathname = create_folder(pathname, name)152 data = affect.create_affect(path=pathname, train=btrain)153 elif name == 'affectnetdark':154 btrain=(subset=='train')155 pathname = create_folder(pathname, 'affectnet')156 data = affect.create_affectdark(path=pathname, train=btrain)157 # metric learning dataset158 elif name == 'cub2011metric': 159 btrain=(subset=='train') 160 pathname = create_folder(pathname, 'cub2011')161 data = cub2011.CUB2011MetricLearning(pathname, train=btrain, download=download)162 data.labels = np.array( data.targets ) 163 elif name == 'cars196metric': 164 btrain=(subset=='train') 165 pathname = create_folder(pathname, 'cars196')166 data = cars196.Cars196MetricLearning(pathname, train=btrain, download=download)167 data.labels = np.array( data.targets ) 168 169 else: 170 assert(False)171 data.btrain = (subset=='train')...

Full Screen

Full Screen

migrations.py

Source:migrations.py Github

copy

Full Screen

2import utils3print(os.getcwd())4os.chdir('..')5CONSTANTS = utils.Defaults()6utils.create_folder(directory=os.getcwd(), name='log')7utils.create_folder(directory=os.getcwd(), name='data')8utils.create_folder(directory=os.path.join(os.getcwd(), 'data'), name='raw')9utils.create_folder(directory=os.path.join(os.getcwd(), 'data'), name='swamp')10utils.create_folder(directory=os.path.join(os.getcwd(), 'data'), name='lake')11utils.create_folder(directory=os.path.join(os.getcwd(), 'data', 'raw'), name='megasena')12utils.create_folder(directory=os.path.join(os.getcwd(), 'data', 'raw'), name='quina')13utils.create_folder(directory=os.path.join(os.getcwd(), 'data', 'raw'), name='lotofacil')14utils.create_folder(directory=os.path.join(os.getcwd(), 'data', 'swamp'), name='megasena')15utils.create_folder(directory=os.path.join(os.getcwd(), 'data', 'swamp'), name='quina')16utils.create_folder(directory=os.path.join(os.getcwd(), 'data', 'swamp'), name='lotofacil')17utils.create_folder(directory=os.path.join(os.getcwd(), 'data', 'lake'), name='megasena')18utils.create_folder(directory=os.path.join(os.getcwd(), 'data', 'lake'), name='quina')...

Full Screen

Full Screen

config.py

Source:config.py Github

copy

Full Screen

1import os.path2def create_folder(name):3 if not os.path.exists(name):4 os.makedirs(name)5 return name6home_folder = os.path.expanduser("~")7root_folder = create_folder(os.path.join(home_folder, ".raireplay"))8data_folder = create_folder(os.path.join(root_folder, "data"))9replay_folder = create_folder(os.path.join(data_folder, "replay"))10raiplay_folder = create_folder(os.path.join(data_folder, "raiplay"))11raiplayradio_folder = create_folder(os.path.join(data_folder, "raiplayradio"))12item_folder = create_folder(os.path.join(data_folder, "items"))13page_folder = create_folder(os.path.join(data_folder, "pages"))14demand_folder = create_folder(os.path.join(data_folder, "demand"))15tg_folder = create_folder(os.path.join(data_folder, "tg"))16mediaset_folder = create_folder(os.path.join(data_folder, "mediaset"))17pluzz_folder = create_folder(os.path.join(data_folder, "pluzz"))18tf1_folder = create_folder(os.path.join(data_folder, "tf1"))19m6_folder = create_folder(os.path.join(data_folder, "m6"))...

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 SeleniumBase 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