Commits

Lynn Rees committed 7fe58be

- update

Comments (0)

Files changed (1)

 
 # check for None
 isnone = lambda x, y: x if y is None else y
-
-
-def memoize(f, i=intern, z=items, r=repr, uw=update_wrapper):
-    '''
-    memoize function
-    '''
-    f.cache = {}.setdefault
-    if function_code(f).co_argcount == 1:
-        def memoize_(arg):
-            return f.cache(i(r(arg)), f(arg))
-    else:
-        def memoize_(*args, **kw): #@IgnorePep8
-            return f.setdefault(
-                i(r(args, z(kw)) if kw else r(args)), f(*args, **kw)
-            )
-    return uw(f, memoize_)
-
-
-if PY3:
-    loads = memoize(lambda x: ld(x, encoding='latin-1'))
-else:
-    loads = memoize(lambda x: ld(x))
+# import loader
+lazyload = lambda x: lazyimport(x) if isstring(x) and '.' in x else x
 
 
 def lazyimport(path, attribute=None, i=import_module, g=getattr, s=isstring):
     return decorating_function
 
 
+def memoize(f, i=intern, z=items, r=repr, uw=update_wrapper):
+    '''
+    memoize function
+    '''
+    f.cache = {}.setdefault
+    if function_code(f).co_argcount == 1:
+        def memoize_(arg):
+            return f.cache(i(r(arg)), f(arg))
+    else:
+        def memoize_(*args, **kw): #@IgnorePep8
+            return f.setdefault(
+                i(r(args, z(kw)) if kw else r(args)), f(*args, **kw)
+            )
+    return uw(f, memoize_)
+
+
+if PY3:
+    loads = memoize(lambda x: ld(x, encoding='latin-1'))
+else:
+    loads = memoize(lambda x: ld(x))
+
+
 @memoize
 def optimize(
     obj,
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.