コード例 #1
0
ファイル: jihthex.py プロジェクト: Patricivs/ytenx
def syncDzih():
  
  def sync_dzih(line, num):
    dzih = Dzih(
      dzih = line[0]
    )
    dzih.save()
    dzih_map[dzih.dzih] = dzih  
    
  def sync_kruan(line, num):
    dzih = dzih_map[line[0]]
    for c in line[1]:
      dzih.dzyen_tongx.add(c)
    for c in line[2]:
      dzih.krau_dep.add(c)
    for c in line[3]:
      dzih.krenx.add(c)
    for c in line[4]:
      dzih.byan.add(c)
    dzih.save()
  
  print 'Dzih...'
  traverse(basePath + 'JihThex.csv', sync_dzih, separator=',')
  print 'Done'
  print 'DzihKruan...'
  traverse(basePath + 'JihThex.csv', sync_kruan, separator=',')
  print 'Done'
コード例 #2
0
ファイル: kyonh.py プロジェクト: weiling103/ytenx
def syncYonhMux():
    print 'YonhMux...'

    def sync(line, num):
        ho = line[3] == u'開'
        tshyuk = line[4] == u'促'
        yonh = YonhMux(
            mjeng=line[0],
            gheh=ghehMap[line[1]],
            tongx=line[2],
            ho=ho,
            tshyuk=tshyuk,
            ngix=yonhMuxNgixQimMap[line[0]],
            preng=yonhMuxPrengQimMap[line[0]],
        )
        yonh.save()
        yonhMuxMap[line[0]] = yonh

    def syncTuaih(line, num):
        tuaih = line[5]
        if tuaih == '': return
        yonh = yonhMuxMap[line[0]]
        tuaih = yonhMuxMap[tuaih]
        yonh.tuaih = tuaih
        yonh.save()

    traverse(base_path + 'YonhMux.txt', sync)
    traverse(base_path + 'YonhMux.txt', syncTuaih)
    print 'Done'
コード例 #3
0
def syncPyanxTshet():
  print 'PyanxTshet...'
  
  def sync(line, num):
    tshet = line[5]
    if not tshet: return
    dciangxDzih = DciangxDzih(
      dzih = tshet[0],
    )
    dciangxDzih.save()
    pyanxTshetDciangxDzihMap[dciangxDzih.dzih] = dciangxDzih
    
    ghraxDzih = GhraxDzih(
      dzih = tshet[1],
    )
    ghraxDzih.save()
    pyanxTshetGhraxDzihMap[ghraxDzih.dzih] = ghraxDzih
    
    dzih = PyanxTshet(
      tshet = tshet,
      dciangx = dciangxDzih,
      ghrax = ghraxDzih,
    )
    dzih.save()
    pyanxTshetMap[tshet] = dzih
  
  traverse(base_path + 'SieuxYonh.txt', sync)
  print 'Done'
コード例 #4
0
ファイル: kyonh.py プロジェクト: weiling103/ytenx
def syncSieuxYonh():
    print 'SieuxYonh...'

    def sync(line, num):
        if line[5] != '':
            pyanx = pyanxTshetMap[line[5]]
        else:
            pyanx = None
        sieux = SieuxYonh(
            ziox=line[0],
            taj=line[1],
            cjeng=cjengMuxMap[line[2]],
            yonh=yonhMuxMap[line[3]],
            yonhMiuk=yonhMiukMap[line[4]],
            pyanx=pyanx,
            ngix=ngixQimMap[line[0]],
            preng=prengQimMap[line[0]],
            dauh=dauhMap[line[0]],
        )
        sieux.cio.clear()
        for cio in line[6].split('/'):
            sieux.cio.add(cioMap[cio])
        sieux.save()
        sieuxYonhMap[line[0]] = sieux

    traverse(base_path + 'SieuxYonh.txt', sync)
    print 'Done'
コード例 #5
0
def syncDzih():
    print 'Dzih...'

    def sync(line, num):
        sieux_ziox = line[0]
        dzih = line[1]

        id = dzih
        i = 1
        while dzih_map.has_key(id):
            i += 1
            id = dzih + str(i)

        dzih = Dzih(
            ziox=num + 1,
            id=id,
            sieux_yonh=sieux_yonh[sieux_ziox],
            dzih=dzih,
            tryoh=line[3],
        )

        identifier = '1_' + line[2]
        dzih.cio.add(cio_map[identifier])

        dzih.save()
        dzih_map[dzih.id] = dzih_map

    traverse(base_path + 'Dzih.txt', sync)
    print 'Done'
コード例 #6
0
ファイル: kyonh.py プロジェクト: weiling103/ytenx
def syncDzih():
    print 'Dzih...'

    def sync(line, num):
        global last_dzih
        global last_ngieh
        current_dzih = u''
        current_ngieh = u''
        try:
            current_dzih = line[0]
            current_ngieh = sub(gloss_fallback_pattern,
                                ur'\1(' + last_dzih + u'‧' + last_ngieh + u')',
                                line[3], 1)
            dzih = Dzih(
                ziox=num + 1,
                dzih=current_dzih,
                sieuxYonh=sieuxYonhMap[line[1]],
                yih=line[2],
                ngieh=current_ngieh,
            )
            dzih.save()
        except:
            print line
        last_dzih = current_dzih
        last_ngieh = current_ngieh

    traverse(base_path + 'Dzih.txt', sync)
    print 'Done'
コード例 #7
0
ファイル: kyonh.py プロジェクト: BYVoid/ytenx
def syncSieuxYonh():
  print 'SieuxYonh...'
  def sync(line, num):
    if line[5] != '':
      pyanx = pyanxTshetMap[line[5]]
    else:
      pyanx = None
    sieux = SieuxYonh(
      ziox = line[0],
      taj = line[1],
      cjeng = cjengMuxMap[line[2]],
      yonh = yonhMuxMap[line[3]],
      yonhMiuk = yonhMiukMap[line[4]],
      pyanx = pyanx,
      ngix = ngixQimMap[line[0]],
      preng = prengQimMap[line[0]],
      dauh = dauhMap[line[0]],
    )
    sieux.cio.clear()
    for cio in line[6].split('/'):
      sieux.cio.add(cioMap[cio])
    sieux.save()
    sieuxYonhMap[line[0]] = sieux
  
  traverse(base_path + 'SieuxYonh.txt', sync)
  print 'Done'
コード例 #8
0
ファイル: kyonh.py プロジェクト: BYVoid/ytenx
def syncDzih():
  print 'Dzih...'
  def sync(line, num):
    global last_dzih
    global last_ngieh
    current_dzih = u''
    current_ngieh = u''
    try:
      current_dzih = line[0]
      current_ngieh = sub(gloss_fallback_pattern, ur'\1(' + last_dzih + u'‧' + last_ngieh + u')' , line[3], 1)
      dzih = Dzih(
        ziox = num + 1,
        dzih = current_dzih,
        sieuxYonh = sieuxYonhMap[line[1]],
        yih = line[2],
        ngieh = current_ngieh,
      )
      dzih.save()
    except:
      print line
    last_dzih = current_dzih
    last_ngieh = current_ngieh
  
  traverse(base_path + 'Dzih.txt', sync)
  print 'Done'
コード例 #9
0
def syncYonhMux():
    print 'YonhMux...'

    def sync(line, num):
        mjeng = line[0]
        box = mjeng[0:2]
        ho = mjeng[2]

        if ho == u'開':
            ho = 1
        elif ho == u'合':
            ho = 2
        elif ho == u'齊':
            ho = 3
        elif ho == u'撮':
            ho = 4
        else:
            assert (False)

        yonh_box = YonhBox(mjeng=box, )
        yonh_box.save()

        ngix = yonh_mux_ngix_qim['y' + mjeng]

        yonh = YonhMux(
            mjeng=mjeng,
            yonh_box=yonh_box,
            ho=ho,
            ngix=ngix,
        )
        yonh_mux[mjeng] = yonh
        yonh.save()

    traverse(base_path + 'YonhMux.txt', sync)
    print 'Done'
コード例 #10
0
ファイル: trngyan.py プロジェクト: BYVoid/ytenx
def syncDzih():
  print 'Dzih...'
  
  def sync(line, num):
    sieux_ziox = line[0]
    dzih = line[1]
    
    id = dzih
    i = 1
    while dzih_map.has_key(id):
      i += 1
      id = dzih + str(i)
    
    dzih = Dzih(
      ziox = num + 1,
      id = id,
      sieux_yonh = sieux_yonh[sieux_ziox],
      dzih = dzih,
      tryoh = line[3],
    )
    
    identifier = '1_' + line[2]
    dzih.cio.add(cio_map[identifier])
    
    dzih.save()
    dzih_map[dzih.id] = dzih_map
  
  traverse(base_path + 'Dzih.txt', sync)
  print 'Done'
コード例 #11
0
ファイル: kyonh.py プロジェクト: BYVoid/ytenx
def syncYonhMux():
  print 'YonhMux...'
  
  def sync(line, num):
    ho = line[3] == u'開'
    tshyuk = line[4] == u'促'
    yonh = YonhMux(
      mjeng = line[0],
      gheh = ghehMap[line[1]],
      tongx = line[2],
      ho = ho,
      tshyuk = tshyuk,
      ngix = yonhMuxNgixQimMap[line[0]],
      preng = yonhMuxPrengQimMap[line[0]],
    )
    yonh.save()
    yonhMuxMap[line[0]] = yonh

  def syncTuaih(line, num):
    tuaih = line[5]
    if tuaih == '': return
    yonh = yonhMuxMap[line[0]]
    tuaih = yonhMuxMap[tuaih]
    yonh.tuaih = tuaih
    yonh.save()

  traverse(base_path + 'YonhMux.txt', sync)
  traverse(base_path + 'YonhMux.txt', syncTuaih)
  print 'Done'
コード例 #12
0
ファイル: kyonh.py プロジェクト: BYVoid/ytenx
def syncPyanxTshet():
  print 'PyanxTshet...'
  
  def sync(line, num):
    tshet = line[5]
    if not tshet: return
    dciangxDzih = DciangxDzih(
      dzih = tshet[0],
    )
    dciangxDzih.save()
    pyanxTshetDciangxDzihMap[dciangxDzih.dzih] = dciangxDzih
    
    ghraxDzih = GhraxDzih(
      dzih = tshet[1],
    )
    ghraxDzih.save()
    pyanxTshetGhraxDzihMap[ghraxDzih.dzih] = ghraxDzih
    
    dzih = PyanxTshet(
      tshet = tshet,
      dciangx = dciangxDzih,
      ghrax = ghraxDzih,
    )
    dzih.save()
    pyanxTshetMap[tshet] = dzih
  
  traverse(base_path + 'SieuxYonh.txt', sync)
  print 'Done'
コード例 #13
0
ファイル: kyonh.py プロジェクト: weiling103/ytenx
def syncYonhMiukDzip():
    print 'YonhMiukDzip...'

    def sync(line, num):
        dzip = YonhMiukDzip()
        if line[0]: dzip.bieng = yonhMiukMap[line[0]]
        if line[1]: dzip.dciangx = yonhMiukMap[line[1]]
        if line[2]: dzip.khioh = yonhMiukMap[line[2]]
        if line[3]: dzip.njip = yonhMiukMap[line[3]]
        dzip.save()

    traverse(base_path + 'YonhMiukDzip.txt', sync)
    print 'Done'
コード例 #14
0
ファイル: kyonh.py プロジェクト: BYVoid/ytenx
def syncYonhMiukDzip():
  print 'YonhMiukDzip...'
  
  def sync(line, num):
    dzip = YonhMiukDzip()
    if line[0]: dzip.bieng = yonhMiukMap[line[0]]
    if line[1]: dzip.dciangx = yonhMiukMap[line[1]]
    if line[2]: dzip.khioh = yonhMiukMap[line[2]]
    if line[3]: dzip.njip = yonhMiukMap[line[3]]
    dzip.save()
  
  traverse(base_path + 'YonhMiukDzip.txt', sync)
  print 'Done'
コード例 #15
0
ファイル: kyonh.py プロジェクト: BYVoid/ytenx
def syncDauh():
  print 'Dauh...'
  
  def sync(line, num):
    dauh = PrengQim(
      identifier = 'dauh' + line[0],
      tcengh = line[1],
      putonghua = line[2],
    )
    dauh.save()
    dauhMap[line[0]] = dauh
  
  traverse(base_path + 'Dauh.txt', sync)
  print 'Done'
コード例 #16
0
ファイル: kyonh.py プロジェクト: weiling103/ytenx
def syncKuangxYonhMiukTshiih():
    print 'KuangxYonhMiukTshiih...'

    def sync(line, num):
        tshiih = KuangxYonhMiukTshiih(
            dzih=line[0],
            kyenh=line[1],
            tshiih=line[2],
        )
        tshiih.save()
        kuangxYonhMiukTshiihMap[line[0]] = tshiih

    traverse(base_path + 'KuangxYonhMiukTshiih.txt', sync)
    print 'Done'
コード例 #17
0
ファイル: kyonh.py プロジェクト: alvinchenghuiwu/ytenx
def syncCjengMuxPrengQim():
  print 'CjengMuxPrengQim...'
  
  def sync(line, num):
    preng = PrengQim(
      identifier = 'cjeng' + line[0],
      polyhedron = line[1],
      thuaiDauh = line[2],
    )
    preng.save()
    cjengMuxPrengQimMap[line[0]] = preng
  
  traverse(base_path + 'CjengMuxPrengQim.txt', sync)
  print 'Done'
コード例 #18
0
def syncCjengMuxPrengQim():
  print 'CjengMuxPrengQim...'
  
  def sync(line, num):
    preng = PrengQim(
      identifier = 'cjeng' + line[0],
      polyhedron = line[1],
      thuaiDauh = line[2],
    )
    preng.save()
    cjengMuxPrengQimMap[line[0]] = preng
  
  traverse(base_path + 'CjengMuxPrengQim.txt', sync)
  print 'Done'
コード例 #19
0
ファイル: kyonh.py プロジェクト: BYVoid/ytenx
def syncKuangxYonhMiukTshiih():
  print 'KuangxYonhMiukTshiih...'
  
  def sync(line, num):
    tshiih = KuangxYonhMiukTshiih(
      dzih = line[0],
      kyenh = line[1],
      tshiih = line[2],
    )
    tshiih.save()
    kuangxYonhMiukTshiihMap[line[0]] = tshiih
  
  traverse(base_path + 'KuangxYonhMiukTshiih.txt', sync)
  print 'Done'
コード例 #20
0
ファイル: kyonh.py プロジェクト: weiling103/ytenx
def syncDauh():
    print 'Dauh...'

    def sync(line, num):
        dauh = PrengQim(
            identifier='dauh' + line[0],
            tcengh=line[1],
            putonghua=line[2],
        )
        dauh.save()
        dauhMap[line[0]] = dauh

    traverse(base_path + 'Dauh.txt', sync)
    print 'Done'
コード例 #21
0
def syncYonhMuxNgixQim():
    print 'YonhMuxNgixQim...'

    def sync(line, num):
        mjeng = line[0]
        identifier = 'y' + mjeng
        ngix = NgixQim(
            identifier=identifier,
            neng_keh_piuk=line[1],
        )
        ngix.save()
        yonh_mux_ngix_qim[identifier] = ngix

    traverse(base_path + 'YonhMuxNgixQim.txt', sync)
    print 'Done'
コード例 #22
0
ファイル: trngyan.py プロジェクト: BYVoid/ytenx
def syncCjengMuxNgixQim():
  print 'CjengMuxNgixQim...'
  
  def sync(line, num):
    dzih = line[0]
    identifier = 'c' + dzih
    ngix = NgixQim(
      identifier = identifier,
      neng_keh_piuk = line[1],
    )
    ngix.save()
    cjeng_mux_ngix_qim[identifier] = ngix
  
  traverse(base_path + 'CjengMuxNgixQim.txt', sync)
  print 'Done'
コード例 #23
0
def syncCjengMuxNgixQim():
    print 'CjengMuxNgixQim...'

    def sync(line, num):
        dzih = line[0]
        identifier = 'c' + dzih
        ngix = NgixQim(
            identifier=identifier,
            neng_keh_piuk=line[1],
        )
        ngix.save()
        cjeng_mux_ngix_qim[identifier] = ngix

    traverse(base_path + 'CjengMuxNgixQim.txt', sync)
    print 'Done'
コード例 #24
0
ファイル: trngyan.py プロジェクト: BYVoid/ytenx
def syncYonhMuxNgixQim():
  print 'YonhMuxNgixQim...'
  
  def sync(line, num):
    mjeng = line[0]
    identifier = 'y' + mjeng
    ngix = NgixQim(
      identifier = identifier,
      neng_keh_piuk = line[1],
    )
    ngix.save()
    yonh_mux_ngix_qim[identifier] = ngix
  
  traverse(base_path + 'YonhMuxNgixQim.txt', sync)
  print 'Done'
コード例 #25
0
ファイル: kyonh.py プロジェクト: BYVoid/ytenx
def syncYonhMuxPrengQim():
  print 'YonhMuxPrengQim...'
  
  def sync(line, num):
    preng = PrengQim(
      identifier = 'yonh' + line[0],
      baxter = line[1],
      polyhedron = line[2],
      tcengh = line[3],
      putonghua = line[4],
    )
    preng.save()
    yonhMuxPrengQimMap[line[0]] = preng
  
  traverse(base_path + 'YonhMuxPrengQim.txt', sync)
  print 'Done'
コード例 #26
0
ファイル: kyonh.py プロジェクト: BYVoid/ytenx
def syncPrengQim():
  print 'PrengQim...'
  
  def sync(line, num):
    id = line[0]
    preng = PrengQim(
      identifier = id,
      polyhedron = line[1],
      hiovNivv = line[2],
      baxter = line[3],
    )
    preng.save()
    prengQimMap[id] = preng
  
  traverse(base_path + 'PrengQim.txt', sync)
  print 'Done'
コード例 #27
0
ファイル: kyonh.py プロジェクト: weiling103/ytenx
def syncYonhGheh():
    print 'YonhGheh...'

    def sync(line, num):
        cjep = YonhCjep(dzih=line[1], )
        cjep.save()

        gheh = YonhGheh(
            dzih=line[0],
            cjep=cjep,
        )
        gheh.save()
        ghehMap[line[0]] = gheh

    traverse(base_path + 'YonhGheh.txt', sync)
    print 'Done'
コード例 #28
0
ファイル: kyonh.py プロジェクト: weiling103/ytenx
def syncYonhMuxPrengQim():
    print 'YonhMuxPrengQim...'

    def sync(line, num):
        preng = PrengQim(
            identifier='yonh' + line[0],
            baxter=line[1],
            polyhedron=line[2],
            tcengh=line[3],
            putonghua=line[4],
        )
        preng.save()
        yonhMuxPrengQimMap[line[0]] = preng

    traverse(base_path + 'YonhMuxPrengQim.txt', sync)
    print 'Done'
コード例 #29
0
ファイル: kyonh.py プロジェクト: weiling103/ytenx
def syncPrengQim():
    print 'PrengQim...'

    def sync(line, num):
        id = line[0]
        preng = PrengQim(
            identifier=id,
            polyhedron=line[1],
            hiovNivv=line[2],
            baxter=line[3],
        )
        preng.save()
        prengQimMap[id] = preng

    traverse(base_path + 'PrengQim.txt', sync)
    print 'Done'
コード例 #30
0
ファイル: kyonh.py プロジェクト: BYVoid/ytenx
def syncDrakDzuonDang():
  print 'DrakDzuonDang...'
  
  def sync(line, num):
    id = line[0] + '_' + line[1]
    drak = DrakDzuonDang(
      identifier = id,
      kyenh = line[0],
      jep = line[1],
      myon = '',
    )
    if len(line) == 3:
      drak.myon = line[2]
    drak.save()
    drakDzuonDangMap[id] = drak
  
  traverse(base_path + 'DrakDzuonDang.txt', sync)
  print 'Done'
コード例 #31
0
ファイル: kyonh.py プロジェクト: BYVoid/ytenx
def syncYonhGheh():
  print 'YonhGheh...'
  
  def sync(line, num):
    cjep = YonhCjep(
      dzih = line[1],
    )
    cjep.save()
  
    gheh = YonhGheh(
      dzih = line[0],
      cjep = cjep,
    )
    gheh.save()
    ghehMap[line[0]] = gheh
    
  traverse(base_path + 'YonhGheh.txt', sync)
  print 'Done'
コード例 #32
0
def syncDzih():
  print 'Dzih...'
  
  def sync(line, num):
    try:
      dzih = Dzih(
        ziox = num + 1,
        dzih = line[0],
        sieuxYonh = sieuxYonhMap[line[1]],
        yih = line[2],
        ngieh = line[3],
      )
      dzih.save()
    except:
      print line
  
  traverse(base_path + 'Dzih.txt', sync)
  print 'Done'
コード例 #33
0
ファイル: kyonh.py プロジェクト: weiling103/ytenx
def syncDrakDzuonDang():
    print 'DrakDzuonDang...'

    def sync(line, num):
        id = line[0] + '_' + line[1]
        drak = DrakDzuonDang(
            identifier=id,
            kyenh=line[0],
            jep=line[1],
            myon='',
        )
        if len(line) == 3:
            drak.myon = line[2]
        drak.save()
        drakDzuonDangMap[id] = drak

    traverse(base_path + 'DrakDzuonDang.txt', sync)
    print 'Done'
コード例 #34
0
ファイル: kyonh.py プロジェクト: alvinchenghuiwu/ytenx
def syncDzih():
  print 'Dzih...'
  
  def sync(line, num):
    try:
      dzih = Dzih(
        ziox = num + 1,
        dzih = line[0],
        sieuxYonh = sieuxYonhMap[line[1]],
        yih = line[2],
        ngieh = line[3],
      )
      dzih.save()
    except:
      print line
  
  traverse(base_path + 'Dzih.txt', sync)
  print 'Done'
コード例 #35
0
ファイル: kyonh.py プロジェクト: alvinchenghuiwu/ytenx
def syncCjengMux():
  print 'CjengMux...'
  
  def sync(line, num):
    lyih = CjengLyih(
      mjeng = line[1]
    )
    lyih.save()
    cjeng = CjengMux(
      dzih = line[0],
      lyih = lyih,
      ngix = cjengMuxNgixQimMap[line[0]],
      preng = cjengMuxPrengQimMap[line[0]],
    )
    cjeng.save()
    cjengMuxMap[line[0]] = cjeng
  
  traverse(base_path + 'CjengMux.txt', sync)
  print 'Done'
コード例 #36
0
def syncCjengMux():
  print 'CjengMux...'
  
  def sync(line, num):
    lyih = CjengLyih(
      mjeng = line[1]
    )
    lyih.save()
    cjeng = CjengMux(
      dzih = line[0],
      lyih = lyih,
      ngix = cjengMuxNgixQimMap[line[0]],
      preng = cjengMuxPrengQimMap[line[0]],
    )
    cjeng.save()
    cjengMuxMap[line[0]] = cjeng
  
  traverse(base_path + 'CjengMux.txt', sync)
  print 'Done'
コード例 #37
0
ファイル: kyonh.py プロジェクト: weiling103/ytenx
def syncYonhMuxNgixQim():
    print 'YonhMuxNgixQim...'

    def sync(line, num):
        ngix = NgixQim(
            identifier='yonh' + line[0],
            kauPuonxHanh=line[1],
            yangLik=line[2],
            lixYeng=line[3],
            dcjeuhYengPhyon=line[4],
            drienghTriangDciangPyang=line[5],
            phuanNgohYon=line[6],
            boLipPuonx=line[7],
        )
        ngix.save()
        yonhMuxNgixQimMap[line[0]] = ngix

    traverse(base_path + 'YonhMuxNgixQim.txt', sync)
    print 'Done'
コード例 #38
0
ファイル: kyonh.py プロジェクト: BYVoid/ytenx
def syncYonhMuxNgixQim():
  print 'YonhMuxNgixQim...'
  
  def sync(line, num):
    ngix = NgixQim(
      identifier = 'yonh' + line[0],
      kauPuonxHanh = line[1],
      yangLik = line[2],
      lixYeng = line[3],
      dcjeuhYengPhyon = line[4],
      drienghTriangDciangPyang = line[5],
      phuanNgohYon = line[6],
      boLipPuonx = line[7],
    )
    ngix.save()
    yonhMuxNgixQimMap[line[0]] = ngix
  
  traverse(base_path + 'YonhMuxNgixQim.txt', sync)
  print 'Done'
コード例 #39
0
def syncCjengMux():
    print 'CjengMux...'

    def sync(line, num):
        lyih = CjengLyih(mjeng=line[0])
        lyih.save()

        dzih = line[1]
        ngix = cjeng_mux_ngix_qim['c' + dzih]

        cjeng = CjengMux(
            dzih=dzih,
            lyih=lyih,
            ngix=ngix,
        )
        cjeng.save()
        cjeng_mux[dzih] = cjeng

    traverse(base_path + 'CjengMux.txt', sync)
    print 'Done'
コード例 #40
0
ファイル: kyonh.py プロジェクト: weiling103/ytenx
def syncNgixQim():
    print 'NgixQim...'

    def sync(line, num):
        ngix = NgixQim(identifier=line[0], )
        cjeng = cjengMuxMap[line[2]]
        yonh = yonhMuxMap[line[3]]
        for key in cjeng.ngix.keys():
            if hasattr(cjeng.ngix, key) and hasattr(yonh.ngix, key):
                cjengNgix = getattr(cjeng.ngix, key)
                yonhNgix = getattr(yonh.ngix, key)
                if cjengNgix and yonhNgix:
                    setattr(ngix, key, cjengNgix + yonhNgix)

        ngix.save()
        ngixQimMap[line[0]] = ngix

    traverse(base_path + 'SieuxYonh.txt', sync)

    print 'Done'
コード例 #41
0
ファイル: kyonh.py プロジェクト: weiling103/ytenx
def syncYonhMiuk():
    print 'YonhMiuk...'

    def sync(line, num):
        yonh = YonhMiuk(dzih=line[0],
                        gheh=ghehMap[line[1]],
                        deuh=line[2],
                        tshiih=kuangxYonhMiukTshiihMap[line[3]])
        yonh.save()

        yonh.yonh.clear()
        for key in yonhMuxMap.keys():
            yonhMux = yonhMuxMap[key]
            if yonhMux.gheh == yonh.gheh and yonhMux.tshyuk == (yonh.deuh
                                                                == 4):
                yonh.yonh.add(yonhMux)

        yonh.save()
        yonhMiukMap[line[0]] = yonh

    traverse(base_path + 'YonhMiuk.txt', sync)
    print 'Done'
コード例 #42
0
ファイル: kyonh.py プロジェクト: BYVoid/ytenx
def syncNgixQim():
  print 'NgixQim...'
  
  def sync(line, num):
    ngix = NgixQim(
      identifier = line[0],
    )
    cjeng = cjengMuxMap[line[2]]
    yonh = yonhMuxMap[line[3]]
    for key in cjeng.ngix.keys():
      if hasattr(cjeng.ngix, key) and hasattr(yonh.ngix, key):
        cjengNgix = getattr(cjeng.ngix, key)
        yonhNgix = getattr(yonh.ngix, key)
        if cjengNgix and yonhNgix:
          setattr(ngix, key, cjengNgix + yonhNgix)

    ngix.save()
    ngixQimMap[line[0]] = ngix
  
  traverse(base_path + 'SieuxYonh.txt', sync)
  
  print 'Done'
コード例 #43
0
ファイル: trngyan.py プロジェクト: BYVoid/ytenx
def syncCjengMux():
  print 'CjengMux...'
  
  def sync(line, num):
    lyih = CjengLyih(
      mjeng = line[0]
    )
    lyih.save()
    
    dzih = line[1]
    ngix = cjeng_mux_ngix_qim['c' + dzih]
    
    cjeng = CjengMux(
      dzih = dzih,
      lyih = lyih,
      ngix = ngix,
    )
    cjeng.save()
    cjeng_mux[dzih] = cjeng
  
  traverse(base_path + 'CjengMux.txt', sync)
  print 'Done'
コード例 #44
0
def syncSieuxYonh():
    print 'SieuxYonh...'

    def sync(line, num):
        deuh = line[2]
        if deuh == u'陰平':
            deuh = 1
        elif deuh == u'陽平':
            deuh = 2
        elif deuh == u'上':
            deuh = 3
        elif deuh == u'去':
            deuh = 4
        elif deuh == u'入平':
            deuh = 5
        elif deuh == u'入上':
            deuh = 6
        elif deuh == u'入去':
            deuh = 7
        else:
            assert (False)

        yonh = yonh_mux[line[5]]

        sieux = SieuxYonh(
            ziox=line[0],
            taj=line[1][0],
            cjeng=cjeng_mux[line[4]],
            yonh_box=yonh.yonh_box,
            yonh=yonh,
            deuh=deuh,
            ho=yonh.ho,
        )
        sieux.save()
        sieux_yonh[line[0]] = sieux

    traverse(base_path + 'TriungNgyanQimYonh.txt', sync)
    print 'Done'
コード例 #45
0
ファイル: kyonh.py プロジェクト: BYVoid/ytenx
def syncYonhMiuk():
  print 'YonhMiuk...'
  
  def sync(line, num):
    yonh = YonhMiuk(
      dzih = line[0],
      gheh = ghehMap[line[1]],
      deuh = line[2],
      tshiih = kuangxYonhMiukTshiihMap[line[3]]
    )
    yonh.save()
    
    yonh.yonh.clear()
    for key in yonhMuxMap.keys():
      yonhMux = yonhMuxMap[key]
      if yonhMux.gheh == yonh.gheh and yonhMux.tshyuk == (yonh.deuh == 4):
        yonh.yonh.add(yonhMux)
    
    yonh.save()
    yonhMiukMap[line[0]] = yonh
  
  traverse(base_path + 'YonhMiuk.txt', sync)
  print 'Done'
コード例 #46
0
ファイル: kyonh.py プロジェクト: BYVoid/ytenx
def syncCjengMuxNgixQim():
  print 'CjengMuxNgixQim...'
  
  def sync(line, num):
    ngix = NgixQim(
      identifier = 'cjeng' + line[0],
      kauPuonxHanh = line[1],
      lixPyangKueh = line[2],
      yangLik = line[3],
      tciuPyapKau = line[4],
      liukTcihYoi = line[5],
      tungxDungGhua = line[6],
      lixYeng = line[7],
      dcjeuhYengPhyon = line[8],
      drienghTriangDciangPyang = line[9],
      phuanNgohYon = line[10],
      boLipPuonx = line[11],
    )
    ngix.save()
    cjengMuxNgixQimMap[line[0]] = ngix
  
  traverse(base_path + 'CjengMuxNgixQim.txt', sync)
  print 'Done'
コード例 #47
0
ファイル: kyonh.py プロジェクト: weiling103/ytenx
def syncCjengMuxNgixQim():
    print 'CjengMuxNgixQim...'

    def sync(line, num):
        ngix = NgixQim(
            identifier='cjeng' + line[0],
            kauPuonxHanh=line[1],
            lixPyangKueh=line[2],
            yangLik=line[3],
            tciuPyapKau=line[4],
            liukTcihYoi=line[5],
            tungxDungGhua=line[6],
            lixYeng=line[7],
            dcjeuhYengPhyon=line[8],
            drienghTriangDciangPyang=line[9],
            phuanNgohYon=line[10],
            boLipPuonx=line[11],
        )
        ngix.save()
        cjengMuxNgixQimMap[line[0]] = ngix

    traverse(base_path + 'CjengMuxNgixQim.txt', sync)
    print 'Done'
コード例 #48
0
ファイル: trngyan.py プロジェクト: BYVoid/ytenx
def syncYonhMux():
  print 'YonhMux...'
  
  def sync(line, num):
    mjeng = line[0]
    box = mjeng[0:2]
    ho = mjeng[2]
    
    if ho == u'開':
      ho = 1
    elif ho == u'合':
      ho = 2
    elif ho == u'齊':
      ho = 3
    elif ho == u'撮':
      ho = 4
    else:
      assert(False)
    
    yonh_box = YonhBox(
      mjeng = box,
    )
    yonh_box.save()
    
    ngix = yonh_mux_ngix_qim['y' + mjeng]
    
    yonh = YonhMux(
      mjeng = mjeng,
      yonh_box = yonh_box,
      ho = ho,
      ngix = ngix,
    )
    yonh_mux[mjeng] = yonh
    yonh.save()

  traverse(base_path + 'YonhMux.txt', sync)
  print 'Done'
コード例 #49
0
ファイル: trngyan.py プロジェクト: BYVoid/ytenx
def syncSieuxYonh():
  print 'SieuxYonh...'
  def sync(line, num):
    deuh = line[2]
    if deuh == u'陰平':
      deuh = 1
    elif deuh == u'陽平':
      deuh = 2
    elif deuh == u'上':
      deuh = 3
    elif deuh == u'去':
      deuh = 4
    elif deuh == u'入平':
      deuh = 5
    elif deuh == u'入上':
      deuh = 6
    elif deuh == u'入去':
      deuh = 7
    else:
      assert(False)

    yonh = yonh_mux[line[5]]
    
    sieux = SieuxYonh(
      ziox = line[0],
      taj = line[1][0],
      cjeng = cjeng_mux[line[4]],
      yonh_box = yonh.yonh_box,
      yonh = yonh,
      deuh = deuh,
      ho = yonh.ho,
    )
    sieux.save()
    sieux_yonh[line[0]] = sieux
  
  traverse(base_path + 'TriungNgyanQimYonh.txt', sync)
  print 'Done'
コード例 #50
0
ファイル: jihthex.py プロジェクト: alantian/kanshi
def syncDzih():
    def sync_dzih(line, num):
        dzih = Dzih(dzih=line[0])
        dzih.save()
        dzih_map[dzih.dzih] = dzih

    def sync_kruan(line, num):
        dzih = dzih_map[line[0]]
        for c in line[1]:
            dzih.dzyen_tongx.add(c)
        for c in line[2]:
            dzih.krau_dep.add(c)
        for c in line[3]:
            dzih.krenx.add(c)
        for c in line[4]:
            dzih.byan.add(c)
        dzih.save()

    print 'Dzih...'
    traverse(basePath + 'JihThex.csv', sync_dzih, separator=',')
    print 'Done'
    print 'DzihKruan...'
    traverse(basePath + 'JihThex.csv', sync_kruan, separator=',')
    print 'Done'
コード例 #51
0
ファイル: dciangx.py プロジェクト: alvinchenghuiwu/ytenx
def syncDzih():
  print 'Dzih...'
  
  def sync(line, num):
    global last_dzih, mt
    dzih = line[0]
    print num, dzih
    pyanx = line[7] + line[8]
    cjeng = line[9]
    yonh = line[10]
    yonh_seh = line[11]
    if yonh_seh == '':
      yonh_seh = 0
    
    if cjeng_map.has_key(cjeng):
      cjeng = cjeng_map[cjeng]
    else:
      cjeng = CjengByo(mjeng=cjeng)
      cjeng.save()
      cjeng_map[cjeng.mjeng] = cjeng
    
    if yonh_map.has_key(yonh):
      yonh = yonh_map[yonh]
    else:
      yonh = YonhBox(mjeng=yonh)
      yonh.save()
      yonh_map[yonh.mjeng] = yonh
    
    id = dzih
    i = 1
    while dzih_map.has_key(id):
      i += 1
      id = dzih + str(i)
    
    ngix_1 = line[12]
    ngix_2 = line[13]
    if len(ngix_2) == 0:
      ngix_2 = line[14]
      ngix_3 = line[15]
    else:
      ngix_3 = line[14]
      assert(len(line[15]) == 0)
    
    tshet = PyanxTshet.objects.filter(tshet = pyanx)
    sieux_yonh = None
    
    if len(tshet) == 1:
      tshet = tshet[0]
      sieuxs = SieuxYonh.objects.filter(pyanx = tshet)
      sieux_yonh = None
      for sieux in sieuxs:
        if sieux_yonh == None:
          sieux_yonh = sieux
        else:
          mt += unicode(num+2) + ' ' + dzih + ' ' + pyanx + ' ' + str(sieuxs).decode('utf-8') + '\n'
    else:
      print pyanx
      if last_dzih.ngix_1 == ngix_1 and last_dzih.ngix_2 == ngix_2 and last_dzih.ngix_3 == ngix_3:
        sieux_yonh = last_dzih.sieux_yonh
      elif pyanx in myo:
        sieux_yonh = None
      elif dzih == u'拯' or dzih == u'氶':
        sieux_yonh = SieuxYonh.objects.get(ziox = 1919)
      else:
        mt += str(num+2) + ' ' + dzih + ' ' + pyanx + '\n'
    
    dzih = Dzih(
      ziox = num + 1,
      id = id,
      dzih = dzih,
      sieux_yonh = sieux_yonh,
      cjeng = cjeng,
      yonh = yonh,
      yonh_seh = yonh_seh,
      ngix_1 = ngix_1,
      ngix_2 = ngix_2,
      ngix_3 = ngix_3,
      tryoh = line[16],
    )
    
    dzih.save()
    dzih_map[dzih.id] = dzih
    last_dzih = dzih
  
  traverse(base_path + 'DrienghTriang.txt', sync)
  f = open('mt.txt', 'w')
  f.write(mt.encode('utf-8'))
  f.close()
  print 'Done'
コード例 #52
0
ファイル: dciangx.py プロジェクト: weiling103/ytenx
def syncDzih():
    print 'Dzih...'

    def sync(line, num):
        global last_dzih, mt
        dzih = line[0]
        pyanx = line[7] + line[8]
        cjeng = line[9]
        yonh = line[10]
        yonh_seh = line[11]
        if yonh_seh == '':
            yonh_seh = 0

        if cjeng_map.has_key(cjeng):
            cjeng = cjeng_map[cjeng]
        else:
            cjeng = CjengByo(mjeng=cjeng)
            cjeng.save()
            cjeng_map[cjeng.mjeng] = cjeng

        if yonh_map.has_key(yonh):
            yonh = yonh_map[yonh]
        else:
            yonh = YonhBox(mjeng=yonh)
            yonh.save()
            yonh_map[yonh.mjeng] = yonh

        id = dzih
        i = 1
        while dzih_map.has_key(id):
            i += 1
            id = dzih + str(i)

        ngix_1 = line[12]
        ngix_2 = line[13]
        if len(ngix_2) == 0:
            ngix_2 = line[14]
            ngix_3 = line[15]
        else:
            ngix_3 = line[14]
            assert (len(line[15]) == 0)

        tshet = PyanxTshet.objects.filter(tshet=pyanx)
        sieux_yonh = None

        if len(tshet) == 1:
            tshet = tshet[0]
            sieuxs = SieuxYonh.objects.filter(pyanx=tshet)
            sieux_yonh = None
            for sieux in sieuxs:
                if sieux_yonh == None:
                    sieux_yonh = sieux
                else:
                    mt += unicode(num +
                                  2) + ' ' + dzih + ' ' + pyanx + ' ' + str(
                                      sieuxs).decode('utf-8') + '\n'
        else:
            if last_dzih.ngix_1 == ngix_1 and last_dzih.ngix_2 == ngix_2 and last_dzih.ngix_3 == ngix_3:
                sieux_yonh = last_dzih.sieux_yonh
            elif pyanx in myo:
                sieux_yonh = None
            elif dzih == u'拯' or dzih == u'氶':
                sieux_yonh = SieuxYonh.objects.get(ziox=1919)
            else:
                mt += str(num + 2) + ' ' + dzih + ' ' + pyanx + '\n'

        dzih = Dzih(
            ziox=num + 1,
            id=id,
            dzih=dzih,
            sieux_yonh=sieux_yonh,
            cjeng=cjeng,
            yonh=yonh,
            yonh_seh=yonh_seh,
            ngix_1=ngix_1,
            ngix_2=ngix_2,
            ngix_3=ngix_3,
            tryoh=line[16],
        )

        dzih.save()
        dzih_map[dzih.id] = dzih
        last_dzih = dzih

    traverse(base_path + 'DrienghTriang.txt', sync)
    f = open('mt.txt', 'w')
    f.write(mt.encode('utf-8'))
    f.close()
    print 'Done'
コード例 #53
0
from common import read_data, traverse

print(traverse(*read_data()))
コード例 #54
0
from common import read_data, traverse

cities = read_data()[0]
print(max(traverse(cities, city, sort=max) for city in cities))