Changeset c1a888b in sasmodels


Ignore:
Timestamp:
Apr 8, 2016 7:38:35 PM (9 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
9a943d0
Parents:
f6029fd
Message:

fix type signature errors

Location:
sasmodels
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/kernelpy.py

    re62a134 rc1a888b  
    1414 
    1515try: 
    16     from typing import Union 
     16    from typing import Union, Callable 
    1717except: 
    1818    pass 
  • sasmodels/model_test.py

    re62a134 rc1a888b  
    323323 
    324324def model_tests(): 
    325     # type: () -> Iterator[Callable[[], None] 
     325    # type: () -> Iterator[Callable[[], None]] 
    326326    """ 
    327327    Test runner visible to nosetests. 
  • sasmodels/modelinfo.py

    rf6029fd rc1a888b  
    8383    # if limits is a list of strings, then this is a choice list 
    8484    # field, and limits are 1 to length of string list 
     85    choices = []  # type: List[str] 
    8586    if isinstance(limits, list) and all(isstr(k) for k in limits): 
    8687        choices = limits 
    87         limits = [0, len(choices)-1] 
    88     else: 
    89         choices = [] 
     88        limits = (0., len(choices)-1.) 
     89 
    9090    # TODO: maybe allow limits of None for (-inf, inf) 
    9191    try: 
     
    276276    def __init__(self, name, units='', default=None, limits=(-np.inf, np.inf), 
    277277                 ptype='', description=''): 
    278         # type: (str, str, float, Limits, str, str) 
     278        # type: (str, str, float, Limits, str, str) -> None 
    279279        self.id = name.split('[')[0].strip() # type: str 
    280280        self.name = name                     # type: str 
     
    327327 
    328328    def as_call_reference(self, prefix=""): 
    329         # type: () -> str 
     329        # type: (str) -> str 
    330330        # Note: if the parameter is a struct type, then we will need to use 
    331331        # &prefix+id.  For scalars and vectors we can just use prefix+id. 
     
    549549 
    550550        # Gather entries such as name[n] into groups of the same n 
    551         dependent = dict((p.id, []) for p in control) 
     551        dependent = dict((p.id, []) for p in control)  # type: Dict[str, List[Parameter]] 
    552552        for p in self.kernel_parameters: 
    553553            if p.length_control is not None: 
     
    555555 
    556556        # Gather entries such as name[4] into groups of the same length 
    557         fixed = {} 
     557        fixed = {}  # type: Dict[int, List[Parameter]] 
    558558        for p in self.kernel_parameters: 
    559559            if p.length > 1 and p.length_control is None: 
     
    617617    info = ModelInfo() 
    618618    #print("make parameter table", kernel_module.parameters) 
    619     parameters = make_parameter_table(kernel_module.parameters) 
     619    parameters = make_parameter_table(getattr(kernel_module, 'parameters', [])) 
    620620    demo = expand_pars(parameters, getattr(kernel_module, 'demo', None)) 
    621621    filename = abspath(kernel_module.__file__) 
     
    713713    source = None           # type: List[str] 
    714714    tests = None            # type: List[TestCondition] 
    715     ER = None               # type: Optional[Callable[[np.ndarray, ...], np.ndarray]] 
    716     VR = None               # type: Optional[Callable[[np.ndarray, ...], Tuple[np.ndarray, np.ndarray]]] 
    717     form_volume = None      # type: Optional[Callable[[np.ndarray, ...], float]] 
    718     Iq = None               # type: Optional[Callable[[np.ndarray, ...], np.ndarray]] 
    719     Iqxy = None             # type: Optional[Callable[[np.ndarray, ...], np.ndarray]] 
    720     profile = None 
    721     sesans = None 
     715    ER = None               # type: Optional[Callable[[np.ndarray], np.ndarray]] 
     716    VR = None               # type: Optional[Callable[[np.ndarray], Tuple[np.ndarray, np.ndarray]]] 
     717    form_volume = None      # type: Optional[Callable[[np.ndarray], float]] 
     718    Iq = None               # type: Optional[Callable[[np.ndarray], np.ndarray]] 
     719    Iqxy = None             # type: Optional[Callable[[np.ndarray], np.ndarray]] 
     720    profile = None          # type: Optional[Callable[[np.ndarray], None]] 
     721    sesans = None           # type: Optional[Callable[[np.ndarray], np.ndarray]] 
    722722    mono_details = None     # type: CallDetails 
    723723 
Note: See TracChangeset for help on using the changeset viewer.