How to use by_name method in lisa

Best Python code snippet using lisa_python

registrable_test.py

Source:registrable_test.py Github

copy

Full Screen

...36 @base_class.register('fake')37 class Fake(base_class):38 # pylint: disable=abstract-method39 pass40 assert base_class.by_name('fake') == Fake41 default = base_class.default_implementation42 if default is not None:43 assert base_class.list_available()[0] == default44 base_class.default_implementation = "fake"45 assert base_class.list_available()[0] == "fake"46 with pytest.raises(ConfigurationError):47 base_class.default_implementation = "not present"48 base_class.list_available()49 base_class.default_implementation = default50 del Registrable._registry[base_class]['fake'] # pylint: disable=protected-access51 # TODO(mattg): maybe move all of these into tests for the base class?52 def test_registry_has_builtin_dataset_readers(self):53 assert DatasetReader.by_name('snli').__name__ == 'SnliReader'54 assert DatasetReader.by_name('sequence_tagging').__name__ == 'SequenceTaggingDatasetReader'55 assert DatasetReader.by_name('language_modeling').__name__ == 'LanguageModelingReader'56 assert DatasetReader.by_name('squad').__name__ == 'SquadReader'57 def test_registry_has_builtin_iterators(self):58 assert DataIterator.by_name('basic').__name__ == 'BasicIterator'59 assert DataIterator.by_name('bucket').__name__ == 'BucketIterator'60 def test_registry_has_builtin_tokenizers(self):61 assert Tokenizer.by_name('word').__name__ == 'WordTokenizer'62 assert Tokenizer.by_name('character').__name__ == 'CharacterTokenizer'63 def test_registry_has_builtin_token_indexers(self):64 assert TokenIndexer.by_name('single_id').__name__ == 'SingleIdTokenIndexer'65 assert TokenIndexer.by_name('characters').__name__ == 'TokenCharactersIndexer'66 def test_registry_has_builtin_regularizers(self):67 assert Regularizer.by_name('l1').__name__ == 'L1Regularizer'68 assert Regularizer.by_name('l2').__name__ == 'L2Regularizer'69 def test_registry_has_builtin_initializers(self):70 all_initializers = {71 "normal": torch.nn.init.normal_,72 "uniform": torch.nn.init.uniform_,73 "orthogonal": torch.nn.init.orthogonal_,74 "constant": torch.nn.init.constant_,75 "dirac": torch.nn.init.dirac_,76 "xavier_normal": torch.nn.init.xavier_normal_,77 "xavier_uniform": torch.nn.init.xavier_uniform_,78 "kaiming_normal": torch.nn.init.kaiming_normal_,79 "kaiming_uniform": torch.nn.init.kaiming_uniform_,80 "sparse": torch.nn.init.sparse_,81 "eye": torch.nn.init.eye_,82 }83 for key, value in all_initializers.items():84 # pylint: disable=protected-access85 assert Initializer.by_name(key)()._init_function == value86 def test_registry_has_builtin_learning_rate_schedulers(self):87 all_schedulers = {88 "step": torch.optim.lr_scheduler.StepLR,89 "multi_step": torch.optim.lr_scheduler.MultiStepLR,90 "exponential": torch.optim.lr_scheduler.ExponentialLR,91 "reduce_on_plateau": torch.optim.lr_scheduler.ReduceLROnPlateau92 }93 for key, value in all_schedulers.items():94 assert LearningRateScheduler.by_name(key) == value95 def test_registry_has_builtin_token_embedders(self):96 assert TokenEmbedder.by_name("embedding").__name__ == 'Embedding'97 assert TokenEmbedder.by_name("character_encoding").__name__ == 'TokenCharactersEncoder'98 def test_registry_has_builtin_text_field_embedders(self):99 assert TextFieldEmbedder.by_name("basic").__name__ == 'BasicTextFieldEmbedder'100 def test_registry_has_builtin_seq2seq_encoders(self):101 # pylint: disable=protected-access102 assert Seq2SeqEncoder.by_name('gru')._module_class.__name__ == 'GRU'103 assert Seq2SeqEncoder.by_name('lstm')._module_class.__name__ == 'LSTM'104 assert Seq2SeqEncoder.by_name('rnn')._module_class.__name__ == 'RNN'105 def test_registry_has_builtin_seq2vec_encoders(self):106 assert Seq2VecEncoder.by_name('cnn').__name__ == 'CnnEncoder'107 # pylint: disable=protected-access108 assert Seq2VecEncoder.by_name('gru')._module_class.__name__ == 'GRU'109 assert Seq2VecEncoder.by_name('lstm')._module_class.__name__ == 'LSTM'110 assert Seq2VecEncoder.by_name('rnn')._module_class.__name__ == 'RNN'111 def test_registry_has_builtin_similarity_functions(self):112 assert SimilarityFunction.by_name("dot_product").__name__ == 'DotProductSimilarity'113 assert SimilarityFunction.by_name("bilinear").__name__ == 'BilinearSimilarity'114 assert SimilarityFunction.by_name("linear").__name__ == 'LinearSimilarity'...

Full Screen

Full Screen

magic.py

Source:magic.py Github

copy

Full Screen

1#Autogenerated. Do not edit!2by_name = {}3by_val = {}4by_name['IDS'] = 14136852965by_val[1413685296] = 'IDS'6by_name['IRMAP_CACHE'] = 14596342657by_val[1459634265] = 'IRMAP_CACHE'8by_name['FS'] = 13631634109by_val[1363163410] = 'FS'10by_name['PAGEMAP'] = 144338128511by_val[1443381285] = 'PAGEMAP'12by_name['CGROUP'] = 149685534413by_val[1496855344] = 'CGROUP'14by_name['FIFO'] = 147995269715by_val[1479952697] = 'FIFO'16by_name['EVENTFD_FILE'] = 114623875417by_val[1146238754] = 'EVENTFD_FILE'18by_name['PIPES_DATA'] = 144737664919by_val[1447376649] = 'PIPES_DATA'20by_name['INETSK'] = 144731144121by_val[1447311441] = 'INETSK'22by_name['TTY_FILES'] = 149757546123by_val[1497575461] = 'TTY_FILES'24by_name['UTSNS'] = 141395200325by_val[1413952003] = 'UTSNS'26by_name['FDINFO'] = 144501739427by_val[1445017394] = 'FDINFO'28by_name['NS_FILES'] = 163114190529by_val[1631141905] = 'NS_FILES'30by_name['INOTIFY_WD'] = 141493044131by_val[1414930441] = 'INOTIFY_WD'32by_name['CRTOOLS_IMAGES_V1_1'] = 233by_val[2] = 'CRTOOLS_IMAGES_V1_1'34by_name['EVENTPOLL_TFD'] = 114525575035by_val[1145255750] = 'EVENTPOLL_TFD'36by_name['MNTS'] = 143171408837by_val[1431714088] = 'MNTS'38by_name['VMAS'] = 141047992739by_val[1410479927] = 'VMAS'40by_name['IPCNS_SHM'] = 117703891641by_val[1177038916] = 'IPCNS_SHM'42by_name['CORE'] = 142640544743by_val[1426405447] = 'CORE'44by_name['FILE_LOCKS'] = 141257679045by_val[1412576790] = 'FILE_LOCKS'46by_name['EVENTPOLL_FILE'] = 115777340047by_val[1157773400] = 'EVENTPOLL_FILE'48by_name['REMAP_FPATH'] = 149443208449by_val[1494432084] = 'REMAP_FPATH'50by_name['SK_QUEUES'] = 144534736651by_val[1445347366] = 'SK_QUEUES'52by_name['USERNS'] = 143073511053by_val[1430735110] = 'USERNS'54by_name['REG_FILES'] = 134573010255by_val[1345730102] = 'REG_FILES'56by_name['TUNFILE'] = 146094267357by_val[1460942673] = 'TUNFILE'58by_name['IPC_VAR'] = 139364352759by_val[1393643527] = 'IPC_VAR'60by_name['TTY_INFO'] = 149770655061by_val[1497706550] = 'TTY_INFO'62by_name['AUTOFS'] = 122822483563by_val[1228224835] = 'AUTOFS'64by_name['PIPES'] = 144816264565by_val[1448162645] = 'PIPES'66by_name['NETDEV'] = 146323694567by_val[1463236945] = 'NETDEV'68by_name['BINFMT_MISC'] = 173147421169by_val[1731474211] = 'BINFMT_MISC'70by_name['RLIMIT'] = 146074653371by_val[1460746533] = 'RLIMIT'72by_name['POSIX_TIMERS'] = 138203784773by_val[1382037847] = 'POSIX_TIMERS'74by_name['STATS'] = 146022067875by_val[1460220678] = 'STATS'76by_name['FANOTIFY_MARK'] = 144810808577by_val[1448108085] = 'FANOTIFY_MARK'78by_name['TIMERFD'] = 134697550679by_val[1346975506] = 'TIMERFD'80by_name['TCP_STREAM'] = 136356378281by_val[1363563782] = 'TCP_STREAM'82by_name['FILES'] = 144599890483by_val[1445998904] = 'FILES'84by_name['CPUINFO'] = 163160065985by_val[1631600659] = 'CPUINFO'86by_name['ITIMERS'] = 146422178287by_val[1464221782] = 'ITIMERS'88by_name['CREDS'] = 140943085589by_val[1409430855] = 'CREDS'90by_name['SIGACT'] = 142948812991by_val[1429488129] = 'SIGACT'92by_name['FIFO_DATA'] = 149652693293by_val[1496526932] = 'FIFO_DATA'94by_name['SECCOMP'] = 168199380195by_val[1681993801] = 'SECCOMP'96by_name['IMG_SERVICE'] = 142713478497by_val[1427134784] = 'IMG_SERVICE'98by_name['PSTREE'] = 134474552099by_val[1344745520] = 'PSTREE'100by_name['UNIXSK'] = 1412905283101by_val[1412905283] = 'UNIXSK'102by_name['EXT_FILES'] = 1495619137103by_val[1495619137] = 'EXT_FILES'104by_name['SIGNAL'] = 1495619143105by_val[1495619143] = 'SIGNAL'106by_name['INOTIFY_FILE'] = 1212302385107by_val[1212302385] = 'INOTIFY_FILE'108by_name['IPCNS_SEM'] = 1498886169109by_val[1498886169] = 'IPCNS_SEM'110by_name['NETLINK_SK'] = 1476417044111by_val[1476417044] = 'NETLINK_SK'112by_name['IMG_COMMON'] = 1414939417113by_val[1414939417] = 'IMG_COMMON'114by_name['KDAT'] = 1459762264115by_val[1459762264] = 'KDAT'116by_name['FANOTIFY_FILE'] = 1426678050117by_val[1426678050] = 'FANOTIFY_FILE'118by_name['TTY_DATA'] = 1497444390119by_val[1497444390] = 'TTY_DATA'120by_name['SIGNALFD'] = 1462908960121by_val[1462908960] = 'SIGNALFD'122by_name['MM'] = 1464412192123by_val[1464412192] = 'MM'124by_name['NETNS'] = 1435711314125by_val[1435711314] = 'NETNS'126by_name['PACKETSK'] = 1615152664127by_val[1615152664] = 'PACKETSK'128by_name['GHOST_FILE'] = 1381512709129by_val[1381512709] = 'GHOST_FILE'130by_name['IPCNS_MSG'] = 1430599479131by_val[1430599479] = 'IPCNS_MSG'132by_name['INVENTORY'] = 1479618838...

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