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)
Recreating my first CRUD in python, but now more professional

Recreating my first CRUD in python, but now more professional

Ricardo Deo Sipione Augusto 2 Nov 27, 2021
Audio2Face - a project that transforms audio to blendshape weights,and drives the digital human,xiaomei,in UE project

Audio2Face - a project that transforms audio to blendshape weights,and drives the digital human,xiaomei,in UE project

FACEGOOD 732 Jan 08, 2023
CBO uses its Capital Tax model (CBO-CapTax) to estimate the effects of federal taxes on capital income from new investment

CBO’s CapTax Model CBO uses its Capital Tax model (CBO-CapTax) to estimate the effects of federal taxes on capital income from new investment. Specifi

Congressional Budget Office 7 Dec 16, 2022
A dog facts python module

A dog facts python module

Fayas Noushad 3 Nov 28, 2021
python for windows extensions

This is the readme for the Python for Win32 (pywin32) extensions source code. See CHANGES.txt for recent changes. 'setup.py' is a standard distutils

27 Dec 08, 2022
python package to showcase, test and build your own version of Pickhardt Payments

Pickhardt Payments Package The pickhardtpayments package is a collection of classes and interfaces that help you to test and implement your dialect of

Rene Pickhardt 37 Dec 18, 2022
Package to provide translation methods for pyramid, and means to reload translations without stopping the application

Package to provide translation methods for pyramid, and means to reload translations without stopping the application

Grzegorz Śliwiński 4 Nov 20, 2022
Pre-1.0 door/chest sound injector for Minecraft

doorjector Pre-1.0 door/chest sound injector for Minecraft. While the game is running, doorjector hotswaps the new sounds for the old right before the

Sam 1 Nov 20, 2021
Interactivity Lab: Household Pulse Explorable

Interactivity Lab: Household Pulse Explorable Goal: Build an interactive application that incorporates fundamental Streamlit components to offer a cur

1 Feb 10, 2022
Collection of system-wide scripts that I use on my Gentoo

linux-scripts Collection of scripts that I use on my Gentoo machine. I tend to put all scripts in /scripts directory. It is not likely that you would

Xoores 1 Jan 09, 2022
A reminder for stand-up roster

roster-reminder A reminder for stand-up roster Run the project Setup database The project use SQLite as database. You can create tables refer to roste

Jason Zhang 5 Oct 28, 2022
An advanced NFT Generator

NFT Generator An advanced NFT Generator Free software: GNU General Public License v3 Documentation: https://nft-generator.readthedocs.io. Features TOD

NFT Generator 5 Apr 21, 2022
This project recreates the R-based RCy3 Cytoscape Automation library as a Python package.

Python library for calling Cytoscape Automation via CyREST

Cytoscape Consortium 40 Dec 22, 2022
Web app for keeping track of buildings in danger of collapsing in the event of an earthquake

Bulina Roșie 🇷🇴 Un cutremur în București nu este o situație ipotetică. Este o certitudine că acest lucru se va întâmpla. În acest context, la mai bi

Code for Romania 27 Nov 29, 2022
March-madness - March Madness results 1985-2021

march-madness Results for all 2,268 NCAA Division I Men's Basketball Tournament games since the modern format was introduced in 1985. Includes years,

Darik Harter 2 Feb 26, 2022
Kivy program for identification & rotation sensing of objects on multi-touch tables.

ObjectViz ObjectViz is a multitouch object detection solution, enabling you to create physical markers out of any reliable multitouch solution. It's e

TangibleDisplay 8 Apr 04, 2022
Zeus - Advanced Punishments with Embeds.

Zeus Advanced Punishments with Embeds. Make sure to put the Discord Bot Token in the " TOKEN = '' " Language Python Features Ban Kick Mute Unmute Warn

2 Jan 05, 2022
Simple python script for AD enumeration

AutoAD - Simple python script for AD enumeration This tool was created on my spare time to help fellow penetration testers in automating the basic enu

Mohammad Arman 28 Jun 21, 2022
because rico hates uuid's

terrible-uuid-lambda because rico hates uuid's sub 200ms response times! Try it out here: https://api.mathisvaneetvelde.com/uuid https://api.mathisvan

Mathis Van Eetvelde 2 Feb 15, 2022
Some basic sorting algos

Sorting-Algos Some basic sorting algos HacktoberFest 2021 This repository consists of mezzo-level projects that undertake a simple task and perform it

Manthan Ghasadiya 7 Dec 13, 2022