def run(): import sys from spil.libs.util.log import setLevel, DEBUG, INFO print('') print('Tests start') print('') setLevel(INFO) # setLevel(DEBUG) # In case of problems, use DEBUG mode print('*' * 60) test_paths = [] # tests = [r'Z:\Projects\Vic_Movie\Prod'] # if not input('Create if not existing ?'): # sys.exit() from spil.conf.sid_conf import test_sids as tests test_sids = [] for test in tests: sid = Sid(test) print('Sid : {}'.format(sid)) # We fill defaults, and strip sid.set_defaults() print('Sid with defaults: {}'.format(sid)) sid = sid.get_stripped() print('Sid stripped: {}'.format(sid)) path = sid.path if path: test_paths.append(path) print('Appended : {}'.format(path)) print('') for path in test_paths: path = Path(path) print(path) if not path.exists(): if is_filename(path): print(path, 'is a file') if not path.parent.exists(): os.makedirs(str(path.parent)) path.touch() else: print(path, 'is a dir') os.makedirs(str(path)) print('Created test paths : ') pprint(test_paths)
def run(): from spil.libs.util.log import setLevel, DEBUG, INFO, warn setLevel(INFO) # setLevel(DEBUG) # In case of problems, use DEBUG mode print('') print('Tests start - Please init files for this to work') print('') from spil.conf.sid_conf import test_sids asset_sid = test_sids[0] sid = Sid(asset_sid) print(sid) print('') print('Get all characters (children of cat)') for asset in FS.get_children(sid.get_as('cat')): print(asset) print('') print('Get all tasks (children of asset name)') for asset in FS.get_children(sid.get_as('name')): print(asset) print('') print('Get by search sid : all tasks') search_sid = sid.get_with(name='*', task='*', cat='*').get_as('task') for asset in FS.get(search_sid): print(asset) print('') print('Get by search sid : all tasks for the given asset') search_sid = sid.get_with(task='*', cat='*').get_as('task') for asset in FS.get(search_sid): print(asset) print('') print('Get by search sid : all assets of cat "fx" in project demo') search_sid = Sid('demo/a/fx/*') for asset in FS.get(search_sid): print(asset) print('') print('Get by search sid : all "shots" in project demo') search_sid = Sid('demo/s/*/*') for sid in FS.get(search_sid): print(sid) print('') print('Get by search sid : all "seq" in project demo') search_sid = Sid('demo/s/*') for sid in FS.get(search_sid): print(sid) print('')
warn('test ' + str(retour)) assert (test == retour) info('') info('*' * 30) info('') if __name__ == '__main__': info('') info('*' * 30) info('') from spil.libs.util.log import setLevel, DEBUG, INFO, info, warn setLevel(INFO) setLevel(DEBUG) # In case of problems, use DEBUG mode info('') info('Tests start') info('') # by paths from spil.conf.fs_conf import test_paths as tests #by_path(tests) # by sids from spil.conf.sid_conf import test_sids as tests by_sids(tests)
if __name__ == '__main__': """ This tests Sid -> File This tests gets the test_sids, generates paths and back to sids again. """ from spil.libs.util.log import setLevel, DEBUG, INFO, info info('') info('Tests start') info('') setLevel(INFO) # setLevel(DEBUG) # In case of problems, use DEBUG mode from spil.conf.sid_conf import test_sids as tests for test in tests: info('Testing : {}'.format(test)) info('') sid = Sid(test) if not sid: info('Sid not correct, skipping : {}'.format(test)) continue if sid.sidtype() in ['shot_version',
This file is part of SPIL, The Simple Pipeline Lib. (C) copyright 2019 Michael Haussmann, [email protected] SPIL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. SPIL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SPIL. If not, see <https://www.gnu.org/licenses/>. """ from spil.libs.util.log import debug, warn, info from spil.libs.util import log log.setLevel(log.INFO) def compare_by_template(a, b, template=None): """ Compares a and b as strings, first for equality, than using the template list. The one that comes first in the list is smaller. If no template list is given, or no match is achieved, string comparision is returned. Note that per default string comparision is case sensitive. If a == b, returns 0 If a > b, returns 1 If a < b, returns -1 Examples:
def run(): from spil.libs.util.log import setLevel, DEBUG, INFO, warn setLevel(INFO) # setLevel(DEBUG) # In case of problems, use DEBUG mode print('') print('Tests start') print('') from spil.conf.sid_conf import test_sids asset_sid = test_sids[0] sid = Sid(asset_sid) print(sid) print('Acess to "values"') if sid.is_asset: print(sid.get('cat')) print(sid.get('name')) elif sid.is_shot: print(sid.get('seq')) print(sid.get('shot')) print(sid.get('version')) print(sid.get('task')) print(sid.path) print('') print('Changing the Sid') print(sid.get_as('task')) print(sid.get_as('task').parent()) print(sid.get_with('task', 'surfacing')) print(sid.get_with(task='setup', state='w')) print('') print('Utilities') print(sid.get_as('subtask').parent().last_key()) # 'task' # sid until name does not have a task print(sid.get_as('name').has_a('task')) print(len(sid)) # the number of valid values print(len(sid.get_as('task'))) print('') print('Iterating over keys - always all the keys') for key in sid.keys: print('\t' + key) print('') print('Iterate over values - only valid (or optional) values') for value in sid.get_as('task'): print('\t' + value) print('') print('Types & dict') print(sid.sidtype()) print(sid.basetype()) print(sid.endtype()) print(sid.asdict()) print('')