本文整理匯總了Python中visual.display方法的典型用法代碼示例。如果您正苦於以下問題:Python visual.display方法的具體用法?Python visual.display怎麽用?Python visual.display使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類visual
的用法示例。
在下文中一共展示了visual.display方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: graph
# 需要導入模塊: import visual [as 別名]
# 或者: from visual import display [as 別名]
def graph(self, ASres=None, padding=0, **kargs):
"""x.graph(ASres=conf.AS_resolver, other args):
ASres=None : no AS resolver => no clustering
ASres=AS_resolver() : default whois AS resolver (riswhois.ripe.net)
ASres=AS_resolver_cymru(): use whois.cymru.com whois database
ASres=AS_resolver(server="whois.ra.net")
type: output type (svg, ps, gif, jpg, etc.), passed to dot's "-T" option
target: filename or redirect. Defaults pipe to Imagemagick's display program
prog: which graphviz program to use"""
if ASres is None:
ASres = conf.AS_resolver
if (self.graphdef is None or
self.graphASres != ASres or
self.graphpadding != padding):
self.make_graph(ASres,padding)
return do_graph(self.graphdef, **kargs)
示例2: graph
# 需要導入模塊: import visual [as 別名]
# 或者: from visual import display [as 別名]
def graph(self, ASres=None, padding=0, **kargs):
"""x.graph(ASres=conf.AS_resolver, other args):
ASres=None : no AS resolver => no clustering
ASres=AS_resolver() : default whois AS resolver (riswhois.ripe.net)
ASres=AS_resolver_cymru(): use whois.cymru.com whois database
ASres=AS_resolver(server="whois.ra.net")
format: output type (svg, ps, gif, jpg, etc.), passed to dot's "-T" option
figsize: w,h tuple in inches. See matplotlib documentation
target: filename. If None uses matplotlib to display
prog: which graphviz program to use"""
if ASres is None:
ASres = conf.AS_resolver
if (self.graphdef is None or
self.graphASres != ASres or
self.graphpadding != padding):
self.make_graph(ASres, padding)
return do_graph(self.graphdef, **kargs)
示例3: graph
# 需要導入模塊: import visual [as 別名]
# 或者: from visual import display [as 別名]
def graph(self, ASres=None, padding=0, **kargs):
"""x.graph(ASres=conf.AS_resolver, other args):
ASres=None : no AS resolver => no clustering
ASres=AS_resolver() : default whois AS resolver (riswhois.ripe.net)
ASres=AS_resolver_cymru(): use whois.cymru.com whois database
ASres=AS_resolver(server="whois.ra.net")
format: output type (svg, ps, gif, jpg, etc.), passed to dot's "-T" option
figsize: w,h tuple in inches. See matplotlib documentation
target: filename. If None uses matplotlib to display
prog: which graphviz program to use"""
if ASres is None:
ASres = conf.AS_resolver
if (self.graphdef is None or
self.graphASres != ASres or
self.graphpadding != padding):
self.make_graph(ASres,padding)
return do_graph(self.graphdef, **kargs)
示例4: get_asns
# 需要導入模塊: import visual [as 別名]
# 或者: from visual import display [as 別名]
def get_asns(self, privaddr=0):
"""Obtain associated AS Numbers for IPv4 Addreses.
privaddr: 0 - Normal display of AS numbers,
1 - Do not show an associated AS Number bound box (cluster) on graph for a private IPv4 Address."""
ips = {}
if privaddr:
for k, v in self._ips.items():
if not is_private_addr(k):
ips[k] = v
else:
ips = self._ips
#
# Special case for the loopback IP Address: 127.0.0.1 - Do not ASN resolve...
if '127.0.0.1' in ips:
del ips['127.0.0.1']
#
# ASN Lookup...
asnquerylist = dict.fromkeys(map(lambda x: x.rsplit(" ", 1)[0], ips)).keys()
if self._asres is None:
asnlist = []
else:
try:
asnlist = self._asres.resolve(*asnquerylist)
except:
pass
for ip, asn, desc, in asnlist:
if asn is None:
continue
iplist = self._asns.get(asn, []) # Get previous ASN value
iplist.append(ip) # Append IP Address to previous ASN
#
# If ASN is a string Convert to a number: (i.e., 'AS3257' => 3257)
if type(asn) == str:
asn = asn.upper()
asn = asn.replace('AS', '')
try:
asn = int(asn)
self._asns[asn] = iplist
self._asds[asn] = desc
except:
continue
else:
self._asns[asn] = iplist
self._asds[asn] = desc
#
# Get the ASN for a given IP Address.
#
# ip - IP Address to get the ASN for.
#
# Return the ASN for a given IP Address if found.
# A -1 is returned if not found.
示例5: get_asns
# 需要導入模塊: import visual [as 別名]
# 或者: from visual import display [as 別名]
def get_asns(self, privaddr = 0):
"""Obtain associated AS Numbers for IPv4 Addreses.
privaddr: 0 - Normal display of AS numbers,
1 - Do not show an associated AS Number bound box (cluster) on graph for a private IPv4 Address."""
ips = {}
if privaddr:
for k,v in self._ips.items():
if (not is_private_addr(k)):
ips[k] = v
else:
ips = self._ips
#
# Special case for the loopback IP Address: 127.0.0.1 - Do not ASN resolve...
if '127.0.0.1' in ips:
del ips['127.0.0.1']
#
# ASN Lookup...
asnquerylist = dict.fromkeys(map(lambda x:x.rsplit(" ",1)[0], ips)).keys()
if self._asres is None:
asnlist = []
else:
try:
asnlist = self._asres.resolve(*asnquerylist)
except:
pass
for ip,asn,desc, in asnlist:
if asn is None:
continue
iplist = self._asns.get(asn,[]) # Get previous ASN value
iplist.append(ip) # Append IP Address to previous ASN
#
# If ASN is a string Convert to a number: (i.e., 'AS3257' => 3257)
if (type(asn) == str):
asn = asn.upper()
asn = asn.replace('AS','')
try:
asn = int(asn)
self._asns[asn] = iplist
self._asds[asn] = desc
except:
continue
else:
self._asns[asn] = iplist
self._asds[asn] = desc
#
# Get the ASN for a given IP Address.
#
# ip - IP Address to get the ASN for.
#
# Return the ASN for a given IP Address if found.
# A -1 is returned if not found.