A collection of design patterns and idioms in Python (With tests!).

Overview

Python Patterns


GitHub top language GitHub release (latest by date) GitHub Repo stars GitHub watchers GitHub forks


Help the project financially:

PayPal Yandex Visa Donate


Short description:

python-patterns - A collection of design patterns and idioms in Python (With tests!).


Current Patterns

Creational Patterns:

Pattern Description Tests
Abstract Factory use a generic function with specific factories test
Builder instead of using multiple constructors, builder receives parameters and returns constructed objects test
Factory Method delegate a specialized function/method to create instances test
Prototype use a factory and clones of a prototype for new instances (if instantiation is expensive) test
Singleton Ensures that the class has only one instance, and provides a global access point to it. test

Structural Patterns:

Pattern Description Tests
Adapter converts the interface of one class to the interface of another that clients expect. test
Bridge a client-provider middleman to soften interface changes test
Composite lets clients treat individual objects and compositions uniformly test
Decorator wrap functionality with other functionality in order to affect outputs test
Facade use one class as an API to a number of others test
Flyweight transparently reuse existing instances of objects with similar/identical state test
Proxy an object funnels operations to something else test

Behavior Patterns:

Pattern Description Tests
Blackboard architectural model, assemble different sub-system knowledge to build a solution, AI approach - non gang of four pattern. test
chain_of_responsibility apply a chain of successive handlers to try and process the data. test
command bundle a command and arguments to call later. test
interpreter a behavioral design pattern that solves a frequently encountered but subject to change problem. test
iterator traverse a container and access the container's elements. test
mediator an object that knows how to connect other objects and act as a proxy. test
memento generate an opaque token that can be used to go back to a previous state. test
observer provide a callback for notification of events/changes to data. test
state logic is organized into a discrete number of potential states and the next state that can be transitioned to. test
strategy selectable operations over the same data. test
template_method defines the basis of the algorithm and allows subclasses to override some of the steps in the algorithm, without changing its structure as a whole. test
visitor invoke a callback for all items of a collection. test

Help:

Requirements:

For run tests:

  • pytest

    • pip3 install pytest
    • pytest -v
  • pytest-cov

    • pip3 install pytest-cov
    • pytest --cov

Disclaimer of liability:

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Links:


Information:

Licensed under the terms of the BSD 3-Clause License

==========================================================
Copyright (c) 2018-2021, A.A Suvorov; All rights reserved.
==========================================================
You might also like...
An addin for Autodesk Fusion 360 that lets you view your design in a Looking Glass Portrait 3D display

An addin for Autodesk Fusion 360 that lets you view your design in a Looking Glass Portrait 3D display

This is the code of Python enthusiasts collection and written.

I am Python's enthusiast, like to collect Python's programs and code.

A collection of some leetcode challenges in python and JavaScript

Python and Javascript Coding Challenges Some leetcode questions I'm currently working on to open up my mind to better ways of problem solving. Impleme

A Curated Collection of Awesome Python Scripts
A Curated Collection of Awesome Python Scripts

A Curated Collection of Awesome Python Scripts that will make you go wow. This repository will help you in getting those green squares. Hop in and enjoy the journey of open source. πŸš€

A collection of python exercises to help your learning path!

How to use Step 1: run this command git clone https://github.com/TechPenguineer/Python-Exercises.git Step 2: Run this command cd Python-Exercises You

A collection of daily usage utility scripts in python. Helps in automation of day to day repetitive tasks.
A collection of daily usage utility scripts in python. Helps in automation of day to day repetitive tasks.

Kush's Utils Tool is my personal collection of scripts which is used to automated daily tasks. It is a evergrowing collection of scripts and will continue to evolve till the day I program. This is also my first python project.

Collection of Python scripts to perform Eikonal Tomography

Collection of Python scripts to perform Eikonal Tomography

x-tools is a collection of tools developed in Python

x-tools X-tools is a collection of tools developed in Python Commands\

Collection of tools to be more productive in your work environment and to avoid certain repetitive tasks. πŸ’›πŸ’™πŸ’š
Collection of tools to be more productive in your work environment and to avoid certain repetitive tasks. πŸ’›πŸ’™πŸ’š

Collection of tools to be more productive in your work environment and to avoid certain repetitive tasks. πŸ’›πŸ’™πŸ’š

Releases(v0.1.0)
  • v0.1.0(Aug 20, 2021)

    Python Patterns


    GitHub top language GitHub release (latest by date) GitHub Repo stars GitHub watchers GitHub forks


    Help the project financially:

    PayPal Yandex Visa Donate


    Short description:

    python-patterns - A collection of design patterns and idioms in Python (With tests!).


    Current Patterns

    Creational Patterns:

    | Pattern | Description | Tests | |:-------:| ----------- |------| | Abstract Factory | use a generic function with specific factories | test | | Builder | instead of using multiple constructors, builder receives parameters and returns constructed objects | test | | Factory Method | delegate a specialized function/method to create instances| test | | Prototype | use a factory and clones of a prototype for new instances (if instantiation is expensive) | test | | Singleton | Ensures that the class has only one instance, and provides a global access point to it. | test |

    Structural Patterns:

    | Pattern | Description | Tests | |:-------:| ----------- |------| | Adapter | converts the interface of one class to the interface of another that clients expect. | test | | Bridge | a client-provider middleman to soften interface changes | test | | Composite | lets clients treat individual objects and compositions uniformly | test | | Decorator | wrap functionality with other functionality in order to affect outputs | test | | Facade | use one class as an API to a number of others | test | | Flyweight | transparently reuse existing instances of objects with similar/identical state | test | | Proxy | an object funnels operations to something else | test |

    Behavior Patterns:

    | Pattern | Description | Tests | |:-------:| ----------- |------| | Blackboard | architectural model, assemble different sub-system knowledge to build a solution, AI approach - non gang of four pattern. | test | | chain_of_responsibility | apply a chain of successive handlers to try and process the data. | test | | command | bundle a command and arguments to call later. | test | | interpreter | a behavioral design pattern that solves a frequently encountered but subject to change problem. | test | | iterator | traverse a container and access the container's elements. | test | | mediator | an object that knows how to connect other objects and act as a proxy. | test | | memento | generate an opaque token that can be used to go back to a previous state. | test | | observer | provide a callback for notification of events/changes to data. | test | | state | logic is organized into a discrete number of potential states and the next state that can be transitioned to. | test | | strategy | selectable operations over the same data. | test | | template_method |defines the basis of the algorithm and allows subclasses to override some of the steps in the algorithm, without changing its structure as a whole. | test | | visitor | invoke a callback for all items of a collection. | test |


    Help:

    Requirements:

    For run tests:

    • pytest

      • pip3 install pytest
      • pytest -v
    • pytest-cov

      • pip3 install pytest-cov
      • pytest --cov

    Disclaimer of liability:

    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
    CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    

    Links:


    Information:

    Licensed under the terms of the BSD 3-Clause License
    
    ==========================================================
    Copyright (c) 2018-2021, A.A Suvorov; All rights reserved.
    ==========================================================
    
    Source code(tar.gz)
    Source code(zip)
System Design Assignments as part of Arpit's System Design Masterclass

System Design Assignments The repository contains a set of problem statements around Software Architecture and System Design as conducted by Arpit's S

Relog 1.1k Jan 9, 2023
Implementation of the Angular Spectrum method in Python to simulate Diffraction Patterns

Diffraction Simulations - Angular Spectrum Method Implementation of the Angular Spectrum method in Python to simulate Diffraction Patterns with arbitr

Rafael de la Fuente 276 Dec 30, 2022
Analyzes crypto candles over a set time period and then trades based on winning patterns found

patternstrade Analyzes crypto candles over a set time period and then trades based on winning patterns found. Heavily customizable. Warning: This was

ConnorCreate 14 May 29, 2022
Discovering local read-level DNA methylation patterns and DNA methylation heterogeneity in intermediately methylated regions

Discovering local read-level DNA methylation patterns and DNA methylation heterogeneity in intermediately methylated regions

null 1 Jan 11, 2022
What Do Deep Nets Learn? Class-wise Patterns Revealed in the Input Space

What Do Deep Nets Learn? Class-wise Patterns Revealed in the Input Space Introduction: Environment: Python3.6.5, PyTorch1.5.0 Dataset: CIFAR-10, Image

null 8 Mar 23, 2022
Architectural Patterns implementation by using notification handler module prototype

This repository covers singleton, indirection, factory, adaptor, mediator patterns in python language by using university hypothetical notification module prototype. The code is just for demonstrating the pattern implementation not modules working

Muhammad Umair 2 Jan 8, 2022
Random pass word generator made with python. PyQt5 module is used to design GUI.

Differences in this GUI program : Default titlebar removed Custom Minimize,Maximize and Close Buttons Drag & move window from any point Program work l

Dimuth De Zoysa 1 Jan 26, 2022
3D Printed Flip Clock Design and Code

Smart Flip Clock 3D printed smart clock that puts a new twist on old technology. Making The Smart Flip Clock The first thing that must be done for thi

Thomas 105 Oct 17, 2022
Here is my Senior Design Project that I implemented to graduate from Computer Engineering.

Here is my Senior Design Project that I implemented to graduate from Computer Engineering. It is a chatbot made in RASA and helps the user to plan their vacation in the Turkish language. In order to plan the user's vacation, it provides reservations by asking various questions for hotel, flight, or event.

Ezgi Subaşı 25 May 31, 2022
An app about keyboards, originating from the design of u/Sonnenschirm

keebapp-backend An app about keyboards, originating from the design of u/Sonnenschirm Setup Firstly, ensure that the environment for python is install

null 8 Sep 4, 2022