MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / StringSlice

Method StringSlice

pkg/filament/cpython/object.go:289–310  ·  view source on GitHub ↗

StringSlice returns this object as a string slice.

()

Source from the content-addressed store, hash-verified

287
288// StringSlice returns this object as a string slice.
289func (ob *PyObject) StringSlice() []string {
290 if ob.rawptr == nil {
291 return []string{}
292 }
293 l := int(C.PyList_Size(ob.asRaw()))
294 if l < 0 {
295 return nil
296 }
297 s := make([]string, l)
298 for i := 0; i < l; i++ {
299 item := C.PyList_GetItem(ob.asRaw(), C.longlong(i))
300 if item == nil {
301 continue
302 }
303 isUnicode := bool(C.Py_IsUnicode(item))
304 if !isUnicode {
305 continue
306 }
307 s[i] = fromRawOb(item).String()
308 }
309 return s
310}
311
312// Uint32 returns an uint32 integer from the raw Python object.
313func (ob *PyObject) Uint32() uint32 {

Callers 8

AddFlagsFunction · 0.80
AddFlagsFunction · 0.80
AddFlagsFunction · 0.80
AddFlagsFunction · 0.80
AddFlagsFunction · 0.80
PyArgsParseKeywordsFunction · 0.80
addFlagsMethod · 0.80
AddFlagsFunction · 0.80

Calls 3

asRawMethod · 0.95
fromRawObFunction · 0.85
StringMethod · 0.65

Tested by

no test coverage detected