Search is not available for this dataset
identifier stringlengths 1 155 | parameters stringlengths 2 6.09k | docstring stringlengths 11 63.4k | docstring_summary stringlengths 0 63.4k | function stringlengths 29 99.8k | function_tokens list | start_point list | end_point list | language stringclasses 1
value | docstring_language stringlengths 2 7 | docstring_language_predictions stringlengths 18 23 | is_langid_reliable stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
ArithRef.is_int | (self) | Return `True` if `self` is an integer expression.
>>> x = Int('x')
>>> x.is_int()
True
>>> (x + 1).is_int()
True
>>> y = Real('y')
>>> (x + y).is_int()
False
| Return `True` if `self` is an integer expression. | def is_int(self):
"""Return `True` if `self` is an integer expression.
>>> x = Int('x')
>>> x.is_int()
True
>>> (x + 1).is_int()
True
>>> y = Real('y')
>>> (x + y).is_int()
False
"""
return self.sort().is_int() | [
"def",
"is_int",
"(",
"self",
")",
":",
"return",
"self",
".",
"sort",
"(",
")",
".",
"is_int",
"(",
")"
] | [
2234,
4
] | [
2246,
35
] | python | en | ['en', 'en', 'en'] | True |
ArithRef.is_real | (self) | Return `True` if `self` is an real expression.
>>> x = Real('x')
>>> x.is_real()
True
>>> (x + 1).is_real()
True
| Return `True` if `self` is an real expression. | def is_real(self):
"""Return `True` if `self` is an real expression.
>>> x = Real('x')
>>> x.is_real()
True
>>> (x + 1).is_real()
True
"""
return self.sort().is_real() | [
"def",
"is_real",
"(",
"self",
")",
":",
"return",
"self",
".",
"sort",
"(",
")",
".",
"is_real",
"(",
")"
] | [
2248,
4
] | [
2257,
36
] | python | en | ['en', 'en', 'en'] | True |
ArithRef.__add__ | (self, other) | Create the Z3 expression `self + other`.
>>> x = Int('x')
>>> y = Int('y')
>>> x + y
x + y
>>> (x + y).sort()
Int
| Create the Z3 expression `self + other`. | def __add__(self, other):
"""Create the Z3 expression `self + other`.
>>> x = Int('x')
>>> y = Int('y')
>>> x + y
x + y
>>> (x + y).sort()
Int
"""
a, b = _coerce_exprs(self, other)
return ArithRef(_mk_bin(Z3_mk_add, a, b), self.ctx) | [
"def",
"__add__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"ArithRef",
"(",
"_mk_bin",
"(",
"Z3_mk_add",
",",
"a",
",",
"b",
")",
",",
"self",
".",
"ctx",
")"
] | [
2259,
4
] | [
2270,
59
] | python | en | ['en', 'en', 'en'] | True |
ArithRef.__radd__ | (self, other) | Create the Z3 expression `other + self`.
>>> x = Int('x')
>>> 10 + x
10 + x
| Create the Z3 expression `other + self`. | def __radd__(self, other):
"""Create the Z3 expression `other + self`.
>>> x = Int('x')
>>> 10 + x
10 + x
"""
a, b = _coerce_exprs(self, other)
return ArithRef(_mk_bin(Z3_mk_add, b, a), self.ctx) | [
"def",
"__radd__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"ArithRef",
"(",
"_mk_bin",
"(",
"Z3_mk_add",
",",
"b",
",",
"a",
")",
",",
"self",
".",
"ctx",
")"
] | [
2272,
4
] | [
2280,
59
] | python | en | ['en', 'en', 'en'] | True |
ArithRef.__mul__ | (self, other) | Create the Z3 expression `self * other`.
>>> x = Real('x')
>>> y = Real('y')
>>> x * y
x*y
>>> (x * y).sort()
Real
| Create the Z3 expression `self * other`. | def __mul__(self, other):
"""Create the Z3 expression `self * other`.
>>> x = Real('x')
>>> y = Real('y')
>>> x * y
x*y
>>> (x * y).sort()
Real
"""
if isinstance(other, BoolRef):
return If(other, self, 0)
a, b = _coerce_exprs(se... | [
"def",
"__mul__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"BoolRef",
")",
":",
"return",
"If",
"(",
"other",
",",
"self",
",",
"0",
")",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"ret... | [
2282,
4
] | [
2295,
59
] | python | en | ['en', 'en', 'en'] | True |
ArithRef.__rmul__ | (self, other) | Create the Z3 expression `other * self`.
>>> x = Real('x')
>>> 10 * x
10*x
| Create the Z3 expression `other * self`. | def __rmul__(self, other):
"""Create the Z3 expression `other * self`.
>>> x = Real('x')
>>> 10 * x
10*x
"""
a, b = _coerce_exprs(self, other)
return ArithRef(_mk_bin(Z3_mk_mul, b, a), self.ctx) | [
"def",
"__rmul__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"ArithRef",
"(",
"_mk_bin",
"(",
"Z3_mk_mul",
",",
"b",
",",
"a",
")",
",",
"self",
".",
"ctx",
")"
] | [
2297,
4
] | [
2305,
59
] | python | en | ['en', 'en', 'en'] | True |
ArithRef.__sub__ | (self, other) | Create the Z3 expression `self - other`.
>>> x = Int('x')
>>> y = Int('y')
>>> x - y
x - y
>>> (x - y).sort()
Int
| Create the Z3 expression `self - other`. | def __sub__(self, other):
"""Create the Z3 expression `self - other`.
>>> x = Int('x')
>>> y = Int('y')
>>> x - y
x - y
>>> (x - y).sort()
Int
"""
a, b = _coerce_exprs(self, other)
return ArithRef(_mk_bin(Z3_mk_sub, a, b), self.ctx) | [
"def",
"__sub__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"ArithRef",
"(",
"_mk_bin",
"(",
"Z3_mk_sub",
",",
"a",
",",
"b",
")",
",",
"self",
".",
"ctx",
")"
] | [
2307,
4
] | [
2318,
59
] | python | en | ['en', 'en', 'en'] | True |
ArithRef.__rsub__ | (self, other) | Create the Z3 expression `other - self`.
>>> x = Int('x')
>>> 10 - x
10 - x
| Create the Z3 expression `other - self`. | def __rsub__(self, other):
"""Create the Z3 expression `other - self`.
>>> x = Int('x')
>>> 10 - x
10 - x
"""
a, b = _coerce_exprs(self, other)
return ArithRef(_mk_bin(Z3_mk_sub, b, a), self.ctx) | [
"def",
"__rsub__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"ArithRef",
"(",
"_mk_bin",
"(",
"Z3_mk_sub",
",",
"b",
",",
"a",
")",
",",
"self",
".",
"ctx",
")"
] | [
2320,
4
] | [
2328,
59
] | python | en | ['en', 'en', 'en'] | True |
ArithRef.__pow__ | (self, other) | Create the Z3 expression `self**other` (** is the power operator).
>>> x = Real('x')
>>> x**3
x**3
>>> (x**3).sort()
Real
>>> simplify(IntVal(2)**8)
256
| Create the Z3 expression `self**other` (** is the power operator). | def __pow__(self, other):
"""Create the Z3 expression `self**other` (** is the power operator).
>>> x = Real('x')
>>> x**3
x**3
>>> (x**3).sort()
Real
>>> simplify(IntVal(2)**8)
256
"""
a, b = _coerce_exprs(self, other)
return Arit... | [
"def",
"__pow__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"ArithRef",
"(",
"Z3_mk_power",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"a",
".",
"as_ast",
"(",
")",
",",
"... | [
2330,
4
] | [
2342,
86
] | python | en | ['en', 'en', 'en'] | True |
ArithRef.__rpow__ | (self, other) | Create the Z3 expression `other**self` (** is the power operator).
>>> x = Real('x')
>>> 2**x
2**x
>>> (2**x).sort()
Real
>>> simplify(2**IntVal(8))
256
| Create the Z3 expression `other**self` (** is the power operator). | def __rpow__(self, other):
"""Create the Z3 expression `other**self` (** is the power operator).
>>> x = Real('x')
>>> 2**x
2**x
>>> (2**x).sort()
Real
>>> simplify(2**IntVal(8))
256
"""
a, b = _coerce_exprs(self, other)
return Ari... | [
"def",
"__rpow__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"ArithRef",
"(",
"Z3_mk_power",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"b",
".",
"as_ast",
"(",
")",
",",
... | [
2344,
4
] | [
2356,
86
] | python | en | ['en', 'en', 'en'] | True |
ArithRef.__div__ | (self, other) | Create the Z3 expression `other/self`.
>>> x = Int('x')
>>> y = Int('y')
>>> x/y
x/y
>>> (x/y).sort()
Int
>>> (x/y).sexpr()
'(div x y)'
>>> x = Real('x')
>>> y = Real('y')
>>> x/y
x/y
>>> (x/y).sort()
Real
... | Create the Z3 expression `other/self`. | def __div__(self, other):
"""Create the Z3 expression `other/self`.
>>> x = Int('x')
>>> y = Int('y')
>>> x/y
x/y
>>> (x/y).sort()
Int
>>> (x/y).sexpr()
'(div x y)'
>>> x = Real('x')
>>> y = Real('y')
>>> x/y
x/y
... | [
"def",
"__div__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"ArithRef",
"(",
"Z3_mk_div",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"a",
".",
"as_ast",
"(",
")",
",",
"b"... | [
2358,
4
] | [
2379,
84
] | python | en | ['en', 'en', 'en'] | True |
ArithRef.__truediv__ | (self, other) | Create the Z3 expression `other/self`. | Create the Z3 expression `other/self`. | def __truediv__(self, other):
"""Create the Z3 expression `other/self`."""
return self.__div__(other) | [
"def",
"__truediv__",
"(",
"self",
",",
"other",
")",
":",
"return",
"self",
".",
"__div__",
"(",
"other",
")"
] | [
2381,
4
] | [
2383,
34
] | python | en | ['en', 'en', 'en'] | True |
ArithRef.__rdiv__ | (self, other) | Create the Z3 expression `other/self`.
>>> x = Int('x')
>>> 10/x
10/x
>>> (10/x).sexpr()
'(div 10 x)'
>>> x = Real('x')
>>> 10/x
10/x
>>> (10/x).sexpr()
'(/ 10.0 x)'
| Create the Z3 expression `other/self`. | def __rdiv__(self, other):
"""Create the Z3 expression `other/self`.
>>> x = Int('x')
>>> 10/x
10/x
>>> (10/x).sexpr()
'(div 10 x)'
>>> x = Real('x')
>>> 10/x
10/x
>>> (10/x).sexpr()
'(/ 10.0 x)'
"""
a, b = _coerce_... | [
"def",
"__rdiv__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"ArithRef",
"(",
"Z3_mk_div",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"b",
".",
"as_ast",
"(",
")",
",",
"a... | [
2385,
4
] | [
2400,
84
] | python | en | ['en', 'en', 'en'] | True |
ArithRef.__rtruediv__ | (self, other) | Create the Z3 expression `other/self`. | Create the Z3 expression `other/self`. | def __rtruediv__(self, other):
"""Create the Z3 expression `other/self`."""
return self.__rdiv__(other) | [
"def",
"__rtruediv__",
"(",
"self",
",",
"other",
")",
":",
"return",
"self",
".",
"__rdiv__",
"(",
"other",
")"
] | [
2402,
4
] | [
2404,
35
] | python | en | ['en', 'en', 'en'] | True |
ArithRef.__mod__ | (self, other) | Create the Z3 expression `other%self`.
>>> x = Int('x')
>>> y = Int('y')
>>> x % y
x%y
>>> simplify(IntVal(10) % IntVal(3))
1
| Create the Z3 expression `other%self`. | def __mod__(self, other):
"""Create the Z3 expression `other%self`.
>>> x = Int('x')
>>> y = Int('y')
>>> x % y
x%y
>>> simplify(IntVal(10) % IntVal(3))
1
"""
a, b = _coerce_exprs(self, other)
if z3_debug():
_z3_assert(a.is_int... | [
"def",
"__mod__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"if",
"z3_debug",
"(",
")",
":",
"_z3_assert",
"(",
"a",
".",
"is_int",
"(",
")",
",",
"\"Z3 integer expression expected\"",
")"... | [
2406,
4
] | [
2419,
84
] | python | en | ['en', 'en', 'en'] | True |
ArithRef.__rmod__ | (self, other) | Create the Z3 expression `other%self`.
>>> x = Int('x')
>>> 10 % x
10%x
| Create the Z3 expression `other%self`. | def __rmod__(self, other):
"""Create the Z3 expression `other%self`.
>>> x = Int('x')
>>> 10 % x
10%x
"""
a, b = _coerce_exprs(self, other)
if z3_debug():
_z3_assert(a.is_int(), "Z3 integer expression expected")
return ArithRef(Z3_mk_mod(self.... | [
"def",
"__rmod__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"if",
"z3_debug",
"(",
")",
":",
"_z3_assert",
"(",
"a",
".",
"is_int",
"(",
")",
",",
"\"Z3 integer expression expected\"",
")... | [
2421,
4
] | [
2431,
84
] | python | en | ['en', 'en', 'en'] | True |
ArithRef.__neg__ | (self) | Return an expression representing `-self`.
>>> x = Int('x')
>>> -x
-x
>>> simplify(-(-x))
x
| Return an expression representing `-self`. | def __neg__(self):
"""Return an expression representing `-self`.
>>> x = Int('x')
>>> -x
-x
>>> simplify(-(-x))
x
"""
return ArithRef(Z3_mk_unary_minus(self.ctx_ref(), self.as_ast()), self.ctx) | [
"def",
"__neg__",
"(",
"self",
")",
":",
"return",
"ArithRef",
"(",
"Z3_mk_unary_minus",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"as_ast",
"(",
")",
")",
",",
"self",
".",
"ctx",
")"
] | [
2433,
4
] | [
2442,
83
] | python | en | ['en', 'en', 'en'] | True |
ArithRef.__pos__ | (self) | Return `self`.
>>> x = Int('x')
>>> +x
x
| Return `self`. | def __pos__(self):
"""Return `self`.
>>> x = Int('x')
>>> +x
x
"""
return self | [
"def",
"__pos__",
"(",
"self",
")",
":",
"return",
"self"
] | [
2444,
4
] | [
2451,
19
] | python | en | ['en', 'ig', 'en'] | False |
ArithRef.__le__ | (self, other) | Create the Z3 expression `other <= self`.
>>> x, y = Ints('x y')
>>> x <= y
x <= y
>>> y = Real('y')
>>> x <= y
ToReal(x) <= y
| Create the Z3 expression `other <= self`. | def __le__(self, other):
"""Create the Z3 expression `other <= self`.
>>> x, y = Ints('x y')
>>> x <= y
x <= y
>>> y = Real('y')
>>> x <= y
ToReal(x) <= y
"""
a, b = _coerce_exprs(self, other)
return BoolRef(Z3_mk_le(self.ctx_ref(), a.as_a... | [
"def",
"__le__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"BoolRef",
"(",
"Z3_mk_le",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"a",
".",
"as_ast",
"(",
")",
",",
"b",
... | [
2453,
4
] | [
2464,
82
] | python | en | ['en', 'en', 'en'] | True |
ArithRef.__lt__ | (self, other) | Create the Z3 expression `other < self`.
>>> x, y = Ints('x y')
>>> x < y
x < y
>>> y = Real('y')
>>> x < y
ToReal(x) < y
| Create the Z3 expression `other < self`. | def __lt__(self, other):
"""Create the Z3 expression `other < self`.
>>> x, y = Ints('x y')
>>> x < y
x < y
>>> y = Real('y')
>>> x < y
ToReal(x) < y
"""
a, b = _coerce_exprs(self, other)
return BoolRef(Z3_mk_lt(self.ctx_ref(), a.as_ast(),... | [
"def",
"__lt__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"BoolRef",
"(",
"Z3_mk_lt",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"a",
".",
"as_ast",
"(",
")",
",",
"b",
... | [
2466,
4
] | [
2477,
82
] | python | en | ['en', 'en', 'en'] | True |
ArithRef.__gt__ | (self, other) | Create the Z3 expression `other > self`.
>>> x, y = Ints('x y')
>>> x > y
x > y
>>> y = Real('y')
>>> x > y
ToReal(x) > y
| Create the Z3 expression `other > self`. | def __gt__(self, other):
"""Create the Z3 expression `other > self`.
>>> x, y = Ints('x y')
>>> x > y
x > y
>>> y = Real('y')
>>> x > y
ToReal(x) > y
"""
a, b = _coerce_exprs(self, other)
return BoolRef(Z3_mk_gt(self.ctx_ref(), a.as_ast(),... | [
"def",
"__gt__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"BoolRef",
"(",
"Z3_mk_gt",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"a",
".",
"as_ast",
"(",
")",
",",
"b",
... | [
2479,
4
] | [
2490,
82
] | python | en | ['en', 'en', 'en'] | True |
ArithRef.__ge__ | (self, other) | Create the Z3 expression `other >= self`.
>>> x, y = Ints('x y')
>>> x >= y
x >= y
>>> y = Real('y')
>>> x >= y
ToReal(x) >= y
| Create the Z3 expression `other >= self`. | def __ge__(self, other):
"""Create the Z3 expression `other >= self`.
>>> x, y = Ints('x y')
>>> x >= y
x >= y
>>> y = Real('y')
>>> x >= y
ToReal(x) >= y
"""
a, b = _coerce_exprs(self, other)
return BoolRef(Z3_mk_ge(self.ctx_ref(), a.as_a... | [
"def",
"__ge__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"BoolRef",
"(",
"Z3_mk_ge",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"a",
".",
"as_ast",
"(",
")",
",",
"b",
... | [
2492,
4
] | [
2503,
82
] | python | en | ['en', 'en', 'en'] | True |
IntNumRef.as_long | (self) | Return a Z3 integer numeral as a Python long (bignum) numeral.
>>> v = IntVal(1)
>>> v + 1
1 + 1
>>> v.as_long() + 1
2
| Return a Z3 integer numeral as a Python long (bignum) numeral. | def as_long(self):
"""Return a Z3 integer numeral as a Python long (bignum) numeral.
>>> v = IntVal(1)
>>> v + 1
1 + 1
>>> v.as_long() + 1
2
"""
if z3_debug():
_z3_assert(self.is_int(), "Integer value expected")
return int(self.as_stri... | [
"def",
"as_long",
"(",
"self",
")",
":",
"if",
"z3_debug",
"(",
")",
":",
"_z3_assert",
"(",
"self",
".",
"is_int",
"(",
")",
",",
"\"Integer value expected\"",
")",
"return",
"int",
"(",
"self",
".",
"as_string",
"(",
")",
")"
] | [
2781,
4
] | [
2792,
36
] | python | en | ['en', 'cy', 'en'] | True |
IntNumRef.as_string | (self) | Return a Z3 integer numeral as a Python string.
>>> v = IntVal(100)
>>> v.as_string()
'100'
| Return a Z3 integer numeral as a Python string.
>>> v = IntVal(100)
>>> v.as_string()
'100'
| def as_string(self):
"""Return a Z3 integer numeral as a Python string.
>>> v = IntVal(100)
>>> v.as_string()
'100'
"""
return Z3_get_numeral_string(self.ctx_ref(), self.as_ast()) | [
"def",
"as_string",
"(",
"self",
")",
":",
"return",
"Z3_get_numeral_string",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"as_ast",
"(",
")",
")"
] | [
2794,
4
] | [
2800,
67
] | python | en | ['en', 'sk', 'en'] | True |
IntNumRef.as_binary_string | (self) | Return a Z3 integer numeral as a Python binary string.
>>> v = IntVal(10)
>>> v.as_binary_string()
'1010'
| Return a Z3 integer numeral as a Python binary string.
>>> v = IntVal(10)
>>> v.as_binary_string()
'1010'
| def as_binary_string(self):
"""Return a Z3 integer numeral as a Python binary string.
>>> v = IntVal(10)
>>> v.as_binary_string()
'1010'
"""
return Z3_get_numeral_binary_string(self.ctx_ref(), self.as_ast()) | [
"def",
"as_binary_string",
"(",
"self",
")",
":",
"return",
"Z3_get_numeral_binary_string",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"as_ast",
"(",
")",
")"
] | [
2802,
4
] | [
2808,
74
] | python | en | ['en', 'sk', 'en'] | True |
RatNumRef.numerator | (self) | Return the numerator of a Z3 rational numeral.
>>> is_rational_value(RealVal("3/5"))
True
>>> n = RealVal("3/5")
>>> n.numerator()
3
>>> is_rational_value(Q(3,5))
True
>>> Q(3,5).numerator()
3
| Return the numerator of a Z3 rational numeral. | def numerator(self):
""" Return the numerator of a Z3 rational numeral.
>>> is_rational_value(RealVal("3/5"))
True
>>> n = RealVal("3/5")
>>> n.numerator()
3
>>> is_rational_value(Q(3,5))
True
>>> Q(3,5).numerator()
3
"""
r... | [
"def",
"numerator",
"(",
"self",
")",
":",
"return",
"IntNumRef",
"(",
"Z3_get_numerator",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"as_ast",
"(",
")",
")",
",",
"self",
".",
"ctx",
")"
] | [
2813,
4
] | [
2826,
83
] | python | en | ['en', 'en', 'en'] | True |
RatNumRef.denominator | (self) | Return the denominator of a Z3 rational numeral.
>>> is_rational_value(Q(3,5))
True
>>> n = Q(3,5)
>>> n.denominator()
5
| Return the denominator of a Z3 rational numeral. | def denominator(self):
""" Return the denominator of a Z3 rational numeral.
>>> is_rational_value(Q(3,5))
True
>>> n = Q(3,5)
>>> n.denominator()
5
"""
return IntNumRef(Z3_get_denominator(self.ctx_ref(), self.as_ast()), self.ctx) | [
"def",
"denominator",
"(",
"self",
")",
":",
"return",
"IntNumRef",
"(",
"Z3_get_denominator",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"as_ast",
"(",
")",
")",
",",
"self",
".",
"ctx",
")"
] | [
2828,
4
] | [
2837,
85
] | python | en | ['en', 'en', 'en'] | True |
RatNumRef.numerator_as_long | (self) | Return the numerator as a Python long.
>>> v = RealVal(10000000000)
>>> v
10000000000
>>> v + 1
10000000000 + 1
>>> v.numerator_as_long() + 1 == 10000000001
True
| Return the numerator as a Python long. | def numerator_as_long(self):
""" Return the numerator as a Python long.
>>> v = RealVal(10000000000)
>>> v
10000000000
>>> v + 1
10000000000 + 1
>>> v.numerator_as_long() + 1 == 10000000001
True
"""
return self.numerator().as_long() | [
"def",
"numerator_as_long",
"(",
"self",
")",
":",
"return",
"self",
".",
"numerator",
"(",
")",
".",
"as_long",
"(",
")"
] | [
2839,
4
] | [
2850,
41
] | python | en | ['en', 'en', 'en'] | True |
RatNumRef.denominator_as_long | (self) | Return the denominator as a Python long.
>>> v = RealVal("1/3")
>>> v
1/3
>>> v.denominator_as_long()
3
| Return the denominator as a Python long. | def denominator_as_long(self):
""" Return the denominator as a Python long.
>>> v = RealVal("1/3")
>>> v
1/3
>>> v.denominator_as_long()
3
"""
return self.denominator().as_long() | [
"def",
"denominator_as_long",
"(",
"self",
")",
":",
"return",
"self",
".",
"denominator",
"(",
")",
".",
"as_long",
"(",
")"
] | [
2852,
4
] | [
2861,
43
] | python | en | ['en', 'pt', 'en'] | True |
RatNumRef.as_decimal | (self, prec) | Return a Z3 rational value as a string in decimal notation using at most `prec` decimal places.
>>> v = RealVal("1/5")
>>> v.as_decimal(3)
'0.2'
>>> v = RealVal("1/3")
>>> v.as_decimal(3)
'0.333?'
| Return a Z3 rational value as a string in decimal notation using at most `prec` decimal places. | def as_decimal(self, prec):
""" Return a Z3 rational value as a string in decimal notation using at most `prec` decimal places.
>>> v = RealVal("1/5")
>>> v.as_decimal(3)
'0.2'
>>> v = RealVal("1/3")
>>> v.as_decimal(3)
'0.333?'
"""
return Z3_get_... | [
"def",
"as_decimal",
"(",
"self",
",",
"prec",
")",
":",
"return",
"Z3_get_numeral_decimal_string",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"as_ast",
"(",
")",
",",
"prec",
")"
] | [
2876,
4
] | [
2886,
81
] | python | en | ['en', 'en', 'en'] | True |
RatNumRef.as_string | (self) | Return a Z3 rational numeral as a Python string.
>>> v = Q(3,6)
>>> v.as_string()
'1/2'
| Return a Z3 rational numeral as a Python string. | def as_string(self):
"""Return a Z3 rational numeral as a Python string.
>>> v = Q(3,6)
>>> v.as_string()
'1/2'
"""
return Z3_get_numeral_string(self.ctx_ref(), self.as_ast()) | [
"def",
"as_string",
"(",
"self",
")",
":",
"return",
"Z3_get_numeral_string",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"as_ast",
"(",
")",
")"
] | [
2888,
4
] | [
2895,
67
] | python | en | ['en', 'en', 'en'] | True |
RatNumRef.as_fraction | (self) | Return a Z3 rational as a Python Fraction object.
>>> v = RealVal("1/5")
>>> v.as_fraction()
Fraction(1, 5)
| Return a Z3 rational as a Python Fraction object. | def as_fraction(self):
"""Return a Z3 rational as a Python Fraction object.
>>> v = RealVal("1/5")
>>> v.as_fraction()
Fraction(1, 5)
"""
return Fraction(self.numerator_as_long(), self.denominator_as_long()) | [
"def",
"as_fraction",
"(",
"self",
")",
":",
"return",
"Fraction",
"(",
"self",
".",
"numerator_as_long",
"(",
")",
",",
"self",
".",
"denominator_as_long",
"(",
")",
")"
] | [
2897,
4
] | [
2904,
77
] | python | en | ['en', 'en', 'en'] | True |
AlgebraicNumRef.approx | (self, precision=10) | Return a Z3 rational number that approximates the algebraic number `self`.
The result `r` is such that |r - self| <= 1/10^precision
>>> x = simplify(Sqrt(2))
>>> x.approx(20)
6838717160008073720548335/4835703278458516698824704
>>> x.approx(5)
2965821/2097152
| Return a Z3 rational number that approximates the algebraic number `self`.
The result `r` is such that |r - self| <= 1/10^precision | def approx(self, precision=10):
"""Return a Z3 rational number that approximates the algebraic number `self`.
The result `r` is such that |r - self| <= 1/10^precision
>>> x = simplify(Sqrt(2))
>>> x.approx(20)
6838717160008073720548335/4835703278458516698824704
>>> x.app... | [
"def",
"approx",
"(",
"self",
",",
"precision",
"=",
"10",
")",
":",
"return",
"RatNumRef",
"(",
"Z3_get_algebraic_number_upper",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"as_ast",
"(",
")",
",",
"precision",
")",
",",
"self",
".",
"ctx... | [
2909,
4
] | [
2919,
107
] | python | en | ['en', 'en', 'en'] | True |
AlgebraicNumRef.as_decimal | (self, prec) | Return a string representation of the algebraic number `self` in decimal notation using `prec` decimal places
>>> x = simplify(Sqrt(2))
>>> x.as_decimal(10)
'1.4142135623?'
>>> x.as_decimal(20)
'1.41421356237309504880?'
| Return a string representation of the algebraic number `self` in decimal notation using `prec` decimal places | def as_decimal(self, prec):
"""Return a string representation of the algebraic number `self` in decimal notation using `prec` decimal places
>>> x = simplify(Sqrt(2))
>>> x.as_decimal(10)
'1.4142135623?'
>>> x.as_decimal(20)
'1.41421356237309504880?'
"""
... | [
"def",
"as_decimal",
"(",
"self",
",",
"prec",
")",
":",
"return",
"Z3_get_numeral_decimal_string",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"as_ast",
"(",
")",
",",
"prec",
")"
] | [
2920,
4
] | [
2929,
81
] | python | en | ['en', 'id', 'en'] | True |
BitVecSortRef.size | (self) | Return the size (number of bits) of the bit-vector sort `self`.
>>> b = BitVecSort(32)
>>> b.size()
32
| Return the size (number of bits) of the bit-vector sort `self`. | def size(self):
"""Return the size (number of bits) of the bit-vector sort `self`.
>>> b = BitVecSort(32)
>>> b.size()
32
"""
return int(Z3_get_bv_sort_size(self.ctx_ref(), self.ast)) | [
"def",
"size",
"(",
"self",
")",
":",
"return",
"int",
"(",
"Z3_get_bv_sort_size",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"ast",
")",
")"
] | [
3239,
4
] | [
3246,
65
] | python | en | ['en', 'en', 'en'] | True |
BitVecSortRef.cast | (self, val) | Try to cast `val` as a Bit-Vector.
>>> b = BitVecSort(32)
>>> b.cast(10)
10
>>> b.cast(10).sexpr()
'#x0000000a'
| Try to cast `val` as a Bit-Vector. | def cast(self, val):
"""Try to cast `val` as a Bit-Vector.
>>> b = BitVecSort(32)
>>> b.cast(10)
10
>>> b.cast(10).sexpr()
'#x0000000a'
"""
if is_expr(val):
if z3_debug():
_z3_assert(self.ctx == val.ctx, "Context mismatch")
... | [
"def",
"cast",
"(",
"self",
",",
"val",
")",
":",
"if",
"is_expr",
"(",
"val",
")",
":",
"if",
"z3_debug",
"(",
")",
":",
"_z3_assert",
"(",
"self",
".",
"ctx",
"==",
"val",
".",
"ctx",
",",
"\"Context mismatch\"",
")",
"# Idea: use sign_extend if sort o... | [
3251,
4
] | [
3266,
39
] | python | en | ['en', 'en', 'en'] | True |
BitVecRef.sort | (self) | Return the sort of the bit-vector expression `self`.
>>> x = BitVec('x', 32)
>>> x.sort()
BitVec(32)
>>> x.sort() == BitVecSort(32)
True
| Return the sort of the bit-vector expression `self`. | def sort(self):
"""Return the sort of the bit-vector expression `self`.
>>> x = BitVec('x', 32)
>>> x.sort()
BitVec(32)
>>> x.sort() == BitVecSort(32)
True
"""
return BitVecSortRef(Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx) | [
"def",
"sort",
"(",
"self",
")",
":",
"return",
"BitVecSortRef",
"(",
"Z3_get_sort",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"as_ast",
"(",
")",
")",
",",
"self",
".",
"ctx",
")"
] | [
3281,
4
] | [
3290,
82
] | python | en | ['en', 'en', 'en'] | True |
BitVecRef.size | (self) | Return the number of bits of the bit-vector expression `self`.
>>> x = BitVec('x', 32)
>>> (x + 1).size()
32
>>> Concat(x, x).size()
64
| Return the number of bits of the bit-vector expression `self`. | def size(self):
"""Return the number of bits of the bit-vector expression `self`.
>>> x = BitVec('x', 32)
>>> (x + 1).size()
32
>>> Concat(x, x).size()
64
"""
return self.sort().size() | [
"def",
"size",
"(",
"self",
")",
":",
"return",
"self",
".",
"sort",
"(",
")",
".",
"size",
"(",
")"
] | [
3292,
4
] | [
3301,
33
] | python | en | ['en', 'en', 'en'] | True |
BitVecRef.__add__ | (self, other) | Create the Z3 expression `self + other`.
>>> x = BitVec('x', 32)
>>> y = BitVec('y', 32)
>>> x + y
x + y
>>> (x + y).sort()
BitVec(32)
| Create the Z3 expression `self + other`. | def __add__(self, other):
"""Create the Z3 expression `self + other`.
>>> x = BitVec('x', 32)
>>> y = BitVec('y', 32)
>>> x + y
x + y
>>> (x + y).sort()
BitVec(32)
"""
a, b = _coerce_exprs(self, other)
return BitVecRef(Z3_mk_bvadd(self.ctx... | [
"def",
"__add__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"BitVecRef",
"(",
"Z3_mk_bvadd",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"a",
".",
"as_ast",
"(",
")",
",",
... | [
3303,
4
] | [
3314,
87
] | python | en | ['en', 'en', 'en'] | True |
BitVecRef.__radd__ | (self, other) | Create the Z3 expression `other + self`.
>>> x = BitVec('x', 32)
>>> 10 + x
10 + x
| Create the Z3 expression `other + self`. | def __radd__(self, other):
"""Create the Z3 expression `other + self`.
>>> x = BitVec('x', 32)
>>> 10 + x
10 + x
"""
a, b = _coerce_exprs(self, other)
return BitVecRef(Z3_mk_bvadd(self.ctx_ref(), b.as_ast(), a.as_ast()), self.ctx) | [
"def",
"__radd__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"BitVecRef",
"(",
"Z3_mk_bvadd",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"b",
".",
"as_ast",
"(",
")",
",",
... | [
3316,
4
] | [
3324,
87
] | python | en | ['en', 'en', 'en'] | True |
BitVecRef.__mul__ | (self, other) | Create the Z3 expression `self * other`.
>>> x = BitVec('x', 32)
>>> y = BitVec('y', 32)
>>> x * y
x*y
>>> (x * y).sort()
BitVec(32)
| Create the Z3 expression `self * other`. | def __mul__(self, other):
"""Create the Z3 expression `self * other`.
>>> x = BitVec('x', 32)
>>> y = BitVec('y', 32)
>>> x * y
x*y
>>> (x * y).sort()
BitVec(32)
"""
a, b = _coerce_exprs(self, other)
return BitVecRef(Z3_mk_bvmul(self.ctx_r... | [
"def",
"__mul__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"BitVecRef",
"(",
"Z3_mk_bvmul",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"a",
".",
"as_ast",
"(",
")",
",",
... | [
3326,
4
] | [
3337,
87
] | python | en | ['en', 'en', 'en'] | True |
BitVecRef.__rmul__ | (self, other) | Create the Z3 expression `other * self`.
>>> x = BitVec('x', 32)
>>> 10 * x
10*x
| Create the Z3 expression `other * self`. | def __rmul__(self, other):
"""Create the Z3 expression `other * self`.
>>> x = BitVec('x', 32)
>>> 10 * x
10*x
"""
a, b = _coerce_exprs(self, other)
return BitVecRef(Z3_mk_bvmul(self.ctx_ref(), b.as_ast(), a.as_ast()), self.ctx) | [
"def",
"__rmul__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"BitVecRef",
"(",
"Z3_mk_bvmul",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"b",
".",
"as_ast",
"(",
")",
",",
... | [
3339,
4
] | [
3347,
87
] | python | en | ['en', 'en', 'en'] | True |
BitVecRef.__sub__ | (self, other) | Create the Z3 expression `self - other`.
>>> x = BitVec('x', 32)
>>> y = BitVec('y', 32)
>>> x - y
x - y
>>> (x - y).sort()
BitVec(32)
| Create the Z3 expression `self - other`. | def __sub__(self, other):
"""Create the Z3 expression `self - other`.
>>> x = BitVec('x', 32)
>>> y = BitVec('y', 32)
>>> x - y
x - y
>>> (x - y).sort()
BitVec(32)
"""
a, b = _coerce_exprs(self, other)
return BitVecRef(Z3_mk_bvsub(self.ctx... | [
"def",
"__sub__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"BitVecRef",
"(",
"Z3_mk_bvsub",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"a",
".",
"as_ast",
"(",
")",
",",
... | [
3349,
4
] | [
3360,
87
] | python | en | ['en', 'en', 'en'] | True |
BitVecRef.__rsub__ | (self, other) | Create the Z3 expression `other - self`.
>>> x = BitVec('x', 32)
>>> 10 - x
10 - x
| Create the Z3 expression `other - self`. | def __rsub__(self, other):
"""Create the Z3 expression `other - self`.
>>> x = BitVec('x', 32)
>>> 10 - x
10 - x
"""
a, b = _coerce_exprs(self, other)
return BitVecRef(Z3_mk_bvsub(self.ctx_ref(), b.as_ast(), a.as_ast()), self.ctx) | [
"def",
"__rsub__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"BitVecRef",
"(",
"Z3_mk_bvsub",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"b",
".",
"as_ast",
"(",
")",
",",
... | [
3362,
4
] | [
3370,
87
] | python | en | ['en', 'en', 'en'] | True |
BitVecRef.__or__ | (self, other) | Create the Z3 expression bitwise-or `self | other`.
>>> x = BitVec('x', 32)
>>> y = BitVec('y', 32)
>>> x | y
x | y
>>> (x | y).sort()
BitVec(32)
| Create the Z3 expression bitwise-or `self | other`. | def __or__(self, other):
"""Create the Z3 expression bitwise-or `self | other`.
>>> x = BitVec('x', 32)
>>> y = BitVec('y', 32)
>>> x | y
x | y
>>> (x | y).sort()
BitVec(32)
"""
a, b = _coerce_exprs(self, other)
return BitVecRef(Z3_mk_bvor... | [
"def",
"__or__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"BitVecRef",
"(",
"Z3_mk_bvor",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"a",
".",
"as_ast",
"(",
")",
",",
"b... | [
3372,
4
] | [
3383,
86
] | python | en | ['en', 'en', 'en'] | True |
BitVecRef.__ror__ | (self, other) | Create the Z3 expression bitwise-or `other | self`.
>>> x = BitVec('x', 32)
>>> 10 | x
10 | x
| Create the Z3 expression bitwise-or `other | self`. | def __ror__(self, other):
"""Create the Z3 expression bitwise-or `other | self`.
>>> x = BitVec('x', 32)
>>> 10 | x
10 | x
"""
a, b = _coerce_exprs(self, other)
return BitVecRef(Z3_mk_bvor(self.ctx_ref(), b.as_ast(), a.as_ast()), self.ctx) | [
"def",
"__ror__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"BitVecRef",
"(",
"Z3_mk_bvor",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"b",
".",
"as_ast",
"(",
")",
",",
"... | [
3385,
4
] | [
3393,
86
] | python | en | ['en', 'en', 'en'] | True |
BitVecRef.__and__ | (self, other) | Create the Z3 expression bitwise-and `self & other`.
>>> x = BitVec('x', 32)
>>> y = BitVec('y', 32)
>>> x & y
x & y
>>> (x & y).sort()
BitVec(32)
| Create the Z3 expression bitwise-and `self & other`. | def __and__(self, other):
"""Create the Z3 expression bitwise-and `self & other`.
>>> x = BitVec('x', 32)
>>> y = BitVec('y', 32)
>>> x & y
x & y
>>> (x & y).sort()
BitVec(32)
"""
a, b = _coerce_exprs(self, other)
return BitVecRef(Z3_mk_bv... | [
"def",
"__and__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"BitVecRef",
"(",
"Z3_mk_bvand",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"a",
".",
"as_ast",
"(",
")",
",",
... | [
3395,
4
] | [
3406,
87
] | python | en | ['en', 'en', 'en'] | True |
BitVecRef.__rand__ | (self, other) | Create the Z3 expression bitwise-or `other & self`.
>>> x = BitVec('x', 32)
>>> 10 & x
10 & x
| Create the Z3 expression bitwise-or `other & self`. | def __rand__(self, other):
"""Create the Z3 expression bitwise-or `other & self`.
>>> x = BitVec('x', 32)
>>> 10 & x
10 & x
"""
a, b = _coerce_exprs(self, other)
return BitVecRef(Z3_mk_bvand(self.ctx_ref(), b.as_ast(), a.as_ast()), self.ctx) | [
"def",
"__rand__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"BitVecRef",
"(",
"Z3_mk_bvand",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"b",
".",
"as_ast",
"(",
")",
",",
... | [
3408,
4
] | [
3416,
87
] | python | en | ['en', 'en', 'en'] | True |
BitVecRef.__xor__ | (self, other) | Create the Z3 expression bitwise-xor `self ^ other`.
>>> x = BitVec('x', 32)
>>> y = BitVec('y', 32)
>>> x ^ y
x ^ y
>>> (x ^ y).sort()
BitVec(32)
| Create the Z3 expression bitwise-xor `self ^ other`. | def __xor__(self, other):
"""Create the Z3 expression bitwise-xor `self ^ other`.
>>> x = BitVec('x', 32)
>>> y = BitVec('y', 32)
>>> x ^ y
x ^ y
>>> (x ^ y).sort()
BitVec(32)
"""
a, b = _coerce_exprs(self, other)
return BitVecRef(Z3_mk_bv... | [
"def",
"__xor__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"BitVecRef",
"(",
"Z3_mk_bvxor",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"a",
".",
"as_ast",
"(",
")",
",",
... | [
3418,
4
] | [
3429,
87
] | python | en | ['en', 'en', 'en'] | True |
BitVecRef.__rxor__ | (self, other) | Create the Z3 expression bitwise-xor `other ^ self`.
>>> x = BitVec('x', 32)
>>> 10 ^ x
10 ^ x
| Create the Z3 expression bitwise-xor `other ^ self`. | def __rxor__(self, other):
"""Create the Z3 expression bitwise-xor `other ^ self`.
>>> x = BitVec('x', 32)
>>> 10 ^ x
10 ^ x
"""
a, b = _coerce_exprs(self, other)
return BitVecRef(Z3_mk_bvxor(self.ctx_ref(), b.as_ast(), a.as_ast()), self.ctx) | [
"def",
"__rxor__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"BitVecRef",
"(",
"Z3_mk_bvxor",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"b",
".",
"as_ast",
"(",
")",
",",
... | [
3431,
4
] | [
3439,
87
] | python | en | ['en', 'en', 'en'] | True |
BitVecRef.__pos__ | (self) | Return `self`.
>>> x = BitVec('x', 32)
>>> +x
x
| Return `self`. | def __pos__(self):
"""Return `self`.
>>> x = BitVec('x', 32)
>>> +x
x
"""
return self | [
"def",
"__pos__",
"(",
"self",
")",
":",
"return",
"self"
] | [
3441,
4
] | [
3448,
19
] | python | en | ['en', 'ig', 'en'] | False |
BitVecRef.__neg__ | (self) | Return an expression representing `-self`.
>>> x = BitVec('x', 32)
>>> -x
-x
>>> simplify(-(-x))
x
| Return an expression representing `-self`. | def __neg__(self):
"""Return an expression representing `-self`.
>>> x = BitVec('x', 32)
>>> -x
-x
>>> simplify(-(-x))
x
"""
return BitVecRef(Z3_mk_bvneg(self.ctx_ref(), self.as_ast()), self.ctx) | [
"def",
"__neg__",
"(",
"self",
")",
":",
"return",
"BitVecRef",
"(",
"Z3_mk_bvneg",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"as_ast",
"(",
")",
")",
",",
"self",
".",
"ctx",
")"
] | [
3450,
4
] | [
3459,
78
] | python | en | ['en', 'en', 'en'] | True |
BitVecRef.__invert__ | (self) | Create the Z3 expression bitwise-not `~self`.
>>> x = BitVec('x', 32)
>>> ~x
~x
>>> simplify(~(~x))
x
| Create the Z3 expression bitwise-not `~self`. | def __invert__(self):
"""Create the Z3 expression bitwise-not `~self`.
>>> x = BitVec('x', 32)
>>> ~x
~x
>>> simplify(~(~x))
x
"""
return BitVecRef(Z3_mk_bvnot(self.ctx_ref(), self.as_ast()), self.ctx) | [
"def",
"__invert__",
"(",
"self",
")",
":",
"return",
"BitVecRef",
"(",
"Z3_mk_bvnot",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"as_ast",
"(",
")",
")",
",",
"self",
".",
"ctx",
")"
] | [
3461,
4
] | [
3470,
78
] | python | en | ['en', 'en', 'en'] | True |
BitVecRef.__div__ | (self, other) | Create the Z3 expression (signed) division `self / other`.
Use the function UDiv() for unsigned division.
>>> x = BitVec('x', 32)
>>> y = BitVec('y', 32)
>>> x / y
x/y
>>> (x / y).sort()
BitVec(32)
>>> (x / y).sexpr()
'(bvsdiv x y)'
>>> U... | Create the Z3 expression (signed) division `self / other`. | def __div__(self, other):
"""Create the Z3 expression (signed) division `self / other`.
Use the function UDiv() for unsigned division.
>>> x = BitVec('x', 32)
>>> y = BitVec('y', 32)
>>> x / y
x/y
>>> (x / y).sort()
BitVec(32)
>>> (x / y).sexpr()... | [
"def",
"__div__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"BitVecRef",
"(",
"Z3_mk_bvsdiv",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"a",
".",
"as_ast",
"(",
")",
",",
... | [
3472,
4
] | [
3489,
88
] | python | en | ['en', 'en', 'en'] | True |
BitVecRef.__truediv__ | (self, other) | Create the Z3 expression (signed) division `self / other`. | Create the Z3 expression (signed) division `self / other`. | def __truediv__(self, other):
"""Create the Z3 expression (signed) division `self / other`."""
return self.__div__(other) | [
"def",
"__truediv__",
"(",
"self",
",",
"other",
")",
":",
"return",
"self",
".",
"__div__",
"(",
"other",
")"
] | [
3491,
4
] | [
3493,
34
] | python | en | ['en', 'en', 'en'] | True |
BitVecRef.__rdiv__ | (self, other) | Create the Z3 expression (signed) division `other / self`.
Use the function UDiv() for unsigned division.
>>> x = BitVec('x', 32)
>>> 10 / x
10/x
>>> (10 / x).sexpr()
'(bvsdiv #x0000000a x)'
>>> UDiv(10, x).sexpr()
'(bvudiv #x0000000a x)'
| Create the Z3 expression (signed) division `other / self`. | def __rdiv__(self, other):
"""Create the Z3 expression (signed) division `other / self`.
Use the function UDiv() for unsigned division.
>>> x = BitVec('x', 32)
>>> 10 / x
10/x
>>> (10 / x).sexpr()
'(bvsdiv #x0000000a x)'
>>> UDiv(10, x).sexpr()
'... | [
"def",
"__rdiv__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"BitVecRef",
"(",
"Z3_mk_bvsdiv",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"b",
".",
"as_ast",
"(",
")",
",",
... | [
3495,
4
] | [
3509,
88
] | python | en | ['en', 'en', 'en'] | True |
BitVecRef.__rtruediv__ | (self, other) | Create the Z3 expression (signed) division `other / self`. | Create the Z3 expression (signed) division `other / self`. | def __rtruediv__(self, other):
"""Create the Z3 expression (signed) division `other / self`."""
return self.__rdiv__(other) | [
"def",
"__rtruediv__",
"(",
"self",
",",
"other",
")",
":",
"return",
"self",
".",
"__rdiv__",
"(",
"other",
")"
] | [
3511,
4
] | [
3513,
35
] | python | en | ['en', 'en', 'en'] | True |
BitVecRef.__mod__ | (self, other) | Create the Z3 expression (signed) mod `self % other`.
Use the function URem() for unsigned remainder, and SRem() for signed remainder.
>>> x = BitVec('x', 32)
>>> y = BitVec('y', 32)
>>> x % y
x%y
>>> (x % y).sort()
BitVec(32)
>>> (x % y).sexpr()
... | Create the Z3 expression (signed) mod `self % other`. | def __mod__(self, other):
"""Create the Z3 expression (signed) mod `self % other`.
Use the function URem() for unsigned remainder, and SRem() for signed remainder.
>>> x = BitVec('x', 32)
>>> y = BitVec('y', 32)
>>> x % y
x%y
>>> (x % y).sort()
BitVec(32... | [
"def",
"__mod__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"BitVecRef",
"(",
"Z3_mk_bvsmod",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"a",
".",
"as_ast",
"(",
")",
",",
... | [
3515,
4
] | [
3534,
88
] | python | en | ['en', 'en', 'en'] | True |
BitVecRef.__rmod__ | (self, other) | Create the Z3 expression (signed) mod `other % self`.
Use the function URem() for unsigned remainder, and SRem() for signed remainder.
>>> x = BitVec('x', 32)
>>> 10 % x
10%x
>>> (10 % x).sexpr()
'(bvsmod #x0000000a x)'
>>> URem(10, x).sexpr()
'(bvurem #... | Create the Z3 expression (signed) mod `other % self`. | def __rmod__(self, other):
"""Create the Z3 expression (signed) mod `other % self`.
Use the function URem() for unsigned remainder, and SRem() for signed remainder.
>>> x = BitVec('x', 32)
>>> 10 % x
10%x
>>> (10 % x).sexpr()
'(bvsmod #x0000000a x)'
>>> ... | [
"def",
"__rmod__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"BitVecRef",
"(",
"Z3_mk_bvsmod",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"b",
".",
"as_ast",
"(",
")",
",",
... | [
3536,
4
] | [
3552,
88
] | python | en | ['en', 'en', 'en'] | True |
BitVecRef.__le__ | (self, other) | Create the Z3 expression (signed) `other <= self`.
Use the function ULE() for unsigned less than or equal to.
>>> x, y = BitVecs('x y', 32)
>>> x <= y
x <= y
>>> (x <= y).sexpr()
'(bvsle x y)'
>>> ULE(x, y).sexpr()
'(bvule x y)'
| Create the Z3 expression (signed) `other <= self`. | def __le__(self, other):
"""Create the Z3 expression (signed) `other <= self`.
Use the function ULE() for unsigned less than or equal to.
>>> x, y = BitVecs('x y', 32)
>>> x <= y
x <= y
>>> (x <= y).sexpr()
'(bvsle x y)'
>>> ULE(x, y).sexpr()
'(b... | [
"def",
"__le__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"BoolRef",
"(",
"Z3_mk_bvsle",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"a",
".",
"as_ast",
"(",
")",
",",
"b"... | [
3554,
4
] | [
3568,
85
] | python | en | ['en', 'en', 'en'] | True |
BitVecRef.__lt__ | (self, other) | Create the Z3 expression (signed) `other < self`.
Use the function ULT() for unsigned less than.
>>> x, y = BitVecs('x y', 32)
>>> x < y
x < y
>>> (x < y).sexpr()
'(bvslt x y)'
>>> ULT(x, y).sexpr()
'(bvult x y)'
| Create the Z3 expression (signed) `other < self`. | def __lt__(self, other):
"""Create the Z3 expression (signed) `other < self`.
Use the function ULT() for unsigned less than.
>>> x, y = BitVecs('x y', 32)
>>> x < y
x < y
>>> (x < y).sexpr()
'(bvslt x y)'
>>> ULT(x, y).sexpr()
'(bvult x y)'
... | [
"def",
"__lt__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"BoolRef",
"(",
"Z3_mk_bvslt",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"a",
".",
"as_ast",
"(",
")",
",",
"b"... | [
3570,
4
] | [
3584,
85
] | python | en | ['en', 'en', 'en'] | True |
BitVecRef.__gt__ | (self, other) | Create the Z3 expression (signed) `other > self`.
Use the function UGT() for unsigned greater than.
>>> x, y = BitVecs('x y', 32)
>>> x > y
x > y
>>> (x > y).sexpr()
'(bvsgt x y)'
>>> UGT(x, y).sexpr()
'(bvugt x y)'
| Create the Z3 expression (signed) `other > self`. | def __gt__(self, other):
"""Create the Z3 expression (signed) `other > self`.
Use the function UGT() for unsigned greater than.
>>> x, y = BitVecs('x y', 32)
>>> x > y
x > y
>>> (x > y).sexpr()
'(bvsgt x y)'
>>> UGT(x, y).sexpr()
'(bvugt x y)'
... | [
"def",
"__gt__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"BoolRef",
"(",
"Z3_mk_bvsgt",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"a",
".",
"as_ast",
"(",
")",
",",
"b"... | [
3586,
4
] | [
3600,
85
] | python | en | ['en', 'en', 'en'] | True |
BitVecRef.__ge__ | (self, other) | Create the Z3 expression (signed) `other >= self`.
Use the function UGE() for unsigned greater than or equal to.
>>> x, y = BitVecs('x y', 32)
>>> x >= y
x >= y
>>> (x >= y).sexpr()
'(bvsge x y)'
>>> UGE(x, y).sexpr()
'(bvuge x y)'
| Create the Z3 expression (signed) `other >= self`. | def __ge__(self, other):
"""Create the Z3 expression (signed) `other >= self`.
Use the function UGE() for unsigned greater than or equal to.
>>> x, y = BitVecs('x y', 32)
>>> x >= y
x >= y
>>> (x >= y).sexpr()
'(bvsge x y)'
>>> UGE(x, y).sexpr()
... | [
"def",
"__ge__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"BoolRef",
"(",
"Z3_mk_bvsge",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"a",
".",
"as_ast",
"(",
")",
",",
"b"... | [
3602,
4
] | [
3616,
85
] | python | en | ['en', 'en', 'en'] | True |
BitVecRef.__rshift__ | (self, other) | Create the Z3 expression (arithmetical) right shift `self >> other`
Use the function LShR() for the right logical shift
>>> x, y = BitVecs('x y', 32)
>>> x >> y
x >> y
>>> (x >> y).sexpr()
'(bvashr x y)'
>>> LShR(x, y).sexpr()
'(bvlshr x y)'
>>> ... | Create the Z3 expression (arithmetical) right shift `self >> other` | def __rshift__(self, other):
"""Create the Z3 expression (arithmetical) right shift `self >> other`
Use the function LShR() for the right logical shift
>>> x, y = BitVecs('x y', 32)
>>> x >> y
x >> y
>>> (x >> y).sexpr()
'(bvashr x y)'
>>> LShR(x, y).sex... | [
"def",
"__rshift__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"BitVecRef",
"(",
"Z3_mk_bvashr",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"a",
".",
"as_ast",
"(",
")",
","... | [
3618,
4
] | [
3646,
88
] | python | en | ['en', 'en', 'en'] | True |
BitVecRef.__lshift__ | (self, other) | Create the Z3 expression left shift `self << other`
>>> x, y = BitVecs('x y', 32)
>>> x << y
x << y
>>> (x << y).sexpr()
'(bvshl x y)'
>>> simplify(BitVecVal(2, 3) << 1)
4
| Create the Z3 expression left shift `self << other` | def __lshift__(self, other):
"""Create the Z3 expression left shift `self << other`
>>> x, y = BitVecs('x y', 32)
>>> x << y
x << y
>>> (x << y).sexpr()
'(bvshl x y)'
>>> simplify(BitVecVal(2, 3) << 1)
4
"""
a, b = _coerce_exprs(self, othe... | [
"def",
"__lshift__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"BitVecRef",
"(",
"Z3_mk_bvshl",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"a",
".",
"as_ast",
"(",
")",
",",... | [
3648,
4
] | [
3660,
87
] | python | en | ['en', 'en', 'en'] | True |
BitVecRef.__rrshift__ | (self, other) | Create the Z3 expression (arithmetical) right shift `other` >> `self`.
Use the function LShR() for the right logical shift
>>> x = BitVec('x', 32)
>>> 10 >> x
10 >> x
>>> (10 >> x).sexpr()
'(bvashr #x0000000a x)'
| Create the Z3 expression (arithmetical) right shift `other` >> `self`. | def __rrshift__(self, other):
"""Create the Z3 expression (arithmetical) right shift `other` >> `self`.
Use the function LShR() for the right logical shift
>>> x = BitVec('x', 32)
>>> 10 >> x
10 >> x
>>> (10 >> x).sexpr()
'(bvashr #x0000000a x)'
"""
... | [
"def",
"__rrshift__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"BitVecRef",
"(",
"Z3_mk_bvashr",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"b",
".",
"as_ast",
"(",
")",
",... | [
3662,
4
] | [
3674,
88
] | python | en | ['en', 'en', 'en'] | True |
Repository.get_release_branches | (self) |
Returns sorted list of tuples:
* remote branch (git.refs.remote.RemoteReference),
* base commit (git.Commit),
* head (git.Commit)).
List is sorted by commits in ascending order.
|
Returns sorted list of tuples:
* remote branch (git.refs.remote.RemoteReference),
* base commit (git.Commit),
* head (git.Commit)).
List is sorted by commits in ascending order.
| def get_release_branches(self):
'''
Returns sorted list of tuples:
* remote branch (git.refs.remote.RemoteReference),
* base commit (git.Commit),
* head (git.Commit)).
List is sorted by commits in ascending order.
'''
release_branches = []
RE_R... | [
"def",
"get_release_branches",
"(",
"self",
")",
":",
"release_branches",
"=",
"[",
"]",
"RE_RELEASE_BRANCH_REF",
"=",
"re",
".",
"compile",
"(",
"r'^refs/remotes/.+/\\d+\\.\\d+$'",
")",
"for",
"branch",
"in",
"[",
"r",
"for",
"r",
"in",
"self",
".",
"_remote"... | [
40,
4
] | [
61,
77
] | python | en | ['en', 'error', 'th'] | False |
BareRepository.get_release_branches | (self) |
Returns sorted list of tuples:
* branch (git.refs.head?),
* base commit (git.Commit),
* head (git.Commit)).
List is sorted by commits in ascending order.
|
Returns sorted list of tuples:
* branch (git.refs.head?),
* base commit (git.Commit),
* head (git.Commit)).
List is sorted by commits in ascending order.
| def get_release_branches(self):
'''
Returns sorted list of tuples:
* branch (git.refs.head?),
* base commit (git.Commit),
* head (git.Commit)).
List is sorted by commits in ascending order.
'''
release_branches = []
RE_RELEASE_BRANCH_REF = re.c... | [
"def",
"get_release_branches",
"(",
"self",
")",
":",
"release_branches",
"=",
"[",
"]",
"RE_RELEASE_BRANCH_REF",
"=",
"re",
".",
"compile",
"(",
"r'^refs/heads/\\d+\\.\\d+$'",
")",
"for",
"branch",
"in",
"[",
"r",
"for",
"r",
"in",
"self",
".",
"_repo",
"."... | [
69,
4
] | [
90,
77
] | python | en | ['en', 'error', 'th'] | False |
instrument_clickhouse_server_log | (self, node=None, test=None,
clickhouse_server_log="/var/log/clickhouse-server/clickhouse-server.log") | Instrument clickhouse-server.log for the current test (default)
by adding start and end messages that include test name to log
of the specified node. If we are in the debug mode and the test
fails then dump the messages from the log for this test.
| Instrument clickhouse-server.log for the current test (default)
by adding start and end messages that include test name to log
of the specified node. If we are in the debug mode and the test
fails then dump the messages from the log for this test.
| def instrument_clickhouse_server_log(self, node=None, test=None,
clickhouse_server_log="/var/log/clickhouse-server/clickhouse-server.log"):
"""Instrument clickhouse-server.log for the current test (default)
by adding start and end messages that include test name to log
of the specified node. If we ... | [
"def",
"instrument_clickhouse_server_log",
"(",
"self",
",",
"node",
"=",
"None",
",",
"test",
"=",
"None",
",",
"clickhouse_server_log",
"=",
"\"/var/log/clickhouse-server/clickhouse-server.log\"",
")",
":",
"if",
"test",
"is",
"None",
":",
"test",
"=",
"current",
... | [
8,
0
] | [
45,
75
] | python | en | ['en', 'da', 'en'] | True |
join | (tasks, timeout=None, polling=5) | Join all parallel tests.
| Join all parallel tests.
| def join(tasks, timeout=None, polling=5):
"""Join all parallel tests.
"""
exc = None
for task in tasks:
task._join_timeout = timeout
while tasks:
try:
try:
tasks[0].get(timeout=polling)
tasks.pop(0)
except PoolTaskTimeoutErro... | [
"def",
"join",
"(",
"tasks",
",",
"timeout",
"=",
"None",
",",
"polling",
"=",
"5",
")",
":",
"exc",
"=",
"None",
"for",
"task",
"in",
"tasks",
":",
"task",
".",
"_join_timeout",
"=",
"timeout",
"while",
"tasks",
":",
"try",
":",
"try",
":",
"tasks... | [
47,
0
] | [
81,
17
] | python | en | ['en', 'en', 'en'] | True |
start | (pool, tasks, scenario, kwargs=None) | Start parallel test.
| Start parallel test.
| def start(pool, tasks, scenario, kwargs=None):
"""Start parallel test.
"""
if kwargs is None:
kwargs = {}
task = pool.apply_async(scenario, [], kwargs)
tasks.append(task)
return task | [
"def",
"start",
"(",
"pool",
",",
"tasks",
",",
"scenario",
",",
"kwargs",
"=",
"None",
")",
":",
"if",
"kwargs",
"is",
"None",
":",
"kwargs",
"=",
"{",
"}",
"task",
"=",
"pool",
".",
"apply_async",
"(",
"scenario",
",",
"[",
"]",
",",
"kwargs",
... | [
83,
0
] | [
92,
15
] | python | en | ['en', 'de', 'en'] | True |
compile | (expr, params=None) |
Force compilation of expression as though it were an expression depending
on BigQuery. Note you can also call expr.compile()
Returns
-------
compiled : string
|
Force compilation of expression as though it were an expression depending
on BigQuery. Note you can also call expr.compile() | def compile(expr, params=None):
"""
Force compilation of expression as though it were an expression depending
on BigQuery. Note you can also call expr.compile()
Returns
-------
compiled : string
"""
from ibis.bigquery.compiler import to_sql
return to_sql(expr, dialect.make_context(p... | [
"def",
"compile",
"(",
"expr",
",",
"params",
"=",
"None",
")",
":",
"from",
"ibis",
".",
"bigquery",
".",
"compiler",
"import",
"to_sql",
"return",
"to_sql",
"(",
"expr",
",",
"dialect",
".",
"make_context",
"(",
"params",
"=",
"params",
")",
")"
] | [
13,
0
] | [
23,
60
] | python | en | ['en', 'error', 'th'] | False |
verify | (expr, params=None) |
Determine if expression can be successfully translated to execute on
BigQuery
|
Determine if expression can be successfully translated to execute on
BigQuery
| def verify(expr, params=None):
"""
Determine if expression can be successfully translated to execute on
BigQuery
"""
try:
compile(expr, params=params)
return True
except com.TranslationError:
return False | [
"def",
"verify",
"(",
"expr",
",",
"params",
"=",
"None",
")",
":",
"try",
":",
"compile",
"(",
"expr",
",",
"params",
"=",
"params",
")",
"return",
"True",
"except",
"com",
".",
"TranslationError",
":",
"return",
"False"
] | [
26,
0
] | [
35,
20
] | python | en | ['en', 'error', 'th'] | False |
connect | (project_id, dataset_id, credentials=None) | Create a BigQueryClient for use with Ibis
Parameters
----------
project_id: str
dataset_id: str
credentials : google.auth.credentials.Credentials, optional, default None
Returns
-------
BigQueryClient
| Create a BigQueryClient for use with Ibis | def connect(project_id, dataset_id, credentials=None):
"""Create a BigQueryClient for use with Ibis
Parameters
----------
project_id: str
dataset_id: str
credentials : google.auth.credentials.Credentials, optional, default None
Returns
-------
BigQueryClient
"""
return Big... | [
"def",
"connect",
"(",
"project_id",
",",
"dataset_id",
",",
"credentials",
"=",
"None",
")",
":",
"return",
"BigQueryClient",
"(",
"project_id",
",",
"dataset_id",
",",
"credentials",
"=",
"credentials",
")"
] | [
38,
0
] | [
52,
74
] | python | en | ['en', 'en', 'en'] | True |
_array_repeat | (t, expr) | Is this really that useful?
Repeat an array like a Python list using modular arithmetic,
scalar subqueries, and PostgreSQL's ARRAY function.
This is inefficient if PostgreSQL allocates memory for the entire sequence
and the output column. A quick glance at PostgreSQL's C code shows the
sequence is... | Is this really that useful? | def _array_repeat(t, expr):
"""Is this really that useful?
Repeat an array like a Python list using modular arithmetic,
scalar subqueries, and PostgreSQL's ARRAY function.
This is inefficient if PostgreSQL allocates memory for the entire sequence
and the output column. A quick glance at PostgreSQL... | [
"def",
"_array_repeat",
"(",
"t",
",",
"expr",
")",
":",
"raw",
",",
"times",
"=",
"map",
"(",
"t",
".",
"translate",
",",
"expr",
".",
"op",
"(",
")",
".",
"args",
")",
"# SQLAlchemy uses our column's table in the FROM clause. We need a simpler",
"# expression ... | [
441,
0
] | [
479,
46
] | python | en | ['en', 'en', 'en'] | True |
non_max_suppression_fast | (boxes, scores, overlap_thresh:float, sort_criterion:str='score') | Possibility to sort boxes by score (default) or area | Possibility to sort boxes by score (default) or area | def non_max_suppression_fast(boxes, scores, overlap_thresh:float, sort_criterion:str='score'):
"Possibility to sort boxes by score (default) or area"
# if there are no boxes, return an empty list
if len(boxes) == 0:
return []
# if the bounding boxes integers, convert them to floats --
# th... | [
"def",
"non_max_suppression_fast",
"(",
"boxes",
",",
"scores",
",",
"overlap_thresh",
":",
"float",
",",
"sort_criterion",
":",
"str",
"=",
"'score'",
")",
":",
"# if there are no boxes, return an empty list",
"if",
"len",
"(",
"boxes",
")",
"==",
"0",
":",
"re... | [
16,
0
] | [
79,
15
] | python | en | ['en', 'en', 'en'] | True |
non_max_suppression_poly | (geoms, scores, overlap_thresh:float, sort_criterion:str='score') | Possibility to sort geoms by score (default) or area | Possibility to sort geoms by score (default) or area | def non_max_suppression_poly(geoms, scores, overlap_thresh:float, sort_criterion:str='score'):
"Possibility to sort geoms by score (default) or area"
# if there are no geoms, return an empty list
if len(geoms) == 0:
return []
# sort prediction by scores,
# initialize the list of picked i... | [
"def",
"non_max_suppression_poly",
"(",
"geoms",
",",
"scores",
",",
"overlap_thresh",
":",
"float",
",",
"sort_criterion",
":",
"str",
"=",
"'score'",
")",
":",
"# if there are no geoms, return an empty list",
"if",
"len",
"(",
"geoms",
")",
"==",
"0",
":",
"re... | [
86,
0
] | [
127,
15
] | python | en | ['en', 'en', 'en'] | True |
fill_holes | (preds:list) | Run `binary_fill_holes` to predicted binary masks | Run `binary_fill_holes` to predicted binary masks | def fill_holes(preds:list) -> list:
"Run `binary_fill_holes` to predicted binary masks"
for i, p in tqdm(enumerate(preds)):
for j in rangeof(p.pred.detection.label_ids):
p_mask = p.pred.detection.mask_array.to_mask(p.height, p.width).data[j]
p.pred.detection.mask_array.data[j] = ... | [
"def",
"fill_holes",
"(",
"preds",
":",
"list",
")",
"->",
"list",
":",
"for",
"i",
",",
"p",
"in",
"tqdm",
"(",
"enumerate",
"(",
"preds",
")",
")",
":",
"for",
"j",
"in",
"rangeof",
"(",
"p",
".",
"pred",
".",
"detection",
".",
"label_ids",
")"... | [
156,
0
] | [
162,
16
] | python | en | ['en', 'fil', 'en'] | True |
dilate_erode | (preds:list) | Run dilation followed by erosion in order to smooth masks | Run dilation followed by erosion in order to smooth masks | def dilate_erode(preds:list) -> list:
"Run dilation followed by erosion in order to smooth masks"
for i, p in tqdm(enumerate(preds)):
for j in rangeof(p.pred.detection.label_ids):
p_mask = p.pred.detection.mask_array.to_mask(p.height, p.width).data[j]
p.pred.detection.mask_array.... | [
"def",
"dilate_erode",
"(",
"preds",
":",
"list",
")",
"->",
"list",
":",
"for",
"i",
",",
"p",
"in",
"tqdm",
"(",
"enumerate",
"(",
"preds",
")",
")",
":",
"for",
"j",
"in",
"rangeof",
"(",
"p",
".",
"pred",
".",
"detection",
".",
"label_ids",
"... | [
164,
0
] | [
170,
16
] | python | en | ['en', 'en', 'en'] | True |
index_cpu_to_gpu_multiple_py | (resources, index, co=None, gpus=None) | builds the C++ vectors for the GPU indices and the
resources. Handles the case where the resources are assigned to
the list of GPUs | builds the C++ vectors for the GPU indices and the
resources. Handles the case where the resources are assigned to
the list of GPUs | def index_cpu_to_gpu_multiple_py(resources, index, co=None, gpus=None):
""" builds the C++ vectors for the GPU indices and the
resources. Handles the case where the resources are assigned to
the list of GPUs """
if gpus is None:
gpus = range(len(resources))
vres = GpuResourcesVector()
vd... | [
"def",
"index_cpu_to_gpu_multiple_py",
"(",
"resources",
",",
"index",
",",
"co",
"=",
"None",
",",
"gpus",
"=",
"None",
")",
":",
"if",
"gpus",
"is",
"None",
":",
"gpus",
"=",
"range",
"(",
"len",
"(",
"resources",
")",
")",
"vres",
"=",
"GpuResources... | [
500,
0
] | [
513,
16
] | python | en | ['en', 'en', 'en'] | True |
index_cpu_to_gpus_list | (index, co=None, gpus=None, ngpu=-1) | Here we can pass list of GPU ids as a parameter or ngpu to
use first n GPU's. gpus mut be a list or None | Here we can pass list of GPU ids as a parameter or ngpu to
use first n GPU's. gpus mut be a list or None | def index_cpu_to_gpus_list(index, co=None, gpus=None, ngpu=-1):
""" Here we can pass list of GPU ids as a parameter or ngpu to
use first n GPU's. gpus mut be a list or None"""
if (gpus is None) and (ngpu == -1): # All blank
gpus = range(get_num_gpus())
elif (gpus is None) and (ngpu != -1): # G... | [
"def",
"index_cpu_to_gpus_list",
"(",
"index",
",",
"co",
"=",
"None",
",",
"gpus",
"=",
"None",
",",
"ngpu",
"=",
"-",
"1",
")",
":",
"if",
"(",
"gpus",
"is",
"None",
")",
"and",
"(",
"ngpu",
"==",
"-",
"1",
")",
":",
"# All blank",
"gpus",
"=",... | [
521,
0
] | [
530,
20
] | python | en | ['en', 'en', 'en'] | True |
vector_to_array | (v) | convert a C++ vector to a numpy array | convert a C++ vector to a numpy array | def vector_to_array(v):
""" convert a C++ vector to a numpy array """
classname = v.__class__.__name__
assert classname.endswith('Vector')
dtype = np.dtype(vector_name_map[classname[:-6]])
a = np.empty(v.size(), dtype=dtype)
if v.size() > 0:
memcpy(swig_ptr(a), v.data(), a.nbytes)
re... | [
"def",
"vector_to_array",
"(",
"v",
")",
":",
"classname",
"=",
"v",
".",
"__class__",
".",
"__name__",
"assert",
"classname",
".",
"endswith",
"(",
"'Vector'",
")",
"dtype",
"=",
"np",
".",
"dtype",
"(",
"vector_name_map",
"[",
"classname",
"[",
":",
"-... | [
548,
0
] | [
556,
12
] | python | ca | ['en', 'ca', 'pt'] | False |
copy_array_to_vector | (a, v) | copy a numpy array to a vector | copy a numpy array to a vector | def copy_array_to_vector(a, v):
""" copy a numpy array to a vector """
n, = a.shape
classname = v.__class__.__name__
assert classname.endswith('Vector')
dtype = np.dtype(vector_name_map[classname[:-6]])
assert dtype == a.dtype, (
'cannot copy a %s array to a %s (should be %s)' % (
... | [
"def",
"copy_array_to_vector",
"(",
"a",
",",
"v",
")",
":",
"n",
",",
"=",
"a",
".",
"shape",
"classname",
"=",
"v",
".",
"__class__",
".",
"__name__",
"assert",
"classname",
".",
"endswith",
"(",
"'Vector'",
")",
"dtype",
"=",
"np",
".",
"dtype",
"... | [
563,
0
] | [
574,
47
] | python | ca | ['en', 'ca', 'pt'] | False |
kmin | (array, k) | return k smallest values (and their indices) of the lines of a
float32 array | return k smallest values (and their indices) of the lines of a
float32 array | def kmin(array, k):
"""return k smallest values (and their indices) of the lines of a
float32 array"""
m, n = array.shape
I = np.zeros((m, k), dtype='int64')
D = np.zeros((m, k), dtype='float32')
ha = float_maxheap_array_t()
ha.ids = swig_ptr(I)
ha.val = swig_ptr(D)
ha.nh = m
ha.... | [
"def",
"kmin",
"(",
"array",
",",
"k",
")",
":",
"m",
",",
"n",
"=",
"array",
".",
"shape",
"I",
"=",
"np",
".",
"zeros",
"(",
"(",
"m",
",",
"k",
")",
",",
"dtype",
"=",
"'int64'",
")",
"D",
"=",
"np",
".",
"zeros",
"(",
"(",
"m",
",",
... | [
581,
0
] | [
595,
15
] | python | en | ['en', 'en', 'en'] | True |
kmax | (array, k) | return k largest values (and their indices) of the lines of a
float32 array | return k largest values (and their indices) of the lines of a
float32 array | def kmax(array, k):
"""return k largest values (and their indices) of the lines of a
float32 array"""
m, n = array.shape
I = np.zeros((m, k), dtype='int64')
D = np.zeros((m, k), dtype='float32')
ha = float_minheap_array_t()
ha.ids = swig_ptr(I)
ha.val = swig_ptr(D)
ha.nh = m
ha.k... | [
"def",
"kmax",
"(",
"array",
",",
"k",
")",
":",
"m",
",",
"n",
"=",
"array",
".",
"shape",
"I",
"=",
"np",
".",
"zeros",
"(",
"(",
"m",
",",
"k",
")",
",",
"dtype",
"=",
"'int64'",
")",
"D",
"=",
"np",
".",
"zeros",
"(",
"(",
"m",
",",
... | [
598,
0
] | [
612,
15
] | python | en | ['en', 'en', 'en'] | True |
pairwise_distances | (xq, xb, mt=METRIC_L2, metric_arg=0) | compute the whole pairwise distance matrix between two sets of
vectors | compute the whole pairwise distance matrix between two sets of
vectors | def pairwise_distances(xq, xb, mt=METRIC_L2, metric_arg=0):
"""compute the whole pairwise distance matrix between two sets of
vectors"""
nq, d = xq.shape
nb, d2 = xb.shape
assert d == d2
dis = np.empty((nq, nb), dtype='float32')
if mt == METRIC_L2:
pairwise_L2sqr(
d, nq, ... | [
"def",
"pairwise_distances",
"(",
"xq",
",",
"xb",
",",
"mt",
"=",
"METRIC_L2",
",",
"metric_arg",
"=",
"0",
")",
":",
"nq",
",",
"d",
"=",
"xq",
".",
"shape",
"nb",
",",
"d2",
"=",
"xb",
".",
"shape",
"assert",
"d",
"==",
"d2",
"dis",
"=",
"np... | [
615,
0
] | [
633,
14
] | python | en | ['en', 'en', 'en'] | True |
eval_intersection | (I1, I2) | size of intersection between each line of two result tables | size of intersection between each line of two result tables | def eval_intersection(I1, I2):
""" size of intersection between each line of two result tables"""
n = I1.shape[0]
assert I2.shape[0] == n
k1, k2 = I1.shape[1], I2.shape[1]
ninter = 0
for i in range(n):
ninter += ranklist_intersection_size(
k1, swig_ptr(I1[i]), k2, swig_ptr(I2... | [
"def",
"eval_intersection",
"(",
"I1",
",",
"I2",
")",
":",
"n",
"=",
"I1",
".",
"shape",
"[",
"0",
"]",
"assert",
"I2",
".",
"shape",
"[",
"0",
"]",
"==",
"n",
"k1",
",",
"k2",
"=",
"I1",
".",
"shape",
"[",
"1",
"]",
",",
"I2",
".",
"shape... | [
660,
0
] | [
669,
17
] | python | en | ['en', 'en', 'en'] | True |
serialize_index | (index) | convert an index to a numpy uint8 array | convert an index to a numpy uint8 array | def serialize_index(index):
""" convert an index to a numpy uint8 array """
writer = VectorIOWriter()
write_index(index, writer)
return vector_to_array(writer.data) | [
"def",
"serialize_index",
"(",
"index",
")",
":",
"writer",
"=",
"VectorIOWriter",
"(",
")",
"write_index",
"(",
"index",
",",
"writer",
")",
"return",
"vector_to_array",
"(",
"writer",
".",
"data",
")"
] | [
758,
0
] | [
762,
39
] | python | en | ['en', 'lb', 'en'] | True |
serialize_index_binary | (index) | convert an index to a numpy uint8 array | convert an index to a numpy uint8 array | def serialize_index_binary(index):
""" convert an index to a numpy uint8 array """
writer = VectorIOWriter()
write_index_binary(index, writer)
return vector_to_array(writer.data) | [
"def",
"serialize_index_binary",
"(",
"index",
")",
":",
"writer",
"=",
"VectorIOWriter",
"(",
")",
"write_index_binary",
"(",
"index",
",",
"writer",
")",
"return",
"vector_to_array",
"(",
"writer",
".",
"data",
")"
] | [
769,
0
] | [
773,
39
] | python | en | ['en', 'lb', 'en'] | True |
Kmeans.__init__ | (self, d, k, **kwargs) | d: input dimension, k: nb of centroids. Additional
parameters are passed on the ClusteringParameters object,
including niter=25, verbose=False, spherical = False
| d: input dimension, k: nb of centroids. Additional
parameters are passed on the ClusteringParameters object,
including niter=25, verbose=False, spherical = False
| def __init__(self, d, k, **kwargs):
"""d: input dimension, k: nb of centroids. Additional
parameters are passed on the ClusteringParameters object,
including niter=25, verbose=False, spherical = False
"""
self.d = d
self.k = k
self.gpu = False
self.cp = ... | [
"def",
"__init__",
"(",
"self",
",",
"d",
",",
"k",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"d",
"=",
"d",
"self",
".",
"k",
"=",
"k",
"self",
".",
"gpu",
"=",
"False",
"self",
".",
"cp",
"=",
"ClusteringParameters",
"(",
")",
"for",
... | [
701,
4
] | [
717,
29
] | python | en | ['en', 'en', 'sw'] | True |
ResultHeap.__init__ | (self, nq, k) | nq: number of query vectors, k: number of results per query | nq: number of query vectors, k: number of results per query | def __init__(self, nq, k):
" nq: number of query vectors, k: number of results per query "
self.I = np.zeros((nq, k), dtype='int64')
self.D = np.zeros((nq, k), dtype='float32')
self.nq, self.k = nq, k
heaps = float_maxheap_array_t()
heaps.k = k
heaps.nh = nq
... | [
"def",
"__init__",
"(",
"self",
",",
"nq",
",",
"k",
")",
":",
"self",
".",
"I",
"=",
"np",
".",
"zeros",
"(",
"(",
"nq",
",",
"k",
")",
",",
"dtype",
"=",
"'int64'",
")",
"self",
".",
"D",
"=",
"np",
".",
"zeros",
"(",
"(",
"nq",
",",
"k... | [
789,
4
] | [
800,
26
] | python | en | ['en', 'en', 'pt'] | True |
ResultHeap.add_result | (self, D, I) | D, I do not need to be in a particular order (heap or sorted) | D, I do not need to be in a particular order (heap or sorted) | def add_result(self, D, I):
"""D, I do not need to be in a particular order (heap or sorted)"""
assert D.shape == (self.nq, self.k)
assert I.shape == (self.nq, self.k)
self.heaps.addn_with_ids(
self.k, faiss.swig_ptr(D),
faiss.swig_ptr(I), self.k) | [
"def",
"add_result",
"(",
"self",
",",
"D",
",",
"I",
")",
":",
"assert",
"D",
".",
"shape",
"==",
"(",
"self",
".",
"nq",
",",
"self",
".",
"k",
")",
"assert",
"I",
".",
"shape",
"==",
"(",
"self",
".",
"nq",
",",
"self",
".",
"k",
")",
"s... | [
802,
4
] | [
808,
38
] | python | en | ['en', 'en', 'en'] | True |
test_pre_execute_basic | (ibis_table, dataframe) |
Test that pre_execute has intercepted execution and provided its own
scope dict
|
Test that pre_execute has intercepted execution and provided its own
scope dict
| def test_pre_execute_basic(ibis_table, dataframe):
"""
Test that pre_execute has intercepted execution and provided its own
scope dict
"""
@pre_execute.register(ops.Node, PandasClient)
def pre_execute_test(op, client, **kwargs):
df = dataframe.assign(plain_int64=dataframe['plain_int64'] ... | [
"def",
"test_pre_execute_basic",
"(",
"ibis_table",
",",
"dataframe",
")",
":",
"@",
"pre_execute",
".",
"register",
"(",
"ops",
".",
"Node",
",",
"PandasClient",
")",
"def",
"pre_execute_test",
"(",
"op",
",",
"client",
",",
"*",
"*",
"kwargs",
")",
":",
... | [
61,
0
] | [
77,
30
] | python | en | ['en', 'error', 'th'] | False |
single_expr_asc | (self) | Check defining of order clause with single expr ASC.
| Check defining of order clause with single expr ASC.
| def single_expr_asc(self):
"""Check defining of order clause with single expr ASC.
"""
expected = convert_output("""
x | s | sum
----+---+-----
1 | a | 2
1 | b | 2
2 | b | 4
""")
execute_query(
"SELECT x,s, sum(x) OVER (ORDER BY x ASC) AS sum FROM values('x Int8,... | [
"def",
"single_expr_asc",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n x | s | sum\n ----+---+-----\n 1 | a | 2\n 1 | b | 2\n 2 | b | 4\n \"\"\"",
")",
"execute_query",
"(",
"\"SELECT x,s, sum(x) OVER (ORDER BY x ASC) AS sum FROM valu... | [
5,
0
] | [
19,
5
] | python | en | ['en', 'en', 'en'] | True |
single_expr_desc | (self) | Check defining of order clause with single expr DESC.
| Check defining of order clause with single expr DESC.
| def single_expr_desc(self):
"""Check defining of order clause with single expr DESC.
"""
expected = convert_output("""
x | s | sum
----+---+-----
2 | b | 2
1 | a | 4
1 | b | 4
""")
execute_query(
"SELECT x,s, sum(x) OVER (ORDER BY x DESC) AS sum FROM values('x In... | [
"def",
"single_expr_desc",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n x | s | sum\n ----+---+-----\n 2 | b | 2\n 1 | a | 4\n 1 | b | 4\n \"\"\"",
")",
"execute_query",
"(",
"\"SELECT x,s, sum(x) OVER (ORDER BY x DESC) AS sum FROM va... | [
22,
0
] | [
36,
5
] | python | en | ['en', 'en', 'en'] | True |
multiple_expr_desc_desc | (self) | Check defining of order clause with multiple exprs.
| Check defining of order clause with multiple exprs.
| def multiple_expr_desc_desc(self):
"""Check defining of order clause with multiple exprs.
"""
expected = convert_output("""
x | s | sum
--+---+----
2 | b | 2
1 | b | 3
1 | a | 4
""")
execute_query(
"SELECT x,s, sum(x) OVER (ORDER BY x DESC, s DESC) AS sum FROM value... | [
"def",
"multiple_expr_desc_desc",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n x | s | sum\n --+---+----\n 2 | b | 2\n 1 | b | 3\n 1 | a | 4\n \"\"\"",
")",
"execute_query",
"(",
"\"SELECT x,s, sum(x) OVER (ORDER BY x DESC, s DESC) AS su... | [
42,
0
] | [
56,
5
] | python | en | ['en', 'en', 'en'] | True |
multiple_expr_asc_asc | (self) | Check defining of order clause with multiple exprs.
| Check defining of order clause with multiple exprs.
| def multiple_expr_asc_asc(self):
"""Check defining of order clause with multiple exprs.
"""
expected = convert_output("""
x | s | sum
----+---+------
1 | a | 1
1 | b | 2
2 | b | 4
""")
execute_query(
"SELECT x,s, sum(x) OVER (ORDER BY x ASC, s ASC) AS sum FROM... | [
"def",
"multiple_expr_asc_asc",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n x | s | sum\n ----+---+------\n 1 | a | 1\n 1 | b | 2\n 2 | b | 4\n \"\"\"",
")",
"execute_query",
"(",
"\"SELECT x,s, sum(x) OVER (ORDER BY x ASC, s ASC)... | [
62,
0
] | [
76,
5
] | python | en | ['en', 'en', 'en'] | True |
multiple_expr_asc_desc | (self) | Check defining of order clause with multiple exprs.
| Check defining of order clause with multiple exprs.
| def multiple_expr_asc_desc(self):
"""Check defining of order clause with multiple exprs.
"""
expected = convert_output("""
x | s | sum
----+---+------
1 | b | 1
1 | a | 2
2 | b | 4
""")
execute_query(
"SELECT x,s, sum(x) OVER (ORDER BY x ASC, s DESC) AS sum... | [
"def",
"multiple_expr_asc_desc",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n x | s | sum\n ----+---+------\n 1 | b | 1\n 1 | a | 2\n 2 | b | 4\n \"\"\"",
")",
"execute_query",
"(",
"\"SELECT x,s, sum(x) OVER (ORDER BY x ASC, s ... | [
82,
0
] | [
96,
5
] | python | en | ['en', 'en', 'en'] | True |
missing_expr_error | (self) | Check that defining of order clause with missing expr returns an error.
| Check that defining of order clause with missing expr returns an error.
| def missing_expr_error(self):
"""Check that defining of order clause with missing expr returns an error.
"""
exitcode = 62
message = "Exception: Syntax error: failed at position"
self.context.node.query("SELECT sum(number) OVER (ORDER BY) FROM numbers(1,3)", exitcode=exitcode, message=message) | [
"def",
"missing_expr_error",
"(",
"self",
")",
":",
"exitcode",
"=",
"62",
"message",
"=",
"\"Exception: Syntax error: failed at position\"",
"self",
".",
"context",
".",
"node",
".",
"query",
"(",
"\"SELECT sum(number) OVER (ORDER BY) FROM numbers(1,3)\"",
",",
"exitcode... | [
102,
0
] | [
108,
119
] | python | en | ['en', 'en', 'en'] | True |
invalid_expr_error | (self) | Check that defining of order clause with invalid expr returns an error.
| Check that defining of order clause with invalid expr returns an error.
| def invalid_expr_error(self):
"""Check that defining of order clause with invalid expr returns an error.
"""
exitcode = 47
message = "Exception: Missing columns: 'foo'"
self.context.node.query("SELECT sum(number) OVER (ORDER BY foo) FROM numbers(1,3)", exitcode=exitcode, message=message) | [
"def",
"invalid_expr_error",
"(",
"self",
")",
":",
"exitcode",
"=",
"47",
"message",
"=",
"\"Exception: Missing columns: 'foo'\"",
"self",
".",
"context",
".",
"node",
".",
"query",
"(",
"\"SELECT sum(number) OVER (ORDER BY foo) FROM numbers(1,3)\"",
",",
"exitcode",
"... | [
114,
0
] | [
120,
123
] | python | en | ['en', 'en', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.