本文整理汇总了Python中txtorcon.router.Router.name_is_unique方法的典型用法代码示例。如果您正苦于以下问题:Python Router.name_is_unique方法的具体用法?Python Router.name_is_unique怎么用?Python Router.name_is_unique使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类txtorcon.router.Router
的用法示例。
在下文中一共展示了Router.name_is_unique方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: router_from_id
# 需要导入模块: from txtorcon.router import Router [as 别名]
# 或者: from txtorcon.router.Router import name_is_unique [as 别名]
def router_from_id(self, routerid):
"""IRouterContainer API"""
try:
return self.routers[routerid]
except KeyError:
router = Router(self.protocol)
if routerid[0] != '$':
raise # just re-raise the KeyError
idhash = routerid[1:41]
nick = ''
is_named = False
if len(routerid) > 41:
nick = routerid[42:]
is_named = routerid[41] is '='
router.update(nick, hashFromHexId(idhash), '0'*27, 'unknown', 'unknown', '0', '0')
router.name_is_unique = is_named
return router
示例2: router_from_id
# 需要导入模块: from txtorcon.router import Router [as 别名]
# 或者: from txtorcon.router.Router import name_is_unique [as 别名]
def router_from_id(self, routerid):
"""IRouterContainer API"""
try:
return self.routers[routerid[:41]]
except KeyError:
if routerid[0] != "$":
raise # just re-raise the KeyError
router = Router(self.protocol)
idhash = routerid[1:41]
nick = ""
is_named = False
if len(routerid) > 41:
nick = routerid[42:]
is_named = routerid[41] == "="
router.update(nick, hashFromHexId(idhash), "0" * 27, "unknown", "unknown", "0", "0")
router.name_is_unique = is_named
self.routers[router.id_hex] = router
return router