enum枚举希望实现顺序取文件值,请帮忙告知一下源码读取文件的代码在哪个函数
Opened this issue · 11 comments
a3733092 commented
gangly commented
在datafaker/dbs/basedb.py文件parse_schema_from_rows函数部分
if cmd == 'enum':
if len(rets) == 0:
raise EnumMustNotEmptyError
# 如果enum类型只有一个值,则产生固定值
# 如果enum类型只有一个值,且以file://开头,则读取文件
if len(rets) == 1 and rets[0].startswith(ENUM_FILE):
rets = read_file_lines(rets[0][len(ENUM_FILE):])
if ctype in INT_TYPES:
args = [int(ret) for ret in rets]
elif ctype in FLOAT_TYPES:
args = [float(ret) for ret in rets]
else:
args = rets
a3733092 commented
好的,非常感谢~我去试试能不能改改
a3733092 commented
gangly commented
感谢提供代码和修改意见,我近期会尽快合并代码实现顺序enum功能
gangly commented
a3733092 commented
gangly commented
已新增order_enum类型
a3733092 commented
a3733092 commented
gangly commented
a3733092 commented
已更新到0.6.2,已经支持,非常感谢!