Changeset 839fd68 in sasmodels for sasmodels/custom/__init__.py
- Timestamp:
- Sep 17, 2018 2:33:16 PM (6 years ago)
- Branches:
- master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 91bd550
- Parents:
- 2c12061
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/custom/__init__.py
r0f48f1e r839fd68 37 37 return module 38 38 39 _MODULE_CACHE = {} 39 40 def load_custom_kernel_module(path): 40 41 """load SAS kernel from *path* as *sasmodels.custom.modelname*""" 41 42 # Pull off the last .ext if it exists; there may be others 42 43 name = basename(splitext(path)[0]) 43 # Placing the model in the 'sasmodels.custom' name space. 44 kernel_module = load_module_from_path('sasmodels.custom.'+name, 45 os.path.expanduser(path)) 46 return kernel_module 44 path = os.path.expanduser(path) 45 timestamp = os.path.getmtime(path) 46 module, cache_time = _MODULE_CACHE.get(path, (None, -1)) 47 if cache_time < timestamp: 48 # Placing the model in the 'sasmodels.custom' name space. 49 module = load_module_from_path('sasmodels.custom.'+name, path) 50 _MODULE_CACHE[path] = module, timestamp 51 52 return module
Note: See TracChangeset
for help on using the changeset viewer.