Download pool/shard003/Python/0027021_Dictionary_Lookup.py from Variable-role/sajaniemi_variable_dataset_large: direct link, hf CLI and curl.
- Browser
- Download file 1.03 kB
-
https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard003/Python/0027021_Dictionary_Lookup.py
- Command line
-
hf download hf://datasets/Variable-role/sajaniemi_variable_dataset_large/pool/shard003/Python/0027021_Dictionary_Lookup.py
-
curl -L -o 0027021_Dictionary_Lookup.py https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard003/Python/0027021_Dictionary_Lookup.py
1.03 kB
| # coding: utf-8 | |
| from objc_util import ObjCClass, UIApplication, CGSize, on_main_thread | |
| import sys | |
| import appex | |
| import dialogs | |
| import ui | |
| UIReferenceLibraryViewController = ObjCClass('UIReferenceLibraryViewController') | |
| def main(): | |
| input = ' '.join(sys.argv[1:]) or dialogs.text_dialog() | |
| if input: | |
| referenceViewController = UIReferenceLibraryViewController.alloc().initWithTerm_(input) | |
| rootVC = UIApplication.sharedApplication().keyWindow().rootViewController() | |
| tabVC = rootVC.detailViewController() | |
| referenceViewController.setTitle_("Definition: '{}'".format(input)) | |
| referenceViewController.setPreferredContentSize_(CGSize(540, 540)) | |
| referenceViewController.setModalPresentationStyle_(2) | |
| #tabVC.addTabWithViewController_(referenceViewController) | |
| tabVC.presentViewController_animated_completion_(referenceViewController, True, None) | |
| if __name__ == '__main__': | |
| if not appex.is_running_extension(): | |
| main() | |
| else: | |
| dialogs.hud_alert('Script does not work in app extension', icon='error') | |