gorrent/py/gorrent/go.py

1388 lines
44 KiB
Python

# python wrapper for package go within overall package gorrent
# This is what you import to use the package.
# File is generated by gopy. Do not edit.
# gopy gen --output=py/gorrent gorrent
# the following is required to enable dlopen to open the _go.so file
import os,sys,inspect,collections
try:
import collections.abc as _collections_abc
except ImportError:
_collections_abc = collections
cwd = os.getcwd()
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
os.chdir(currentdir)
from . import _gorrent
os.chdir(cwd)
# to use this code in your end-user python file, import it as follows:
# from gorrent import go
# and then refer to everything using go. prefix
# packages imported by this package listed below:
import collections
try:
import collections.abc as _collections_abc
except ImportError:
_collections_abc = collections
class GoClass(object):
"""GoClass is the base class for all GoPy wrapper classes"""
def __init__(self):
self.handle = 0
# use go.nil for nil pointers
nil = GoClass()
# need to explicitly initialize it
def main():
global nil
nil = GoClass()
main()
def Init():
"""calls the GoPyInit function, which runs the 'main' code string that was passed using -main arg to gopy"""
_gorrent.GoPyInit()
# ---- Types ---
# Python type for slice []bool
class Slice_bool(GoClass):
""""""
def __init__(self, *args, **kwargs):
"""
handle=A Go-side object is always initialized with an explicit handle=arg
otherwise parameter is a python list that we copy from
"""
self.index = 0
if len(kwargs) == 1 and 'handle' in kwargs:
self.handle = kwargs['handle']
_gorrent.IncRef(self.handle)
elif len(args) == 1 and isinstance(args[0], GoClass):
self.handle = args[0].handle
_gorrent.IncRef(self.handle)
else:
self.handle = _gorrent.Slice_bool_CTor()
_gorrent.IncRef(self.handle)
if len(args) > 0:
if not isinstance(args[0], _collections_abc.Iterable):
raise TypeError('Slice_bool.__init__ takes a sequence as argument')
for elt in args[0]:
self.append(elt)
def __del__(self):
_gorrent.DecRef(self.handle)
def __str__(self):
s = 'go.Slice_bool len: ' + str(len(self)) + ' handle: ' + str(self.handle) + ' ['
if len(self) < 120:
s += ', '.join(map(str, self)) + ']'
return s
def __repr__(self):
return 'go.Slice_bool([' + ', '.join(map(str, self)) + '])'
def __len__(self):
return _gorrent.Slice_bool_len(self.handle)
def __getitem__(self, key):
if isinstance(key, slice):
if key.step == None or key.step == 1:
st = key.start
ed = key.stop
if st == None:
st = 0
if ed == None:
ed = _gorrent.Slice_bool_len(self.handle)
return Slice_bool(handle=_gorrent.Slice_bool_subslice(self.handle, st, ed))
return [self[ii] for ii in range(*key.indices(len(self)))]
elif isinstance(key, int):
if key < 0:
key += len(self)
if key < 0 or key >= len(self):
raise IndexError('slice index out of range')
return _gorrent.Slice_bool_elem(self.handle, key)
else:
raise TypeError('slice index invalid type')
def __setitem__(self, idx, value):
if idx < 0:
idx += len(self)
if idx < len(self):
_gorrent.Slice_bool_set(self.handle, idx, value)
return
raise IndexError('slice index out of range')
def __iadd__(self, value):
if not isinstance(value, _collections_abc.Iterable):
raise TypeError('Slice_bool.__iadd__ takes a sequence as argument')
for elt in value:
self.append(elt)
return self
def __iter__(self):
self.index = 0
return self
def __next__(self):
if self.index < len(self):
rv = _gorrent.Slice_bool_elem(self.handle, self.index)
self.index = self.index + 1
return rv
raise StopIteration
def append(self, value):
_gorrent.Slice_bool_append(self.handle, value)
def copy(self, src):
""" copy emulates the go copy function, copying elements into this list from source list, up to min of size of each list """
mx = min(len(self), len(src))
for i in range(mx):
self[i] = src[i]
# Python type for slice []byte
class Slice_byte(GoClass):
""""""
def __init__(self, *args, **kwargs):
"""
handle=A Go-side object is always initialized with an explicit handle=arg
otherwise parameter is a python list that we copy from
"""
self.index = 0
if len(kwargs) == 1 and 'handle' in kwargs:
self.handle = kwargs['handle']
_gorrent.IncRef(self.handle)
elif len(args) == 1 and isinstance(args[0], GoClass):
self.handle = args[0].handle
_gorrent.IncRef(self.handle)
else:
self.handle = _gorrent.Slice_byte_CTor()
_gorrent.IncRef(self.handle)
if len(args) > 0:
if not isinstance(args[0], _collections_abc.Iterable):
raise TypeError('Slice_byte.__init__ takes a sequence as argument')
for elt in args[0]:
self.append(elt)
def __del__(self):
_gorrent.DecRef(self.handle)
def __str__(self):
s = 'go.Slice_byte len: ' + str(len(self)) + ' handle: ' + str(self.handle) + ' ['
if len(self) < 120:
s += ', '.join(map(str, self)) + ']'
return s
def __repr__(self):
return 'go.Slice_byte([' + ', '.join(map(str, self)) + '])'
def __len__(self):
return _gorrent.Slice_byte_len(self.handle)
def __getitem__(self, key):
if isinstance(key, slice):
if key.step == None or key.step == 1:
st = key.start
ed = key.stop
if st == None:
st = 0
if ed == None:
ed = _gorrent.Slice_byte_len(self.handle)
return Slice_byte(handle=_gorrent.Slice_byte_subslice(self.handle, st, ed))
return [self[ii] for ii in range(*key.indices(len(self)))]
elif isinstance(key, int):
if key < 0:
key += len(self)
if key < 0 or key >= len(self):
raise IndexError('slice index out of range')
return _gorrent.Slice_byte_elem(self.handle, key)
else:
raise TypeError('slice index invalid type')
def __setitem__(self, idx, value):
if idx < 0:
idx += len(self)
if idx < len(self):
_gorrent.Slice_byte_set(self.handle, idx, value)
return
raise IndexError('slice index out of range')
def __iadd__(self, value):
if not isinstance(value, _collections_abc.Iterable):
raise TypeError('Slice_byte.__iadd__ takes a sequence as argument')
for elt in value:
self.append(elt)
return self
def __iter__(self):
self.index = 0
return self
def __next__(self):
if self.index < len(self):
rv = _gorrent.Slice_byte_elem(self.handle, self.index)
self.index = self.index + 1
return rv
raise StopIteration
def append(self, value):
_gorrent.Slice_byte_append(self.handle, value)
def copy(self, src):
""" copy emulates the go copy function, copying elements into this list from source list, up to min of size of each list """
mx = min(len(self), len(src))
for i in range(mx):
self[i] = src[i]
# Python type for slice []float32
class Slice_float32(GoClass):
""""""
def __init__(self, *args, **kwargs):
"""
handle=A Go-side object is always initialized with an explicit handle=arg
otherwise parameter is a python list that we copy from
"""
self.index = 0
if len(kwargs) == 1 and 'handle' in kwargs:
self.handle = kwargs['handle']
_gorrent.IncRef(self.handle)
elif len(args) == 1 and isinstance(args[0], GoClass):
self.handle = args[0].handle
_gorrent.IncRef(self.handle)
else:
self.handle = _gorrent.Slice_float32_CTor()
_gorrent.IncRef(self.handle)
if len(args) > 0:
if not isinstance(args[0], _collections_abc.Iterable):
raise TypeError('Slice_float32.__init__ takes a sequence as argument')
for elt in args[0]:
self.append(elt)
def __del__(self):
_gorrent.DecRef(self.handle)
def __str__(self):
s = 'go.Slice_float32 len: ' + str(len(self)) + ' handle: ' + str(self.handle) + ' ['
if len(self) < 120:
s += ', '.join(map(str, self)) + ']'
return s
def __repr__(self):
return 'go.Slice_float32([' + ', '.join(map(str, self)) + '])'
def __len__(self):
return _gorrent.Slice_float32_len(self.handle)
def __getitem__(self, key):
if isinstance(key, slice):
if key.step == None or key.step == 1:
st = key.start
ed = key.stop
if st == None:
st = 0
if ed == None:
ed = _gorrent.Slice_float32_len(self.handle)
return Slice_float32(handle=_gorrent.Slice_float32_subslice(self.handle, st, ed))
return [self[ii] for ii in range(*key.indices(len(self)))]
elif isinstance(key, int):
if key < 0:
key += len(self)
if key < 0 or key >= len(self):
raise IndexError('slice index out of range')
return _gorrent.Slice_float32_elem(self.handle, key)
else:
raise TypeError('slice index invalid type')
def __setitem__(self, idx, value):
if idx < 0:
idx += len(self)
if idx < len(self):
_gorrent.Slice_float32_set(self.handle, idx, value)
return
raise IndexError('slice index out of range')
def __iadd__(self, value):
if not isinstance(value, _collections_abc.Iterable):
raise TypeError('Slice_float32.__iadd__ takes a sequence as argument')
for elt in value:
self.append(elt)
return self
def __iter__(self):
self.index = 0
return self
def __next__(self):
if self.index < len(self):
rv = _gorrent.Slice_float32_elem(self.handle, self.index)
self.index = self.index + 1
return rv
raise StopIteration
def append(self, value):
_gorrent.Slice_float32_append(self.handle, value)
def copy(self, src):
""" copy emulates the go copy function, copying elements into this list from source list, up to min of size of each list """
mx = min(len(self), len(src))
for i in range(mx):
self[i] = src[i]
# Python type for slice []float64
class Slice_float64(GoClass):
""""""
def __init__(self, *args, **kwargs):
"""
handle=A Go-side object is always initialized with an explicit handle=arg
otherwise parameter is a python list that we copy from
"""
self.index = 0
if len(kwargs) == 1 and 'handle' in kwargs:
self.handle = kwargs['handle']
_gorrent.IncRef(self.handle)
elif len(args) == 1 and isinstance(args[0], GoClass):
self.handle = args[0].handle
_gorrent.IncRef(self.handle)
else:
self.handle = _gorrent.Slice_float64_CTor()
_gorrent.IncRef(self.handle)
if len(args) > 0:
if not isinstance(args[0], _collections_abc.Iterable):
raise TypeError('Slice_float64.__init__ takes a sequence as argument')
for elt in args[0]:
self.append(elt)
def __del__(self):
_gorrent.DecRef(self.handle)
def __str__(self):
s = 'go.Slice_float64 len: ' + str(len(self)) + ' handle: ' + str(self.handle) + ' ['
if len(self) < 120:
s += ', '.join(map(str, self)) + ']'
return s
def __repr__(self):
return 'go.Slice_float64([' + ', '.join(map(str, self)) + '])'
def __len__(self):
return _gorrent.Slice_float64_len(self.handle)
def __getitem__(self, key):
if isinstance(key, slice):
if key.step == None or key.step == 1:
st = key.start
ed = key.stop
if st == None:
st = 0
if ed == None:
ed = _gorrent.Slice_float64_len(self.handle)
return Slice_float64(handle=_gorrent.Slice_float64_subslice(self.handle, st, ed))
return [self[ii] for ii in range(*key.indices(len(self)))]
elif isinstance(key, int):
if key < 0:
key += len(self)
if key < 0 or key >= len(self):
raise IndexError('slice index out of range')
return _gorrent.Slice_float64_elem(self.handle, key)
else:
raise TypeError('slice index invalid type')
def __setitem__(self, idx, value):
if idx < 0:
idx += len(self)
if idx < len(self):
_gorrent.Slice_float64_set(self.handle, idx, value)
return
raise IndexError('slice index out of range')
def __iadd__(self, value):
if not isinstance(value, _collections_abc.Iterable):
raise TypeError('Slice_float64.__iadd__ takes a sequence as argument')
for elt in value:
self.append(elt)
return self
def __iter__(self):
self.index = 0
return self
def __next__(self):
if self.index < len(self):
rv = _gorrent.Slice_float64_elem(self.handle, self.index)
self.index = self.index + 1
return rv
raise StopIteration
def append(self, value):
_gorrent.Slice_float64_append(self.handle, value)
def copy(self, src):
""" copy emulates the go copy function, copying elements into this list from source list, up to min of size of each list """
mx = min(len(self), len(src))
for i in range(mx):
self[i] = src[i]
# Python type for slice []int
class Slice_int(GoClass):
""""""
def __init__(self, *args, **kwargs):
"""
handle=A Go-side object is always initialized with an explicit handle=arg
otherwise parameter is a python list that we copy from
"""
self.index = 0
if len(kwargs) == 1 and 'handle' in kwargs:
self.handle = kwargs['handle']
_gorrent.IncRef(self.handle)
elif len(args) == 1 and isinstance(args[0], GoClass):
self.handle = args[0].handle
_gorrent.IncRef(self.handle)
else:
self.handle = _gorrent.Slice_int_CTor()
_gorrent.IncRef(self.handle)
if len(args) > 0:
if not isinstance(args[0], _collections_abc.Iterable):
raise TypeError('Slice_int.__init__ takes a sequence as argument')
for elt in args[0]:
self.append(elt)
def __del__(self):
_gorrent.DecRef(self.handle)
def __str__(self):
s = 'go.Slice_int len: ' + str(len(self)) + ' handle: ' + str(self.handle) + ' ['
if len(self) < 120:
s += ', '.join(map(str, self)) + ']'
return s
def __repr__(self):
return 'go.Slice_int([' + ', '.join(map(str, self)) + '])'
def __len__(self):
return _gorrent.Slice_int_len(self.handle)
def __getitem__(self, key):
if isinstance(key, slice):
if key.step == None or key.step == 1:
st = key.start
ed = key.stop
if st == None:
st = 0
if ed == None:
ed = _gorrent.Slice_int_len(self.handle)
return Slice_int(handle=_gorrent.Slice_int_subslice(self.handle, st, ed))
return [self[ii] for ii in range(*key.indices(len(self)))]
elif isinstance(key, int):
if key < 0:
key += len(self)
if key < 0 or key >= len(self):
raise IndexError('slice index out of range')
return _gorrent.Slice_int_elem(self.handle, key)
else:
raise TypeError('slice index invalid type')
def __setitem__(self, idx, value):
if idx < 0:
idx += len(self)
if idx < len(self):
_gorrent.Slice_int_set(self.handle, idx, value)
return
raise IndexError('slice index out of range')
def __iadd__(self, value):
if not isinstance(value, _collections_abc.Iterable):
raise TypeError('Slice_int.__iadd__ takes a sequence as argument')
for elt in value:
self.append(elt)
return self
def __iter__(self):
self.index = 0
return self
def __next__(self):
if self.index < len(self):
rv = _gorrent.Slice_int_elem(self.handle, self.index)
self.index = self.index + 1
return rv
raise StopIteration
def append(self, value):
_gorrent.Slice_int_append(self.handle, value)
def copy(self, src):
""" copy emulates the go copy function, copying elements into this list from source list, up to min of size of each list """
mx = min(len(self), len(src))
for i in range(mx):
self[i] = src[i]
# Python type for slice []int16
class Slice_int16(GoClass):
""""""
def __init__(self, *args, **kwargs):
"""
handle=A Go-side object is always initialized with an explicit handle=arg
otherwise parameter is a python list that we copy from
"""
self.index = 0
if len(kwargs) == 1 and 'handle' in kwargs:
self.handle = kwargs['handle']
_gorrent.IncRef(self.handle)
elif len(args) == 1 and isinstance(args[0], GoClass):
self.handle = args[0].handle
_gorrent.IncRef(self.handle)
else:
self.handle = _gorrent.Slice_int16_CTor()
_gorrent.IncRef(self.handle)
if len(args) > 0:
if not isinstance(args[0], _collections_abc.Iterable):
raise TypeError('Slice_int16.__init__ takes a sequence as argument')
for elt in args[0]:
self.append(elt)
def __del__(self):
_gorrent.DecRef(self.handle)
def __str__(self):
s = 'go.Slice_int16 len: ' + str(len(self)) + ' handle: ' + str(self.handle) + ' ['
if len(self) < 120:
s += ', '.join(map(str, self)) + ']'
return s
def __repr__(self):
return 'go.Slice_int16([' + ', '.join(map(str, self)) + '])'
def __len__(self):
return _gorrent.Slice_int16_len(self.handle)
def __getitem__(self, key):
if isinstance(key, slice):
if key.step == None or key.step == 1:
st = key.start
ed = key.stop
if st == None:
st = 0
if ed == None:
ed = _gorrent.Slice_int16_len(self.handle)
return Slice_int16(handle=_gorrent.Slice_int16_subslice(self.handle, st, ed))
return [self[ii] for ii in range(*key.indices(len(self)))]
elif isinstance(key, int):
if key < 0:
key += len(self)
if key < 0 or key >= len(self):
raise IndexError('slice index out of range')
return _gorrent.Slice_int16_elem(self.handle, key)
else:
raise TypeError('slice index invalid type')
def __setitem__(self, idx, value):
if idx < 0:
idx += len(self)
if idx < len(self):
_gorrent.Slice_int16_set(self.handle, idx, value)
return
raise IndexError('slice index out of range')
def __iadd__(self, value):
if not isinstance(value, _collections_abc.Iterable):
raise TypeError('Slice_int16.__iadd__ takes a sequence as argument')
for elt in value:
self.append(elt)
return self
def __iter__(self):
self.index = 0
return self
def __next__(self):
if self.index < len(self):
rv = _gorrent.Slice_int16_elem(self.handle, self.index)
self.index = self.index + 1
return rv
raise StopIteration
def append(self, value):
_gorrent.Slice_int16_append(self.handle, value)
def copy(self, src):
""" copy emulates the go copy function, copying elements into this list from source list, up to min of size of each list """
mx = min(len(self), len(src))
for i in range(mx):
self[i] = src[i]
# Python type for slice []int32
class Slice_int32(GoClass):
""""""
def __init__(self, *args, **kwargs):
"""
handle=A Go-side object is always initialized with an explicit handle=arg
otherwise parameter is a python list that we copy from
"""
self.index = 0
if len(kwargs) == 1 and 'handle' in kwargs:
self.handle = kwargs['handle']
_gorrent.IncRef(self.handle)
elif len(args) == 1 and isinstance(args[0], GoClass):
self.handle = args[0].handle
_gorrent.IncRef(self.handle)
else:
self.handle = _gorrent.Slice_int32_CTor()
_gorrent.IncRef(self.handle)
if len(args) > 0:
if not isinstance(args[0], _collections_abc.Iterable):
raise TypeError('Slice_int32.__init__ takes a sequence as argument')
for elt in args[0]:
self.append(elt)
def __del__(self):
_gorrent.DecRef(self.handle)
def __str__(self):
s = 'go.Slice_int32 len: ' + str(len(self)) + ' handle: ' + str(self.handle) + ' ['
if len(self) < 120:
s += ', '.join(map(str, self)) + ']'
return s
def __repr__(self):
return 'go.Slice_int32([' + ', '.join(map(str, self)) + '])'
def __len__(self):
return _gorrent.Slice_int32_len(self.handle)
def __getitem__(self, key):
if isinstance(key, slice):
if key.step == None or key.step == 1:
st = key.start
ed = key.stop
if st == None:
st = 0
if ed == None:
ed = _gorrent.Slice_int32_len(self.handle)
return Slice_int32(handle=_gorrent.Slice_int32_subslice(self.handle, st, ed))
return [self[ii] for ii in range(*key.indices(len(self)))]
elif isinstance(key, int):
if key < 0:
key += len(self)
if key < 0 or key >= len(self):
raise IndexError('slice index out of range')
return _gorrent.Slice_int32_elem(self.handle, key)
else:
raise TypeError('slice index invalid type')
def __setitem__(self, idx, value):
if idx < 0:
idx += len(self)
if idx < len(self):
_gorrent.Slice_int32_set(self.handle, idx, value)
return
raise IndexError('slice index out of range')
def __iadd__(self, value):
if not isinstance(value, _collections_abc.Iterable):
raise TypeError('Slice_int32.__iadd__ takes a sequence as argument')
for elt in value:
self.append(elt)
return self
def __iter__(self):
self.index = 0
return self
def __next__(self):
if self.index < len(self):
rv = _gorrent.Slice_int32_elem(self.handle, self.index)
self.index = self.index + 1
return rv
raise StopIteration
def append(self, value):
_gorrent.Slice_int32_append(self.handle, value)
def copy(self, src):
""" copy emulates the go copy function, copying elements into this list from source list, up to min of size of each list """
mx = min(len(self), len(src))
for i in range(mx):
self[i] = src[i]
# Python type for slice []int64
class Slice_int64(GoClass):
""""""
def __init__(self, *args, **kwargs):
"""
handle=A Go-side object is always initialized with an explicit handle=arg
otherwise parameter is a python list that we copy from
"""
self.index = 0
if len(kwargs) == 1 and 'handle' in kwargs:
self.handle = kwargs['handle']
_gorrent.IncRef(self.handle)
elif len(args) == 1 and isinstance(args[0], GoClass):
self.handle = args[0].handle
_gorrent.IncRef(self.handle)
else:
self.handle = _gorrent.Slice_int64_CTor()
_gorrent.IncRef(self.handle)
if len(args) > 0:
if not isinstance(args[0], _collections_abc.Iterable):
raise TypeError('Slice_int64.__init__ takes a sequence as argument')
for elt in args[0]:
self.append(elt)
def __del__(self):
_gorrent.DecRef(self.handle)
def __str__(self):
s = 'go.Slice_int64 len: ' + str(len(self)) + ' handle: ' + str(self.handle) + ' ['
if len(self) < 120:
s += ', '.join(map(str, self)) + ']'
return s
def __repr__(self):
return 'go.Slice_int64([' + ', '.join(map(str, self)) + '])'
def __len__(self):
return _gorrent.Slice_int64_len(self.handle)
def __getitem__(self, key):
if isinstance(key, slice):
if key.step == None or key.step == 1:
st = key.start
ed = key.stop
if st == None:
st = 0
if ed == None:
ed = _gorrent.Slice_int64_len(self.handle)
return Slice_int64(handle=_gorrent.Slice_int64_subslice(self.handle, st, ed))
return [self[ii] for ii in range(*key.indices(len(self)))]
elif isinstance(key, int):
if key < 0:
key += len(self)
if key < 0 or key >= len(self):
raise IndexError('slice index out of range')
return _gorrent.Slice_int64_elem(self.handle, key)
else:
raise TypeError('slice index invalid type')
def __setitem__(self, idx, value):
if idx < 0:
idx += len(self)
if idx < len(self):
_gorrent.Slice_int64_set(self.handle, idx, value)
return
raise IndexError('slice index out of range')
def __iadd__(self, value):
if not isinstance(value, _collections_abc.Iterable):
raise TypeError('Slice_int64.__iadd__ takes a sequence as argument')
for elt in value:
self.append(elt)
return self
def __iter__(self):
self.index = 0
return self
def __next__(self):
if self.index < len(self):
rv = _gorrent.Slice_int64_elem(self.handle, self.index)
self.index = self.index + 1
return rv
raise StopIteration
def append(self, value):
_gorrent.Slice_int64_append(self.handle, value)
def copy(self, src):
""" copy emulates the go copy function, copying elements into this list from source list, up to min of size of each list """
mx = min(len(self), len(src))
for i in range(mx):
self[i] = src[i]
# Python type for slice []int8
class Slice_int8(GoClass):
""""""
def __init__(self, *args, **kwargs):
"""
handle=A Go-side object is always initialized with an explicit handle=arg
otherwise parameter is a python list that we copy from
"""
self.index = 0
if len(kwargs) == 1 and 'handle' in kwargs:
self.handle = kwargs['handle']
_gorrent.IncRef(self.handle)
elif len(args) == 1 and isinstance(args[0], GoClass):
self.handle = args[0].handle
_gorrent.IncRef(self.handle)
else:
self.handle = _gorrent.Slice_int8_CTor()
_gorrent.IncRef(self.handle)
if len(args) > 0:
if not isinstance(args[0], _collections_abc.Iterable):
raise TypeError('Slice_int8.__init__ takes a sequence as argument')
for elt in args[0]:
self.append(elt)
def __del__(self):
_gorrent.DecRef(self.handle)
def __str__(self):
s = 'go.Slice_int8 len: ' + str(len(self)) + ' handle: ' + str(self.handle) + ' ['
if len(self) < 120:
s += ', '.join(map(str, self)) + ']'
return s
def __repr__(self):
return 'go.Slice_int8([' + ', '.join(map(str, self)) + '])'
def __len__(self):
return _gorrent.Slice_int8_len(self.handle)
def __getitem__(self, key):
if isinstance(key, slice):
if key.step == None or key.step == 1:
st = key.start
ed = key.stop
if st == None:
st = 0
if ed == None:
ed = _gorrent.Slice_int8_len(self.handle)
return Slice_int8(handle=_gorrent.Slice_int8_subslice(self.handle, st, ed))
return [self[ii] for ii in range(*key.indices(len(self)))]
elif isinstance(key, int):
if key < 0:
key += len(self)
if key < 0 or key >= len(self):
raise IndexError('slice index out of range')
return _gorrent.Slice_int8_elem(self.handle, key)
else:
raise TypeError('slice index invalid type')
def __setitem__(self, idx, value):
if idx < 0:
idx += len(self)
if idx < len(self):
_gorrent.Slice_int8_set(self.handle, idx, value)
return
raise IndexError('slice index out of range')
def __iadd__(self, value):
if not isinstance(value, _collections_abc.Iterable):
raise TypeError('Slice_int8.__iadd__ takes a sequence as argument')
for elt in value:
self.append(elt)
return self
def __iter__(self):
self.index = 0
return self
def __next__(self):
if self.index < len(self):
rv = _gorrent.Slice_int8_elem(self.handle, self.index)
self.index = self.index + 1
return rv
raise StopIteration
def append(self, value):
_gorrent.Slice_int8_append(self.handle, value)
def copy(self, src):
""" copy emulates the go copy function, copying elements into this list from source list, up to min of size of each list """
mx = min(len(self), len(src))
for i in range(mx):
self[i] = src[i]
# Python type for slice []rune
class Slice_rune(GoClass):
""""""
def __init__(self, *args, **kwargs):
"""
handle=A Go-side object is always initialized with an explicit handle=arg
otherwise parameter is a python list that we copy from
"""
self.index = 0
if len(kwargs) == 1 and 'handle' in kwargs:
self.handle = kwargs['handle']
_gorrent.IncRef(self.handle)
elif len(args) == 1 and isinstance(args[0], GoClass):
self.handle = args[0].handle
_gorrent.IncRef(self.handle)
else:
self.handle = _gorrent.Slice_rune_CTor()
_gorrent.IncRef(self.handle)
if len(args) > 0:
if not isinstance(args[0], _collections_abc.Iterable):
raise TypeError('Slice_rune.__init__ takes a sequence as argument')
for elt in args[0]:
self.append(elt)
def __del__(self):
_gorrent.DecRef(self.handle)
def __str__(self):
s = 'go.Slice_rune len: ' + str(len(self)) + ' handle: ' + str(self.handle) + ' ['
if len(self) < 120:
s += ', '.join(map(str, self)) + ']'
return s
def __repr__(self):
return 'go.Slice_rune([' + ', '.join(map(str, self)) + '])'
def __len__(self):
return _gorrent.Slice_rune_len(self.handle)
def __getitem__(self, key):
if isinstance(key, slice):
if key.step == None or key.step == 1:
st = key.start
ed = key.stop
if st == None:
st = 0
if ed == None:
ed = _gorrent.Slice_rune_len(self.handle)
return Slice_rune(handle=_gorrent.Slice_rune_subslice(self.handle, st, ed))
return [self[ii] for ii in range(*key.indices(len(self)))]
elif isinstance(key, int):
if key < 0:
key += len(self)
if key < 0 or key >= len(self):
raise IndexError('slice index out of range')
return _gorrent.Slice_rune_elem(self.handle, key)
else:
raise TypeError('slice index invalid type')
def __setitem__(self, idx, value):
if idx < 0:
idx += len(self)
if idx < len(self):
_gorrent.Slice_rune_set(self.handle, idx, value)
return
raise IndexError('slice index out of range')
def __iadd__(self, value):
if not isinstance(value, _collections_abc.Iterable):
raise TypeError('Slice_rune.__iadd__ takes a sequence as argument')
for elt in value:
self.append(elt)
return self
def __iter__(self):
self.index = 0
return self
def __next__(self):
if self.index < len(self):
rv = _gorrent.Slice_rune_elem(self.handle, self.index)
self.index = self.index + 1
return rv
raise StopIteration
def append(self, value):
_gorrent.Slice_rune_append(self.handle, value)
def copy(self, src):
""" copy emulates the go copy function, copying elements into this list from source list, up to min of size of each list """
mx = min(len(self), len(src))
for i in range(mx):
self[i] = src[i]
# Python type for slice []string
class Slice_string(GoClass):
""""""
def __init__(self, *args, **kwargs):
"""
handle=A Go-side object is always initialized with an explicit handle=arg
otherwise parameter is a python list that we copy from
"""
self.index = 0
if len(kwargs) == 1 and 'handle' in kwargs:
self.handle = kwargs['handle']
_gorrent.IncRef(self.handle)
elif len(args) == 1 and isinstance(args[0], GoClass):
self.handle = args[0].handle
_gorrent.IncRef(self.handle)
else:
self.handle = _gorrent.Slice_string_CTor()
_gorrent.IncRef(self.handle)
if len(args) > 0:
if not isinstance(args[0], _collections_abc.Iterable):
raise TypeError('Slice_string.__init__ takes a sequence as argument')
for elt in args[0]:
self.append(elt)
def __del__(self):
_gorrent.DecRef(self.handle)
def __str__(self):
s = 'go.Slice_string len: ' + str(len(self)) + ' handle: ' + str(self.handle) + ' ['
if len(self) < 120:
s += ', '.join(map(str, self)) + ']'
return s
def __repr__(self):
return 'go.Slice_string([' + ', '.join(map(str, self)) + '])'
def __len__(self):
return _gorrent.Slice_string_len(self.handle)
def __getitem__(self, key):
if isinstance(key, slice):
if key.step == None or key.step == 1:
st = key.start
ed = key.stop
if st == None:
st = 0
if ed == None:
ed = _gorrent.Slice_string_len(self.handle)
return Slice_string(handle=_gorrent.Slice_string_subslice(self.handle, st, ed))
return [self[ii] for ii in range(*key.indices(len(self)))]
elif isinstance(key, int):
if key < 0:
key += len(self)
if key < 0 or key >= len(self):
raise IndexError('slice index out of range')
return _gorrent.Slice_string_elem(self.handle, key)
else:
raise TypeError('slice index invalid type')
def __setitem__(self, idx, value):
if idx < 0:
idx += len(self)
if idx < len(self):
_gorrent.Slice_string_set(self.handle, idx, value)
return
raise IndexError('slice index out of range')
def __iadd__(self, value):
if not isinstance(value, _collections_abc.Iterable):
raise TypeError('Slice_string.__iadd__ takes a sequence as argument')
for elt in value:
self.append(elt)
return self
def __iter__(self):
self.index = 0
return self
def __next__(self):
if self.index < len(self):
rv = _gorrent.Slice_string_elem(self.handle, self.index)
self.index = self.index + 1
return rv
raise StopIteration
def append(self, value):
_gorrent.Slice_string_append(self.handle, value)
def copy(self, src):
""" copy emulates the go copy function, copying elements into this list from source list, up to min of size of each list """
mx = min(len(self), len(src))
for i in range(mx):
self[i] = src[i]
# Python type for slice []uint
class Slice_uint(GoClass):
""""""
def __init__(self, *args, **kwargs):
"""
handle=A Go-side object is always initialized with an explicit handle=arg
otherwise parameter is a python list that we copy from
"""
self.index = 0
if len(kwargs) == 1 and 'handle' in kwargs:
self.handle = kwargs['handle']
_gorrent.IncRef(self.handle)
elif len(args) == 1 and isinstance(args[0], GoClass):
self.handle = args[0].handle
_gorrent.IncRef(self.handle)
else:
self.handle = _gorrent.Slice_uint_CTor()
_gorrent.IncRef(self.handle)
if len(args) > 0:
if not isinstance(args[0], _collections_abc.Iterable):
raise TypeError('Slice_uint.__init__ takes a sequence as argument')
for elt in args[0]:
self.append(elt)
def __del__(self):
_gorrent.DecRef(self.handle)
def __str__(self):
s = 'go.Slice_uint len: ' + str(len(self)) + ' handle: ' + str(self.handle) + ' ['
if len(self) < 120:
s += ', '.join(map(str, self)) + ']'
return s
def __repr__(self):
return 'go.Slice_uint([' + ', '.join(map(str, self)) + '])'
def __len__(self):
return _gorrent.Slice_uint_len(self.handle)
def __getitem__(self, key):
if isinstance(key, slice):
if key.step == None or key.step == 1:
st = key.start
ed = key.stop
if st == None:
st = 0
if ed == None:
ed = _gorrent.Slice_uint_len(self.handle)
return Slice_uint(handle=_gorrent.Slice_uint_subslice(self.handle, st, ed))
return [self[ii] for ii in range(*key.indices(len(self)))]
elif isinstance(key, int):
if key < 0:
key += len(self)
if key < 0 or key >= len(self):
raise IndexError('slice index out of range')
return _gorrent.Slice_uint_elem(self.handle, key)
else:
raise TypeError('slice index invalid type')
def __setitem__(self, idx, value):
if idx < 0:
idx += len(self)
if idx < len(self):
_gorrent.Slice_uint_set(self.handle, idx, value)
return
raise IndexError('slice index out of range')
def __iadd__(self, value):
if not isinstance(value, _collections_abc.Iterable):
raise TypeError('Slice_uint.__iadd__ takes a sequence as argument')
for elt in value:
self.append(elt)
return self
def __iter__(self):
self.index = 0
return self
def __next__(self):
if self.index < len(self):
rv = _gorrent.Slice_uint_elem(self.handle, self.index)
self.index = self.index + 1
return rv
raise StopIteration
def append(self, value):
_gorrent.Slice_uint_append(self.handle, value)
def copy(self, src):
""" copy emulates the go copy function, copying elements into this list from source list, up to min of size of each list """
mx = min(len(self), len(src))
for i in range(mx):
self[i] = src[i]
# Python type for slice []uint16
class Slice_uint16(GoClass):
""""""
def __init__(self, *args, **kwargs):
"""
handle=A Go-side object is always initialized with an explicit handle=arg
otherwise parameter is a python list that we copy from
"""
self.index = 0
if len(kwargs) == 1 and 'handle' in kwargs:
self.handle = kwargs['handle']
_gorrent.IncRef(self.handle)
elif len(args) == 1 and isinstance(args[0], GoClass):
self.handle = args[0].handle
_gorrent.IncRef(self.handle)
else:
self.handle = _gorrent.Slice_uint16_CTor()
_gorrent.IncRef(self.handle)
if len(args) > 0:
if not isinstance(args[0], _collections_abc.Iterable):
raise TypeError('Slice_uint16.__init__ takes a sequence as argument')
for elt in args[0]:
self.append(elt)
def __del__(self):
_gorrent.DecRef(self.handle)
def __str__(self):
s = 'go.Slice_uint16 len: ' + str(len(self)) + ' handle: ' + str(self.handle) + ' ['
if len(self) < 120:
s += ', '.join(map(str, self)) + ']'
return s
def __repr__(self):
return 'go.Slice_uint16([' + ', '.join(map(str, self)) + '])'
def __len__(self):
return _gorrent.Slice_uint16_len(self.handle)
def __getitem__(self, key):
if isinstance(key, slice):
if key.step == None or key.step == 1:
st = key.start
ed = key.stop
if st == None:
st = 0
if ed == None:
ed = _gorrent.Slice_uint16_len(self.handle)
return Slice_uint16(handle=_gorrent.Slice_uint16_subslice(self.handle, st, ed))
return [self[ii] for ii in range(*key.indices(len(self)))]
elif isinstance(key, int):
if key < 0:
key += len(self)
if key < 0 or key >= len(self):
raise IndexError('slice index out of range')
return _gorrent.Slice_uint16_elem(self.handle, key)
else:
raise TypeError('slice index invalid type')
def __setitem__(self, idx, value):
if idx < 0:
idx += len(self)
if idx < len(self):
_gorrent.Slice_uint16_set(self.handle, idx, value)
return
raise IndexError('slice index out of range')
def __iadd__(self, value):
if not isinstance(value, _collections_abc.Iterable):
raise TypeError('Slice_uint16.__iadd__ takes a sequence as argument')
for elt in value:
self.append(elt)
return self
def __iter__(self):
self.index = 0
return self
def __next__(self):
if self.index < len(self):
rv = _gorrent.Slice_uint16_elem(self.handle, self.index)
self.index = self.index + 1
return rv
raise StopIteration
def append(self, value):
_gorrent.Slice_uint16_append(self.handle, value)
def copy(self, src):
""" copy emulates the go copy function, copying elements into this list from source list, up to min of size of each list """
mx = min(len(self), len(src))
for i in range(mx):
self[i] = src[i]
# Python type for slice []uint32
class Slice_uint32(GoClass):
""""""
def __init__(self, *args, **kwargs):
"""
handle=A Go-side object is always initialized with an explicit handle=arg
otherwise parameter is a python list that we copy from
"""
self.index = 0
if len(kwargs) == 1 and 'handle' in kwargs:
self.handle = kwargs['handle']
_gorrent.IncRef(self.handle)
elif len(args) == 1 and isinstance(args[0], GoClass):
self.handle = args[0].handle
_gorrent.IncRef(self.handle)
else:
self.handle = _gorrent.Slice_uint32_CTor()
_gorrent.IncRef(self.handle)
if len(args) > 0:
if not isinstance(args[0], _collections_abc.Iterable):
raise TypeError('Slice_uint32.__init__ takes a sequence as argument')
for elt in args[0]:
self.append(elt)
def __del__(self):
_gorrent.DecRef(self.handle)
def __str__(self):
s = 'go.Slice_uint32 len: ' + str(len(self)) + ' handle: ' + str(self.handle) + ' ['
if len(self) < 120:
s += ', '.join(map(str, self)) + ']'
return s
def __repr__(self):
return 'go.Slice_uint32([' + ', '.join(map(str, self)) + '])'
def __len__(self):
return _gorrent.Slice_uint32_len(self.handle)
def __getitem__(self, key):
if isinstance(key, slice):
if key.step == None or key.step == 1:
st = key.start
ed = key.stop
if st == None:
st = 0
if ed == None:
ed = _gorrent.Slice_uint32_len(self.handle)
return Slice_uint32(handle=_gorrent.Slice_uint32_subslice(self.handle, st, ed))
return [self[ii] for ii in range(*key.indices(len(self)))]
elif isinstance(key, int):
if key < 0:
key += len(self)
if key < 0 or key >= len(self):
raise IndexError('slice index out of range')
return _gorrent.Slice_uint32_elem(self.handle, key)
else:
raise TypeError('slice index invalid type')
def __setitem__(self, idx, value):
if idx < 0:
idx += len(self)
if idx < len(self):
_gorrent.Slice_uint32_set(self.handle, idx, value)
return
raise IndexError('slice index out of range')
def __iadd__(self, value):
if not isinstance(value, _collections_abc.Iterable):
raise TypeError('Slice_uint32.__iadd__ takes a sequence as argument')
for elt in value:
self.append(elt)
return self
def __iter__(self):
self.index = 0
return self
def __next__(self):
if self.index < len(self):
rv = _gorrent.Slice_uint32_elem(self.handle, self.index)
self.index = self.index + 1
return rv
raise StopIteration
def append(self, value):
_gorrent.Slice_uint32_append(self.handle, value)
def copy(self, src):
""" copy emulates the go copy function, copying elements into this list from source list, up to min of size of each list """
mx = min(len(self), len(src))
for i in range(mx):
self[i] = src[i]
# Python type for slice []uint64
class Slice_uint64(GoClass):
""""""
def __init__(self, *args, **kwargs):
"""
handle=A Go-side object is always initialized with an explicit handle=arg
otherwise parameter is a python list that we copy from
"""
self.index = 0
if len(kwargs) == 1 and 'handle' in kwargs:
self.handle = kwargs['handle']
_gorrent.IncRef(self.handle)
elif len(args) == 1 and isinstance(args[0], GoClass):
self.handle = args[0].handle
_gorrent.IncRef(self.handle)
else:
self.handle = _gorrent.Slice_uint64_CTor()
_gorrent.IncRef(self.handle)
if len(args) > 0:
if not isinstance(args[0], _collections_abc.Iterable):
raise TypeError('Slice_uint64.__init__ takes a sequence as argument')
for elt in args[0]:
self.append(elt)
def __del__(self):
_gorrent.DecRef(self.handle)
def __str__(self):
s = 'go.Slice_uint64 len: ' + str(len(self)) + ' handle: ' + str(self.handle) + ' ['
if len(self) < 120:
s += ', '.join(map(str, self)) + ']'
return s
def __repr__(self):
return 'go.Slice_uint64([' + ', '.join(map(str, self)) + '])'
def __len__(self):
return _gorrent.Slice_uint64_len(self.handle)
def __getitem__(self, key):
if isinstance(key, slice):
if key.step == None or key.step == 1:
st = key.start
ed = key.stop
if st == None:
st = 0
if ed == None:
ed = _gorrent.Slice_uint64_len(self.handle)
return Slice_uint64(handle=_gorrent.Slice_uint64_subslice(self.handle, st, ed))
return [self[ii] for ii in range(*key.indices(len(self)))]
elif isinstance(key, int):
if key < 0:
key += len(self)
if key < 0 or key >= len(self):
raise IndexError('slice index out of range')
return _gorrent.Slice_uint64_elem(self.handle, key)
else:
raise TypeError('slice index invalid type')
def __setitem__(self, idx, value):
if idx < 0:
idx += len(self)
if idx < len(self):
_gorrent.Slice_uint64_set(self.handle, idx, value)
return
raise IndexError('slice index out of range')
def __iadd__(self, value):
if not isinstance(value, _collections_abc.Iterable):
raise TypeError('Slice_uint64.__iadd__ takes a sequence as argument')
for elt in value:
self.append(elt)
return self
def __iter__(self):
self.index = 0
return self
def __next__(self):
if self.index < len(self):
rv = _gorrent.Slice_uint64_elem(self.handle, self.index)
self.index = self.index + 1
return rv
raise StopIteration
def append(self, value):
_gorrent.Slice_uint64_append(self.handle, value)
def copy(self, src):
""" copy emulates the go copy function, copying elements into this list from source list, up to min of size of each list """
mx = min(len(self), len(src))
for i in range(mx):
self[i] = src[i]
# Python type for slice []uint8
class Slice_uint8(GoClass):
""""""
def __init__(self, *args, **kwargs):
"""
handle=A Go-side object is always initialized with an explicit handle=arg
otherwise parameter is a python list that we copy from
"""
self.index = 0
if len(kwargs) == 1 and 'handle' in kwargs:
self.handle = kwargs['handle']
_gorrent.IncRef(self.handle)
elif len(args) == 1 and isinstance(args[0], GoClass):
self.handle = args[0].handle
_gorrent.IncRef(self.handle)
else:
self.handle = _gorrent.Slice_uint8_CTor()
_gorrent.IncRef(self.handle)
if len(args) > 0:
if not isinstance(args[0], _collections_abc.Iterable):
raise TypeError('Slice_uint8.__init__ takes a sequence as argument')
for elt in args[0]:
self.append(elt)
def __del__(self):
_gorrent.DecRef(self.handle)
def __str__(self):
s = 'go.Slice_uint8 len: ' + str(len(self)) + ' handle: ' + str(self.handle) + ' ['
if len(self) < 120:
s += ', '.join(map(str, self)) + ']'
return s
def __repr__(self):
return 'go.Slice_uint8([' + ', '.join(map(str, self)) + '])'
def __len__(self):
return _gorrent.Slice_uint8_len(self.handle)
def __getitem__(self, key):
if isinstance(key, slice):
if key.step == None or key.step == 1:
st = key.start
ed = key.stop
if st == None:
st = 0
if ed == None:
ed = _gorrent.Slice_uint8_len(self.handle)
return Slice_uint8(handle=_gorrent.Slice_uint8_subslice(self.handle, st, ed))
return [self[ii] for ii in range(*key.indices(len(self)))]
elif isinstance(key, int):
if key < 0:
key += len(self)
if key < 0 or key >= len(self):
raise IndexError('slice index out of range')
return _gorrent.Slice_uint8_elem(self.handle, key)
else:
raise TypeError('slice index invalid type')
def __setitem__(self, idx, value):
if idx < 0:
idx += len(self)
if idx < len(self):
_gorrent.Slice_uint8_set(self.handle, idx, value)
return
raise IndexError('slice index out of range')
def __iadd__(self, value):
if not isinstance(value, _collections_abc.Iterable):
raise TypeError('Slice_uint8.__iadd__ takes a sequence as argument')
for elt in value:
self.append(elt)
return self
def __iter__(self):
self.index = 0
return self
def __next__(self):
if self.index < len(self):
rv = _gorrent.Slice_uint8_elem(self.handle, self.index)
self.index = self.index + 1
return rv
raise StopIteration
def append(self, value):
_gorrent.Slice_uint8_append(self.handle, value)
def copy(self, src):
""" copy emulates the go copy function, copying elements into this list from source list, up to min of size of each list """
mx = min(len(self), len(src))
for i in range(mx):
self[i] = src[i]
# ---- External Types Outside of Targeted Packages ---