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)
A Python script to convert your favorite TV series into an Anki deck.

Ankiniser A Python3.8 script to convert your favorite TV series into an Anki deck. How to install? Download the script with git or download it manualy

37 Nov 03, 2022
Understanding the field usage of any object in Salesforce

Understanding the field usage of any object in Salesforce One of the biggest problems that I have addressed while working with Salesforce is to unders

Sebastian Undurraga 1 Dec 14, 2021
πŸ’˜ Write any Python with 9 Characters: e,x,c,h,r,(,+,1,)

πŸ’˜ PyFuck exchr(+1) PyFuck is a strange playful code. It uses only nine different characters to write Python3 code. Inspired by aemkei/jsfuck Example

Satoki 10 Dec 25, 2022
This is a repository built by the community for the community.

Nutshell Machine Learning Machines can see, hear and learn. Welcome to the future 🌍 The repository was built with a tree-like structure in mind, it c

Edem Gold 82 Nov 18, 2022
Application to list countries in order of travel from the United States.

Application to list countries in order of travel from the United States.

Broden Wanner 1 Nov 03, 2021
⏰ Shutdown Timer is an application that you can shutdown, restart, logoff, and hibernate your computer with a timer.

Shutdown Timer is a an application that you can shutdown, restart, logoff, and hibernate your computer with a timer. After choosing an action from the

Mehmet GΓΌdΓΌk 5 Jun 27, 2022
Lenovo Yoga Ideapad Autocharge

Description This program uses the conservation_mode of Lonovo Ideapad / Yoga not

1 Jan 09, 2022
Python bindings for `ign-msgs` and `ign-transport`

Python Ignition This project aims to provide Python bindings for ignition-msgs and ignition-transport. It is a work in progress... C++ and Python libr

Rhys Mainwaring 3 Nov 08, 2022
Analyze FnO trends by using NSE Bhav copy

BhavFnO Analyze FnO trends by using NSE Bhav copy Download entire BhavFnO folder and unzip it In that folder open command window

33 Jan 04, 2023
Todo-backend - Todo backend with python

Todo-backend - Todo backend with python

Julio C. Diaz 1 Jan 07, 2022
Simple control of Thorlabs Elliptec devices from Python.

Elliptec Simple control of Thorlabs Elliptec devices. No docs yet Β» Get started Β· Report a bug Β· Request a feature About The Project ThorLabs Elliptec

David Roesel 8 Sep 22, 2022
Open slidebook .sldy files in Python

Work in progress slidebook-python Open slidebook .sldy files in Python To install slidebook-python requires Python = 3.9 pip install slidebook-python

The Institute of Cancer Research 2 May 04, 2022
Restaurant-finder - Restaurant finder With Python

restaurant-finder APIs /restaurants query-params: a. filter: column based on whi

Kumar saurav 1 Feb 22, 2022
A general purpose low level programming language written in Python.

A general purpose low level programming language written in Python. Basal is an easy mid level programming language compiling to C. It has an easy syntax, similar to Python, Rust etc.

Snm Logic 6 Mar 30, 2022
A python implementation of differentiable quality diversity.

Differentiable Quality Diversity This repository is the official implementation of Differentiable Quality Diversity.

ICAROS 41 Nov 30, 2022
This code extracts line width of phonons from specular energy density (SED) calculated with LAMMPS.

This code extracts line width of phonons from specular energy density (SED) calculated with LAMMPS.

Masato Ohnishi 3 Jun 15, 2022
Tips that improve your life in one way or another

Tips that improve your life in one way or another. This software downloads life tips from reddit.com/r/LifeProTips and tweet the most upvoted tips on Twitter.

Burak Tokman 2 Aug 04, 2022
Python library for converting Python calculations into rendered latex.

Covert art by Joshua Hoiberg handcalcs: Python calculations in Jupyter, as though you wrote them by hand. handcalcs is a library to render Python calc

Connor Ferster 5.1k Jan 07, 2023
A python script to make leaderboards using a CSV with the runners name, IDs and Flag Emojis

SrcLbMaker A python script to make speedrun.com global leaderboards. Installation You need python 3.6 or higher. First, go to the folder where you wan

2 Jul 25, 2022
This library is an ongoing effort towards bringing the data exchanging ability between Java/Scala and Python

PyJava This library is an ongoing effort towards bringing the data exchanging ability between Java/Scala and Python

Byzer 6 Oct 17, 2022