Changeset 11030:041609b67d4d in orange


Ignore:
Timestamp:
11/14/12 16:22:57 (18 months ago)
Author:
Miha Stajdohar <miha.stajdohar@…>
Branch:
default
Message:

Added Mock to orange docs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • docs/conf.py

    r11028 r11030  
    1313 
    1414import imp, inspect, sys, os 
     15 
     16class Mock(object): 
     17    def __init__(self, *args, **kwargs): 
     18        pass 
     19 
     20    def __call__(self, *args, **kwargs): 
     21        return Mock() 
     22 
     23    @classmethod 
     24    def __getattr__(cls, name): 
     25        if name in ('__file__', '__path__'): 
     26            return '/dev/null' 
     27        elif name[0] == name[0].upper(): 
     28            mockType = type(name, (), {}) 
     29            mockType.__module__ = __name__ 
     30            return mockType 
     31        else: 
     32            return Mock() 
     33 
     34MOCK_MODULES = ['orange', 'scipy', 'scipy.stats', 'scipy.sparse', 'scipy.optimize', 'scipy.linalg'] 
     35for mod_name in MOCK_MODULES: 
     36    sys.modules[mod_name] = Mock() 
    1537 
    1638#rewrite formatargs function with different defaults 
Note: See TracChangeset for help on using the changeset viewer.