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)
WhyNotWin11 - Detection Script to help identify why your PC isn't Windows 11 Release Ready

WhyNotWin11 - Detection Script to help identify why your PC isn't Windows 11 Release Ready

Robert C. Maehl 5.9k Dec 31, 2022
A place where the most basic, basic of python coding exists

python-basics A place where the most basic, basic of python coding exists As you can see, there are four folders and the best order to read is: appeti

Chuqin 2 Oct 05, 2022
Find functions without canary check (or similar)

Ghidra Check Protector Which non-trivial functions don't reference the stack canary checker (or other, user-defined function)? Place your cursor to th

buherator 3 Jan 17, 2022
This is the code of Python enthusiasts collection and written.

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

cnzb 35 Apr 18, 2022
A normal phoneNumber tracker made with python.

A normal phoneNumber tracker made with python.

CLAYZANE 2 Dec 30, 2021
Sequence clustering and database creation using mmseqs, from local fasta files

Sequence clustering and database creation using mmseqs, from local fasta files

Ana Julia Velez Rueda 3 Oct 27, 2022
An OpenSource crowd-sourced cooking recipes website

An OpenSource crowd-sourced cooking recipes website

21 Jul 31, 2022
Visualize Data From Stray Scanner https://keke.dev/blog/2021/03/10/Stray-Scanner.html

StrayVisualizer A set of scripts to work with data collected using Stray Scanner. Usage Installing Dependencies Install dependencies with pip -r requi

Kenneth Blomqvist 45 Dec 30, 2022
Using Python to parse through email logs received through several backup systems.

outlook-automated-backup-control Backup monitoring on a mailbox: In this mailbox there will be backup logs. The identification will based on the follo

Connor 2 Sep 28, 2022
Parser for the GeoSuite[tm] PRV export format

Parser for the GeoSuite[tm] PRV export format This library provides functionality to parse geotechnical investigation data in .prv files generated by

EMerald Geomodelling 1 Dec 17, 2021
Load, explore and analyse data from Scotland and rest of the world related to Covid19.

Streamlit Examples This is my first attempt with Streamlit. It is an open-source framework, free, Python-based and easy to use tool to build and deplo

Eyad Elyan 12 Mar 01, 2021
This Open-Source project is great for sensor capture and storage solutions.

Phase 1 This project helps developers in the creation of extended realities that communicate with Arduino and require the security of blockchain stora

Wolfberry, LLC 10 Dec 28, 2022
πŸ”€ Measure edit distance based on keyboard layout

clavier Measure edit distance based on keyboard layout. Table of contents Table of contents Introduction Installation User guide Keyboard layouts Dist

Max Halford 42 Dec 18, 2022
Data on COVID-19 (coronavirus) cases, deaths, hospitalizations, tests β€’ All countries β€’ Updated daily by Our World in Data

COVID-19 Dataset by Our World in Data Find our data on COVID-19 and its documentation in public/data. Documentation Data: complete COVID-19 dataset Da

Our World in Data 5.5k Jan 03, 2023
Predict if a fuse is usable on an appliance depending on the fuse rating

fuse-feasibility-analysis Predict if a fuse is usable on an appliance depending on the fuse rating , Power rating and resistance in the appliance

Sebastian Muchui 4 Jul 21, 2022
A set of decks and notebooks with exercises for use in a hands-on causal inference tutorial session

intro-to-causal-inference A introduction to causal inference using common tools from the python data stack Table of Contents Getting Started Install g

Roni Kobrosly 15 Dec 07, 2022
Quanser Labs Robotic Arm With Python

Quanser-Labs-Robotic-Arm As a team, we programmed a Robotic-Arm in Python on the

1 Jul 11, 2022
Plux - A dynamic code loading framework for building plugable Python distributions

Plux plux is the dynamic code loading framework used in LocalStack. Overview The

LocalStack 65 Dec 20, 2022
Framework To Ease Operating with Quantum Computers

QType Framework To Ease Operating with Quantum Computers Concept # define an array of 15 cubits:

Antonio PΓ‘rraga Navarro 2 Jun 06, 2022
synchronize projects via yaml/json manifest. built on libvcs

vcspull - synchronize your repos. built on libvcs Manage your commonly used repos from YAML / JSON manifest(s). Compare to myrepos. Great if you use t

python utilities for version control 200 Dec 20, 2022