def create_objects(self, test_directory): """Traverses the XML structure and creates test objects Arguments: test_directory - The test directory. """ for element in self.root: if element.tag == 'maker': self.tests.append(Maker(element, test_directory)) if element.tag == 'merge': self.tests.append(Merge(element, test_directory))
def __init__(self): # The actual workers self.maker = Maker() self.tex = Latex(self.maker) self.maker.dep_append(self.tex) # What to do self.backend = "pdftex" self.format = "pdf" self.index_style = "" self.batch = 1 self.encoding = "latin-1" self.texpost = "" self.options = ""
def main(): print() if args.image: print('1. Read image sheet') print('Path : ' + args.image) elif args.text: print('1. Read text sheet') print('Path : ' + args.text) sheet_parser = Parser(args.text) else: print('Needs input') exit(1) print() print('2. Parse sheet') try: sheet = sheet_parser.parse() except SheetParserError as err: expression, message = err.args print() print('!! Sheet Parser Error !!') print(expression) print(message) print() exit(1) else: print('parse success') print('Print sheet...') print(sheet) print() print('3. Load videos') print() print('4. Generate music video.') music = Maker(sheet, args.output) music.make() print()
}) elif ds_name == 'three_fruits': paths = easydict.EasyDict({ 'datasetFile': os.path.join(dirs_suffix, 'datasets', 'three_fruits'), 'textDir': 'text_c10', 'maxEpochs': '1000' }) maker = Maker(datasetFile=paths.datasetFile, textDir=paths.textDir, checking_folder=checking_folder, lang=lang, client_txt=desc, pre_trained_gen=os.path.join( dirs_suffix, 'checkpoints', ds_name + '_cls_test', 'gen_' + paths.maxEpochs + '.pth'), pre_trained_disc=os.path.join( dirs_suffix, 'checkpoints', ds_name + '_cls_test', 'disc_' + paths.maxEpochs + '.pth'), ID=ID) maker.generate() os.remove(filepath) time.sleep(0.5) print('Listening folder ' + rootdir + '...')
#!/usr/bin/env python #-*- coding:utf-8 -*- from user import User from maker import Maker from shareInt import ShareInt shareObject=ShareInt() user1=User("user1",shareObject) maker1=Maker("maker1",shareObject) user1.start() maker1.start() user1.join() maker1.join() user1.display() print "main threading over!"
from maker import Maker from winner import Winner pygame.init() pygame.display.set_caption('Dreidel Blades') screen = pygame.display.set_mode( # size=(640, 480), # size=(1280, 720), size=(1366, 768), # size=(1920, 1080), # flags=pygame.FULLSCREEN, ) maker = Maker(screen) choose = Choose(screen) clock = pygame.time.Clock() active = choose lastGameEndTime = None gameOverTime = None while True: if isinstance(active, Choose): if active.startGameWith is not None: imgPath, stats = active.startGameWith # game = Game(screen)
pairs = [{"Initsuccess": False, "pair": ' ', "maker": 0, "asset":'GDEX.BTC', "base":'CNY', "priceuplimit": 200000, "pricedownlimit": 10000, "Gaprate": 0.01, "spreadrate": 0.008, "size":4, "amount": 5000}] pairs.append ({"Initsuccess": False, "pair": ' ', "maker": 0, "asset":'GDEX.ETH', "base":'CNY', "priceuplimit": 20000, "pricedownlimit": 1000, "Gaprate": 0.01, "spreadrate": 0.008, "size":4, "amount": 5000}) pairs.append({"Initsuccess": False, "pair": ' ', "maker": 0, "asset":'GDEX.EOS', "base":'CNY', "priceuplimit": 400, "pricedownlimit": 10, "Gaprate": 0.01, "spreadrate": 0.008, "size":4, "amount": 5000}) pairs.append({"Initsuccess": False, "pair": ' ', "maker": 0, "asset":'GDEX.NEO', "base":'CNY', "priceuplimit": 4000, "pricedownlimit": 100, "Gaprate": 0.011, "spreadrate": 0.0088, "size":6, "amount": 5000}) pairs.append({"Initsuccess": False, "pair": ' ', "maker": 0, "asset":'GDEX.GAS', "base":'CNY', "priceuplimit": 1000, "pricedownlimit": 70, "Gaprate": 0.01, "spreadrate": 0.008, "size":6, "amount": 5000}) pairs.append({"Initsuccess": False, "pair": ' ', "maker": 0, "asset":'GDEX.QTUM', "base":'CNY', "priceuplimit": 1000, "pricedownlimit": 50, "Gaprate": 0.01, "spreadrate": 0.008, "size":6, "amount": 5000}) pairs.append({"Initsuccess": False, "pair": ' ', "maker": 0, "asset":'GDEX.ATN', "base":'CNY', "priceuplimit": 40, "pricedownlimit": 1, "Gaprate": 0.01, "spreadrate": 0.008, "size":4, "amount": 5000}) maker = {} for pair in pairs: pair['pair'] = pair['base']+"/"+pair['asset'] print('pleae input the middle price for ' + pair['pair'] + ':') inputprice = float(input()) pair['maker'] = Maker(globalconfig, inputprice, ex='dex', asset=pair['asset'], base=pair['base'], priceuplimit=pair['priceuplimit'], pricedownlimit=pair['pricedownlimit'], Gaprate=pair['Gaprate'], spreadrate=pair['spreadrate'], size=pair['size'], amount=pair['amount']) while True: for pair in pairs: if not pair['Initsuccess']: try: pair['Initsuccess'] = pair['maker'].InitOrderPlace() except Exception as e: print(pair['pair'] + "failed to initialize orders, error:", e) pair['Initsuccess'] = False time.sleep(5) if pair['Initsuccess']: today = datetime.now() yesterday = today + timedelta(hours=-24)
from maker import Maker, Recipe, Player, Actions if __name__ == '__main__': r = Recipe(name='Crimson Cider') r.update_fromdb() p = Player(80, 1500, 1350, 300) m = Maker(recipe=r, player=p) print(m.step, m.durability, m.progress, m.quality, m.player.cp) action_rotation = [ Actions.REFLECT, Actions.GREAT_STRIDES, Actions.INNOVATION, Actions.OBSERVE, Actions.BASIC_TOUCH, Actions.STANDARD_TOUCH, Actions.PREPARATORY_TOUCH, Actions.BYREGOTS_BLESSING, # Actions.CAREFUL_SYNTHESIS, # Actions.VENERATION, # Actions.GROUNDWORK ] print(p.available_actions()) p.check_rotation(action_rotation) for action in action_rotation: getattr(m, action.value.function)()
import numpy as np from copy import copy space = np.random.randn(4) * 0.18 + 1 print space img_all = [] label_all = [] for s in space: require = copy(RE) require[0] = [int(round(n * s)) for n in require[0]] require[1] = [int(round(n * s)) for n in require[1]] center_scale = np.random.choice(space, 1) center = (int(round(128 * center_scale)), int(round(128 * center_scale))) print center, require m = Maker(require) a = np.random.randint(360) m.generate(5, a, center=center) img = [i[None, None, None, :, :] for i in m.imgs] label = [l[None, None, None, :, :] for l in m.labels] img = np.concatenate(img, axis=0) label = np.concatenate(label, axis=0) img_all.append(img) label_all.append(label) img_all = np.concatenate(img_all, axis=1) img_all = np.transpose(img_all, (1, 0, 2, 3, 4)) label_all = np.concatenate(label_all, axis=1) label_all = np.transpose(label_all, (1, 0, 2, 3, 4))