MCPcopy Create free account
hub / github.com/ActiveState/code / __call__

Method __call__

recipes/Python/577280_Holiday_Leave/recipe-577280.py:92–122  ·  view source on GitHub ↗

Each action should call this logic.

(self, parser, namespace, values, option_string=None)

Source from the content-addressed store, hash-verified

90 """
91
92 def __call__(self, parser, namespace, values, option_string=None):
93 """
94 Each action should call this logic.
95 """
96
97 dis_dict = {'--add': '+',
98 '--remove': '-',
99 '-a': '+',
100 '-rm': '-',
101 '--reset': '*'}
102 #debug
103 #print '%r %r %r' % (namespace, values, option_string)
104 if option_string == '--reset':
105 print 'Base reset to: ', values
106 Log.history.append(('*' + str(values),
107 time.strftime(STATIC_T, time.gmtime())))
108 Log.save_log()
109 elif option_string == '--clear':
110 Log.history = []
111 Log.save_log()
112 os.remove(STATIC_P)
113 sys.exit('Clear all data...OK')
114 else:
115 try:
116 Log.history.append((dis_dict[option_string] + str(values),
117 time.strftime(STATIC_T, time.gmtime())))
118 except KeyError:
119 pass
120 else:
121 Log.save_log()
122 Log.print_log()
123
124
125class Leave(object):

Callers

nothing calls this directly

Calls 7

strFunction · 0.85
gmtimeMethod · 0.80
save_logMethod · 0.80
appendMethod · 0.45
removeMethod · 0.45
exitMethod · 0.45
print_logMethod · 0.45

Tested by

no test coverage detected