NO DOCUMENTATION (module kivy.uix.recycleview)

class kivy.lang.compiler.utils.StringPool(prefix='var')[source]

Bases: builtins.object

A pool of strings that we can borrow from. Strings can be reused or borrowed permanently. It just keeps incrementing and adding more items to the pool as needed, but reuses first. E.g.

>>> obj1 = object()
>>> obj2 = object()
>>> pool = StringPool()
>>> pool.borrow(obj1, 3)
'var_0'
>>> pool.borrow(obj2, 1)
'var_1'
>>> pool.borrow_persistent()
'var_2'
>>> pool.borrow_persistent()
'var_3'
>>> pool.return_back(obj1)
2
>>> pool.return_back(obj1)
1
>>> pool.borrow_persistent()
'var_4'
>>> pool.return_back(obj1)
0
>>> pool.borrow_persistent()
'var_0'
>>> pool.return_back(obj2)
0
>>> pool.borrow_persistent()
'var_1'
>>> pool.borrow_persistent()
'var_5'
borrow(token, count=1)[source]

Borrows a item for the token. :param token: The token that is borrowing the item. :param count: The number of times the item will be borrowed. :return: A value from the pool.

borrow_persistent()[source]

Borows a items from the pool permanently (will never be returned). :return: The item from the pool.

get_all_items()[source]
Returns:all the items that has been borrowed or are currently borrowed.
get_available_items()[source]
Returns:The list of items currently available to be borrowed by the pool, that has been borrowed previously (obviously we have an infinite list if we also include items not yet borrowed).
get_num_borrowed()[source]
Returns:The number of items currently borrowed.
return_back(token)[source]

Returns a an item borrowed from the pool by the token. The token must return the items for as many times as it borrowed it. :param token: The token that borrowed an item. :return: The number of times the token still borrowed the item from the

pool, after the current return.