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


Python builtins.super方法代码示例

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


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

示例1: __init__

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import super [as 别名]
def __init__(self, *args, **kwargs):
        # In the Python 2 stdlib, ModuleFinder is an old-style class that
        # does not inherit from object, therefore we cannot use super().
        modulefinder.ModuleFinder.__init__(self, *args, **kwargs)
        logger.Loggable.__init__(self)  # Enable logging via self.logger

        # Mapping of module object to a set of its dependencies. We store the
        # dependencies in a list instead of a set to preserve ordering. While
        # not strictly necessary, it makes testing easier when the ordering
        # of nodes in the graph can be relied on. However, we must ensure that
        # each dependency is unique, so we check before adding each new
        # dependency below. This should be a significant performance issue,
        # as we only expect each module to have a relatively small number
        # of dependencies (around 10s) so O(n) adding is acceptable.
        self._module_deps = collections.defaultdict(list)
        self._curr_caller = None
        self._module_nodes = {} 
开发者ID:Morgan-Stanley,项目名称:testplan,代码行数:19,代码来源:reloader.py

示例2: test_call_with_args_does_nothing

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import super [as 别名]
def test_call_with_args_does_nothing(self):
        if utils.PY2:
            from __builtin__ import super as builtin_super
        else:
            from builtins import super as builtin_super
        class Base(object):
            def calc(self,value):
                return 2 * value
        class Sub1(Base):
            def calc(self,value):
                return 7 + super().calc(value)
        class Sub2(Base):
            def calc(self,value):
                return super().calc(value) - 1
        class Diamond(Sub1,Sub2):
            def calc(self,value):
                return 3 * super().calc(value)
        for cls in (Base,Sub1,Sub2,Diamond,):
            obj = cls()
            self.assertSuperEquals(builtin_super(cls), super(cls))
            self.assertSuperEquals(builtin_super(cls,obj), super(cls,obj)) 
开发者ID:hughperkins,项目名称:kgsgo-dataset-preprocessor,代码行数:23,代码来源:test_magicsuper.py

示例3: cleanup

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import super [as 别名]
def cleanup(self):
        with self._condition:
            super().cleanup()
            if hasattr(self, '_pubnub'):
                self._pubnub.unsubscribe_all()

                # Pubnub doesn't close its open session, so do that ourselves
                # to free up sockets. We have to access a private attribute,
                # but this exists at least in (4.0.0 <= versions <= 4.0.11).
                # After closing the Session, remove it so that PubNub
                # can't reopen it.
                self._pubnub._request_handler.session.close()
                del self._pubnub._request_handler.session

                # The PubNub object is no longer usable.
                # Note that it can't be garbage collected because of circular
                # references, so this represents a (small) memory leak.
                del self._pubnub 
开发者ID:civisanalytics,项目名称:civis-python,代码行数:20,代码来源:futures.py

示例4: __init__

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import super [as 别名]
def __init__(self, from_template_id,
                 name=None,
                 hidden=True,
                 arguments=None,
                 max_n_retries=0,
                 client=None,
                 polling_interval=None,
                 inc_script_names=False):
        self.from_template_id = from_template_id
        self.arguments = arguments

        if name is None:
            date_str = datetime.datetime.today().strftime("%Y-%m-%d")
            name = "CustomScriptExecutorScript {}".format(date_str)

        super().__init__(name=name,
                         hidden=hidden,
                         client=client,
                         max_n_retries=max_n_retries,
                         polling_interval=polling_interval,
                         inc_script_names=inc_script_names) 
开发者ID:civisanalytics,项目名称:civis-python,代码行数:23,代码来源:futures.py

示例5: is_retry

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import super [as 别名]
def is_retry(self, method, status_code, has_retry_after=False):
        """ Is this method/status code retryable? (Based on whitelists and control
        variables such as the number of total retries to allow, whether to
        respect the Retry-After header, whether this header is present, and
        whether the returned status code is on the list of status codes to
        be retried upon on the presence of the aforementioned header)
        """
        if (self.total and
                self.respect_retry_after_header and
                has_retry_after and
                (status_code in self.RETRY_AFTER_STATUS_CODES)):
            return True

        else:
            return super().is_retry(method=method, status_code=status_code,
                                    has_retry_after=has_retry_after) 
开发者ID:civisanalytics,项目名称:civis-python,代码行数:18,代码来源:_utils.py

示例6: setData

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import super [as 别名]
def setData(self, data):
        """Add some data.
        
        Args:
            data (object): Object to add as data. This object has to be pickable. 
                Qt objects don't work!
        
        Raises:
            TypeError if data is not pickable
        """
        try:
            bytestream = pickle.dumps(data)
            super(MimeData, self).setData(self._mimeType, bytestream)
        except TypeError:
            raise TypeError(self.tr("can not pickle added data"))
        except:
            raise 
开发者ID:draperjames,项目名称:qtpandas,代码行数:19,代码来源:mime.py

示例7: __init__

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import super [as 别名]
def __init__(self, dfindex, column, value, dtype, parentId):
        """store dataframe information in a pickable object
        
        Args:
            dfindex (pandas.index): index of the dragged data.
            column (str): name of column to be dragged.
            value (object): value on according position.
            dtype (pandas dtype): data type of column.
            parentId (str): hex(id(...)) of according DataFrameModel.

        """
        super(PandasCellPayload, self).__init__()
        self.dfindex = dfindex
        self.column = column
        self.value = value
        self.dtype = dtype
        self.parentId = parentId 
开发者ID:draperjames,项目名称:qtpandas,代码行数:19,代码来源:mime.py

示例8: flags

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import super [as 别名]
def flags(self, index):
        """Returns the item flags for the given index as ored value, e.x.: Qt.ItemIsUserCheckable | Qt.ItemIsEditable

        If a combobox for bool values should pop up ItemIsEditable have to set for bool columns too.

        Args:
            index (QtCore.QModelIndex): Index to define column and row

        Returns:
            if column dtype is not boolean Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsEditable
            if column dtype is boolean Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsUserCheckable
        """
        flags = super(DataFrameModel, self).flags(index)

        if not self.editable:
            return flags

        col = self._dataFrame.columns[index.column()]
        if self._dataFrame[col].dtype == numpy.bool:
            flags |= Qt.ItemIsUserCheckable
        else:
            # if you want to have a combobox for bool columns set this
            flags |= Qt.ItemIsEditable

        return flags 
开发者ID:draperjames,项目名称:qtpandas,代码行数:27,代码来源:DataFrameModel.py

示例9: __init__

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import super [as 别名]
def __init__(self, part, *pin_ids, **criteria):

        # Don't use super() for this.
        SkidlBaseObject.__init__(self)

        # Remember the part that this unit belongs to.
        self.parent = part

        # Give the PartUnit the same information as the Part it is generated
        # from so it can act the same way, just with fewer pins.
        for k, v in list(part.__dict__.items()):
            self.__dict__[k] = v

        # Don't associate any units from the parent with this unit itself.
        self.unit = {}

        # Remove the pins copied from the parent and replace them with
        # pins selected from the parent.
        self.pins = []
        self.add_pins_from_parent(*pin_ids, **criteria) 
开发者ID:xesscorp,项目名称:skidl,代码行数:22,代码来源:Part.py

示例10: __init__

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import super [as 别名]
def __init__(self, attrs=None, mode='code', options=None, width=None, height=None):
        default_options = {
            'modes': ['text', 'code', 'tree', 'form', 'view'],
            'mode': mode,
            'search': True,
        }
        if options:
            default_options.update(options)

        self.options = default_options
        self.width = width
        self.height = height

        super(JSONEditorWidget, self).__init__(attrs=attrs) 
开发者ID:jmrivas86,项目名称:django-json-widget,代码行数:16,代码来源:widgets.py

示例11: get_context

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import super [as 别名]
def get_context(self, name, value, attrs):
        context = super().get_context(name, value, attrs)
        context['widget']['options'] = json.dumps(self.options)
        context['widget']['width'] = self.width
        context['widget']['height'] = self.height

        return context 
开发者ID:jmrivas86,项目名称:django-json-widget,代码行数:9,代码来源:widgets.py

示例12: __setattr__

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import super [as 别名]
def __setattr__(self, name, value):
        if name == 'queues' or name == 'api':
            super().__setattr__(name, value)
        else:
            return self.get_or_create_queue(context.System.device.deviceId).__setattr__(name, value) 
开发者ID:stevenleeg,项目名称:geemusic,代码行数:7,代码来源:music_queue.py

示例13: __hasattr__

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import super [as 别名]
def __hasattr__(self, name):
        if name == 'queues' or name == 'api':
            return super().__hasattr__(name)
        else:
            return self.get_or_create_queue(context.System.device.deviceId).__hasattr__(name) 
开发者ID:stevenleeg,项目名称:geemusic,代码行数:7,代码来源:music_queue.py

示例14: __getattr__

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import super [as 别名]
def __getattr__(self, name):
        if name == 'queues' or name == 'api':
            return super().__getattr__(name)
        else:
            return self.get_or_create_queue(context.System.device.deviceId).__getattribute__(name)  # object methods don't have __getattr__ 
开发者ID:stevenleeg,项目名称:geemusic,代码行数:7,代码来源:music_queue.py

示例15: find_class

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import super [as 别名]
def find_class(self, module, name):
            if module == '__main__' and name == 'Node':
                return Node
            else:
                return super().find_class(module, name) 
开发者ID:Aetf,项目名称:tensorflow-tbcnn,代码行数:7,代码来源:data.py


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