1
0
Fork 0
mirror of https://github.com/sileht/bird-lg.git synced 2024-11-25 00:04:42 +01:00

Basic python reformatting

Transform all tabs to spaces and remove trailing spaces.
This commit is contained in:
Baptiste Jonglez 2020-06-15 22:34:25 +02:00
parent ca4550ae74
commit a45ae45408
4 changed files with 156 additions and 164 deletions

View file

@ -171,7 +171,4 @@ class BirdSocket:
return True, parsed_string return True, parsed_string
__all__ = ['BirdSocketSingleton' , 'BirdSocket' ] __all__ = ['BirdSocketSingleton', 'BirdSocket']

2
lg.py
View file

@ -461,7 +461,6 @@ def show_bgpmap():
if "%s*" % label_without_star not in labels: if "%s*" % label_without_star not in labels:
labels = [ kwargs["label"] ] + [ l for l in labels if not l.startswith(label_without_star) ] labels = [ kwargs["label"] ] + [ l for l in labels if not l.startswith(label_without_star) ]
labels = sorted(labels, cmp=lambda x,y: x.endswith("*") and -1 or 1) labels = sorted(labels, cmp=lambda x,y: x.endswith("*") and -1 or 1)
label = escape("\r".join(labels)) label = escape("\r".join(labels))
e.set_label(label) e.set_label(label)
return edges[edge_tuple] return edges[edge_tuple]
@ -511,7 +510,6 @@ def show_bgpmap():
else: else:
hop_label = "" hop_label = ""
if _as == asmap[-1]: if _as == asmap[-1]:
add_node(_as, fillcolor="#F5A9A9", shape="box", ) add_node(_as, fillcolor="#F5A9A9", shape="box", )
else: else:

View file

@ -78,9 +78,8 @@ def traceroute():
src = [] src = []
if request.path == '/traceroute6': if request.path == '/traceroute6':
traceroute = traceroute6 traceroute = traceroute6
if app.config.get("IPV6_SOURCE",""): if app.config.get("IPV6_SOURCE", ""):
src = [ "-s", app.config.get("IPV6_SOURCE") ] src = [ "-s", app.config.get("IPV6_SOURCE") ]
else: else:
traceroute = traceroute4 traceroute = traceroute4
if app.config.get("IPV4_SOURCE",""): if app.config.get("IPV4_SOURCE",""):
@ -97,11 +96,9 @@ def traceroute():
options = [ '-A', '-q1', '-N32', '-w1', '-m15' ] options = [ '-A', '-q1', '-N32', '-w1', '-m15' ]
command = traceroute + src + options + [ query ] command = traceroute + src + options + [ query ]
result = subprocess.Popen( command , stdout=subprocess.PIPE).communicate()[0].decode('utf-8', 'ignore').replace("\n","<br>") result = subprocess.Popen( command , stdout=subprocess.PIPE).communicate()[0].decode('utf-8', 'ignore').replace("\n","<br>")
return result return result
@app.route("/bird") @app.route("/bird")
@app.route("/bird6") @app.route("/bird6")
def bird(): def bird():