当前位置: 首页>>代码示例>>Python>>正文


Python Configuration.data_dir方法代码示例

本文整理汇总了Python中config.Configuration.data_dir方法的典型用法代码示例。如果您正苦于以下问题:Python Configuration.data_dir方法的具体用法?Python Configuration.data_dir怎么用?Python Configuration.data_dir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在config.Configuration的用法示例。


在下文中一共展示了Configuration.data_dir方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: CHECK

# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import data_dir [as 别名]
#!/usr/bin/env python3

import os, sys

sys.path.append(os.path.join(os.path.dirname(__file__), "..", "lib"))
import romdb
from config import Configuration
from dbconnection import DBConnection

dbxmlfname = Configuration.xml_dir() + "/db_weaponobject.xml"
filedbfname = Configuration.data_dir() + "/weaponobject.db"

conn = DBConnection()
cur = conn.cursor()

fields = romdb.load_field_xml(dbxmlfname)

# construct db table
db_fields = romdb.DBFields(cur, "weapon", fields, ["eqtype", "dropability"])
db_fields.recreate_table([("guid", "sys_name", "id")])

cur.execute("DROP TABLE IF EXISTS weapon_ability")
cur.execute(
    """CREATE TABLE weapon_ability (
	guid INTEGER NOT NULL,
	ordernum INTEGER NOT NULL,
	abilityid INTEGER NOT NULL,
	CONSTRAINT weapon_ability_ordernum_range CHECK (ordernum >= 1 AND ordernum <= 6),
	CONSTRAINT weapon_ability_ability_range CHECK (abilityid / 10000 IN (51, 72)),
	PRIMARY KEY (guid, ordernum),
	FOREIGN KEY (guid) REFERENCES weapon
开发者ID:zhmu,项目名称:romdb,代码行数:33,代码来源:weapondb-import.py

示例2: CHECK

# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import data_dir [as 别名]
#!/usr/bin/env python3

import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib'))
import romdb
from config import Configuration
from dbconnection import DBConnection

dbxmlfname = Configuration.xml_dir() + "/db_armorobject.xml"
filedbfname = Configuration.data_dir() + "/armorobject.db"

conn = DBConnection()
cur = conn.cursor()

fields = romdb.load_field_xml(dbxmlfname)

# construct db table
db_fields = romdb.DBFields(cur, 'armor', fields, [ 'eqtype', 'dropability' ])
db_fields.recreate_table([ ('guid', 'sys_name', 'id') ])

cur.execute("""DROP TABLE IF EXISTS armor_ability""")
cur.execute("""CREATE TABLE armor_ability (
	guid INTEGER NOT NULL,
	ordernum INTEGER NOT NULL,
	abilityid INTEGER NOT NULL,
	CONSTRAINT armor_ability_ordernum_range CHECK (ordernum >= 1 AND ordernum <= 6),
	CONSTRAINT aror_ability_ability_range CHECK (abilityid / 10000 IN (51, 72)),
	PRIMARY KEY (guid, ordernum),
	FOREIGN KEY (guid) REFERENCES armor
)
""")
开发者ID:zhmu,项目名称:romdb,代码行数:33,代码来源:armordb-import.py

示例3: CHECK

# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import data_dir [as 别名]
#!/usr/bin/env python3

import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib'))
import romdb
from config import Configuration
from dbconnection import DBConnection

dbxmlfname = Configuration.xml_dir() + "/db_itemobject.xml"
filedbfname = Configuration.data_dir() + "/itemobject.db"

conn = DBConnection()
cur = conn.cursor()

fields = romdb.load_field_xml(dbxmlfname)

db_fields = romdb.DBFields(cur, 'item', fields, [ 'dropability' ])
db_fields.recreate_table([ ])

cur.execute('DROP TABLE IF EXISTS item_ability')
cur.execute("""CREATE TABLE item_ability (
	guid INTEGER NOT NULL,
	ordernum INTEGER NOT NULL,
	abilityid INTEGER NOT NULL,
	CONSTRAINT item_ability_ordernum_range CHECK (ordernum >= 1 AND ordernum <= 6),
	CONSTRAINT item_ability_ability_range CHECK (abilityid / 10000 IN (51, 72)),
	PRIMARY KEY (guid, ordernum),
	FOREIGN KEY (guid) REFERENCES item
)
""")
开发者ID:zhmu,项目名称:romdb,代码行数:32,代码来源:item-import.py

示例4: import_strings

# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import data_dir [as 别名]
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib'))
import romdb
from config import Configuration
from dbconnection import DBConnection

def import_strings(cur, strings, idtype, table, prefix, suffix):
	cur.execute('DROP TABLE IF EXISTS ' + table + ' CASCADE')
	cur.execute('CREATE TABLE ' + table + ' (id ' + idtype + ' PRIMARY KEY, content CITEXT NOT NULL);')
	if suffix:
		d = { k[len(prefix):-len(suffix)]:v for k, v in strings.items() if k.startswith(prefix) and k.endswith(suffix) }
	else:
		d = { k[len(prefix):]:v for k, v in strings.items() if k.startswith(prefix) }
	for k, v in d.items():
		cur.execute('INSERT INTO ' + table + ' (id, content) VALUES (%s,%s)', (k, v))

fname = Configuration.data_dir() + "/string_eneu.db"

conn = DBConnection()
cur = conn.cursor()

strings = romdb.read_stringdb(fname)

import_strings(cur, strings, 'INTEGER', 'sys_name', 'Sys', '_name')
import_strings(cur, strings, 'INTEGER', 'sys_shortnote', 'Sys', '_shortnote')
import_strings(cur, strings, 'INTEGER', 'sys_weareqtype', 'SYS_WEAREQTYPE_', '')
import_strings(cur, strings, 'INTEGER', 'sys_weapontype', 'SYS_WEAPON_TYPE', '')
import_strings(cur, strings, 'INTEGER', 'sys_weaponpos', 'SYS_WEAPON_POS', '')
import_strings(cur, strings, 'INTEGER', 'sys_armorpos', 'SYS_ARMORPOS_', '')
import_strings(cur, strings, 'INTEGER', 'sys_armortype', 'SYS_ARMORTYPE_', '')
import_strings(cur, strings, 'VARCHAR(128)', 'sys_sc', 'SC_', '')
import_strings(cur, strings, 'VARCHAR(128)', 'sys_zone', 'ZONE_', '')
开发者ID:zhmu,项目名称:romdb,代码行数:33,代码来源:stringdb-import.py

示例5: CHECK

# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import data_dir [as 别名]
#!/usr/bin/env python3

import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib'))
import romdb
from config import Configuration
from dbconnection import DBConnection

dbxmlfname = Configuration.xml_dir() + "/db_addpowerobject.xml"
filedbfname = Configuration.data_dir() + "/addpowerobject.db"

conn = DBConnection()
cur = conn.cursor()

fields = romdb.load_field_xml(dbxmlfname)

# construct db table
db_fields = romdb.DBFields(cur, 'addpower', fields, [ 'eqtype' ])
db_fields.recreate_table([ ])

cur.execute('DROP TABLE IF EXISTS addpower_weareq ')
cur.execute("""CREATE TABLE addpower_weareq (
	guid INTEGER NOT NULL,
	ordernum INTEGER NOT NULL,
	typeid INTEGER NOT NULL,
	value INTEGER NOT NULL,
	CONSTRAINT addpower_weareq_ordernum_range CHECK (ordernum >= 1 AND ordernum <= 10),
	PRIMARY KEY (guid, ordernum),
	FOREIGN KEY (guid) REFERENCES addpower,
	FOREIGN KEY (typeid) REFERENCES sys_weareqtype (id)
)
开发者ID:zhmu,项目名称:romdb,代码行数:33,代码来源:addpowerobject-import.py

示例6: CHECK

# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import data_dir [as 别名]
#!/usr/bin/env python3

import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib'))
import romdb
from config import Configuration
from dbconnection import DBConnection

dbxmlfname = Configuration.xml_dir() + "/db_itemcombine.xml"
filedbfname = Configuration.data_dir() + "/itemcombine.db"

conn = DBConnection()
cur = conn.cursor()

fields = romdb.load_field_xml(dbxmlfname)

db_fields = romdb.DBFields(cur, 'item_combine', fields, [ 'src' ])
db_fields.recreate_table([ ('dstitem', 'sys_name', 'id') ])

cur.execute('DROP TABLE IF EXISTS item_combine_src ')
cur.execute("""CREATE TABLE item_combine_src (
	guid INTEGER NOT NULL,
	ordernum INTEGER NOT NULL,
	item INTEGER NOT NULL,
	amount INTEGER NOT NULL,
	CONSTRAINT item_combine_src_ordernum_range CHECK (ordernum >= 1 AND ordernum <= 3),
	CONSTRAINT item_combine_src_amount_range CHECK (amount >= 1),
	PRIMARY KEY (guid, ordernum),
	FOREIGN KEY (guid) REFERENCES item_combine
)""")
conn.commit()
开发者ID:zhmu,项目名称:romdb,代码行数:33,代码来源:itemcombine-import.py

示例7: CHECK

# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import data_dir [as 别名]
#!/usr/bin/env python3

import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib'))
import romdb
from config import Configuration
from dbconnection import DBConnection

dbxmlfname = Configuration.xml_dir() + "/db_treasureobject.xml"
filedbfname = Configuration.data_dir() + "/treasureobject.db"

conn = DBConnection()
cur = conn.cursor()

fields = romdb.load_field_xml(dbxmlfname)
db_fields = romdb.DBFields(cur, 'treasure', fields, [ 'dropability', 'item' ])
db_fields.recreate_table([ ('guid', 'sys_name', 'id') ])

cur.execute('DROP TABLE IF EXISTS treasure_drop ')
cur.execute("""CREATE TABLE treasure_drop (
	guid INTEGER NOT NULL,
	ordernum INTEGER NOT NULL,
	item INTEGER,
	rate INTEGER NOT NULL,
	count INTEGER NOT NULL,
	CONSTRAINT treasure_drop_ordernum_range CHECK (ordernum >= 1 AND ordernum <= 100),
	PRIMARY KEY (guid, ordernum),
	FOREIGN KEY (guid) REFERENCES treasure
)
""")
conn.commit()
开发者ID:zhmu,项目名称:romdb,代码行数:33,代码来源:treasure-import.py

示例8: CHECK

# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import data_dir [as 别名]
#!/usr/bin/env python3

import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib'))
import romdb
from config import Configuration
from dbconnection import DBConnection

dbxmlfname = Configuration.xml_dir() + "/db_recipeobject.xml"
filedbfname = Configuration.data_dir() + "/recipeobject.db"

conn = DBConnection()
cur = conn.cursor()

fields = romdb.load_field_xml(dbxmlfname)

db_fields = romdb.DBFields(cur, 'recipe', fields, [ 'source' ])
db_fields.recreate_table([ ])

cur.execute('DROP TABLE IF EXISTS recipe_source ')
cur.execute("""CREATE TABLE recipe_source (
	guid INTEGER NOT NULL,
	ordernum INTEGER NOT NULL,
	source INTEGER NOT NULL,
	count INTEGER NOT NULL,
	reduce INTEGER NOT NULL,
	CONSTRAINT recipe_source_ordernum_range CHECK (ordernum >= 1 AND ordernum <= 8),
	PRIMARY KEY (guid, ordernum),
	FOREIGN KEY (guid) REFERENCES recipe
)
""")
开发者ID:zhmu,项目名称:romdb,代码行数:33,代码来源:recipe-import.py

示例9: CHECK

# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import data_dir [as 别名]
#!/usr/bin/env python3

import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib'))
import romdb
from config import Configuration
from dbconnection import DBConnection

dbxmlfname = Configuration.xml_dir() + "/db_eqrefineabilityobject.xml"
filedbfname = Configuration.data_dir() + "/eqrefineabilityobject.db"

conn = DBConnection()
cur = conn.cursor()

fields = romdb.load_field_xml(dbxmlfname)

# construct db table
db_fields = romdb.DBFields(cur, 'refine', fields, [ 'eqtype' ])
db_fields.recreate_table([ ])

cur.execute('DROP TABLE IF EXISTS refine_prop')
cur.execute("""CREATE TABLE refine_prop (
	guid INTEGER NOT NULL,
	ordernum INTEGER NOT NULL,
	typeid INTEGER NOT NULL,
	value INTEGER NOT NULL,
	CONSTRAINT refine_prop_ordernum_range CHECK (ordernum >= 1 AND ordernum <= 10),
	PRIMARY KEY (guid, ordernum),
	FOREIGN KEY (guid) REFERENCES refine,
	FOREIGN KEY (typeid) REFERENCES sys_weareqtype (id)
)
开发者ID:zhmu,项目名称:romdb,代码行数:33,代码来源:refine-import.py

示例10: DBConnection

# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import data_dir [as 别名]
#!/usr/bin/env python3

import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib'))
import romdb
from config import Configuration
from dbconnection import DBConnection

dbxmlfname = Configuration.xml_dir() + "/db_cardobject.xml"
filedbfname = Configuration.data_dir() + "/cardobject.db"

conn = DBConnection()
cur = conn.cursor()

fields = romdb.load_field_xml(dbxmlfname)

db_fields = romdb.DBFields(cur, 'card', fields, [ ])
db_fields.recreate_table([ ('cardaddpower', 'addpower', 'guid') ])
conn.commit()

records = romdb.decode_db(filedbfname, fields)
for k, v in records.items():
	if not db_fields.insert_fields(v):
		# constraint failure (no sys_name most likely) - skip the item
		continue
	conn.commit()

conn.close()

# vim:set ts=2 sw=2:
开发者ID:zhmu,项目名称:romdb,代码行数:32,代码来源:cardobject-import.py

示例11: CHECK

# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import data_dir [as 别名]
#!/usr/bin/env python3

import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib'))
import romdb
from config import Configuration
from dbconnection import DBConnection

dbxmlfname = Configuration.xml_dir() + "/db_suitobject.xml"
filedbfname = Configuration.data_dir() + "/suitobject.db"

conn = DBConnection()
cur = conn.cursor()

fields = romdb.load_field_xml(dbxmlfname)

db_fields = romdb.DBFields(cur, 'suit', fields, [ 'basetype', 'suitlist' ])
db_fields.recreate_table([ ('guid', 'sys_name', 'id') ])

cur.execute('DROP TABLE IF EXISTS suit_bonus')
cur.execute("""CREATE TABLE suit_bonus (
	guid INTEGER NOT NULL,
	itemcount INTEGER NOT NULL,
	ordernum INTEGER NOT NULL,
	typeid INTEGER NOT NULL,
	value INTEGER NOT NULL,
	CONSTRAINT suitbouns_itemcount_range CHECK (itemcount >= 2 AND itemcount <= 9),
	CONSTRAINT suitbonus_ordernum_range CHECK (ordernum >= 1 AND ordernum <= 3),
	PRIMARY KEY (guid, itemcount, ordernum),
	FOREIGN KEY (typeid) REFERENCES sys_weareqtype (id),
	FOREIGN KEY (guid) REFERENCES suit 
开发者ID:zhmu,项目名称:romdb,代码行数:33,代码来源:suitdb-import.py

示例12: CHECK

# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import data_dir [as 别名]
#!/usr/bin/env python3

import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib'))
import romdb
from config import Configuration
from dbconnection import DBConnection

dbxmlfname = Configuration.xml_dir() + "/db_titleobject.xml"
filedbfname = Configuration.data_dir() + "/titleobject.db"

conn = DBConnection()
cur = conn.cursor()

fields = romdb.load_field_xml(dbxmlfname)

# construct db table
db_fields = romdb.DBFields(cur, 'title', fields, [ 'eqtype' ])
db_fields.recreate_table([ ('guid', 'sys_name', 'id') ])

cur.execute('DROP TABLE IF EXISTS title_weareq ')
cur.execute("""CREATE TABLE title_weareq (
	guid INTEGER NOT NULL,
	ordernum INTEGER NOT NULL,
	typeid INTEGER NOT NULL,
	value INTEGER NOT NULL,
	CONSTRAINT title_weareq_ordernum_range CHECK (ordernum >= 1 AND ordernum <= 5),
	PRIMARY KEY (guid, ordernum),
	FOREIGN KEY (guid) REFERENCES title,
	FOREIGN KEY (typeid) REFERENCES sys_weareqtype (id)
)
开发者ID:zhmu,项目名称:romdb,代码行数:33,代码来源:titleobject-import.py


注:本文中的config.Configuration.data_dir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。