Last active
June 26, 2017 21:21
-
-
Save stdavis/aba2ecd009f26e0dbb5cbc1ea9445488 to your computer and use it in GitHub Desktop.
Pallet Ship Shell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' | |
| NamePallet.py | |
| A module that ... | |
| ''' | |
| from forklift.models import Pallet | |
| from time import strftime | |
| class NamePallet(Pallet): | |
| def is_ready_to_ship(self): | |
| run_day = 'Monday' | |
| ready = strftime('%A') == run_day | |
| if not ready: | |
| self.success = (True, 'This pallet only runs on {}s.'.format(run_day)) | |
| return ready | |
| def ship(self): | |
| #: your code goes here | |
| #: replace print statements with self.log.info('...') | |
| if __name__ == '__main__': | |
| import logging | |
| pallet = NamePallet() | |
| logging.basicConfig( | |
| format='%(levelname)s %(asctime)s %(lineno)s %(message)s', | |
| datefmt='%H:%M:%S', | |
| level=logging.INFO | |
| ) | |
| pallet.log = logging | |
| pallet.ship() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment