Completed
Push — master ( 3ae80f...b1ac69 )
by Jeffrey
03:56
created

has_seen()   B

Complexity

Conditions 7

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 7
c 1
b 0
f 0
dl 0
loc 13
rs 7.3333
1
#!/usr/bin/env python
2
# -*- coding: utf-8 -*-
3
4
# These imports are for python3 compatability inside python2
5
from __future__ import absolute_import
6
from __future__ import division
7
from __future__ import print_function
8
9
__author__ = 'Jeffrey Phillips Freeman (WI2ARD)'
10
__maintainer__ = 'Jeffrey Phillips Freeman (WI2ARD)'
11
__email__ = '[email protected]'
12
__license__ = 'Apache License, Version 2.0'
13
__copyright__ = 'Copyright 2016, Syncleus, Inc. and contributors'
14
__credits__ = []
15
16
def has_seen(port_map, frame):
17
    # Can't digipeat anything when you are the source
18
    for port in port_map.values():
19
        if frame['source'] == port['identifier']:
20
            return True
21
22
    # can't digipeat things we already digipeated.
23
    for hop in frame['path']:
24
        for port in port_map.values():
25
            if hop.startswith(port['identifier']) and hop.endswith('*'):
26
                return True
27
28
    return False
29