updated from Atlas
This commit is contained in:
parent
aab93699a4
commit
573e1a94c4
@ -23,6 +23,6 @@ with open(sys.argv[1], encoding='utf-8') as fp:
|
|||||||
index[word] = occurrences # <3>
|
index[word] = occurrences # <3>
|
||||||
|
|
||||||
# print in alphabetical order
|
# print in alphabetical order
|
||||||
for word in sorted(index, key=str.upper):
|
for word in sorted(index, key=str.upper): # <4>
|
||||||
print(word, index[word])
|
print(word, index[word])
|
||||||
# END INDEX0
|
# END INDEX0
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
# BEGIN CLIP_ANNOT
|
# BEGIN CLIP_ANNOT
|
||||||
|
|
||||||
def clip(text:str, max_len:'int > 0'=80) -> str:
|
def clip(text:str, max_len:'int > 0'=80) -> str: # <1>
|
||||||
"""Return text clipped at the last space before or after max_len
|
"""Return text clipped at the last space before or after max_len
|
||||||
"""
|
"""
|
||||||
end = None
|
end = None
|
@ -73,7 +73,7 @@ class Promotion(ABC): # the Strategy: an Abstract Base Class
|
|||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def discount(self, order):
|
def discount(self, order):
|
||||||
"""Return discount as an positive dollar amount"""
|
"""Return discount as a positive dollar amount"""
|
||||||
|
|
||||||
|
|
||||||
class FidelityPromo(Promotion): # first Concrete Strategy
|
class FidelityPromo(Promotion): # first Concrete Strategy
|
@ -8,9 +8,8 @@ def register(active=True): # <2>
|
|||||||
% (active, func))
|
% (active, func))
|
||||||
if active: # <4>
|
if active: # <4>
|
||||||
registry.add(func)
|
registry.add(func)
|
||||||
else: # <5>
|
else:
|
||||||
if func in registry:
|
registry.discard(func) # <5>
|
||||||
registry.remove(func)
|
|
||||||
|
|
||||||
return func # <6>
|
return func # <6>
|
||||||
return decorate # <7>
|
return decorate # <7>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user