Ignore:
Timestamp:
01/25/13 18:13:14 (15 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Small fixes to docstrings.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/OrangeCanvas/registry/discovery.py

    r11285 r11286  
    11""" 
    2 Widget discovery. 
     2Widget Discovery 
     3================ 
     4 
     5Discover which widgets are installed/available. 
     6 
     7This module implements a discovery process 
    38 
    49""" 
     
    3338         "project_name",     # distribution name (if available) 
    3439         "project_version",  # distribution version (if available) 
    35          "exc_type",         # exception type 
    36          "exc_val",          # exception value (string) 
     40         "exc_type",         # exception type when last trying to import 
     41         "exc_val",          # exception value (str of value) 
    3742         "description"       # WidgetDescription instance 
    3843         ] 
     
    4146 
    4247def default_category_for_module(module): 
    43     """Return a default constructed :class:`CategoryDescription` 
    44     for `module`. 
     48    """ 
     49    Return a default constructed :class:`CategoryDescription` 
     50    for a `module`. 
    4551 
    4652    """ 
     
    6975        Run the widget discovery process from an entry point iterator 
    7076        (yielding :class:`pkg_resources.EntryPoint` instances). 
     77 
     78        As a convenience, if `entry_points_iter` is a string it will be used 
     79        to retrieve the iterator using `pkg_resources.iter_entry_points`. 
    7180 
    7281        """ 
     
    120129 
    121130    def process_directory(self, directory): 
    122         """Process and locate any widgets in directory 
    123         (old style widget discovery). 
     131        """ 
     132        Process and locate any widgets in directory on a file system, 
     133        i.e. examines all .py files in the directory, delegating the 
     134        to `process_file` (deprecated) 
    124135 
    125136        """ 
     
    128139 
    129140    def process_file(self, filename): 
    130         """Process .py file containing the widget code 
    131         (old stye widget discovery). 
    132  
     141        """ 
     142        Process .py file containing the widget code (deprecated). 
    133143        """ 
    134144        filename = fix_pyext(filename) 
     
    154164        self.handle_widget(desc) 
    155165 
    156     def process_widget_module(self, module, name=None, distribution=None): 
    157         """Process a widget module. 
     166    def process_widget_module(self, module, name=None, category_name=None, 
     167                              distribution=None): 
     168        """ 
     169        Process a widget module. 
    158170        """ 
    159171        try: 
     
    167179 
    168180    def process_category_package(self, category, name=None, distribution=None): 
    169         """Process a category package. 
     181        """ 
     182        Process a category package. 
    170183        """ 
    171184        cat_desc = None 
     
    210223 
    211224    def process_loader(self, callable): 
    212         """Process a callable loader function. 
     225        """ 
     226        Process a callable loader function. 
    213227        """ 
    214228        try: 
     
    226240                self.handle_widget(desc) 
    227241            else: 
    228                 log.error("Category or Widget Description instance expected." 
    229                           "Got %r.", desc) 
     242                log.error("Category or Widget Description instance " 
     243                          "expected. Got %r.", desc) 
    230244 
    231245    def handle_widget(self, desc): 
    232         """Handle a found widget description. 
     246        """ 
     247        Handle a found widget description. 
     248 
    233249        Base implementation adds it to the registry supplied in the 
    234250        constructor. 
     
    239255 
    240256    def handle_category(self, desc): 
    241         """Handle a found category description. 
     257        """ 
     258        Handle a found category description. 
     259 
    242260        Base implementation adds it to the registry supplied in the 
    243261        constructor. 
     
    249267    def iter_widget_descriptions(self, package, category_name=None, 
    250268                                 distribution=None): 
    251         """Return an iterator over widget descriptions 
    252         accessible from `package`. 
     269        """ 
     270        Return an iterator over widget descriptions accessible from 
     271        `package`. 
    253272 
    254273        """ 
     
    306325    def widget_description(self, module, widget_name=None, 
    307326                           category_name=None, distribution=None): 
    308         """Return a widget description from a module. 
     327        """ 
     328        Return a widget description from a module. 
    309329        """ 
    310330        if isinstance(module, basestring): 
     
    345365    def cache_insert(self, module, mtime, description, distribution=None, 
    346366                     error=None): 
    347         """Insert the description into the cache. 
     367        """ 
     368        Insert the description into the cache. 
    348369        """ 
    349370        if isinstance(module, types.ModuleType): 
     
    377398 
    378399    def cache_get(self, mod_path, distribution=None): 
    379         """Get the cache entry for mod_path. 
     400        """ 
     401        Get the cache entry for `mod_path`. 
    380402        """ 
    381403        if isinstance(mod_path, types.ModuleType): 
     
    385407 
    386408    def cache_has_valid_entry(self, mod_path, distribution=None): 
    387         """Does the cache have a valid entry for mod_path. 
     409        """ 
     410        Does the cache have a valid entry for `mod_path. 
    388411        """ 
    389412        mod_path = fix_pyext(mod_path) 
     
    412435 
    413436    def cache_can_ignore(self, mod_path, distribution=None): 
    414         """Can the mod_path be ignored (i.e. it was determined that it 
     437        """ 
     438        Can the `mod_path` be ignored (i.e. it was determined that it 
    415439        could not contain a valid widget description, for instance the 
    416         module does not hava a valid description and was not changed from 
    417         the last run). 
     440        module does not have a valid description and was not changed from 
     441        the last discovery run). 
    418442 
    419443        """ 
    420444        mod_path = fix_pyext(mod_path) 
    421445        if not os.path.exists(mod_path): 
    422             # Possible orphaned .pyc file 
     446            # Possible orphaned .py[co] file 
    423447            return True 
    424448 
     
    432456 
    433457    def cache_log_error(self, mod_path, error, distribution=None): 
    434         """Cache that the `error` occurred while processing mod_path. 
     458        """ 
     459        Cache that the `error` occurred while processing `mod_path`. 
    435460        """ 
    436461        mod_path = fix_pyext(mod_path) 
    437462        if not os.path.exists(mod_path): 
    438             # Possible orphaned .pyc file 
     463            # Possible orphaned .py[co] file 
    439464            return 
    440465        mtime = os.stat(mod_path).st_mtime 
     
    444469 
    445470def fix_pyext(mod_path): 
    446     """Fix a module filename path extension to always end with the 
    447     modules source file (i.e. strip compiled/optimzed .pyc,p.pyo 
     471    """ 
     472    Fix a module filename path extension to always end with the 
     473    modules source file (i.e. strip compiled/optimized .pyc, .pyo 
    448474    extension and replace it with .py). 
    449475 
     
    489515 
    490516def module_name_split(name): 
    491     """Split the module name into pacakge name and module 
    492     name inside the pacakge. 
    493  
     517    """ 
     518    Split the module name into package name and module name. 
    494519    """ 
    495520    if "." in name: 
     
    501526 
    502527def module_modified_time(module): 
    503     """Return the `module`s source filename and modified time as a tuple 
     528    """ 
     529    Return the `module`s source filename and modified time as a tuple 
    504530    (source_filename, modified_time). In case the module is from a zipped 
    505531    package the modified time is that of of the archive. 
     
    509535    name = module.__name__ 
    510536    module_filename = module.__file__ 
    511  
    512 #    if os.path.splitext(module_filename)[-1] in [".pyc", ".pyo"]: 
    513 #        module_filename = module_filename[:-1] 
    514537 
    515538    provider = pkg_resources.get_provider(name) 
     
    524547 
    525548def asmodule(module): 
    526     """Return the module references by `module` name. If `module` is 
     549    """ 
     550    Return the module references by `module` name. If `module` is 
    527551    already an imported module instance, return it as is. 
    528552 
Note: See TracChangeset for help on using the changeset viewer.