shelf.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:shelfdb 作者: nitipit 项目源码 文件源码
def insert(self, entry):
        """Insert an entry. Automatic generate **uuid1** as entry's ID.

        Args:
            ``entry`` (dict): Entry to be inserted.

        Return:
            ``string``: Entry's UUID.
        """

        # Must generate uuid1 here, since id_=str(uuid.uuid1()) in def args
        # will return the same value all the times after first call.
        id_ = str(uuid.uuid1())
        if isinstance(entry, dict):
            self._shelf[id_] = entry
            return id_
        else:
            raise Exception('Entry is not a dict object')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号