This file is indexed.

/usr/lib/python2.7/dist-packages/ola/MACAddress.py is in ola-python 0.10.5.nojsmin-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
# MACAddress.py
# Copyright (C) 2013 Peter Newman

"""The MACAddress class."""

__author__ = 'nomis52@gmail.com (Simon Newton)'

MAC_ADDRESS_LENGTH = 6


class Error(Exception):
  """Base Error Class."""


class MACAddress(object):
  """Represents a MAC Address."""

  def __init__(self, mac_address):
    """Create a new MAC Address object.

    Args:
      mac_address: The byte array representation of the MAC Address, e.g.
      bytearray([0x01, 0x23, 0x45, 0x67, 0x89 0xab]).
    """
    self._mac_address = mac_address

  @property
  def mac_address(self):
    return self._mac_address

  def __str__(self):
    return ':'.join(format(x, '02x') for x in self._mac_address)

  def __hash__(self):
    return hash(str(self))

  def __repr__(self):
    return self.__str__()

  def __cmp__(self, other):
    if other is None:
      return 1
    return cmp(self.mac_address, other.mac_address)

  def __lt__(self, other):
    return self.mac_address < other.mac_address

  def __eq__(self, other):
    if other is None:
      return False

    return self.mac_address == other.mac_address

  @staticmethod
  def FromString(mac_address_str):
    """Create a new MAC Address from a string.

    Args:
      mac_address_str: The string representation of the MAC Address, e.g.
      01:23:45:67:89:ab or 98.76.54.fe.dc.ba.
    """
    parts = mac_address_str.split(':')
    if len(parts) != MAC_ADDRESS_LENGTH:
      parts = mac_address_str.split('.')
      if len(parts) != MAC_ADDRESS_LENGTH:
        return None
    try:
      address = bytearray([int(parts[0], 16),
                           int(parts[1], 16),
                           int(parts[2], 16),
                           int(parts[3], 16),
                           int(parts[4], 16),
                           int(parts[5], 16)])
    except ValueError:
      return None

    return MACAddress(address)