示例#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__)