models.py 文件源码

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

项目:pyfc4 作者: ghukill 项目源码 文件源码
def create_resource(self, resource_type=None, uri=None):

        '''
        Convenience method for creating a new resource

        Note: A Resource is instantiated, but is not yet created.  Still requires resource.create().

        Args:
            uri (rdflib.term.URIRef, str): uri of resource to create
            resource_type (NonRDFSource (Binary), BasicContainer, DirectContainer, IndirectContainer):  resource type to create

        Returns:
            (NonRDFSource (Binary), BasicContainer, DirectContainer, IndirectContainer): instance of appropriate type
        '''

        if resource_type in [NonRDFSource, Binary, BasicContainer, DirectContainer, IndirectContainer]:
            return resource_type(self, uri)
        else:
            raise TypeError("expecting Resource type, such as BasicContainer or NonRDFSource")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号