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
    
  
  
    
  | pub struct ScanMap<I, F, T> { | |
| iter: I, | |
| f: F, | |
| acc: T, | |
| } | |
| impl<I, F, T> ScanMap<I, F, T> | |
| where | |
| I: Iterator, | |
| F: FnMut(&T, I::Item) -> T, | 
  
    
      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
    
  
  
    
  | import asyncio | |
| import inspect | |
| async def async_func(): | |
| await asyncio.sleep(1) | |
| @asyncio.coroutine | |
| def decorator_func(): | |
| yield from asyncio.sleep(1) | 
  
    
      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
    
  
  
    
  | # add the other files to your django app and migrate | |
| # enter django shell with python manage.py shell and execute the following | |
| # I called my app 'issues'; so change issues to your app name in case you choose another one | |
| # there are 5 models which realize state machine bindings to django models in different ways | |
| # Item: add a transitions.Machine instance to each record/item | |
| # ItemSingleton: add each model to a global transitions.Machine | |
| # ItemSingletonSet: Extend transitions.Machine to use set instead of list to store models; this increases look up speed in add_model | |
| # ItemNoMachine: just a minimal model without a state machine (for referencing purposes) | |
| # ItemFysom: add a customized fysom machine to each record/item | 
  
    
      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
    
  
  
    
  | # unloads all imports from a certain module | |
| def unload_module(name): | |
| dk = [] | |
| for k in sys.modules.keys(): | |
| if k.startswith(name): | |
| dk.append(k) | |
| for k in dk: | |
| del sys.modules[k] |