예제 #1
0
파일: entry.py 프로젝트: nagexiucai/pmdd
class TestForFromClassImportItsSundryAttributes:
    ClassAttribute = lambda: tprint("class attribute")
    def ordinaryMethod(self):
        tprint("ordinary method")
    @staticmethod
    def staticMethod():
        tprint("static method")
    @classmethod
    def classMethod(that):
        tprint("class method")
    def __repr__(self):
        tprint("magic method")
        return "test for from class import its sundry attributes"
예제 #2
0
파일: d.py 프로젝트: nagexiucai/pmdd
def __init__(this, *args, **kwargs):
    tprint("top __init__ function within a script is", type(__init__), "in",
           __file__, this, args, kwargs)
예제 #3
0
파일: d.py 프로젝트: nagexiucai/pmdd
from cfg import tprint

tprint("file is", __file__)
tprint("package is", __package__)

# TODO: 在脚本顶层定义以下魔法属性是然并卵的事情
# __new__
# __init__
# __call__
# __add__
# __del__
# __eq__
# __metaclass__
# __slot__

# TODO: 为何可以给模块对象动态添加却用不到下列方法
# def __getattr__(this, name):
#     tprint("get a none-existent attribute", name, "in", __file__)
# def __setattr__(this, name, entity):
#     tprint("set attribute", this, name, entity, "in", __file__)
# def __getattribute__(this, name):
#     tprint("get a defined attribute", name, "in", __file__)

__dict__ = {"name": "bob", "sex": "secret"}


def __init__(this, *args, **kwargs):
    tprint("top __init__ function within a script is", type(__init__), "in",
           __file__, this, args, kwargs)

예제 #4
0
파일: libe.py 프로젝트: nagexiucai/pmdd
def me():
    tprint("this is", me.__name__, "in", __file__)
예제 #5
0
파일: libe.py 프로젝트: nagexiucai/pmdd
from cfg import tprint


tprint("file is", __file__)
tprint("package is", __package__)


from operator import getitem
from collections import Counter


def me():
    tprint("this is", me.__name__, "in", __file__)


from explicit.intricacy import *


# 测试相对引入
# from ..implicit import libi  # attempted relative import beyond top-level package
from .intricacy import *
예제 #6
0
def c():
    tprint("this is", c.__name__, "in", __file__)
예제 #7
0
파일: entry.py 프로젝트: nagexiucai/pmdd
 def __repr__(self):
     tprint("magic method")
     return "test for from class import its sundry attributes"
예제 #8
0
def __init__(this, *args, **kwargs):
    tprint("top __init__ function within folder module's __init__.py", this,
           args, kwargs, "in", __file__)
예제 #9
0
파일: entry.py 프로젝트: nagexiucai/pmdd
 def staticMethod():
     tprint("static method")
예제 #10
0
파일: entry.py 프로젝트: nagexiucai/pmdd
 def ordinaryMethod(self):
     tprint("ordinary method")
예제 #11
0
파일: b.py 프로젝트: nagexiucai/pmdd
def b():
    tprint("this is", b.__name__, "in", __file__)
예제 #12
0
def init():
    tprint("this is", __file__, init.__name__, "in", __file__)
예제 #13
0
 def __init__(self):
     tprint("i am", self.__class__.__name__, "in", __file__)
예제 #14
0
from cfg import tprint, tpprint

tprint("file is", __file__)
tprint("package is", __package__)


def init():
    tprint("this is", __file__, init.__name__, "in", __file__)


class Init(object):
    def __init__(self):
        tprint("i am", self.__class__.__name__, "in", __file__)


def me():
    tprint("this is", me.__name__, "in", __file__)


from momus import c

c.c()
c.cc()

import momus
tprint("folder without __init__.py is", type(momus), "in", __file__,
       dir(momus))
tprint("script under folder without __init__ attribute is", type(c), "in",
       __file__, dir(c))

from momus import d
예제 #15
0
파일: d.py 프로젝트: nagexiucai/pmdd
def dd():
    tprint("this is", dd.__name__, "in", __file__)
예제 #16
0
파일: entry.py 프로젝트: nagexiucai/pmdd
 def classMethod(that):
     tprint("class method")
예제 #17
0
파일: d.py 프로젝트: nagexiucai/pmdd
 def __init__(self):
     tprint("classic class in newer python is normal class automatically")
예제 #18
0
파일: a.py 프로젝트: nagexiucai/pmdd
def a():
    tprint("this is", a.__name__, "in", __file__)