File tree Expand file tree Collapse file tree 1 file changed +1
-12
lines changed Expand file tree Collapse file tree 1 file changed +1
-12
lines changed Original file line number Diff line number Diff line change 16
16
17
17
class DelayedImportElement :
18
18
19
- class MarkAsImported :
20
- def __init__ (self , obj ):
21
- self .obj = obj
22
-
23
19
def __init__ (self , name , import_path = None ):
24
20
self .name = name
25
21
self .import_path = import_path
@@ -41,17 +37,10 @@ def _import(self):
41
37
42
38
def __get__ (self , instance , owner ):
43
39
assert instance is None
44
- imported = self .MarkAsImported ( self . _import () )
40
+ imported = self ._import ()
45
41
setattr (owner , self .name , imported )
46
42
return imported
47
43
48
- def __set__ (self , instance , value ):
49
- if isinstance (value , self .MarkAsImported ):
50
- delattr (instance , self .name )
51
- setattr (instance , self .name , value .obj )
52
- else :
53
- self .import_path = value
54
-
55
44
56
45
class DelayedImport :
57
46
"""A utility to delay the import of modules or variables.
You can’t perform that action at this time.
0 commit comments