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)
KUIZ is a web application quiz where you can create/take a quiz for learning and sharing knowledge from various subjects, questions and answers.

KUIZ KUIZ is a web application quiz where you can create/take a quiz for learning and sharing knowledge from various subjects, questions and answers.

Thanatibordee Sihaboonthong 3 Sep 12, 2022
The fundamentals of Python!

The fundamentals of Python Author: Mohamed NIANG, Staff ML Scientist Presentation This repository contains notebooks on the fundamentals of Python. Th

Mohamed NIANG 1 Mar 15, 2022
Tie together `drf-spectacular` and `djangorestframework-dataclasses` for easy-to-use apis and openapi schemas.

Speccify Tie together drf-spectacular and djangorestframework-dataclasses for easy-to-use apis and openapi schemas. Usage @dataclass class MyQ

Lyst 4 Sep 26, 2022
A check numbers python module

Made with Python3 (C) @FayasNoushad Copyright permission under MIT License License - https://github.com/FayasNoushad/Numbers/blob/main/LICENSE Deplo

Fayas Noushad 3 Nov 28, 2021
A simple spyware in python.

Spyware-Python- Dependencies: Python 3.x OpenCV PyAutoGUI PyMongo (for mongodb connection) Flask (Web Server) Ngrok (helps us push our fla

Abubakar 3 Sep 07, 2022
The goal of this program was to find the most common color in my living room.

The goal of this program was to find the most common color in my living room. I found a dataset online with colors names and their corr

1 Nov 09, 2021
This is the key combo trainer for League of Legends and Dota 2 players.

This is the key combo trainer for League of Legends and Dota 2 players. Place the mouse cursor on the blue point and press the key combo from the upper-left side of the screen.

Ilya Shpigor 1 Jan 31, 2022
Mpis-ex7 - Implementation of tasks 1, 2, 3 for Metody Probabilistyczne i Statystyka Lista 7

Implementations of task 1, 2 and 3 from here Author: Maciej Bazela Index: 261743 Each task was implemented in Python 3. I've used Cython to speed up e

Maciej Bazela 1 Feb 27, 2022
Albert launcher extension for rolling dice.

dice-roll-albert-ext Extension for rolling dice in Albert launcher Installation Locate the modules directory in the Python extension data directory. T

Jonah Lawrence 1 Nov 18, 2021
Enhanced version of blender's bvh add-on with more settings supported. The bvh's rest pose should have the same handedness as the armature while could use a different up/forward definiton.

Enhanced bvh add-on (importer/exporter) for blender Enhanced bvh add-on (importer/exporter) for blender Enhanced bvh importer Enhanced bvh exporter Ho

James Zhao 16 Dec 20, 2022
Werkzeug has a debug console that requires a pin. It's possible to bypass this with an LFI vulnerability or use it as a local privilege escalation vector.

Werkzeug Debug Console Pin Bypass Werkzeug has a debug console that requires a pin by default. It's possible to bypass this with an LFI vulnerability

Wyatt Dahlenburg 23 Dec 17, 2022
Collie is for uncovering RDMA NIC performance anomalies

Collie is for uncovering RDMA NIC performance anomalies. Overview Prerequ

Bytedance Inc. 34 Dec 11, 2022
Tesla App Update Differences Extractor

Tesla App Update Differences Extractor Python program that finds the differences between two versions of the Tesla App. When Tesla updates the app a l

Adrian 5 Apr 11, 2022
pydock - Docker-based environment manager for Python

pydock - Docker-based environment manager for Python ⚠️ pydock is still in beta mode, and very unstable. It is not recommended for anything serious. p

Alejandro Piad 16 Sep 18, 2021
Msgpack serialization/deserialization library for Python, written in Rust using PyO3 and rust-msgpack. Reboot of orjson. msgpack.org[Python]

ormsgpack ormsgpack is a fast msgpack library for Python. It is a fork/reboot of orjson It serializes faster than msgpack-python and deserializes a bi

Aviram Hassan 139 Dec 30, 2022
Malicious Document IoC Extractor is a collection of scripts that helps extracting IoCs from various maldoc families.

MDIExtractor Malicious Document IoC Extractor (MDIExtractor) is a collection of scripts that helps extracting IoCs from various maldoc families. Prere

Malwrologist 14 Nov 25, 2022
VCC-Generator is a python script that generate VCC for testing purposes only

VCC-Generator is a python script that generate VCC for testing purposes only

Spider Anongreyhat 10 Oct 23, 2022
Sample microservices application demo

Development mode docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d or export COMPOSE_FILE='docker-compose.yml:docker-compose.dev.ym

Konstantinos Bairaktaris 1 Nov 14, 2021
This repository holds those infrastructure-level modules, that every application requires that follows the core 12-factor principles.

py-12f-common About This repository holds those infrastructure-level modules, that every application requires that follows the core 12-factor principl

TamΓ‘s Benke 1 Dec 15, 2022
[x]it! support for working with todo and check list files in Sublime Text

[x]it! for Sublime Text This Sublime Package provides syntax-highlighting, shortcuts, and auto-completions for [x]it! files. Features Syntax highlight

Jan Heuermann 18 Sep 19, 2022