Skip to content

Commit 27ae281

Browse files
committed
updates
1 parent cf5f268 commit 27ae281

File tree

15 files changed

+24
-4
lines changed

15 files changed

+24
-4
lines changed

adapter/adapter_concept.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# pylint: disable=too-few-public-methods
2+
# pylint: disable=arguments-differ
23
"Adapter Concept Sample Code"
34
from abc import ABCMeta, abstractmethod
45

bridge/bridge_concept.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# pylint: disable=too-few-public-methods
2+
# pylint: disable=arguments-differ
23
"Bridge Pattern Concept Sample Code"
34
from abc import ABCMeta, abstractmethod
45

builder/builder_concept.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# pylint: disable=too-few-public-methods
2+
# pylint: disable=arguments-differ
23
"Builder Concept Sample Code"
34
from abc import ABCMeta, abstractmethod
45

command/command_concept.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# pylint: disable=arguments-differ
12
"The Command Pattern Concept"
23
from abc import ABCMeta, abstractmethod
34

composite/composite_concept.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# pylint: disable=arguments-differ
12
"The Composite pattern concept"
23
from abc import ABCMeta, abstractmethod
34

decorator/decorator_concept.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# pylint: disable=too-few-public-methods
2+
# pylint: disable=arguments-differ
23
"Decorator Concept Sample Code"
34
from abc import ABCMeta, abstractmethod
45

factory/factory_concept.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# pylint: disable=too-few-public-methods
2+
# pylint: disable=arguments-differ
23
"The Factory Concept"
34
from abc import ABCMeta, abstractmethod
45

interpreter/interpreter_concept.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# pylint: disable=too-few-public-methods
2+
# pylint: disable=arguments-differ
23
"The Interpreter Pattern Concept"
34

45

@@ -7,7 +8,7 @@ class AbstractExpression():
78
@staticmethod
89
def interpret():
910
"""
10-
The `interpret` method gets called recursively for each
11+
The `interpret` method gets called recursively for each
1112
AbstractExpression
1213
"""
1314

iterator/iterator_concept.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# pylint: disable=too-few-public-methods
2+
# pylint: disable=arguments-differ
23
"The Iterator Pattern Concept"
34
from abc import ABCMeta, abstractmethod
45

observer/observer_concept.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# pylint: disable=too-few-public-methods
2+
# pylint: disable=arguments-differ
23
"Observer Design Pattern Concept"
34

45
from abc import ABCMeta, abstractmethod

prototype/prototype_concept.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# pylint: disable=too-few-public-methods
2+
# pylint: disable=arguments-differ
23
"Prototype Concept Sample Code"
34
from abc import ABCMeta, abstractmethod
45

proxy/proxy_concept.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
# pylint: disable=too-few-public-methods
2+
# pylint: disable=arguments-differ
23
"A Proxy Concept Example"
34

45
from abc import ABCMeta, abstractmethod
56

7+
68
class ISubject(metaclass=ABCMeta):
79
"An interface implemented by both the Proxy and Real Subject"
810
@staticmethod
911
@abstractmethod
1012
def request():
1113
"A method to implement"
1214

15+
1316
class RealSubject(ISubject):
1417
"The actual real object that the proxy is representing"
1518

@@ -20,6 +23,7 @@ def __init__(self):
2023
def request(self):
2124
return self.enormous_data
2225

26+
2327
class Proxy(ISubject):
2428
"""
2529
The proxy. In this case the proxy will act as a cache for
@@ -36,18 +40,19 @@ def request(self):
3640
Using the proxy as a cache, and loading data into it only if
3741
it is needed
3842
"""
39-
if self.enormous_data == []:
43+
if not self.enormous_data:
4044
print("pulling data from RealSubject")
4145
self.enormous_data = self.real_subject.request()
4246
return self.enormous_data
4347
print("pulling data from Proxy cache")
4448
return self.enormous_data
4549

50+
4651
# The Client
4752
SUBJECT = Proxy()
4853
# use SUBJECT
4954
print(id(SUBJECT))
5055
# load the enormous amounts of data because now we want to show it.
5156
print(SUBJECT.request())
5257
# show the data again, but this time it retrieves it from the local cache
53-
print(SUBJECT.request())
58+
print(SUBJECT.request())

singleton/singleton_concept.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"Singleton Concept Sample Code"
33
import copy
44

5+
56
class Singleton():
67
"The Singleton Class"
78
value = []
@@ -21,6 +22,7 @@ def class_method(cls):
2122
"Use @classmethod to access class level variables"
2223
print(cls.value)
2324

25+
2426
# The Client
2527
# All uses of singleton point to the same memory address (id)
2628
print(f"id(Singleton)\t= {id(Singleton)}")
@@ -32,4 +34,4 @@ def class_method(cls):
3234
print(f"id(OBJECT2)\t= {id(OBJECT2)}")
3335

3436
OBJECT3 = Singleton()
35-
print(f"id(OBJECT1)\t= {id(OBJECT3)}")
37+
print(f"id(OBJECT1)\t= {id(OBJECT3)}")

visitor/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# pylint: disable=too-few-public-methods
2+
# pylint: disable=arguments-differ
23
"The Visitor Pattern Use Case Example"
34
from abc import ABCMeta, abstractmethod
45

visitor/visitor_concept.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# pylint: disable=too-few-public-methods
2+
# pylint: disable=arguments-differ
23
"The Visitor Pattern Concept"
34
from abc import ABCMeta, abstractmethod
45

0 commit comments

Comments
 (0)