Best Python code snippet using Testify_python
buildUI.py
Source:buildUI.py
1from Qt import QtWidgets as wdg2from Qt import QtGui as gui3from Qt import QtCore as qt4import maya.cmds as mc5import maya.mel as mm6from rigBot.gui import mayaWidget7from rigBot.gui import loadDataUI8from rigBot.gui import handPoseUI9from rigBot.gui import build_ui10from rigBot import env11from rigBot import mod12from rigBot import utils13from rigBot import rig14from functools import partial15import getpass16import inspect17import rigBot18import os19import pydoc20reload(build_ui)21class BuildUI(mayaWidget.MayaWidget):22 def __init__(self, parent=None, ignore_missing=False, label=''):23 mayaWidget.MayaWidget.__init__(self, parent=parent)24 title = 'build_UI'25 #if mc.window(title, q=1, ex=1):26 #mc.deleteUI(title)27 self.ui = build_ui.Ui_guides_form()28 self.ui.setupUi(self)29 self.setObjectName(title)30 mayaWidget.set_icon(self.ui.help_btn, 'info_24x24.png')31 mayaWidget.set_icon(self.ui.icon_label, 'logo_36x36.png')32 css = 'QPushButton:!disabled { background-color: #7c5cb7; }'33 self.ui.build_all_btn.setStyleSheet(css)34 self.ui.help_btn.released.connect(rigBot.help)35 self.resize(445, 720)36 self.ui.splitter.setStretchFactor(0,1)37 self.ui.splitter.setStretchFactor(1,0)38 self.ui.splitter.setCollapsible(1,1)39 self.ui.splitter.setCollapsible(0,0)40 self.ui.splitter.setSizes([1000,100])41 self.asset = ''42 self.variant = ''43 self.variants = ['default']44 self.use_plugin = False45 self.import_error = False46 self.build_module = None47 self.no_asset_mode = False48 self.build_items = []49 self.build_list = []50 self.ui.variant_cmb.currentIndexChanged.connect(self.set_variant)51 # self.ui.use_plugin_chx.stateChanged.connect(self.set_use_plugin)52 self.ui.cache_chx.stateChanged.connect(self.set_cache_build)53 self.ui.build_tree.header().setSectionResizeMode(0, wdg.QHeaderView.Stretch)54 self.ui.build_tree.header().setSectionResizeMode(1, wdg.QHeaderView.ResizeToContents)55 self.ui.build_tree.itemChanged.connect(self.set_enabled)56 self.ui.build_tree.itemSelectionChanged.connect(self.update_info_widget)57 self.ui.hand_util_btn.released.connect(handPoseUI.run)58 self.ui.data_util_btn.released.connect(loadDataUI.run)59 self.ui.data_util_btn_2.released.connect(rig.unfinalize)60 self.ui.build_next_btn.released.connect(self.build_next_step)61 self.ui.build_selected_btn.released.connect(self.build_selected_steps)62 self.ui.build_to_selected_btn.released.connect(partial(self.build_selected_steps, to_selection=True))63 self.ui.build_all_btn.released.connect(partial(self.build_selected_steps, remaining=True))64 self.ui.load_cache_build_btn.released.connect(self.load_cache_and_rebuild)65 self.ui.load_cache_build_btn.hide()66 self.ui.open_btn.released.connect(self.open_module_file)67 self.ui.open_btn_2.released.connect(self.open_build_list_file)68 self.ui.migrate_btn.released.connect(self.migrate_file)69 item = wdg.QAction(self)70 item.setText('Build All Steps From Start To Finish')71 item.triggered.connect(partial(self.build_selected_steps, fresh_build=True))72 self.ui.build_all_btn.addAction(item)73 item = wdg.QAction(self)74 item.setText('Build Next Step')75 item.triggered.connect(self.build_next_step)76 self.ui.build_tree.addAction(item)77 item = wdg.QAction(self)78 item.setText('Build Selected Steps')79 item.triggered.connect(self.build_selected_steps)80 self.ui.build_tree.addAction(item)81 item = wdg.QAction(self)82 item.setText('Build Up To Selected Step')83 item.triggered.connect(partial(self.build_selected_steps, to_selection=True))84 self.ui.build_tree.addAction(item)85 div = wdg.QAction(self)86 div.setSeparator(1)87 self.ui.build_tree.addAction(div)88 item = wdg.QAction(self)89 item.setText('Build All Remaining Steps')90 item.triggered.connect(partial(self.build_selected_steps, to_selection=True))91 self.ui.build_tree.addAction(item)92 div = wdg.QAction(self)93 div.setSeparator(1)94 self.ui.build_tree.addAction(div)95 item0 = wdg.QAction(self)96 item0.setText('Load Previous Cache And Run This Step')97 item0.triggered.connect(self.load_cache_and_rebuild)98 self.ui.build_tree.addAction(item0)99 item2 = wdg.QAction(self)100 item2.setText('Load Cache For This Step')101 item2.triggered.connect(self.load_cache)102 self.ui.build_tree.addAction(item2)103 self.cache_items= [item0, item2]104 div = wdg.QAction(self)105 div.setSeparator(1)106 self.ui.build_tree.addAction(div)107 item = wdg.QAction(self)108 item.setText('Reload Build Module and Refresh Steps List')109 item.triggered.connect(self.initialize_ui_widgets)110 self.ui.build_tree.addAction(item)111 item = wdg.QAction(self)112 item.setText('Load Cache For This Step')113 item.triggered.connect(self.load_cache)114 self.ui.load_cache_build_btn.addAction(item)115 self.initialize_ui_widgets()116 def initialize_ui_widgets(self, force_reload=True):117 if force_reload or self.asset != env.get_asset():118 self.read_build_list_from_disk()119 print ('Reloading build list for asset: '+env.get_asset())120 self.set_asset_state()121 self.set_cache_build()122 self.populate_build_tree()123 def read_build_list_from_disk(self):124 """This is what reads the assets build list on disk. The module is reloaded every time its read."""125 self.asset = env.get_asset()126 self.variant = env.get_variant() or 'default'127 self.variants = env.list_variants(verbose=0) or ['default']128 variant_class_name = self.variant[0].upper()+self.variant[1:]129 build_module = mod.import_module(self.asset+'_buildList.'+variant_class_name)130 if not self.asset or not self.variant:131 self.build_module = None132 self.build_list = []133 self.use_plugin = True134 # load default from rigBot asset folder135 self.no_asset_mode = False136 if not build_module:137 build_module = mod.import_module('buildList.'+variant_class_name)138 self.no_asset_mode = True139 elif type(build_module) in [unicode, str]:140 self.ui.build_tree.clear()141 item = wdg.QTreeWidgetItem()142 item.setSizeHint(0, qt.QSize(10, 17))143 item.setText(0, '**No Build List available for this asset!')144 item.setText(1, build_module.split(':')[0])145 item.command_str = self.asset+'_buildList'146 item.file_path = ''147 item.doc_label = self.asset+'_buildList'148 item.build_index = None149 tool_tip = 'Cannot find the {0}_buildList.py\n{1}'.format(self.asset, build_module)150 item.setToolTip(0, tool_tip)151 item.doc_str = tool_tip+'\nMake sure ther are no syntax errors in your code!'152 self.ui.build_tree.addTopLevelItem(item)153 self.ui.module_label.setText(item.doc_label)154 self.ui.doc_browser.setText(item.doc_str)155 self.build_module = build_module156 self.build_list = []157 self.use_plugin = True158 color = gui.QColor('#ff4d4d')159 item.setForeground(0, color)160 item.setForeground(1, color)161 elif build_module:162 build_list = build_module.build_list163 update_required = False164 if len(self.build_list) == len(build_list):165 for i in range(len(build_list)):166 if build_list[i].get('label') != self.build_list[i].get('label'):167 update_required = True168 else:169 update_required = True170 self.build_module = build_module171 self.build_list = build_list172 self.use_plugin = build_module.use_plugin_nodes173 if update_required:174 self.populate_build_tree()175 else:176 self.build_module = None177 self.build_list = []178 self.use_plugin = True179 def script_job_functions(self):180 try:181 self.set_build_status()182 except:183 pass184 def set_asset_state(self):185 # Reset widgets if asset is not set186 try:187 self.ui.variant_cmb.currentIndexChanged.disconnect(self.set_variant)188 except:189 pass190 # try:191 # self.ui.use_plugin_chx.stateChanged.disconnect(self.set_use_plugin)192 # except:193 # pass194 try:195 self.ui.cache_chx.stateChanged.disconnect(self.set_cache_build)196 except:197 pass198 self.ui.variant_cmb.clear()199 self.ui.asset_label.setText('Asset: Not Set!')200 # self.ui.use_plugin_chx.setChecked(1)201 if os.environ['cache_build'] == 'False':202 self.ui.cache_chx.setChecked(0)203 else:204 self.ui.cache_chx.setChecked(1)205 btns = [206 self.ui.open_btn,207 self.ui.open_btn_2,208 self.ui.migrate_btn,209 self.ui.build_all_btn,210 self.ui.build_next_btn,211 self.ui.build_selected_btn,212 self.ui.load_cache_build_btn,213 # self.ui.use_plugin_chx,214 self.ui.cache_chx]215 for btn in btns:216 btn.setEnabled(1)217 # IF asset IS set populate everytrhing218 if self.asset:219 self.ui.asset_label.setText('Asset: '+self.asset)220 if self.asset and self.variant and self.variants:221 variants = self.variants222 if 'default' in variants:223 variants.remove('default')224 variants.insert(0, 'default')225 self.ui.variant_cmb.addItems(variants)226 # self.ui.use_plugin_chx.setChecked(self.use_plugin)227 for btn in btns:228 btn.setEnabled(1)229 idx = variants.index(self.variant)230 self.ui.variant_cmb.setCurrentIndex(idx)231 self.ui.variant_cmb.currentIndexChanged.connect(self.set_variant)232 # self.ui.use_plugin_chx.stateChanged.connect(self.set_use_plugin)233 self.ui.cache_chx.stateChanged.connect(self.set_cache_build)234 def set_variant(self):235 """Set the variant from UI and reset all ui and build list"""236 variant = self.ui.variant_cmb.currentText()237 env.set_variant(variant)238 self.initialize_ui_widgets()239 # def set_use_plugin(self):240 # """Change the use plugin flag PER variant. This is written to the assets build list file."""241 #242 # # state = self.ui.use_plugin_chx.isChecked()243 # # self.build_module.set_use_plugin(state)244 def set_cache_build(self):245 """Set the cache build variable"""246 cache = self.ui.cache_chx.isChecked()247 if cache:248 self.ui.load_cache_build_btn.setEnabled(1)249 os.environ['cache_build'] = 'True'250 for action in self.cache_items:251 action.setEnabled(1)252 else:253 self.ui.load_cache_build_btn.setEnabled(0)254 os.environ['cache_build'] = 'False'255 for action in self.cache_items:256 action.setEnabled(0)257 def clear_build_tree(self):258 for i in reversed(range(self.ui.build_tree.topLevelItemCount())):259 self.ui.build_tree.takeTopLevelItem(i)260 def populate_build_tree(self):261 """This build your build list ui QTreewidget"""262 if type(self.build_module) in [str, unicode]:263 return264 self.clear_build_tree()265 parent_item = None266 self.build_items = []267 try:268 self.ui.build_tree.itemChanged.disconnect(self.set_enabled)269 except:270 pass271 if not self.build_list:272 item = wdg.QTreeWidgetItem()273 item.setSizeHint(0, qt.QSize(10, 17))274 item.setText(0, '**No Build List available for this asset!')275 item.command_str = self.asset+'_buildList'276 item.file_path = ''277 item.doc_label = self.asset+'_buildList'278 item.build_index = None279 tool_tip = 'Cannot find the {0}_buildList.py'.format(self.asset)280 item.setToolTip(0, tool_tip)281 item.doc_str = tool_tip+'\nMake sure ther are no syntax errors in your code!'282 self.ui.build_tree.addTopLevelItem(item)283 self.ui.module_label.setText(item.doc_label)284 self.ui.doc_browser.setText(item.doc_str)285 color = gui.QColor('gray')286 item.setForeground(0, color)287 return288 for idx, item in enumerate(self.build_list):289 label = item.get('label')290 enabled = item.get('enabled')291 command = item.get('command')292 command_str = ''293 file_path = ''294 tool_tip = ''295 doc_str = ''296 doc_label = ''297 error_type = ''298 error_msg = ''299 if command:300 # first get the fila path and doc string for the commands301 if type(command) == partial:302 error_type = ''303 error_msg = ''304 module = command.func.__module__305 command_str = command.func.__name__306 args = command.args307 kwargs = command.keywords308 file_path = inspect.getfile(inspect.getmodule(command.func))309 doc = inspect.getdoc(command.func)310 kwarg_str = '( ' + ', '.join(args)311 for key, value in kwargs.items():312 kwarg_str += '{0}={1}, '.format(key, value)313 if kwarg_str.endswith(', '):314 kwarg_str = kwarg_str[:-2]315 kwarg_str += ' )'316 if kwargs or args:317 command_str += kwarg_str318 else:319 command_str += '()'320 elif type(command) in [unicode, str]:321 doc = command.replace(' :: ', '\n')322 command_str = ''323 file_path = command.split(' :: ')[2]324 module = command.split(' :: ')[1]325 error_type = command.split(':')[0]326 error_msg = '\n'.join(command.split(' :: ')[:-1])327 else:328 error_type = ''329 error_msg = ''330 module = command.__module__331 command_str = command.__name__+'()'332 file_path = inspect.getfile(inspect.getmodule(command))333 doc = inspect.getdoc(command)334 # assemble tool tip335 if not doc:336 doc = ''337 file_path = file_path.replace('.pyc', '.py')338 tool_tip = 'FILE PATH:\n '+file_path+'\n\n'339 tool_tip += 'MODULE:\n '+module+'\n\n'340 tool_tip += 'COMMAND:\n '+command_str+'\n\n'341 doc_label = module+'.'+command_str.split('(')[0]342 # assemble doc string343 doc_str = tool_tip+'.\n'344 doc_str += doc345 # Create the widget item346 item = wdg.QTreeWidgetItem()347 item.setSizeHint(0, qt.QSize(10, 17))348 item.setText(0, label)349 item.setText(1, error_type)350 item.setToolTip(0, tool_tip)351 item.command_str = command_str352 item.doc_str = doc_str353 item.build_index = idx354 item.file_path = file_path355 item.doc_label = doc_label356 item.label = False357 item.error_type = error_type358 item.error_msg = error_msg359 if command:360 if enabled:361 item.setCheckState(0, qt.Qt.CheckState.Checked)362 else:363 item.setCheckState(0, qt.Qt.CheckState.Unchecked)364 if parent_item:365 parent_item.addChild(item)366 parent_item.setExpanded(1)367 else:368 self.ui.build_tree.addTopLevelItem(item)369 else:370 item.label = True371 parent_item = item372 item.setExpanded(1)373 self.ui.build_tree.addTopLevelItem(item)374 self.build_items = [i.value() for i in wdg.QTreeWidgetItemIterator(self.ui.build_tree)]375 self.ui.build_tree.itemChanged.connect(self.set_enabled)376 self.update_info_widget()377 self.set_build_status()378 def set_enabled(self, item):379 new_state = bool(item.checkState(0))380 idx = item.build_index381 try:382 if not 'enabled' in self.build_list[idx].keys():383 return384 except:385 return386 current_state = self.build_list[idx].get('enabled')387 if current_state == new_state:388 return389 if not len(self.build_list) == len(self.build_module.build_list):390 return391 self.build_module.get_step_node()392 self.build_module.get_status()393 self.build_module.set_enabled(idx, new_state)394 def update_info_widget(self):395 items = self.ui.build_tree.selectedItems()396 self.ui.module_label.setText('')397 self.ui.doc_browser.setText('')398 if not items:399 return400 if len(items) > 1:401 self.ui.module_label.setText('Multiple Items Selected...')402 self.ui.doc_browser.setText('')403 return404 item = items[0]405 self.ui.module_label.setText(item.doc_label)406 self.ui.doc_browser.setText(item.doc_str)407 def set_build_status(self):408 self.build_module.get_step_node()409 self.build_module.get_status()410 status_array = self.build_module.status_array411 enabled_array = self.build_module.enabled_array412 next_step = self.build_module.get_next_step()413 build_asset = env.get_asset()414 if mc.objExists(self.build_module.step_node+'.asset'):415 build_asset = mc.getAttr(self.build_module.step_node+'.asset')416 for idx, item in enumerate(self.build_items):417 item.setText(1, item.error_type)418 if item.label:419 color = gui.QColor('gray')420 else:421 color = gui.QColor('#ccc')422 if self.no_asset_mode:423 color = gui.QColor(mayaWidget.purple_color)424 elif item.file_path and self.asset in item.file_path:425 color = gui.QColor(mayaWidget.blue_color)426 if env.using_sandbox:427 color = gui.QColor(mayaWidget.pink_color)428 # status color429 if status_array[idx] == -1:430 color = gui.QColor('#ff4d4d')431 item.setText(1, 'FAILED! ')432 if status_array[idx] in [2]:433 color = gui.QColor('#00b386')434 if item.error_type:435 color = gui.QColor('#ff4d4d')436 item.setForeground(0, color)437 item.setForeground(1, color)438 # Set last successful item to bright green439 for idx in reversed(range(len(self.build_items))):440 if status_array[idx] == 3:441 color = gui.QColor('#00ff99')442 self.build_items[idx].setForeground(0, color)443 self.build_items[idx].setForeground(1, color)444 break445 def set_wip_item_color(self, idx):446 color = gui.QColor('orange')447 self.build_items[idx].setForeground(0, color)448 self.build_items[idx].setForeground(1, color)449 qt.QCoreApplication.processEvents()450 @utils.undoable451 def build_next_step(self):452 self.read_build_list_from_disk()453 self.build_module.get_step_node()454 self.build_module.get_status()455 status_array = self.build_module.status_array456 enabled_array = self.build_module.enabled_array457 next_step = self.build_module.get_next_step()458 try:459 i = self.build_module.get_next_step()460 if not self.build_list[i].get('command'):461 i +=1462 self.set_wip_item_color(i)463 i = self.build_module.build('next')464 if 'command' in self.build_list[i].keys():465 self.save_cache(i)466 except:467 if self.build_items[i].error_msg:468 print self.build_items[i].error_msg469 else:470 print utils.get_exception()471 self.set_build_status()472 @utils.undoable473 def build_selected_steps(self, to_selection=False, remaining=False, fresh_build=False):474 self.read_build_list_from_disk()475 self.build_module.get_step_node()476 self.build_module.get_status()477 status_array = self.build_module.status_array478 enabled_array = self.build_module.enabled_array479 items = self.ui.build_tree.selectedItems()480 next_step = self.build_module.get_next_step()481 last_step = self.build_items[-1].build_index482 if not fresh_build and not remaining and not items:483 mc.warning('No build steps selected!')484 return485 if items:486 selected_idx = [i.build_index for i in items]487 selected_idx.sort()488 next_step = selected_idx[0]489 last_step = selected_idx[-1]490 if to_selection:491 next_step = self.build_module.get_next_step()492 if last_step < next_step:493 mc.warning('The selected step has already been built up to!')494 return495 if remaining:496 next_step = self.build_module.get_next_step()497 last_step = self.build_items[-1].build_index498 if fresh_build:499 next_step = 0500 last_step = self.build_items[-1].build_index501 if not utils.save_changes():502 return503 progress_bar = mm.eval('$tmp = $gMainProgressBar')504 try:505 if next_step == last_step:506 self.set_wip_item_color(next_step)507 self.build_module.build(next_step)508 if 'command' in self.build_list[next_step].keys():509 self.save_cache(next_step)510 self.set_build_status()511 else:512 message = 'Building Rig ...'513 if next_step < last_step+1:514 mc.progressBar(progress_bar, e=True, bp=True, ii=True, st=message, min=next_step, max=last_step+1)515 for i in range(next_step, last_step+1, 1):516 if mc.progressBar(progress_bar, q=True, ic=True):517 mc.warning('Build canceled by user!')518 mc.progressBar(progress_bar, e=True, ep=1)519 return520 self.set_wip_item_color(i)521 self.build_module.build(i)522 if 'command' in self.build_list[i].keys():523 self.save_cache(i)524 self.set_build_status()525 qt.QCoreApplication.processEvents()526 mc.progressBar(progress_bar, e=True, step=1)527 except:528 self.set_build_status()529 mc.progressBar(progress_bar, e=True, ep=1)530 if self.build_items[i].error_msg:531 print self.build_items[i].error_msg532 else:533 print utils.get_exception()534 self.set_build_status()535 mc.progressBar(progress_bar, e=True, ep=1)536 def open_module_file(self):537 items = self.ui.build_tree.selectedItems()538 if not items:539 return540 if len(items) > 1:541 mc.warning('Select only one item to open file!')542 return543 if not items[0].command_str:544 return545 file_path = items[0].file_path546 file_path = file_path.replace('.pyc','.py')547 utils.edit_file(file_path)548 def open_build_list_file(self):549 file_path = os.path.join(env.get_rigbuild_path(), self.asset+'_buildList.py')550 utils.edit_file(file_path)551 def migrate_file(self):552 if not self.asset:553 return554 items = self.ui.build_tree.selectedItems()555 if not items:556 return557 if len(items) > 1:558 mc.warning('Select only one item to open file!')559 return560 if not items[0].command_str:561 return562 file_path = items[0].file_path563 file_path = file_path.replace('.pyc','.py')564 if self.asset in file_path:565 mc.warning('This module is already in the assets rigbuild folder!')566 return567 env.migrate_file(file_path, add_asset_prefix=False, edit=False, verbose=True)568 self.set_build_status()569 def save_cache(self, index):570 if os.environ['cache_build'] != 'True':571 return572 cache_path = mc.internalVar(utd=1)573 utils.make_dirs(cache_path)574 mm.eval('source "cleanUpScene.mel";')575 mm.eval('deleteUnknownNodes();')576 file_path = os.path.join(cache_path, '{0}_{1}_{2}_{3}_rig_cache.ma'.format(577 self.asset,578 self.variant,579 getpass.getuser(),580 index))581 mc.file(file_path, pr=1, ea=1, f=1, type='mayaAscii')582 print '# Cached Step: '+file_path583 def load_cache(self, index=None, previous=False):584 if not self.asset:585 mc.warning('Asset not set.')586 return587 if os.environ['cache_build'] != 'True':588 mc.warning('Caching is currently turned off.')589 return590 item = self.ui.build_tree.currentItem()591 if not item:592 return593 if index is None:594 try:595 index = item.build_index596 if previous:597 index -= 1598 except:599 return600 cache_path = mc.internalVar(utd=1)601 if not os.path.isdir(cache_path):602 mc.warning('Path doesnt exist: '+cache_path)603 return604 file_path = os.path.join(cache_path, '{0}_{1}_{2}_{3}_rig_cache.ma'.format(605 self.asset,606 self.variant,607 getpass.getuser(),608 index))609 if not os.path.isfile(file_path):610 file_path = os.path.join(cache_path, '{0}_{1}_{2}_{3}_rig_cache.ma'.format(611 self.asset,612 self.variant,613 getpass.getuser(),614 index-1))615 if not os.path.isfile(file_path):616 mc.warning('Cache file doesnt exist: '+file_path)617 return618 if not utils.save_changes():619 return620 mc.file(file_path, i=1)621 self.build_module.get_status()622 self.set_build_status()623 print '# Loaded cache Step: '+file_path624 return True625 def load_cache_and_rebuild(self):626 item = self.ui.build_tree.currentItem()627 if not item:628 return629 if self.load_cache(previous=1):...
make.py
Source:make.py
1import sys, re23ARGUMENT_CONVERTERS = {4 str: lambda x: x,5 int: lambda x: int(x),6 bool: lambda x: x.lower() in ['true', 't', 'y', 'yes', '1']7}89def run(build_module, args, cprint):10 try:11 task_names = parse_args(build_module, args)1213 dump_cfg(build_module, cprint)1415 for task_name in task_names:16 cprint('Executing %s' % task_name, 'Cyan')17 task = getattr(build_module, task_name)18 task()19 cprint('Make Succeeded!', 'Green')20 except:21 cprint('Make Failed!', 'Red')22 raise2324def parse_args(build_module, args):25 tasks = []26 for arg in [re.split('\s*=\s*', x, 1) for x in args]:27 if len(arg) == 2:28 arg_type = type(getattr(build_module, arg[0], ''))29 arg_convrter = ARGUMENT_CONVERTERS[arg_type]30 setattr(build_module, arg[0], arg_convrter(arg[1]))31 else:32 add_task(build_module, tasks, arg[0])3334 if not tasks:35 add_task(build_module, tasks, 'default')3637 return tasks3839def add_task(build_module, tasks, task_name):40 task = getattr(build_module, task_name, None)41 if type(task) is list:42 for task_name in task:43 add_task(build_module, tasks, task_name)44 else:45 tasks.append(task_name)4647def dump_cfg(build_module, cprint):48 names = [n for n in dir(build_module) if not n.startswith('_') and type(getattr(build_module, n)) in ARGUMENT_CONVERTERS]4950 if not names:51 return5253 pad = max([len(x) for x in names])5455 for name in names:56 cprint(name.rjust(pad) + ': ', 'White', '')57 cprint(str(getattr(build_module, name)))5859def ironpython_cprint(message, fg='Gray', end='\n'):60 import System61 System.Console.ForegroundColor = getattr(System.ConsoleColor, fg)62 sys.stdout.write(message)63 sys.stdout.write(end)64 System.Console.ResetColor()6566if __name__ == '__main__':67 import os, importlib, traceback6869 build_path = os.path.abspath(sys.argv[1])70 build_args = sys.argv[2:]71 build_dir = os.path.dirname(build_path)72 build_file = os.path.basename(build_path)73 build_module_name, build_ext = os.path.splitext(build_file)7475 sys.path.insert(0, build_dir)76 build_module = importlib.import_module(build_module_name)7778 try:79 run(build_module, build_args, ironpython_cprint)80 except:81 traceback.print_exc()
...
build_api_rst.py
Source:build_api_rst.py
...456def main():78 build_module('util', 'vtool', 'util.py')9 build_module('util_file', 'vtool', 'util_file.py')10 build_module('data', 'vtool', 'data.py')11 build_module('process', 'vtool.process_manager', 'process_manager/process.py')12 build_module('core', 'vtool.maya_lib', 'maya_lib/core.py')13 build_module('attr', 'vtool.maya_lib', 'maya_lib/attr.py')14 build_module('space', 'vtool.maya_lib', 'maya_lib/space.py')15 build_module('geo', 'vtool.maya_lib', 'maya_lib/geo.py')16 build_module('deform', 'vtool.maya_lib', 'maya_lib/deform.py')17 build_module('anim', 'vtool.maya_lib', 'maya_lib/anim.py')18 build_module('shade', 'vtool.maya_lib', 'maya_lib/shade.py')19 build_module('fx', 'vtool.maya_lib', 'maya_lib/fx.py')20 build_module('corrective', 'vtool.maya_lib', 'maya_lib/corrective.py')21 build_module('rigs', 'vtool.maya_lib', 'maya_lib/rigs.py')22 build_module('rigs_util', 'vtool.maya_lib', 'maya_lib/rigs_util.py')23 build_module('blendshape', 'vtool.maya_lib', 'maya_lib/blendshape.py')24 build_module('curve', 'vtool.maya_lib', 'maya_lib/curve.py')25 build_module('api', 'vtool.maya_lib', 'maya_lib/api.py')26 #build_module('ui', 'vtool.maya_lib', 'maya_lib/ui.py')27 28 build_curve.create_curve_rst()29 30def build_module(name, sub_path, sub_file_path):3132 dir = util.vtool_dir33 docs_dir = util.get_doc_directory()34 35 filepath = os.path.join(dir, sub_file_path)36 output_path = docs_dir 37 38 write_module = util.WriteModule(filepath)39 write_module.set_base_dir(dir)40 write_module.set_output_dir(output_path)41 write_module.create_module_rst(name, sub_path) 42 43 44if __name__ == '__main__':
...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!