当前位置: 首页>>代码示例>>Python>>正文


Python abc.abstractmethod方法代码示例

本文整理汇总了Python中collections.abc.abstractmethod方法的典型用法代码示例。如果您正苦于以下问题:Python abc.abstractmethod方法的具体用法?Python abc.abstractmethod怎么用?Python abc.abstractmethod使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在collections.abc的用法示例。


在下文中一共展示了abc.abstractmethod方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getAltName

# 需要导入模块: from collections import abc [as 别名]
# 或者: from collections.abc import abstractmethod [as 别名]
def getAltName(tag):
        """An `abstractmethod`, gives the alternate name of _tag_ or `None`

        # Parameters

        _tag_ : `str`

        > The requested tag

        # Returns

        `str`

        > The alternate name of _tag_ or `None`
        """
        return None #Default to Null case 
开发者ID:UWNETLAB,项目名称:metaknowledge,代码行数:18,代码来源:mkRecord.py

示例2: tagProcessingFunc

# 需要导入模块: from collections import abc [as 别名]
# 或者: from collections.abc import abstractmethod [as 别名]
def tagProcessingFunc(tag):
        """An `abstractmethod`, gives the function for processing _tag_

        # Parameters

        _tag_ : `optional [str]`

        > The tag in need of processing

        # Returns

        `function`

        > The function to process the raw tag
        """
        #Should not raise an exception
        return lambda x: x 
开发者ID:UWNETLAB,项目名称:metaknowledge,代码行数:19,代码来源:mkRecord.py

示例3: writeRecord

# 需要导入模块: from collections import abc [as 别名]
# 或者: from collections.abc import abstractmethod [as 别名]
def writeRecord(self, infile):
        """An `abstractmethod`, writes the record in its original form to _infile_

        # Parameters

        _infile_ : `writable file`

        > The file to be written to
        """
        pass 
开发者ID:UWNETLAB,项目名称:metaknowledge,代码行数:12,代码来源:mkRecord.py

示例4: encoding

# 需要导入模块: from collections import abc [as 别名]
# 或者: from collections.abc import abstractmethod [as 别名]
def encoding(self):
        """An `abstractmethod`, gives the encoding string of the record.

        # Returns

        `str`

        > The encoding
        """
        return 'utf-8' #Most likely to be the encoding 
开发者ID:UWNETLAB,项目名称:metaknowledge,代码行数:12,代码来源:mkRecord.py

示例5: specialFuncs

# 需要导入模块: from collections import abc [as 别名]
# 或者: from collections.abc import abstractmethod [as 别名]
def specialFuncs(self, key):
        """An `abstractmethod`, process the special tag, _key_ using the whole `Record`

        # Parameters

        _key_ : `str`

        > One of the special tags: `'authorsFull'`, `'keywords'`, `'grants'`, `'j9'`, `'authorsShort'`, `'volume'`, `'selfCitation'`, `'citations'`, `'address'`, `'abstract'`, `'title'`, `'month'`, `'year'`, `'journal'`, `'beginningPage'` and `'DOI'`

        # Returns

        > The processed value of _key_
        """
        raise KeyError("There are no special functions given by default.") 
开发者ID:UWNETLAB,项目名称:metaknowledge,代码行数:16,代码来源:mkRecord.py

示例6: test_abstract

# 需要导入模块: from collections import abc [as 别名]
# 或者: from collections.abc import abstractmethod [as 别名]
def test_abstract(self):
        class Abstract(abc.ABCMeta):

            @abc.abstractmethod
            def add(self, x, y):
                pass

            add5 = functools.partialmethod(add, 5)

        self.assertTrue(Abstract.add.__isabstractmethod__)
        self.assertTrue(Abstract.add5.__isabstractmethod__)

        for func in [self.A.static, self.A.cls, self.A.over_partial, self.A.nested, self.A.both]:
            self.assertFalse(getattr(func, '__isabstractmethod__', False)) 
开发者ID:bkerler,项目名称:android_universal,代码行数:16,代码来源:test_functools.py


注:本文中的collections.abc.abstractmethod方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。