Graybyt3 Was Here
Linux cloud.locucionar.com 3.10.0-1160.81.1.el7.x86_64 #1 SMP Fri Dec 16 17:29:43 UTC 2022 x86_64
Apache
91.191.211.241
/
lib
/
python2.7
/
site-packages
/
future
/
builtins
[ HOME ]
Exec
Submit
File Name : newsuper.pyc
� ,�]c @@ s d Z d d l m Z d d l Z d d l m Z d d l m Z m Z e Z e � Z e e d d � Z d � Z d g Z d S( sh This module provides a newsuper() function in Python 2 that mimics the behaviour of super() in Python 3. It is designed to be used as follows: from __future__ import division, absolute_import, print_function from future.builtins import super And then, for example: class VerboseList(list): def append(self, item): print('Adding an item') super().append(item) # new simpler super() function Importing this module on Python 3 has no effect. This is based on (i.e. almost identical to) Ryan Kelly's magicsuper module here: https://github.com/rfk/magicsuper.git Excerpts from Ryan's docstring: "Of course, you can still explicitly pass in the arguments if you want to do something strange. Sometimes you really do want that, e.g. to skip over some classes in the method resolution order. "How does it work? By inspecting the calling frame to determine the function object being executed and the object on which it's being called, and then walking the object's __mro__ chain to find out where that function was defined. Yuck, but it seems to work..." i ( t absolute_importN( t FunctionType( t PY3t PY26i c C@ s� | t k r�t j | � } y | j | j j d } Wn# t t f k r[ t d � � n Xy | j } WnG t t f k r� y | j j } Wq� t k r� t d � � q� Xn Xx� | D]� } x� | j j � D]� } yh xa t | t � s<t | t � r| j } q� y | j } Wq� t k r8| j | | � } q� Xq� WWn t t f k rZq� n X| j | j k r� Pq� q� Wq� Pq� Wt d � � n | t k r�t | | � St | � S( s� Like builtin super(), but capable of magic. This acts just like the builtin super() function, but if called without any arguments it attempts to infer them at runtime. i s'