added usage documentation links to docstrings.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -90,3 +90,4 @@ ENV/
|
||||
|
||||
# Other
|
||||
.idea
|
||||
html/
|
||||
|
||||
@@ -5,7 +5,8 @@ class ChainLink(object, metaclass=ABCMeta):
|
||||
"""
|
||||
Abstract ChainLink object as part of the Chain of Responsibility pattern.
|
||||
|
||||
External Chain of Responsibility Pattern documentation: U{https://en.wikipedia.org/wiki/Chain-of-responsibility_pattern}
|
||||
- External Usage documentation: U{https://github.com/tylerlaberge/PyPatterns/wiki/Behavioral-Pattern-Usage}
|
||||
- External Chain of Responsibility Pattern documentation: U{https://en.wikipedia.org/wiki/Chain-of-responsibility_pattern}
|
||||
"""
|
||||
def __init__(self):
|
||||
"""
|
||||
@@ -44,7 +45,8 @@ class Chain(object, metaclass=ABCMeta):
|
||||
"""
|
||||
Abstract Chain class as part of the Chain of Responsibility pattern.
|
||||
|
||||
External Chain of Responsibility Pattern documentation: U{https://en.wikipedia.org/wiki/Chain-of-responsibility_pattern}
|
||||
- External Usage documentation: U{https://github.com/tylerlaberge/PyPatterns/wiki/Behavioral-Pattern-Usage}
|
||||
- External Chain of Responsibility Pattern documentation: U{https://en.wikipedia.org/wiki/Chain-of-responsibility_pattern}
|
||||
"""
|
||||
def __init__(self, chainlink):
|
||||
"""
|
||||
|
||||
@@ -5,7 +5,8 @@ class Receiver(object, metaclass=ABCMeta):
|
||||
"""
|
||||
Abstract receiver class as part of the Command pattern.
|
||||
|
||||
External Command Pattern documentation: U{https://en.wikipedia.org/wiki/Command_pattern}
|
||||
- External Usage documentation: U{https://github.com/tylerlaberge/PyPatterns/wiki/Behavioral-Pattern-Usage}
|
||||
- External Command Pattern documentation: U{https://en.wikipedia.org/wiki/Command_pattern}
|
||||
"""
|
||||
def action(self, name, *args, **kwargs):
|
||||
"""
|
||||
@@ -26,7 +27,8 @@ class Command(object, metaclass=ABCMeta):
|
||||
"""
|
||||
Abstract Command class as part of the Command pattern.
|
||||
|
||||
External Command Pattern documentation: U{https://en.wikipedia.org/wiki/Command_pattern}
|
||||
- External Usage documentation: U{https://github.com/tylerlaberge/PyPatterns/wiki/Behavioral-Pattern-Usage}
|
||||
- External Command Pattern documentation: U{https://en.wikipedia.org/wiki/Command_pattern}
|
||||
"""
|
||||
def __init__(self, receiver):
|
||||
"""
|
||||
@@ -56,7 +58,8 @@ class Invoker(object, metaclass=ABCMeta):
|
||||
"""
|
||||
Abstract Invoker class as part of the Command pattern.
|
||||
|
||||
External Command Pattern documentation: U{https://en.wikipedia.org/wiki/Command_pattern}
|
||||
- External Usage documentation: U{https://github.com/tylerlaberge/PyPatterns/wiki/Behavioral-Pattern-Usage}
|
||||
- External Command Pattern documentation: U{https://en.wikipedia.org/wiki/Command_pattern}
|
||||
"""
|
||||
def __init__(self, valid_commands):
|
||||
"""
|
||||
|
||||
@@ -5,7 +5,8 @@ class Iterator(object):
|
||||
"""
|
||||
An Iterator class for the Iterator design pattern.
|
||||
|
||||
External Iterator Pattern documentation: U{https://en.wikipedia.org/wiki/Iterator_pattern}
|
||||
- External Usage documentation: U{https://github.com/tylerlaberge/PyPatterns/wiki/Behavioral-Pattern-Usage}
|
||||
- External Iterator Pattern documentation: U{https://en.wikipedia.org/wiki/Iterator_pattern}
|
||||
"""
|
||||
def __init__(self, iterable):
|
||||
"""
|
||||
@@ -27,7 +28,8 @@ class Iterable(object, metaclass=ABCMeta):
|
||||
"""
|
||||
An abstract class representing an Iterable object as part of the Iterator design pattern.
|
||||
|
||||
External Iterator Pattern documentation: U{https://en.wikipedia.org/wiki/Iterator_pattern}
|
||||
- External Usage documentation: U{https://github.com/tylerlaberge/PyPatterns/wiki/Behavioral-Pattern-Usage}
|
||||
- External Iterator Pattern documentation: U{https://en.wikipedia.org/wiki/Iterator_pattern}
|
||||
"""
|
||||
@abstractmethod
|
||||
def __next__(self):
|
||||
|
||||
@@ -5,7 +5,8 @@ class Mediator(object):
|
||||
"""
|
||||
Mediator class as part of the Mediator design pattern.
|
||||
|
||||
External Mediator Pattern documentation: U{https://en.wikipedia.org/wiki/Mediator_pattern}
|
||||
- External Usage documentation: U{https://github.com/tylerlaberge/PyPatterns/wiki/Behavioral-Pattern-Usage}
|
||||
- External Mediator Pattern documentation: U{https://en.wikipedia.org/wiki/Mediator_pattern}
|
||||
"""
|
||||
def __init__(self):
|
||||
"""
|
||||
|
||||
@@ -5,7 +5,8 @@ class Memento(object):
|
||||
"""
|
||||
Memento class as part of the Memento design pattern.
|
||||
|
||||
External Memento Pattern documentation: U{https://en.wikipedia.org/wiki/Memento_pattern}
|
||||
- External Usage documentation: U{https://github.com/tylerlaberge/PyPatterns/wiki/Behavioral-Pattern-Usage}
|
||||
- External Memento Pattern documentation: U{https://en.wikipedia.org/wiki/Memento_pattern}
|
||||
"""
|
||||
def __init__(self, state):
|
||||
"""
|
||||
@@ -25,7 +26,8 @@ class Originator(object):
|
||||
"""
|
||||
Originator base class as part of the Memento design pattern.
|
||||
|
||||
External Mediator Pattern documentation: U{https://en.wikipedia.org/wiki/Memento_pattern}
|
||||
- External Usage documentation: U{https://github.com/tylerlaberge/PyPatterns/wiki/Behavioral-Pattern-Usage}
|
||||
- External Mediator Pattern documentation: U{https://en.wikipedia.org/wiki/Memento_pattern}
|
||||
"""
|
||||
def commit(self):
|
||||
"""
|
||||
|
||||
@@ -2,7 +2,8 @@ class Null(object):
|
||||
"""
|
||||
A Null object class as part of the Null object design pattern.
|
||||
|
||||
External Null Object Pattern documentation: U{https://en.wikipedia.org/wiki/Null_Object_pattern}
|
||||
- External Usage documentation: U{https://github.com/tylerlaberge/PyPatterns/wiki/Behavioral-Pattern-Usage}
|
||||
- External Null Object Pattern documentation: U{https://en.wikipedia.org/wiki/Null_Object_pattern}
|
||||
"""
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
|
||||
@@ -5,7 +5,8 @@ class Observer(object, metaclass=ABCMeta):
|
||||
"""
|
||||
Abstract Observer class as part of the Observer design pattern.
|
||||
|
||||
External Observer Pattern documentation: U{https://en.wikipedia.org/wiki/Observer_pattern}
|
||||
- External Usage documentation: U{https://github.com/tylerlaberge/PyPatterns/wiki/Behavioral-Pattern-Usage}
|
||||
- External Observer Pattern documentation: U{https://en.wikipedia.org/wiki/Observer_pattern}
|
||||
"""
|
||||
@abstractmethod
|
||||
def update(self, **state):
|
||||
@@ -19,7 +20,8 @@ class Observable(object):
|
||||
"""
|
||||
Base Observable class as part of the Observer design pattern.
|
||||
|
||||
External Observer Pattern documentation: U{https://en.wikipedia.org/wiki/Observer_pattern}
|
||||
- External Usage documentation: U{https://github.com/tylerlaberge/PyPatterns/wiki/Behavioral-Pattern-Usage}
|
||||
- External Observer Pattern documentation: U{https://en.wikipedia.org/wiki/Observer_pattern}
|
||||
"""
|
||||
def __init__(self):
|
||||
"""
|
||||
|
||||
@@ -5,7 +5,8 @@ class Visitor(metaclass=ABCMeta):
|
||||
"""
|
||||
Abstract Visitor class as part of the Visitor Design Pattern.
|
||||
|
||||
External Visitor Design Pattern documentation: U{https://en.wikipedia.org/wiki/Visitor_pattern}
|
||||
- External Usage documentation: U{https://github.com/tylerlaberge/PyPatterns/wiki/Behavioral-Pattern-Usage}
|
||||
- External Visitor Design Pattern documentation: U{https://en.wikipedia.org/wiki/Visitor_pattern}
|
||||
"""
|
||||
def visit(self, node, *args, **kwargs):
|
||||
"""
|
||||
@@ -42,7 +43,8 @@ class Visitee(object):
|
||||
"""
|
||||
A base class for objects that wish to be able to be visited by a Visitor class.
|
||||
|
||||
External Visitor Design Pattern documentation: U{https://en.wikipedia.org/wiki/Visitor_pattern}
|
||||
- External Usage documentation: U{https://github.com/tylerlaberge/PyPatterns/wiki/Behavioral-Pattern-Usage}
|
||||
- External Visitor Design Pattern documentation: U{https://en.wikipedia.org/wiki/Visitor_pattern}
|
||||
"""
|
||||
def accept(self, visitor, *args, **kwargs):
|
||||
"""
|
||||
|
||||
@@ -7,7 +7,8 @@ class Reusable(Originator, metaclass=ABCMeta):
|
||||
"""
|
||||
An abstract reusable class.
|
||||
|
||||
External Object Pool Pattern documentation: U{https://en.wikipedia.org/wiki/Object_pool_pattern}
|
||||
- External Usage documentation: U{https://github.com/tylerlaberge/PyPatterns/wiki/Creational-Pattern-Usage}
|
||||
- External Object Pool Pattern documentation: U{https://en.wikipedia.org/wiki/Object_pool_pattern}
|
||||
"""
|
||||
def __init__(self):
|
||||
"""
|
||||
@@ -28,7 +29,8 @@ class Pool(object):
|
||||
"""
|
||||
An Object Pool design pattern implementation.
|
||||
|
||||
External Object Pool Pattern documentation: U{https://en.wikipedia.org/wiki/Object_pool_pattern}
|
||||
- External Usage documentation: U{https://github.com/tylerlaberge/PyPatterns/wiki/Creational-Pattern-Usage}
|
||||
- External Object Pool Pattern documentation: U{https://en.wikipedia.org/wiki/Object_pool_pattern}
|
||||
"""
|
||||
def __init__(self, reusable_class, *args, **kwargs):
|
||||
"""
|
||||
|
||||
@@ -6,7 +6,8 @@ class Prototype(object):
|
||||
"""
|
||||
Prototype design pattern abstract class.
|
||||
|
||||
External Prototype Pattern documentation: U{https://en.wikipedia.org/wiki/Prototype_pattern}
|
||||
- External Usage documentation: U{https://github.com/tylerlaberge/PyPatterns/wiki/Creational-Pattern-Usage}
|
||||
- External Prototype Pattern documentation: U{https://en.wikipedia.org/wiki/Prototype_pattern}
|
||||
"""
|
||||
def prototype(self, **attributes):
|
||||
"""
|
||||
|
||||
@@ -4,7 +4,8 @@ class Singleton(type):
|
||||
|
||||
Enforces any object using this metaclass to only create a single instance.
|
||||
|
||||
External Singleton Pattern documentation: U{https://en.wikipedia.org/wiki/Singleton_pattern}
|
||||
- External Usage documentation: U{https://github.com/tylerlaberge/PyPatterns/wiki/Creational-Pattern-Usage}
|
||||
- External Singleton Pattern documentation: U{https://en.wikipedia.org/wiki/Singleton_pattern}
|
||||
"""
|
||||
__instance = None
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@ class Adapter(object):
|
||||
"""
|
||||
Adapter class as part of the Adapter design pattern.
|
||||
|
||||
External Adapter Pattern Documentation: U{https://en.wikipedia.org/wiki/Adapter_pattern}
|
||||
- External Usage Documentation: U{https://github.com/tylerlaberge/PyPatterns/wiki/Structural-Pattern-Usage}
|
||||
- External Adapter Pattern Documentation: U{https://en.wikipedia.org/wiki/Adapter_pattern}
|
||||
"""
|
||||
def __init__(self, adaptee, **adapted_methods):
|
||||
"""
|
||||
|
||||
@@ -2,7 +2,8 @@ class Composite(object):
|
||||
"""
|
||||
Composite class as part of the Composite pattern.
|
||||
|
||||
External Composite Pattern documentation: U{https://en.wikipedia.org/wiki/Composite_pattern}
|
||||
- External Usage Documentation: U{https://github.com/tylerlaberge/PyPatterns/wiki/Structural-Pattern-Usage}
|
||||
- External Composite Pattern documentation: U{https://en.wikipedia.org/wiki/Composite_pattern}
|
||||
"""
|
||||
def __init__(self, interface):
|
||||
"""
|
||||
|
||||
@@ -6,7 +6,8 @@ class Decorator(object, metaclass=ABCMeta):
|
||||
"""
|
||||
Base Decorator class that all decorator classes inherit from.
|
||||
|
||||
External Decorator Pattern documentation: U{https://en.wikipedia.org/wiki/Decorator_pattern}
|
||||
- External Usage Documentation: U{https://github.com/tylerlaberge/PyPatterns/wiki/Structural-Pattern-Usage}
|
||||
- External Decorator Pattern documentation: U{https://en.wikipedia.org/wiki/Decorator_pattern}
|
||||
"""
|
||||
def __get__(self, instance, owner):
|
||||
"""
|
||||
@@ -26,7 +27,8 @@ class DecoratorSimple(Decorator, metaclass=ABCMeta):
|
||||
"""
|
||||
A Base Decorator class for decorators with no arguments.
|
||||
|
||||
External Decorator Pattern documentation: U{https://en.wikipedia.org/wiki/Decorator_pattern}
|
||||
- External Usage Documentation: U{https://github.com/tylerlaberge/PyPatterns/wiki/Structural-Pattern-Usage}
|
||||
- External Decorator Pattern documentation: U{https://en.wikipedia.org/wiki/Decorator_pattern}
|
||||
"""
|
||||
def __init__(self, func):
|
||||
"""
|
||||
@@ -41,7 +43,8 @@ class DecoratorComplex(Decorator, metaclass=ABCMeta):
|
||||
"""
|
||||
A Base Decorator class for decorators with arguments.
|
||||
|
||||
External Decorator Pattern documentation: U{https://en.wikipedia.org/wiki/Decorator_pattern}
|
||||
- External Usage Documentation: U{https://github.com/tylerlaberge/PyPatterns/wiki/Structural-Pattern-Usage}
|
||||
- External Decorator Pattern documentation: U{https://en.wikipedia.org/wiki/Decorator_pattern}
|
||||
"""
|
||||
@abstractmethod
|
||||
def __init__(self, *args, **kwargs):
|
||||
@@ -70,7 +73,8 @@ class CallWrapper(DecoratorSimple):
|
||||
"""
|
||||
A Decorator for wrapping DecoratorComplex __call__ methods.
|
||||
|
||||
External Decorator Pattern documentation: U{https://en.wikipedia.org/wiki/Decorator_pattern}
|
||||
- External Usage Documentation: U{https://github.com/tylerlaberge/PyPatterns/wiki/Structural-Pattern-Usage}
|
||||
- External Decorator Pattern documentation: U{https://en.wikipedia.org/wiki/Decorator_pattern}
|
||||
"""
|
||||
def __call__(self, instance, func):
|
||||
"""
|
||||
|
||||
@@ -2,7 +2,8 @@ class FlyweightMeta(type):
|
||||
"""
|
||||
Flyweight meta class as part of the Flyweight design pattern.
|
||||
|
||||
External Flyweight Pattern documentation: U{https://en.wikipedia.org/wiki/Flyweight_pattern}
|
||||
- External Usage Documentation: U{https://github.com/tylerlaberge/PyPatterns/wiki/Structural-Pattern-Usage}
|
||||
- External Flyweight Pattern documentation: U{https://en.wikipedia.org/wiki/Flyweight_pattern}
|
||||
"""
|
||||
def __new__(mcs, name, bases, attrs):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user