From 506ab8b323f9e74f98e303d1f980013708b8b1d3 Mon Sep 17 00:00:00 2001 From: Grygorii Iermolenko Date: Thu, 7 Nov 2019 14:36:23 +0200 Subject: [PATCH] Remove script runner and hints at the top --- patterns/behavioral/catalog.py | 2 -- .../behavioral/chain_of_responsibility.py | 2 -- patterns/behavioral/chaining_method.py | 3 --- patterns/behavioral/command.py | 2 -- patterns/behavioral/iterator.py | 2 -- patterns/behavioral/mediator.py | 2 -- patterns/behavioral/memento.py | 2 -- patterns/behavioral/observer.py | 2 -- patterns/behavioral/publish_subscribe.py | 2 -- patterns/behavioral/registry.py | 3 --- patterns/behavioral/specification.py | 2 -- patterns/behavioral/state.py | 2 -- patterns/behavioral/strategy.py | 2 -- patterns/behavioral/template.py | 2 -- patterns/behavioral/visitor.py | 2 -- patterns/creational/abstract_factory.py | 2 -- patterns/creational/borg.py | 2 -- patterns/creational/builder.py | 3 --- patterns/creational/factory.py | 2 -- patterns/creational/lazy_evaluation.py | 2 -- patterns/creational/pool.py | 2 -- patterns/creational/prototype.py | 2 -- patterns/dependency_injection.py | 3 --- patterns/fundamental/delegation_pattern.py | 2 -- patterns/other/blackboard.py | 2 -- patterns/other/graph_search.py | 5 ----- patterns/structural/3-tier.py | 2 -- patterns/structural/adapter.py | 2 -- patterns/structural/bridge.py | 2 -- patterns/structural/composite.py | 2 -- patterns/structural/decorator.py | 2 -- patterns/structural/facade.py | 2 -- patterns/structural/flyweight.py | 2 -- patterns/structural/front_controller.py | 2 -- patterns/structural/mvc.py | 2 -- patterns/structural/proxy.py | 2 -- run_all.sh | 22 ------------------- tests/behavioral/test_command.py | 2 -- tests/behavioral/test_observer.py | 2 -- tests/behavioral/test_publish_subscribe.py | 2 -- tests/behavioral/test_state.py | 2 -- tests/creational/test_abstract_factory.py | 2 -- tests/creational/test_borg.py | 2 -- tests/creational/test_builder.py | 2 -- tests/creational/test_lazy.py | 2 -- tests/creational/test_pool.py | 2 -- tests/creational/test_prototype.py | 2 -- tests/structural/test_adapter.py | 2 -- tests/structural/test_bridge.py | 2 -- tests/structural/test_decorator.py | 2 -- tests/structural/test_proxy.py | 2 -- tests/test_hsm.py | 2 -- 52 files changed, 131 deletions(-) delete mode 100755 run_all.sh diff --git a/patterns/behavioral/catalog.py b/patterns/behavioral/catalog.py index 1f96d0b00..0570f7d3e 100644 --- a/patterns/behavioral/catalog.py +++ b/patterns/behavioral/catalog.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - """ A class that uses different static function depending of a parameter passed in init. Note the use of a single dictionary instead of multiple conditions diff --git a/patterns/behavioral/chain_of_responsibility.py b/patterns/behavioral/chain_of_responsibility.py index 9c000e1ed..ecc00f775 100644 --- a/patterns/behavioral/chain_of_responsibility.py +++ b/patterns/behavioral/chain_of_responsibility.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - """ *What is this pattern about? diff --git a/patterns/behavioral/chaining_method.py b/patterns/behavioral/chaining_method.py index e4779ec71..13c8032cf 100644 --- a/patterns/behavioral/chaining_method.py +++ b/patterns/behavioral/chaining_method.py @@ -1,6 +1,3 @@ -#!/usr/bin/env python - - class Person: def __init__(self, name, action): self.name = name diff --git a/patterns/behavioral/command.py b/patterns/behavioral/command.py index 5e6a4dcd6..e2b883949 100644 --- a/patterns/behavioral/command.py +++ b/patterns/behavioral/command.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - """ *TL;DR Encapsulates all information needed to perform an action or trigger an event. diff --git a/patterns/behavioral/iterator.py b/patterns/behavioral/iterator.py index 129da047a..c329e64d0 100644 --- a/patterns/behavioral/iterator.py +++ b/patterns/behavioral/iterator.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - """ http://ginstrom.com/scribbles/2007/10/08/design-patterns-python-style/ Implementation of the iterator pattern with a generator diff --git a/patterns/behavioral/mediator.py b/patterns/behavioral/mediator.py index ac6e5cf9b..0410d2c36 100644 --- a/patterns/behavioral/mediator.py +++ b/patterns/behavioral/mediator.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - """ https://www.djangospin.com/design-patterns-python/mediator/ diff --git a/patterns/behavioral/memento.py b/patterns/behavioral/memento.py index ddb02b2d0..7e4c62fea 100644 --- a/patterns/behavioral/memento.py +++ b/patterns/behavioral/memento.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - """ http://code.activestate.com/recipes/413838-memento-closure/ diff --git a/patterns/behavioral/observer.py b/patterns/behavioral/observer.py index ce75a9b3f..a30775584 100644 --- a/patterns/behavioral/observer.py +++ b/patterns/behavioral/observer.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - """ http://code.activestate.com/recipes/131499-observer-pattern/ diff --git a/patterns/behavioral/publish_subscribe.py b/patterns/behavioral/publish_subscribe.py index 73309c438..0cb3fc520 100644 --- a/patterns/behavioral/publish_subscribe.py +++ b/patterns/behavioral/publish_subscribe.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - """ Reference: http://www.slideshare.net/ishraqabd/publish-subscribe-model-overview-13368808 diff --git a/patterns/behavioral/registry.py b/patterns/behavioral/registry.py index 7843b0ce7..5ed18f467 100644 --- a/patterns/behavioral/registry.py +++ b/patterns/behavioral/registry.py @@ -1,6 +1,3 @@ -#!/usr/bin/env python - - class RegistryHolder(type): REGISTRY = {} diff --git a/patterns/behavioral/specification.py b/patterns/behavioral/specification.py index 1c6c76474..9cd85d86b 100644 --- a/patterns/behavioral/specification.py +++ b/patterns/behavioral/specification.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - """ @author: Gordeev Andrey diff --git a/patterns/behavioral/state.py b/patterns/behavioral/state.py index f4fa77389..32f11d775 100644 --- a/patterns/behavioral/state.py +++ b/patterns/behavioral/state.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - """ Implementation of the state pattern diff --git a/patterns/behavioral/strategy.py b/patterns/behavioral/strategy.py index bc6fbf7b9..e6f0aab32 100644 --- a/patterns/behavioral/strategy.py +++ b/patterns/behavioral/strategy.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - """ *What is this pattern about? Define a family of algorithms, encapsulate each one, and make them interchangeable. diff --git a/patterns/behavioral/template.py b/patterns/behavioral/template.py index d98c614e3..98c0cf2d1 100644 --- a/patterns/behavioral/template.py +++ b/patterns/behavioral/template.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - """ An example of the Template pattern in Python diff --git a/patterns/behavioral/visitor.py b/patterns/behavioral/visitor.py index 45f120bd7..a9bbd7e8d 100644 --- a/patterns/behavioral/visitor.py +++ b/patterns/behavioral/visitor.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - """ http://peter-hoffmann.com/2010/extrinsic-visitor-pattern-python-inheritance.html diff --git a/patterns/creational/abstract_factory.py b/patterns/creational/abstract_factory.py index ddb40f2a4..a9ed4bf53 100644 --- a/patterns/creational/abstract_factory.py +++ b/patterns/creational/abstract_factory.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - """ *What is this pattern about? diff --git a/patterns/creational/borg.py b/patterns/creational/borg.py index 7f85e25c1..dd0df0bad 100644 --- a/patterns/creational/borg.py +++ b/patterns/creational/borg.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - """ *What is this pattern about? The Borg pattern (also known as the Monostate pattern) is a way to diff --git a/patterns/creational/builder.py b/patterns/creational/builder.py index 6a450165f..f73a9665e 100644 --- a/patterns/creational/builder.py +++ b/patterns/creational/builder.py @@ -1,6 +1,3 @@ -#!/usr/bin/python -# -*- coding : utf-8 -*- - """ *What is this pattern about? It decouples the creation of a complex object and its representation, diff --git a/patterns/creational/factory.py b/patterns/creational/factory.py index fea8c36a0..c12064f8b 100644 --- a/patterns/creational/factory.py +++ b/patterns/creational/factory.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - """*What is this pattern about? A Factory is an object for creating other objects. diff --git a/patterns/creational/lazy_evaluation.py b/patterns/creational/lazy_evaluation.py index 10cebe231..cc752e2eb 100644 --- a/patterns/creational/lazy_evaluation.py +++ b/patterns/creational/lazy_evaluation.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - """ Lazily-evaluated property pattern in Python. diff --git a/patterns/creational/pool.py b/patterns/creational/pool.py index 526d325e7..0e2f1fec6 100644 --- a/patterns/creational/pool.py +++ b/patterns/creational/pool.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - """ *What is this pattern about? This pattern is used when creating an object is costly (and they are diff --git a/patterns/creational/prototype.py b/patterns/creational/prototype.py index 00c810821..b82f1e1f2 100644 --- a/patterns/creational/prototype.py +++ b/patterns/creational/prototype.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - """ *What is this pattern about? This patterns aims to reduce the number of classes required by an diff --git a/patterns/dependency_injection.py b/patterns/dependency_injection.py index c75eabb88..8522763ad 100644 --- a/patterns/dependency_injection.py +++ b/patterns/dependency_injection.py @@ -1,6 +1,3 @@ -#!/usr/bin/python -# -*- coding : utf-8 -*- - """ Dependency Injection (DI) is a technique whereby one object supplies the dependencies (services) to another object (client). diff --git a/patterns/fundamental/delegation_pattern.py b/patterns/fundamental/delegation_pattern.py index e58443197..051ef0da0 100644 --- a/patterns/fundamental/delegation_pattern.py +++ b/patterns/fundamental/delegation_pattern.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - """ Reference: https://en.wikipedia.org/wiki/Delegation_pattern Author: https://github.com/IuryAlves diff --git a/patterns/other/blackboard.py b/patterns/other/blackboard.py index 61eb38c77..f08fed0b6 100644 --- a/patterns/other/blackboard.py +++ b/patterns/other/blackboard.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - """ @author: Eugene Duboviy | github.com/duboviy diff --git a/patterns/other/graph_search.py b/patterns/other/graph_search.py index f340f11a7..6970092d2 100644 --- a/patterns/other/graph_search.py +++ b/patterns/other/graph_search.py @@ -1,8 +1,3 @@ -#!/usr/bin/env python - -"" - - class GraphSearch: """Graph search emulation in python, from source diff --git a/patterns/structural/3-tier.py b/patterns/structural/3-tier.py index b922f642f..4b5b61579 100644 --- a/patterns/structural/3-tier.py +++ b/patterns/structural/3-tier.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - """ *TL;DR Separates presentation, application processing, and data management functions. diff --git a/patterns/structural/adapter.py b/patterns/structural/adapter.py index e3167a20e..99314a2ac 100644 --- a/patterns/structural/adapter.py +++ b/patterns/structural/adapter.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - """ *What is this pattern about? The Adapter pattern provides a different interface for a class. We can diff --git a/patterns/structural/bridge.py b/patterns/structural/bridge.py index 28b70fc28..8a9f3c56f 100644 --- a/patterns/structural/bridge.py +++ b/patterns/structural/bridge.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - """ *References: http://en.wikibooks.org/wiki/Computer_Science_Design_Patterns/Bridge_Pattern#Python diff --git a/patterns/structural/composite.py b/patterns/structural/composite.py index aaa0a432b..2f2e6da90 100644 --- a/patterns/structural/composite.py +++ b/patterns/structural/composite.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - """ *What is this pattern about? The composite pattern describes a group of objects that is treated the diff --git a/patterns/structural/decorator.py b/patterns/structural/decorator.py index e6e094d57..b94c05273 100644 --- a/patterns/structural/decorator.py +++ b/patterns/structural/decorator.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - """ *What is this pattern about? The Decorator pattern is used to dynamically add a new feature to an diff --git a/patterns/structural/facade.py b/patterns/structural/facade.py index 0dee36c1b..6c04c472c 100644 --- a/patterns/structural/facade.py +++ b/patterns/structural/facade.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - """ Example from https://en.wikipedia.org/wiki/Facade_pattern#Python diff --git a/patterns/structural/flyweight.py b/patterns/structural/flyweight.py index 585483793..b5911370e 100644 --- a/patterns/structural/flyweight.py +++ b/patterns/structural/flyweight.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - """ *What is this pattern about? This pattern aims to minimise the number of objects that are needed by diff --git a/patterns/structural/front_controller.py b/patterns/structural/front_controller.py index bf857651f..346392e4e 100644 --- a/patterns/structural/front_controller.py +++ b/patterns/structural/front_controller.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - """ @author: Gordeev Andrey diff --git a/patterns/structural/mvc.py b/patterns/structural/mvc.py index 4e1a4c0ef..ff22ea595 100644 --- a/patterns/structural/mvc.py +++ b/patterns/structural/mvc.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - """ *TL;DR Separates data in GUIs from the ways it is presented, and accepted. diff --git a/patterns/structural/proxy.py b/patterns/structural/proxy.py index f2d3c8b23..8dcb7687f 100644 --- a/patterns/structural/proxy.py +++ b/patterns/structural/proxy.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - """ *TL;DR Provides an interface to resource that is expensive to duplicate. diff --git a/run_all.sh b/run_all.sh deleted file mode 100755 index 50922f3d2..000000000 --- a/run_all.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# -# Little helper to run all the scripts, under python coverage if coverage is available -# - -set -eu -failed="" - -if which coverage > /dev/null; then - COVERAGE="`which coverage` run -a" -else - COVERAGE='' -fi -for f in */[^_]*py; do - PYTHONPATH=. python $COVERAGE $f || failed+=" $f" - echo "I: done $f. Exit code $?" -done; - -if [ ! -z "$failed" ]; then - echo "Failed: $failed"; - exit 1 -fi \ No newline at end of file diff --git a/tests/behavioral/test_command.py b/tests/behavioral/test_command.py index 2532af029..fbee10595 100644 --- a/tests/behavioral/test_command.py +++ b/tests/behavioral/test_command.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- import os import shutil import unittest diff --git a/tests/behavioral/test_observer.py b/tests/behavioral/test_observer.py index 3c97d14c5..ae7a53a6a 100644 --- a/tests/behavioral/test_observer.py +++ b/tests/behavioral/test_observer.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- import unittest from unittest.mock import patch diff --git a/tests/behavioral/test_publish_subscribe.py b/tests/behavioral/test_publish_subscribe.py index a0363a34d..84015080e 100644 --- a/tests/behavioral/test_publish_subscribe.py +++ b/tests/behavioral/test_publish_subscribe.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- import unittest from unittest.mock import patch, call from patterns.behavioral.publish_subscribe import Provider, Publisher, Subscriber diff --git a/tests/behavioral/test_state.py b/tests/behavioral/test_state.py index 4009820b0..53dbf9bde 100644 --- a/tests/behavioral/test_state.py +++ b/tests/behavioral/test_state.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- import unittest from patterns.behavioral.state import Radio diff --git a/tests/creational/test_abstract_factory.py b/tests/creational/test_abstract_factory.py index a53355742..ad7a7fcf9 100644 --- a/tests/creational/test_abstract_factory.py +++ b/tests/creational/test_abstract_factory.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- import unittest from unittest.mock import patch diff --git a/tests/creational/test_borg.py b/tests/creational/test_borg.py index 62e9efe43..82d9efaf1 100644 --- a/tests/creational/test_borg.py +++ b/tests/creational/test_borg.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- import unittest from patterns.creational.borg import Borg, YourBorg diff --git a/tests/creational/test_builder.py b/tests/creational/test_builder.py index 4b63531a7..7f0d8e72f 100644 --- a/tests/creational/test_builder.py +++ b/tests/creational/test_builder.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- import unittest from patterns.creational.builder import construct_building, House, Flat, ComplexHouse diff --git a/tests/creational/test_lazy.py b/tests/creational/test_lazy.py index c61ee9a16..8da429ec1 100644 --- a/tests/creational/test_lazy.py +++ b/tests/creational/test_lazy.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- from __future__ import print_function import unittest from patterns.creational.lazy_evaluation import Person diff --git a/tests/creational/test_pool.py b/tests/creational/test_pool.py index f1d822ed4..b63f58c76 100644 --- a/tests/creational/test_pool.py +++ b/tests/creational/test_pool.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- import unittest import queue diff --git a/tests/creational/test_prototype.py b/tests/creational/test_prototype.py index 2e462d1c2..74eb12cfe 100644 --- a/tests/creational/test_prototype.py +++ b/tests/creational/test_prototype.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- import unittest from patterns.creational.prototype import Prototype, PrototypeDispatcher diff --git a/tests/structural/test_adapter.py b/tests/structural/test_adapter.py index 667c2fb53..76f80425e 100644 --- a/tests/structural/test_adapter.py +++ b/tests/structural/test_adapter.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- import unittest from patterns.structural.adapter import Dog, Cat, Human, Car, Adapter diff --git a/tests/structural/test_bridge.py b/tests/structural/test_bridge.py index ff106713f..0bb704f3b 100644 --- a/tests/structural/test_bridge.py +++ b/tests/structural/test_bridge.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- import unittest from unittest.mock import patch diff --git a/tests/structural/test_decorator.py b/tests/structural/test_decorator.py index 2b6933c7f..df8e9b210 100644 --- a/tests/structural/test_decorator.py +++ b/tests/structural/test_decorator.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- import unittest from patterns.structural.decorator import TextTag, BoldWrapper, ItalicWrapper diff --git a/tests/structural/test_proxy.py b/tests/structural/test_proxy.py index f54570a2a..e0dcaac05 100644 --- a/tests/structural/test_proxy.py +++ b/tests/structural/test_proxy.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- import sys from time import time import unittest diff --git a/tests/test_hsm.py b/tests/test_hsm.py index e752755e7..7b759e79c 100644 --- a/tests/test_hsm.py +++ b/tests/test_hsm.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- import unittest from unittest.mock import patch