當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。