/usr/share/pyshared/tp/netlib/objects/Object_GetID_ByPos.py is in python-tp-netlib 0.2.5-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 | from xstruct import pack
from Header import Processed
class Object_GetID_ByPos(Processed):
"""\
The Object_GetIDByPos packet consists of:
* 3 by int64, center of sphere
* a uint64, radius of sphere
"""
no = 29
struct = "3q Q"
def __init__(self, sequence, posx, posy, posz, size):
if sequence != 0:
raise ValueError("Object_Get is a normal packet so needs a zero sequence number (%i)" % sequence)
Processed.__init__(self, sequence)
# Length is:
# * 24 bytes (position)
# * 8 bytes (radius)
self.length = 32
self.pos = [posx, posy, posz]
self.size = size
def __str__(self):
output = Processed.__str__(self)
output += pack(self.struct, \
self.pos[0], self.pos[1], self.pos[2], self.size)
return output
|