commonutil.container

數值儲存用類別 / Value container classes

class AppendToListDecorator(*args, **kwds)[source]

用來將被裝飾的語言物件存入一個串列的裝飾器類別 / Decorator to append decorated element into a list

class ContentListEntity(content_key, content_list)
content_key

Alias for field number 0

content_list

Alias for field number 1

class OrderedKeyContentList(*args, **kwds)[source]

有順序的有鍵的值所構成的串列 / List of content with key

add(k, content)[source]

增加給定的鍵值組

Add given key-value pair. If given key does not existed in this container a list container will be created for keeping given value.

Parameters:
  • k – 給定值所屬的鍵 / Key value of given content
  • content – 給定值 / Value of given content
class SealableOrderedDict(*args, **kwds)[source]

可固定已有的鍵值不被後續程序變更的有序字典物件

A seal-able ordered dictionary

clear() → None. Remove all items from od.[source]
seal()[source]

固定已有的鍵值,針對既有鍵的後續的變更作業會丟出 KeyError 例外

Seal existed key-value pair. Later modification will resulted in KeyError exception.

unseal()[source]

解除鍵值的固定

Remove key-value seal.