diff --git a/call.bat b/call.bat new file mode 100644 index 0000000..c72a926 --- /dev/null +++ b/call.bat @@ -0,0 +1,39 @@ +pyreverse 创建型模式-徎猎J-元类.py -p 创建型模式-徎猎J-元类.py +pyreverse 创建型模式-徎猎J-装饰器版本.py -p 创建型模式-徎猎J-装饰器版本.py +pyreverse 创建型模式-徎猎J.py -p 创建型模式-徎猎J.py +pyreverse 创建型模式-单例模式-元类.py -p 创建型模式-单例模式-元类.py +pyreverse 创建型模式-单例模式-装饰器.py -p 创建型模式-单例模式-装饰器.py +pyreverse 创建型模式-单例模式-重写new但不每次执行init方式.py -p 创建型模式-单例模式-重写new但不每次执行init方式.py +pyreverse 创建型模式-单例模式.py -p 创建型模式-单例模式.py +pyreverse 创建型模式-原型模式.py -p 创建型模式-原型模式.py +pyreverse 创建型模式-对徎页啬J.py -p 创建型模式-对徎页啬J.py +pyreverse 创建型模式-建造者模式.py -p 创建型模式-建造者模式.py +pyreverse 创建型模式-抽徎夜こJ.py -p 创建型模式-抽徎夜こJ.py +pyreverse 创建型模式-简单工厂模式.py -p 创建型模式-简单工厂模式.py +pyreverse 结构型模式-mvc模式.py -p 结构型模式-mvc模式.py +pyreverse 结构型模式-代理模式.py -p 结构型模式-代理模式.py +pyreverse 结构型模式-外观模式.py -p 结构型模式-外观模式.py +pyreverse 结构型模式-桥接模式.py -p 结构型模式-桥接模式.py +pyreverse 结构型模式-组合模式.py -p 结构型模式-组合模式.py +pyreverse 结构型模式-装饰者模式-函数装饰器.py -p 结构型模式-装饰者模式-函数装饰器.py +pyreverse 结构型模式-装饰者模式-类装饰器.py -p 结构型模式-装饰者模式-类装饰器.py +pyreverse 结构型模式-装饰者模式.py -p 结构型模式-装饰者模式.py +pyreverse 结构型模式-适配器模式.py -p 结构型模式-适配器模式.py +pyreverse 行为型模式-中介者模式.py -p 行为型模式-中介者模式.py +pyreverse 行为型模式-发布订阅模式.py -p 行为型模式-发布订阅模式.py +pyreverse 行为型模式-命令模式.py -p 行为型模式-命令模式.py +pyreverse 行为型模式-备忘录模式.py -p 行为型模式-备忘录模式.py +pyreverse 行为型模式-延迟计算缓存模式.py -p 行为型模式-延迟计算缓存模式.py +pyreverse 行为型模式-模板模式.py -p 行为型模式-模板模式.py +pyreverse 行为型模式-状态模式.py -p 行为型模式-状态模式.py +pyreverse 行为型模式-登记模式.py -p 行为型模式-登记模式.py +pyreverse 行为型模式-策略模式.py -p 行为型模式-策略模式.py +pyreverse 行为型模式-观察者模式-重新实徍救罩鞠低.py -p 行为型模式-观察者模式-重新实徍救罩鞠低.py +pyreverse 行为型模式-解释器模式.py -p 行为型模式-解释器模式.py +pyreverse 行为型模式-访问者模式.py -p 行为型模式-访问者模式.py +pyreverse 行为型模式-责任链模式.py -p 行为型模式-责任链模式.py +pyreverse 行为型模式-过滤器模式.py -p 行为型模式-过滤器模式.py +pyreverse 行为型模式-迭代器模式-使用类.py -p 行为型模式-迭代器模式-使用类.py +pyreverse 行为型模式-迭代器模式.py -p 行为型模式-迭代器模式.py +pyreverse 行为型模式-迭代器模式3.py -p 行为型模式-迭代器模式3.py + diff --git "a/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-344边272边253边345边205边203边346边250边241边345边274边217边-345边205边203边347边261边273边.py.dot" "b/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-344边272边253边345边205边203边346边250边241边345边274边217边-345边205边203边347边261边273边.py.dot" new file mode 100644 index 0000000..752a6dc --- /dev/null +++ "b/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-344边272边253边345边205边203边346边250边241边345边274边217边-345边205边203边347边261边273边.py.dot" @@ -0,0 +1,7 @@ +digraph "classes_???寤哄??妯″??-浜????妯″??-???绫?.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"???寤哄??妯″??-浜????妯″??-???绫?.A" [color="black", fontcolor="black", label=<{a|
|}>, shape="record", style="solid"]; +"???寤哄??妯″??-浜????妯″??-???绫?.FlyweightMetaClass" [color="black", fontcolor="black", label=<{flyweightmetaclass|
|}>, shape="record", style="solid"]; +} diff --git "a/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-344边272边253边345边205边203边346边250边241边345边274边217边-350边243边205边351边245边260边345边231边250边347边211边210边346边234边254边.py.dot" "b/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-344边272边253边345边205边203边346边250边241边345边274边217边-350边243边205边351边245边260边345边231边250边347边211边210边346边234边254边.py.dot" new file mode 100644 index 0000000..b9f25cb --- /dev/null +++ "b/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-344边272边253边345边205边203边346边250边241边345边274边217边-350边243边205边351边245边260边345边231边250边347边211边210边346边234边254边.py.dot" @@ -0,0 +1,6 @@ +digraph "classes_???寤哄??妯″??-浜????妯″??-瑁?楗板???????.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"???寤哄??妯″??-浜????妯″??-瑁?楗板???????.A" [color="black", fontcolor="black", label=<{a|identity
|eat()
}>, shape="record", style="solid"]; +} diff --git "a/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-344边272边253边345边205边203边346边250边241边345边274边217边.py.dot" "b/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-344边272边253边345边205边203边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..dbd24bd --- /dev/null +++ "b/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-344边272边253边345边205边203边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,6 @@ +digraph "classes_???寤哄??妯″??-浜????妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"???寤哄??妯″??-浜????妯″??.A" [color="black", fontcolor="black", label=<{a|identity
pool : dict
|eat()
}>, shape="record", style="solid"]; +} diff --git "a/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边-345边205边203边347边261边273边.py.dot" "b/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边-345边205边203边347边261边273边.py.dot" new file mode 100644 index 0000000..855806a --- /dev/null +++ "b/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边-345边205边203边347边261边273边.py.dot" @@ -0,0 +1,7 @@ +digraph "classes_???寤哄??妯″??-???渚?妯″??-???绫?.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"???寤哄??妯″??-???渚?妯″??-???绫?.A" [color="black", fontcolor="black", label=<{a|identity
|eat()
}>, shape="record", style="solid"]; +"???寤哄??妯″??-???渚?妯″??-???绫?.Singleton" [color="black", fontcolor="black", label=<{singleton|
|}>, shape="record", style="solid"]; +} diff --git "a/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边-350边243边205边351边245边260边345边231边250边.py.dot" "b/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边-350边243边205边351边245边260边345边231边250边.py.dot" new file mode 100644 index 0000000..48c4d9b --- /dev/null +++ "b/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边-350边243边205边351边245边260边345边231边250边.py.dot" @@ -0,0 +1,6 @@ +digraph "classes_???寤哄??妯″??-???渚?妯″??-瑁?楗板??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"???寤哄??妯″??-???渚?妯″??-瑁?楗板??.A" [color="black", fontcolor="black", label=<{a|identity
|eat()
}>, shape="record", style="solid"]; +} diff --git "a/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边-351边207边215边345边206边231边new344边275边206边344边270边215边346边257边217边346边254边241边346边211边247边350边241边214边init346边226边271边345边274边217边.py.dot" "b/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边-351边207边215边345边206边231边new344边275边206边344边270边215边346边257边217边346边254边241边346边211边247边350边241边214边init346边226边271边345边274边217边.py.dot" new file mode 100644 index 0000000..6013495 --- /dev/null +++ "b/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边-351边207边215边345边206边231边new344边275边206边344边270边215边346边257边217边346边254边241边346边211边247边350边241边214边init346边226边271边345边274边217边.py.dot" @@ -0,0 +1,6 @@ +digraph "classes_???寤哄??妯″??-???渚?妯″??-??????new浣?涓?姣忔?ц??init??瑰??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"???寤哄??妯″??-???渚?妯″??-??????new浣?涓?姣忔?ц??init??瑰??.A" [color="black", fontcolor="black", label=<{a|identity
|eat()
}>, shape="record", style="solid"]; +} diff --git "a/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边.py.dot" "b/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..59f1628 --- /dev/null +++ "b/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,6 @@ +digraph "classes_???寤哄??妯″??-???渚?妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"???寤哄??妯″??-???渚?妯″??.A" [color="black", fontcolor="black", label=<{a|identity
|eat()
}>, shape="record", style="solid"]; +} diff --git "a/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边216边237边345边236边213边346边250边241边345边274边217边.py.dot" "b/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边216边237边345边236边213边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..f28aec4 --- /dev/null +++ "b/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边216边237边345边236边213边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,7 @@ +digraph "classes_???寤哄??妯″??-??????妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"???寤哄??妯″??-??????妯″??.Book" [color="black", fontcolor="black", label=<{book|authors
name
price
|}>, shape="record", style="solid"]; +"???寤哄??妯″??-??????妯″??.Prototype" [color="black", fontcolor="black", label=<{prototype|objects : dict
|clone(identifier)
register(identifier, obj)
unregister(identifier)
}>, shape="record", style="solid"]; +} diff --git "a/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边257边271边350边261边241边346边261边240边346边250边241边345边274边217边.py.dot" "b/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边257边271边350边261边241边346边261边240边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..1b5f03a --- /dev/null +++ "b/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边257边271边350边261边241边346边261边240边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,6 @@ +digraph "classes_???寤哄??妯″??-瀵硅薄姹?妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"???寤哄??妯″??-瀵硅薄姹?妯″??.QueueObject" [color="black", fontcolor="black", label=<{queueobject|object : NoneType
|}>, shape="record", style="solid"]; +} diff --git "a/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边273边272边351边200边240边350边200边205边346边250边241边345边274边217边.py.dot" "b/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边273边272边351边200边240边350边200边205边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..7ed3a2e --- /dev/null +++ "b/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边273边272边351边200边240边350边200边205边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,16 @@ +digraph "classes_???寤哄??妯″??-寤洪?????妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"???寤哄??妯″??-寤洪?????妯″??.AbsBuilder" [color="black", fontcolor="black", label=<{absbuilder|building : NoneType
|build_floor()
build_size()
new_building()
}>, shape="record", style="solid"]; +"???寤哄??妯″??-寤洪?????妯″??.Building" [color="black", fontcolor="black", label=<{building|floor : str, NoneType
size : str, NoneType
|}>, shape="record", style="solid"]; +"???寤哄??妯″??-寤洪?????妯″??.Client" [color="black", fontcolor="black", label=<{client|
|build(build_type)
}>, shape="record", style="solid"]; +"???寤哄??妯″??-寤洪?????妯″??.Director" [color="black", fontcolor="black", label=<{director|builder : NoneType
|construct_building()
get_building()
}>, shape="record", style="solid"]; +"???寤哄??妯″??-寤洪?????妯″??.FlatBuilder" [color="black", fontcolor="black", label=<{flatbuilder|
|build_floor()
build_size()
}>, shape="record", style="solid"]; +"???寤哄??妯″??-寤洪?????妯″??.HouseBuilder" [color="black", fontcolor="black", label=<{housebuilder|
|build_floor()
build_size()
}>, shape="record", style="solid"]; +"???寤哄??妯″??-寤洪?????妯″??.FlatBuilder" -> "???寤哄??妯″??-寤洪?????妯″??.AbsBuilder" [arrowhead="empty", arrowtail="none"]; +"???寤哄??妯″??-寤洪?????妯″??.HouseBuilder" -> "???寤哄??妯″??-寤洪?????妯″??.AbsBuilder" [arrowhead="empty", arrowtail="none"]; +"???寤哄??妯″??-寤洪?????妯″??.Building" -> "???寤哄??妯″??-寤洪?????妯″??.AbsBuilder" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="building", style="solid"]; +"???寤哄??妯″??-寤洪?????妯″??.FlatBuilder" -> "???寤哄??妯″??-寤洪?????妯″??.Director" [arrowhead="odiamond", arrowtail="none", fontcolor="green", label="builder", style="solid"]; +"???寤哄??妯″??-寤洪?????妯″??.HouseBuilder" -> "???寤哄??妯″??-寤洪?????妯″??.Director" [arrowhead="odiamond", arrowtail="none", fontcolor="green", label="builder", style="solid"]; +} diff --git "a/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-346边212边275边350边261边241边345边267边245边345边216边202边346边250边241边345边274边217边.py.dot" "b/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-346边212边275边350边261边241边345边267边245边345边216边202边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..bb85f70 --- /dev/null +++ "b/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-346边212边275边350边261边241边345边267边245边345边216边202边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,12 @@ +digraph "classes_???寤哄??妯″??-??借薄宸ュ??妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"???寤哄??妯″??-??借薄宸ュ??妯″??.Apple5" [color="black", fontcolor="black", label=<{apple5|phone_name : str
|send_msg()
}>, shape="record", style="solid"]; +"???寤哄??妯″??-??借薄宸ュ??妯″??.Apple6" [color="black", fontcolor="black", label=<{apple6|phone_name : str
|send_msg()
}>, shape="record", style="solid"]; +"???寤哄??妯″??-??借薄宸ュ??妯″??.AppleFactory" [color="black", fontcolor="black", label=<{applefactory|
|get_phone(phone_type)
}>, shape="record", style="solid"]; +"???寤哄??妯″??-??借薄宸ュ??妯″??.FactoryProducer" [color="black", fontcolor="black", label=<{factoryproducer|
|get_factory(factory_name)
}>, shape="record", style="solid"]; +"???寤哄??妯″??-??借薄宸ュ??妯″??.XiaomFactory" [color="black", fontcolor="black", label=<{xiaomfactory|
|get_phone(phone_type)
}>, shape="record", style="solid"]; +"???寤哄??妯″??-??借薄宸ュ??妯″??.Xiaomi5" [color="black", fontcolor="black", label=<{xiaomi5|phone_name : str
|send_msg()
}>, shape="record", style="solid"]; +"???寤哄??妯″??-??借薄宸ュ??妯″??.Xiaomi6" [color="black", fontcolor="black", label=<{xiaomi6|phone_name : str
|send_msg()
}>, shape="record", style="solid"]; +} diff --git "a/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-347边256边200边345边215边225边345边267边245边345边216边202边346边250边241边345边274边217边.py.dot" "b/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-347边256边200边345边215边225边345边267边245边345边216边202边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..e6f4717 --- /dev/null +++ "b/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-347边256边200边345边215边225边345边267边245边345边216边202边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,7 @@ +digraph "classes_???寤哄??妯″??-绠????宸ュ??妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"???寤哄??妯″??-绠????宸ュ??妯″??.Xiaomi5" [color="black", fontcolor="black", label=<{xiaomi5|phone_name : str
|send_msg()
}>, shape="record", style="solid"]; +"???寤哄??妯″??-绠????宸ュ??妯″??.Xiaomi6" [color="black", fontcolor="black", label=<{xiaomi6|phone_name : str
|send_msg()
}>, shape="record", style="solid"]; +} diff --git "a/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-mvc346边250边241边345边274边217边.py.dot" "b/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-mvc346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..cfb48f7 --- /dev/null +++ "b/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-mvc346边250边241边345边274边217边.py.dot" @@ -0,0 +1,10 @@ +digraph "classes_缁???????妯″??-mvc妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"缁???????妯″??-mvc妯″??.QuoteModel" [color="black", fontcolor="black", label=<{quotemodel|
|get_quote(n)
}>, shape="record", style="solid"]; +"缁???????妯″??-mvc妯″??.QuoteTerminalController" [color="black", fontcolor="black", label=<{quoteterminalcontroller|model
view
|run()
}>, shape="record", style="solid"]; +"缁???????妯″??-mvc妯″??.QuoteTerminalView" [color="black", fontcolor="black", label=<{quoteterminalview|
|error(msg)
select_quote()
show(quote)
}>, shape="record", style="solid"]; +"缁???????妯″??-mvc妯″??.QuoteModel" -> "缁???????妯″??-mvc妯″??.QuoteTerminalController" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="model", style="solid"]; +"缁???????妯″??-mvc妯″??.QuoteTerminalView" -> "缁???????妯″??-mvc妯″??.QuoteTerminalController" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="view", style="solid"]; +} diff --git "a/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-344边273边243边347边220边206边346边250边241边345边274边217边.py.dot" "b/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-344边273边243边347边220边206边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..5b4d5a8 --- /dev/null +++ "b/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-344边273边243边347边220边206边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,8 @@ +digraph "classes_缁???????妯″??-浠g??妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"缁???????妯″??-浠g??妯″??.Info" [color="black", fontcolor="black", label=<{info|protected
secret : str
|add(user)
read()
}>, shape="record", style="solid"]; +"缁???????妯″??-浠g??妯″??.SensitiveInfo" [color="black", fontcolor="black", label=<{sensitiveinfo|users : list
|add(user)
read()
}>, shape="record", style="solid"]; +"缁???????妯″??-浠g??妯″??.SensitiveInfo" -> "缁???????妯″??-浠g??妯″??.Info" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="protected", style="solid"]; +} diff --git "a/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-345边244边226边350边247边202边346边250边241边345边274边217边.py.dot" "b/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-345边244边226边350边247边202边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..7ad975d --- /dev/null +++ "b/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-345边244边226边350边247边202边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,12 @@ +digraph "classes_缁???????妯″??-澶?瑙?妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"缁???????妯″??-澶?瑙?妯″??.A" [color="black", fontcolor="black", label=<{a|
|jump()
run()
}>, shape="record", style="solid"]; +"缁???????妯″??-澶?瑙?妯″??.B" [color="black", fontcolor="black", label=<{b|
|jump()
run()
}>, shape="record", style="solid"]; +"缁???????妯″??-澶?瑙?妯″??.C" [color="black", fontcolor="black", label=<{c|
|jump()
run()
}>, shape="record", style="solid"]; +"缁???????妯″??-澶?瑙?妯″??.Facade" [color="black", fontcolor="black", label=<{facade|a
b
c
|jump()
run()
}>, shape="record", style="solid"]; +"缁???????妯″??-澶?瑙?妯″??.A" -> "缁???????妯″??-澶?瑙?妯″??.Facade" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="a", style="solid"]; +"缁???????妯″??-澶?瑙?妯″??.B" -> "缁???????妯″??-澶?瑙?妯″??.Facade" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="b", style="solid"]; +"缁???????妯″??-澶?瑙?妯″??.C" -> "缁???????妯″??-澶?瑙?妯″??.Facade" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="c", style="solid"]; +} diff --git "a/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-346边241边245边346边216边245边346边250边241边345边274边217边.py.dot" "b/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-346边241边245边346边216边245边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..c5041dd --- /dev/null +++ "b/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-346边241边245边346边216边245边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,9 @@ +digraph "classes_缁???????妯″??-妗ユˇ妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"缁???????妯″??-妗ユˇ妯″??.A" [color="black", fontcolor="black", label=<{a|
|run(name)
}>, shape="record", style="solid"]; +"缁???????妯″??-妗ユˇ妯″??.B" [color="black", fontcolor="black", label=<{b|
|run(name)
}>, shape="record", style="solid"]; +"缁???????妯″??-妗ユˇ妯″??.Bridge" [color="black", fontcolor="black", label=<{bridge|ager : str
classname
|bridge_run()
}>, shape="record", style="solid"]; +"缁???????妯″??-妗ユˇ妯″??.B" -> "缁???????妯″??-妗ユˇ妯″??.Bridge" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="classname", style="solid"]; +} diff --git "a/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-347边273边204边345边220边210边346边250边241边345边274边217边.py.dot" "b/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-347边273边204边345边220边210边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..50df8e8 --- /dev/null +++ "b/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-347边273边204边345边220边210边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,12 @@ +digraph "classes_缁???????妯″??-缁????妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"缁???????妯″??-缁????妯″??.Company" [color="black", fontcolor="black", label=<{company|name
name : str
|add(company)
display(depth)
line_of_duty()
remove(company)
}>, shape="record", style="solid"]; +"缁???????妯″??-缁????妯″??.ConcreteCompany" [color="black", fontcolor="black", label=<{concretecompany|childrencompany : NoneType
childrenCompany : list
|add(company)
display(depth)
line_of_duty()
remove(company)
}>, shape="record", style="solid"]; +"缁???????妯″??-缁????妯″??.FinanceDepartment" [color="black", fontcolor="black", label=<{financedepartment|
|display(depth)
line_of_duty()
}>, shape="record", style="solid"]; +"缁???????妯″??-缁????妯″??.HRDepartment" [color="black", fontcolor="black", label=<{hrdepartment|
|display(depth)
line_of_duty()
}>, shape="record", style="solid"]; +"缁???????妯″??-缁????妯″??.ConcreteCompany" -> "缁???????妯″??-缁????妯″??.Company" [arrowhead="empty", arrowtail="none"]; +"缁???????妯″??-缁????妯″??.FinanceDepartment" -> "缁???????妯″??-缁????妯″??.Company" [arrowhead="empty", arrowtail="none"]; +"缁???????妯″??-缁????妯″??.HRDepartment" -> "缁???????妯″??-缁????妯″??.Company" [arrowhead="empty", arrowtail="none"]; +} diff --git "a/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-350边243边205边351边245边260边350边200边205边346边250边241边345边274边217边-345边207边275边346边225边260边350边243边205边351边245边260边345边231边250边.py.dot" "b/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-350边243边205边351边245边260边350边200边205边346边250边241边345边274边217边-345边207边275边346边225边260边350边243边205边351边245边260边345边231边250边.py.dot" new file mode 100644 index 0000000..d01087d --- /dev/null +++ "b/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-350边243边205边351边245边260边350边200边205边346边250边241边345边274边217边-345边207边275边346边225边260边350边243边205边351边245边260边345边231边250边.py.dot" @@ -0,0 +1,5 @@ +digraph "classes_缁???????妯″??-瑁?楗拌??妯″??-??芥?拌??楗板??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +} diff --git "a/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-350边243边205边351边245边260边350边200边205边346边250边241边345边274边217边-347边261边273边350边243边205边351边245边260边345边231边250边.py.dot" "b/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-350边243边205边351边245边260边350边200边205边346边250边241边345边274边217边-347边261边273边350边243边205边351边245边260边345边231边250边.py.dot" new file mode 100644 index 0000000..5dd389a --- /dev/null +++ "b/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-350边243边205边351边245边260边350边200边205边346边250边241边345边274边217边-347边261边273边350边243边205边351边245边260边345边231边250边.py.dot" @@ -0,0 +1,7 @@ +digraph "classes_缁???????妯″??-瑁?楗拌??妯″??-绫昏??楗板??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"缁???????妯″??-瑁?楗拌??妯″??-绫昏??楗板??.Profiled" [color="black", fontcolor="black", label=<{profiled|ncalls : int
|}>, shape="record", style="solid"]; +"缁???????妯″??-瑁?楗拌??妯″??-绫昏??楗板??.Spam" [color="black", fontcolor="black", label=<{spam|
|bar(x)
}>, shape="record", style="solid"]; +} diff --git "a/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-350边243边205边351边245边260边350边200边205边346边250边241边345边274边217边.py.dot" "b/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-350边243边205边351边245边260边350边200边205边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..1caaf49 --- /dev/null +++ "b/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-350边243边205边351边245边260边350边200边205边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,7 @@ +digraph "classes_缁???????妯″??-瑁?楗拌??妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"缁???????妯″??-瑁?楗拌??妯″??.Foo" [color="black", fontcolor="black", label=<{foo|
|f1()
f2()
}>, shape="record", style="solid"]; +"缁???????妯″??-瑁?楗拌??妯″??.Foo_decorator" [color="black", fontcolor="black", label=<{foo_decorator|
|f1()
}>, shape="record", style="solid"]; +} diff --git "a/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-351边200边202边351边205边215边345边231边250边346边250边241边345边274边217边.py.dot" "b/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-351边200边202边351边205边215边345边231边250边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..6744b9b --- /dev/null +++ "b/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-351边200边202边351边205边215边345边231边250边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,9 @@ +digraph "classes_缁???????妯″??-?????????妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"缁???????妯″??-?????????妯″??.Adapter" [color="black", fontcolor="black", label=<{adapter|
|run()
speak()
}>, shape="record", style="solid"]; +"缁???????妯″??-?????????妯″??.Cat" [color="black", fontcolor="black", label=<{cat|name
|cat_run()
miaomiao()
}>, shape="record", style="solid"]; +"缁???????妯″??-?????????妯″??.Dog" [color="black", fontcolor="black", label=<{dog|name
|dog_run()
wangwang()
}>, shape="record", style="solid"]; +"缁???????妯″??-?????????妯″??.Sheep" [color="black", fontcolor="black", label=<{sheep|name
|miemie()
sheet_run()
}>, shape="record", style="solid"]; +} diff --git "a/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-344边270边255边344边273边213边350边200边205边346边250边241边345边274边217边.py.dot" "b/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-344边270边255边344边273边213边350边200边205边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..e877f86 --- /dev/null +++ "b/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-344边270边255边344边273边213边350边200边205边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,7 @@ +digraph "classes_琛?涓哄??妯″??-涓TEL?????妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"琛?涓哄??妯″??-涓TEL?????妯″??.ChatRoom" [color="black", fontcolor="black", label=<{chatroom|
|show_message(user, msg)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-涓TEL?????妯″??.User" [color="black", fontcolor="black", label=<{user|name
|send_msg(msg)
}>, shape="record", style="solid"]; +} diff --git "a/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边217边221边345边270边203边350边256边242边351边230边205边346边250边241边345边274边217边.py.dot" "b/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边217边221边345边270边203边350边256边242边351边230边205边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..74b699c --- /dev/null +++ "b/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边217边221边345边270边203边350边256边242边351边230边205边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,8 @@ +digraph "classes_琛?涓哄??妯″??-???甯?璁㈤??妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"琛?涓哄??妯″??-???甯?璁㈤??妯″??.Event" [color="black", fontcolor="black", label=<{event|client_list : dict
|listen(key, fn)
remove(key, fn)
trigger()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-???甯?璁㈤??妯″??.SalesOffice" [color="black", fontcolor="black", label=<{salesoffice|
|}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-???甯?璁㈤??妯″??.SalesOffice" -> "琛?涓哄??妯″??-???甯?璁㈤??妯″??.Event" [arrowhead="empty", arrowtail="none"]; +} diff --git "a/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边221边275边344边273边244边346边250边241边345边274边217边.py.dot" "b/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边221边275边344边273边244边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..e030efc --- /dev/null +++ "b/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边221边275边344边273边244边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,8 @@ +digraph "classes_琛?涓哄??妯″??-??戒护妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"琛?涓哄??妯″??-??戒护妯″??.CreateFile" [color="black", fontcolor="black", label=<{createfile|path
txt : str
|execute()
undo()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-??戒护妯″??.ReadFile" [color="black", fontcolor="black", label=<{readfile|path
|execute()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-??戒护妯″??.RenameFile" [color="black", fontcolor="black", label=<{renamefile|dest
src
|execute()
undo()
}>, shape="record", style="solid"]; +} diff --git "a/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边244边207边345边277边230边345边275边225边346边250边241边345边274边217边.py.dot" "b/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边244边207边345边277边230边345边275边225边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..52d5509 --- /dev/null +++ "b/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边244边207边345边277边230边345边275边225边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,8 @@ +digraph "classes_琛?涓哄??妯″??-澶?蹇?褰?妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"琛?涓哄??妯″??-澶?蹇?褰?妯″??.Caretaker" [color="black", fontcolor="black", label=<{caretaker|memento
|}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-澶?蹇?褰?妯″??.Memento" [color="black", fontcolor="black", label=<{memento|state
|}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-澶?蹇?褰?妯″??.Originator" [color="black", fontcolor="black", label=<{originator|state : str
|create_memento()
set_memento(memento)
show()
}>, shape="record", style="solid"]; +} diff --git "a/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边273边266边350边277边237边350边256边241边347边256边227边347边274边223边345边255边230边346边250边241边345边274边217边.py.dot" "b/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边273边266边350边277边237边350边256边241边347边256边227边347边274边223边345边255边230边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..7356786 --- /dev/null +++ "b/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边273边266边350边277边237边350边256边241边347边256边227边347边274边223边345边255边230边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,8 @@ +digraph "classes_琛?涓哄??妯″??-寤惰??璁$??缂?瀛?妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"琛?涓哄??妯″??-寤惰??璁$??缂?瀛?妯″??.FunctionResultCacher" [color="black", fontcolor="black", label=<{functionresultcacher|func_result_dict : dict
|cached_function_result_for_a_time(cache_time: float)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-寤惰??璁$??缂?瀛?妯″??.cached_class_property" [color="black", fontcolor="black", label=<{cached_class_property|func
|}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-寤惰??璁$??缂?瀛?妯″??.cached_instance_property" [color="black", fontcolor="black", label=<{cached_instance_property|func
|}>, shape="record", style="solid"]; +} diff --git "a/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-346边250边241边346边235边277边346边250边241边345边274边217边.py.dot" "b/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-346边250边241边346边235边277边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..4491c76 --- /dev/null +++ "b/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-346边250边241边346边235边277边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,8 @@ +digraph "classes_琛?涓哄??妯″??-妯℃?挎ā寮?.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"琛?涓哄??妯″??-妯℃?挎ā寮?.AbstractClass" [color="black", fontcolor="black", label=<{abstractclass|
|operation1()
operation2()
operation3()
template_method()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-妯℃?挎ā寮?.ConcreteClass" [color="black", fontcolor="black", label=<{concreteclass|
|operation1()
operation2()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-妯℃?挎ā寮?.ConcreteClass" -> "琛?涓哄??妯″??-妯℃?挎ā寮?.AbstractClass" [arrowhead="empty", arrowtail="none"]; +} diff --git "a/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-347边212边266边346边200边201边346边250边241边345边274边217边.py.dot" "b/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-347边212边266边346边200边201边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..8fe90b0 --- /dev/null +++ "b/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-347边212边266边346边200边201边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,14 @@ +digraph "classes_琛?涓哄??妯″??-??舵??妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"琛?涓哄??妯″??-??舵??妯″??.AmState" [color="black", fontcolor="black", label=<{amstate|name : str
pos : int
radio
stations : list
|toggle_amfm()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-??舵??妯″??.FmState" [color="black", fontcolor="black", label=<{fmstate|name : str
pos : int
radio
stations : list
|toggle_amfm()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-??舵??妯″??.Radio" [color="black", fontcolor="black", label=<{radio|amstate
fmstate
state
|scan()
toggle_amfm()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-??舵??妯″??.State" [color="black", fontcolor="black", label=<{state|pos : int
|scan()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-??舵??妯″??.AmState" -> "琛?涓哄??妯″??-??舵??妯″??.State" [arrowhead="empty", arrowtail="none"]; +"琛?涓哄??妯″??-??舵??妯″??.FmState" -> "琛?涓哄??妯″??-??舵??妯″??.State" [arrowhead="empty", arrowtail="none"]; +"琛?涓哄??妯″??-??舵??妯″??.AmState" -> "琛?涓哄??妯″??-??舵??妯″??.Radio" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="amstate", style="solid"]; +"琛?涓哄??妯″??-??舵??妯″??.AmState" -> "琛?涓哄??妯″??-??舵??妯″??.Radio" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="state", style="solid"]; +"琛?涓哄??妯″??-??舵??妯″??.FmState" -> "琛?涓哄??妯″??-??舵??妯″??.Radio" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="fmstate", style="solid"]; +} diff --git "a/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-347边231边273边350边256边260边346边250边241边345边274边217边.py.dot" "b/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-347边231边273边350边256边260边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..3b56248 --- /dev/null +++ "b/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-347边231边273边350边256边260边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,9 @@ +digraph "classes_琛?涓哄??妯″??-??昏彴铈ā??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"琛?涓哄??妯″??-??昏彴铈ā??.BaseRegisteredClass" [color="black", fontcolor="black", label=<{baseregisteredclass|
|}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-??昏彴铈ā??.ClassRegistree" [color="black", fontcolor="black", label=<{classregistree|
|}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-??昏彴铈ā??.RegistryHolder" [color="black", fontcolor="black", label=<{registryholder|registry : dict
|get_registry()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-??昏彴铈ā??.ClassRegistree" -> "琛?涓哄??妯″??-??昏彴铈ā??.BaseRegisteredClass" [arrowhead="empty", arrowtail="none"]; +} diff --git "a/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-347边255边226边347边225边245边346边250边241边345边274边217边.py.dot" "b/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-347边255边226边347边225边245边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..2f34025 --- /dev/null +++ "b/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-347边255边226边347边225边245边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,11 @@ +digraph "classes_琛?涓哄??妯″??-绛???ユā寮?.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"琛?涓哄??妯″??-绛???ユā寮?.FaultStrategy" [color="black", fontcolor="black", label=<{faultstrategy|
|process()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-绛???ユā寮?.NormalStrategy" [color="black", fontcolor="black", label=<{normalstrategy|
|process()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-绛???ユā寮?.Park" [color="black", fontcolor="black", label=<{park|
|geoProcess()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-绛???ユā寮?.Strategy" [color="black", fontcolor="black", label=<{strategy|
|process()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-绛???ユā寮?.FaultStrategy" -> "琛?涓哄??妯″??-绛???ユā寮?.Strategy" [arrowhead="empty", arrowtail="none"]; +"琛?涓哄??妯″??-绛???ユā寮?.NormalStrategy" -> "琛?涓哄??妯″??-绛???ユā寮?.Strategy" [arrowhead="empty", arrowtail="none"]; +} diff --git "a/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边247边202边345边257边237边350边200边205边346边250边241边345边274边217边-351边207边215边346边226边260边345边256边236边347边216边260边346边227边245边345边277边227边347边263边273边347边273边237边.py.dot" "b/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边247边202边345边257边237边350边200边205边346边250边241边345边274边217边-351边207边215边346边226边260边345边256边236边347边216边260边346边227边245边345边277边227边347边263边273边347边273边237边.py.dot" new file mode 100644 index 0000000..68b18aa --- /dev/null +++ "b/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边247边202边345边257边237边350边200边205边346边250边241边345边274边217边-351边207边215边346边226边260边345边256边236边347边216边260边346边227边245边345边277边227边347边263边273边347边273边237边.py.dot" @@ -0,0 +1,15 @@ +digraph "classes_琛?涓哄??妯″??-瑙?瀵????妯″??-?????板???〖??ュ??绯荤??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"琛?涓哄??妯″??-瑙?瀵????妯″??-?????板???〖??ュ??绯荤??.AbstractHandler" [color="black", fontcolor="black", label=<{abstracthandler|
|emit(record)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-瑙?瀵????妯″??-?????板???〖??ュ??绯荤??.DingdingHandler" [color="black", fontcolor="black", label=<{dingdinghandler|
|emit(record)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-瑙?瀵????妯″??-?????板???〖??ュ??绯荤??.FileHandler" [color="black", fontcolor="black", label=<{filehandler|
|emit(record)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-瑙?瀵????妯″??-?????板???〖??ュ??绯荤??.Logger" [color="black", fontcolor="black", label=<{logger|handlers : list
name
|add_handler(handler)
log(record: str)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-瑙?瀵????妯″??-?????板???〖??ュ??绯荤??.MailHandler" [color="black", fontcolor="black", label=<{mailhandler|
|emit(record)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-瑙?瀵????妯″??-?????板???〖??ュ??绯荤??.StreamHandler" [color="black", fontcolor="black", label=<{streamhandler|
|emit(record)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-瑙?瀵????妯″??-?????板???〖??ュ??绯荤??.DingdingHandler" -> "琛?涓哄??妯″??-瑙?瀵????妯″??-?????板???〖??ュ??绯荤??.AbstractHandler" [arrowhead="empty", arrowtail="none"]; +"琛?涓哄??妯″??-瑙?瀵????妯″??-?????板???〖??ュ??绯荤??.FileHandler" -> "琛?涓哄??妯″??-瑙?瀵????妯″??-?????板???〖??ュ??绯荤??.AbstractHandler" [arrowhead="empty", arrowtail="none"]; +"琛?涓哄??妯″??-瑙?瀵????妯″??-?????板???〖??ュ??绯荤??.MailHandler" -> "琛?涓哄??妯″??-瑙?瀵????妯″??-?????板???〖??ュ??绯荤??.AbstractHandler" [arrowhead="empty", arrowtail="none"]; +"琛?涓哄??妯″??-瑙?瀵????妯″??-?????板???〖??ュ??绯荤??.StreamHandler" -> "琛?涓哄??妯″??-瑙?瀵????妯″??-?????板???〖??ュ??绯荤??.AbstractHandler" [arrowhead="empty", arrowtail="none"]; +} diff --git "a/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边247边243边351边207边212边345边231边250边346边250边241边345边274边217边.py.dot" "b/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边247边243边351边207边212边345边231边250边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..87c32c2 --- /dev/null +++ "b/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边247边243边351边207边212边345边231边250边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,9 @@ +digraph "classes_琛?涓哄??妯″??-瑙i?????妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"琛?涓哄??妯″??-瑙i?????妯″??.Expression" [color="black", fontcolor="black", label=<{expression|
|execute(play_key, play_value)
interpret(context)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-瑙i?????妯″??.NormGuitar" [color="black", fontcolor="black", label=<{normguitar|
|execute(key, value)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-瑙i?????妯″??.PlayContext" [color="black", fontcolor="black", label=<{playcontext|play_text : NoneType
play_text : str
|}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-瑙i?????妯″??.NormGuitar" -> "琛?涓哄??妯″??-瑙i?????妯″??.Expression" [arrowhead="empty", arrowtail="none"]; +} diff --git "a/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边256边277边351边227边256边350边200边205边346边250边241边345边274边217边.py.dot" "b/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边256边277边351边227边256边350边200边205边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..5cfdea4 --- /dev/null +++ "b/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边256边277边351边227边256边350边200边205边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,12 @@ +digraph "classes_琛?涓哄??妯″??-璁块?缎??妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"琛?涓哄??妯″??-璁块?缎??妯″??.Accounting" [color="black", fontcolor="black", label=<{accounting|duty : str
id : str
|visit(year_data)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-璁块?缎??妯″??.Advisor" [color="black", fontcolor="black", label=<{advisor|duty : str
id : str
|visit(year_data)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-璁块?缎??妯″??.AnalyseData" [color="black", fontcolor="black", label=<{analysedata|datalist : list
|add_data(year_data)
remove_data(year_data)
visit()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-璁块?缎??妯″??.Audit" [color="black", fontcolor="black", label=<{audit|duty : str
id : str
|visit(year_data)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-璁块?缎??妯″??.Finance" [color="black", fontcolor="black", label=<{finance|cost : NoneType
history_cost : NoneType
history_salesvolume : NoneType
salesvolume : NoneType
|accept(visitor)
set_cost(value)
set_history_cost(value)
set_history_salesvolume(value)
set_salesvolume(value)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-璁块?缎??妯″??.Finance_year" [color="black", fontcolor="black", label=<{finance_year|analyst : list
year
|accept()
add_analyst(worker)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-璁块?缎??妯″??.Finance_year" -> "琛?涓哄??妯″??-璁块?缎??妯″??.Finance" [arrowhead="empty", arrowtail="none"]; +} diff --git "a/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边264边243边344边273边273边351边223边276边346边250边241边345边274边217边.py.dot" "b/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边264边243边344边273边273边351边223边276边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..ff9d4ad --- /dev/null +++ "b/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边264边243边344边273边273边351边223边276边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,13 @@ +digraph "classes_琛?涓哄??妯″??-璐d换??炬ā寮?.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"琛?涓哄??妯″??-璐d换??炬ā寮?.Event" [color="black", fontcolor="black", label=<{event|name
|}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-璐d换??炬ā寮?.MainWindow" [color="black", fontcolor="black", label=<{mainwindow|
|handle_close(event)
handle_default(event)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-璐d换??炬ā寮?.MsgText" [color="black", fontcolor="black", label=<{msgtext|
|handle_down(event)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-璐d换??炬ā寮?.SendDialog" [color="black", fontcolor="black", label=<{senddialog|
|handle_paint(event)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-璐d换??炬ā寮?.Widget" [color="black", fontcolor="black", label=<{widget|parent : NoneType
|handle(event)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-璐d换??炬ā寮?.MainWindow" -> "琛?涓哄??妯″??-璐d换??炬ā寮?.Widget" [arrowhead="empty", arrowtail="none"]; +"琛?涓哄??妯″??-璐d换??炬ā寮?.MsgText" -> "琛?涓哄??妯″??-璐d换??炬ā寮?.Widget" [arrowhead="empty", arrowtail="none"]; +"琛?涓哄??妯″??-璐d换??炬ā寮?.SendDialog" -> "琛?涓哄??妯″??-璐d换??炬ā寮?.Widget" [arrowhead="empty", arrowtail="none"]; +} diff --git "a/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边207边346边273边244边345边231边250边346边250边241边345边274边217边.py.dot" "b/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边207边346边273边244边345边231边250边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..8a72ed5 --- /dev/null +++ "b/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边207边346边273边244边345边231边250边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,21 @@ +digraph "classes_琛?涓哄??妯″??-杩?婊ゅ??妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"琛?涓哄??妯″??-杩?婊ゅ??妯″??.AndCriteria" [color="black", fontcolor="black", label=<{andcriteria|criteria
criteria_other
|meet_criteria(persons): list
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-杩?婊ゅ??妯″??.Criteria" [color="black", fontcolor="black", label=<{criteria|
|meet_criteria(persons): list
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-杩?婊ゅ??妯″??.CriteriaFemale" [color="black", fontcolor="black", label=<{criteriafemale|
|meet_criteria(persons): list
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-杩?婊ゅ??妯″??.CriteriaMale" [color="black", fontcolor="black", label=<{criteriamale|
|meet_criteria(persons): list
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-杩?婊ゅ??妯″??.CriteriaSingle" [color="black", fontcolor="black", label=<{criteriasingle|
|meet_criteria(persons): list
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-杩?婊ゅ??妯″??.OrCriteria" [color="black", fontcolor="black", label=<{orcriteria|criteria
criteria_other
|meet_criteria(persons): list
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-杩?婊ゅ??妯″??.Person" [color="black", fontcolor="black", label=<{person|marital_status
name
sex
|}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-杩?婊ゅ??妯″??.AndCriteria" -> "琛?涓哄??妯″??-杩?婊ゅ??妯″??.Criteria" [arrowhead="empty", arrowtail="none"]; +"琛?涓哄??妯″??-杩?婊ゅ??妯″??.CriteriaFemale" -> "琛?涓哄??妯″??-杩?婊ゅ??妯″??.Criteria" [arrowhead="empty", arrowtail="none"]; +"琛?涓哄??妯″??-杩?婊ゅ??妯″??.CriteriaMale" -> "琛?涓哄??妯″??-杩?婊ゅ??妯″??.Criteria" [arrowhead="empty", arrowtail="none"]; +"琛?涓哄??妯″??-杩?婊ゅ??妯″??.CriteriaSingle" -> "琛?涓哄??妯″??-杩?婊ゅ??妯″??.Criteria" [arrowhead="empty", arrowtail="none"]; +"琛?涓哄??妯″??-杩?婊ゅ??妯″??.OrCriteria" -> "琛?涓哄??妯″??-杩?婊ゅ??妯″??.Criteria" [arrowhead="empty", arrowtail="none"]; +"琛?涓哄??妯″??-杩?婊ゅ??妯″??.Criteria" -> "琛?涓哄??妯″??-杩?婊ゅ??妯″??.AndCriteria" [arrowhead="odiamond", arrowtail="none", fontcolor="green", label="criteria", style="solid"]; +"琛?涓哄??妯″??-杩?婊ゅ??妯″??.Criteria" -> "琛?涓哄??妯″??-杩?婊ゅ??妯″??.AndCriteria" [arrowhead="odiamond", arrowtail="none", fontcolor="green", label="criteria_other", style="solid"]; +"琛?涓哄??妯″??-杩?婊ゅ??妯″??.Criteria" -> "琛?涓哄??妯″??-杩?婊ゅ??妯″??.OrCriteria" [arrowhead="odiamond", arrowtail="none", fontcolor="green", label="criteria", style="solid"]; +"琛?涓哄??妯″??-杩?婊ゅ??妯″??.Criteria" -> "琛?涓哄??妯″??-杩?婊ゅ??妯″??.OrCriteria" [arrowhead="odiamond", arrowtail="none", fontcolor="green", label="criteria_other", style="solid"]; +} diff --git "a/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边255边344边273边243边345边231边250边346边250边241边345边274边217边-344边275边277边347边224边250边347边261边273边.py.dot" "b/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边255边344边273边243边345边231边250边346边250边241边345边274边217边-344边275边277边347边224边250边347边261边273边.py.dot" new file mode 100644 index 0000000..d86adad --- /dev/null +++ "b/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边255边344边273边243边345边231边250边346边250边241边345边274边217边-344边275边277边347边224边250边347边261边273边.py.dot" @@ -0,0 +1,6 @@ +digraph "classes_琛?涓哄??妯″??-杩TEL唬???妯″??-浣跨??被.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"琛?涓哄??妯″??-杩TEL唬???妯″??-浣跨??被.AccountIterator" [color="black", fontcolor="black", label=<{accountiterator|accounts
index : int
|}>, shape="record", style="solid"]; +} diff --git "a/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边255边344边273边243边345边231边250边346边250边241边345边274边217边.py.dot" "b/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边255边344边273边243边345边231边250边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..1d2e602 --- /dev/null +++ "b/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边255边344边273边243边345边231边250边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,11 @@ +digraph "classes_琛?涓哄??妯″??-杩TEL唬???妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"琛?涓哄??妯″??-杩TEL唬???妯″??.Aggregate" [color="black", fontcolor="black", label=<{aggregate|
|iterator()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-杩TEL唬???妯″??.ConcreteAggregate" [color="black", fontcolor="black", label=<{concreteaggregate|alist
|iterator()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-杩TEL唬???妯″??.ConcreteIterator" [color="black", fontcolor="black", label=<{concreteiterator|alist
|hasNext()
next()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-杩TEL唬???妯″??.Iterator" [color="black", fontcolor="black", label=<{iterator|
|hasNext()
next()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-杩TEL唬???妯″??.ConcreteAggregate" -> "琛?涓哄??妯″??-杩TEL唬???妯″??.Aggregate" [arrowhead="empty", arrowtail="none"]; +"琛?涓哄??妯″??-杩TEL唬???妯″??.ConcreteIterator" -> "琛?涓哄??妯″??-杩TEL唬???妯″??.Iterator" [arrowhead="empty", arrowtail="none"]; +} diff --git "a/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边255边344边273边243边345边231边250边346边250边241边345边274边2173边.py.dot" "b/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边255边344边273边243边345边231边250边346边250边241边345边274边2173边.py.dot" new file mode 100644 index 0000000..8e6e984 --- /dev/null +++ "b/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边255边344边273边243边345边231边250边346边250边241边345边274边2173边.py.dot" @@ -0,0 +1,5 @@ +digraph "classes_琛?涓哄??妯″??-杩TEL唬???妯″??3.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +} diff --git "a/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-344边272边253边345边205边203边346边250边241边345边274边217边-345边205边203边347边261边273边.py.dot" "b/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-344边272边253边345边205边203边346边250边241边345边274边217边-345边205边203边347边261边273边.py.dot" new file mode 100644 index 0000000..752a6dc --- /dev/null +++ "b/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-344边272边253边345边205边203边346边250边241边345边274边217边-345边205边203边347边261边273边.py.dot" @@ -0,0 +1,7 @@ +digraph "classes_???寤哄??妯″??-浜????妯″??-???绫?.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"???寤哄??妯″??-浜????妯″??-???绫?.A" [color="black", fontcolor="black", label=<{a|
|}>, shape="record", style="solid"]; +"???寤哄??妯″??-浜????妯″??-???绫?.FlyweightMetaClass" [color="black", fontcolor="black", label=<{flyweightmetaclass|
|}>, shape="record", style="solid"]; +} diff --git "a/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-344边272边253边345边205边203边346边250边241边345边274边217边-350边243边205边351边245边260边345边231边250边347边211边210边346边234边254边.py.dot" "b/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-344边272边253边345边205边203边346边250边241边345边274边217边-350边243边205边351边245边260边345边231边250边347边211边210边346边234边254边.py.dot" new file mode 100644 index 0000000..b9f25cb --- /dev/null +++ "b/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-344边272边253边345边205边203边346边250边241边345边274边217边-350边243边205边351边245边260边345边231边250边347边211边210边346边234边254边.py.dot" @@ -0,0 +1,6 @@ +digraph "classes_???寤哄??妯″??-浜????妯″??-瑁?楗板???????.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"???寤哄??妯″??-浜????妯″??-瑁?楗板???????.A" [color="black", fontcolor="black", label=<{a|identity
|eat()
}>, shape="record", style="solid"]; +} diff --git "a/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-344边272边253边345边205边203边346边250边241边345边274边217边.py.dot" "b/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-344边272边253边345边205边203边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..dbd24bd --- /dev/null +++ "b/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-344边272边253边345边205边203边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,6 @@ +digraph "classes_???寤哄??妯″??-浜????妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"???寤哄??妯″??-浜????妯″??.A" [color="black", fontcolor="black", label=<{a|identity
pool : dict
|eat()
}>, shape="record", style="solid"]; +} diff --git "a/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边-345边205边203边347边261边273边.py.dot" "b/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边-345边205边203边347边261边273边.py.dot" new file mode 100644 index 0000000..855806a --- /dev/null +++ "b/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边-345边205边203边347边261边273边.py.dot" @@ -0,0 +1,7 @@ +digraph "classes_???寤哄??妯″??-???渚?妯″??-???绫?.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"???寤哄??妯″??-???渚?妯″??-???绫?.A" [color="black", fontcolor="black", label=<{a|identity
|eat()
}>, shape="record", style="solid"]; +"???寤哄??妯″??-???渚?妯″??-???绫?.Singleton" [color="black", fontcolor="black", label=<{singleton|
|}>, shape="record", style="solid"]; +} diff --git "a/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边-350边243边205边351边245边260边345边231边250边.py.dot" "b/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边-350边243边205边351边245边260边345边231边250边.py.dot" new file mode 100644 index 0000000..48c4d9b --- /dev/null +++ "b/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边-350边243边205边351边245边260边345边231边250边.py.dot" @@ -0,0 +1,6 @@ +digraph "classes_???寤哄??妯″??-???渚?妯″??-瑁?楗板??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"???寤哄??妯″??-???渚?妯″??-瑁?楗板??.A" [color="black", fontcolor="black", label=<{a|identity
|eat()
}>, shape="record", style="solid"]; +} diff --git "a/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边-351边207边215边345边206边231边new344边275边206边344边270边215边346边257边217边346边254边241边346边211边247边350边241边214边init346边226边271边345边274边217边.py.dot" "b/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边-351边207边215边345边206边231边new344边275边206边344边270边215边346边257边217边346边254边241边346边211边247边350边241边214边init346边226边271边345边274边217边.py.dot" new file mode 100644 index 0000000..6013495 --- /dev/null +++ "b/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边-351边207边215边345边206边231边new344边275边206边344边270边215边346边257边217边346边254边241边346边211边247边350边241边214边init346边226边271边345边274边217边.py.dot" @@ -0,0 +1,6 @@ +digraph "classes_???寤哄??妯″??-???渚?妯″??-??????new浣?涓?姣忔?ц??init??瑰??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"???寤哄??妯″??-???渚?妯″??-??????new浣?涓?姣忔?ц??init??瑰??.A" [color="black", fontcolor="black", label=<{a|identity
|eat()
}>, shape="record", style="solid"]; +} diff --git "a/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边.py.dot" "b/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..59f1628 --- /dev/null +++ "b/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,6 @@ +digraph "classes_???寤哄??妯″??-???渚?妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"???寤哄??妯″??-???渚?妯″??.A" [color="black", fontcolor="black", label=<{a|identity
|eat()
}>, shape="record", style="solid"]; +} diff --git "a/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边216边237边345边236边213边346边250边241边345边274边217边.py.dot" "b/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边216边237边345边236边213边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..f28aec4 --- /dev/null +++ "b/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边216边237边345边236边213边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,7 @@ +digraph "classes_???寤哄??妯″??-??????妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"???寤哄??妯″??-??????妯″??.Book" [color="black", fontcolor="black", label=<{book|authors
name
price
|}>, shape="record", style="solid"]; +"???寤哄??妯″??-??????妯″??.Prototype" [color="black", fontcolor="black", label=<{prototype|objects : dict
|clone(identifier)
register(identifier, obj)
unregister(identifier)
}>, shape="record", style="solid"]; +} diff --git "a/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边257边271边350边261边241边346边261边240边346边250边241边345边274边217边.py.dot" "b/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边257边271边350边261边241边346边261边240边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..1b5f03a --- /dev/null +++ "b/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边257边271边350边261边241边346边261边240边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,6 @@ +digraph "classes_???寤哄??妯″??-瀵硅薄姹?妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"???寤哄??妯″??-瀵硅薄姹?妯″??.QueueObject" [color="black", fontcolor="black", label=<{queueobject|object : NoneType
|}>, shape="record", style="solid"]; +} diff --git "a/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边273边272边351边200边240边350边200边205边346边250边241边345边274边217边.py.dot" "b/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边273边272边351边200边240边350边200边205边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..7ed3a2e --- /dev/null +++ "b/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边273边272边351边200边240边350边200边205边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,16 @@ +digraph "classes_???寤哄??妯″??-寤洪?????妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"???寤哄??妯″??-寤洪?????妯″??.AbsBuilder" [color="black", fontcolor="black", label=<{absbuilder|building : NoneType
|build_floor()
build_size()
new_building()
}>, shape="record", style="solid"]; +"???寤哄??妯″??-寤洪?????妯″??.Building" [color="black", fontcolor="black", label=<{building|floor : str, NoneType
size : str, NoneType
|}>, shape="record", style="solid"]; +"???寤哄??妯″??-寤洪?????妯″??.Client" [color="black", fontcolor="black", label=<{client|
|build(build_type)
}>, shape="record", style="solid"]; +"???寤哄??妯″??-寤洪?????妯″??.Director" [color="black", fontcolor="black", label=<{director|builder : NoneType
|construct_building()
get_building()
}>, shape="record", style="solid"]; +"???寤哄??妯″??-寤洪?????妯″??.FlatBuilder" [color="black", fontcolor="black", label=<{flatbuilder|
|build_floor()
build_size()
}>, shape="record", style="solid"]; +"???寤哄??妯″??-寤洪?????妯″??.HouseBuilder" [color="black", fontcolor="black", label=<{housebuilder|
|build_floor()
build_size()
}>, shape="record", style="solid"]; +"???寤哄??妯″??-寤洪?????妯″??.FlatBuilder" -> "???寤哄??妯″??-寤洪?????妯″??.AbsBuilder" [arrowhead="empty", arrowtail="none"]; +"???寤哄??妯″??-寤洪?????妯″??.HouseBuilder" -> "???寤哄??妯″??-寤洪?????妯″??.AbsBuilder" [arrowhead="empty", arrowtail="none"]; +"???寤哄??妯″??-寤洪?????妯″??.Building" -> "???寤哄??妯″??-寤洪?????妯″??.AbsBuilder" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="building", style="solid"]; +"???寤哄??妯″??-寤洪?????妯″??.FlatBuilder" -> "???寤哄??妯″??-寤洪?????妯″??.Director" [arrowhead="odiamond", arrowtail="none", fontcolor="green", label="builder", style="solid"]; +"???寤哄??妯″??-寤洪?????妯″??.HouseBuilder" -> "???寤哄??妯″??-寤洪?????妯″??.Director" [arrowhead="odiamond", arrowtail="none", fontcolor="green", label="builder", style="solid"]; +} diff --git "a/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-346边212边275边350边261边241边345边267边245边345边216边202边346边250边241边345边274边217边.py.dot" "b/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-346边212边275边350边261边241边345边267边245边345边216边202边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..bb85f70 --- /dev/null +++ "b/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-346边212边275边350边261边241边345边267边245边345边216边202边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,12 @@ +digraph "classes_???寤哄??妯″??-??借薄宸ュ??妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"???寤哄??妯″??-??借薄宸ュ??妯″??.Apple5" [color="black", fontcolor="black", label=<{apple5|phone_name : str
|send_msg()
}>, shape="record", style="solid"]; +"???寤哄??妯″??-??借薄宸ュ??妯″??.Apple6" [color="black", fontcolor="black", label=<{apple6|phone_name : str
|send_msg()
}>, shape="record", style="solid"]; +"???寤哄??妯″??-??借薄宸ュ??妯″??.AppleFactory" [color="black", fontcolor="black", label=<{applefactory|
|get_phone(phone_type)
}>, shape="record", style="solid"]; +"???寤哄??妯″??-??借薄宸ュ??妯″??.FactoryProducer" [color="black", fontcolor="black", label=<{factoryproducer|
|get_factory(factory_name)
}>, shape="record", style="solid"]; +"???寤哄??妯″??-??借薄宸ュ??妯″??.XiaomFactory" [color="black", fontcolor="black", label=<{xiaomfactory|
|get_phone(phone_type)
}>, shape="record", style="solid"]; +"???寤哄??妯″??-??借薄宸ュ??妯″??.Xiaomi5" [color="black", fontcolor="black", label=<{xiaomi5|phone_name : str
|send_msg()
}>, shape="record", style="solid"]; +"???寤哄??妯″??-??借薄宸ュ??妯″??.Xiaomi6" [color="black", fontcolor="black", label=<{xiaomi6|phone_name : str
|send_msg()
}>, shape="record", style="solid"]; +} diff --git "a/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-347边256边200边345边215边225边345边267边245边345边216边202边346边250边241边345边274边217边.py.dot" "b/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-347边256边200边345边215边225边345边267边245边345边216边202边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..e6f4717 --- /dev/null +++ "b/dot/classes_345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-347边256边200边345边215边225边345边267边245边345边216边202边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,7 @@ +digraph "classes_???寤哄??妯″??-绠????宸ュ??妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"???寤哄??妯″??-绠????宸ュ??妯″??.Xiaomi5" [color="black", fontcolor="black", label=<{xiaomi5|phone_name : str
|send_msg()
}>, shape="record", style="solid"]; +"???寤哄??妯″??-绠????宸ュ??妯″??.Xiaomi6" [color="black", fontcolor="black", label=<{xiaomi6|phone_name : str
|send_msg()
}>, shape="record", style="solid"]; +} diff --git "a/dot/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-mvc346边250边241边345边274边217边.py.dot" "b/dot/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-mvc346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..cfb48f7 --- /dev/null +++ "b/dot/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-mvc346边250边241边345边274边217边.py.dot" @@ -0,0 +1,10 @@ +digraph "classes_缁???????妯″??-mvc妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"缁???????妯″??-mvc妯″??.QuoteModel" [color="black", fontcolor="black", label=<{quotemodel|
|get_quote(n)
}>, shape="record", style="solid"]; +"缁???????妯″??-mvc妯″??.QuoteTerminalController" [color="black", fontcolor="black", label=<{quoteterminalcontroller|model
view
|run()
}>, shape="record", style="solid"]; +"缁???????妯″??-mvc妯″??.QuoteTerminalView" [color="black", fontcolor="black", label=<{quoteterminalview|
|error(msg)
select_quote()
show(quote)
}>, shape="record", style="solid"]; +"缁???????妯″??-mvc妯″??.QuoteModel" -> "缁???????妯″??-mvc妯″??.QuoteTerminalController" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="model", style="solid"]; +"缁???????妯″??-mvc妯″??.QuoteTerminalView" -> "缁???????妯″??-mvc妯″??.QuoteTerminalController" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="view", style="solid"]; +} diff --git "a/dot/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-344边273边243边347边220边206边346边250边241边345边274边217边.py.dot" "b/dot/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-344边273边243边347边220边206边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..5b4d5a8 --- /dev/null +++ "b/dot/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-344边273边243边347边220边206边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,8 @@ +digraph "classes_缁???????妯″??-浠g??妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"缁???????妯″??-浠g??妯″??.Info" [color="black", fontcolor="black", label=<{info|protected
secret : str
|add(user)
read()
}>, shape="record", style="solid"]; +"缁???????妯″??-浠g??妯″??.SensitiveInfo" [color="black", fontcolor="black", label=<{sensitiveinfo|users : list
|add(user)
read()
}>, shape="record", style="solid"]; +"缁???????妯″??-浠g??妯″??.SensitiveInfo" -> "缁???????妯″??-浠g??妯″??.Info" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="protected", style="solid"]; +} diff --git "a/dot/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-345边244边226边350边247边202边346边250边241边345边274边217边.py.dot" "b/dot/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-345边244边226边350边247边202边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..7ad975d --- /dev/null +++ "b/dot/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-345边244边226边350边247边202边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,12 @@ +digraph "classes_缁???????妯″??-澶?瑙?妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"缁???????妯″??-澶?瑙?妯″??.A" [color="black", fontcolor="black", label=<{a|
|jump()
run()
}>, shape="record", style="solid"]; +"缁???????妯″??-澶?瑙?妯″??.B" [color="black", fontcolor="black", label=<{b|
|jump()
run()
}>, shape="record", style="solid"]; +"缁???????妯″??-澶?瑙?妯″??.C" [color="black", fontcolor="black", label=<{c|
|jump()
run()
}>, shape="record", style="solid"]; +"缁???????妯″??-澶?瑙?妯″??.Facade" [color="black", fontcolor="black", label=<{facade|a
b
c
|jump()
run()
}>, shape="record", style="solid"]; +"缁???????妯″??-澶?瑙?妯″??.A" -> "缁???????妯″??-澶?瑙?妯″??.Facade" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="a", style="solid"]; +"缁???????妯″??-澶?瑙?妯″??.B" -> "缁???????妯″??-澶?瑙?妯″??.Facade" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="b", style="solid"]; +"缁???????妯″??-澶?瑙?妯″??.C" -> "缁???????妯″??-澶?瑙?妯″??.Facade" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="c", style="solid"]; +} diff --git "a/dot/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-346边241边245边346边216边245边346边250边241边345边274边217边.py.dot" "b/dot/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-346边241边245边346边216边245边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..c5041dd --- /dev/null +++ "b/dot/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-346边241边245边346边216边245边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,9 @@ +digraph "classes_缁???????妯″??-妗ユˇ妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"缁???????妯″??-妗ユˇ妯″??.A" [color="black", fontcolor="black", label=<{a|
|run(name)
}>, shape="record", style="solid"]; +"缁???????妯″??-妗ユˇ妯″??.B" [color="black", fontcolor="black", label=<{b|
|run(name)
}>, shape="record", style="solid"]; +"缁???????妯″??-妗ユˇ妯″??.Bridge" [color="black", fontcolor="black", label=<{bridge|ager : str
classname
|bridge_run()
}>, shape="record", style="solid"]; +"缁???????妯″??-妗ユˇ妯″??.B" -> "缁???????妯″??-妗ユˇ妯″??.Bridge" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="classname", style="solid"]; +} diff --git "a/dot/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-347边273边204边345边220边210边346边250边241边345边274边217边.py.dot" "b/dot/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-347边273边204边345边220边210边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..50df8e8 --- /dev/null +++ "b/dot/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-347边273边204边345边220边210边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,12 @@ +digraph "classes_缁???????妯″??-缁????妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"缁???????妯″??-缁????妯″??.Company" [color="black", fontcolor="black", label=<{company|name
name : str
|add(company)
display(depth)
line_of_duty()
remove(company)
}>, shape="record", style="solid"]; +"缁???????妯″??-缁????妯″??.ConcreteCompany" [color="black", fontcolor="black", label=<{concretecompany|childrencompany : NoneType
childrenCompany : list
|add(company)
display(depth)
line_of_duty()
remove(company)
}>, shape="record", style="solid"]; +"缁???????妯″??-缁????妯″??.FinanceDepartment" [color="black", fontcolor="black", label=<{financedepartment|
|display(depth)
line_of_duty()
}>, shape="record", style="solid"]; +"缁???????妯″??-缁????妯″??.HRDepartment" [color="black", fontcolor="black", label=<{hrdepartment|
|display(depth)
line_of_duty()
}>, shape="record", style="solid"]; +"缁???????妯″??-缁????妯″??.ConcreteCompany" -> "缁???????妯″??-缁????妯″??.Company" [arrowhead="empty", arrowtail="none"]; +"缁???????妯″??-缁????妯″??.FinanceDepartment" -> "缁???????妯″??-缁????妯″??.Company" [arrowhead="empty", arrowtail="none"]; +"缁???????妯″??-缁????妯″??.HRDepartment" -> "缁???????妯″??-缁????妯″??.Company" [arrowhead="empty", arrowtail="none"]; +} diff --git "a/dot/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-350边243边205边351边245边260边350边200边205边346边250边241边345边274边217边-345边207边275边346边225边260边350边243边205边351边245边260边345边231边250边.py.dot" "b/dot/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-350边243边205边351边245边260边350边200边205边346边250边241边345边274边217边-345边207边275边346边225边260边350边243边205边351边245边260边345边231边250边.py.dot" new file mode 100644 index 0000000..d01087d --- /dev/null +++ "b/dot/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-350边243边205边351边245边260边350边200边205边346边250边241边345边274边217边-345边207边275边346边225边260边350边243边205边351边245边260边345边231边250边.py.dot" @@ -0,0 +1,5 @@ +digraph "classes_缁???????妯″??-瑁?楗拌??妯″??-??芥?拌??楗板??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +} diff --git "a/dot/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-350边243边205边351边245边260边350边200边205边346边250边241边345边274边217边-347边261边273边350边243边205边351边245边260边345边231边250边.py.dot" "b/dot/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-350边243边205边351边245边260边350边200边205边346边250边241边345边274边217边-347边261边273边350边243边205边351边245边260边345边231边250边.py.dot" new file mode 100644 index 0000000..5dd389a --- /dev/null +++ "b/dot/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-350边243边205边351边245边260边350边200边205边346边250边241边345边274边217边-347边261边273边350边243边205边351边245边260边345边231边250边.py.dot" @@ -0,0 +1,7 @@ +digraph "classes_缁???????妯″??-瑁?楗拌??妯″??-绫昏??楗板??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"缁???????妯″??-瑁?楗拌??妯″??-绫昏??楗板??.Profiled" [color="black", fontcolor="black", label=<{profiled|ncalls : int
|}>, shape="record", style="solid"]; +"缁???????妯″??-瑁?楗拌??妯″??-绫昏??楗板??.Spam" [color="black", fontcolor="black", label=<{spam|
|bar(x)
}>, shape="record", style="solid"]; +} diff --git "a/dot/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-350边243边205边351边245边260边350边200边205边346边250边241边345边274边217边.py.dot" "b/dot/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-350边243边205边351边245边260边350边200边205边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..1caaf49 --- /dev/null +++ "b/dot/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-350边243边205边351边245边260边350边200边205边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,7 @@ +digraph "classes_缁???????妯″??-瑁?楗拌??妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"缁???????妯″??-瑁?楗拌??妯″??.Foo" [color="black", fontcolor="black", label=<{foo|
|f1()
f2()
}>, shape="record", style="solid"]; +"缁???????妯″??-瑁?楗拌??妯″??.Foo_decorator" [color="black", fontcolor="black", label=<{foo_decorator|
|f1()
}>, shape="record", style="solid"]; +} diff --git "a/dot/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-351边200边202边351边205边215边345边231边250边346边250边241边345边274边217边.py.dot" "b/dot/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-351边200边202边351边205边215边345边231边250边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..6744b9b --- /dev/null +++ "b/dot/classes_347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-351边200边202边351边205边215边345边231边250边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,9 @@ +digraph "classes_缁???????妯″??-?????????妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"缁???????妯″??-?????????妯″??.Adapter" [color="black", fontcolor="black", label=<{adapter|
|run()
speak()
}>, shape="record", style="solid"]; +"缁???????妯″??-?????????妯″??.Cat" [color="black", fontcolor="black", label=<{cat|name
|cat_run()
miaomiao()
}>, shape="record", style="solid"]; +"缁???????妯″??-?????????妯″??.Dog" [color="black", fontcolor="black", label=<{dog|name
|dog_run()
wangwang()
}>, shape="record", style="solid"]; +"缁???????妯″??-?????????妯″??.Sheep" [color="black", fontcolor="black", label=<{sheep|name
|miemie()
sheet_run()
}>, shape="record", style="solid"]; +} diff --git "a/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-344边270边255边344边273边213边350边200边205边346边250边241边345边274边217边.py.dot" "b/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-344边270边255边344边273边213边350边200边205边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..e877f86 --- /dev/null +++ "b/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-344边270边255边344边273边213边350边200边205边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,7 @@ +digraph "classes_琛?涓哄??妯″??-涓TEL?????妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"琛?涓哄??妯″??-涓TEL?????妯″??.ChatRoom" [color="black", fontcolor="black", label=<{chatroom|
|show_message(user, msg)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-涓TEL?????妯″??.User" [color="black", fontcolor="black", label=<{user|name
|send_msg(msg)
}>, shape="record", style="solid"]; +} diff --git "a/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边217边221边345边270边203边350边256边242边351边230边205边346边250边241边345边274边217边.py.dot" "b/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边217边221边345边270边203边350边256边242边351边230边205边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..74b699c --- /dev/null +++ "b/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边217边221边345边270边203边350边256边242边351边230边205边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,8 @@ +digraph "classes_琛?涓哄??妯″??-???甯?璁㈤??妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"琛?涓哄??妯″??-???甯?璁㈤??妯″??.Event" [color="black", fontcolor="black", label=<{event|client_list : dict
|listen(key, fn)
remove(key, fn)
trigger()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-???甯?璁㈤??妯″??.SalesOffice" [color="black", fontcolor="black", label=<{salesoffice|
|}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-???甯?璁㈤??妯″??.SalesOffice" -> "琛?涓哄??妯″??-???甯?璁㈤??妯″??.Event" [arrowhead="empty", arrowtail="none"]; +} diff --git "a/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边221边275边344边273边244边346边250边241边345边274边217边.py.dot" "b/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边221边275边344边273边244边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..e030efc --- /dev/null +++ "b/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边221边275边344边273边244边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,8 @@ +digraph "classes_琛?涓哄??妯″??-??戒护妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"琛?涓哄??妯″??-??戒护妯″??.CreateFile" [color="black", fontcolor="black", label=<{createfile|path
txt : str
|execute()
undo()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-??戒护妯″??.ReadFile" [color="black", fontcolor="black", label=<{readfile|path
|execute()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-??戒护妯″??.RenameFile" [color="black", fontcolor="black", label=<{renamefile|dest
src
|execute()
undo()
}>, shape="record", style="solid"]; +} diff --git "a/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边244边207边345边277边230边345边275边225边346边250边241边345边274边217边.py.dot" "b/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边244边207边345边277边230边345边275边225边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..52d5509 --- /dev/null +++ "b/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边244边207边345边277边230边345边275边225边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,8 @@ +digraph "classes_琛?涓哄??妯″??-澶?蹇?褰?妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"琛?涓哄??妯″??-澶?蹇?褰?妯″??.Caretaker" [color="black", fontcolor="black", label=<{caretaker|memento
|}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-澶?蹇?褰?妯″??.Memento" [color="black", fontcolor="black", label=<{memento|state
|}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-澶?蹇?褰?妯″??.Originator" [color="black", fontcolor="black", label=<{originator|state : str
|create_memento()
set_memento(memento)
show()
}>, shape="record", style="solid"]; +} diff --git "a/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边273边266边350边277边237边350边256边241边347边256边227边347边274边223边345边255边230边346边250边241边345边274边217边.py.dot" "b/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边273边266边350边277边237边350边256边241边347边256边227边347边274边223边345边255边230边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..7356786 --- /dev/null +++ "b/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边273边266边350边277边237边350边256边241边347边256边227边347边274边223边345边255边230边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,8 @@ +digraph "classes_琛?涓哄??妯″??-寤惰??璁$??缂?瀛?妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"琛?涓哄??妯″??-寤惰??璁$??缂?瀛?妯″??.FunctionResultCacher" [color="black", fontcolor="black", label=<{functionresultcacher|func_result_dict : dict
|cached_function_result_for_a_time(cache_time: float)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-寤惰??璁$??缂?瀛?妯″??.cached_class_property" [color="black", fontcolor="black", label=<{cached_class_property|func
|}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-寤惰??璁$??缂?瀛?妯″??.cached_instance_property" [color="black", fontcolor="black", label=<{cached_instance_property|func
|}>, shape="record", style="solid"]; +} diff --git "a/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-346边250边241边346边235边277边346边250边241边345边274边217边.py.dot" "b/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-346边250边241边346边235边277边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..4491c76 --- /dev/null +++ "b/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-346边250边241边346边235边277边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,8 @@ +digraph "classes_琛?涓哄??妯″??-妯℃?挎ā寮?.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"琛?涓哄??妯″??-妯℃?挎ā寮?.AbstractClass" [color="black", fontcolor="black", label=<{abstractclass|
|operation1()
operation2()
operation3()
template_method()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-妯℃?挎ā寮?.ConcreteClass" [color="black", fontcolor="black", label=<{concreteclass|
|operation1()
operation2()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-妯℃?挎ā寮?.ConcreteClass" -> "琛?涓哄??妯″??-妯℃?挎ā寮?.AbstractClass" [arrowhead="empty", arrowtail="none"]; +} diff --git "a/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-347边212边266边346边200边201边346边250边241边345边274边217边.py.dot" "b/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-347边212边266边346边200边201边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..8fe90b0 --- /dev/null +++ "b/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-347边212边266边346边200边201边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,14 @@ +digraph "classes_琛?涓哄??妯″??-??舵??妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"琛?涓哄??妯″??-??舵??妯″??.AmState" [color="black", fontcolor="black", label=<{amstate|name : str
pos : int
radio
stations : list
|toggle_amfm()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-??舵??妯″??.FmState" [color="black", fontcolor="black", label=<{fmstate|name : str
pos : int
radio
stations : list
|toggle_amfm()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-??舵??妯″??.Radio" [color="black", fontcolor="black", label=<{radio|amstate
fmstate
state
|scan()
toggle_amfm()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-??舵??妯″??.State" [color="black", fontcolor="black", label=<{state|pos : int
|scan()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-??舵??妯″??.AmState" -> "琛?涓哄??妯″??-??舵??妯″??.State" [arrowhead="empty", arrowtail="none"]; +"琛?涓哄??妯″??-??舵??妯″??.FmState" -> "琛?涓哄??妯″??-??舵??妯″??.State" [arrowhead="empty", arrowtail="none"]; +"琛?涓哄??妯″??-??舵??妯″??.AmState" -> "琛?涓哄??妯″??-??舵??妯″??.Radio" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="amstate", style="solid"]; +"琛?涓哄??妯″??-??舵??妯″??.AmState" -> "琛?涓哄??妯″??-??舵??妯″??.Radio" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="state", style="solid"]; +"琛?涓哄??妯″??-??舵??妯″??.FmState" -> "琛?涓哄??妯″??-??舵??妯″??.Radio" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="fmstate", style="solid"]; +} diff --git "a/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-347边231边273边350边256边260边346边250边241边345边274边217边.py.dot" "b/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-347边231边273边350边256边260边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..3b56248 --- /dev/null +++ "b/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-347边231边273边350边256边260边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,9 @@ +digraph "classes_琛?涓哄??妯″??-??昏彴铈ā??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"琛?涓哄??妯″??-??昏彴铈ā??.BaseRegisteredClass" [color="black", fontcolor="black", label=<{baseregisteredclass|
|}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-??昏彴铈ā??.ClassRegistree" [color="black", fontcolor="black", label=<{classregistree|
|}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-??昏彴铈ā??.RegistryHolder" [color="black", fontcolor="black", label=<{registryholder|registry : dict
|get_registry()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-??昏彴铈ā??.ClassRegistree" -> "琛?涓哄??妯″??-??昏彴铈ā??.BaseRegisteredClass" [arrowhead="empty", arrowtail="none"]; +} diff --git "a/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-347边255边226边347边225边245边346边250边241边345边274边217边.py.dot" "b/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-347边255边226边347边225边245边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..2f34025 --- /dev/null +++ "b/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-347边255边226边347边225边245边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,11 @@ +digraph "classes_琛?涓哄??妯″??-绛???ユā寮?.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"琛?涓哄??妯″??-绛???ユā寮?.FaultStrategy" [color="black", fontcolor="black", label=<{faultstrategy|
|process()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-绛???ユā寮?.NormalStrategy" [color="black", fontcolor="black", label=<{normalstrategy|
|process()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-绛???ユā寮?.Park" [color="black", fontcolor="black", label=<{park|
|geoProcess()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-绛???ユā寮?.Strategy" [color="black", fontcolor="black", label=<{strategy|
|process()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-绛???ユā寮?.FaultStrategy" -> "琛?涓哄??妯″??-绛???ユā寮?.Strategy" [arrowhead="empty", arrowtail="none"]; +"琛?涓哄??妯″??-绛???ユā寮?.NormalStrategy" -> "琛?涓哄??妯″??-绛???ユā寮?.Strategy" [arrowhead="empty", arrowtail="none"]; +} diff --git "a/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边247边202边345边257边237边350边200边205边346边250边241边345边274边217边-351边207边215边346边226边260边345边256边236边347边216边260边346边227边245边345边277边227边347边263边273边347边273边237边.py.dot" "b/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边247边202边345边257边237边350边200边205边346边250边241边345边274边217边-351边207边215边346边226边260边345边256边236边347边216边260边346边227边245边345边277边227边347边263边273边347边273边237边.py.dot" new file mode 100644 index 0000000..68b18aa --- /dev/null +++ "b/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边247边202边345边257边237边350边200边205边346边250边241边345边274边217边-351边207边215边346边226边260边345边256边236边347边216边260边346边227边245边345边277边227边347边263边273边347边273边237边.py.dot" @@ -0,0 +1,15 @@ +digraph "classes_琛?涓哄??妯″??-瑙?瀵????妯″??-?????板???〖??ュ??绯荤??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"琛?涓哄??妯″??-瑙?瀵????妯″??-?????板???〖??ュ??绯荤??.AbstractHandler" [color="black", fontcolor="black", label=<{abstracthandler|
|emit(record)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-瑙?瀵????妯″??-?????板???〖??ュ??绯荤??.DingdingHandler" [color="black", fontcolor="black", label=<{dingdinghandler|
|emit(record)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-瑙?瀵????妯″??-?????板???〖??ュ??绯荤??.FileHandler" [color="black", fontcolor="black", label=<{filehandler|
|emit(record)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-瑙?瀵????妯″??-?????板???〖??ュ??绯荤??.Logger" [color="black", fontcolor="black", label=<{logger|handlers : list
name
|add_handler(handler)
log(record: str)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-瑙?瀵????妯″??-?????板???〖??ュ??绯荤??.MailHandler" [color="black", fontcolor="black", label=<{mailhandler|
|emit(record)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-瑙?瀵????妯″??-?????板???〖??ュ??绯荤??.StreamHandler" [color="black", fontcolor="black", label=<{streamhandler|
|emit(record)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-瑙?瀵????妯″??-?????板???〖??ュ??绯荤??.DingdingHandler" -> "琛?涓哄??妯″??-瑙?瀵????妯″??-?????板???〖??ュ??绯荤??.AbstractHandler" [arrowhead="empty", arrowtail="none"]; +"琛?涓哄??妯″??-瑙?瀵????妯″??-?????板???〖??ュ??绯荤??.FileHandler" -> "琛?涓哄??妯″??-瑙?瀵????妯″??-?????板???〖??ュ??绯荤??.AbstractHandler" [arrowhead="empty", arrowtail="none"]; +"琛?涓哄??妯″??-瑙?瀵????妯″??-?????板???〖??ュ??绯荤??.MailHandler" -> "琛?涓哄??妯″??-瑙?瀵????妯″??-?????板???〖??ュ??绯荤??.AbstractHandler" [arrowhead="empty", arrowtail="none"]; +"琛?涓哄??妯″??-瑙?瀵????妯″??-?????板???〖??ュ??绯荤??.StreamHandler" -> "琛?涓哄??妯″??-瑙?瀵????妯″??-?????板???〖??ュ??绯荤??.AbstractHandler" [arrowhead="empty", arrowtail="none"]; +} diff --git "a/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边247边243边351边207边212边345边231边250边346边250边241边345边274边217边.py.dot" "b/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边247边243边351边207边212边345边231边250边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..87c32c2 --- /dev/null +++ "b/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边247边243边351边207边212边345边231边250边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,9 @@ +digraph "classes_琛?涓哄??妯″??-瑙i?????妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"琛?涓哄??妯″??-瑙i?????妯″??.Expression" [color="black", fontcolor="black", label=<{expression|
|execute(play_key, play_value)
interpret(context)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-瑙i?????妯″??.NormGuitar" [color="black", fontcolor="black", label=<{normguitar|
|execute(key, value)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-瑙i?????妯″??.PlayContext" [color="black", fontcolor="black", label=<{playcontext|play_text : NoneType
play_text : str
|}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-瑙i?????妯″??.NormGuitar" -> "琛?涓哄??妯″??-瑙i?????妯″??.Expression" [arrowhead="empty", arrowtail="none"]; +} diff --git "a/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边256边277边351边227边256边350边200边205边346边250边241边345边274边217边.py.dot" "b/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边256边277边351边227边256边350边200边205边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..5cfdea4 --- /dev/null +++ "b/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边256边277边351边227边256边350边200边205边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,12 @@ +digraph "classes_琛?涓哄??妯″??-璁块?缎??妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"琛?涓哄??妯″??-璁块?缎??妯″??.Accounting" [color="black", fontcolor="black", label=<{accounting|duty : str
id : str
|visit(year_data)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-璁块?缎??妯″??.Advisor" [color="black", fontcolor="black", label=<{advisor|duty : str
id : str
|visit(year_data)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-璁块?缎??妯″??.AnalyseData" [color="black", fontcolor="black", label=<{analysedata|datalist : list
|add_data(year_data)
remove_data(year_data)
visit()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-璁块?缎??妯″??.Audit" [color="black", fontcolor="black", label=<{audit|duty : str
id : str
|visit(year_data)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-璁块?缎??妯″??.Finance" [color="black", fontcolor="black", label=<{finance|cost : NoneType
history_cost : NoneType
history_salesvolume : NoneType
salesvolume : NoneType
|accept(visitor)
set_cost(value)
set_history_cost(value)
set_history_salesvolume(value)
set_salesvolume(value)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-璁块?缎??妯″??.Finance_year" [color="black", fontcolor="black", label=<{finance_year|analyst : list
year
|accept()
add_analyst(worker)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-璁块?缎??妯″??.Finance_year" -> "琛?涓哄??妯″??-璁块?缎??妯″??.Finance" [arrowhead="empty", arrowtail="none"]; +} diff --git "a/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边264边243边344边273边273边351边223边276边346边250边241边345边274边217边.py.dot" "b/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边264边243边344边273边273边351边223边276边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..ff9d4ad --- /dev/null +++ "b/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边264边243边344边273边273边351边223边276边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,13 @@ +digraph "classes_琛?涓哄??妯″??-璐d换??炬ā寮?.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"琛?涓哄??妯″??-璐d换??炬ā寮?.Event" [color="black", fontcolor="black", label=<{event|name
|}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-璐d换??炬ā寮?.MainWindow" [color="black", fontcolor="black", label=<{mainwindow|
|handle_close(event)
handle_default(event)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-璐d换??炬ā寮?.MsgText" [color="black", fontcolor="black", label=<{msgtext|
|handle_down(event)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-璐d换??炬ā寮?.SendDialog" [color="black", fontcolor="black", label=<{senddialog|
|handle_paint(event)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-璐d换??炬ā寮?.Widget" [color="black", fontcolor="black", label=<{widget|parent : NoneType
|handle(event)
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-璐d换??炬ā寮?.MainWindow" -> "琛?涓哄??妯″??-璐d换??炬ā寮?.Widget" [arrowhead="empty", arrowtail="none"]; +"琛?涓哄??妯″??-璐d换??炬ā寮?.MsgText" -> "琛?涓哄??妯″??-璐d换??炬ā寮?.Widget" [arrowhead="empty", arrowtail="none"]; +"琛?涓哄??妯″??-璐d换??炬ā寮?.SendDialog" -> "琛?涓哄??妯″??-璐d换??炬ā寮?.Widget" [arrowhead="empty", arrowtail="none"]; +} diff --git "a/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边207边346边273边244边345边231边250边346边250边241边345边274边217边.py.dot" "b/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边207边346边273边244边345边231边250边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..8a72ed5 --- /dev/null +++ "b/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边207边346边273边244边345边231边250边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,21 @@ +digraph "classes_琛?涓哄??妯″??-杩?婊ゅ??妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"琛?涓哄??妯″??-杩?婊ゅ??妯″??.AndCriteria" [color="black", fontcolor="black", label=<{andcriteria|criteria
criteria_other
|meet_criteria(persons): list
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-杩?婊ゅ??妯″??.Criteria" [color="black", fontcolor="black", label=<{criteria|
|meet_criteria(persons): list
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-杩?婊ゅ??妯″??.CriteriaFemale" [color="black", fontcolor="black", label=<{criteriafemale|
|meet_criteria(persons): list
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-杩?婊ゅ??妯″??.CriteriaMale" [color="black", fontcolor="black", label=<{criteriamale|
|meet_criteria(persons): list
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-杩?婊ゅ??妯″??.CriteriaSingle" [color="black", fontcolor="black", label=<{criteriasingle|
|meet_criteria(persons): list
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-杩?婊ゅ??妯″??.OrCriteria" [color="black", fontcolor="black", label=<{orcriteria|criteria
criteria_other
|meet_criteria(persons): list
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-杩?婊ゅ??妯″??.Person" [color="black", fontcolor="black", label=<{person|marital_status
name
sex
|}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-杩?婊ゅ??妯″??.AndCriteria" -> "琛?涓哄??妯″??-杩?婊ゅ??妯″??.Criteria" [arrowhead="empty", arrowtail="none"]; +"琛?涓哄??妯″??-杩?婊ゅ??妯″??.CriteriaFemale" -> "琛?涓哄??妯″??-杩?婊ゅ??妯″??.Criteria" [arrowhead="empty", arrowtail="none"]; +"琛?涓哄??妯″??-杩?婊ゅ??妯″??.CriteriaMale" -> "琛?涓哄??妯″??-杩?婊ゅ??妯″??.Criteria" [arrowhead="empty", arrowtail="none"]; +"琛?涓哄??妯″??-杩?婊ゅ??妯″??.CriteriaSingle" -> "琛?涓哄??妯″??-杩?婊ゅ??妯″??.Criteria" [arrowhead="empty", arrowtail="none"]; +"琛?涓哄??妯″??-杩?婊ゅ??妯″??.OrCriteria" -> "琛?涓哄??妯″??-杩?婊ゅ??妯″??.Criteria" [arrowhead="empty", arrowtail="none"]; +"琛?涓哄??妯″??-杩?婊ゅ??妯″??.Criteria" -> "琛?涓哄??妯″??-杩?婊ゅ??妯″??.AndCriteria" [arrowhead="odiamond", arrowtail="none", fontcolor="green", label="criteria", style="solid"]; +"琛?涓哄??妯″??-杩?婊ゅ??妯″??.Criteria" -> "琛?涓哄??妯″??-杩?婊ゅ??妯″??.AndCriteria" [arrowhead="odiamond", arrowtail="none", fontcolor="green", label="criteria_other", style="solid"]; +"琛?涓哄??妯″??-杩?婊ゅ??妯″??.Criteria" -> "琛?涓哄??妯″??-杩?婊ゅ??妯″??.OrCriteria" [arrowhead="odiamond", arrowtail="none", fontcolor="green", label="criteria", style="solid"]; +"琛?涓哄??妯″??-杩?婊ゅ??妯″??.Criteria" -> "琛?涓哄??妯″??-杩?婊ゅ??妯″??.OrCriteria" [arrowhead="odiamond", arrowtail="none", fontcolor="green", label="criteria_other", style="solid"]; +} diff --git "a/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边255边344边273边243边345边231边250边346边250边241边345边274边217边-344边275边277边347边224边250边347边261边273边.py.dot" "b/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边255边344边273边243边345边231边250边346边250边241边345边274边217边-344边275边277边347边224边250边347边261边273边.py.dot" new file mode 100644 index 0000000..d86adad --- /dev/null +++ "b/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边255边344边273边243边345边231边250边346边250边241边345边274边217边-344边275边277边347边224边250边347边261边273边.py.dot" @@ -0,0 +1,6 @@ +digraph "classes_琛?涓哄??妯″??-杩TEL唬???妯″??-浣跨??被.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"琛?涓哄??妯″??-杩TEL唬???妯″??-浣跨??被.AccountIterator" [color="black", fontcolor="black", label=<{accountiterator|accounts
index : int
|}>, shape="record", style="solid"]; +} diff --git "a/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边255边344边273边243边345边231边250边346边250边241边345边274边217边.py.dot" "b/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边255边344边273边243边345边231边250边346边250边241边345边274边217边.py.dot" new file mode 100644 index 0000000..1d2e602 --- /dev/null +++ "b/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边255边344边273边243边345边231边250边346边250边241边345边274边217边.py.dot" @@ -0,0 +1,11 @@ +digraph "classes_琛?涓哄??妯″??-杩TEL唬???妯″??.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +"琛?涓哄??妯″??-杩TEL唬???妯″??.Aggregate" [color="black", fontcolor="black", label=<{aggregate|
|iterator()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-杩TEL唬???妯″??.ConcreteAggregate" [color="black", fontcolor="black", label=<{concreteaggregate|alist
|iterator()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-杩TEL唬???妯″??.ConcreteIterator" [color="black", fontcolor="black", label=<{concreteiterator|alist
|hasNext()
next()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-杩TEL唬???妯″??.Iterator" [color="black", fontcolor="black", label=<{iterator|
|hasNext()
next()
}>, shape="record", style="solid"]; +"琛?涓哄??妯″??-杩TEL唬???妯″??.ConcreteAggregate" -> "琛?涓哄??妯″??-杩TEL唬???妯″??.Aggregate" [arrowhead="empty", arrowtail="none"]; +"琛?涓哄??妯″??-杩TEL唬???妯″??.ConcreteIterator" -> "琛?涓哄??妯″??-杩TEL唬???妯″??.Iterator" [arrowhead="empty", arrowtail="none"]; +} diff --git "a/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边255边344边273边243边345边231边250边346边250边241边345边274边2173边.py.dot" "b/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边255边344边273边243边345边231边250边346边250边241边345边274边2173边.py.dot" new file mode 100644 index 0000000..8e6e984 --- /dev/null +++ "b/dot/classes_350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边255边344边273边243边345边231边250边346边250边241边345边274边2173边.py.dot" @@ -0,0 +1,5 @@ +digraph "classes_琛?涓哄??妯″??-杩TEL唬???妯″??3.py" { +rankdir=BT +bgcolor="#7e7e7e" +charset="utf-8" +} diff --git "a/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-344边272边253边345边205边203边346边250边241边345边274边217边-345边205边203边347边261边273边.py" "b/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-344边272边253边345边205边203边346边250边241边345边274边217边-345边205边203边347边261边273边.py" new file mode 100644 index 0000000..c493b81 --- /dev/null +++ "b/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-344边272边253边345边205边203边346边250边241边345边274边217边-345边205边203边347边261边273边.py" @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019钳11奉19泣 0019 12:22 +from monkey_print2 import print + + +class FlyweightMetaClass(type): + def __init__(cls, name, bases, dict): + super(FlyweightMetaClass, cls).__init__(name, bases, dict) + cls._instance_map = {} + + @staticmethod + def _make_arguments_to_key(args, kwds): + key = args + if kwds: + sorted_items = sorted(kwds.items()) + for item in sorted_items: + key += item + return key + + def __call__(cls, *args, **kw): + cache_key = f'{cls}_{cls._make_arguments_to_key(args, kw)}' + if cache_key not in cls._instance_map: + cls._instance_map[cache_key] = super().__call__(*args, **kw) + return cls._instance_map[cache_key] + + +class A(metaclass=FlyweightMetaClass): + def __init__(self, a, b): + print(f'???濮???? {a},{b}') + + +if __name__ == '__main__': + A(1, 2) + A(1, 2) + A(1, 3) + """ + "D:/coding2/python36patterns/???寤哄??妯″??-浜????妯″??-???绫?.py:28" 14:19:44 ???濮???? 1,2 # 杩??徆???彧??杩?琛?涓?娆\??浜????妯″????戒腑浜?缂?瀛???? + "D:/coding2/python36patterns/???寤哄??妯″??-浜????妯″??-???绫?.py:28" 14:19:44 ???濮???? 1,3 + """ diff --git "a/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-344边272边253边345边205边203边346边250边241边345边274边217边-350边243边205边351边245边260边345边231边250边347边211边210边346边234边254边.py" "b/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-344边272边253边345边205边203边346边250边241边345边274边217边-350边243边205边351边245边260边345边231边250边347边211边210边346边234边254边.py" new file mode 100644 index 0000000..11bca9a --- /dev/null +++ "b/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-344边272边253边345边205边203边346边250边241边345边274边217边-350边243边205边351边245边260边345边231边250边347边211边210边346边234边254边.py" @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019钳10奉8泣 0008 13:55 +""" +浜????妯″?? +浜????妯″?????杩?涓虹?镐技瀵硅薄寮???ユ?版???变韩??ユ??灏???????瀛?浣跨?彧??????????ц?斤??涓?涓彨婧???灏辨?徃??涓???????舵???????ス?????涓??徟????版?彸????变韩瀵硅薄锛?渚?璧???舵??????徟????版?彸??搴???徃俸??????涓???????锛????涓烘?忎?彾诣薄??杩?绉?淇℃?徃????稿??锛????娉???变韩锛?濡????浜???????瑕??????烘????版????璇ョ?卞???风?浠g????剧ず???渚???? + +浜????妯″?忎?浜????渚?妯″?????涓?????ァ??跺??澶?渚?妯″?忎???淬?????甯哥?垫椿锛?瀹??????у??浣跨????烘??ぇ浜????渚?妯″????? +渚?濡????寤轰??涓??版????杩??ˇ锛?涓?甯????寤虹??澶?涓????ˇ锛?浣????瑕???????涓?瑙i?????涓????浣?濂藉???彴?哄??????版????锛?褰?浼?????????哄????ip绔?????????跺??锛???h????瑕????寤轰??涓??扮??杩??ˇ浜?锛?杩?绉?浣跨??浜????妯″??????????? +""" +from functools import wraps + +from monkey_print2 import print + + +def flyweight(cls): + _instance = {} + + def _make_arguments_to_key(args, kwds): + key = args + if kwds: + sorted_items = sorted(kwds.items()) + for item in sorted_items: + key += item + return key + + @wraps(cls) + def _flyweight(*args, **kwargs): + cache_key = f'{cls}_{_make_arguments_to_key(args, kwargs)}' + if cache_key not in _instance: + _instance[cache_key] = cls(*args, **kwargs) + return _instance[cache_key] + + return _flyweight + + +@flyweight +class A: + def __init__(self, identity): + self.identity = identity + + def eat(self): + print(f'{self.identity} ???楗?') + + +if __name__ == '__main__': + a1 = A('001') + a2 = A('001') + print(a1 == a2) + a1.eat() + a2.eat() + a3 = A('003') + print(a1 == a3) + a3.eat() + + """ + a1???a2?????涓?涓?彾诣盶?? + "D:/coding2/python36patterns/???寤哄??妯″??-浜????妯″??-瑁?楗板???????.py:49" 15:48:38 True + "D:/coding2/python36patterns/???寤哄??妯″??-浜????妯″??-瑁?楗板???????.py:43" 15:48:38 001 ???楗? + "D:/coding2/python36patterns/???寤哄??妯″??-浜????妯″??-瑁?楗板???????.py:43" 15:48:38 001 ???楗? + "D:/coding2/python36patterns/???寤哄??妯″??-浜????妯″??-瑁?楗板???????.py:53" 15:48:38 False + "D:/coding2/python36patterns/???寤哄??妯″??-浜????妯″??-瑁?楗板???????.py:43" 15:48:38 003 ???楗? + """ diff --git "a/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-344边272边253边345边205边203边346边250边241边345边274边217边.py" "b/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-344边272边253边345边205边203边346边250边241边345边274边217边.py" new file mode 100644 index 0000000..7b6d1a1 --- /dev/null +++ "b/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-344边272边253边345边205边203边346边250边241边345边274边217边.py" @@ -0,0 +1,97 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019钳10奉8泣 0008 13:55 +""" +浜????妯″?? +浜????妯″?????杩?涓虹?镐技瀵硅薄寮???ユ?版???变韩??ユ??灏???????瀛?浣跨?彧??????????ц?斤??涓?涓彨婧???灏辨?徃??涓???????舵???????ス?????涓??徟????版?彸????变韩瀵硅薄锛?渚?璧???舵??????徟????版?彸??搴???徃俸??????涓???????锛????涓烘?忎?彾诣薄??杩?绉?淇℃?徃????稿??锛????娉???变韩锛?濡????浜???????瑕??????烘????版????璇ョ?卞???风?浠g????剧ず???渚???? + +浜????妯″?忎?浜????渚?妯″?????涓?????ァ??跺??澶?渚?妯″?忎???淬?????甯哥?垫椿锛?瀹??????у??浣跨????烘??ぇ浜????渚?妯″????? +渚?濡????寤轰??涓??版????杩??ˇ锛?涓?甯????寤虹??澶?涓????ˇ锛?浣????瑕???????涓?瑙i?????涓????浣?濂藉???彴?哄??????版????锛?褰?浼?????????哄????ip绔?????????跺??锛???h????瑕????寤轰??涓??扮??杩??ˇ浜?锛?杩?绉?浣跨??浜????妯″??????????? + + +渚?濡??????????涓???浜???????浠g????? +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2020钳1奉13泣 0013 12:09 +""" +# ???璇徃俳??????渚?璁捐?℃ā寮????渚?瀛? + +''' +from redis import Redis +class MyRedis: + _inst = None + + def __new__(cls, *args, **kwargs): + if not cls._inst: + self = super().__new__(cls) + self.__my_init__(*args, **kwargs) + cls._inst = self + return cls._inst + + + def __my_init__(self,redis_db): + print(f'浼???ョ??redis db??? {redis_db}') + self.r = Redis(host='127.0.0.1',port=6379,db=redis_db) + + def set(self,key,value): + self.r.set(key,value) + +if __name__ == '__main__': + """ + ???渚?妯″?忎娇??涓?褰?锛???????椤圭??法澶ф?忔?锛????浜?璇存??涔?娌$?????redis????????稿?崇??锛????涓哄??渚?妯″?忎???村??db5锛????浜?浠ヤ负??芥?惧??db6锛?db7锛?搴?璇ヤ娇???浜????妯″?????????璇徃??浣跨??浜????渚?妯″????? + """ + MyRedis(5).set('a',1) + MyRedis(6).set('b', 2) + MyRedis(5).set('c', 3) + MyRedis(6).set('d', 4) + +''' +from monkey_print2 import print + + +class A: + pool = dict() + + def __new__(cls, identity): + """ + ???璁剧?稿?????瀛?彿鍙?????1涓?6??? + :param identity: + :return: + + 杩?涓??徃俸???妯″??????浜轰???????伴????? __new__灏辨?>欢???灏?绁?缁忚?????浣???℃?徃?????浜?__new__???浠g??浠???借彴╀负????渚?妯″????? + 涓昏????徃莶???????彵舯???涓?浜?姒?蹇电????セ川锛?姝昏彴铉ˉ??褰㈠??????????????璇徃鎻癌??ャ?? + ???璧风??瑕???ラ??__new__???共??ワ??__init__???共??ワ??涓???ラ?????璇?灏变??姝昏彴铉ˉ?????渚?妯″?????褰㈠????? + """ + obj = cls.pool.get(identity, None) + if not obj: + obj = object.__new__(cls) + print(f'瀹?渚???? 瀛?彿涓 {identity} ???瀛???') + cls.pool[identity] = obj + return obj + + def __init__(self, identity): + self.identity = identity + + def eat(self): + print(f'{self.identity} ???楗?') + + +if __name__ == '__main__': + A('001').eat() + A('001').eat() + A('002').eat() + + # 涓???㈡???充??杩?涓彨婧???妯″?忚?汉璇存???????渚?妯″????????椹炽??濡?????????渚?妯″??print(id(A('001')) == id(A('002'))) 缁????浼????True + print(id(A('001')) == id(A('002'))) # False + print(id(A('001')) == id(A('001'))) # True + + """ + 涓?浼?澶?娆$????? 001瀛?彿?????瀛???涓?彾诣<?? + "D:/coding2/python36patterns/???寤哄??妯″??-浜????妯″??.py:30" 11:46:53 瀹?渚???? 瀛?彿涓 001 ???瀛??? + "D:/coding2/python36patterns/???寤哄??妯″??-浜????妯″??.py:38" 11:46:53 001 ???楗? + "D:/coding2/python36patterns/???寤哄??妯″??-浜????妯″??.py:38" 11:46:53 001 ???楗? + "D:/coding2/python36patterns/???寤哄??妯″??-浜????妯″??.py:30" 11:46:53 瀹?渚???? 瀛?彿涓 002 ???瀛??? + "D:/coding2/python36patterns/???寤哄??妯″??-浜????妯″??.py:38" 11:46:53 002 ???楗? + "D:/coding2/python36patterns/???寤哄??妯″??-浜????妯″??.py:45" 11:46:53 False + "D:/coding2/python36patterns/???寤哄??妯″??-浜????妯″??.py:46" 11:46:53 True + """ diff --git "a/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边-345边205边203边347边261边273边.py" "b/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边-345边205边203边347边261边273边.py" new file mode 100644 index 0000000..cd11c1c --- /dev/null +++ "b/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边-345边205边203边347边261边273边.py" @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019钳10奉8泣 0008 13:55 +""" +???渚?妯″?? +??????????翠??棰????锛?杩?涓???徃??甯哥????璁捐?℃ā寮????寰?寰??彧?借?卞?鸿????轰??浠???借???鸿??涓?绉?璁捐?℃ā寮??浣?oop??规?ス?彸????徃??澶?渚?锛? +浣跨??oop??ュ???〖???渚?妯″???濂藉???????? +1 寤惰?????濮????锛??彧??????????瀵硅薄??跺??璋????__init__?????㈡?跺?????杩?琛????濮????锛? +2 ??????浼???????濮???? +?????锛?涓???シ????典??锛?涓????瑕???ヤ娇???被??ユ?????渚?妯″??????浠剁骇妯″?????灞?????????????娉????瀹???冲徟??python妯″??澶彨?跺??渚?锛?涓?淇$??璇??徟嘶ユ?璇?涓?涓?锛?c瀵煎??a锛?b涔?瀵煎??a锛?c瀵煎??b锛????a?????㈢?存ˇprint hello锛? +杩?琛?c.py,?彧???????颁??娆?print hello??? + +""" +import threading +from functools import wraps + +from monkey_print2 import print + + +class Singleton(type): + def __init__(cls, name, bases, dict): + super(Singleton, cls).__init__(name, bases, dict) + cls.instance = None + + def __call__(cls, *args, **kw): + if cls.instance is None: + cls.instance = super(Singleton, cls).__call__(*args, **kw) + return cls.instance + + +class A(metaclass=Singleton): + def __init__(self, identity): + print('??ц??init') + self.identity = identity + + def eat(self): + print(f'{self.identity} ???楗?') + + +if __name__ == '__main__': + a1 = A('001') + a2 = A('001') + print(a1 == a2) + a1.eat() + a2.eat() + a3 = A('003') + print(a1 == a3) + a3.eat() + + """ + a1 a2 a3 涓?娆″??渚??????烘?ワ??浣???芥????涓?涓?彾诣<??瀵规??涓?浜????妯″????? + "D:/coding2/python36patterns/???寤哄??妯″??-???渚?妯″??.py:36" 16:00:25 True +"D:/coding2/python36patterns/???寤哄??妯″??-???渚?妯″??.py:30" 16:00:25 001 ???楗? +"D:/coding2/python36patterns/???寤哄??妯″??-???渚?妯″??.py:30" 16:00:25 001 ???楗? +"D:/coding2/python36patterns/???寤哄??妯″??-???渚?妯″??.py:40" 16:00:25 True +"D:/coding2/python36patterns/???寤哄??妯″??-???渚?妯″??.py:30" 16:00:25 001 ???楗? + """ diff --git "a/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边-350边243边205边351边245边260边345边231边250边.py" "b/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边-350边243边205边351边245边260边345边231边250边.py" new file mode 100644 index 0000000..2908f50 --- /dev/null +++ "b/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边-350边243边205边351边245边260边345边231边250边.py" @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019钳10奉8泣 0008 13:55 +""" +???渚?妯″?? +??????????翠??棰????锛?杩?涓???徃??甯哥????璁捐?℃ā寮????寰?寰??彧?借?卞?鸿????轰??浠???借???鸿??涓?绉?璁捐?℃ā寮??浣?oop??规?ス?彸????徃??澶?渚?锛? +浣跨??oop??ュ???〖???渚?妯″???濂藉???????? +1 寤惰?????濮????锛??彧??????????瀵硅薄??跺??璋????__init__?????㈡?跺?????杩?琛????濮????锛? +2 ??????浼???????濮???? +?????锛?涓???シ????典??锛?涓????瑕???ヤ娇???被??ユ?????渚?妯″??????浠剁骇妯″?????灞?????????????娉????瀹???冲徟??python妯″??澶彨?跺??渚?锛?涓?淇$??璇??徟嘶ユ?璇?涓?涓?锛?c瀵煎??a锛?b涔?瀵煎??a锛?c瀵煎??b锛????a?????㈢?存ˇprint hello锛? +杩?琛?c.py,?彧???????颁??娆?print hello??? + +""" +import threading +from functools import wraps + +from monkey_print2 import print + + +def singleton(cls): + """ + ???渚?妯″?忚?楗板??,??板????ョ嚎绋????锛???寸?㈠?虹?????渚?妯″???涓昏??瑙e?冲??绾跨??濡?100绾跨???????跺??渚?????????典???徟?戒????虹〖涓?渚????渚??????????,瀹?娴???? + """ + _instance = {} + singleton.__lock = threading.Lock() # 杩??????存ˇ婕?绀轰??绾跨??瀹?????????渚?妯″?? + + @wraps(cls) + def _singleton(*args, **kwargs): + with singleton.__lock: + if cls not in _instance: + _instance[cls] = cls(*args, **kwargs) + return _instance[cls] + + return _singleton + + +@singleton +class A: + def __init__(self, identity): + self.identity = identity + + def eat(self): + print(f'{self.identity} ???楗?') + + +if __name__ == '__main__': + a1 = A('001') + a2 = A('001') + print(a1 == a2) + a1.eat() + a2.eat() + a3 = A('003') + print(a1 == a3) + a3.eat() + + """ + a1 a2 a3 涓?娆″??渚??????烘?ワ??浣???芥????涓?涓?彾诣<??瀵规??涓?浜????妯″????? + "D:/coding2/python36patterns/???寤哄??妯″??-???渚?妯″??.py:36" 16:00:25 True +"D:/coding2/python36patterns/???寤哄??妯″??-???渚?妯″??.py:30" 16:00:25 001 ???楗? +"D:/coding2/python36patterns/???寤哄??妯″??-???渚?妯″??.py:30" 16:00:25 001 ???楗? +"D:/coding2/python36patterns/???寤哄??妯″??-???渚?妯″??.py:40" 16:00:25 True +"D:/coding2/python36patterns/???寤哄??妯″??-???渚?妯″??.py:30" 16:00:25 003 ???楗? + """ diff --git "a/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边-351边207边215边345边206边231边new344边275边206边344边270边215边346边257边217边346边254边241边346边211边247边350边241边214边init346边226边271边345边274边217边.py" "b/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边-351边207边215边345边206边231边new344边275边206边344边270边215边346边257边217边346边254边241边346边211边247边350边241边214边init346边226边271边345边274边217边.py" new file mode 100644 index 0000000..189fb8d --- /dev/null +++ "b/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边-351边207边215边345边206边231边new344边275边206边344边270边215边346边257边217边346边254边241边346边211边247边350边241边214边init346边226边271边345边274边217边.py" @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019钳10奉8泣 0008 13:55 +""" +???渚?妯″?? +??????????翠??棰????锛?杩?涓???徃??甯哥????璁捐?℃ā寮????寰?寰??彧?借?卞?鸿????轰??浠???借???鸿??涓?绉?璁捐?℃ā寮??浣?oop??规?ス?彸????徃??澶?渚?锛? +浣跨??oop??ュ???〖???渚?妯″???濂藉???????? +1 寤惰?????濮????锛??彧??????????瀵硅薄??跺??璋????__init__?????㈡?跺?????杩?琛????濮????锛? +2 ??????浼???????濮???? +?????锛?涓???シ????典??锛?涓????瑕???ヤ娇???被??ユ?????渚?妯″??????浠剁骇妯″?????灞?????????????娉????瀹???冲徟??python妯″??澶彨?跺??渚?锛?涓?淇$??璇??徟嘶ユ?璇?涓?涓?锛?c瀵煎??a锛?b涔?瀵煎??a锛?c瀵煎??b锛????a?????㈢?存ˇprint hello锛? +杩?琛?c.py,?彧???????颁??娆?print hello??? + +""" + + +from monkey_print2 import print + + +class A: + """ + # &&&&&杩?绉???瑰????????new瀹??〖??????渚?妯″?忚?娉???????界?剁????????瀵硅薄??芥????涓?涓???浣?init浼?姣忔?借?????????????py2杩?绉????娉?瀹??〖??????渚?妯″???init涓?浼??????璋???彧??py3浼?琚????????????? + 瑕????init?????㈡????サ??澶э??涓?甯????琚?????????彧???徟嘶??规???彟???????瑰???????????朵????瑰????????渚?妯″?????&&&&& + 淇彸?逛????㈣??涓?己??圭????????new??瑰?? + """ + _inst = None + def __new__(cls, *args,**kwargs): + if not cls._inst: + cls._inst = object.__new__(cls) + cls._inst.__custom_init__(*args,**kwargs) # ?????瑰?????????? + return cls._inst + + def __custom_init__(self, identity): # 杩?琛?涔???徃?徃????广???サ???浜?__init__??规??锛?init浼?琚?????????彧????规?????new?????富??????????? + print('??ц??init') + self.identity = identity + + def eat(self): + print(f'{self.identity} ???楗?') + + +if __name__ == '__main__': + a1 = A('001') + a2 = A('001') + print(a1 == a2) + a1.eat() + a2.eat() + a3 = A('003') + print(a1 == a3) + a3.eat() + + """ + init?彧????ц??涓?娆<?? +"D:/coding2/python36patterns/???寤哄??妯″??-???渚?妯″??-??????new浣?涓?姣忔?ц??init??瑰??.py:33" 16:20:19 ??ц??init +"D:/coding2/python36patterns/???寤哄??妯″??-???渚?妯″??-??????new浣?涓?姣忔?ц??init??瑰??.py:43" 16:20:19 True +"D:/coding2/python36patterns/???寤哄??妯″??-???渚?妯″??-??????new浣?涓?姣忔?ц??init??瑰??.py:37" 16:20:19 001 ???楗? +"D:/coding2/python36patterns/???寤哄??妯″??-???渚?妯″??-??????new浣?涓?姣忔?ц??init??瑰??.py:37" 16:20:19 001 ???楗? +"D:/coding2/python36patterns/???寤哄??妯″??-???渚?妯″??-??????new浣?涓?姣忔?ц??init??瑰??.py:47" 16:20:19 True +"D:/coding2/python36patterns/???寤哄??妯″??-???渚?妯″??-??????new浣?涓?姣忔?ц??init??瑰??.py:37" 16:20:19 001 ???楗? + + + """ diff --git "a/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边.py" "b/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边.py" new file mode 100644 index 0000000..08f7a80 --- /dev/null +++ "b/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边215边225边344边276边213边346边250边241边345边274边217边.py" @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019钳10奉8泣 0008 13:55 +""" +???渚?妯″?? +??????????翠??棰????锛?杩?涓???徃??甯哥????璁捐?℃ā寮????寰?寰??彧?借?卞?鸿????轰??浠???借???鸿??涓?绉?璁捐?℃ā寮??浣?oop??规?ス?彸????徃??澶?渚?锛? +浣跨??oop??ュ???〖???渚?妯″???濂藉???????? +1 寤惰?????濮????锛??彧??????????瀵硅薄??跺??璋????__init__?????㈡?跺?????杩?琛????濮????锛? +2 ??????浼???????濮???? +?????锛?涓???シ????典??锛?涓????瑕???ヤ娇???被??ユ?????渚?妯″??????浠剁骇妯″?????灞?????????????娉????瀹???冲徟??python妯″??澶彨?跺??渚?锛?涓?淇$??璇??徟嘶ユ?璇?涓?涓?锛?c瀵煎??a锛?b涔?瀵煎??a锛?c瀵煎??b锛????a?????㈢?存ˇprint hello锛? +杩?琛?c.py,?彧???????颁??娆?print hello??? + +""" + + +from monkey_print2 import print + + +class A: + """ + # 杩?绉???瑰????????new瀹??〖??????渚?妯″?忚?娉???????界?剁????????瀵硅薄??芥????涓?涓???浣?init浼?姣忔?借?????????????py2杩?绉????娉?瀹??〖??????渚?妯″???init涓?浼??????璋???彧??py3浼?琚????????????? + 瑕????init?????㈡????サ??澶э??涓?甯????姣忔?借?????????彧???徟嘶??规???彟???????瑰???????????朵????瑰????????渚?妯″????? + """ + _inst = None + def __new__(cls, identity): + if not cls._inst: + cls._inst = object.__new__(cls) + return cls._inst + + def __init__(self, identity): + print('??ц??init') + self.identity = identity + + def eat(self): + print(f'{self.identity} ???楗?') + + +if __name__ == '__main__': + a1 = A('001') + a2 = A('001') + print(a1 == a2) + a1.eat() + a2.eat() + a3 = A('003') + print(a1 == a3) + a3.eat() + + """ + "D:/coding2/python36patterns/???寤哄??妯″??-???渚?妯″??.py:27" 16:13:31 ??ц??init +"D:/coding2/python36patterns/???寤哄??妯″??-???渚?妯″??.py:27" 16:13:31 ??ц??init +"D:/coding2/python36patterns/???寤哄??妯″??-???渚?妯″??.py:37" 16:13:31 True +"D:/coding2/python36patterns/???寤哄??妯″??-???渚?妯″??.py:31" 16:13:31 001 ???楗? +"D:/coding2/python36patterns/???寤哄??妯″??-???渚?妯″??.py:31" 16:13:31 001 ???楗? +"D:/coding2/python36patterns/???寤哄??妯″??-???渚?妯″??.py:27" 16:13:31 ??ц??init +"D:/coding2/python36patterns/???寤哄??妯″??-???渚?妯″??.py:41" 16:13:31 True +"D:/coding2/python36patterns/???寤哄??妯″??-???渚?妯″??.py:31" 16:13:31 003 ???楗? + + """ diff --git "a/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边216边237边345边236边213边346边250边241边345边274边217边.py" "b/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边216边237边345边236边213边346边250边241边345边274边217边.py" new file mode 100644 index 0000000..a4b04cc --- /dev/null +++ "b/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边216边237边345边236边213边346边250边241边345边274边217边.py" @@ -0,0 +1,92 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019钳10奉8泣 0008 13:55 +""" +??????妯″?? +??????妯″???Prototype Pattern锛???徃??浜????寤洪??澶????瀵硅薄锛??????跺????戒??璇???ц?姐??杩?绉?绫诲?????璁捐?℃ā寮忓?浜????寤哄??妯″???瀹????渚?浜?涓?绉????寤哄彾诣薄?????浣虫?瑰????? + +杩?绉?妯″????????〖浜?涓?涓???????ˇ????璇ユˇ????浜????寤哄?????瀵硅薄????????????褰???存ˇ???寤哄彾诣薄??浠d环姣?杈?澶ф?讹?????????????绉?妯″?????渚?濡?锛?涓?涓?彾诣薄??瑕????涓?涓???浠d环?????版???????浣?涔????琚????寤恒?????浠サ徟嘶ョ?瀛?璇ュ彾诣盶?????涓?涓?涓?彾墟???惰?????瀹??????????锛??????瑕??????跺????存?版?版????锛?浠ユ4??ュ?忓???版????璋??????? + +浠?缁? +?????撅???????????瀹?渚????瀹????寤哄彾诣薄??绉?绫伙??骞朵?????杩???疯??杩?浜??????????寤烘?扮??瀵硅薄??? + +涓昏??瑙e?筹???????琛????寤虹??????????ゅ???????? + +浣???朵娇??彧?? 1???褰?涓?涓?郴缁?搴?璇ョ?ス??浜?瀹????浜у?????寤猴???????????琛?ず??躲?? 2???褰?瑕?瀹?渚???????绫绘??????琛???跺?绘??瀹???讹??渚?濡?锛????杩???????瑁?杞姐?? 3???涓轰????垮?????寤轰??涓彨??浜у??绫诲??娆″钩琛????宸ュ??绫诲??娆℃?躲?? 4???褰?涓?涓?被???瀹?渚??彧?芥?????涓彨???????舵??缁????涓布??涓?绉???躲??寤虹????稿????扮?彸????????骞跺?????瀹?浠サ徟?芥??姣忔?????????????舵?????宸ュ??渚????璇ョ被??存?逛究涓?浜???? + +濡?浣?瑙e?筹????彨??宸叉?????涓?涓??????瀵硅薄锛?蹇?????扮??????????????瀵硅薄涓???风??瀹?渚???? + +??抽?彸榛???锛? 1???瀹??〖?????????浣?锛???? JAVA 缁ф?? Cloneable锛??????? clone()锛???? .NET 涓惧徟嘶ヤ娇?? Object 绫荤?? MemberwiseClone() ??规????ュ???〖瀵硅薄???娴???疯????????杩?搴????????????瑰????ュ???〖娣辨?疯????? 2?????????妯″???????风??浜????绂荤被瀵硅薄???浣跨?????????蜂??绫诲??锛???????绫伙??涔???寸?????????崇郴锛?瀹??????疯??姹?杩?浜?"??????绫?"??ユ??绋冲??????ˇ?彺?? + +搴????瀹?渚?锛? 1???缁???????瑁???? 2???JAVA 涓布?? Object clone() ??规????? + +浼???癸?? 1?????ц?芥??楂???? 2????????挎???????芥?扮??绾?????? + +缂虹?癸?? 1??????澶?????????规?????瑕?瀵圭被????????借??琛?????????????锛?杩?瀵逛???????扮??绫讳?????????撅??浣?瀵逛??宸叉?????绫讳??涓?瀹?寰?瀹规??锛???瑰??褰?涓?涓?被寮????涓???徃??涓茶??????????存ˇ瀵硅薄锛???????寮??????????寰?ッ缁?????????跺????? 2???蹇?椤诲???〖 Cloneable ?ˇ?彺?? + +浣跨????烘?徆?? 1???璧?婧?浼??????烘?徃?? 2???绫诲??濮???????瑕?娑???????甯稿?????璧?婧?锛?杩?涓???婧??????シ?版?寿??纭コ欢璧?婧?绛???? 3?????ц?藉??瀹??????姹??????烘?徃?? 4??????杩? new 浜х??涓?涓?彾诣薄??瑕????甯哥??????????版????澶????璁块?彸?????锛?????徟嘶ヤ娇????????妯″????? 5???涓?涓?彾诣薄??涓彨婵??硅???????烘?徃?? 6???涓?涓?彾诣薄??瑕????渚?缁???朵??瀵硅薄璁块?彺?????涓????涓?????????徟?介?介??瑕?淇彸?瑰?跺?兼?讹???徟嘶??????浣跨????????妯″????疯??澶?涓?彾诣>??璋??????浣跨????? 7??????瀹????椤圭?彸楦???????妯″?忓?灏??????サ?虹〖锛?涓???シ????宸ュ????规??妯″?忎?璧峰?虹〖锛????杩? clone ?????规?????寤轰??涓?彾诣盶????跺????卞伐?????规?????渚?缁?璋???????????????妯″?忓凡?忎? Java ???涓烘????朵??浣?锛?澶у彵?徟嘶????????挎?ヤ娇?????? + +娉???忎?椤癸??涓????杩?瀵逛??涓?被杩?琛?瀹?渚??????ユ???????板彾诣>??????????徆????????妯″????徃??杩???疯??涓?涓?〖???瀵硅薄????????板彾诣薄?????娴???疯??瀹??〖 Cloneable锛???????锛?娣辨?疯????徃??杩?瀹??〖 Serializable 璇诲??浜?杩???舵????? +""" +from monkey_print2 import print + +import copy +from collections import OrderedDict + + +class Book: + def __init__(self, name, authors, price, **rest): + '''rest???渚?瀛????锛???虹??????????垮害??????绛俱????虹????ユ??''' + self.name = name + self.authors = authors + self.price = price + self.__dict__.update(rest) # 娣诲????朵??棰?澶?灞???? + + def __str__(self): + mylist = [] + ordered = OrderedDict(sorted(self.__dict__.items())) + for i in ordered.keys(): + mylist.append('{}: {}'.format(i, ordered[i])) + if i == 'price': + mylist.append('$') + mylist.append('\n') + return ''.join(mylist) + + +class Prototype: + def __init__(self): + self.objects = dict() # ???濮????涓?涓?????????琛? + + def register(self, identifier, obj): + # ????????????琛?涓面敞?????????瀵硅薄 + self.objects[identifier] = obj + + def unregister(self, identifier): + # 浠??????????琛?涓惧????ゅ?????瀵硅薄 + del self.objects[identifier] + + def clone(self, identifier, **attr): + # ??规?? identifier ????????????琛?涓面?ユ?惧?????瀵硅薄骞跺????? + found = self.objects.get(identifier) + if not found: + raise ValueError('Incorrect object identifier: {}'.format(identifier)) + obj = copy.deepcopy(found) + obj.__dict__.update(attr) # ?????扮??灞???у?兼?挎?㈠?????瀵硅薄涓布??瀵瑰??灞???? + return obj + + + + +if __name__ == '__main__': + b1 = Book('The C Programming Language', ('Brian W. Kernighan', 'Dennis M.Ritchie'), + price=118, publisher='Prentice Hall', length=228, publication_date='1978-02-22', + tags=('C', 'programming', 'algorithms', 'data structures')) + + prototype = Prototype() + cid = 'k&r-first' + prototype.register(cid, b1) + b2 = prototype.clone(cid, name='The C Programming Language(ANSI)', price=48.99, length=274, publication_date='1988-04-01', edition=2) + + for i in (b1, b2): + print(i) + print("ID b1 : {} != ID b2 : {}".format(id(b1), id(b2))) diff --git "a/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边257边271边350边261边241边346边261边240边346边250边241边345边274边217边.py" "b/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边257边271边350边261边241边346边261边240边346边250边241边345边274边217边.py" new file mode 100644 index 0000000..6109a02 --- /dev/null +++ "b/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边257边271边350边261边241边346边261边240边346边250边241边345边274边217边.py" @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019钳10奉8泣 0008 16:41 +""" +???瑕????妯″?忎?涓????浣跨????绉?妯″???徟嘶????????版????杩??ˇ姹? 娴忚????姹?绛???? +瀹??〖?????????涓や釜???瑕??????版?规?徆??浣跨????跺?????锛?浣跨??瀹???????褰?杩???????浣跨????涓??????浜?涓?涓???甯稿己澶х????烘?徃?? +???濂芥?徃俳???with璇面????ュ?????瀵硅薄?????????杩?锛???忓?璋????澶????浠g????? + +璧?婧??????????, 涓????瑕??徟思哥紡┟?х???ッ澧?(cpu\???瀛?绛???彨??璧?婧???????): cpu??ц?戒??澶?寮哄??, ???瀛?姣?杈?绱у??, ?????炬?堕??, ???瀛???????浼???????姣?杈?澶х??褰卞??, ???瑕????楂????瀛?绠$????????, ???搴???ф?????????????翠负???瑕?; +??伴???????????, 姣?濡???版????杩??ˇ; +???寤烘????ソ?????瀵硅薄, ?徟嘶????????????????, 姣?杈?甯歌????????绾跨??姹?锛?ThreadPoolExecutor锛?, 瀛??????扮??姹?绛???? +""" +from queue import Queue +from monkey_print2 import print + + +class QueueObject(): + + def __init__(self, queue, auto_get=False): + self._queue = queue + self.object = self._queue.get() if auto_get else None + + def __enter__(self): + if self.object is None: + self.object = self._queue.get() + return self.object + + def __exit__(self, Type, value, traceback): + if self.object is not None: + self._queue.put(self.object) + self.object = None + + def __del__(self): + if self.object is not None: + self._queue.put(self.object) + self.object = None + + +def main(): + sample_queue = Queue() + sample_queue.put('yam') + with QueueObject(sample_queue) as obj: + print('Inside with: {}'.format(obj)) + print('Outside with: {}'.format(sample_queue.get())) + + sample_queue.put('sam') + queue_object = QueueObject(sample_queue, True) + print('?????? func: {}'.format(queue_object.object)) + print('澶???? func: {}'.format(sample_queue.get())) + + if not sample_queue.empty(): + print(sample_queue.get()) + + +if __name__ == '__main__': + main() diff --git "a/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边273边272边351边200边240边350边200边205边346边250边241边345边274边217边.py" "b/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边273边272边351边200边240边350边200边205边346边250边241边345边274边217边.py" new file mode 100644 index 0000000..b6e8580 --- /dev/null +++ "b/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-345边273边272边351边200边240边350边200边205边346边250边241边345边274边217边.py" @@ -0,0 +1,121 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019钳10奉8泣 0008 13:55 +""" +寤洪?????妯″?? + +寤洪?????妯″?? +寤洪?????妯″???Builder Pattern锛?浣跨??澶?涓?????????瀵硅薄涓?姝ヤ??姝ユ??寤烘??涓?涓?????????瀵硅薄???杩?绉?绫诲?????璁捐?℃ā寮忓?浜????寤哄??妯″???瀹????渚?浜?涓?绉????寤哄彾诣薄?????浣虫?瑰????? + +涓?涓? Builder 绫讳??涓?姝ヤ??姝ユ????????缁????瀵硅薄???璇? Builder 绫绘?徃?ス??浜???朵??瀵硅薄?????? + +浠?缁? +?????撅??灏?涓?涓????????????寤轰????惰;绀虹?稿??绂伙??浣垮???????风?????寤鸿??绋??徟嘶???寤轰????????琛?ず??? + +涓昏??瑙e?筹??涓昏??瑙e?冲??蒋浠剁郴缁?涓炯下???????跺????复???"涓?涓??????瀵硅薄"??????寤哄伐浣?锛???堕??甯哥?卞??涓?????????瀛?瀵硅薄???涓?瀹????绠?娉???????锛???变?????姹??????????锛?杩?涓??????瀵硅薄??????涓??????缁忓父?复?????х???????????锛?浣??????瀹?浠ス????????涓?璧风??绠?娉???寸?稿彾溢ǔ????? + +浣???朵娇??彧??涓?浜???烘?ソ??浠朵??浼????锛??????剁?????缁忓父??????????跺????? + +濡?浣?瑙e?筹??灏????涓?涓???????绂诲????? + +??抽?彸榛???锛?寤洪?????锛????寤哄?????渚?瀹?渚?锛?瀵兼??锛?绠$??寤洪????烘?ョ??瀹?渚????渚?璧???崇郴??? + +搴????瀹?渚?锛? 1????サ???痉??猴??姹???<???徟???????徃?<????搁浮缈?绛???徃????????锛??????剁???????徃?忓父????????锛?????????烘??璋????"濂?椁?"??? 2???JAVA 涓布?? StringBuilder??? + +浼???癸?? 1???寤洪???????ス??锛??????彨????? 2???渚夸???ァ??剁?????椋???彨?? + +缂虹?癸?? 1???浜у??蹇?椤绘????卞????癸???????存???????躲?? 2???濡?????????????澶????锛?浼????寰?澶????寤洪??绫汇?? + +浣跨????烘?徆?? 1??????瑕??????????瀵硅薄??锋??澶????????????????????? 2??????瑕??????????瀵硅薄??????灞???ф?セ韩??镐??渚?璧???? + +娉???忎?椤癸??涓?宸ュ??妯″???????哄????徆??寤洪?????妯″????村????虫敞涓???朵欢瑁???????椤哄????? +""" +from monkey_print2 import print + +import abc + + +# 姝ラ彧虽?锛????寤哄彾义????浜у????借薄绫?/浜у??绫? +class Building(object): + def __init__(self): + self.floor = None + self.size = None + + def __repr__(self): + return 'Floor: {0.floor} | size: {0.size}'.format(self) + + +# 姝ラ彧虽?锛????寤烘??寤鸿????借薄绫伙??涓昏???????涔????寤鸿????????灞????/??规??锛?浠ュ??缁ф?胯??蹇?椤诲???〖????????芥?借薄 +# Abstract builder +class AbsBuilder(object): + def __init__(self): + self.building = None + + def new_building(self): + self.building = Building() + + @abc.abstractmethod + def build_floor(self): + pass + + @abc.abstractmethod + def build_size(self): + pass + + +# 姝ラ彧???锛???蜂?????寤鸿??绫诲???〖 +class HouseBuilder(AbsBuilder): + def build_floor(self): + self.building.floor = 'one' + + def build_size(self): + self.building.size = '220 squre' + + +class FlatBuilder(AbsBuilder): + def build_floor(self): + self.building.floor = 'seven' + + def build_size(self): + self.building.size = '140 squre' + + +# 姝ラ彧虽?锛????寤轰骇???????????ヨ??绫伙????虫??缁????渚?缁?瀹㈡?风????浜у?????瀹?渚?瀵硅薄锛?浠ュ??缁?瑁?杩?绋? +class Director(object): + def __init__(self): + self.builder = None + + def construct_building(self): + """ + #寤洪?????妯″?忎?锛?浠??????瑕???跺???风?浠g???????惧????拌彾墟??????ヨ??杩???????缁????瀵硅薄 + """ + self.builder.new_building() + self.builder.build_floor() + self.builder.build_size() + + def get_building(self): + return self.builder.building + + +class Client(object): + def build(self, build_type): + if build_type == "House": + director = Director() + builder = HouseBuilder() + director.builder = builder + director.construct_building() + building = director.get_building() + print(building) + else: + director = Director() + builder = FlatBuilder() + director.builder = builder + director.construct_building() + building = director.get_building() + print(building) + + +if __name__ == "__main__": + build_type = "Flat" + client = Client() + client.build(build_type) diff --git "a/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-346边212边275边350边261边241边345边267边245边345边216边202边346边250边241边345边274边217边.py" "b/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-346边212边275边350边261边241边345边267边245边345边216边202边346边250边241边345边274边217边.py" new file mode 100644 index 0000000..98ba4d9 --- /dev/null +++ "b/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-346边212边275边350边261边241边345边267边245边345边216边202边346边250边241边345边274边217边.py" @@ -0,0 +1,84 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019钳10奉8泣 0008 13:55 +""" +??借薄宸ュ??妯″?? + +??借薄宸ュ??妯″????徃?????褰㈡?????宸ュ??妯″?忎该??涓烘?借薄????????蜂????シ?х??涓?绉?褰㈡???????借薄宸ュ??妯″????徃??褰????澶?涓??借薄瑙???叉?讹??浣跨????涓?绉?宸ュ??妯″????? + +??借薄宸ュ??妯″???徟嘶???瀹㈡?风????渚?涓?涓?ˇ????浣垮???风????涓?蹇????瀹?浜у???????蜂??????????典??锛????寤哄??涓彨婧?????忎覆??浜у??瀵硅薄??? + +??规?彸??姘???挎?㈠?????锛?浠讳???ˇ?????剁被????????版?癸????藉??褰???藉???ˇ???瀛?绫诲????????姝わ??瀹????涓?绯荤????????瑕????锛?浠?浠???徃獗???涓?杩?浜???借薄浜у??瑙???茬?稿?????涓?浜?瀹?渚?锛????涓???徃??浜???借薄浜у?????瀹?渚???? + +??㈣??涔?锛?涔?灏辨?徃??浜???借薄浜у???????蜂??瀛?绫荤??瀹?渚????宸ュ??绫昏??璐e??寤烘?借薄浜у???????蜂??瀛?绫荤??瀹?渚???? +""" +from monkey_print2 import print + + +class Xiaomi5: + def __init__(self): + self.phone_name = '灏忕?5' + + def send_msg(self): + print(f'??? {self.phone_name} ?????TEL俊') + + +class Xiaomi6: + def __init__(self): + self.phone_name = '灏忕?6' + + def send_msg(self): + print(f'??? {self.phone_name} ?????TEL俊') + + +class XiaomFactory: + @staticmethod + def get_phone(phone_type): + if phone_type == '5': + return Xiaomi5() + elif phone_type == '6': + return Xiaomi6() + + +class Apple5: + def __init__(self): + self.phone_name = '??规??5' + + def send_msg(self): + print(f'??? {self.phone_name} ?????TEL俊') + + +class Apple6: + def __init__(self): + self.phone_name = '??规??6' + + def send_msg(self): + print(f'??? {self.phone_name} ?????TEL俊') + + +class AppleFactory: + @staticmethod + def get_phone(phone_type): + if phone_type == '5': + return Xiaomi5() + elif phone_type == '6': + return Xiaomi6() + + +class FactoryProducer: + @staticmethod + def get_factory(factory_name): + if factory_name == 'xiaomi': + return XiaomFactory() + elif factory_name == 'apple': + return AppleFactory() + + +if __name__ == '__main__': + factory = FactoryProducer.get_factory('xiaomi') + xiaomi5 = factory.get_phone('5') + xiaomi5.send_msg() + + """ + "D:/coding2/python36patterns/???寤哄??妯″??-??借薄宸ュ??妯″??.py:22" 14:38:03 ??? 灏忕?5 ?????TEL俊 + """ diff --git "a/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-347边256边200边345边215边225边345边267边245边345边216边202边346边250边241边345边274边217边.py" "b/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-347边256边200边345边215边225边345边267边245边345边216边202边346边250边241边345边274边217边.py" new file mode 100644 index 0000000..9dc4846 --- /dev/null +++ "b/py_design/345边210边233边345边273边272边345边236边213边346边250边241边345边274边217边-347边256边200边345边215边225边345边267边245边345边216边202边346边250边241边345边274边217边.py" @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019钳10奉8泣 0008 13:55 +""" +绠????宸ュ??妯″?? + +濂藉??涓昏?????锛? +1???灏????寤哄??渚????宸ヤ??涓?浣跨??瀹?渚????宸ヤ?????寮? +2?????????濮????瀹?渚???剁??宸ヤ????惧?板伐??????杩?琛?锛?浣夸唬?????村彵???缁存?ゃ?? +3???浣垮??淇彸?逛唬?????朵??浼?寮?璧峰お澶х???????彧?????ソ?????彨????с?? + 姣?濡?锛????瀵硅薄A????〖?????淇彸?硅??涓???渚??????规?????灏变?????瀵硅薄B锛?缁ф??A锛???跺????????A?????㈢?????涓??规?????杩???讹??濡????娌℃??宸ュ??妯″?????d??灏辫?????姣忔??寤?A瀵硅薄???浠g????芥?逛负???寤?B瀵硅薄???杩???????徟?????涓?浠朵???????? + 濡???????宸ュ??妯″?????d??锛????浠サ徟嘶?彧淇??瑰伐???涓惧??寤?A瀵硅薄?????规??锛?灏卞徟嘶ュ????杩?浠朵?????浜??????村彵??????锛??徟嘶???杩?涓???渚???????寤哄???????缃彸??浠朵腑?????d??瀵逛??杩?绉??????彧???彧??淇彸?归??缃彸??浠跺氨?徟嘶ュ??〖浜?锛?涓????瑕?淇彸?瑰伐???绫汇?? +""" +from monkey_print2 import print + + +class Xiaomi5: + def __init__(self): + self.phone_name = '灏忕?5' + + def send_msg(self): + print(f'??? {self.phone_name} ?????TEL俊') + + +class Xiaomi6: + def __init__(self): + self.phone_name = '灏忕?6' + + def send_msg(self): + print(f'??? {self.phone_name} ?????TEL俊') + + +def get_xiaomi_phone(phone_type): + if phone_type == '5': + return Xiaomi5() + elif phone_type == '6': + return Xiaomi6() + + +if __name__ == '__main__': + phone5 = get_xiaomi_phone('5') + phone5.send_msg() + + phone6 = get_xiaomi_phone('6') + phone6.send_msg() + + """ + "D:/coding2/python36patterns/???寤哄??妯″??-绠????宸ュ??妯″??.py:15" 14:16:27 ??? 灏忕?5 ?????TEL俊 + "D:/coding2/python36patterns/???寤哄??妯″??-绠????宸ュ??妯″??.py:23" 14:16:27 ??? 灏忕?6 ?????TEL俊 + """ diff --git "a/py_design/347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-mvc346边250边241边345边274边217边.py" "b/py_design/347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-mvc346边250边241边345边274边217边.py" new file mode 100644 index 0000000..c76997d --- /dev/null +++ "b/py_design/347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-mvc346边250边241边345边274边217边.py" @@ -0,0 +1,67 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019钳10奉8泣 0008 21:23 +""" +MVC 妯″?忎籬; Model-View-Controller锛?妯″??-瑙????-?ァ??跺?彧?? 妯″?????杩?绉?妯″?????浜?搴??????搴???????灞?寮??????? + +Model锛?妯″??锛? - 妯″??浠h;涓?涓????????版?彸??瀵硅薄??? JAVA POJO???瀹?涔??徟嘶ュ?????昏??锛??????版?????????舵?存?版ァ??跺????? +View锛?瑙???撅?? - 瑙???句唬琛?妯″????????????版?彸???徟???????? +Controller锛??ァ??跺?彧?? - ?ァ??跺??浣????浜?妯″?????瑙???句?????瀹??ァ??舵?版?彸?????妯″??瀵硅薄锛?骞跺????版?????????舵?存?拌????俱??瀹?浣胯????句??妯″?????绂诲????? +""" +from monkey_print2 import print + +quotes = ('A man is not complete until he is married. Then he is finished.', + 'As I said before, I never repeat myself.', + 'Behind a successful man is an exhausted woman.', + 'Black holes really suck...', 'Facts are stubborn things.') + + +class QuoteModel: + + def get_quote(self, n): + try: + value = quotes[n] + except IndexError as err: + value = 'Not found!' + return value + + +class QuoteTerminalView: + + def show(self, quote): + print('And the quote is: "{}"'.format(quote)) + + def error(self, msg): + print('Error: {}'.format(msg)) + + def select_quote(self): + return input('Which quote number would you like to see?') + + +class QuoteTerminalController: + + def __init__(self): + self.model = QuoteModel() + self.view = QuoteTerminalView() + + def run(self): + valid_input = False + while not valid_input: + n = self.view.select_quote() + try: + n = int(n) + except ValueError as err: + self.view.error("Incorrect index '{}'".format(n)) + else: + valid_input = True + quote = self.model.get_quote(n) + self.view.show(quote) + + +def main(): + controller = QuoteTerminalController() + while True: + controller.run() + +if __name__ == '__main__': + main() \ No newline at end of file diff --git "a/py_design/347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-344边273边243边347边220边206边346边250边241边345边274边217边.py" "b/py_design/347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-344边273边243边347边220边206边346边250边241边345边274边217边.py" new file mode 100644 index 0000000..ba7ac43 --- /dev/null +++ "b/py_design/347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-344边273边243边347边220边206边346边250边241边345边274边217边.py" @@ -0,0 +1,66 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019钳10奉8泣 0008 22:40 + +""" +??????浜?搴????涓炯下?????浠シ?宠?????彵??彸??涓?彾诣>???????ц??涓?涓???澶?涓???瑕???????浣?锛?渚?濡?锛?璁块?彸????? +淇℃?徃???????????璁哥????疯彵??彸?????淇℃?徃?????锛????浠サ?????纭彸???????峰?峰??瓒冲?????????????????浣?绯荤??涓TEL??瀛???? +绫讳技????????碉???????峰??椤诲?锋??绠$????????????????藉??郴缁?涓惧??瑁???扮??搴???? +涓???㈡????扮?????瑕????浣?涓?涓?瀹?涓?瀹?????彸????稿?炽??寤惰?????濮???? +???彟??涓???渚?锛????浠シ?宠?????涓?涓??$???????セ??楂????瀵硅薄??????寤鸿??绋?寤惰????扮????烽??娆$??姝d娇???瀹???? +???杩?琛???? + + + +???浠g??妯″???Proxy Pattern锛?涓炯下??涓?涓?被浠h;?彟??涓?被????????姐??杩?绉?绫诲?????璁捐?℃ā寮忓?浜?缁???????妯″????? + +???浠g??妯″?忎妇枷?????浠サ??寤哄?锋???〖???瀵硅薄???瀵硅薄锛?浠ヤ究???澶???????渚??????芥ˇ?彺?? +""" + + +class SensitiveInfo: + + def __init__(self): + self.users = ['nick', 'tom', 'ben', 'mike'] + + def read(self): + print('There are {} users: {}'.format(len(self.users), ' '.join(self.users))) + + def add(self, user): + self.users.append(user) + print('Added user {}'.format(user)) + + +class Info: + + '''SensitiveInfo???淇???や唬???''' + + def __init__(self): + self.protected = SensitiveInfo() + self.secret = '0xdeadbeef' + + def read(self): + self.protected.read() + + def add(self, user): + sec = input('what is the secret? ') + self.protected.add(user) if sec == self.secret else print("That's wrong!") + + +def main(): + info = Info() + while True: + print('1. read list |==| 2. add user |==| 3. quit') + key = input('choose option: ') + if key == '1': + info.read() + elif key == '2': + name = input('choose username: ') + info.add(name) + elif key == '3': + exit() + else: + print('unknown option: {}'.format(key)) + +if __name__ == '__main__': + main() \ No newline at end of file diff --git "a/py_design/347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-345边244边226边350边247边202边346边250边241边345边274边217边.py" "b/py_design/347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-345边244边226边350边247边202边346边250边241边345边274边217边.py" new file mode 100644 index 0000000..9813c77 --- /dev/null +++ "b/py_design/347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-345边244边226边350边247边202边346边250边241边345边274边217边.py" @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019钳10奉8泣 0008 19:00 +""" +澶?瑙?妯″???Facade Pattern锛??????忕郴?????澶??????э??骞跺??瀹㈡?风????渚?浜?涓?涓????风??徟嘶ヨ?彸畛荤?????ˇ?彺??杩?绉?绫诲?????璁捐?℃ā寮忓?浜?缁???????妯″???瀹?????〖??????绯荤??娣诲??涓?涓?ˇ??????ラ????忕郴?????澶??????с?? + +杩?绉?妯″?忔??????颁??涓???涓????绫伙??璇ョ被???渚?浜?瀹㈡?风?璇锋?????绠??????规?????瀵圭〖???绯荤??绫绘?规?????濮????璋??????? +""" + +from monkey_print2 import print + +class A: + def run(self): + print('A run') + + def jump(self): + print('A jump') + + +class B: + def run(self): + print('B run') + + def jump(self): + print('B jump') + + +class C: + def run(self): + print('C run') + + def jump(self): + print('C jump') + + +class Facade: + def __init__(self): + self.a = A() + self.b = B() + self.c = C() + + def run(self): + for item in ('a', 'b', 'c'): + getattr(self, item).run() + + def jump(self): + for item in ('a', 'b', 'c'): + getattr(self, item).jump() + + +if __name__ == '__main__': + facade = Facade() + facade.run() + facade.jump() diff --git "a/py_design/347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-346边241边245边346边216边245边346边250边241边345边274边217边.py" "b/py_design/347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-346边241边245边346边216边245边346边250边241边345边274边217边.py" new file mode 100644 index 0000000..8819ab7 --- /dev/null +++ "b/py_design/347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-346边241边245边346边216边245边346边250边241边345边274边217边.py" @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019钳10奉8泣 0008 17:39 +""" +妗ユˇ锛?????忎?搴ф.杩??ˇ涓ゅ哺锛????Python绋?搴忚?>腑???妗ユˇ????????徃?借薄?????????瀹?浣??????????杩??ˇ锛?绠??????ヨ???徃獗???绫诲??渚????杩?绉颁腑???杩??ˇ??? + +妗ユˇ妯″?????杩????被???绫诲??渚????涓宝?翠????彧??浣垮?舵?借薄???瀹??〖?徟嘶??ス???????????涓?浜???稿共??帮??杩?灏辨?徃.?ˇ妯″?????澶х??浣??????? + +??稿??????????虫?徃??杩?灏?瑁?锛?灏?涓?涓??借薄绫荤????稿?冲????板????规??????????涓烘.?ˇ绫荤??灞???э??杩???峰??瀹?渚????妗ユˇ绫诲?????杩?淇彸?规.?ˇ绫荤??灞???э??渚垮徟嘶ュ??〖??借薄???瀹??〖涔???寸????ス??????????? + +""" +from monkey_print2 import print + + +class A: + def run(self, name): + print("my name is :{}".format(name)) + + +class B: + def run(self, name): + print("?????????瀛???徆??{}".format(name)) + + +class Bridge: + def __init__(self, ager, classname): + self.ager = ager + self.classname = classname + + def bridge_run(self): + self.classname.run(self.ager) + + +if __name__ == '__main__': + test = Bridge('??????', A()) + test.bridge_run() + test.ager = 'Tome' + test.bridge_run() + test.classname = B() + test.bridge_run() + test.ager = '??????' + test.bridge_run() + """ + "D:/coding2/python36patterns/缁???????妯″??-妗ユˇ妯″??.py:7" 17:56:50 my name is :?????? +"D:/coding2/python36patterns/缁???????妯″??-妗ユˇ妯″??.py:7" 17:56:50 my name is :Tome +"D:/coding2/python36patterns/缁???????妯″??-妗ユˇ妯″??.py:12" 17:56:50 ?????????瀛???徆??Tome +"D:/coding2/python36patterns/缁???????妯″??-妗ユˇ妯″??.py:12" 17:56:50 ?????????瀛???徆???????? + + """ diff --git "a/py_design/347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-347边273边204边345边220边210边346边250边241边345边274边217边.py" "b/py_design/347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-347边273边204边345边220边210边346边250边241边345边274边217边.py" new file mode 100644 index 0000000..b6a6603 --- /dev/null +++ "b/py_design/347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-347边273边204边345边220边210边346边250边241边345边274边217边.py" @@ -0,0 +1,135 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019钳10奉8泣 0008 17:39 +""" +缁????妯″?? +缁????妯″???Composite Pattern锛?锛?????彨???????翠??妯″?????徃??浜????涓?缁???镐技???瀵硅薄褰?浣?涓?涓???涓????瀵硅薄???缁????妯″?忎???彸??褰㈢???????ョ?????瀵硅薄锛??????ヨ;绀洪?????浠ュ????翠??灞?娆<??杩?绉?绫诲?????璁捐?℃ā寮忓?浜?缁???????妯″???瀹????寤轰??瀵硅薄缁???????褰㈢???????? + +杩?绉?妯″?????寤轰??涓?涓????????繁瀵硅薄缁????绫汇??璇ョ被???渚?浜?淇彸?圭?稿??瀵硅薄缁??????瑰????? + +???浠ソ??杩?涓???㈢??瀹?渚???ユ??绀虹?????妯″????????娉????瀹?渚?婕?绀轰??涓?涓???缁?涓惧??宸ョ??灞?娆$???????? + +浠?缁? +?????撅??灏?瀵硅薄缁??????????褰㈢?????浠ヨ;绀?"??????-??翠??"???灞?娆$????????缁????妯″?忎娇???????峰彾???涓?彾诣薄??缁????瀵硅薄???浣跨????锋??涓???存?с?? + +涓昏??瑙e?筹??瀹???????浠シ?????缁?????????彸??涓炯下??妯$??浜?绠???????绱????澶???????绱????姒?蹇碉??瀹㈡?风??搴??徟嘶???澶????绠???????绱?涓???锋?ュ?????澶???????绱?锛?浠????浣垮??瀹㈡?风??搴忎?澶???????绱???????????????瑙h???? + +浣???朵娇??彧?? 1????????宠;绀哄彾诣薄????????-??翠??灞?娆$?????锛????褰㈢?????锛???? 2??????甯?????????峰拷??ョ?????瀵硅薄涓????涓?彾诣薄??涓????锛??????峰??缁?涓???颁娇????????缁????涓布????????瀵硅薄??? + +濡?浣?瑙e?筹????????????彾??瀹??〖缁?涓??ˇ?????????????????????璇ユˇ?彺?? + +??抽?彸榛???锛??????????????????璇ユˇ????骞朵??????????????灞???? List锛??????㈡?? Component??? + +搴????瀹?渚?锛? 1???绠???徃;杈惧???????シ??浣???般?????浣?绗????彟??涓???浣???帮????朵腑锛??彟??涓???浣?绗????徟嘶??徃??浣???般?????浣?绗????彟??涓???浣???般?? 2?????? JAVA AWT ??? SWING 涓炯下??瀵逛?? Button ??? Checkbox ??徃???彾??Container ??徃???????? + +浼???癸?? 1???楂?灞?妯″??璋???????????? 2????????硅???卞???????? + +缂虹?癸?????浣跨???????妯″????讹????跺彾??????????????澹版????芥?????〖绫伙?????涓???徃荨????杩????浜?渚?璧????缃????????? + +浣跨????烘?徆?????????????翠????烘?徆??濡????褰㈣?????锛????浠躲?????浠跺す???绠$????? + +娉???忎?椤癸??瀹?涔???朵负??蜂??绫汇?? + +""" +from monkey_print2 import print + + +# Component锛???サ徃?借薄绫? +class Company: + name = '' + + def __init__(self, name): + self.name = name + + def add(self, company): + pass + + def remove(self, company): + pass + + def display(self, depth): + pass + + def line_of_duty(self): # 灞ヨ?????璐? + pass + + # Composite锛???サ徃绫 + + +class ConcreteCompany(Company): + childrenCompany = None + + def __init__(self, name): + Company.__init__(self, name) + self.childrenCompany = [] + + def add(self, company): + self.childrenCompany.append(company) + + def remove(self, company): + self.childrenCompany.remove(company) + + def display(self, depth): + print('-' * depth + self.name) + + for component in self.childrenCompany: + component.display(depth + 2) + + def line_of_duty(self): # 灞ヨ?????璐? + for component in self.childrenCompany: + component.line_of_duty() + + +# Leaf锛???蜂???????介???? +class HRDepartment(Company): + def __init__(self, name): + Company.__init__(self, name) + + def display(self, depth): + print('-' * depth + self.name) + + def line_of_duty(self): # 灞ヨ?????璐? + print('%s\t???宸ユ???????硅彴哏??' % self.name) + + +# Leaf锛???蜂???????介???? +class FinanceDepartment(Company): + def __init__(self, name): + Company.__init__(self, name) + + def display(self, depth): + print('-' * depth + self.name) + + def line_of_duty(self): # 灞ヨ?????璐? + print('%s\t??サ徃璐??℃?舵?徃?$??' % self.name) + + + + +if __name__ == '__main__': + root = ConcreteCompany('???浜シ?诲?サ??') + root.add(HRDepartment('??诲?サ徃浜???璧?婧????')) + root.add(FinanceDepartment('??诲?サ徃璐??¢??')) + + comp = ConcreteCompany('???涓??????サ??') + comp.add(HRDepartment('???涓??????サ徃浜???璧?婧????')) + comp.add(FinanceDepartment('???涓??????サ徃璐??¢??')) + root.add(comp) + + comp1 = ConcreteCompany('???浜サ??浜?澶?') + comp1.add(HRDepartment('???浜サ??浜?澶?浜哄??璧?婧????')) + comp1.add(FinanceDepartment('???浜サ??浜?澶?璐㈠?¢??')) + comp.add(comp1) + + comp2 = ConcreteCompany('??惧?????浜?澶?') + comp2.add(HRDepartment('??惧?????浜?澶?浜哄??璧?婧????')) + comp2.add(FinanceDepartment('??惧?????浜?澶?璐㈠?¢??')) + comp.add(comp2) + + print('-------??サ徃????????-------') + root.display(1) + + print('\n-------???璐?-------') + root.line_of_duty() + + diff --git "a/py_design/347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-350边243边205边351边245边260边350边200边205边346边250边241边345边274边217边-345边207边275边346边225边260边350边243边205边351边245边260边345边231边250边.py" "b/py_design/347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-350边243边205边351边245边260边350边200边205边346边250边241边345边274边217边-345边207边275边346边225边260边350边243边205边351边245边260边345边231边250边.py" new file mode 100644 index 0000000..c18e67e --- /dev/null +++ "b/py_design/347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-350边243边205边351边245边260边350边200边205边346边250边241边345边274边217边-345边207边275边346边225边260边350边243边205边351边245边260边345边231边250边.py" @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019钳10奉8泣 0008 18:32 +""" +??芥?拌??楗板?? +""" +import time +from functools import wraps +from monkey_print2 import print + + +def timethis(func): + ''' + Decorator that reports the execution time. + ''' + + @wraps(func) + def wrapper(*args, **kwargs): + start = time.time() + result = func(*args, **kwargs) + end = time.time() + print(func.__name__, end - start) + return result + + return wrapper + + +@timethis +def fun(): + time.sleep(3) + return 1 + + +if __name__ == '__main__': + fun() diff --git "a/py_design/347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-350边243边205边351边245边260边350边200边205边346边250边241边345边274边217边-347边261边273边350边243边205边351边245边260边345边231边250边.py" "b/py_design/347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-350边243边205边351边245边260边350边200边205边346边250边241边345边274边217边-347边261边273边350边243边205边351边245边260边345边231边250边.py" new file mode 100644 index 0000000..a4fd27e --- /dev/null +++ "b/py_design/347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-350边243边205边351边245边260边350边200边205边346边250边241边345边274边217边-347边261边273边350边243边205边351边245边260边345边231边250边.py" @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019钳10奉8泣 0008 18:32 +""" +绫昏??楗板?? +""" +import types +from functools import wraps +from monkey_print2 import print + + + +class Profiled: + def __init__(self, func): + wraps(func)(self) + self.ncalls = 0 + + def __call__(self, *args, **kwargs): + self.ncalls += 1 + return self.__wrapped__(*args, **kwargs) + + def __get__(self, instance, cls): + if instance is None: + return self + else: + return types.MethodType(self, instance) + +@Profiled +def add(x, y): + return x + y + +class Spam: + @Profiled + def bar(self, x): + print(self, x) + +if __name__ == '__main__': + add(2, 3) + add(4, 5) + print(add.ncalls) + + s = Spam() + s.bar(1) + s.bar(2) + s.bar(3) + print(Spam.bar.ncalls) + diff --git "a/py_design/347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-350边243边205边351边245边260边350边200边205边346边250边241边345边274边217边.py" "b/py_design/347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-350边243边205边351边245边260边350边200边205边346边250边241边345边274边217边.py" new file mode 100644 index 0000000..96c5c49 --- /dev/null +++ "b/py_design/347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-350边243边205边351边245边260边350边200边205边346边250边241边345边274边217边.py" @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019钳10奉8泣 0008 18:24 + +""" +???璁轰????舵??浠シ?冲彾忆?涓?彾诣薄娣???棰?澶?????????斤????芥??涓???㈣??浜?涓?????????????规????? +??? 濡??????????锛??徟嘶??存ˇ灏??????芥坊?????板彾诣薄??灞????绫伙??渚?濡?锛?娣诲??涓?涓??扮????规??锛? +??? 浣跨??????? +??? 浣跨??户??? +涓?缁ф?跨?告??锛????甯稿??璇ヤ??????????彨?????锛????涓虹户??夸娇寰?浠g????撮?惧????彧??缁ф?垮?崇郴??徃????????锛?骞朵??搴????浜???翠釜绫讳互???杩?涓?被?????????瀹?渚?锛?璇峰?????锛?GOF95锛?绗?31椤碉冀???缃?椤碉蓟t.cn/RqrC8Yo锛斤????? +璁捐?℃ā寮忎负??浠シ??渚?绗サ??绉???????规??锛?浠ユ?徃??????????帮??杩?琛???讹????彨??涓?涓?彾诣薄???????斤??杩?绉???规??灏辨?徃倏グ?????淇彸謦??彧??Decorator锛?妯″????藉??浠ラ??????????瑰???涓?浼?褰卞????朵??瀵硅薄锛?????????板???????芥坊?????颁??涓?彾诣>腑锛?璇峰?????锛?GOF95锛?绗?196椤碉冀锛???? +???深澶?缂?绋?璇焊??涓炯下??浣跨??瀛?绫诲??锛?缁ф?匡????ュ???〖淇彸謦???妯″???璇峰?????锛?GOF95锛?绗?198椤碉冀锛???? +???Python涓炯下?????浠サ徟嘶ワ?骞朵??搴?璇ワ??浣跨?????缃彸??淇彸謦????规?с??涓?涓?Python淇彸謦???灏辨??彾襊ython璇面?????涓?涓??瑰????瑰??锛????浜???彨??涓?涓?被?????规???????芥?扮??琛?涓猴???????????浣跨??户??裤??浠?瀹??〖???瑙?搴??ヨ?锛? +Python淇彸謦?????徃??涓?徟?????瀵硅薄锛???芥?般????规?????绫伙??锛??ˇ???涓?涓??芥?板彾诣?fin浣?涓鸿????ワ??骞惰??????彟??涓??芥?板彾诣? ???杩??????崇???徟嘶ュ?浠讳????锋??杩?浜?灞???х???徟?????瀵硅薄褰?浣?涓?涓彨婵グ?????????1绔????绗?2绔?涓惧凡缁??????板??浣?浣跨?????缃彸??property淇彸謦???彴箱?涓??规??琛?〖涓轰??涓????????????5.4???锛????浠サ??瀛???濡?浣?瀹??〖???浣跨?????浠セ??繁???淇彸謦?????? +淇彸謦???妯″?????Python淇彸謦???涔???村苟涓???徃??瀵逛?????绛?浠峰?崇郴???Python淇彸謦????藉?????瀹????涓?姣?淇彸謦???妯″?忓?寰?澶?锛???朵腑涔?涓?灏辨?????〖淇彸謦???妯″?? +""" +from monkey_print2 import print + +class Foo: + def f1(self): + print("original f1") + + def f2(self): + print("original f2") + + +class Foo_decorator: + def __init__(self, decoratee): + self._decoratee = decoratee + + def f1(self): + print("before run f1") + self._decoratee.f1() + print("after run f1") + + def __getattr__(self, name): + return getattr(self._decoratee, name) + +if __name__ == '__main__': + u = Foo() + v = Foo_decorator(u) + v.f1() + v.f2() \ No newline at end of file diff --git "a/py_design/347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-351边200边202边351边205边215边345边231边250边346边250边241边345边274边217边.py" "b/py_design/347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-351边200边202边351边205边215边345边231边250边346边250边241边345边274边217边.py" new file mode 100644 index 0000000..743dcf5 --- /dev/null +++ "b/py_design/347边273边223边346边236边204边345边236边213边346边250边241边345边274边217边-351边200边202边351边205边215边345边231边250边346边250边241边345边274边217边.py" @@ -0,0 +1,73 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019钳10奉8泣 0008 17:39 +""" +?????????妯″???Adapter Pattern锛???徃??涓轰袱涓彨????煎彵????ˇ??????寸??妗ユ?????杩?绉?绫诲?????璁捐?℃ā寮忓?浜?缁???????妯″???瀹?缁????浜?涓や釜??ス???ˇ?????????姐?? + +杩?绉?妯″?忔??????颁??涓???涓????绫伙??璇ョ被璐?璐e????ョ?ス????????涓???煎彵????ˇ??????姐??涓句釜???瀹????渚?瀛?锛?璇诲?″????徃??涓哄??瀛???″??绗?璁版?コ????寸?????????????????灏????瀛???℃????ヨ彾??″?彧?????灏?璇诲?″???????ョ??璁版?ロ??杩???峰氨?徟嘶???杩?绗?璁版?シ?ヨ彾??????瀛???<?? + +""" +from monkey_print2 import print + + +class Dog: + def __init__(self, name): + self.name = name + + def wangwang(self): + print('my name is' + self.name + '?????????姹?豹姹彨????????') + + def dog_run(self): + print(f'{self.name} is running') + + +class Cat: + def __init__(self, name): + self.name = name + + def miaomiao(self): + print('my name is' + self.name + '???????????靛?靛?点????????') + + def cat_run(self): + print(f'{self.name} is running') + + +class Sheep: + def __init__(self, name): + self.name = name + + def miemie(self): + print('my name is' + self.name + '???????????彨?彨????????') + + def sheet_run(self): + print(f'{self.name} is running') + + +class Adapter: + def __init__(self, adapted_methods): + + self.__dict__.update(adapted_methods) + + def speak(self): + pass + + def run(self): + pass + + +def main(): + animals = [] + dog = Dog('??鸿储') + cat = Cat('澶ц?哥??') + sheep = Sheep('???娲?娲?') + animals.append(Adapter({'speak': dog.wangwang, 'run': dog.dog_run})) + animals.append(Adapter({'speak': cat.miaomiao, 'run': cat.cat_run})) + animals.append(Adapter({'speak': sheep.miemie, 'run': sheep.sheet_run})) + + for a in animals: + a.speak() + a.run() + + +if __name__ == "__main__": + main() diff --git "a/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-344边270边255边344边273边213边350边200边205边346边250边241边345边274边217边.py" "b/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-344边270边255边344边273边213边350边200边205边346边250边241边345边274边217边.py" new file mode 100644 index 0000000..1c4a3ed --- /dev/null +++ "b/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-344边270边255边344边273边213边350边200边205边346边250边241边345边274边217边.py" @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019钳10奉9泣 0009 11:13 + +""" +涓TEL?????妯″??(Mediator Pattern):???涓?涓?彾诣薄?ュ??瑁?涓?绯诲?????瀵硅薄浜や??锛?涓TEL?????浣垮??瀵硅薄涓????瑕???剧ず??扮?镐??寮???彧??浠????浣胯??????炬?o?????涓??徟嘶??ス????版?瑰??瀹?浠コ????寸??浜や??. +""" +from monkey_print2 import print +class ChatRoom: + @staticmethod + def show_message(user,msg): + print(f'{user.name} 璇达?? {msg}') + +class User: + def __init__(self,name): + self.name = name + + def send_msg(self,msg): + ChatRoom.show_message(self,msg) + +if __name__ == '__main__': + user1 = User('灏????') + user2 = User('灏忕?') + user1.send_msg('??彨??濂?') + user2.send_msg('???涓?濂?') + + """ + "D:/coding2/python36patterns/琛?涓哄??妯″??-涓TEL?????妯″??.py:12" 11:21:04 灏???? 璇达?? ??彨??濂? +"D:/coding2/python36patterns/琛?涓哄??妯″??-涓TEL?????妯″??.py:12" 11:21:04 灏忕? 璇达?? ???涓?濂? + """ \ No newline at end of file diff --git "a/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边217边221边345边270边203边350边256边242边351边230边205边346边250边241边345边274边217边.py" "b/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边217边221边345边270边203边350边256边242边351边230边205边346边250边241边345边274边217边.py" new file mode 100644 index 0000000..056066f --- /dev/null +++ "b/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边217边221边345边270边203边350边256边242边351边230边205边346边250边241边345边274边217边.py" @@ -0,0 +1,80 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019钳10奉9泣 0009 10:39 + +"""???瑕?绋?搴? ????????? +璁㈤??-???甯?妯″?????瑙?瀵????妯″?忔?蹇电?镐技锛?浣????????-???甯?妯″?忎妇枷??璁㈤???????????甯????涔???村??浜?涓?灞?涓宝?翠欢锛?涓?涓???借薄??烘?ョ??淇℃?徃??搴?腑蹇???? + +浣???跺??娌℃??蹇?瑕?澶?繁绌? 2 ?????哄???????涓恒??Head First 璁捐?℃ā寮????杩???ス????镐功??藉??浜?锛????甯?+璁㈤??=瑙?瀵????妯″???????舵?稿???????虫?徃?舵????瑰????????甯??????ャ?????姝ゅ?虹??涓?锛???规?缎彽箬???规?э??杩?琛?瀹??〖??冲徟?? + +瀵规??瑙?瀵????妯″????????23绉?缁???歌彵予妯″?????????????サ??甯?璁㈤??璁捐?℃ā寮????哄??寰?灏???? +""" + +class Event: + def __init__(self): + self.client_list = {} + + def listen(self, key, fn): + if key not in self.client_list: + self.client_list[key] = [] + self.client_list[key].append(fn) + + def trigger(self, *args, **kwargs): + fns = self.client_list[args[0]] + + length = len(fns) + if not fns or length == 0: + return False + + for fn in fns: + fn(*args[1:], **kwargs) + + return False + + def remove(self, key, fn): + if key not in self.client_list or not fn: + return False + + fns = self.client_list[key] + length = len(fns) + + for _fn in fns: + if _fn == fn: + fns.remove(_fn) + + return True + + +# ?????彨谢??夸负瀵硅薄瀹?瑁? ???甯?-璁㈤?? ?????? +class SalesOffice(Event): + def __init__(self): + super().__init__() + + +# ??规?缎??繁???姹?瀹?涔?涓?涓??芥?帮??渚?浜?浠跺?????瀹????璋???? +def handle_event(event_name): + def _handle_event(*args, **kwargs): + print("Price is", *args, "at", event_name) + + return _handle_event + + +if __name__ == "__main__": + # ???寤?2涓???璋???芥?? + fn1 = handle_event("event01") + fn2 = handle_event("event02") + + sales_office = SalesOffice() + + # 璁㈤??event01 ??? event02 杩?2涓彨??浠讹??骞朵??缁?瀹???稿?崇?? 瀹????????????芥?? + sales_office.listen("event01", fn1) + sales_office.listen("event02", fn2) + + # 褰?涓や釜浜?浠跺???????跺??锛?瑙?????????琛?缁?瀹??????稿?冲?芥?? + sales_office.trigger("event01", 1000) + sales_office.trigger("event02", 2000) + + sales_office.remove("event01", fn1) + + # ?????帮??False + print(sales_office.trigger("event01", 1000)) diff --git "a/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边221边275边344边273边244边346边250边241边345边274边217边.py" "b/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边221边275边344边273边244边346边250边241边345边274边217边.py" new file mode 100644 index 0000000..dcb6702 --- /dev/null +++ "b/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边221边275边344边273边244边346边250边241边345边274边217边.py" @@ -0,0 +1,90 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019钳10奉9泣 0009 9:29 +""" +??戒护妯″???Command Pattern锛???徃??绉???版?彸鰋?????璁捐?℃ā寮??瀹?灞?浜?琛?涓哄??妯″?????璇锋??浠ュ?戒护???褰㈠?????瑁瑰??瀵硅薄涓炯下??骞朵??缁?璋????瀵硅薄???璋????瀵硅薄瀵绘?惧徟嘶ュ????璇ュ?戒护????????????瀵硅薄锛?骞舵??璇ュ?戒护浼?缁???稿?????瀵硅薄锛?璇ュ彾诣薄?ц????戒护??? + + +?〖???澶???板??????芥????ら?????浣??????界?堕?句互??宠薄锛?浣????寰?澶?骞撮??锛?浠讳??杞徃倩朵覆糮瀹???戒??瀛??????ら?? +???浣??????ら?????浣??????1974骞村????ョ??锛?璇峰?????缃?椤碉蓟t.cn/Rqr3N22锛斤??锛?浣?Fortran???Lisp????????彨??1957 +骞村??1958骞村氨宸插??寤轰????ら?????浣?锛?璇峰?????缃?椤碉蓟t.cn/Rqr3067锛斤??锛?杩?涓ら??彽箬?浠????浜哄箍娉?浣跨????? +????d??骞撮??锛???????蹇?涓???充娇???搴????蒋浠躲????徃??涓?涓???璇徆???????蜂??娌>??涔?渚挎?锋?瑰????戒慨姝e????? +""" +import os + +verbose = True + + +class RenameFile: + + def __init__(self, path_src, path_dest): + self.src, self.dest = path_src, path_dest + + def execute(self): + if verbose: + print("[renaming '{}' to '{}']".format(self.src, self.dest)) + os.rename(self.src, self.dest) + + def undo(self): + if verbose: + print("[renaming '{}' back to '{}']".format(self.dest, self.src)) + os.rename(self.dest, self.src) + + +class CreateFile: + + def __init__(self, path, txt='hello world\n'): + self.path, self.txt = path, txt + + def execute(self): + if verbose: + print("[creating file '{}']".format(self.path)) + with open(self.path, mode='w', encoding='utf-8') as out_file: + out_file.write(self.txt) + + def undo(self): + delete_file(self.path) + + +class ReadFile: + + def __init__(self, path): + self.path = path + + def execute(self): + if verbose: + print("[reading file '{}']".format(self.path)) + with open(self.path, mode='r', encoding='utf-8') as in_file: + print(in_file.read(), end='') + + +def delete_file(path): + if verbose: + print("deleting file '{}'".format(path)) + os.remove(path) + + +def main(): + orig_name, new_name = 'file1', 'file2' + + commands = [] + for cmd in CreateFile(orig_name), ReadFile(orig_name), RenameFile(orig_name, new_name): + commands.append(cmd) + + [c.execute() for c in commands] + + answer = input('reverse the executed commands? [y/n] ') + + if answer not in 'yY': + print("the result is {}".format(new_name)) + exit() + + for c in reversed(commands): + try: + c.undo() + except AttributeError as e: + pass + + +if __name__ == '__main__': + main() diff --git "a/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边244边207边345边277边230边345边275边225边346边250边241边345边274边217边.py" "b/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边244边207边345边277边230边345边275边225边346边250边241边345边274边217边.py" new file mode 100644 index 0000000..fe68882 --- /dev/null +++ "b/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边244边207边345边277边230边345边275边225边346边250边241边345边274边217边.py" @@ -0,0 +1,81 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019钳10奉9泣 0009 11:22 + +""" +澶?蹇?褰?妯″?? +澶?蹇?褰?妯″???Memento Pattern锛?淇?瀛?涓?涓?彾诣薄?????涓??舵??锛?浠ヤ究?????褰??????跺????㈠??瀵硅薄???澶?蹇?褰?妯″?忓?浜?琛?涓哄??妯″????? + +浠?缁? +?????撅?????涓???村?忓?瑁???х????????涓?锛?????キ涓?涓?彾诣薄?????????舵??锛?骞跺??彽襄璞′?澶?淇?瀛?杩?涓??舵????? + +涓昏??瑙e?筹?????璋?澶?蹇?褰?妯″?忓氨????涓???村?忓?瑁??????????涓?锛?????キ涓?涓?彾诣薄?????????舵??锛?骞跺??彽襄璞′?澶?淇?瀛?杩?涓??舵??锛?杩???峰徟嘶???浠ュ??灏?瀵硅薄??㈠????板?????淇?瀛??????舵????? + +浣???朵娇??彧??寰?澶???跺?????浠シ?绘?徃??瑕?璁板??涓?涓?彾诣薄?????????舵??锛?杩???峰???????彸??灏辨?徃俑轰????璁哥????峰??娑?涓?纭????????????璇徃?????浣?锛???藉????㈠????颁?????????????舵??锛?浣垮??浠????"?????????"?徟????? + +濡?浣?瑙e?筹?????杩?涓?涓???蹇?褰?绫讳?????瀛????瀵硅薄??舵????? + +??抽?彸榛???锛?瀹㈡?蜂??涓?澶?蹇?褰?绫昏????锛?涓?澶?蹇?褰?绠$??绫昏??????? + +搴????瀹?渚?锛? 1???????????徃?? 2??????娓告????剁??瀛?妗c?? 3???Windows ?????? ctri + z??? 4???IE 涓布??????????? 4?????版???????浜???$?$????? + +浼???癸?? 1???缁??????锋??渚?浜?涓?绉??徟嘶??㈠????舵???????哄?讹???徟嘶ヤ娇????疯?藉??姣?杈???逛究??板????版??涓????彶????舵????? 2???瀹??〖浜?淇℃?徃??灏?瑁?锛?浣垮???????蜂?????瑕???冲????舵?????淇?瀛?缁??????? + +缂虹?癸??娑????璧?婧????濡????绫荤?????????????忚?澶?锛???垮??浼???????姣?杈?澶х??璧?婧?锛????涓?姣忎?娆>??瀛???戒??娑????涓?瀹???????瀛???? + +浣跨????烘?徆?? 1??????瑕?淇?瀛?/??㈠????版?彸????稿?崇?舵????烘?徃?? 2??????渚?涓?涓?徟??婊???????浣???? + +娉???忎?椤癸?? 1???涓轰??绗???杩?背??瑰?????锛?杩?瑕?澧????涓?涓??$??澶?蹇?褰????绫汇?? 2???涓轰?????绾???瀛?锛??徟私?????????妯″??+澶?蹇?褰?妯″????? +""" +from monkey_print2 import print +#!/usr/bin/env python +# -*- coding:utf-8 -*- + +__author__ = 'Andy' +""" +澶ц??璁捐?℃ā寮? +璁捐?℃ā寮???????澶?蹇?褰?妯″?? +澶?蹇?褰?妯″??(Memento Pattern):涓???村?忓?瑁???х????????涓?????キ涓?涓?彾诣薄?????????舵??锛?骞跺??彽襄璞′?澶?淇?瀛?杩?涓??舵??,杩???峰凡缁????灏卞徟??璇ュ彾诣薄?㈠????板?????淇?瀛??????舵?? +""" +from monkey_print2 import print +# ???璧蜂汉绫? +class Originator(object): + + def __init__(self, state): + self.state = state + + def create_memento(self): + return Memento(self.state) + + def set_memento(self, memento): + self.state = memento.state + + def show(self): + print("褰??????舵?? ", self.state) + +# 澶?蹇?褰?绫? +class Memento(object): + + def __init__(self, state): + self.state = state + +# 绠$?????绫? +class Caretaker(object): + + def __init__(self,memento): + self.memento = memento + + + +if __name__ == "__main__": + # ???濮???舵?? + originator = Originator(state='On') + originator.show() + # 澶?蹇?褰? + caretaker = Caretaker(originator.create_memento()) + # 淇彸?圭?舵?? + originator.state = 'Off' + originator.show() + # 澶??????舵?? + originator.set_memento(caretaker.memento) + originator.show() \ No newline at end of file diff --git "a/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边273边266边350边277边237边350边256边241边347边256边227边347边274边223边345边255边230边346边250边241边345边274边217边.py" "b/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边273边266边350边277边237边350边256边241边347边256边227边347边274边223边345边255边230边346边250边241边345边274边217边.py" new file mode 100644 index 0000000..294497e --- /dev/null +++ "b/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-345边273边266边350边277边237边350边256边241边347边256边227边347边274边223边345边255边230边346边250边241边345边274边217边.py" @@ -0,0 +1,95 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019钳10奉8泣 0008 17:12 +""" +23绉?璁捐?℃ā寮忎该娌????????拌??涓?绉???? +???浜???ц??浠d环姣?杈?澶х????烘?徃???徟嘶?????彥冒镐?缂?瀛???????缂?瀛?涓?娈垫?堕?淬?? + +""" +import sys +import time +from functools import wraps + +from monkey_print2 import print + +class cached_class_property(object): + """绫诲????х??瀛?瑁?楗板??,?????规?????缁????缂?瀛?涓虹被灞????""" + + def __init__(self, func): + self.func = func + + def __get__(self, obj, cls): + if obj is None: + return self + value = self.func(obj) + setattr(cls, self.func.__name__, value) + return value + + +# noinspection PyPep8Naming +class cached_instance_property(object): + """瀹?渚?灞???х??瀛?瑁?楗板?彧???????规?????缁????缂?瀛?涓哄??渚?灞????""" + + def __init__(self, func): + self.func = func + + def __get__(self, obj, cls): + print(obj, cls) + if obj is None: + return self + value = obj.__dict__[self.func.__name__] = self.func(obj) + return value + + + +class FunctionResultCacher: + """ + 浣垮?芥?扮??缁????缂?瀛????瀹??????堕?淬??渚?濡????5?????????宸茬????ヨ彽逛?娣卞?崇??澶彥??锛????娆¤???????ュぉ姘??????芥?扮?存ˇ杩????涔??????ヨ彽???澶彥????? + + """ + func_result_dict = {} + """ + { + (f1,(1,2,3,4)):(10,1532066199.739), + (f2,(5,6,7,8)):(26,1532066211.645), + } + """ + + @classmethod + def cached_function_result_for_a_time(cls, cache_time: float): + """ + ??芥?扮??缁????缂?瀛?涓?娈垫?堕?磋??楗板??,涓?瑕?瑁?楗板???????缁??????徃??澶у??绗?覆????????朵????????澶у??瀛??????版?彸?????涓??????芥?颁????€?? + :param cache_time :缂?瀛??????堕?? + :type cache_time : float + """ + + def _cached_function_result_for_a_time(fun): + + @wraps(fun) + def __cached_function_result_for_a_time(*args, **kwargs): + # print(cls.func_result_dict) + # if len(cls.func_result_dict)> 1024: + if sys.getsizeof(cls.func_result_dict)> 100 * 1000 * 1000: + cls.func_result_dict.clear() + + key = cls._make_arguments_to_key(args, kwargs) + if (fun, key) in cls.func_result_dict and time.time() - cls.func_result_dict[(fun, key)][1] < cache_time: + return cls.func_result_dict[(fun, key)][0] + else: + print('??芥?? [{}] 姝ゆ?涓???戒娇?????瀛?'.format(fun.__name__)) + result = fun(*args, **kwargs) + cls.func_result_dict[(fun, key)] = (result, time.time()) + return result + + return __cached_function_result_for_a_time + + return _cached_function_result_for_a_time + + @staticmethod + def _make_arguments_to_key(args, kwds): + key = args + if kwds: + sorted_items = sorted(kwds.items()) + for item in sorted_items: + key += item + return key # ???绁??徟嘶??稿????? \ No newline at end of file diff --git "a/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-346边250边241边346边235边277边346边250边241边345边274边217边.py" "b/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-346边250边241边346边235边277边346边250边241边345边274边217边.py" new file mode 100644 index 0000000..f6cf7ea --- /dev/null +++ "b/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-346边250边241边346边235边277边346边250边241边345边274边217边.py" @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019/10/9 0009 10:28 +"""???瑕?绋?搴? ??????????????? +???甯哥?????????剁??涓?绉?璁捐?℃ā寮??璇寸?戒??灏辨?徃饣??裤??绛???ユā寮忚缃?灏辨?徃???????? +??????oop 4姝ヨ浆?????サ?????????????\????????????村箍??? + +1.??烘?徆?? + +?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 1.1 褰?澶?涓???娉????绫诲???〖绫讳技?????稿????昏???????跺????? + +?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 1.2 ???瀛?绫讳腑瀹??〖绠?娉??????彨????忓????澶?浠g???????跺????? + +?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 1.3 ?徟嘶ヨ畯??绫诲?彨???????瀹??〖琛?涓烘?ュ??涔?澶?涓???娉??????跺????? + +2.??彸??锛? + +?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 2.1 浣跨????烘?シ??浣?瀹?涔?绠?娉????妗???躲?? + +?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 2.2 ?????板??涔?瀛?绫荤?????浜????浣?锛??????????淇彸?圭??娉????缁??????? + +?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 2.3 瀹??〖浠g????????骞堕?垮?????澶?宸ヤ?? + +?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 2.4 ??彨????????ˇ?彺??瀹??〖 + +""" + +from abc import ABCMeta, abstractmethod +from monkey_print2 import print + + +# ??借薄??规?? AbstractClass +class AbstractClass(metaclass=ABCMeta): + def __init__(self): + pass + + @abstractmethod + def operation1(self): + pass + + @abstractmethod + def operation2(self): + pass + + def operation3(self): + print('???浣?3') + + # 妯℃?挎?规?? tmplate_method() + def template_method(self): + print("Defining the Algorithm.Operation1 follows Operation2") + self.operation2() + self.operation1() + self.operation3() + + +# ??蜂??绫? ConcreteClass +class ConcreteClass(AbstractClass): + def operation1(self): + print("My Concrete Operation1") + + def operation2(self): + print("Operation 2 remains same") + + +if __name__ == '__main__': + concreate = ConcreteClass() + concreate.template_method() + + """ + "D:/coding2/python36patterns/琛?涓哄??妯″??-妯℃?挎ā寮?.py:47" 10:35:10 Defining the Algorithm.Operation1 follows Operation2 +"D:/coding2/python36patterns/琛?涓哄??妯″??-妯℃?挎ā寮?.py:59" 10:35:10 Operation 2 remains same +"D:/coding2/python36patterns/琛?涓哄??妯″??-妯℃?挎ā寮?.py:56" 10:35:10 My Concrete Operation1 +"D:/coding2/python36patterns/琛?涓哄??妯″??-妯℃?挎ā寮?.py:43" 10:35:10 ???浣?3 + + """ diff --git "a/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-347边212边266边346边200边201边346边250边241边345边274边217边.py" "b/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-347边212边266边346边200边201边346边250边241边345边274边217边.py" new file mode 100644 index 0000000..bd5e206 --- /dev/null +++ "b/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-347边212边266边346边200边201边346边250边241边345边274边217边.py" @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019/10/9 0009 10:08 +""" +????舵??妯″???State Pattern锛?涓炯下??绫荤??琛?涓烘???轰??瀹??????舵????瑰????????杩?绉?绫诲?????璁捐?℃ā寮忓?浜?琛?涓哄??妯″????? + +????舵??妯″?忎妇枷?????浠サ??寤鸿;绀哄??绉???舵?????瀵硅薄???涓?涓???涓洪???????舵??瀵硅薄??瑰???????瑰????? context 瀵硅薄??? +""" + + +class State(object): + """Base state. This is to share functionality""" + + def scan(self): + """Scan the dial to the next station""" + self.pos += 1 + if self.pos == len(self.stations): + self.pos = 0 + print("Scanning... Station is", self.stations[self.pos], self.name) + + +class AmState(State): + def __init__(self, radio): + self.radio = radio + self.stations = ["1250", "1380", "1510"] + self.pos = 0 + self.name = "AM" + + def toggle_amfm(self): + print("Switching to FM") + self.radio.state = self.radio.fmstate + + +class FmState(State): + def __init__(self, radio): + self.radio = radio + self.stations = ["81.3", "89.1", "103.9"] + self.pos = 0 + self.name = "FM" + + def toggle_amfm(self): + print("Switching to AM") + self.radio.state = self.radio.amstate + + +class Radio(object): + """A radio. It has a scan button, and an AM/FM toggle switch.""" + + def __init__(self): + """We have an AM state and an FM state""" + self.amstate = AmState(self) + self.fmstate = FmState(self) + self.state = self.amstate + + def toggle_amfm(self): + self.state.toggle_amfm() + + def scan(self): + self.state.scan() + + +# Test our radio out +if __name__ == '__main__': + radio = Radio() + actions = [radio.scan] * 2 + [radio.toggle_amfm] + [radio.scan] * 2 + actions = actions * 2 + + for action in actions: + action() + + """ + Scanning... Station is 1380 AM + Scanning... Station is 1510 AM + Switching to FM + Scanning... Station is 89.1 FM + Scanning... Station is 103.9 FM + Scanning... Station is 81.3 FM + Scanning... Station is 89.1 FM + Switching to AM + Scanning... Station is 1250 AM + Scanning... Station is 1380 AM + """ \ No newline at end of file diff --git "a/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-347边231边273边350边256边260边346边250边241边345边274边217边.py" "b/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-347边231边273边350边256边260边346边250边241边345边274边217边.py" new file mode 100644 index 0000000..d767e2d --- /dev/null +++ "b/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-347边231边273边350边256边260边346边250边241边345边274边217边.py" @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019/10/9 0009 13:53 +""" +??昏彴铈ā??????????涓?徟嘶??奸【???渚?妯″????????寤哄??绠$????? +""" +class RegistryHolder(type): + + REGISTRY = {} + + def __new__(cls, name, bases, attrs): + new_cls = type.__new__(cls, name, bases, attrs) + """ + Here the name of the class is used as key but it could be any class + parameter. + """ + cls.REGISTRY[new_cls.__name__] = new_cls + return new_cls + + @classmethod + def get_registry(cls): + return dict(cls.REGISTRY) + + +class BaseRegisteredClass(metaclass=RegistryHolder): + """ + Any class that will inherits from BaseRegisteredClass will be included + inside the dict RegistryHolder.REGISTRY, the key being the name of the + class and the associated value, the class itself. + """ + + +if __name__ == "__main__": + print(sorted(RegistryHolder.REGISTRY)) + + class ClassRegistree(BaseRegisteredClass): + def __init__(self, *args, **kwargs): + pass + + + print(sorted(RegistryHolder.REGISTRY)) \ No newline at end of file diff --git "a/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-347边255边226边347边225边245边346边250边241边345边274边217边.py" "b/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-347边255边226边347边225边245边346边250边241边345边274边217边.py" new file mode 100644 index 0000000..4a903ea --- /dev/null +++ "b/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-347边255边226边347边225边245边346边250边241边345边274边217边.py" @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019/10/9 0009 10:12 +"""???瑕?绋?搴? ???????????? + +绛???ユā寮??Strategy pattern锛?榧???变娇???澶?绉?绠?娉???ヨВ??充??涓??彸??锛???舵?????绾х?规?ф?徃?藉??????? +琛???堕???????板????㈢??娉?锛?瀹㈡?风?浠g??瀵瑰?????????????ワ????????姝わ??濡????浣????涓ょ??绠?娉?锛?骞朵????ラ????朵腑涓? +绉?瀵瑰????忚???ユ???????村ソ锛??彟??绉?瀵瑰ぇ??忚???ユ???????村ソ锛?????徟嘶ヤ娇??????ユā寮??????琛???跺?轰??杈???ユ?? +????冲??浣跨???????绠?娉? + +浠ヤ??婕?绀虹????ョ被??????python涓惧?芥?颁????徃??绛???シ?????绠?????????典?????绛???ユā寮忓???芥?版?セ韩浣?涓哄彟??涓??芥??/??规???????ュ????冲徟?? + +""" + +from monkey_print2 import print + +# 绛???ユā寮? +class Strategy(): + def process(self): + pass + + +class FaultStrategy(Strategy): + def process(self): + print("fault") + + +class NormalStrategy(Strategy): + def process(self): + print("normal") + + +class Park(): + def __init__(self, strategy): + self.__strategy = strategy + + def geoProcess(self): + self.__strategy.process() + + +if __name__ == '__main__': + p = Park(NormalStrategy()) + p.geoProcess() + p = Park(FaultStrategy()) + p.geoProcess() + + """ + "D:/coding2/python36patterns/琛?涓哄??妯″??-绛???ユā寮?.py:30" 10:23:25 normal +"D:/coding2/python36patterns/琛?涓哄??妯″??-绛???ユā寮?.py:25" 10:23:25 fault + """ \ No newline at end of file diff --git "a/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边247边202边345边257边237边350边200边205边346边250边241边345边274边217边-351边207边215边346边226边260边345边256边236边347边216边260边346边227边245边345边277边227边347边263边273边347边273边237边.py" "b/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边247边202边345边257边237边350边200边205边346边250边241边345边274边217边-351边207边215边346边226边260边345边256边236边347边216边260边346边227边245边345边277边227边347边263边273边347边273边237边.py" new file mode 100644 index 0000000..07f3c45 --- /dev/null +++ "b/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边247边202边345边257边237边350边200边205边346边250边241边345边274边217边-351边207边215边346边226边260边345边256边236边347边216边260边346边227边245边345边277边227边347边263边273边347边273边237边.py" @@ -0,0 +1,76 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019/10/9 0009 9:39 + +"""???瑕?绋?搴? ????????? +褰?瀵硅薄??村?????涓?瀵瑰????崇郴??讹?????浣跨????瀵????妯″???Observer Pattern锛????姣?濡?锛?褰?涓?涓?彾诣薄琚繌稠?规?讹?????浼??????????ュ?????渚?璧?瀵硅薄???瑙?瀵????妯″?忓?浜?琛?涓哄??妯″????? +?????讹?????浠サ????????涓?涓?彾诣薄????舵????瑰????舵?存?板彟??涓?缁?瀵硅薄??? + +璇磋??涔?澶???借薄???姒?蹇碉??璇寸?瑰?蜂?????灏辨?徃倩??ュ??涓轰??锛????浜烘??print褰??????ュ????彧???????㈢????哄???稿??澶э????ュ??涓?浠??徟嘶???streamhandler???filehandler锛?杩????mailhandler httphandler +绛????浜跨???????涔?handler???logger debug??跺???????Е??????绉?handler???emit??规????? +???涓?浼???ュ??涓????瑙f?ュ??锛?瀵?logger addHandler???绉?handler??甸?间????ラ?????骞插??锛????涓昏????徃?????瑙?瀵????妯″?????????????? +甯????涓惧??渚?瀛???徃荨﹁????瀹??????忎?锛?涓???㈢?????浣跨????瀵????妯″???????版ā???瀹??〖涓?涓彨婕??ュ???????? +""" +import abc +from monkey_print2 import print + + +class AbstractHandler(metaclass=abc.ABCMeta): + @abc.abstractmethod + def emit(self, record): + pass + + +class Logger: + def __init__(self, logger_name): + self.name = logger_name + self.handlers = [] + + def add_handler(self, handler): + self.handlers.append(handler) + + def log(self, record: str): + for hr in self.handlers: + hr.emit(f'{self.name} -- {record}') + + +class StreamHandler(AbstractHandler): + def emit(self, record): + print(f' {record} ?ァ??跺彴?????') + + +class FileHandler(AbstractHandler): + def emit(self, record): + print(f' {record} ???浠跺?????') # ?彧?徃俑轰?婕?绀哄????ユ??浠讹?????print妯℃?????浼????〖???甯????瑕????娓?妤?杩?????????彸??涓????print??? + + +class MailHandler(AbstractHandler): + def emit(self, record): + print(f' {record} ?????彸榛剁????浜?') # ?彧?徃俑轰?婕?绀哄????彸榛讹????print妯℃?????浼????〖???甯????瑕????娓?妤?杩?????????彸??涓????print??? + + +class DingdingHandler(AbstractHandler): + def emit(self, record): + print(f' {record} ????????哄??浜哄??杩??徆?????缁?缇ら??') # ?彧?徃俑轰?婕?绀哄??????????哄??浜烘????徆?????print妯℃?????浼????〖???甯????瑕????娓?妤?杩?????????彸??涓????print??? + + +if __name__ == '__main__': + logger1 = Logger('a') + logger1.add_handler(StreamHandler()) + logger1.add_handler(FileHandler()) + logger1.add_handler(MailHandler()) + logger1.log('?????????????') + + logger2 = Logger('b') + logger2.add_handler(StreamHandler()) + logger2.add_handler(DingdingHandler()) + logger2.log('??????????????????') + + """ + ?徟嘶?????版?ュ?????甯哥?垫椿锛??徟嘶???????????彨??涓?handler锛?渚?濡???ュ??a浼? ?ァ??跺彴????扮?? ?????ユ??浠? ?????彸榛讹???ュ??b?ァ??跺彴????? ?????????娑???徃?? + "D:/coding2/python36patterns/琛?涓哄??妯″??-瑙?瀵????妯″??.py:36" 10:00:19 a -- ????????????? ?ァ??跺彴????? + "D:/coding2/python36patterns/琛?涓哄??妯″??-瑙?瀵????妯″??.py:40" 10:00:19 a -- ????????????? ???浠跺????? + "D:/coding2/python36patterns/琛?涓哄??妯″??-瑙?瀵????妯″??.py:45" 10:00:19 a -- ????????????? ?????彸榛剁????浜? + "D:/coding2/python36patterns/琛?涓哄??妯″??-瑙?瀵????妯″??.py:36" 10:00:19 b -- ?????????????????? ?ァ??跺彴????? + "D:/coding2/python36patterns/琛?涓哄??妯″??-瑙?瀵????妯″??.py:49" 10:00:19 b -- ?????????????????? ????????哄??浜哄??杩??徆?????缁?缇ら?? + """ diff --git "a/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边247边243边351边207边212边345边231边250边346边250边241边345边274边217边.py" "b/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边247边243边351边207边212边345边231边250边346边250边241边345边274边217边.py" new file mode 100644 index 0000000..7d60aa2 --- /dev/null +++ "b/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边247边243边351边207边212边345边231边250边346边250边241边345边274边217边.py" @@ -0,0 +1,65 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019/10/9 0009 9:35 +""" +???瑕?绋?搴? ?????? + +瑙i?????妯″???Interpreter Pattern锛????渚?浜?璇?浼拌彽箬????璇面?????琛?揪寮??????瑰???瀹?灞?浜?琛?涓哄??妯″?????杩?绉?妯″?忓??〖浜?涓?涓?;杈惧???ˇ????璇ユˇ?彺铵???涓?涓??瑰?????涓?涓???????杩?绉?妯″?忚?????? SQL 瑙f?????绗?彿?????寮????绛???? + +瀵规?忎????????ヨ?锛???冲?????浠ヤ??涓ょ??涓????????????峰??绫汇?? +??? ??烘?ス????凤??杩?绫荤????峰彧???????藉????布?磋??浣跨??搴???????浠?浠コ?????娆㈣?卞お澶???堕?撮??缃彸??瀛???搴? +??????????????瀵逛??浠シ?ヨ?锛???烘?ス?????娉?灏辫冻澶?浜???? +??? 楂?绾х????凤??杩?浜??????凤??瀹????涓????甯告??????帮??涓?浠??????辫垂棰?澶??????堕?村6涔?濡?浣?浣跨??搴?????? +楂?绾х?规?с??濡??????ラ??瀛???涔??????藉????颁互涓?濂藉??锛?浠?浠ス????充???サ瀛???涓?绉????缃彺??????????ロ?? +璇焊????? +??? ??藉????村ソ??版ァ??朵??涓?????? +??? 浠ユ?村ソ?????瑰?忚?揪??虫?? +??? ???楂????浜у?? +瑙i????彧??Interpreter锛?妯″?忎???藉??璧峰???????楂?绾х????风????磋叮???杩??????涓鸿В??????妯″???????????涓? +瑕??????虫?徃鎻跋??????绾х????峰??棰????涓?瀹朵娇???涓????????????璇焊????ヨ;杈炬?虫???????惰??锛?浠?涔???徃??绉?绠???????璇? +瑷?锛?瀵逛?????浠ス?????姹???ヨ?锛?涓?绉?绠???????璇焊??灏辨?徃莶$?绋?璇焊????d??澶???????璇焊?? +""" +from monkey_print2 import print + + +class PlayContext(): + play_text = None + + +class Expression(): + def interpret(self, context): + if len(context.play_text) == 0: + return + else: + play_segs = context.play_text.split(" ") + for play_seg in play_segs: + pos = 0 + for ele in play_seg: + if ele.isalpha(): + pos += 1 + continue + break + play_chord = play_seg[0:pos] + play_value = play_seg[pos:] + self.execute(play_chord, play_value) + + def execute(self, play_key, play_value): + pass + + +class NormGuitar(Expression): + def execute(self, key, value): + print("Normal Guitar Playing--Chord:%s Play Tune:%s" % (key, value)) + + +if __name__ == "__main__": + context = PlayContext() + context.play_text = "C53231323 Em43231323 F43231323 G63231323" + guitar = NormGuitar() + guitar.interpret(context) + """ + "D:/coding2/python36patterns/琛?涓哄??妯″??-瑙i?????妯″??.py:29" 09:37:28 Normal Guitar Playing--Chord:C Play Tune:53231323 + "D:/coding2/python36patterns/琛?涓哄??妯″??-瑙i?????妯″??.py:29" 09:37:28 Normal Guitar Playing--Chord:Em Play Tune:43231323 + "D:/coding2/python36patterns/琛?涓哄??妯″??-瑙i?????妯″??.py:29" 09:37:28 Normal Guitar Playing--Chord:F Play Tune:43231323 + "D:/coding2/python36patterns/琛?涓哄??妯″??-瑙i?????妯″??.py:29" 09:37:28 Normal Guitar Playing--Chord:G Play Tune:63231323 + """ diff --git "a/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边256边277边351边227边256边350边200边205边346边250边241边345边274边217边.py" "b/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边256边277边351边227边256边350边200边205边346边250边241边345边274边217边.py" new file mode 100644 index 0000000..8392fea --- /dev/null +++ "b/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边256边277边351边227边256边350边200边205边346边250边241边345边274边217边.py" @@ -0,0 +1,179 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019/10/9 0009 11:31 + +""" +1???涓轰??涔?瑕?浣跨??彵予妯″?? +浠????璁轰????ヨ?锛?璁捐?℃ā寮????彾溢?搴???彸??姣?杈?濂界??瑙e?虫?规??????????扮??绋?搴??????芥?剧???????拌??杩?浜???彸??锛?骞朵??浠?浠コ娇?????浜?瑙e?虫?规???サ澶????杩?浜???彸????????浠ュ??浣??????板????风????彸??锛?涓轰??涔?瑕??サ??崇?????寤轰??涓?В??虫?规?????涓???徃??〖??????骞朵??琚????????徃????????????? + + + +2???璁块?缎??妯″?忚?充??浠?涔???彸??锛? +1)瀵硅薄缁????涓惧彾诣薄鍙兑搴????绫诲??灏???瑰??锛?浣?缁忓父??瑕????姝ゅ彾诣薄?????涓?瀹?涔???扮?????浣???? +2)???瑕?瀵逛??涓?彾诣薄?????涓布??瀵硅薄杩?琛?寰?澶?涓???????骞朵??涓???稿?崇?????浣?锛???????瑕???垮??璁彨??浜????浣????姹℃?????杩?浜?瀵硅薄???绫伙??涔?涓?甯???????澧??????版??浣???朵慨??硅??浜?绫汇?? + + + +3???璁块?缎??妯″?忎娇????烘?? +1)瀵硅薄缁????姣?杈?绋冲??锛?浣?缁忓父??瑕????姝ゅ彾诣薄?????涓?瀹?涔???扮?????浣? + +2)???瑕?瀵逛??涓?彾诣薄?????涓布??瀵硅薄杩?琛?寰?澶?涓???????涓?涓???稿?崇?????浣?锛???????瑕???垮??杩?浜????浣????姹℃?????杩?浜?瀵硅薄???绫伙??涔?涓?甯???????澧??????版??浣???朵慨??硅??浜?绫汇?? + +姣?濡?锛?璁块?缎???徟嘶ュ????借??琛?缁?涓?锛??徟嘶?????ヨ;???UI??????????涓?杩?婊ゅ????? + + + +??版?彸畋?彧??渚?涓?涓??版???????????ˇ?????????版?彸畋???澶??????规?????浠サ彨??璁块?缎?? + +涓?????瀛??徟嘶ュ??〖锛?瀹????涓????骞翠唤???璐㈠?℃?ヨ;缁?涓???????瑙???插?????锛?杩?灏辨?徃鎻辟??缎??妯″?????榄????锛?璁块?缎??妯″???????稿???????淇????????????版?彸??????????虹??涓?锛?瀹??〖澶?绉???版?彸??澶??????规??锛?璇ユ?规?????瑙???插氨??徃鎻辟??缎????? + + + +4???璁块?缎??妯″?忎???? +1)浣垮????版?彸????????浣????浜?缁????涓???????浣?瑙h????浣垮?????浣????????徟嘶??ス??????????? + +2)娣诲????扮?????浣???????璇磋彵??缎??浼????甯稿彵?????? + +3)灏?瀵瑰??涓???绱????涓?缁????浣????涓惧??涓?涓?彵??缎??绫诲??涓KK?? + +4)浣垮??绫诲??娆$?????涓???瑰??????????典??锛??徟嘶???瀵瑰??涓???娆″????轰???????????浣?锛????涓?褰卞??绫诲??娆$????????瀹???存?с?? + +5)?徟嘶ヨ???绫诲??娆$?????锛?璁块?彸?????灞?娆$?????绱?绫伙???????虹?稿????????浣???? +6)濡???????浣??????昏????瑰??锛????浠サ彧??瑕???瑰??璁块?缎?????瀹??〖灏卞??浜?锛????涓?????サ淇彸?瑰?朵?????????????????绫汇?? + +7)娣诲????扮被?????????????扮郴缁????寰?瀹规??????彧??瑕???瑰??涓?涓?璁块?缎???ˇ??互?????跺???〖???宸茬?忓????????????绫诲????浼?琚?骞叉?板奖?????? + + + +5???璁块?缎??妯″?忕己?? +1)澧??????扮?????绱?浼????甯稿?伴?俱?? + +2)瀹??〖璧锋?ユ??杈?澶????锛?浼?澧????绯荤?????澶??????с?? + +3)??村?忓?瑁?锛?濡????灏?璁块?缎??涓烘?惧?????涓???绱?涓炯下??????徟嘶ヤ???撮?插??绱????????????????????舵??锛?浣?浣跨??彵??缎??妯″???????跺??锛?涓轰??璁彨覐辟??缎????借キ?????版????冲?????淇℃?徆?????绱?绫讳??寰?涓???撮?插?轰??浜???????????舵?????缁????锛?灏卞????跺?ュ??????虹被蹇?椤绘??渚?璁块?彸??棰???????瀛????椤圭?彸????规??涓???枫?? + +4)visit()??规?????杩??????肩??绫诲?????彵予绯荤?寮忓氨??瑕????纭寿??涓???讹??灏遍??瑕?淇彸?硅彵??缎??????ˇ??互??????????ˇ?????〖????彟??濡????璁块?缎???ˇ????瀹??〖澶???锛?绯荤???????彨????у氨浼?涓??????? + +""" + + +class Finance: + def __init__(self): + self.salesvolume = None # ?????彸?? + self.cost = None # ?????? + self.history_salesvolume = None # ????彶????彸?? + self.history_cost = None # ????彶????? + + def set_salesvolume(self, value): + self.salesvolume = value + + def set_cost(self, value): + self.cost = value + + def set_history_salesvolume(self, value): + self.history_salesvolume = value + + def set_history_cost(self, value): + self.history_cost = value + + def accept(self, visitor): + pass + + +# 2018骞寸??璐㈠?℃????? +class Finance_year(Finance): + def __init__(self, year): + Finance.__init__(self) + self.analyst = [] + self.year = year + + def add_analyst(self, worker): # ?????彨????????甯???ュ???????版?? + self.analyst.append(worker) + + def accept(self): # ??????甯????琛?????㈢??浜哄サ????????版?? + for v in self.analyst: + v.visit(self) + + +# 浼?璁? +class Accounting: + def __init__(self): + self.id = '浼?璁?' + self.Duty = '璁$????ヨ;' + + def visit(self, year_data): + print('????〖???????????????{}骞寸????版??'.format(year_data.year)) + print('??????韬?唤???:{}锛????璐o??'.format(self.id, self.Duty)) + print('??サ勾搴?函??彥枚:{}'.format(year_data.salesvolume - year_data.cost)) + print('---------------------------------------') + + +# 璐㈠?℃?荤?? +class Audit: + def __init__(self): + self.id = '璐㈠?℃?荤??' + self.Duty = '??????涓?缁?' + + def visit(self, year_data): # 瑕??????蜂????彨??骞寸????版?彸??缁???????甯?锛?璁彨?????甯??サ?????? + print('????〖???????????????{}骞寸????版??'.format(year_data.year)) + print('??????韬?唤???:{}锛????璐o??'.format(self.id, self.Duty)) + if year_data.salesvolume - year_data.cost> year_data.history_salesvolume - year_data.history_cost: + msg = '杈???????涓?娑?' + else: + msg = '杈???????涓?璺?' + print('??サ勾搴??サ徃??缁?:{}'.format(msg)) + print('---------------------------------') + + +# ?????ラ【??? +class Advisor: + def __init__(self): + self.id = '?????ラ【???' + self.Duty = '??跺?????骞寸?????' + + def visit(self, year_data): + print('????〖???????????????{}骞寸????版??'.format(year_data.year)) + print('??????韬?唤???:{}锛????璐o??'.format(self.id, self.Duty)) + if year_data.salesvolume> year_data.history_salesvolume: + msg = '琛?涓?涓?娑彧????彨沥ц?妯?' + else: + msg = '琛?涓?涓?璺?锛???忓?瑙?妯?' + print('??サ勾搴??サ徃??缁?:{}'.format(msg)) + print('------------------------------') + + +# ??ц???????? +class AnalyseData: + def __init__(self): + self.datalist = [] # ???瑕?澶?????????版????琛?, + + def add_data(self, year_data): + self.datalist.append(year_data) + + def remove_data(self, year_data): + self.datalist.remove(year_data) + + def visit(self): + for d in self.datalist: + d.accept() + + +if __name__ == '__main__': + w = AnalyseData() # 璁″??瀹????璐㈠?\????荤??锛?椤鹃??彾2018骞存?版??????? + finance_2018 = Finance_year(2018) # 2018骞寸??璐㈠?℃?版?? + finance_2018.set_salesvolume(200) + finance_2018.set_cost(90) + finance_2018.set_history_salesvolume(190) + finance_2018.set_history_cost(80) + + accounting = Accounting() + audit = Audit() + advisor = Advisor() + + finance_2018.add_analyst(accounting) # 浼?璁″??涓?2018骞寸????版???????锛???跺????ц??浜????繁???visit??规?? + finance_2018.add_analyst(audit) + finance_2018.add_analyst(advisor) + + # finance_2018.accept() #涔??徟嘶??存ˇ杩???疯????? + w.add_data(finance_2018) + w.visit() \ No newline at end of file diff --git "a/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边264边243边344边273边273边351边223边276边346边250边241边345边274边217边.py" "b/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边264边243边344边273边273边351边223边276边346边250边241边345边274边217边.py" new file mode 100644 index 0000000..742c0b1 --- /dev/null +++ "b/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边264边243边344边273边273边351边223边276边346边250边241边345边274边217边.py" @@ -0,0 +1,73 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019钳10奉9泣 0009 9:24 + +""" ???瑕?绋?搴? ?????? +椤惧?????涔?锛?璐d换??炬ā寮??Chain of Responsibility Pattern锛?涓鸿彾墟????寤轰??涓?涓?ˇ??惰??瀵硅薄?????俱??杩?绉?妯″?忕?浜?璇锋?????绫诲??锛?瀵硅彾墟?????????????????ˇ??惰??杩?琛?瑙h????杩?绉?绫诲?????璁捐?℃ā寮忓?浜?琛?涓哄??妯″????? + +?????绉?妯″?忎妇枷?????甯告?忎?ˇ??惰????藉?????瀵瑰彟??涓?ˇ??惰?????寮???????濡????涓?涓?彾诣>????藉?????璇ヨ彾墟?锛???d??瀹?浼??????稿?????璇锋??浼?缁?涓?涓?涓?ˇ??惰??锛?渚?姝ょ被?ィ??? + + +""" +class Event: + + def __init__(self, name): + self.name = name + + def __str__(self): + return self.name + + +class Widget: + + def __init__(self, parent=None): + self.parent = parent + + def handle(self, event): + handler = 'handle_{}'.format(event) + if hasattr(self, handler): + method = getattr(self, handler) + method(event) + elif self.parent: + self.parent.handle(event) + elif hasattr(self, 'handle_default'): + self.handle_default(event) + + +class MainWindow(Widget): + + def handle_close(self, event): + print('MainWindow: {}'.format(event)) + + def handle_default(self, event): + print('MainWindow Default: {}'.format(event)) + + +class SendDialog(Widget): + + def handle_paint(self, event): + print('SendDialog: {}'.format(event)) + + +class MsgText(Widget): + + def handle_down(self, event): + print('MsgText: {}'.format(event)) + + +def main(): + mw = MainWindow() + sd = SendDialog(mw) + msg = MsgText(sd) + + for e in ('down', 'paint', 'unhandled', 'close'): + evt = Event(e) + print('\nSending event -{}- to MainWindow'.format(evt)) + mw.handle(evt) + print('Sending event -{}- to SendDialog'.format(evt)) + sd.handle(evt) + print('Sending event -{}- to MsgText'.format(evt)) + msg.handle(evt) + +if __name__ == '__main__': + main() \ No newline at end of file diff --git "a/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边207边346边273边244边345边231边250边346边250边241边345边274边217边.py" "b/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边207边346边273边244边345边231边250边346边250边241边345边274边217边.py" new file mode 100644 index 0000000..caf6ac9 --- /dev/null +++ "b/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边207边346边273边244边345边231边250边346边250边241边345边274边217边.py" @@ -0,0 +1,92 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019钳10奉9泣 0009 14:17 +""" +杩?婊ゅ??妯″???Filter Pattern锛??????????妯″???Criteria Pattern锛???徃??绉?璁捐?℃ā寮??杩?绉?妯″?????璁稿?????浜哄??浣跨??涓???????????????ヨ??婊や??缁?瀵硅薄锛????杩???昏??杩?绠?浠ヨВ???????瑰?????瀹?浠セ???ˇ璧锋?ャ??杩?绉?绫诲?????璁捐?℃ā寮忓?浜?缁???????妯″???瀹?缁????澶?涓????????ヨキ寰????涓?????????? +""" +from abc import ABCMeta, abstractmethod +from monkey_print2 import print + + +class Person: + def __init__(self, name, sex, marital_status): + self.name = name + self.sex = sex + self.marital_status = marital_status + + def __str__(self): + return f"""Person: [Name: {self.name}, Gender: {self.sex} Marital Status: {self.marital_status}]""" + + +class Criteria(metaclass=ABCMeta): + @abstractmethod + def meet_criteria(self, persons) -> list: + pass + + +class CriteriaMale(Criteria): + def meet_criteria(self, persons) -> list: + return [p for p in persons if p.sex.lower() == 'MALE'.lower()] + + +class CriteriaFemale(Criteria): + def meet_criteria(self, persons) -> list: + return [p for p in persons if p.sex.lower() == 'FEMALE'.lower()] + + +class CriteriaSingle(Criteria): + def meet_criteria(self, persons) -> list: + return [p for p in persons if p.sex.lower() == 'SINGLE'.lower()] + + +class AndCriteria(Criteria): + def __init__(self, criteria: Criteria, criteria_other: Criteria): + self.criteria = criteria + self.criteria_other = criteria_other + + def meet_criteria(self, persons) -> list: + return self.criteria_other.meet_criteria(self.criteria.meet_criteria(persons)) + + +class OrCriteria(Criteria): + def __init__(self, criteria: Criteria, criteria_other: Criteria): + self.criteria = criteria + self.criteria_other = criteria_other + + def meet_criteria(self, persons) -> list: + persons1 = self.criteria.meet_criteria(persons) + persons2 = self.criteria_other.meet_criteria(persons) + return list(set(persons1 + persons2)) + + +if __name__ == '__main__': + def print_person_list(p_list): + for p in p_list: + print(p) + + + person_list = list() + person_list.append(Person("Robert", "Male", "Single")) + person_list.append(Person("John", "Male", "Married")) + person_list.append(Person("Laura", "Female", "Married")) + person_list.append(Person("Diana", "Female", "Single")) + person_list.append(Person("Mike", "Male", "Single")) + person_list.append(Person("Bobby", "Male", "Single")) + + male = CriteriaMale() + female = CriteriaFemale() + single = CriteriaSingle() + singleMale = AndCriteria(single, male) + singleOrFemale = OrCriteria(single, female) + + print("\nMales: ") + print_person_list(male.meet_criteria(person_list)) + + print("\nFemales: ") + print_person_list(female.meet_criteria(person_list)) + + print("\nSingle Males: ") + print_person_list(singleMale.meet_criteria(person_list)) + + print("\nSingle Or Females: ") + print_person_list(singleOrFemale.meet_criteria(person_list)) diff --git "a/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边255边344边273边243边345边231边250边346边250边241边345边274边217边-344边275边277边347边224边250边347边261边273边.py" "b/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边255边344边273边243边345边231边250边346边250边241边345边274边217边-344边275边277边347边224边250边347边261边273边.py" new file mode 100644 index 0000000..2302fcc --- /dev/null +++ "b/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边255边344边273边243边345边231边250边346边250边241边345边274边217边-344边275边277边347边224边250边347边261边273边.py" @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019钳10奉9泣 0009 11:49 + +class AccountIterator(): + def __init__(self, accounts): + self.accounts = accounts # 璐??烽????? + self.index = 0 + + def __iter__(self): + return self + + def __next__(self): + if self.index>= len(self.accounts): + raise StopIteration("??板ご浜?...") + else: + self.index += 1 + return self.accounts[self.index - 1] + + +if __name__ == '__main__': + account_iter = AccountIterator(['a','b','c','d']) + print(next(account_iter)) + print('----') + for a in account_iter: + print(a) diff --git "a/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边255边344边273边243边345边231边250边346边250边241边345边274边217边.py" "b/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边255边344边273边243边345边231边250边346边250边241边345边274边217边.py" new file mode 100644 index 0000000..09d8438 --- /dev/null +++ "b/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边255边344边273边243边345边231边250边346边250边241边345边274边217边.py" @@ -0,0 +1,78 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019钳10奉9泣 0009 11:39 +""" +杩TEL唬???妯″???Iterator Pattern锛???? Java ??? .Net 缂?绋??ッ澧?涓宝??甯稿父?????璁捐?℃ā寮????杩?绉?妯″?????浜?椤哄?忚?彸?????瀵硅薄??????绱?锛?涓????瑕???ラ????????瀵硅薄???搴?灞?琛?ず??? + +杩TEL唬???妯″?忓?浜?琛?涓哄??妯″????? + +浠?缁? +?????撅?????渚?涓?绉???规??椤哄?忚?彸??涓??????瀵硅薄涓惧??涓???绱?, ?????????椤绘?撮?茶彽襄璞?????????;绀恒?? + +涓昏??瑙e?筹??涓?????????瑰????ラ???????翠釜??村??瀵硅薄??? + +浣???朵娇??彧????????涓?涓??????瀵硅薄??? + +濡?浣?瑙e?筹???????????绱?涔???存父璧扮??璐d换浜ょ??杩TEL唬??彧?????涓???徃?????瀵硅薄??? + +??抽?彸榛???锛?瀹?涔??ˇ????hasNext, next??? + +搴????瀹?渚?锛?JAVA 涓布?? iterator??? + +浼???癸?? 1???瀹???徃??浠ヤ??????????瑰????????涓?涓??????瀵硅薄??? 2???杩TEL唬????????浜???????绫汇?? 3?????????涓?涓??????涓??徟嘶???澶?涓????????? 4??????凯浠e??妯″?忎妇枷??澧??????扮????????绫诲??杩TEL唬???被??藉????逛究锛????椤讳慨??瑰?????浠g????? + +缂虹?癸????变??杩TEL唬???妯″?忓?瀛??????版????????????版?彸?????璐e??绂伙??澧??????扮????????绫婚??瑕?瀵瑰??澧??????扮??杩TEL唬???被锛?绫荤??涓??版??瀵瑰?????锛?杩????涓?瀹?绋?搴???澧????浜?绯荤?????澶??????с?? + +浣跨????烘?徆?? 1???璁块?彸??涓??????瀵硅薄??????瀹硅?????椤绘?撮?插???????????;绀恒?? 2??????瑕?涓鸿?????瀵硅薄???渚?澶?绉?????????瑰????? 3???涓洪?????涓?????????????缁???????渚?涓?涓???涓?????ˇ?彺?? + +娉???忎?椤癸??杩TEL唬???妯″?忓氨????绂讳????????瀵硅薄?????????琛?涓猴????借薄??轰??涓?凯浠e??被??ヨ??璐o??杩???锋?㈠徟嘶?????颁????撮?查???????????????????锛?????徟詮跋澶????浠g??????????拌彵??彸???????????????版?寿?? + +python??????pythonic?????瑰????? +""" + +from abc import ABCMeta, abstractmethod + +class Iterator(metaclass=ABCMeta): + + @abstractmethod + def hasNext(self): + pass + + @abstractmethod + def next(self): + pass + +class ConcreteIterator(Iterator): + + def __init__(self, alist): + self.alist = alist + + def hasNext(self): + '''??????????涓?涓?涓???绱?''' + return self.alist != [] + + def next(self): + '''杩????涓?涓?涓???绱?''' + return self.alist.pop(0) + + +class Aggregate(object): + + def iterator(self): + pass + +class ConcreteAggregate(Aggregate): + + def __init__(self, alist): + self.alist = alist + + def iterator(self): + '''杩????杩TEL唬???瀵硅薄''' + return ConcreteIterator(self.alist) + + +if __name__ == "__main__": + concreteAggregate = ConcreteAggregate([1, 2, 3]) + concreteIterator = concreteAggregate.iterator() + while concreteIterator.hasNext(): + print (concreteIterator.next()) \ No newline at end of file diff --git "a/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边255边344边273边243边345边231边250边346边250边241边345边274边2173边.py" "b/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边255边344边273边243边345边231边250边346边250边241边345边274边2173边.py" new file mode 100644 index 0000000..3d2d4e5 --- /dev/null +++ "b/py_design/350边241边214边344边270边272边345边236边213边346边250边241边345边274边217边-350边277边255边344边273边243边345边231边250边346边250边241边345边274边2173边.py" @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# @Author : ydf +# @Time : 2019钳10奉9泣 0009 11:56 + +from __future__ import print_function + + +def count_to(count): + """Counts by word numbers, up to a maximum of five""" + numbers = ["one", "two", "three", "four", "five"] + for number in numbers[:count]: + yield number + + +# Test the generator +count_to_two = lambda: count_to(2) +count_to_five = lambda: count_to(5) + + +if __name__ == "__main__": + for number in count_to_two(): + print(number) + + + for number in count_to_five(): + print(number)

AltStyle によって恃垂されたペ〖ジ (->オリジナル) /