2020-04-24_python-decorators-part-1.html
001|
002|
003|
004|
005| def process_command (s):
006|
007| return s
008|
009| def scope_azimuth (command):
010| command = process_command(command)
011|
012|
013| def scope_elevation (command):
014| command = process_command(command)
015|
016|
017|
018| def UpperCase (inner):
019| def wrapper (s):
020| s = s.upper()
021| return inner(s)
022| return wrapper
023|
024| @UpperCase
025| def scope_azimuth (command):
026|
027|
028| @UpperCase
029| def scope_elevation (command):
030|
031|
032|
033| def UpperCase (inner):
034| return lambda s:inner(s.upper())
035|
036| def scope_azimuth (command):
037|
038| def scope_elevation (command):
039|
040|
041| scope_azimuth = UpperCase(scope_azimuth)
042| scope_elevation = UpperCase(scope_elevation)
043|
044|
045| def UpperCase (inner):
046| return lambda s:inner(s.upper())
047|
048| def LowerCase (inner):
049| return lambda s:inner(s.lower())
050|
051| def Spaces (inner):
052| def wrapper (s):
053| t = s.split()
054| return inner(' '.join(t))
055| return wrapper
056|
057|
058| @UpperCase
059| @Spaces
060| def scope_azimuth (command):
061|
062|
063| @UpperCase
064| @Spaces
065| def scope_elevation (command):
066|
067|
068|
069| def scope_azimuth (command):
070|
071| def scope_elevation (command):
072|
073|
074| scope_azimuth = UpperCase(Spaces(scope_azimuth))
075| scope_elevation = UpperCase(Spaces(scope_elevation))
076|
077|
078|