e2366e9102e6862416bf998af52baaa5e9c0a31b,python/mxnet/attribute.py,AttrScope,__enter__,#AttrScope#,68
Before Change
def __enter__(self):
// pylint: disable=protected-access
if not hasattr(AttrScope._current, "value"):
AttrScope._current.value = AttrScope()
self._old_scope = AttrScope._current.value
attr = AttrScope._current.value._attr.copy()
attr.update(self._attr)
self._attr = attr
AttrScope._current.value = self
return self
def __exit__(self, ptype, value, trace):
assert self._old_scope
After Change
return attr if attr else {}
def __enter__(self): // pylint: disable=protected-access
attr = _current.get()._attr.copy()
attr.update(self._attr)
self._attr = attr
// Token can"t be pickled and Token.old_value is Token.MISSING if _current.get() uses default value
self._old_scope = _current.get()
_current.set(self)
return self
def __exit__(self, ptype, value, trace):
assert self._old_scope
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 18
Instances
Project Name: apache/incubator-mxnet
Commit Name: e2366e9102e6862416bf998af52baaa5e9c0a31b
Time: 2020-07-15
Author: lausen@amazon.com
File Name: python/mxnet/attribute.py
Class Name: AttrScope
Method Name: __enter__
Project Name: apache/incubator-mxnet
Commit Name: e2366e9102e6862416bf998af52baaa5e9c0a31b
Time: 2020-07-15
Author: lausen@amazon.com
File Name: python/mxnet/attribute.py
Class Name: AttrScope
Method Name: __enter__
Project Name: apache/incubator-mxnet
Commit Name: e2366e9102e6862416bf998af52baaa5e9c0a31b
Time: 2020-07-15
Author: lausen@amazon.com
File Name: python/mxnet/name.py
Class Name: NameManager
Method Name: __enter__
Project Name: apache/incubator-mxnet
Commit Name: e2366e9102e6862416bf998af52baaa5e9c0a31b
Time: 2020-07-15
Author: lausen@amazon.com
File Name: python/mxnet/context.py
Class Name: Context
Method Name: __enter__