/usr/share/pybik/tests/loadmodels.py is in pybik 2.1-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright © 2015 B. Clausius <barcc@gmx.de>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
def lines():
template_1 = '''
Fields:
solved = [True]
type = ['Cube']
sizes = [(3, 3, 3)]
selection_mode = ['quadrant', 'simple']
mirror_faces = [False, True]
Conditions:
Limits:
Initial:
State: solved=True, type='Cube', sizes=(3, 3, 3), selection_mode='simple', mirror_faces=False
Transition: set_settings_draw 'selection_nick', 'quadrant'
State:
selection_mode='quadrant'
Transition: set_settings_draw 'selection_nick', 'simple'
State:
selection_mode='simple'
Transition: set_settings_draw 'mirror_faces', False
State:
mirror_faces=False
Transition: set_settings_draw 'mirror_faces', True
State:
mirror_faces=True
Transition: direct_selectmodel 'Cube', (3,)
'''.strip()
template_2 = '''
direct_selectmodel {!r}, {!r}
'''.strip('\n')
template_3 = '''
State: solved=True, type='Cube', sizes=(3, 3, 3)
solved=True, type='Cube', sizes=(3, 3, 3)
'''.strip('\n')
template_4 = '''
type={!r}, sizes={!r}
'''.strip('\n')
from pybiklib.model import Model
Model.load_index()
tslist = []
for mtype, sizesdict in Model.cache_index['sizes'].items():
for normsizes, (internsizes, unused_file) in sizesdict.items():
tslist.append((mtype, normsizes, internsizes))
import random
#tslist.sort()
random.shuffle(tslist)
tslist.append(('Cube', (3,), (3, 3, 3)))
yield from template_1.splitlines()
for mtype, normsizes, internsizes in tslist:
yield from template_2.format(mtype, normsizes).splitlines()
yield from template_3.splitlines()
for mtype, normsizes, internsizes in tslist:
yield from template_4.format(mtype, internsizes).splitlines()
def main():
import sys
sys.path.insert(0, '.')
for line in lines():
print(line)
if __name__ == '__main__':
main()
|