query
stringlengths
9
9.05k
document
stringlengths
10
222k
negatives
listlengths
19
20
metadata
dict
itkTernaryAddImageFilterIF3IF3IF3IF3_Superclass_cast(itkLightObject obj) > itkTernaryAddImageFilterIF3IF3IF3IF3_Superclass
def itkTernaryAddImageFilterIF3IF3IF3IF3_Superclass_cast(*args): return _itkTernaryAddImageFilterPython.itkTernaryAddImageFilterIF3IF3IF3IF3_Superclass_cast(*args)
[ "def itkNotImageFilterIF3IF3_Superclass_cast(obj: 'itkLightObject') -> \"itkNotImageFilterIF3IF3_Superclass *\":\n return _itkNotImageFilterPython.itkNotImageFilterIF3IF3_Superclass_cast(obj)", "def itkTernaryAddImageFilterID3ID3ID3ID3_Superclass_cast(*args):\n return _itkTernaryAddImageFilterPython.itkTernar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
New() > itkTernaryAddImageFilterIUC2IUC2IUC2IUC2_Superclass Create a new object of the class itkTernaryAddImageFilterIUC2IUC2IUC2IUC2_Superclass and set the input and the parameters if some named or nonnamed arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects the first non named parameter in the first input, etc. The named parameters are used by calling the method with the same name prefixed by 'Set'.
def New(*args, **kargs): obj = itkTernaryAddImageFilterIUC2IUC2IUC2IUC2_Superclass.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj
[ "def New(*args, **kargs):\n obj = itkTernaryAddImageFilterIUC3IUC3IUC3IUC3_Superclass.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj", "def New(*args, **kargs):\n obj = itkTernaryAddImageFilterIUL2IUL2IUL2IUL2_Superclass.__New_orig__()\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
itkTernaryAddImageFilterIUC2IUC2IUC2IUC2_Superclass_cast(itkLightObject obj) > itkTernaryAddImageFilterIUC2IUC2IUC2IUC2_Superclass
def itkTernaryAddImageFilterIUC2IUC2IUC2IUC2_Superclass_cast(*args): return _itkTernaryAddImageFilterPython.itkTernaryAddImageFilterIUC2IUC2IUC2IUC2_Superclass_cast(*args)
[ "def itkNotImageFilterIUC2IUC2_Superclass_cast(obj: 'itkLightObject') -> \"itkNotImageFilterIUC2IUC2_Superclass *\":\n return _itkNotImageFilterPython.itkNotImageFilterIUC2IUC2_Superclass_cast(obj)", "def itkNotImageFilterIF2IF2_Superclass_cast(obj: 'itkLightObject') -> \"itkNotImageFilterIF2IF2_Superclass *\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
New() > itkTernaryAddImageFilterIUC3IUC3IUC3IUC3_Superclass Create a new object of the class itkTernaryAddImageFilterIUC3IUC3IUC3IUC3_Superclass and set the input and the parameters if some named or nonnamed arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects the first non named parameter in the first input, etc. The named parameters are used by calling the method with the same name prefixed by 'Set'.
def New(*args, **kargs): obj = itkTernaryAddImageFilterIUC3IUC3IUC3IUC3_Superclass.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj
[ "def New(*args, **kargs):\n obj = itkTernaryAddImageFilterID3ID3ID3ID3_Superclass.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj", "def New(*args, **kargs):\n obj = itkTernaryAddImageFilterIUL3IUL3IUL3IUL3_Superclass.__New_orig__()\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
itkTernaryAddImageFilterIUC3IUC3IUC3IUC3_Superclass_cast(itkLightObject obj) > itkTernaryAddImageFilterIUC3IUC3IUC3IUC3_Superclass
def itkTernaryAddImageFilterIUC3IUC3IUC3IUC3_Superclass_cast(*args): return _itkTernaryAddImageFilterPython.itkTernaryAddImageFilterIUC3IUC3IUC3IUC3_Superclass_cast(*args)
[ "def itkNotImageFilterIUC3IUC3_Superclass_cast(obj: 'itkLightObject') -> \"itkNotImageFilterIUC3IUC3_Superclass *\":\n return _itkNotImageFilterPython.itkNotImageFilterIUC3IUC3_Superclass_cast(obj)", "def itkTernaryAddImageFilterIUL3IUL3IUL3IUL3_Superclass_cast(*args):\n return _itkTernaryAddImageFilterPython...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
New() > itkTernaryAddImageFilterIUL2IUL2IUL2IUL2_Superclass Create a new object of the class itkTernaryAddImageFilterIUL2IUL2IUL2IUL2_Superclass and set the input and the parameters if some named or nonnamed arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects the first non named parameter in the first input, etc. The named parameters are used by calling the method with the same name prefixed by 'Set'.
def New(*args, **kargs): obj = itkTernaryAddImageFilterIUL2IUL2IUL2IUL2_Superclass.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj
[ "def New(*args, **kargs):\n obj = itkTernaryAddImageFilterIUL3IUL3IUL3IUL3_Superclass.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj", "def New(*args, **kargs):\n obj = itkTernaryAddImageFilterIUC2IUC2IUC2IUC2_Superclass.__New_orig__()\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
itkTernaryAddImageFilterIUL2IUL2IUL2IUL2_Superclass_cast(itkLightObject obj) > itkTernaryAddImageFilterIUL2IUL2IUL2IUL2_Superclass
def itkTernaryAddImageFilterIUL2IUL2IUL2IUL2_Superclass_cast(*args): return _itkTernaryAddImageFilterPython.itkTernaryAddImageFilterIUL2IUL2IUL2IUL2_Superclass_cast(*args)
[ "def itkNotImageFilterIF2IF2_Superclass_cast(obj: 'itkLightObject') -> \"itkNotImageFilterIF2IF2_Superclass *\":\n return _itkNotImageFilterPython.itkNotImageFilterIF2IF2_Superclass_cast(obj)", "def itkNotImageFilterIUS2IUS2_Superclass_cast(obj: 'itkLightObject') -> \"itkNotImageFilterIUS2IUS2_Superclass *\":\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
New() > itkTernaryAddImageFilterIUL3IUL3IUL3IUL3_Superclass Create a new object of the class itkTernaryAddImageFilterIUL3IUL3IUL3IUL3_Superclass and set the input and the parameters if some named or nonnamed arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects the first non named parameter in the first input, etc. The named parameters are used by calling the method with the same name prefixed by 'Set'.
def New(*args, **kargs): obj = itkTernaryAddImageFilterIUL3IUL3IUL3IUL3_Superclass.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj
[ "def New(*args, **kargs):\n obj = itkTernaryAddImageFilterID3ID3ID3ID3_Superclass.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj", "def New(*args, **kargs):\n obj = itkTernaryAddImageFilterIUC3IUC3IUC3IUC3_Superclass.__New_orig__()\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
itkTernaryAddImageFilterIUL3IUL3IUL3IUL3_Superclass_cast(itkLightObject obj) > itkTernaryAddImageFilterIUL3IUL3IUL3IUL3_Superclass
def itkTernaryAddImageFilterIUL3IUL3IUL3IUL3_Superclass_cast(*args): return _itkTernaryAddImageFilterPython.itkTernaryAddImageFilterIUL3IUL3IUL3IUL3_Superclass_cast(*args)
[ "def itkNotImageFilterIF3IF3_Superclass_cast(obj: 'itkLightObject') -> \"itkNotImageFilterIF3IF3_Superclass *\":\n return _itkNotImageFilterPython.itkNotImageFilterIF3IF3_Superclass_cast(obj)", "def itkNotImageFilterISS3ISS3_Superclass_cast(obj: 'itkLightObject') -> \"itkNotImageFilterISS3ISS3_Superclass *\":\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
New() > itkTernaryAddImageFilterIUS2IUS2IUS2IUS2_Superclass Create a new object of the class itkTernaryAddImageFilterIUS2IUS2IUS2IUS2_Superclass and set the input and the parameters if some named or nonnamed arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects the first non named parameter in the first input, etc. The named parameters are used by calling the method with the same name prefixed by 'Set'.
def New(*args, **kargs): obj = itkTernaryAddImageFilterIUS2IUS2IUS2IUS2_Superclass.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj
[ "def New(*args, **kargs):\n obj = itkTernaryAddImageFilterID2ID2ID2ID2_Superclass.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj", "def New(*args, **kargs):\n obj = itkAddImageFilterIUS2IUS2IUS2_Superclass.__New_orig__()\n import i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
itkTernaryAddImageFilterIUS2IUS2IUS2IUS2_Superclass_cast(itkLightObject obj) > itkTernaryAddImageFilterIUS2IUS2IUS2IUS2_Superclass
def itkTernaryAddImageFilterIUS2IUS2IUS2IUS2_Superclass_cast(*args): return _itkTernaryAddImageFilterPython.itkTernaryAddImageFilterIUS2IUS2IUS2IUS2_Superclass_cast(*args)
[ "def itkNotImageFilterIUS2IUS2_Superclass_cast(obj: 'itkLightObject') -> \"itkNotImageFilterIUS2IUS2_Superclass *\":\n return _itkNotImageFilterPython.itkNotImageFilterIUS2IUS2_Superclass_cast(obj)", "def itkSLICImageFilterIF2IUS2_Superclass_cast(obj: 'itkLightObject') -> \"itkSLICImageFilterIF2IUS2_Superclass...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
New() > itkTernaryAddImageFilterIUS3IUS3IUS3IUS3_Superclass Create a new object of the class itkTernaryAddImageFilterIUS3IUS3IUS3IUS3_Superclass and set the input and the parameters if some named or nonnamed arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects the first non named parameter in the first input, etc. The named parameters are used by calling the method with the same name prefixed by 'Set'.
def New(*args, **kargs): obj = itkTernaryAddImageFilterIUS3IUS3IUS3IUS3_Superclass.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj
[ "def New(*args, **kargs):\n obj = itkTernaryAddImageFilterID3ID3ID3ID3_Superclass.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj", "def New(*args, **kargs):\n obj = itkTernaryAddImageFilterIUS2IUS2IUS2IUS2_Superclass.__New_orig__()\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
itkTernaryAddImageFilterIUS3IUS3IUS3IUS3_Superclass_cast(itkLightObject obj) > itkTernaryAddImageFilterIUS3IUS3IUS3IUS3_Superclass
def itkTernaryAddImageFilterIUS3IUS3IUS3IUS3_Superclass_cast(*args): return _itkTernaryAddImageFilterPython.itkTernaryAddImageFilterIUS3IUS3IUS3IUS3_Superclass_cast(*args)
[ "def itkNotImageFilterIUS3IUS3_Superclass_cast(obj: 'itkLightObject') -> \"itkNotImageFilterIUS3IUS3_Superclass *\":\n return _itkNotImageFilterPython.itkNotImageFilterIUS3IUS3_Superclass_cast(obj)", "def itkNotImageFilterIUS2IUS2_Superclass_cast(obj: 'itkLightObject') -> \"itkNotImageFilterIUS2IUS2_Superclass...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
New() > itkTernaryAddImageFilterID2ID2ID2ID2 Create a new object of the class itkTernaryAddImageFilterID2ID2ID2ID2 and set the input and the parameters if some named or nonnamed arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects the first non named parameter in the first input, etc. The named parameters are used by calling the method with the same name prefixed by 'Set'.
def New(*args, **kargs): obj = itkTernaryAddImageFilterID2ID2ID2ID2.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj
[ "def New(*args, **kargs):\n obj = itkTernaryAddImageFilterID2ID2ID2ID2_Superclass.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj", "def New(*args, **kargs):\n obj = itkTernaryAddImageFilterIF2IF2IF2IF2.__New_orig__()\n import itkTe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
itkTernaryAddImageFilterID2ID2ID2ID2_cast(itkLightObject obj) > itkTernaryAddImageFilterID2ID2ID2ID2
def itkTernaryAddImageFilterID2ID2ID2ID2_cast(*args): return _itkTernaryAddImageFilterPython.itkTernaryAddImageFilterID2ID2ID2ID2_cast(*args)
[ "def itkConstrainedValueAdditionImageFilterIF2IF2IF2_cast(obj: 'itkLightObject') -> \"itkConstrainedValueAdditionImageFilterIF2IF2IF2 *\":\n return _itkConstrainedValueAdditionImageFilterPython.itkConstrainedValueAdditionImageFilterIF2IF2IF2_cast(obj)", "def itkAbsoluteValueDifferenceImageFilterIF2IF2IF2_cast(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
New() > itkTernaryAddImageFilterID3ID3ID3ID3 Create a new object of the class itkTernaryAddImageFilterID3ID3ID3ID3 and set the input and the parameters if some named or nonnamed arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects the first non named parameter in the first input, etc. The named parameters are used by calling the method with the same name prefixed by 'Set'.
def New(*args, **kargs): obj = itkTernaryAddImageFilterID3ID3ID3ID3.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj
[ "def New(*args, **kargs):\n obj = itkTernaryAddImageFilterIF3IF3IF3IF3.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj", "def New(*args, **kargs):\n obj = itkTernaryAddImageFilterIF3IF3IF3IF3_Superclass.__New_orig__()\n import itkTe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
itkTernaryAddImageFilterID3ID3ID3ID3_cast(itkLightObject obj) > itkTernaryAddImageFilterID3ID3ID3ID3
def itkTernaryAddImageFilterID3ID3ID3ID3_cast(*args): return _itkTernaryAddImageFilterPython.itkTernaryAddImageFilterID3ID3ID3ID3_cast(*args)
[ "def itkTernaryAddImageFilterIF3IF3IF3IF3_cast(*args):\n return _itkTernaryAddImageFilterPython.itkTernaryAddImageFilterIF3IF3IF3IF3_cast(*args)", "def itkNotImageFilterIF3IF3_cast(obj: 'itkLightObject') -> \"itkNotImageFilterIF3IF3 *\":\n return _itkNotImageFilterPython.itkNotImageFilterIF3IF3_cast(obj)", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
New() > itkTernaryAddImageFilterIF2IF2IF2IF2 Create a new object of the class itkTernaryAddImageFilterIF2IF2IF2IF2 and set the input and the parameters if some named or nonnamed arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects the first non named parameter in the first input, etc. The named parameters are used by calling the method with the same name prefixed by 'Set'.
def New(*args, **kargs): obj = itkTernaryAddImageFilterIF2IF2IF2IF2.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj
[ "def New(*args, **kargs):\n obj = itkTernaryAddImageFilterIF2IF2IF2IF2_Superclass.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj", "def New(*args, **kargs):\n obj = itkTernaryAddImageFilterID2ID2ID2ID2.__New_orig__()\n import itkTe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
itkTernaryAddImageFilterIF2IF2IF2IF2_cast(itkLightObject obj) > itkTernaryAddImageFilterIF2IF2IF2IF2
def itkTernaryAddImageFilterIF2IF2IF2IF2_cast(*args): return _itkTernaryAddImageFilterPython.itkTernaryAddImageFilterIF2IF2IF2IF2_cast(*args)
[ "def itkNotImageFilterIF2IF2_cast(obj: 'itkLightObject') -> \"itkNotImageFilterIF2IF2 *\":\n return _itkNotImageFilterPython.itkNotImageFilterIF2IF2_cast(obj)", "def itkConstrainedValueAdditionImageFilterIF2IF2IF2_cast(obj: 'itkLightObject') -> \"itkConstrainedValueAdditionImageFilterIF2IF2IF2 *\":\n return...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
New() > itkTernaryAddImageFilterIF3IF3IF3IF3 Create a new object of the class itkTernaryAddImageFilterIF3IF3IF3IF3 and set the input and the parameters if some named or nonnamed arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects the first non named parameter in the first input, etc. The named parameters are used by calling the method with the same name prefixed by 'Set'.
def New(*args, **kargs): obj = itkTernaryAddImageFilterIF3IF3IF3IF3.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj
[ "def New(*args, **kargs):\n obj = itkTernaryAddImageFilterIF3IF3IF3IF3_Superclass.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj", "def New(*args, **kargs):\n obj = itkTernaryAddImageFilterID3ID3ID3ID3.__New_orig__()\n import itkTe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
itkTernaryAddImageFilterIF3IF3IF3IF3_cast(itkLightObject obj) > itkTernaryAddImageFilterIF3IF3IF3IF3
def itkTernaryAddImageFilterIF3IF3IF3IF3_cast(*args): return _itkTernaryAddImageFilterPython.itkTernaryAddImageFilterIF3IF3IF3IF3_cast(*args)
[ "def itkNotImageFilterIF3IF3_cast(obj: 'itkLightObject') -> \"itkNotImageFilterIF3IF3 *\":\n return _itkNotImageFilterPython.itkNotImageFilterIF3IF3_cast(obj)", "def itkExpImageFilterIF3IF3_cast(obj: 'itkLightObject') -> \"itkExpImageFilterIF3IF3 *\":\n return _itkExpImageFilterPython.itkExpImageFilterIF3IF...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
New() > itkTernaryAddImageFilterIUC2IUC2IUC2IUC2 Create a new object of the class itkTernaryAddImageFilterIUC2IUC2IUC2IUC2 and set the input and the parameters if some named or nonnamed arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects the first non named parameter in the first input, etc. The named parameters are used by calling the method with the same name prefixed by 'Set'.
def New(*args, **kargs): obj = itkTernaryAddImageFilterIUC2IUC2IUC2IUC2.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj
[ "def New(*args, **kargs):\n obj = itkTernaryAddImageFilterIUC2IUC2IUC2IUC2_Superclass.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj", "def New(*args, **kargs):\n obj = itkTernaryAddImageFilterIUL2IUL2IUL2IUL2.__New_orig__()\n impo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
itkTernaryAddImageFilterIUC2IUC2IUC2IUC2_cast(itkLightObject obj) > itkTernaryAddImageFilterIUC2IUC2IUC2IUC2
def itkTernaryAddImageFilterIUC2IUC2IUC2IUC2_cast(*args): return _itkTernaryAddImageFilterPython.itkTernaryAddImageFilterIUC2IUC2IUC2IUC2_cast(*args)
[ "def itkAbsoluteValueDifferenceImageFilterIUC2IUC2IUC2_cast(obj: 'itkLightObject') -> \"itkAbsoluteValueDifferenceImageFilterIUC2IUC2IUC2 *\":\n return _itkAbsoluteValueDifferenceImageFilterPython.itkAbsoluteValueDifferenceImageFilterIUC2IUC2IUC2_cast(obj)", "def itkConstrainedValueAdditionImageFilterIUC2IUC2I...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
New() > itkTernaryAddImageFilterIUC3IUC3IUC3IUC3 Create a new object of the class itkTernaryAddImageFilterIUC3IUC3IUC3IUC3 and set the input and the parameters if some named or nonnamed arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects the first non named parameter in the first input, etc. The named parameters are used by calling the method with the same name prefixed by 'Set'.
def New(*args, **kargs): obj = itkTernaryAddImageFilterIUC3IUC3IUC3IUC3.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj
[ "def New(*args, **kargs):\n obj = itkTernaryAddImageFilterIF3IF3IF3IF3.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj", "def New(*args, **kargs):\n obj = itkTernaryAddImageFilterIF3IF3IF3IF3_Superclass.__New_orig__()\n import itkTe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
itkTernaryAddImageFilterIUC3IUC3IUC3IUC3_cast(itkLightObject obj) > itkTernaryAddImageFilterIUC3IUC3IUC3IUC3
def itkTernaryAddImageFilterIUC3IUC3IUC3IUC3_cast(*args): return _itkTernaryAddImageFilterPython.itkTernaryAddImageFilterIUC3IUC3IUC3IUC3_cast(*args)
[ "def itkTernaryAddImageFilterIUL3IUL3IUL3IUL3_cast(*args):\n return _itkTernaryAddImageFilterPython.itkTernaryAddImageFilterIUL3IUL3IUL3IUL3_cast(*args)", "def itkNotImageFilterIUC3IUC3_cast(obj: 'itkLightObject') -> \"itkNotImageFilterIUC3IUC3 *\":\n return _itkNotImageFilterPython.itkNotImageFilterIUC3IUC3_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
New() > itkTernaryAddImageFilterIUL2IUL2IUL2IUL2 Create a new object of the class itkTernaryAddImageFilterIUL2IUL2IUL2IUL2 and set the input and the parameters if some named or nonnamed arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects the first non named parameter in the first input, etc. The named parameters are used by calling the method with the same name prefixed by 'Set'.
def New(*args, **kargs): obj = itkTernaryAddImageFilterIUL2IUL2IUL2IUL2.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj
[ "def New(*args, **kargs):\n obj = itkTernaryAddImageFilterIUL2IUL2IUL2IUL2_Superclass.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj", "def New(*args, **kargs):\n obj = itkTernaryAddImageFilterIF2IF2IF2IF2_Superclass.__New_orig__()\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
itkTernaryAddImageFilterIUL2IUL2IUL2IUL2_cast(itkLightObject obj) > itkTernaryAddImageFilterIUL2IUL2IUL2IUL2
def itkTernaryAddImageFilterIUL2IUL2IUL2IUL2_cast(*args): return _itkTernaryAddImageFilterPython.itkTernaryAddImageFilterIUL2IUL2IUL2IUL2_cast(*args)
[ "def cast(obj: 'itkLightObject') -> \"itkAbsoluteValueDifferenceImageFilterIF2IF2IF2 *\":\n return _itkAbsoluteValueDifferenceImageFilterPython.itkAbsoluteValueDifferenceImageFilterIF2IF2IF2_cast(obj)", "def itkAbsoluteValueDifferenceImageFilterIF2IF2IF2_cast(obj: 'itkLightObject') -> \"itkAbsoluteValueDif...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
New() > itkTernaryAddImageFilterIUL3IUL3IUL3IUL3 Create a new object of the class itkTernaryAddImageFilterIUL3IUL3IUL3IUL3 and set the input and the parameters if some named or nonnamed arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects the first non named parameter in the first input, etc. The named parameters are used by calling the method with the same name prefixed by 'Set'.
def New(*args, **kargs): obj = itkTernaryAddImageFilterIUL3IUL3IUL3IUL3.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj
[ "def New(*args, **kargs):\n obj = itkTernaryAddImageFilterIF3IF3IF3IF3.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj", "def New(*args, **kargs):\n obj = itkTernaryAddImageFilterIF3IF3IF3IF3_Superclass.__New_orig__()\n import itkTe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
itkTernaryAddImageFilterIUL3IUL3IUL3IUL3_cast(itkLightObject obj) > itkTernaryAddImageFilterIUL3IUL3IUL3IUL3
def itkTernaryAddImageFilterIUL3IUL3IUL3IUL3_cast(*args): return _itkTernaryAddImageFilterPython.itkTernaryAddImageFilterIUL3IUL3IUL3IUL3_cast(*args)
[ "def itkTernaryAddImageFilterIUC3IUC3IUC3IUC3_cast(*args):\n return _itkTernaryAddImageFilterPython.itkTernaryAddImageFilterIUC3IUC3IUC3IUC3_cast(*args)", "def cast(obj: 'itkLightObject') -> \"itkAbsoluteValueDifferenceImageFilterIF3IF3IF3 *\":\n return _itkAbsoluteValueDifferenceImageFilterPython.itkAbso...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
New() > itkTernaryAddImageFilterIUS2IUS2IUS2IUS2 Create a new object of the class itkTernaryAddImageFilterIUS2IUS2IUS2IUS2 and set the input and the parameters if some named or nonnamed arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects the first non named parameter in the first input, etc. The named parameters are used by calling the method with the same name prefixed by 'Set'.
def New(*args, **kargs): obj = itkTernaryAddImageFilterIUS2IUS2IUS2IUS2.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj
[ "def New(*args, **kargs):\n obj = itkTernaryAddImageFilterIUS2IUS2IUS2IUS2_Superclass.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj", "def New(*args, **kargs):\n obj = itkAddImageFilterIUS2IUS2IUS2.__New_orig__()\n import itkTempl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
New() > itkTernaryAddImageFilterIUS3IUS3IUS3IUS3 Create a new object of the class itkTernaryAddImageFilterIUS3IUS3IUS3IUS3 and set the input and the parameters if some named or nonnamed arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects the first non named parameter in the first input, etc. The named parameters are used by calling the method with the same name prefixed by 'Set'.
def New(*args, **kargs): obj = itkTernaryAddImageFilterIUS3IUS3IUS3IUS3.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj
[ "def New(*args, **kargs):\n obj = itkTernaryAddImageFilterIUS3IUS3IUS3IUS3_Superclass.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj", "def New(*args, **kargs):\n obj = itkAddImageFilterIUS3IUS3IUS3.__New_orig__()\n import itkTempl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
itkTernaryAddImageFilterIUS3IUS3IUS3IUS3_cast(itkLightObject obj) > itkTernaryAddImageFilterIUS3IUS3IUS3IUS3
def itkTernaryAddImageFilterIUS3IUS3IUS3IUS3_cast(*args): return _itkTernaryAddImageFilterPython.itkTernaryAddImageFilterIUS3IUS3IUS3IUS3_cast(*args)
[ "def itkHuangThresholdImageFilterIUS3IUS3_cast(obj: 'itkLightObject') -> \"itkHuangThresholdImageFilterIUS3IUS3 *\":\n return _itkHuangThresholdImageFilterPython.itkHuangThresholdImageFilterIUS3IUS3_cast(obj)", "def itkHuangThresholdImageFilterIF3IUS3_cast(obj: 'itkLightObject') -> \"itkHuangThresholdImageFilt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compute the aperture radius necessary to have a certain SPAXEL SCALE [in mas] at a certain WAVELENGTH [in microns] That would be the aperture radius in an array ranging from [1, 1] in physical length For example, if rho = 0.5, then the necessary aperture is a circle of half the size of the array We can use the inverse of that to get the "oversize" in physical units in our arrays to match a given scale
def rho_spaxel_scale(spaxel_scale=4.0, wavelength=1.0): scale_rad = spaxel_scale / MILIARCSECS_IN_A_RAD rho = scale_rad * ELT_DIAM / (wavelength * 1e-6) return rho
[ "def rho_spaxel_scale(spaxel_scale=4.0, wavelength=1.5):\n\n scale_rad = spaxel_scale / MILIARCSECS_IN_A_RAD\n rho = scale_rad * ELT_DIAM / (wavelength * 1e-6)\n return rho", "def bound_spectral_radius(arr, bound=1.2):\n spectral_radius = abs(np.linalg.eigvals(ma.assert_numpy(arr))).max()\n arr[......
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks the spaxel scale at a certain wavelength, for a given aperture radius defined for a [1, 1] physical array
def check_spaxel_scale(rho_aper, wavelength): SPAXEL_RAD = rho_aper * wavelength / ELT_DIAM * 1e-6 SPAXEL_MAS = SPAXEL_RAD * MILIARCSECS_IN_A_RAD print('%.2f mas spaxels at %.2f microns' %(SPAXEL_MAS, wavelength))
[ "def bound_spectral_radius(arr, bound=1.2):\n spectral_radius = abs(np.linalg.eigvals(ma.assert_numpy(arr))).max()\n arr[...] *= bound / spectral_radius", "def rho_spaxel_scale(spaxel_scale=4.0, wavelength=1.5):\n\n scale_rad = spaxel_scale / MILIARCSECS_IN_A_RAD\n rho = scale_rad * ELT_DIAM / (wavele...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a Dictionary for the triangular numbers associated with the Zernike pyramid
def triangular_numbers(N_levels): zernike_rows = list(np.arange(1, N_levels + 1)) triangular = {} for i, zernike_per_row in enumerate(zernike_rows): total = np.sum(zernike_rows[:i+1]) triangular[zernike_per_row] = total return triangular
[ "def _get_tri_dict(self):\n tri_dict = dict(\n vertices=np.concatenate([self.contour.vertices] + [hole.vertices for hole in self.holes]),\n segments=list(self._segment_pairs())\n )\n if self.holes:\n tri_dict['holes'] = np.array([hole.interior_point for hole in ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Computes the (Xc, Yc) coordinates of actuator centres inside a circle of rho_aper, assuming there are N_actuators along the [1, 1] line
def actuator_centres(N_actuators, rho_aper=RHO_APER, rho_obsc=RHO_OBSC): x0 = np.linspace(-1., 1., N_actuators, endpoint=True) delta = x0[1] - x0[0] N_in_D = 2*RHO_APER/delta print('%.2f actuators in D' %N_in_D) max_freq = N_in_D / 2 # Max spatial frequency we can sense xx, yy = np.meshgrid(x0, x0) x_f = xx.flatten() y_f = yy.flatten() act = [] for x_c, y_c in zip(x_f, y_f): r = np.sqrt(x_c ** 2 + y_c ** 2) if r < 0.97 * rho_aper and r > 1.05 * rho_obsc: act.append([x_c, y_c]) total_act = len(act) print('Total Actuators: ', total_act) return [act, delta], max_freq
[ "def create_actuator_centres(self, N_actuators, radial=True):\n wave_range = self.slicer_model.wave_range\n wave_ratios = self.slicer_model.waves_ratio\n self.rho_aper = rho_spaxel_scale(self.slicer_model.spaxel_scale, wavelength=wave_range[0])\n self.rho_obsc = CENTRAL_OBS * self.rho_ap...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compute the PEAK of the PSF without aberrations so that we can normalize everything by it
def peak_PSF(self): im, strehl = self.compute_PSF(np.zeros(self.N_act)) return strehl
[ "def generatePSF(self):\n\n PSF = dict()\n # Load atmosphere and instrument PSF \n if self.information['PSF']['total']['method'] == 'compute': \n for keyword in self.information['PSF']:\n if keyword != \"total\":\n if \"file\" not in self.information['PSF'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Plot an image of the PSF
def plot_PSF(self, coef, wave_idx): PSF, strehl = self.compute_PSF(coef, wave_idx) plt.figure() plt.imshow(PSF) plt.title('Strehl: %.3f' %strehl) plt.colorbar() plt.clim(vmin=0, vmax=1)
[ "def plot_prodata_psf(self,font_size=28,img_name='prodata_psf.pdf',img_id=0):\n rawimage = self.raw_image\n dataimage = self.data\n len_mask = self.lens_mask\n plu_mask_out = self.plu_mask\n\n fig, (ax1, ax2, ax3, ax4,ax5) = plt.subplots(1, 5, figsize=(19, 10))\n ax1.imshow...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given an oversampled PSF (typically 0.51.0 mas spaxels), it calculates the Ensquared Energy of the central spaxel in a new_scale (4, 10, 20 mas) It selects a window of size new_scale and adds up the Intensity of those pixels
def ensquared_one_pix(array, pix_scale, new_scale=40, plot=True): n = int(new_scale // pix_scale) minPix, maxPix = (pix + 1 - n) // 2, (pix + 1 + n) // 2 ens = array[minPix:maxPix, minPix:maxPix] # print(ens.shape) energy = np.sum(ens) if plot: mapp = 'viridis' f, (ax1, ax2) = plt.subplots(1, 2) ax1 = plt.subplot(1, 2, 1) square = Rectangle((minPix-0.5, minPix-0.5), n, n, linestyle='--', fill=None, color='white') ax1.add_patch(square) img1 = ax1.imshow(array, cmap=mapp) ax1.set_title('%.1f mas pixels' % (pix_scale)) img1.set_clim(0, 1) plt.colorbar(img1, ax=ax1, orientation='horizontal') ax2 = plt.subplot(1, 2, 2) img2 = ax2.imshow(ens, cmap=mapp) ax2.set_title('%d mas window' %new_scale) img1.set_clim(0, 1) plt.colorbar(img2, ax=ax2, orientation='horizontal') return energy
[ "def superPSFResamplewInterp(subPSFName,xCen,yCen,dE=[0.0,0.0,0.0],subSampFactor=105,useMemory='n',useHeaderKernel=False,star=False):\r\n\r\n print xCen,yCen\r\n\r\n trueSubFactor=subSampFactor/5 ###start with 5x supersampled PSFs!\r\n halfSSF=subSampFactor/2 ###will be rounded. eg. 105/2 = 52\r\n\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update kth(0indexed) value with a
def set_val(self, k, a): k += self.n - 1 self.dat[k] = a while k > 0: k = (k - 1) // 2 # parent self.dat[k] = self.op(self.dat[k * 2 + 1], self.dat[k * 2 + 2])
[ "def update(self, k, x):\n k = self.num + k\n self.tree[k] = x\n while k > 1:\n k = k // 2\n self.tree[k] = self.func(self.tree[k * 2], self.tree[k * 2 + 1])", "def update(self, x: int, k: int) -> None:\n while x <= self.n:\n self.tree[x] += k\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Decodes and yields each game event from the contents byte string.
def decode_replay_game_events(contents): decoder = BitPackedDecoder(contents, typeinfos) for event in _decode_event_stream(decoder, game_eventid_typeid, game_event_types, decode_user_id=True): yield event
[ "def decode_replay_game_events(contents):\r\n decoder = BitPackedDecoder(contents, typeinfos)\r\n for event in _decode_event_stream(decoder,\r\n game_eventid_typeid,\r\n game_event_types,\r\n decode_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Decodes and yields each message event from the contents byte string.
def decode_replay_message_events(contents): decoder = BitPackedDecoder(contents, typeinfos) for event in _decode_event_stream(decoder, message_eventid_typeid, message_event_types, decode_user_id=True): yield event
[ "def decode_replay_message_events(contents):\r\n decoder = BitPackedDecoder(contents, typeinfos)\r\n for event in _decode_event_stream(decoder,\r\n message_eventid_typeid,\r\n message_event_types,\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Decodes and yields each tracker event from the contents byte string.
def decode_replay_tracker_events(contents): decoder = VersionedDecoder(contents, typeinfos) for event in _decode_event_stream(decoder, tracker_eventid_typeid, tracker_event_types, decode_user_id=False): yield event
[ "def decode_replay_tracker_events(contents):\r\n decoder = VersionedDecoder(contents, typeinfos)\r\n for event in _decode_event_stream(decoder,\r\n tracker_eventid_typeid,\r\n tracker_event_types,\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Decodes and return the replay header from the contents byte string.
def decode_replay_header(contents): decoder = VersionedDecoder(contents, typeinfos) return decoder.instance(replay_header_typeid)
[ "def decode_replay_header(contents):\r\n decoder = VersionedDecoder(contents, typeinfos)\r\n return decoder.instance(replay_header_typeid)", "def decode_header(byte_iter):\n try:\n return MMSDecoder.decode_mms_header(byte_iter)\n except wsp_pdu.DecodeError:\n return wsp_p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Decodes and returns the game details from the contents byte string.
def decode_replay_details(contents): decoder = VersionedDecoder(contents, typeinfos) return decoder.instance(game_details_typeid)
[ "def decode_replay_details(contents):\r\n decoder = VersionedDecoder(contents, typeinfos)\r\n return decoder.instance(game_details_typeid)", "def decode_content(raw_content):\n return raw_content", "def decode_replay_header(contents):\r\n decoder = VersionedDecoder(contents, typeinfos)\r\n re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Decodes and return the replay init data from the contents byte string.
def decode_replay_initdata(contents): decoder = BitPackedDecoder(contents, typeinfos) return decoder.instance(replay_initdata_typeid)
[ "def decode_replay_header(contents):\r\n decoder = VersionedDecoder(contents, typeinfos)\r\n return decoder.instance(replay_header_typeid)", "def decode_replay_header(contents):\n decoder = VersionedDecoder(contents, typeinfos)\n return decoder.instance(replay_header_typeid)", "def decode(byte_strin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Decodes and yields each attribute from the contents byte string.
def decode_replay_attributes_events(contents): buffer = BitPackedBuffer(contents, 'little') attributes = {} if not buffer.done(): attributes['source'] = buffer.read_bits(8) attributes['mapNamespace'] = buffer.read_bits(32) count = buffer.read_bits(32) attributes['scopes'] = {} while not buffer.done(): value = {} value['namespace'] = buffer.read_bits(32) value['attrid'] = attrid = buffer.read_bits(32) scope = buffer.read_bits(8) value['value'] = buffer.read_aligned_bytes(4)[::-1].strip(b'\x00') if not scope in attributes['scopes']: attributes['scopes'][scope] = {} if not attrid in attributes['scopes'][scope]: attributes['scopes'][scope][attrid] = [] attributes['scopes'][scope][attrid].append(value) return attributes
[ "def unpack(self, buff, offset=0):\n begin = offset\n for name, value in self.get_class_attributes():\n size = self._unpack_attribute(name, value, buff, begin)\n begin += size", "def decode(self, b):\n # Check what is included in this attributes file\n flags = int...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Computes the squareroot Wiener filter (WF) gain function.
def srwf(xi): return np.sqrt(wienergain(xi)) # SRWF gain function.
[ "def get_filter_gain(b, a, f_gain, fs):\n # Save the passband gain\n w, h = signal.freqz(b, a)\n w_gain = f_gain * 2 * np.pi / fs\n\n ind = np.where(w >= w_gain)[0][0]\n gain = abs(h[ind])\n\n return gain", "def gain(dB):\n return 10.**(dB/10.)", "def A_weighting(fs):\n b, a = A_weighting_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the xpath to user folder link
def get_user_folder_link_xpath(): return links['users_folder'].get('folder_xpath')
[ "def get_enrolment_methods_link_xpath():\n return links['users_folder']['enrolment_link'].get('xpath')", "def get_home_page_link_xpath():\n return links['home_page_link'].get('xpath')", "def _getLDAPUserFolder(self, user):\n return getattr(user.acl_users, self.id)._getLDAPUserFolder()", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the xpath to enrolment methods link
def get_enrolment_methods_link_xpath(): return links['users_folder']['enrolment_link'].get('xpath')
[ "def get_main_courses_link_xpath():\n return links['main_courses_page_link'].get('xpath')", "def clickOnEnrollButton(self):\n self.elementClick(locator=self._enroll_button)", "def functionURI(self):\n ret = libxml2mod.xmlXPathGetFunctionURI(self._o)\n return ret", "def get_xpath_ne...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a custom boolean operator. This method is shorthand for calling
def bool_op( self, opstring: str, precedence: int = 0, python_impl: Optional[Callable[..., Any]] = None, ) -> Callable[[Any], Operators]: return self.op( opstring, precedence=precedence, is_comparison=True, python_impl=python_impl, )
[ "def __bool__(self):\n if self.operator in (operators.eq, operators.ne):\n # this is using the eq/ne operator given int hash values,\n # rather than Operator, so that \"bool\" can be based on\n # identity\n return self.operator(*self._orig) # type: ignore\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Implement the ``<`` operator. In a column context, produces the clause ``a < b``.
def __lt__(self, other: Any) -> ColumnOperators: return self.operate(lt, other)
[ "def __lt__(self, other):\n return self.calculate(lt, other)", "def __lt__(self, other):\n return OPERATOR_MAP[self.value][1] < OPERATOR_MAP[other.value][1]", "def lt(x, y):\n return x < y", "def __lt__(self, other_feature_or_val):\n from featuretools.primitives import LessThan\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Implement the ``==`` operator. In a column context, produces the clause ``a = b``. If the target is ``None``, produces ``a IS NULL``.
def __eq__(self, other: Any) -> ColumnOperators: # type: ignore[override] return self.operate(eq, other)
[ "def sql_equals(self):\n return getattr(self.manager.modelclass, self.manager.column) == self.value", "def equals(field: str, value: Any) -> Expression:\n return Expression(_criterion(field, \"equals\", value))", "def __eq__(self, rhs):\n return _table.Connection___eq__(self, rhs)", "def _eq(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Implement the ``IS DISTINCT FROM`` operator. Renders "a IS DISTINCT FROM b" on most platforms; on some such as SQLite may render "a IS NOT b".
def is_distinct_from(self, other: Any) -> ColumnOperators: return self.operate(is_distinct_from, other)
[ "def is_not_distinct_from(self, other: Any) -> ColumnOperators:\n return self.operate(is_not_distinct_from, other)", "def test_distinct(self):\n self.assertEquals(\n Select(\n [self.schema.FOO.BAR],\n From=self.schema.FOO,\n Distinct=True\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Implement the ``IS NOT DISTINCT FROM`` operator. Renders "a IS NOT DISTINCT FROM b" on most platforms; on some such as SQLite may render "a IS b".
def is_not_distinct_from(self, other: Any) -> ColumnOperators: return self.operate(is_not_distinct_from, other)
[ "def is_distinct_from(self, other: Any) -> ColumnOperators:\n return self.operate(is_distinct_from, other)", "def is_distinct(value, *args):\n return value not in args", "def __invert__(self):\n return NotAny(self)", "def test_distinct(self):\n self.assertEquals(\n Select(\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Implement the ``>`` operator. In a column context, produces the clause ``a > b``.
def __gt__(self, other: Any) -> ColumnOperators: return self.operate(gt, other)
[ "def __lt__(self, other: Any) -> ColumnOperators:\n return self.operate(lt, other)", "def test_greater_than(self):\n utils.compare_tracing_methods(\n SimpleCompareOpsModule(\"greaterThan\"),\n torch.randn(3, 4, 5),\n torch.randn(3, 4, 5),\n fusible_ops={\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
implement the >> operator. Not used by SQLAlchemy core, this is provided for custom operator systems which want to use >> as an extension point.
def __rshift__(self, other: Any) -> ColumnOperators: return self.operate(rshift, other)
[ "def __rshift__(self, other):\n other.set_upstream(self)\n # return other so a >> b >> c works\n return other", "def __rshift__(self, monadic):\n if not callable(monadic):\n return NotImplemented\n # pylint: disable = star-args\n composed = lambda *args, **kwar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Implement the 'concat' operator. In a column context, produces the clause ``a || b``, or uses the ``concat()`` operator on MySQL.
def concat(self, other: Any) -> ColumnOperators: return self.operate(concat_op, other)
[ "def _rconcat(self, other: Any) -> ColumnOperators:\n return self.reverse_operate(concat_op, other)", "def concatpair(self, compiler, connection, **extra_context):\n # Spanner's CONCAT function returns null if any of its arguments are null.\n # Prevent that by converting null arguments to an empty st...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Implement an 'rconcat' operator. this is for internal use at the moment
def _rconcat(self, other: Any) -> ColumnOperators: return self.reverse_operate(concat_op, other)
[ "def __radd__(self, left_arr):\n concat_arr = left_arr.copy() # Create new instance to return\n concat_arr.extend(self)\n return concat_arr", "def concat(self, other: Any) -> ColumnOperators:\n return self.operate(concat_op, other)", "def concatenate_data():", "def _concat(self, o...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
r"""Implement the ``like`` operator.
def like( self, other: Any, escape: Optional[str] = None ) -> ColumnOperators: return self.operate(like_op, other, escape=escape)
[ "def _checkNotLike(match):\n if match.group(\"op\").upper() == \"LIKE\":\n raise RuntimeError(\"comparisons using LIKE are not supported\")", "def postfix(cls, __and=True, __key=None, **kwargs):\r\n return _queries(\"LIKE\", __key, __and, [(k, f\"%{_escape_like(v)}\") for k, v in kwargs.items()])...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Produce a bitwise XOR operation, typically via the ``^`` operator, or ```` for PostgreSQL.
def bitwise_xor(self, other: Any) -> ColumnOperators: return self.operate(bitwise_xor_op, other)
[ "def bitwise_xor(self, other):\n return math_funcs.bitwise_xor(self, other)", "def xor(a, b):", "def my_xor(x, y):\r\n return (x | y) & (~x | ~y)", "def logical_xor(a, b):\n return bool(a) ^ bool(b)", "def lc_xor(*args):\n return ''.join([chr(byte) for byte in [ reduce(lambda x,y: x^y, items) fo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Produce a bitwise NOT operation, typically via the ``~`` operator.
def bitwise_not(self) -> ColumnOperators: return self.operate(bitwise_not_op)
[ "def bitwise_not_(self):\n return math_funcs.bitwise_not(self, self)", "def bitwise_not(data):\n return _make.bitwise_not(data)", "def bitwise_not(x, out=None, **kwargs):\n return _unary_func_helper(x, _npi.bitwise_not, _np.bitwise_not, out=out, **kwargs)", "def logical_not(data):\n return _make.l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Produce a bitwise LSHIFT operation, typically via the ``<<`` operator.
def bitwise_lshift(self, other: Any) -> ColumnOperators: return self.operate(bitwise_lshift_op, other)
[ "def lshift(self, value):\n return self.clone().lshift_(value)", "def __lshift__(self, other):\r\n # TODO: extend to secret offset\r\n if not isinstance(other, int):\r\n return NotImplemented\r\n\r\n return runtime.mul(self, 1<<other)", "def __rlshift__(self, *args):\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Produce a bitwise RSHIFT operation, typically via the ``>>`` operator.
def bitwise_rshift(self, other: Any) -> ColumnOperators: return self.operate(bitwise_rshift_op, other)
[ "def right_shift(lhs, rhs):\n return _make.right_shift(lhs, rhs)", "def __rshift__(self, other: Any) -> ColumnOperators:\n return self.operate(rshift, other)", "def rshift(self, value):\n return self.clone().rshift_(value)", "def right_shift(key,shift):\n if shift > len(key):\n shif...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
implement the ``NOT IN`` operator. This is equivalent to using negation with
def not_in(self, other: Any) -> ColumnOperators: return self.operate(not_in_op, other)
[ "def notIn(self, value):\n newq = self.copy()\n newq.setOp(Query.Op.IsNotIn)\n\n if isinstance(value, orb.Collection):\n newq.setValue(value)\n elif not isinstance(value, (set, list, tuple)):\n newq.setValue((value,))\n else:\n newq.setValue(tuple(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
implement the ``NOT LIKE`` operator. This is equivalent to using negation with
def not_like( self, other: Any, escape: Optional[str] = None ) -> ColumnOperators: return self.operate(not_like_op, other, escape=escape)
[ "def _checkNotLike(match):\n if match.group(\"op\").upper() == \"LIKE\":\n raise RuntimeError(\"comparisons using LIKE are not supported\")", "def test_searchNot(self):\n return self._messageSetSearchTest('NOT 3', [1, 2, 4, 5])", "def not_ilike(\n self, other: Any, escape: Optional[str] ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
implement the ``NOT ILIKE`` operator. This is equivalent to using negation with
def not_ilike( self, other: Any, escape: Optional[str] = None ) -> ColumnOperators: return self.operate(not_ilike_op, other, escape=escape)
[ "def not_like(\n self, other: Any, escape: Optional[str] = None\n ) -> ColumnOperators:\n return self.operate(not_like_op, other, escape=escape)", "def _checkNotLike(match):\n if match.group(\"op\").upper() == \"LIKE\":\n raise RuntimeError(\"comparisons using LIKE are not supported\")"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Implements a databasespecific 'match' operator.
def match(self, other: Any, **kwargs: Any) -> ColumnOperators: return self.operate(match_op, other, **kwargs)
[ "def _query_one(self, session: Session, match_value: str, match_key: str = None) -> SqlAlchemyBase:\n if match_key is None:\n match_key = self.primary_key\n\n return session.query(self.sql_model).filter_by(**{match_key: match_value}).one()", "def testSearchWithMatchesAndQuestionMarkWildca...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Implements a databasespecific 'regexp match' operator.
def regexp_match( self, pattern: Any, flags: Optional[str] = None ) -> ColumnOperators: return self.operate(regexp_match_op, pattern, flags=flags)
[ "def _regex_operation(self, left, right):\n if self.dialect == 'mysql':\n return literal(left).op('REGEXP', is_comparison=True)(right)\n elif self.dialect == 'postgresql':\n return literal(left).op('~', is_comparison=True)(right)\n elif self.dialect == 'oracle':\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Implements a databasespecific 'regexp replace' operator.
def regexp_replace( self, pattern: Any, replacement: Any, flags: Optional[str] = None ) -> ColumnOperators: return self.operate( regexp_replace_op, pattern, replacement=replacement, flags=flags, )
[ "def replace_regex(self, args):\n bound_char = args[0]\n pattern = args.split(bound_char)\n if len(pattern) != 4:\n print \"ERROR, format is: !reg /REGEX/REPLACE/ and / can be any char.\"\n else:\n reg, rep = pattern[1], pattern[2]\n regex = re.compile(re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Implement the ``+`` operator. In a column context, produces the clause ``a + b`` if the parent object has nonstring affinity. If the parent object has a string affinity, produces the concatenation operator, ``a || b``
def __add__(self, other: Any) -> ColumnOperators: return self.operate(add, other)
[ "def concat(self, other: Any) -> ColumnOperators:\n return self.operate(concat_op, other)", "def __add__(self, o):\n if isinstance(o, str):\n o = LiteralString(o)\n if not isinstance(o, (LiteralString, CMacro, CStringExpression)):\n raise TypeError(f\"unsupported operand...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Implement the ``%`` operator. In a column context, produces the clause ``a % b``.
def __mod__(self, other: Any) -> ColumnOperators: return self.operate(mod, other)
[ "def mod(a,b) :\n return a%b", "def mod(x, y):\n\n return x % y", "def __floordiv__(self, other: Any) -> ColumnOperators:\n return self.operate(floordiv, other)", "def percent(a, b):\n if a is None:\n return '0.00%'\n else:\n return '%0.2f%%' % (100.0 * a / b)", "def mydivmo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Implement the ``//`` operator. In a column context, produces the clause ``a / b``, which is the same as "truediv", but considers the result type to be integer.
def __floordiv__(self, other: Any) -> ColumnOperators: return self.operate(floordiv, other)
[ "def exquo(self, a, b):\n return a / b", "def divu(arg1, arg2):\n R_LO = ExprOp('udiv', arg1, arg2)\n R_HI = ExprOp('umod', arg1, arg2)", "def convert_div_scalar(node, **kwargs):\n return scalar_op_helper(node, 'Div', **kwargs)", "def division(operand1, operand2):\n return operand1/operand2...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Verifies the bot by solving the website's captcha
def solve_captcha(self): # Switch to the Captcha's iframe captcha = CapatchaSolver(self.driver) while True: self.driver.switch_to.frame(self.driver.find_element_by_tag_name("iframe")) captcha.solve_captcha() # Check if we passed the captcha part by checking the page title wait = WebDriverWait(self.driver, 10) try: wait.until_not(EC.title_is(consts.BLOCKED)) break except TimeoutException: self.driver.refresh()
[ "def funcbot():\n msg.askyesno(\"Captcha\", \"Are you human\")", "def test_bad_captcha(self):\r\n self.F.UserFactory.create(username=\"test\", password=\"sekrit\")\r\n\r\n session_data = {}\r\n\r\n with patch_session(session_data):\r\n res = self.get()\r\n for i in ra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Obtains a generic title for a review for a product
def get_review_title(self, language): comment_generator = CommentGenerator(language) return comment_generator.generateTitle()
[ "def _getReviewTitle(self):\n try:\n return re.search('reviewLink\">\"(.+?)\"</a>', self.reviewHTML).group(1)\n except:\n return ''", "def review_restaurant_name(review):\n return review[0]", "def get_product_title(product_page_object):\n return product_page_object.find...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Leaves a review in a product page
def leave_review(self, product_url, review, review_title): raise NotImplementedError
[ "def delete_prod_review(request, pk):\n review = get_object_or_404(ProductReview, pk=pk)\n product = review.product_id\n if review.user == request.user:\n review.delete()\n sweetify.success(\n request,\n \"Review deleted\",\n icon='success',\n timer...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Wait for the current page to change
def wait_for_page_change(self, current_page): WebDriverWait(self.driver, 5).until(EC.url_changes(current_page))
[ "def wati_until_page_change(driver, url):\n while driver.current_url == url:\n time.sleep(10)", "def wait_until_lemonade_insurance_page_displayed(self):", "def wait_for_page_load(self):\n old_page = self.browser.find_element_by_tag_name('html')\n yield\n WebDriverWait(self.browser...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Verify the mail sent to the mail service
def verify_mail(self): raise NotImplementedError
[ "def test_send_mail(self):\n response = self.client.post(reverse('contact-form'), self.valid_data, follow=True)\n self.assertEqual(response.status_code, 200)\n self.assertEqual(len(mail.outbox), 1)\n self.assertEqual(mail.outbox[0].subject, self.valid_data['subject'])\n self.asser...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a list of the positions of all locations that meet the target_func criteria
def get_x_in_range(self, start, target_func, max_distance, sort_func=None): if sort_func is None: targets = [] for x in range(-max_distance, max_distance + 1): for y in range(-max_distance, max_distance + 1): distance = abs(x) + abs(y) if distance > max_distance: continue pos = Position(start.x + x, start.y + y) if target_func(pos, distance): targets.append(pos) return targets else: targets = PriorityQueue() for x in range(-max_distance, max_distance + 1): for y in range(-max_distance, max_distance + 1): distance = abs(x) + abs(y) if distance > max_distance: continue pos = Position(start.x + x, start.y + y) if target_func(pos, distance): targets.enqueue(sort_func(pos, distance), pos) return targets.to_list()
[ "def locate_target(grid, target):\n\n grid_size = len(grid)\n return [(r, c)\n for r in range(grid_size)\n for c in range(grid_size)\n if grid[r][c] == target]", "def _inter_pos_list(obs, target):\r\n pos_list = [0]\r\n if len(obs) != 0:\r\n pos_list = [i for i,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Decorator to modify the docstring of an object. For all provided strings, unused empty lines are removed, and the indentation of the first nonempty line is removed from all lines if possible. This allows better indentation when used as a decorator. Unused empty lines means initial enpty lines for ``pre``, and final empty lines for ``post``.
def docstring( docstring: str = None, *, pre: str = None, post: str = None ) -> Callable[[U], U]: def edit_docstring(obj: U) -> U: obj.__doc__ = "".join( ( clean_docstring(pre or "", unused="pre"), clean_docstring(docstring or (obj.__doc__ or "")), clean_docstring(post or "", unused="post"), ) ) return obj return edit_docstring
[ "def docstring(obj: Any):\n obj_doc = obj.__doc__\n if obj_doc:\n docs = []\n indent, obj_doc = dedent_docs(obj_doc)\n for section, lines in doc_sections(obj_doc):\n section_lines = docstring_section(obj, section, lines, indent)\n if section.lower() == 'parameters':\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Class decorator to autoformat string arguments in the __init__ method Modify the class __init__ method in place by wrapping it. The wrapped class will call the format() method of arguments specified in `params` that exist in the original signature, passing all other arguments are dictionary to str.format()
def autoformat( cls: Type[U] = None, /, params: Union[str, Iterable[str]] = ( # pylint: disable=unsubscriptable-object "message", "msg", ), ): if isinstance(params, str): params = (params,) if cls is None: return functools.partial(autoformat, params=params) orig_init = cls.__init__ signature = inspect.signature(orig_init) params = signature.parameters.keys() & set(params) @functools.wraps(orig_init) def init(*args, **kwargs): bounds = signature.bind(*args, **kwargs) bounds.apply_defaults() pre_formatted = { name: bounds.arguments.pop(name) for name in params if name in bounds.arguments } formatted = { name: string.format(**bounds.arguments) for name, string in pre_formatted.items() } for name, arg in formatted.items(): bounds.arguments[name] = arg return orig_init(*bounds.args, **bounds.kwargs) # init.__signature__ = signature setattr(cls, "__init__", init) return cls
[ "def format(self, *args, **kwargs) -> String:\n pass", "def format(*args, **kwargs):\n\n pass", "def create_initstring(classname, base, method, excludes):\n from inspect import getargspec\n\n # creates line: def __init__(self, ...):\n # keywords are deduced from arguments with defaults.\n # others wi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes a parameter from a Signature object If param is an int, remove the parameter at that position, else remove any paramater with that name
def _sig_without(sig: inspect.Signature, param: Union[int, str]) -> inspect.Signature: if isinstance(param, int): params = list(sig.parameters.values()) params.pop(param) else: params = [p for name, p in sig.parameters.items() if name != param] return sig.replace(parameters=params)
[ "def remove(self, param):\n if param in self.params:\n self.params.remove(param)\n if param in self.Parser.params:\n self.Parser.params.remove(param)", "def removeParameter(self, *args):\n return _libsbml.KineticLaw_removeParameter(self, *args)", "def param_remove(para...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Merges two signature object, dropping the return annotations
def _sig_merge(lsig: inspect.Signature, rsig: inspect.Signature) -> inspect.Signature: return inspect.Signature( sorted( list(lsig.parameters.values()) + list(rsig.parameters.values()), key=lambda param: param.kind, ) )
[ "def ir_merge(target, other):\n if not target[\"params\"]:\n target[\"params\"] = other[\"params\"]\n elif other[\"params\"]:\n target_params, other_params = map(itemgetter(\"params\"), (target, other))\n\n for name in other_params.keys() & target_params.keys():\n if not target...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Class decorator to automatically support __post_init__() on classes This is useful for .s decorated classes, because __attr_post_init__() doesn't support additional arguments. This decorators wraps the class __init__ in a new function that accept merged arguments, and dispatch them to __init__ and then __post_init__()
def post_init(cls: Type[U]) -> Type[U]: if not isinstance(cls, type): raise TypeError("Can only decorate classes") if not hasattr(cls, "__post_init__"): raise TypeError("The class must have a __post_init__() method") # Ignore the first argument which is the "self" argument sig = init_sig = _sig_without(inspect.signature(cls.__init__), 0) previous = [(cls, "__init__", sig)] for parent in reversed(cls.__mro__): if hasattr(parent, "__post_init__"): post_sig = _sig_without( inspect.signature(getattr(parent, "__post_init__")), 0 ) try: sig = _sig_merge(sig, post_sig) except Exception as err: # find the incompatibility for parent, method, psig in previous: try: _sig_merge(psig, post_sig) except Exception: break else: raise TypeError( "__post_init__ signature is incompatible with the class" ) from err raise TypeError( f"__post_init__() is incompatible with {parent.__qualname__}{method}()" ) from err # No exception previous.append((parent, "__post_init__", post_sig)) # handles type annotations and defaults # inspired by the dataclasses modules params = list(sig.parameters.values()) localns = ( { f"__type_{p.name}": p.annotation for p in params if p.annotation is not inspect.Parameter.empty } | { f"__default_{p.name}": p.default for p in params if p.default is not inspect.Parameter.empty } | cls.__dict__ ) for i, p in enumerate(params): if p.default is not inspect.Parameter.empty: p = p.replace(default=Variable(f"__default_{p.name}")) if p.annotation is not inspect.Parameter.empty: p = p.replace(annotation=f"__type_{p.name}") params[i] = p new_sig = inspect.Signature(params) # Build the new __init__ source code self_ = "self" if "self" not in sig.parameters else "__post_init_self" init_lines = [ f"def __init__({self_}, {_sig_to_def(new_sig)}) -> None:", f"__original_init({self_}, {_sig_to_call(init_sig)})", ] for parent, method, psig in previous[1:]: if hasattr(parent, "__post_init__"): if parent is not cls: init_lines.append( f"super({parent.__qualname__}, {self_}).{method}({_sig_to_call(psig)})" ) else: init_lines.append(f"{self_}.{method}({_sig_to_call(psig)})") init_src = "\n ".join(init_lines) # Build the factory function source code local_vars = ", ".join(localns.keys()) factory_src = ( f"def __make_init__(__original_init, {local_vars}):\n" f" {init_src}\n" " return __init__" ) # Create new __init__ with the factory globalns = inspect.getmodule(cls).__dict__ ns: dict[str, Any] = {} exec(factory_src, globalns, ns) init = ns["__make_init__"](cls.__init__, **localns) self_param = inspect.Parameter(self_, inspect.Parameter.POSITIONAL_ONLY) init.__signature__ = inspect.Signature( parameters=[self_param] + list(sig.parameters.values()), return_annotation=None ) setattr(cls, "__init__", init) return cls
[ "def __init_subclass__(cls, **kwargs):\n if cls.__init__ != object.__init__:\n old_init = cls.__init__\n\n def new_init(self, *args, **kwargs):\n _cls = type(self)\n if getattr(_cls, _mangle(_cls, \"initialized\")) is not True:\n old_init...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
split an iterable based on the truth value of the function for element Arguments func a callable to apply to each element in the iterable iterable an iterable of element to split Returns falsy, truthy two tuple, the first with element e of the itrable where func(e) return false, the second with element of the iterable that are True
def split(func, iterable): falsy, truthy = [], [] for e in iterable: if func(e): truthy.append(e) else: falsy.append(e) return tuple(falsy), tuple(truthy)
[ "def split_data(iterable, pred):\n yes, no = [], []\n for d in iterable:\n if pred(d):\n yes.append(d)\n else:\n no.append(d)\n return yes, no", "def split_on(\n predicate: Callable[[Any], bool], sequence: Sequence\n) -> (list, list):\n return (\n list(fil...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Filter multiple iterable at once, selecting values at index i such that func(iterables[0][i], iterables[1][i], ...) is True
def sync_filter(func, *iterables): return tuple(zip(*tuple(i for i in zip(*iterables) if func(*i)))) or ((),) * len( iterables )
[ "def chain_filter(it: Iterable, *filters: Callable) -> Iterator:\n for f in filters:\n it = filter(f, it)\n return it", "def filter(function, iterable):\n\n if function is bool:\n return [x for x in iterable if x]\n\n return [x for x in iterable if function(x)]", "def filter(function: ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
report a runtime error
def runtime_error(self, error: 'LoxRuntimeError'): output = f'{error.get_message()}{os.linesep}[line {error.token.line}]' print(output, file=sys.stderr) self.had_runtime_error = False
[ "def test_re_raise_runtime_error(self, _mock_pipeline, MockTrial): # noqa: N803\n self._test_re_raise(MockTrial=MockTrial, exception=RuntimeError)", "def reportError(self):\n self.Q['err'].put(sys.exc_info()[:2])", "def serious_error(self, e):\n pass", "def func():\n raise Runti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Note, SMTPTimeoutError vs SMTPConnectError here depends on processing time.
async def test_timeout_error_with_no_server(event_loop): client = SMTP(hostname="127.0.0.1", port=65534, loop=event_loop) with pytest.raises(SMTPTimeoutError): await client.connect(timeout=0.000000001)
[ "def send_mail(self, mail_to, mail_subject, mail_body, retries=3, sleep_time=5):\n for i in xrange(retries):\n try:\n self._send_mail(mail_to, mail_subject, mail_body)\n log_info('Successful send mail from %s to %s (Subject: %s) at %i try.' % (self.sender, mail_to, ma...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Классифицирует условия для INNER_JOIN
def basis_classifier_inner_join(self, join_left_tables, join_right_tables): join_left_tables = set(join_left_tables) join_right_tables = set(join_right_tables) join_expr_equals = [] for i, (basis, (flag, new_basis), columns) in enumerate(zip( self.base_expressions, self.equivalent_basis, self.used_columns )): left_columns, right_columns = columns if isinstance(basis, expr.ComparisonPredicate): assert left_columns or right_columns left_table = { column.table for column in left_columns } right_table = { column.table for column in right_columns } wrong_tables = (left_table | right_table) - (join_left_tables | join_right_tables) if wrong_tables: Select.logger.error( 'The tables (%s) is not included in the join', ', '.join(sorted( '.'.join(*table.full_name()) for table in wrong_tables )) ) continue if left_table <= join_right_tables and right_table <= join_left_tables: # Приведение к виду, где левая часть предиката # соответствует левой таблице, а правая часть # соответствует правой таблице basis.reverse() left_table, right_table = right_table, left_table left_columns, right_columns = right_columns, left_columns if len(left_table) == 1 and len(right_table) == 1: left_table = left_table.pop() right_table = right_table.pop() if left_table == right_table: # Условие на одну таблицу if new_basis: left_table.filters.append(new_basis) self.not_used_expression.append(i) for column in left_columns + right_columns: column.count_used -= 1 elif ( left_table in join_left_tables and right_table in join_right_tables and isinstance(basis.left, st.Column) and isinstance(basis.right, st.Column) ): # left.column = right.column if i in self.all_true and basis.op == ss.equals_operator: # (a.id = b.id) is True join_expr_equals.append((basis.left, basis.right)) elif i in self.all_false and basis.op == ss.not_equals_operator: # (a.id != b.id) is False join_expr_equals.append((basis.left, basis.right)) else: continue self.not_used_expression.append(i) elif len(left_table) == 1 and len(right_table) == 0: # tbl.column <= 10 table = left_table.pop() if new_basis: table.filters.append(new_basis) self.not_used_expression.append(i) for column in left_columns: column.count_used -= 1 elif len(left_table) == 0 and len(right_table) == 1: # tbl.column <= 10 table = right_table.pop() if new_basis: table.filters.append(new_basis) self.not_used_expression.append(i) for column in right_columns: column.count_used -= 1 continue else: assert len(left_columns) table = { column.table for column in left_columns } if len(table) == 1: table = table.pop() if new_basis: table.filters.append(new_basis) self.not_used_expression.append(i) for column in left_columns: column.count_used -= 1 self.join_expr_equals = join_expr_equals return join_expr_equals
[ "def inner_join(\n cls,\n other: type[Selectable],\n on: Union[OnClause, Iterable[BaseColumn]],\n ) -> type[Join]:\n return cls._join(other, \"INNER\", on)", "def InnerJoin(self, table, *args):\n return self.Join(table, \"INNER\", *args)", "def join(self, table, *conditions...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Классифицирует условия для RIGHT_JOIN
def basis_classifier_right_join(self, join_left_tables, join_right_tables): join_left_tables = set(join_left_tables) join_right_tables = set(join_right_tables) join_expr_equals = [] for i, (basis, (flag, new_basis), columns) in enumerate(zip( self.base_expressions, self.equivalent_basis, self.used_columns )): left_columns, right_columns = columns if isinstance(basis, expr.ComparisonPredicate): assert left_columns or right_columns left_table = { column.table for column in left_columns } right_table = { column.table for column in right_columns } wrong_tables = (left_table | right_table) - (join_left_tables | join_right_tables) if wrong_tables: Select.logger.error( 'The tables (%s) is not included in the join', ', '.join(sorted( '.'.join(*table.full_name()) for table in wrong_tables )) ) continue if left_table <= join_right_tables and right_table <= join_left_tables: # Приведение к виду, где левая часть предиката # соответствует левой таблице, а правая часть # соответствует правой таблице basis.reverse() left_table, right_table = right_table, left_table left_columns, right_columns = right_columns, left_columns if len(left_table) == 1 and len(right_table) == 1: left_table = left_table.pop() right_table = right_table.pop() if left_table == right_table and {right_table} <= join_left_tables: # Условие на одну таблицу if new_basis: left_table.filters.append(new_basis) self.not_used_expression.append(i) for column in left_columns + right_columns: column.count_used -= 1 elif ( left_table in join_left_tables and right_table in join_right_tables and isinstance(basis.left, st.Column) and isinstance(basis.right, st.Column) ): # left.column = right.column if i in self.all_true and basis.op == ss.equals_operator: # (a.id = b.id) is True join_expr_equals.append((basis.left, basis.right)) elif i in self.all_false and basis.op == ss.not_equals_operator: # (a.id != b.id) is False join_expr_equals.append((basis.left, basis.right)) else: continue self.not_used_expression.append(i) elif len(left_table) == 1 and len(right_table) == 0 and left_table <= join_left_tables: table = left_table.pop() if new_basis: table.filters.append(new_basis) self.not_used_expression.append(i) for column in left_columns: column.count_used -= 1 continue else: assert len(left_columns) table = { column.table for column in left_columns } if len(table) == 1 and table <= join_left_tables: table = table.pop() if new_basis: table.filters.append(new_basis) self.not_used_expression.append(i) for column in left_columns: column.count_used -= 1 self.join_expr_equals = join_expr_equals return join_expr_equals
[ "def right_join(self, table, *conditions):\n self.join_by_type(\"RIGHT\", table, *conditions)", "def RightJoin(self, table, *args):\n return self.Join(table, \"RIGHT OUTER\", *args)", "def right_join_where(self, table, one, operator, two):\n return self.join_where(table, one, operator, two,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Классифицирует условия для FULL_JOIN
def basis_classifier_full_join(self, join_left_tables, join_right_tables): return []
[ "def full_join(self, table, *conditions):\n self.join_by_type(\"FULL\", table, *conditions)", "def full_outer_join(\n cls,\n other: type[Selectable],\n on: Union[OnClause, Iterable[BaseColumn]],\n ) -> type[Join]:\n return cls._join(other, \"FULL OUTER\", on)", "def basis_c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Register the device with the provisioning service. This is a synchronous call, meaning that this function will not return until the registration process has completed successfully or the attempt has resulted in a failure. Before returning the client will also disconnect from the Hub. If a registration attempt is made while a previous registration is in progress it may throw an error.
def register(self): logger.info("Registering with Hub...") register_complete = Event() def on_register_complete(result=None, error=None): # This could be a failed/successful registration result from the HUB # or a error from polling machine. Response should be given appropriately if result is not None: if result.status == "assigned": logger.info("Successfully registered with Hub") else: # There be other statuses logger.error("Failed registering with Hub") if error is not None: # This can only happen when the polling machine runs into error logger.info(error) register_complete.set() self._polling_machine.register(callback=on_register_complete) register_complete.wait()
[ "def register_device():\n payload = request.get_json()\n return _register_device(payload)", "def RegisterDeviceAndSendResponse(self, msg, username):\n device_id = self.GetUniqueParam('deviceid')\n if not device_id:\n return (400, 'Missing device identifier')\n\n token_info = self.server.Regist...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a synchronous call, meaning that this function will not return until the cancellation process has completed successfully or the attempt has resulted in a failure. Before returning the client will also disconnect from the Hub. In case there is no registration in process it will throw an error as there is no registration process to cancel.
def cancel(self): logger.info("Cancelling the current registration process") cancel_complete = Event() def on_cancel_complete(): cancel_complete.set() logger.info("Successfully cancelled the current registration process") self._polling_machine.cancel(callback=on_cancel_complete) cancel_complete.wait()
[ "def disconnect(self):\n if self.is_connected:\n try:\n self.client.unregister()\n finally:\n if self.client.is_running:\n self.client.stop()\n self.hub.disconnect()", "async def async_cancel(self):\n raise NotImpl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ask a yes/no/quit question via raw_input() and return their answer. "question" is a string that is presented to the user. "default" is the presumed answer if the user just hits . It must be "yes" (the default), "no", "quit" or None (meaning an answer is required of the user). The "answer" return value is one of "yes", "no" or "quit".
def query_yes_no_quit(question, default="yes"): valid = {"yes":"yes", "y":"yes", "ye":"yes", "no":"no", "n":"no", "quit":"quit", "qui":"quit", "qu":"quit", "q":"quit"} if default == None: prompt = " [y/n/q] " elif default == "yes": prompt = " [Y/n/q] " elif default == "no": prompt = " [y/N/q] " elif default == "quit": prompt = " [y/n/Q] " else: raise ValueError("invalid default answer: '%s'" % default) while 1: sys.stdout.write(question + prompt) choice = raw_input().lower() if default is not None and choice == '': return default elif choice in valid.keys(): return valid[choice] else: sys.stdout.write("Please respond with 'yes', 'no' or 'quit'.\n")
[ "def query_yes_no_quit(question, default=\"yes\"):\n valid = {\"yes\":\"yes\", \"y\":\"yes\", \"ye\":\"yes\",\n \"no\":\"no\", \"n\":\"no\",\n \"quit\":\"quit\", \"qui\":\"quit\", \"qu\":\"quit\", \"q\":\"quit\"}\n if default == None:\n prompt = \" [y/n/q] \"\n elif ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compute the mean absolute error on test set given X, y, and model parameter w.
def mean_absolute_error(w, X, y): ##################################################### # TODO 1: Fill in your code here # ##################################################### err = None temp = np.dot(X, w) err = np.mean(np.abs(_error(y, temp))) return err
[ "def mean_absolute_error(w, X, y):\n #####################################################\n # TODO 1: Fill in your code here #\n #####################################################\n N = len(X)\n err = np.sum(abs(np.dot(w,X.T) - y))\n err = err / N\n return err", "def mean_absolute_error(w...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Iterate over modes. Synchronized iterator to iterate the modes in an order.
def modes(self): try: order = self._current_order except AttributeError: raise AttributeError('Cannot iterate over modes without iterating over orders!') from None mode = -order while mode <= order: yield mode mode += 1
[ "def use_modes(self, modes):\n if isinstance(modes, (str, Mode)):\n modes = [modes]\n old_modes = self.active_modes\n try:\n self.active_modes = modes\n yield\n finally:\n self.active_modes = old_modes", "def get_modes(self):\n return ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
r"""Find the approximate location of a levitation trap. Find an approximate position of a acoustic levitation trap close to a starting point. This is done by following the radiation force in the sound field using an differential equation solver. The differential equation is the unphysical equation
def find_trap(array, start_position, complex_transducer_amplitudes, tolerance=10e-6, time_interval=50, path_points=1, **kwargs): from scipy.integrate import solve_ivp from numpy.linalg import lstsq if 'radius' in kwargs: from .fields import SphericalHarmonicsForce as Force, SphericalHarmonicsForceGradient as ForceGradient else: from .fields import RadiationForce as Force, RadiationForceGradient as ForceGradient evaluator = Force(array, **kwargs) + ForceGradient(array, **kwargs) mg = evaluator.fields[0].field.mg def f(t, x): F = evaluator(complex_transducer_amplitudes, x)[0] F[2] -= mg return F def bead_close(t, x): F, dF = evaluator(complex_transducer_amplitudes, x) F[2] -= mg dx = lstsq(dF, F, rcond=None)[0] distance = np.sum(dx**2, axis=0)**0.5 return np.clip(distance - tolerance, 0, None) bead_close.terminal = True outs = solve_ivp(f, (0, time_interval), np.asarray(start_position), events=bead_close, vectorized=True, dense_output=path_points > 1) if outs.message != 'A termination event occurred.': print('End criterion not met. Final path position might not be close to trap location.') if path_points > 1: return outs.sol(np.linspace(0, outs.sol.t_max, path_points)) else: return outs.y[:, -1]
[ "def anl_solution(self):\r\n\r\n m = float(self.mass) / self.nu_m\r\n qe = 1 / self.nu_m * (self.nu_t * self.nu_t / self.nu_x) * 1.0 \\\r\n / float(self.size_tick * self.size_tick)\r\n print 'qE=', qe\r\n c = self.light_vel\r\n for i in range(0, len(self.obs.obt_g)):\r\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Play a song based on its path.
def play_song(self): path = input('Give path to wanted song: ') # Request path to song path = path.replace('\\', '/') if not self.path_storage_re.match(path): # Check if the wanted song is from the storage directory print("Give a valid path") else: p = vlc.MediaPlayer(path) # Create VLC instance and play the song p.play() self.playSong.append(p) self.isPlaying = True
[ "def play(self, song):\n pass", "def play_music(path, play_cnt):\n\tcanonicalized_path = path.replace('/', os.sep).replace('\\\\', os.sep)\n\tmixer.music.load(canonicalized_path)\n\tmixer.music.play(play_cnt)\n\treturn 1", "async def play(self, ctx, *, song: str):\r\n #await self.queue_music(ctx, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Stop the current playing/paused song.
def stop_song(self): if self.isPlaying: self.playSong[0].stop() self.playSong.clear() self.isPlaying = False print("Music stopped") else: print("Play a song first...")
[ "async def stop(self):\n # Are we already stopped?\n if self._current_track is None:\n return\n \n await self._stop()\n \n # do not change `self._paused`\n self._paused_track = None\n self._current_track = None", "def stop(self):\r\n pygame...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pause the current playing song.
def pause_song(self): if self.isPlaying: self.playSong[0].pause() print("Song paused. To continue type Play.") else: print("Play a song first...")
[ "def pause(self):\n self.paused = True\n # FIXME?: Why is this not doing anything? Shouldn't it be calling into the player API?", "def pause_music(self):\n\n self.my_pygame.mixer.music.pause() # pause the music", "def pause(self):\r\n if self.musicPlaying:\r\n pygame.mi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }