python tokenizer是什么_Python dns.tokenizer方法代码示例

# 需要导入模块: import dns [as 别名]

# 或者: from dns import tokenizer [as 别名]

def from_text(text, origin = None, rdclass = dns.rdataclass.IN,

relativize = True, zone_factory=Zone, filename=None,

allow_include=False, check_origin=True):

"""Build a zone object from a master file format string.

@param text: the master file format input

@type text: string.

@param origin: The origin of the zone; if not specified, the first

$ORIGIN statement in the master file will determine the origin of the

zone.

@type origin: dns.name.Name object or string

@param rdclass: The zone's rdata class; the default is class IN.

@type rdclass: int

@param relativize: should names be relativized? The default is True

@type relativize: bool

@param zone_factory: The zone factory to use

@type zone_factory: function returning a Zone

@param filename: The filename to emit when describing where an error

occurred; the default is ''.

@type filename: string

@param allow_include: is $INCLUDE allowed?

@type allow_include: bool

@param check_origin: should sanity checks of the origin node be done?

The default is True.

@type check_origin: bool

@raises dns.zone.NoSOA: No SOA RR was found at the zone origin

@raises dns.zone.NoNS: No NS RRset was found at the zone origin

@rtype: dns.zone.Zone object

"""

# 'text' can also be a file, but we don't publish that fact

# since it's an implementation detail. The official file

# interface is from_file().

if filename is None:

filename = ''

tok = dns.tokenizer.Tokenizer(text, filename)

reader = _MasterReader(tok, origin, rdclass, relativize, zone_factory,

allow_include=allow_include,

check_origin=check_origin)

reader.read()

return reader.zone

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值