body
stringlengths 26
98.2k
| body_hash
int64 -9,222,864,604,528,158,000
9,221,803,474B
| docstring
stringlengths 1
16.8k
| path
stringlengths 5
230
| name
stringlengths 1
96
| repository_name
stringlengths 7
89
| lang
stringclasses 1
value | body_without_docstring
stringlengths 20
98.2k
|
---|---|---|---|---|---|---|---|
def _invert_complex(f, g_ys, symbol):
'Helper function for _invert.'
if (f == symbol):
return (f, g_ys)
n = Dummy('n')
if f.is_Add:
(g, h) = f.as_independent(symbol)
if (g is not S.Zero):
return _invert_complex(h, imageset(Lambda(n, (n - g)), g_ys), symbol)
if f.is_Mul:
(g, h) = f.as_independent(symbol)
if (g is not S.One):
return _invert_complex(h, imageset(Lambda(n, (n / g)), g_ys), symbol)
if (hasattr(f, 'inverse') and (not isinstance(f, TrigonometricFunction)) and (not isinstance(f, exp))):
if (len(f.args) > 1):
raise ValueError('Only functions with one argument are supported.')
return _invert_complex(f.args[0], imageset(Lambda(n, f.inverse()(n)), g_ys), symbol)
if isinstance(f, exp):
if isinstance(g_ys, FiniteSet):
exp_invs = Union(*[imageset(Lambda(n, ((I * (((2 * n) * pi) + arg(g_y))) + log(Abs(g_y)))), S.Integers) for g_y in g_ys if (g_y != 0)])
return _invert_complex(f.args[0], exp_invs, symbol)
return (f, g_ys) | -3,189,530,294,001,748,500 | Helper function for _invert. | sympy/solvers/solveset.py | _invert_complex | aktech/sympy | python | def _invert_complex(f, g_ys, symbol):
if (f == symbol):
return (f, g_ys)
n = Dummy('n')
if f.is_Add:
(g, h) = f.as_independent(symbol)
if (g is not S.Zero):
return _invert_complex(h, imageset(Lambda(n, (n - g)), g_ys), symbol)
if f.is_Mul:
(g, h) = f.as_independent(symbol)
if (g is not S.One):
return _invert_complex(h, imageset(Lambda(n, (n / g)), g_ys), symbol)
if (hasattr(f, 'inverse') and (not isinstance(f, TrigonometricFunction)) and (not isinstance(f, exp))):
if (len(f.args) > 1):
raise ValueError('Only functions with one argument are supported.')
return _invert_complex(f.args[0], imageset(Lambda(n, f.inverse()(n)), g_ys), symbol)
if isinstance(f, exp):
if isinstance(g_ys, FiniteSet):
exp_invs = Union(*[imageset(Lambda(n, ((I * (((2 * n) * pi) + arg(g_y))) + log(Abs(g_y)))), S.Integers) for g_y in g_ys if (g_y != 0)])
return _invert_complex(f.args[0], exp_invs, symbol)
return (f, g_ys) |
def domain_check(f, symbol, p):
'Returns False if point p is infinite or any subexpression of f\n is infinite or becomes so after replacing symbol with p. If none of\n these conditions is met then True will be returned.\n\n Examples\n ========\n\n >>> from sympy import Mul, oo\n >>> from sympy.abc import x\n >>> from sympy.solvers.solveset import domain_check\n >>> g = 1/(1 + (1/(x + 1))**2)\n >>> domain_check(g, x, -1)\n False\n >>> domain_check(x**2, x, 0)\n True\n >>> domain_check(1/x, x, oo)\n False\n\n * The function relies on the assumption that the original form\n of the equation has not been changed by automatic simplification.\n\n >>> domain_check(x/x, x, 0) # x/x is automatically simplified to 1\n True\n\n * To deal with automatic evaluations use evaluate=False:\n\n >>> domain_check(Mul(x, 1/x, evaluate=False), x, 0)\n False\n '
(f, p) = (sympify(f), sympify(p))
if p.is_infinite:
return False
return _domain_check(f, symbol, p) | -3,833,105,999,056,127,500 | Returns False if point p is infinite or any subexpression of f
is infinite or becomes so after replacing symbol with p. If none of
these conditions is met then True will be returned.
Examples
========
>>> from sympy import Mul, oo
>>> from sympy.abc import x
>>> from sympy.solvers.solveset import domain_check
>>> g = 1/(1 + (1/(x + 1))**2)
>>> domain_check(g, x, -1)
False
>>> domain_check(x**2, x, 0)
True
>>> domain_check(1/x, x, oo)
False
* The function relies on the assumption that the original form
of the equation has not been changed by automatic simplification.
>>> domain_check(x/x, x, 0) # x/x is automatically simplified to 1
True
* To deal with automatic evaluations use evaluate=False:
>>> domain_check(Mul(x, 1/x, evaluate=False), x, 0)
False | sympy/solvers/solveset.py | domain_check | aktech/sympy | python | def domain_check(f, symbol, p):
'Returns False if point p is infinite or any subexpression of f\n is infinite or becomes so after replacing symbol with p. If none of\n these conditions is met then True will be returned.\n\n Examples\n ========\n\n >>> from sympy import Mul, oo\n >>> from sympy.abc import x\n >>> from sympy.solvers.solveset import domain_check\n >>> g = 1/(1 + (1/(x + 1))**2)\n >>> domain_check(g, x, -1)\n False\n >>> domain_check(x**2, x, 0)\n True\n >>> domain_check(1/x, x, oo)\n False\n\n * The function relies on the assumption that the original form\n of the equation has not been changed by automatic simplification.\n\n >>> domain_check(x/x, x, 0) # x/x is automatically simplified to 1\n True\n\n * To deal with automatic evaluations use evaluate=False:\n\n >>> domain_check(Mul(x, 1/x, evaluate=False), x, 0)\n False\n '
(f, p) = (sympify(f), sympify(p))
if p.is_infinite:
return False
return _domain_check(f, symbol, p) |
def _is_finite_with_finite_vars(f, domain=S.Complexes):
"\n Return True if the given expression is finite. For symbols that\n don't assign a value for `complex` and/or `real`, the domain will\n be used to assign a value; symbols that don't assign a value\n for `finite` will be made finite. All other assumptions are\n left unmodified.\n "
def assumptions(s):
A = s.assumptions0
if (A.get('finite', None) is None):
A['finite'] = True
A.setdefault('complex', True)
A.setdefault('real', domain.is_subset(S.Reals))
return A
reps = {s: Dummy(**assumptions(s)) for s in f.free_symbols}
return f.xreplace(reps).is_finite | 995,980,117,664,021,600 | Return True if the given expression is finite. For symbols that
don't assign a value for `complex` and/or `real`, the domain will
be used to assign a value; symbols that don't assign a value
for `finite` will be made finite. All other assumptions are
left unmodified. | sympy/solvers/solveset.py | _is_finite_with_finite_vars | aktech/sympy | python | def _is_finite_with_finite_vars(f, domain=S.Complexes):
"\n Return True if the given expression is finite. For symbols that\n don't assign a value for `complex` and/or `real`, the domain will\n be used to assign a value; symbols that don't assign a value\n for `finite` will be made finite. All other assumptions are\n left unmodified.\n "
def assumptions(s):
A = s.assumptions0
if (A.get('finite', None) is None):
A['finite'] = True
A.setdefault('complex', True)
A.setdefault('real', domain.is_subset(S.Reals))
return A
reps = {s: Dummy(**assumptions(s)) for s in f.free_symbols}
return f.xreplace(reps).is_finite |
def _is_function_class_equation(func_class, f, symbol):
' Tests whether the equation is an equation of the given function class.\n\n The given equation belongs to the given function class if it is\n comprised of functions of the function class which are multiplied by\n or added to expressions independent of the symbol. In addition, the\n arguments of all such functions must be linear in the symbol as well.\n\n Examples\n ========\n\n >>> from sympy.solvers.solveset import _is_function_class_equation\n >>> from sympy import tan, sin, tanh, sinh, exp\n >>> from sympy.abc import x\n >>> from sympy.functions.elementary.trigonometric import (TrigonometricFunction,\n ... HyperbolicFunction)\n >>> _is_function_class_equation(TrigonometricFunction, exp(x) + tan(x), x)\n False\n >>> _is_function_class_equation(TrigonometricFunction, tan(x) + sin(x), x)\n True\n >>> _is_function_class_equation(TrigonometricFunction, tan(x**2), x)\n False\n >>> _is_function_class_equation(TrigonometricFunction, tan(x + 2), x)\n True\n >>> _is_function_class_equation(HyperbolicFunction, tanh(x) + sinh(x), x)\n True\n '
if (f.is_Mul or f.is_Add):
return all((_is_function_class_equation(func_class, arg, symbol) for arg in f.args))
if f.is_Pow:
if (not f.exp.has(symbol)):
return _is_function_class_equation(func_class, f.base, symbol)
else:
return False
if (not f.has(symbol)):
return True
if isinstance(f, func_class):
try:
g = Poly(f.args[0], symbol)
return (g.degree() <= 1)
except PolynomialError:
return False
else:
return False | -4,478,829,296,558,413,000 | Tests whether the equation is an equation of the given function class.
The given equation belongs to the given function class if it is
comprised of functions of the function class which are multiplied by
or added to expressions independent of the symbol. In addition, the
arguments of all such functions must be linear in the symbol as well.
Examples
========
>>> from sympy.solvers.solveset import _is_function_class_equation
>>> from sympy import tan, sin, tanh, sinh, exp
>>> from sympy.abc import x
>>> from sympy.functions.elementary.trigonometric import (TrigonometricFunction,
... HyperbolicFunction)
>>> _is_function_class_equation(TrigonometricFunction, exp(x) + tan(x), x)
False
>>> _is_function_class_equation(TrigonometricFunction, tan(x) + sin(x), x)
True
>>> _is_function_class_equation(TrigonometricFunction, tan(x**2), x)
False
>>> _is_function_class_equation(TrigonometricFunction, tan(x + 2), x)
True
>>> _is_function_class_equation(HyperbolicFunction, tanh(x) + sinh(x), x)
True | sympy/solvers/solveset.py | _is_function_class_equation | aktech/sympy | python | def _is_function_class_equation(func_class, f, symbol):
' Tests whether the equation is an equation of the given function class.\n\n The given equation belongs to the given function class if it is\n comprised of functions of the function class which are multiplied by\n or added to expressions independent of the symbol. In addition, the\n arguments of all such functions must be linear in the symbol as well.\n\n Examples\n ========\n\n >>> from sympy.solvers.solveset import _is_function_class_equation\n >>> from sympy import tan, sin, tanh, sinh, exp\n >>> from sympy.abc import x\n >>> from sympy.functions.elementary.trigonometric import (TrigonometricFunction,\n ... HyperbolicFunction)\n >>> _is_function_class_equation(TrigonometricFunction, exp(x) + tan(x), x)\n False\n >>> _is_function_class_equation(TrigonometricFunction, tan(x) + sin(x), x)\n True\n >>> _is_function_class_equation(TrigonometricFunction, tan(x**2), x)\n False\n >>> _is_function_class_equation(TrigonometricFunction, tan(x + 2), x)\n True\n >>> _is_function_class_equation(HyperbolicFunction, tanh(x) + sinh(x), x)\n True\n '
if (f.is_Mul or f.is_Add):
return all((_is_function_class_equation(func_class, arg, symbol) for arg in f.args))
if f.is_Pow:
if (not f.exp.has(symbol)):
return _is_function_class_equation(func_class, f.base, symbol)
else:
return False
if (not f.has(symbol)):
return True
if isinstance(f, func_class):
try:
g = Poly(f.args[0], symbol)
return (g.degree() <= 1)
except PolynomialError:
return False
else:
return False |
def _solve_as_rational(f, symbol, domain):
' solve rational functions'
f = together(f, deep=True)
(g, h) = fraction(f)
if (not h.has(symbol)):
return _solve_as_poly(g, symbol, domain)
else:
valid_solns = _solveset(g, symbol, domain)
invalid_solns = _solveset(h, symbol, domain)
return (valid_solns - invalid_solns) | 2,026,569,488,700,366,800 | solve rational functions | sympy/solvers/solveset.py | _solve_as_rational | aktech/sympy | python | def _solve_as_rational(f, symbol, domain):
' '
f = together(f, deep=True)
(g, h) = fraction(f)
if (not h.has(symbol)):
return _solve_as_poly(g, symbol, domain)
else:
valid_solns = _solveset(g, symbol, domain)
invalid_solns = _solveset(h, symbol, domain)
return (valid_solns - invalid_solns) |
def _solve_trig(f, symbol, domain):
' Helper to solve trigonometric equations '
f = trigsimp(f)
f_original = f
f = f.rewrite(exp)
f = together(f)
(g, h) = fraction(f)
y = Dummy('y')
(g, h) = (g.expand(), h.expand())
(g, h) = (g.subs(exp((I * symbol)), y), h.subs(exp((I * symbol)), y))
if (g.has(symbol) or h.has(symbol)):
return ConditionSet(symbol, Eq(f, 0), S.Reals)
solns = (solveset_complex(g, y) - solveset_complex(h, y))
if isinstance(solns, FiniteSet):
result = Union(*[invert_complex(exp((I * symbol)), s, symbol)[1] for s in solns])
return Intersection(result, domain)
elif (solns is S.EmptySet):
return S.EmptySet
else:
return ConditionSet(symbol, Eq(f_original, 0), S.Reals) | -5,411,093,422,298,752,000 | Helper to solve trigonometric equations | sympy/solvers/solveset.py | _solve_trig | aktech/sympy | python | def _solve_trig(f, symbol, domain):
' '
f = trigsimp(f)
f_original = f
f = f.rewrite(exp)
f = together(f)
(g, h) = fraction(f)
y = Dummy('y')
(g, h) = (g.expand(), h.expand())
(g, h) = (g.subs(exp((I * symbol)), y), h.subs(exp((I * symbol)), y))
if (g.has(symbol) or h.has(symbol)):
return ConditionSet(symbol, Eq(f, 0), S.Reals)
solns = (solveset_complex(g, y) - solveset_complex(h, y))
if isinstance(solns, FiniteSet):
result = Union(*[invert_complex(exp((I * symbol)), s, symbol)[1] for s in solns])
return Intersection(result, domain)
elif (solns is S.EmptySet):
return S.EmptySet
else:
return ConditionSet(symbol, Eq(f_original, 0), S.Reals) |
def _solve_as_poly(f, symbol, domain=S.Complexes):
'\n Solve the equation using polynomial techniques if it already is a\n polynomial equation or, with a change of variables, can be made so.\n '
result = None
if f.is_polynomial(symbol):
solns = roots(f, symbol, cubics=True, quartics=True, quintics=True, domain='EX')
num_roots = sum(solns.values())
if (degree(f, symbol) <= num_roots):
result = FiniteSet(*solns.keys())
else:
poly = Poly(f, symbol)
solns = poly.all_roots()
if (poly.degree() <= len(solns)):
result = FiniteSet(*solns)
else:
result = ConditionSet(symbol, Eq(f, 0), domain)
else:
poly = Poly(f)
if (poly is None):
result = ConditionSet(symbol, Eq(f, 0), domain)
gens = [g for g in poly.gens if g.has(symbol)]
if (len(gens) == 1):
poly = Poly(poly, gens[0])
gen = poly.gen
deg = poly.degree()
poly = Poly(poly.as_expr(), poly.gen, composite=True)
poly_solns = FiniteSet(*roots(poly, cubics=True, quartics=True, quintics=True).keys())
if (len(poly_solns) < deg):
result = ConditionSet(symbol, Eq(f, 0), domain)
if (gen != symbol):
y = Dummy('y')
inverter = (invert_real if domain.is_subset(S.Reals) else invert_complex)
(lhs, rhs_s) = inverter(gen, y, symbol)
if (lhs == symbol):
result = Union(*[rhs_s.subs(y, s) for s in poly_solns])
else:
result = ConditionSet(symbol, Eq(f, 0), domain)
else:
result = ConditionSet(symbol, Eq(f, 0), domain)
if (result is not None):
if isinstance(result, FiniteSet):
if all([((s.free_symbols == set()) and (not isinstance(s, RootOf))) for s in result]):
s = Dummy('s')
result = imageset(Lambda(s, expand_complex(s)), result)
if isinstance(result, FiniteSet):
result = result.intersection(domain)
return result
else:
return ConditionSet(symbol, Eq(f, 0), domain) | -4,573,146,541,065,318,000 | Solve the equation using polynomial techniques if it already is a
polynomial equation or, with a change of variables, can be made so. | sympy/solvers/solveset.py | _solve_as_poly | aktech/sympy | python | def _solve_as_poly(f, symbol, domain=S.Complexes):
'\n Solve the equation using polynomial techniques if it already is a\n polynomial equation or, with a change of variables, can be made so.\n '
result = None
if f.is_polynomial(symbol):
solns = roots(f, symbol, cubics=True, quartics=True, quintics=True, domain='EX')
num_roots = sum(solns.values())
if (degree(f, symbol) <= num_roots):
result = FiniteSet(*solns.keys())
else:
poly = Poly(f, symbol)
solns = poly.all_roots()
if (poly.degree() <= len(solns)):
result = FiniteSet(*solns)
else:
result = ConditionSet(symbol, Eq(f, 0), domain)
else:
poly = Poly(f)
if (poly is None):
result = ConditionSet(symbol, Eq(f, 0), domain)
gens = [g for g in poly.gens if g.has(symbol)]
if (len(gens) == 1):
poly = Poly(poly, gens[0])
gen = poly.gen
deg = poly.degree()
poly = Poly(poly.as_expr(), poly.gen, composite=True)
poly_solns = FiniteSet(*roots(poly, cubics=True, quartics=True, quintics=True).keys())
if (len(poly_solns) < deg):
result = ConditionSet(symbol, Eq(f, 0), domain)
if (gen != symbol):
y = Dummy('y')
inverter = (invert_real if domain.is_subset(S.Reals) else invert_complex)
(lhs, rhs_s) = inverter(gen, y, symbol)
if (lhs == symbol):
result = Union(*[rhs_s.subs(y, s) for s in poly_solns])
else:
result = ConditionSet(symbol, Eq(f, 0), domain)
else:
result = ConditionSet(symbol, Eq(f, 0), domain)
if (result is not None):
if isinstance(result, FiniteSet):
if all([((s.free_symbols == set()) and (not isinstance(s, RootOf))) for s in result]):
s = Dummy('s')
result = imageset(Lambda(s, expand_complex(s)), result)
if isinstance(result, FiniteSet):
result = result.intersection(domain)
return result
else:
return ConditionSet(symbol, Eq(f, 0), domain) |
def _has_rational_power(expr, symbol):
"\n Returns (bool, den) where bool is True if the term has a\n non-integer rational power and den is the denominator of the\n expression's exponent.\n\n Examples\n ========\n\n >>> from sympy.solvers.solveset import _has_rational_power\n >>> from sympy import sqrt\n >>> from sympy.abc import x\n >>> _has_rational_power(sqrt(x), x)\n (True, 2)\n >>> _has_rational_power(x**2, x)\n (False, 1)\n "
(a, p, q) = (Wild('a'), Wild('p'), Wild('q'))
pattern_match = (expr.match((a * (p ** q))) or {})
if (pattern_match.get(a, S.Zero) is S.Zero):
return (False, S.One)
elif (p not in pattern_match.keys()):
return (False, S.One)
elif (isinstance(pattern_match[q], Rational) and pattern_match[p].has(symbol)):
if (not (pattern_match[q].q == S.One)):
return (True, pattern_match[q].q)
if ((not isinstance(pattern_match[a], Pow)) or isinstance(pattern_match[a], Mul)):
return (False, S.One)
else:
return _has_rational_power(pattern_match[a], symbol) | -2,331,732,730,696,701,000 | Returns (bool, den) where bool is True if the term has a
non-integer rational power and den is the denominator of the
expression's exponent.
Examples
========
>>> from sympy.solvers.solveset import _has_rational_power
>>> from sympy import sqrt
>>> from sympy.abc import x
>>> _has_rational_power(sqrt(x), x)
(True, 2)
>>> _has_rational_power(x**2, x)
(False, 1) | sympy/solvers/solveset.py | _has_rational_power | aktech/sympy | python | def _has_rational_power(expr, symbol):
"\n Returns (bool, den) where bool is True if the term has a\n non-integer rational power and den is the denominator of the\n expression's exponent.\n\n Examples\n ========\n\n >>> from sympy.solvers.solveset import _has_rational_power\n >>> from sympy import sqrt\n >>> from sympy.abc import x\n >>> _has_rational_power(sqrt(x), x)\n (True, 2)\n >>> _has_rational_power(x**2, x)\n (False, 1)\n "
(a, p, q) = (Wild('a'), Wild('p'), Wild('q'))
pattern_match = (expr.match((a * (p ** q))) or {})
if (pattern_match.get(a, S.Zero) is S.Zero):
return (False, S.One)
elif (p not in pattern_match.keys()):
return (False, S.One)
elif (isinstance(pattern_match[q], Rational) and pattern_match[p].has(symbol)):
if (not (pattern_match[q].q == S.One)):
return (True, pattern_match[q].q)
if ((not isinstance(pattern_match[a], Pow)) or isinstance(pattern_match[a], Mul)):
return (False, S.One)
else:
return _has_rational_power(pattern_match[a], symbol) |
def _solve_radical(f, symbol, solveset_solver):
' Helper function to solve equations with radicals '
(eq, cov) = unrad(f)
if (not cov):
result = (solveset_solver(eq, symbol) - Union(*[solveset_solver(g, symbol) for g in denoms(f, [symbol])]))
else:
(y, yeq) = cov
if (not solveset_solver((y - I), y)):
yreal = Dummy('yreal', real=True)
yeq = yeq.xreplace({y: yreal})
eq = eq.xreplace({y: yreal})
y = yreal
g_y_s = solveset_solver(yeq, symbol)
f_y_sols = solveset_solver(eq, y)
result = Union(*[imageset(Lambda(y, g_y), f_y_sols) for g_y in g_y_s])
if isinstance(result, Complement):
solution_set = result
else:
f_set = []
c_set = []
for s in result:
if checksol(f, symbol, s):
f_set.append(s)
else:
c_set.append(s)
solution_set = (FiniteSet(*f_set) + ConditionSet(symbol, Eq(f, 0), FiniteSet(*c_set)))
return solution_set | -1,662,945,041,287,894,300 | Helper function to solve equations with radicals | sympy/solvers/solveset.py | _solve_radical | aktech/sympy | python | def _solve_radical(f, symbol, solveset_solver):
' '
(eq, cov) = unrad(f)
if (not cov):
result = (solveset_solver(eq, symbol) - Union(*[solveset_solver(g, symbol) for g in denoms(f, [symbol])]))
else:
(y, yeq) = cov
if (not solveset_solver((y - I), y)):
yreal = Dummy('yreal', real=True)
yeq = yeq.xreplace({y: yreal})
eq = eq.xreplace({y: yreal})
y = yreal
g_y_s = solveset_solver(yeq, symbol)
f_y_sols = solveset_solver(eq, y)
result = Union(*[imageset(Lambda(y, g_y), f_y_sols) for g_y in g_y_s])
if isinstance(result, Complement):
solution_set = result
else:
f_set = []
c_set = []
for s in result:
if checksol(f, symbol, s):
f_set.append(s)
else:
c_set.append(s)
solution_set = (FiniteSet(*f_set) + ConditionSet(symbol, Eq(f, 0), FiniteSet(*c_set)))
return solution_set |
def _solve_abs(f, symbol, domain):
' Helper function to solve equation involving absolute value function '
if (not domain.is_subset(S.Reals)):
raise ValueError(filldedent('\n Absolute values cannot be inverted in the\n complex domain.'))
(p, q, r) = (Wild('p'), Wild('q'), Wild('r'))
pattern_match = (f.match(((p * Abs(q)) + r)) or {})
if (not pattern_match.get(p, S.Zero).is_zero):
(f_p, f_q, f_r) = (pattern_match[p], pattern_match[q], pattern_match[r])
q_pos_cond = solve_univariate_inequality((f_q >= 0), symbol, relational=False)
q_neg_cond = solve_univariate_inequality((f_q < 0), symbol, relational=False)
sols_q_pos = solveset_real(((f_p * f_q) + f_r), symbol).intersect(q_pos_cond)
sols_q_neg = solveset_real(((f_p * (- f_q)) + f_r), symbol).intersect(q_neg_cond)
return Union(sols_q_pos, sols_q_neg)
else:
return ConditionSet(symbol, Eq(f, 0), domain) | -2,798,441,721,755,541,000 | Helper function to solve equation involving absolute value function | sympy/solvers/solveset.py | _solve_abs | aktech/sympy | python | def _solve_abs(f, symbol, domain):
' '
if (not domain.is_subset(S.Reals)):
raise ValueError(filldedent('\n Absolute values cannot be inverted in the\n complex domain.'))
(p, q, r) = (Wild('p'), Wild('q'), Wild('r'))
pattern_match = (f.match(((p * Abs(q)) + r)) or {})
if (not pattern_match.get(p, S.Zero).is_zero):
(f_p, f_q, f_r) = (pattern_match[p], pattern_match[q], pattern_match[r])
q_pos_cond = solve_univariate_inequality((f_q >= 0), symbol, relational=False)
q_neg_cond = solve_univariate_inequality((f_q < 0), symbol, relational=False)
sols_q_pos = solveset_real(((f_p * f_q) + f_r), symbol).intersect(q_pos_cond)
sols_q_neg = solveset_real(((f_p * (- f_q)) + f_r), symbol).intersect(q_neg_cond)
return Union(sols_q_pos, sols_q_neg)
else:
return ConditionSet(symbol, Eq(f, 0), domain) |
def solve_decomposition(f, symbol, domain):
'\n Function to solve equations via the principle of "Decomposition\n and Rewriting".\n\n Examples\n ========\n >>> from sympy import exp, sin, Symbol, pprint, S\n >>> from sympy.solvers.solveset import solve_decomposition as sd\n >>> x = Symbol(\'x\')\n >>> f1 = exp(2*x) - 3*exp(x) + 2\n >>> sd(f1, x, S.Reals)\n {0, log(2)}\n >>> f2 = sin(x)**2 + 2*sin(x) + 1\n >>> pprint(sd(f2, x, S.Reals), use_unicode=False)\n 3*pi\n {2*n*pi + ---- | n in Integers()}\n 2\n >>> f3 = sin(x + 2)\n >>> pprint(sd(f3, x, S.Reals), use_unicode=False)\n {2*n*pi - 2 | n in Integers()} U {pi*(2*n + 1) - 2 | n in Integers()}\n\n '
from sympy.solvers.decompogen import decompogen
from sympy.calculus.util import function_range
g_s = decompogen(f, symbol)
y_s = FiniteSet(0)
for g in g_s:
frange = function_range(g, symbol, domain)
y_s = Intersection(frange, y_s)
result = S.EmptySet
if isinstance(y_s, FiniteSet):
for y in y_s:
solutions = solveset(Eq(g, y), symbol, domain)
if (not isinstance(solutions, ConditionSet)):
result += solutions
else:
if isinstance(y_s, ImageSet):
iter_iset = (y_s,)
elif isinstance(y_s, Union):
iter_iset = y_s.args
for iset in iter_iset:
new_solutions = solveset(Eq(iset.lamda.expr, g), symbol, domain)
dummy_var = tuple(iset.lamda.expr.free_symbols)[0]
base_set = iset.base_set
if isinstance(new_solutions, FiniteSet):
new_exprs = new_solutions
elif isinstance(new_solutions, Intersection):
if isinstance(new_solutions.args[1], FiniteSet):
new_exprs = new_solutions.args[1]
for new_expr in new_exprs:
result += ImageSet(Lambda(dummy_var, new_expr), base_set)
if (result is S.EmptySet):
return ConditionSet(symbol, Eq(f, 0), domain)
y_s = result
return y_s | 997,600,514,692,112,900 | Function to solve equations via the principle of "Decomposition
and Rewriting".
Examples
========
>>> from sympy import exp, sin, Symbol, pprint, S
>>> from sympy.solvers.solveset import solve_decomposition as sd
>>> x = Symbol('x')
>>> f1 = exp(2*x) - 3*exp(x) + 2
>>> sd(f1, x, S.Reals)
{0, log(2)}
>>> f2 = sin(x)**2 + 2*sin(x) + 1
>>> pprint(sd(f2, x, S.Reals), use_unicode=False)
3*pi
{2*n*pi + ---- | n in Integers()}
2
>>> f3 = sin(x + 2)
>>> pprint(sd(f3, x, S.Reals), use_unicode=False)
{2*n*pi - 2 | n in Integers()} U {pi*(2*n + 1) - 2 | n in Integers()} | sympy/solvers/solveset.py | solve_decomposition | aktech/sympy | python | def solve_decomposition(f, symbol, domain):
'\n Function to solve equations via the principle of "Decomposition\n and Rewriting".\n\n Examples\n ========\n >>> from sympy import exp, sin, Symbol, pprint, S\n >>> from sympy.solvers.solveset import solve_decomposition as sd\n >>> x = Symbol(\'x\')\n >>> f1 = exp(2*x) - 3*exp(x) + 2\n >>> sd(f1, x, S.Reals)\n {0, log(2)}\n >>> f2 = sin(x)**2 + 2*sin(x) + 1\n >>> pprint(sd(f2, x, S.Reals), use_unicode=False)\n 3*pi\n {2*n*pi + ---- | n in Integers()}\n 2\n >>> f3 = sin(x + 2)\n >>> pprint(sd(f3, x, S.Reals), use_unicode=False)\n {2*n*pi - 2 | n in Integers()} U {pi*(2*n + 1) - 2 | n in Integers()}\n\n '
from sympy.solvers.decompogen import decompogen
from sympy.calculus.util import function_range
g_s = decompogen(f, symbol)
y_s = FiniteSet(0)
for g in g_s:
frange = function_range(g, symbol, domain)
y_s = Intersection(frange, y_s)
result = S.EmptySet
if isinstance(y_s, FiniteSet):
for y in y_s:
solutions = solveset(Eq(g, y), symbol, domain)
if (not isinstance(solutions, ConditionSet)):
result += solutions
else:
if isinstance(y_s, ImageSet):
iter_iset = (y_s,)
elif isinstance(y_s, Union):
iter_iset = y_s.args
for iset in iter_iset:
new_solutions = solveset(Eq(iset.lamda.expr, g), symbol, domain)
dummy_var = tuple(iset.lamda.expr.free_symbols)[0]
base_set = iset.base_set
if isinstance(new_solutions, FiniteSet):
new_exprs = new_solutions
elif isinstance(new_solutions, Intersection):
if isinstance(new_solutions.args[1], FiniteSet):
new_exprs = new_solutions.args[1]
for new_expr in new_exprs:
result += ImageSet(Lambda(dummy_var, new_expr), base_set)
if (result is S.EmptySet):
return ConditionSet(symbol, Eq(f, 0), domain)
y_s = result
return y_s |
def _solveset(f, symbol, domain, _check=False):
"Helper for solveset to return a result from an expression\n that has already been sympify'ed and is known to contain the\n given symbol."
from sympy.simplify.simplify import signsimp
orig_f = f
f = together(f)
if f.is_Mul:
(_, f) = f.as_independent(symbol, as_Add=False)
if f.is_Add:
(a, h) = f.as_independent(symbol)
(m, h) = h.as_independent(symbol, as_Add=False)
f = ((a / m) + h)
f = piecewise_fold(f)
solver = (lambda f, x, domain=domain: _solveset(f, x, domain))
if domain.is_subset(S.Reals):
inverter_func = invert_real
else:
inverter_func = invert_complex
inverter = (lambda f, rhs, symbol: inverter_func(f, rhs, symbol, domain))
result = EmptySet()
if f.expand().is_zero:
return domain
elif (not f.has(symbol)):
return EmptySet()
elif (f.is_Mul and all((_is_finite_with_finite_vars(m, domain) for m in f.args))):
result = Union(*[solver(m, symbol) for m in f.args])
elif (_is_function_class_equation(TrigonometricFunction, f, symbol) or _is_function_class_equation(HyperbolicFunction, f, symbol)):
result = _solve_trig(f, symbol, domain)
elif f.is_Piecewise:
dom = domain
result = EmptySet()
expr_set_pairs = f.as_expr_set_pairs()
for (expr, in_set) in expr_set_pairs:
if in_set.is_Relational:
in_set = in_set.as_set()
if in_set.is_Interval:
dom -= in_set
solns = solver(expr, symbol, in_set)
result += solns
else:
(lhs, rhs_s) = inverter(f, 0, symbol)
if (lhs == symbol):
if isinstance(rhs_s, FiniteSet):
rhs_s = FiniteSet(*[Mul(*signsimp(i).as_content_primitive()) for i in rhs_s])
result = rhs_s
elif isinstance(rhs_s, FiniteSet):
for equation in [(lhs - rhs) for rhs in rhs_s]:
if (equation == f):
if (any((_has_rational_power(g, symbol)[0] for g in equation.args)) or _has_rational_power(equation, symbol)[0]):
result += _solve_radical(equation, symbol, solver)
elif equation.has(Abs):
result += _solve_abs(f, symbol, domain)
else:
result += _solve_as_rational(equation, symbol, domain)
else:
result += solver(equation, symbol)
elif (rhs_s is not S.EmptySet):
result = ConditionSet(symbol, Eq(f, 0), domain)
if _check:
if isinstance(result, ConditionSet):
return result
fx = orig_f.as_independent(symbol, as_Add=True)[1]
fx = fx.as_independent(symbol, as_Add=False)[1]
if isinstance(result, FiniteSet):
result = FiniteSet(*[s for s in result if (isinstance(s, RootOf) or domain_check(fx, symbol, s))])
return result | -617,146,554,266,846,500 | Helper for solveset to return a result from an expression
that has already been sympify'ed and is known to contain the
given symbol. | sympy/solvers/solveset.py | _solveset | aktech/sympy | python | def _solveset(f, symbol, domain, _check=False):
"Helper for solveset to return a result from an expression\n that has already been sympify'ed and is known to contain the\n given symbol."
from sympy.simplify.simplify import signsimp
orig_f = f
f = together(f)
if f.is_Mul:
(_, f) = f.as_independent(symbol, as_Add=False)
if f.is_Add:
(a, h) = f.as_independent(symbol)
(m, h) = h.as_independent(symbol, as_Add=False)
f = ((a / m) + h)
f = piecewise_fold(f)
solver = (lambda f, x, domain=domain: _solveset(f, x, domain))
if domain.is_subset(S.Reals):
inverter_func = invert_real
else:
inverter_func = invert_complex
inverter = (lambda f, rhs, symbol: inverter_func(f, rhs, symbol, domain))
result = EmptySet()
if f.expand().is_zero:
return domain
elif (not f.has(symbol)):
return EmptySet()
elif (f.is_Mul and all((_is_finite_with_finite_vars(m, domain) for m in f.args))):
result = Union(*[solver(m, symbol) for m in f.args])
elif (_is_function_class_equation(TrigonometricFunction, f, symbol) or _is_function_class_equation(HyperbolicFunction, f, symbol)):
result = _solve_trig(f, symbol, domain)
elif f.is_Piecewise:
dom = domain
result = EmptySet()
expr_set_pairs = f.as_expr_set_pairs()
for (expr, in_set) in expr_set_pairs:
if in_set.is_Relational:
in_set = in_set.as_set()
if in_set.is_Interval:
dom -= in_set
solns = solver(expr, symbol, in_set)
result += solns
else:
(lhs, rhs_s) = inverter(f, 0, symbol)
if (lhs == symbol):
if isinstance(rhs_s, FiniteSet):
rhs_s = FiniteSet(*[Mul(*signsimp(i).as_content_primitive()) for i in rhs_s])
result = rhs_s
elif isinstance(rhs_s, FiniteSet):
for equation in [(lhs - rhs) for rhs in rhs_s]:
if (equation == f):
if (any((_has_rational_power(g, symbol)[0] for g in equation.args)) or _has_rational_power(equation, symbol)[0]):
result += _solve_radical(equation, symbol, solver)
elif equation.has(Abs):
result += _solve_abs(f, symbol, domain)
else:
result += _solve_as_rational(equation, symbol, domain)
else:
result += solver(equation, symbol)
elif (rhs_s is not S.EmptySet):
result = ConditionSet(symbol, Eq(f, 0), domain)
if _check:
if isinstance(result, ConditionSet):
return result
fx = orig_f.as_independent(symbol, as_Add=True)[1]
fx = fx.as_independent(symbol, as_Add=False)[1]
if isinstance(result, FiniteSet):
result = FiniteSet(*[s for s in result if (isinstance(s, RootOf) or domain_check(fx, symbol, s))])
return result |
def solveset(f, symbol=None, domain=S.Complexes):
"Solves a given inequality or equation with set as output\n\n Parameters\n ==========\n\n f : Expr or a relational.\n The target equation or inequality\n symbol : Symbol\n The variable for which the equation is solved\n domain : Set\n The domain over which the equation is solved\n\n Returns\n =======\n\n Set\n A set of values for `symbol` for which `f` is True or is equal to\n zero. An `EmptySet` is returned if `f` is False or nonzero.\n A `ConditionSet` is returned as unsolved object if algorithms\n to evaluate complete solution are not yet implemented.\n\n `solveset` claims to be complete in the solution set that it returns.\n\n Raises\n ======\n\n NotImplementedError\n The algorithms to solve inequalities in complex domain are\n not yet implemented.\n ValueError\n The input is not valid.\n RuntimeError\n It is a bug, please report to the github issue tracker.\n\n\n Notes\n =====\n\n Python interprets 0 and 1 as False and True, respectively, but\n in this function they refer to solutions of an expression. So 0 and 1\n return the Domain and EmptySet, respectively, while True and False\n return the opposite (as they are assumed to be solutions of relational\n expressions).\n\n\n See Also\n ========\n\n solveset_real: solver for real domain\n solveset_complex: solver for complex domain\n\n Examples\n ========\n\n >>> from sympy import exp, sin, Symbol, pprint, S\n >>> from sympy.solvers.solveset import solveset, solveset_real\n\n * The default domain is complex. Not specifying a domain will lead\n to the solving of the equation in the complex domain (and this\n is not affected by the assumptions on the symbol):\n\n >>> x = Symbol('x')\n >>> pprint(solveset(exp(x) - 1, x), use_unicode=False)\n {2*n*I*pi | n in Integers()}\n\n >>> x = Symbol('x', real=True)\n >>> pprint(solveset(exp(x) - 1, x), use_unicode=False)\n {2*n*I*pi | n in Integers()}\n\n * If you want to use `solveset` to solve the equation in the\n real domain, provide a real domain. (Using `solveset\\_real`\n does this automatically.)\n\n >>> R = S.Reals\n >>> x = Symbol('x')\n >>> solveset(exp(x) - 1, x, R)\n {0}\n >>> solveset_real(exp(x) - 1, x)\n {0}\n\n The solution is mostly unaffected by assumptions on the symbol,\n but there may be some slight difference:\n\n >>> pprint(solveset(sin(x)/x,x), use_unicode=False)\n ({2*n*pi | n in Integers()} \\ {0}) U ({2*n*pi + pi | n in Integers()} \\ {0})\n\n >>> p = Symbol('p', positive=True)\n >>> pprint(solveset(sin(p)/p, p), use_unicode=False)\n {2*n*pi | n in Integers()} U {2*n*pi + pi | n in Integers()}\n\n * Inequalities can be solved over the real domain only. Use of a complex\n domain leads to a NotImplementedError.\n\n >>> solveset(exp(x) > 1, x, R)\n (0, oo)\n\n "
f = sympify(f)
if (f is S.true):
return domain
if (f is S.false):
return S.EmptySet
if (not isinstance(f, (Expr, Number))):
raise ValueError(('%s is not a valid SymPy expression' % f))
free_symbols = f.free_symbols
if (not free_symbols):
b = Eq(f, 0)
if (b is S.true):
return domain
elif (b is S.false):
return S.EmptySet
else:
raise NotImplementedError(filldedent(('\n relationship between value and 0 is unknown: %s' % b)))
if (symbol is None):
if (len(free_symbols) == 1):
symbol = free_symbols.pop()
else:
raise ValueError(filldedent('\n The independent variable must be specified for a\n multivariate equation.'))
elif (not getattr(symbol, 'is_Symbol', False)):
raise ValueError(('A Symbol must be given, not type %s: %s' % (type(symbol), symbol)))
if isinstance(f, Eq):
from sympy.core import Add
f = Add(f.lhs, (- f.rhs), evaluate=False)
elif f.is_Relational:
if (not domain.is_subset(S.Reals)):
raise NotImplementedError(filldedent('\n Inequalities in the complex domain are\n not supported. Try the real domain by\n setting domain=S.Reals'))
try:
result = (solve_univariate_inequality(f, symbol, relational=False) - _invalid_solutions(f, symbol, domain))
except NotImplementedError:
result = ConditionSet(symbol, f, domain)
return result
return _solveset(f, symbol, domain, _check=True) | -4,553,008,390,556,071,400 | Solves a given inequality or equation with set as output
Parameters
==========
f : Expr or a relational.
The target equation or inequality
symbol : Symbol
The variable for which the equation is solved
domain : Set
The domain over which the equation is solved
Returns
=======
Set
A set of values for `symbol` for which `f` is True or is equal to
zero. An `EmptySet` is returned if `f` is False or nonzero.
A `ConditionSet` is returned as unsolved object if algorithms
to evaluate complete solution are not yet implemented.
`solveset` claims to be complete in the solution set that it returns.
Raises
======
NotImplementedError
The algorithms to solve inequalities in complex domain are
not yet implemented.
ValueError
The input is not valid.
RuntimeError
It is a bug, please report to the github issue tracker.
Notes
=====
Python interprets 0 and 1 as False and True, respectively, but
in this function they refer to solutions of an expression. So 0 and 1
return the Domain and EmptySet, respectively, while True and False
return the opposite (as they are assumed to be solutions of relational
expressions).
See Also
========
solveset_real: solver for real domain
solveset_complex: solver for complex domain
Examples
========
>>> from sympy import exp, sin, Symbol, pprint, S
>>> from sympy.solvers.solveset import solveset, solveset_real
* The default domain is complex. Not specifying a domain will lead
to the solving of the equation in the complex domain (and this
is not affected by the assumptions on the symbol):
>>> x = Symbol('x')
>>> pprint(solveset(exp(x) - 1, x), use_unicode=False)
{2*n*I*pi | n in Integers()}
>>> x = Symbol('x', real=True)
>>> pprint(solveset(exp(x) - 1, x), use_unicode=False)
{2*n*I*pi | n in Integers()}
* If you want to use `solveset` to solve the equation in the
real domain, provide a real domain. (Using `solveset\_real`
does this automatically.)
>>> R = S.Reals
>>> x = Symbol('x')
>>> solveset(exp(x) - 1, x, R)
{0}
>>> solveset_real(exp(x) - 1, x)
{0}
The solution is mostly unaffected by assumptions on the symbol,
but there may be some slight difference:
>>> pprint(solveset(sin(x)/x,x), use_unicode=False)
({2*n*pi | n in Integers()} \ {0}) U ({2*n*pi + pi | n in Integers()} \ {0})
>>> p = Symbol('p', positive=True)
>>> pprint(solveset(sin(p)/p, p), use_unicode=False)
{2*n*pi | n in Integers()} U {2*n*pi + pi | n in Integers()}
* Inequalities can be solved over the real domain only. Use of a complex
domain leads to a NotImplementedError.
>>> solveset(exp(x) > 1, x, R)
(0, oo) | sympy/solvers/solveset.py | solveset | aktech/sympy | python | def solveset(f, symbol=None, domain=S.Complexes):
"Solves a given inequality or equation with set as output\n\n Parameters\n ==========\n\n f : Expr or a relational.\n The target equation or inequality\n symbol : Symbol\n The variable for which the equation is solved\n domain : Set\n The domain over which the equation is solved\n\n Returns\n =======\n\n Set\n A set of values for `symbol` for which `f` is True or is equal to\n zero. An `EmptySet` is returned if `f` is False or nonzero.\n A `ConditionSet` is returned as unsolved object if algorithms\n to evaluate complete solution are not yet implemented.\n\n `solveset` claims to be complete in the solution set that it returns.\n\n Raises\n ======\n\n NotImplementedError\n The algorithms to solve inequalities in complex domain are\n not yet implemented.\n ValueError\n The input is not valid.\n RuntimeError\n It is a bug, please report to the github issue tracker.\n\n\n Notes\n =====\n\n Python interprets 0 and 1 as False and True, respectively, but\n in this function they refer to solutions of an expression. So 0 and 1\n return the Domain and EmptySet, respectively, while True and False\n return the opposite (as they are assumed to be solutions of relational\n expressions).\n\n\n See Also\n ========\n\n solveset_real: solver for real domain\n solveset_complex: solver for complex domain\n\n Examples\n ========\n\n >>> from sympy import exp, sin, Symbol, pprint, S\n >>> from sympy.solvers.solveset import solveset, solveset_real\n\n * The default domain is complex. Not specifying a domain will lead\n to the solving of the equation in the complex domain (and this\n is not affected by the assumptions on the symbol):\n\n >>> x = Symbol('x')\n >>> pprint(solveset(exp(x) - 1, x), use_unicode=False)\n {2*n*I*pi | n in Integers()}\n\n >>> x = Symbol('x', real=True)\n >>> pprint(solveset(exp(x) - 1, x), use_unicode=False)\n {2*n*I*pi | n in Integers()}\n\n * If you want to use `solveset` to solve the equation in the\n real domain, provide a real domain. (Using `solveset\\_real`\n does this automatically.)\n\n >>> R = S.Reals\n >>> x = Symbol('x')\n >>> solveset(exp(x) - 1, x, R)\n {0}\n >>> solveset_real(exp(x) - 1, x)\n {0}\n\n The solution is mostly unaffected by assumptions on the symbol,\n but there may be some slight difference:\n\n >>> pprint(solveset(sin(x)/x,x), use_unicode=False)\n ({2*n*pi | n in Integers()} \\ {0}) U ({2*n*pi + pi | n in Integers()} \\ {0})\n\n >>> p = Symbol('p', positive=True)\n >>> pprint(solveset(sin(p)/p, p), use_unicode=False)\n {2*n*pi | n in Integers()} U {2*n*pi + pi | n in Integers()}\n\n * Inequalities can be solved over the real domain only. Use of a complex\n domain leads to a NotImplementedError.\n\n >>> solveset(exp(x) > 1, x, R)\n (0, oo)\n\n "
f = sympify(f)
if (f is S.true):
return domain
if (f is S.false):
return S.EmptySet
if (not isinstance(f, (Expr, Number))):
raise ValueError(('%s is not a valid SymPy expression' % f))
free_symbols = f.free_symbols
if (not free_symbols):
b = Eq(f, 0)
if (b is S.true):
return domain
elif (b is S.false):
return S.EmptySet
else:
raise NotImplementedError(filldedent(('\n relationship between value and 0 is unknown: %s' % b)))
if (symbol is None):
if (len(free_symbols) == 1):
symbol = free_symbols.pop()
else:
raise ValueError(filldedent('\n The independent variable must be specified for a\n multivariate equation.'))
elif (not getattr(symbol, 'is_Symbol', False)):
raise ValueError(('A Symbol must be given, not type %s: %s' % (type(symbol), symbol)))
if isinstance(f, Eq):
from sympy.core import Add
f = Add(f.lhs, (- f.rhs), evaluate=False)
elif f.is_Relational:
if (not domain.is_subset(S.Reals)):
raise NotImplementedError(filldedent('\n Inequalities in the complex domain are\n not supported. Try the real domain by\n setting domain=S.Reals'))
try:
result = (solve_univariate_inequality(f, symbol, relational=False) - _invalid_solutions(f, symbol, domain))
except NotImplementedError:
result = ConditionSet(symbol, f, domain)
return result
return _solveset(f, symbol, domain, _check=True) |
def solvify(f, symbol, domain):
'Solves an equation using solveset and returns the solution in accordance\n with the `solve` output API.\n\n Returns\n =======\n\n We classify the output based on the type of solution returned by `solveset`.\n\n Solution | Output\n ----------------------------------------\n FiniteSet | list\n\n ImageSet, | list (if `f` is periodic)\n Union |\n\n EmptySet | empty list\n\n Others | None\n\n\n Raises\n ======\n\n NotImplementedError\n A ConditionSet is the input.\n\n Examples\n ========\n\n >>> from sympy.solvers.solveset import solvify, solveset\n >>> from sympy.abc import x\n >>> from sympy import S, tan, sin, exp\n >>> solvify(x**2 - 9, x, S.Reals)\n [-3, 3]\n >>> solvify(sin(x) - 1, x, S.Reals)\n [pi/2]\n >>> solvify(tan(x), x, S.Reals)\n [0]\n >>> solvify(exp(x) - 1, x, S.Complexes)\n\n >>> solvify(exp(x) - 1, x, S.Reals)\n [0]\n\n '
solution_set = solveset(f, symbol, domain)
result = None
if (solution_set is S.EmptySet):
result = []
elif isinstance(solution_set, ConditionSet):
raise NotImplementedError('solveset is unable to solve this equation.')
elif isinstance(solution_set, FiniteSet):
result = list(solution_set)
else:
period = periodicity(f, symbol)
if (period is not None):
solutions = S.EmptySet
if isinstance(solution_set, ImageSet):
iter_solutions = (solution_set,)
elif isinstance(solution_set, Union):
if all((isinstance(i, ImageSet) for i in solution_set.args)):
iter_solutions = solution_set.args
for solution in iter_solutions:
solutions += solution.intersect(Interval(0, period, False, True))
if isinstance(solutions, FiniteSet):
result = list(solutions)
else:
solution = solution_set.intersect(domain)
if isinstance(solution, FiniteSet):
result += solution
return result | 7,219,948,723,992,646,000 | Solves an equation using solveset and returns the solution in accordance
with the `solve` output API.
Returns
=======
We classify the output based on the type of solution returned by `solveset`.
Solution | Output
----------------------------------------
FiniteSet | list
ImageSet, | list (if `f` is periodic)
Union |
EmptySet | empty list
Others | None
Raises
======
NotImplementedError
A ConditionSet is the input.
Examples
========
>>> from sympy.solvers.solveset import solvify, solveset
>>> from sympy.abc import x
>>> from sympy import S, tan, sin, exp
>>> solvify(x**2 - 9, x, S.Reals)
[-3, 3]
>>> solvify(sin(x) - 1, x, S.Reals)
[pi/2]
>>> solvify(tan(x), x, S.Reals)
[0]
>>> solvify(exp(x) - 1, x, S.Complexes)
>>> solvify(exp(x) - 1, x, S.Reals)
[0] | sympy/solvers/solveset.py | solvify | aktech/sympy | python | def solvify(f, symbol, domain):
'Solves an equation using solveset and returns the solution in accordance\n with the `solve` output API.\n\n Returns\n =======\n\n We classify the output based on the type of solution returned by `solveset`.\n\n Solution | Output\n ----------------------------------------\n FiniteSet | list\n\n ImageSet, | list (if `f` is periodic)\n Union |\n\n EmptySet | empty list\n\n Others | None\n\n\n Raises\n ======\n\n NotImplementedError\n A ConditionSet is the input.\n\n Examples\n ========\n\n >>> from sympy.solvers.solveset import solvify, solveset\n >>> from sympy.abc import x\n >>> from sympy import S, tan, sin, exp\n >>> solvify(x**2 - 9, x, S.Reals)\n [-3, 3]\n >>> solvify(sin(x) - 1, x, S.Reals)\n [pi/2]\n >>> solvify(tan(x), x, S.Reals)\n [0]\n >>> solvify(exp(x) - 1, x, S.Complexes)\n\n >>> solvify(exp(x) - 1, x, S.Reals)\n [0]\n\n '
solution_set = solveset(f, symbol, domain)
result = None
if (solution_set is S.EmptySet):
result = []
elif isinstance(solution_set, ConditionSet):
raise NotImplementedError('solveset is unable to solve this equation.')
elif isinstance(solution_set, FiniteSet):
result = list(solution_set)
else:
period = periodicity(f, symbol)
if (period is not None):
solutions = S.EmptySet
if isinstance(solution_set, ImageSet):
iter_solutions = (solution_set,)
elif isinstance(solution_set, Union):
if all((isinstance(i, ImageSet) for i in solution_set.args)):
iter_solutions = solution_set.args
for solution in iter_solutions:
solutions += solution.intersect(Interval(0, period, False, True))
if isinstance(solutions, FiniteSet):
result = list(solutions)
else:
solution = solution_set.intersect(domain)
if isinstance(solution, FiniteSet):
result += solution
return result |
def linear_eq_to_matrix(equations, *symbols):
"\n Converts a given System of Equations into Matrix form.\n Here `equations` must be a linear system of equations in\n `symbols`. The order of symbols in input `symbols` will\n determine the order of coefficients in the returned\n Matrix.\n\n The Matrix form corresponds to the augmented matrix form.\n For example:\n\n .. math:: 4x + 2y + 3z = 1\n .. math:: 3x + y + z = -6\n .. math:: 2x + 4y + 9z = 2\n\n This system would return `A` & `b` as given below:\n\n ::\n\n [ 4 2 3 ] [ 1 ]\n A = [ 3 1 1 ] b = [-6 ]\n [ 2 4 9 ] [ 2 ]\n\n Examples\n ========\n\n >>> from sympy import linear_eq_to_matrix, symbols\n >>> x, y, z = symbols('x, y, z')\n >>> eqns = [x + 2*y + 3*z - 1, 3*x + y + z + 6, 2*x + 4*y + 9*z - 2]\n >>> A, b = linear_eq_to_matrix(eqns, [x, y, z])\n >>> A\n Matrix([\n [1, 2, 3],\n [3, 1, 1],\n [2, 4, 9]])\n >>> b\n Matrix([\n [ 1],\n [-6],\n [ 2]])\n >>> eqns = [x + z - 1, y + z, x - y]\n >>> A, b = linear_eq_to_matrix(eqns, [x, y, z])\n >>> A\n Matrix([\n [1, 0, 1],\n [0, 1, 1],\n [1, -1, 0]])\n >>> b\n Matrix([\n [1],\n [0],\n [0]])\n\n * Symbolic coefficients are also supported\n\n >>> a, b, c, d, e, f = symbols('a, b, c, d, e, f')\n >>> eqns = [a*x + b*y - c, d*x + e*y - f]\n >>> A, B = linear_eq_to_matrix(eqns, x, y)\n >>> A\n Matrix([\n [a, b],\n [d, e]])\n >>> B\n Matrix([\n [c],\n [f]])\n\n "
if (not symbols):
raise ValueError('Symbols must be given, for which coefficients are to be found.')
if hasattr(symbols[0], '__iter__'):
symbols = symbols[0]
M = Matrix([symbols])
M = M.col_insert(len(symbols), Matrix([1]))
row_no = 1
for equation in equations:
f = sympify(equation)
if isinstance(f, Equality):
f = (f.lhs - f.rhs)
coeff_list = []
for symbol in symbols:
coeff_list.append(f.coeff(symbol))
coeff_list.append((- f.as_coeff_add(*symbols)[0]))
M = M.row_insert(row_no, Matrix([coeff_list]))
row_no += 1
M.row_del(0)
(A, b) = (M[:, :(- 1)], M[:, (- 1):])
return (A, b) | -8,302,918,135,174,498,000 | Converts a given System of Equations into Matrix form.
Here `equations` must be a linear system of equations in
`symbols`. The order of symbols in input `symbols` will
determine the order of coefficients in the returned
Matrix.
The Matrix form corresponds to the augmented matrix form.
For example:
.. math:: 4x + 2y + 3z = 1
.. math:: 3x + y + z = -6
.. math:: 2x + 4y + 9z = 2
This system would return `A` & `b` as given below:
::
[ 4 2 3 ] [ 1 ]
A = [ 3 1 1 ] b = [-6 ]
[ 2 4 9 ] [ 2 ]
Examples
========
>>> from sympy import linear_eq_to_matrix, symbols
>>> x, y, z = symbols('x, y, z')
>>> eqns = [x + 2*y + 3*z - 1, 3*x + y + z + 6, 2*x + 4*y + 9*z - 2]
>>> A, b = linear_eq_to_matrix(eqns, [x, y, z])
>>> A
Matrix([
[1, 2, 3],
[3, 1, 1],
[2, 4, 9]])
>>> b
Matrix([
[ 1],
[-6],
[ 2]])
>>> eqns = [x + z - 1, y + z, x - y]
>>> A, b = linear_eq_to_matrix(eqns, [x, y, z])
>>> A
Matrix([
[1, 0, 1],
[0, 1, 1],
[1, -1, 0]])
>>> b
Matrix([
[1],
[0],
[0]])
* Symbolic coefficients are also supported
>>> a, b, c, d, e, f = symbols('a, b, c, d, e, f')
>>> eqns = [a*x + b*y - c, d*x + e*y - f]
>>> A, B = linear_eq_to_matrix(eqns, x, y)
>>> A
Matrix([
[a, b],
[d, e]])
>>> B
Matrix([
[c],
[f]]) | sympy/solvers/solveset.py | linear_eq_to_matrix | aktech/sympy | python | def linear_eq_to_matrix(equations, *symbols):
"\n Converts a given System of Equations into Matrix form.\n Here `equations` must be a linear system of equations in\n `symbols`. The order of symbols in input `symbols` will\n determine the order of coefficients in the returned\n Matrix.\n\n The Matrix form corresponds to the augmented matrix form.\n For example:\n\n .. math:: 4x + 2y + 3z = 1\n .. math:: 3x + y + z = -6\n .. math:: 2x + 4y + 9z = 2\n\n This system would return `A` & `b` as given below:\n\n ::\n\n [ 4 2 3 ] [ 1 ]\n A = [ 3 1 1 ] b = [-6 ]\n [ 2 4 9 ] [ 2 ]\n\n Examples\n ========\n\n >>> from sympy import linear_eq_to_matrix, symbols\n >>> x, y, z = symbols('x, y, z')\n >>> eqns = [x + 2*y + 3*z - 1, 3*x + y + z + 6, 2*x + 4*y + 9*z - 2]\n >>> A, b = linear_eq_to_matrix(eqns, [x, y, z])\n >>> A\n Matrix([\n [1, 2, 3],\n [3, 1, 1],\n [2, 4, 9]])\n >>> b\n Matrix([\n [ 1],\n [-6],\n [ 2]])\n >>> eqns = [x + z - 1, y + z, x - y]\n >>> A, b = linear_eq_to_matrix(eqns, [x, y, z])\n >>> A\n Matrix([\n [1, 0, 1],\n [0, 1, 1],\n [1, -1, 0]])\n >>> b\n Matrix([\n [1],\n [0],\n [0]])\n\n * Symbolic coefficients are also supported\n\n >>> a, b, c, d, e, f = symbols('a, b, c, d, e, f')\n >>> eqns = [a*x + b*y - c, d*x + e*y - f]\n >>> A, B = linear_eq_to_matrix(eqns, x, y)\n >>> A\n Matrix([\n [a, b],\n [d, e]])\n >>> B\n Matrix([\n [c],\n [f]])\n\n "
if (not symbols):
raise ValueError('Symbols must be given, for which coefficients are to be found.')
if hasattr(symbols[0], '__iter__'):
symbols = symbols[0]
M = Matrix([symbols])
M = M.col_insert(len(symbols), Matrix([1]))
row_no = 1
for equation in equations:
f = sympify(equation)
if isinstance(f, Equality):
f = (f.lhs - f.rhs)
coeff_list = []
for symbol in symbols:
coeff_list.append(f.coeff(symbol))
coeff_list.append((- f.as_coeff_add(*symbols)[0]))
M = M.row_insert(row_no, Matrix([coeff_list]))
row_no += 1
M.row_del(0)
(A, b) = (M[:, :(- 1)], M[:, (- 1):])
return (A, b) |
def linsolve(system, *symbols):
'\n Solve system of N linear equations with M variables, which\n means both under - and overdetermined systems are supported.\n The possible number of solutions is zero, one or infinite.\n Zero solutions throws a ValueError, where as infinite\n solutions are represented parametrically in terms of given\n symbols. For unique solution a FiniteSet of ordered tuple\n is returned.\n\n All Standard input formats are supported:\n For the given set of Equations, the respective input types\n are given below:\n\n .. math:: 3x + 2y - z = 1\n .. math:: 2x - 2y + 4z = -2\n .. math:: 2x - y + 2z = 0\n\n * Augmented Matrix Form, `system` given below:\n\n ::\n\n [3 2 -1 1]\n system = [2 -2 4 -2]\n [2 -1 2 0]\n\n * List Of Equations Form\n\n `system = [3x + 2y - z - 1, 2x - 2y + 4z + 2, 2x - y + 2z]`\n\n * Input A & b Matrix Form (from Ax = b) are given as below:\n\n ::\n\n [3 2 -1 ] [ 1 ]\n A = [2 -2 4 ] b = [ -2 ]\n [2 -1 2 ] [ 0 ]\n\n `system = (A, b)`\n\n Symbols to solve for should be given as input in all the\n cases either in an iterable or as comma separated arguments.\n This is done to maintain consistency in returning solutions\n in the form of variable input by the user.\n\n The algorithm used here is Gauss-Jordan elimination, which\n results, after elimination, in an row echelon form matrix.\n\n Returns\n =======\n\n A FiniteSet of ordered tuple of values of `symbols` for which\n the `system` has solution.\n\n Please note that general FiniteSet is unordered, the solution\n returned here is not simply a FiniteSet of solutions, rather\n it is a FiniteSet of ordered tuple, i.e. the first & only\n argument to FiniteSet is a tuple of solutions, which is ordered,\n & hence the returned solution is ordered.\n\n Also note that solution could also have been returned as an\n ordered tuple, FiniteSet is just a wrapper `{}` around\n the tuple. It has no other significance except for\n the fact it is just used to maintain a consistent output\n format throughout the solveset.\n\n Returns EmptySet(), if the linear system is inconsistent.\n\n Raises\n ======\n\n ValueError\n The input is not valid.\n The symbols are not given.\n\n Examples\n ========\n\n >>> from sympy import Matrix, S, linsolve, symbols\n >>> x, y, z = symbols("x, y, z")\n >>> A = Matrix([[1, 2, 3], [4, 5, 6], [7, 8, 10]])\n >>> b = Matrix([3, 6, 9])\n >>> A\n Matrix([\n [1, 2, 3],\n [4, 5, 6],\n [7, 8, 10]])\n >>> b\n Matrix([\n [3],\n [6],\n [9]])\n >>> linsolve((A, b), [x, y, z])\n {(-1, 2, 0)}\n\n * Parametric Solution: In case the system is under determined, the function\n will return parametric solution in terms of the given symbols.\n Free symbols in the system are returned as it is. For e.g. in the system\n below, `z` is returned as the solution for variable z, which means z is a\n free symbol, i.e. it can take arbitrary values.\n\n >>> A = Matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]])\n >>> b = Matrix([3, 6, 9])\n >>> linsolve((A, b), [x, y, z])\n {(z - 1, -2*z + 2, z)}\n\n * List of Equations as input\n\n >>> Eqns = [3*x + 2*y - z - 1, 2*x - 2*y + 4*z + 2, - x + S(1)/2*y - z]\n >>> linsolve(Eqns, x, y, z)\n {(1, -2, -2)}\n\n * Augmented Matrix as input\n\n >>> aug = Matrix([[2, 1, 3, 1], [2, 6, 8, 3], [6, 8, 18, 5]])\n >>> aug\n Matrix([\n [2, 1, 3, 1],\n [2, 6, 8, 3],\n [6, 8, 18, 5]])\n >>> linsolve(aug, x, y, z)\n {(3/10, 2/5, 0)}\n\n * Solve for symbolic coefficients\n\n >>> a, b, c, d, e, f = symbols(\'a, b, c, d, e, f\')\n >>> eqns = [a*x + b*y - c, d*x + e*y - f]\n >>> linsolve(eqns, x, y)\n {((-b*f + c*e)/(a*e - b*d), (a*f - c*d)/(a*e - b*d))}\n\n * A degenerate system returns solution as set of given\n symbols.\n\n >>> system = Matrix(([0,0,0], [0,0,0], [0,0,0]))\n >>> linsolve(system, x, y)\n {(x, y)}\n\n * For an empty system linsolve returns empty set\n\n >>> linsolve([ ], x)\n EmptySet()\n\n '
if (not system):
return S.EmptySet
if (not symbols):
raise ValueError('Symbols must be given, for which solution of the system is to be found.')
if hasattr(symbols[0], '__iter__'):
symbols = symbols[0]
try:
sym = symbols[0].is_Symbol
except AttributeError:
sym = False
if (not sym):
raise ValueError(('Symbols or iterable of symbols must be given as second argument, not type %s: %s' % (type(symbols[0]), symbols[0])))
if isinstance(system, Matrix):
(A, b) = (system[:, :(- 1)], system[:, (- 1):])
elif hasattr(system, '__iter__'):
if ((len(system) == 2) and system[0].is_Matrix):
(A, b) = (system[0], system[1])
if (not system[0].is_Matrix):
(A, b) = linear_eq_to_matrix(system, symbols)
else:
raise ValueError('Invalid arguments')
try:
(sol, params, free_syms) = A.gauss_jordan_solve(b, freevar=True)
except ValueError:
return EmptySet()
solution = []
if params:
for s in sol:
for (k, v) in enumerate(params):
s = s.xreplace({v: symbols[free_syms[k]]})
solution.append(simplify(s))
else:
for s in sol:
solution.append(simplify(s))
solution = FiniteSet(tuple(solution))
return solution | 4,470,600,606,688,218,600 | Solve system of N linear equations with M variables, which
means both under - and overdetermined systems are supported.
The possible number of solutions is zero, one or infinite.
Zero solutions throws a ValueError, where as infinite
solutions are represented parametrically in terms of given
symbols. For unique solution a FiniteSet of ordered tuple
is returned.
All Standard input formats are supported:
For the given set of Equations, the respective input types
are given below:
.. math:: 3x + 2y - z = 1
.. math:: 2x - 2y + 4z = -2
.. math:: 2x - y + 2z = 0
* Augmented Matrix Form, `system` given below:
::
[3 2 -1 1]
system = [2 -2 4 -2]
[2 -1 2 0]
* List Of Equations Form
`system = [3x + 2y - z - 1, 2x - 2y + 4z + 2, 2x - y + 2z]`
* Input A & b Matrix Form (from Ax = b) are given as below:
::
[3 2 -1 ] [ 1 ]
A = [2 -2 4 ] b = [ -2 ]
[2 -1 2 ] [ 0 ]
`system = (A, b)`
Symbols to solve for should be given as input in all the
cases either in an iterable or as comma separated arguments.
This is done to maintain consistency in returning solutions
in the form of variable input by the user.
The algorithm used here is Gauss-Jordan elimination, which
results, after elimination, in an row echelon form matrix.
Returns
=======
A FiniteSet of ordered tuple of values of `symbols` for which
the `system` has solution.
Please note that general FiniteSet is unordered, the solution
returned here is not simply a FiniteSet of solutions, rather
it is a FiniteSet of ordered tuple, i.e. the first & only
argument to FiniteSet is a tuple of solutions, which is ordered,
& hence the returned solution is ordered.
Also note that solution could also have been returned as an
ordered tuple, FiniteSet is just a wrapper `{}` around
the tuple. It has no other significance except for
the fact it is just used to maintain a consistent output
format throughout the solveset.
Returns EmptySet(), if the linear system is inconsistent.
Raises
======
ValueError
The input is not valid.
The symbols are not given.
Examples
========
>>> from sympy import Matrix, S, linsolve, symbols
>>> x, y, z = symbols("x, y, z")
>>> A = Matrix([[1, 2, 3], [4, 5, 6], [7, 8, 10]])
>>> b = Matrix([3, 6, 9])
>>> A
Matrix([
[1, 2, 3],
[4, 5, 6],
[7, 8, 10]])
>>> b
Matrix([
[3],
[6],
[9]])
>>> linsolve((A, b), [x, y, z])
{(-1, 2, 0)}
* Parametric Solution: In case the system is under determined, the function
will return parametric solution in terms of the given symbols.
Free symbols in the system are returned as it is. For e.g. in the system
below, `z` is returned as the solution for variable z, which means z is a
free symbol, i.e. it can take arbitrary values.
>>> A = Matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
>>> b = Matrix([3, 6, 9])
>>> linsolve((A, b), [x, y, z])
{(z - 1, -2*z + 2, z)}
* List of Equations as input
>>> Eqns = [3*x + 2*y - z - 1, 2*x - 2*y + 4*z + 2, - x + S(1)/2*y - z]
>>> linsolve(Eqns, x, y, z)
{(1, -2, -2)}
* Augmented Matrix as input
>>> aug = Matrix([[2, 1, 3, 1], [2, 6, 8, 3], [6, 8, 18, 5]])
>>> aug
Matrix([
[2, 1, 3, 1],
[2, 6, 8, 3],
[6, 8, 18, 5]])
>>> linsolve(aug, x, y, z)
{(3/10, 2/5, 0)}
* Solve for symbolic coefficients
>>> a, b, c, d, e, f = symbols('a, b, c, d, e, f')
>>> eqns = [a*x + b*y - c, d*x + e*y - f]
>>> linsolve(eqns, x, y)
{((-b*f + c*e)/(a*e - b*d), (a*f - c*d)/(a*e - b*d))}
* A degenerate system returns solution as set of given
symbols.
>>> system = Matrix(([0,0,0], [0,0,0], [0,0,0]))
>>> linsolve(system, x, y)
{(x, y)}
* For an empty system linsolve returns empty set
>>> linsolve([ ], x)
EmptySet() | sympy/solvers/solveset.py | linsolve | aktech/sympy | python | def linsolve(system, *symbols):
'\n Solve system of N linear equations with M variables, which\n means both under - and overdetermined systems are supported.\n The possible number of solutions is zero, one or infinite.\n Zero solutions throws a ValueError, where as infinite\n solutions are represented parametrically in terms of given\n symbols. For unique solution a FiniteSet of ordered tuple\n is returned.\n\n All Standard input formats are supported:\n For the given set of Equations, the respective input types\n are given below:\n\n .. math:: 3x + 2y - z = 1\n .. math:: 2x - 2y + 4z = -2\n .. math:: 2x - y + 2z = 0\n\n * Augmented Matrix Form, `system` given below:\n\n ::\n\n [3 2 -1 1]\n system = [2 -2 4 -2]\n [2 -1 2 0]\n\n * List Of Equations Form\n\n `system = [3x + 2y - z - 1, 2x - 2y + 4z + 2, 2x - y + 2z]`\n\n * Input A & b Matrix Form (from Ax = b) are given as below:\n\n ::\n\n [3 2 -1 ] [ 1 ]\n A = [2 -2 4 ] b = [ -2 ]\n [2 -1 2 ] [ 0 ]\n\n `system = (A, b)`\n\n Symbols to solve for should be given as input in all the\n cases either in an iterable or as comma separated arguments.\n This is done to maintain consistency in returning solutions\n in the form of variable input by the user.\n\n The algorithm used here is Gauss-Jordan elimination, which\n results, after elimination, in an row echelon form matrix.\n\n Returns\n =======\n\n A FiniteSet of ordered tuple of values of `symbols` for which\n the `system` has solution.\n\n Please note that general FiniteSet is unordered, the solution\n returned here is not simply a FiniteSet of solutions, rather\n it is a FiniteSet of ordered tuple, i.e. the first & only\n argument to FiniteSet is a tuple of solutions, which is ordered,\n & hence the returned solution is ordered.\n\n Also note that solution could also have been returned as an\n ordered tuple, FiniteSet is just a wrapper `{}` around\n the tuple. It has no other significance except for\n the fact it is just used to maintain a consistent output\n format throughout the solveset.\n\n Returns EmptySet(), if the linear system is inconsistent.\n\n Raises\n ======\n\n ValueError\n The input is not valid.\n The symbols are not given.\n\n Examples\n ========\n\n >>> from sympy import Matrix, S, linsolve, symbols\n >>> x, y, z = symbols("x, y, z")\n >>> A = Matrix([[1, 2, 3], [4, 5, 6], [7, 8, 10]])\n >>> b = Matrix([3, 6, 9])\n >>> A\n Matrix([\n [1, 2, 3],\n [4, 5, 6],\n [7, 8, 10]])\n >>> b\n Matrix([\n [3],\n [6],\n [9]])\n >>> linsolve((A, b), [x, y, z])\n {(-1, 2, 0)}\n\n * Parametric Solution: In case the system is under determined, the function\n will return parametric solution in terms of the given symbols.\n Free symbols in the system are returned as it is. For e.g. in the system\n below, `z` is returned as the solution for variable z, which means z is a\n free symbol, i.e. it can take arbitrary values.\n\n >>> A = Matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]])\n >>> b = Matrix([3, 6, 9])\n >>> linsolve((A, b), [x, y, z])\n {(z - 1, -2*z + 2, z)}\n\n * List of Equations as input\n\n >>> Eqns = [3*x + 2*y - z - 1, 2*x - 2*y + 4*z + 2, - x + S(1)/2*y - z]\n >>> linsolve(Eqns, x, y, z)\n {(1, -2, -2)}\n\n * Augmented Matrix as input\n\n >>> aug = Matrix([[2, 1, 3, 1], [2, 6, 8, 3], [6, 8, 18, 5]])\n >>> aug\n Matrix([\n [2, 1, 3, 1],\n [2, 6, 8, 3],\n [6, 8, 18, 5]])\n >>> linsolve(aug, x, y, z)\n {(3/10, 2/5, 0)}\n\n * Solve for symbolic coefficients\n\n >>> a, b, c, d, e, f = symbols(\'a, b, c, d, e, f\')\n >>> eqns = [a*x + b*y - c, d*x + e*y - f]\n >>> linsolve(eqns, x, y)\n {((-b*f + c*e)/(a*e - b*d), (a*f - c*d)/(a*e - b*d))}\n\n * A degenerate system returns solution as set of given\n symbols.\n\n >>> system = Matrix(([0,0,0], [0,0,0], [0,0,0]))\n >>> linsolve(system, x, y)\n {(x, y)}\n\n * For an empty system linsolve returns empty set\n\n >>> linsolve([ ], x)\n EmptySet()\n\n '
if (not system):
return S.EmptySet
if (not symbols):
raise ValueError('Symbols must be given, for which solution of the system is to be found.')
if hasattr(symbols[0], '__iter__'):
symbols = symbols[0]
try:
sym = symbols[0].is_Symbol
except AttributeError:
sym = False
if (not sym):
raise ValueError(('Symbols or iterable of symbols must be given as second argument, not type %s: %s' % (type(symbols[0]), symbols[0])))
if isinstance(system, Matrix):
(A, b) = (system[:, :(- 1)], system[:, (- 1):])
elif hasattr(system, '__iter__'):
if ((len(system) == 2) and system[0].is_Matrix):
(A, b) = (system[0], system[1])
if (not system[0].is_Matrix):
(A, b) = linear_eq_to_matrix(system, symbols)
else:
raise ValueError('Invalid arguments')
try:
(sol, params, free_syms) = A.gauss_jordan_solve(b, freevar=True)
except ValueError:
return EmptySet()
solution = []
if params:
for s in sol:
for (k, v) in enumerate(params):
s = s.xreplace({v: symbols[free_syms[k]]})
solution.append(simplify(s))
else:
for s in sol:
solution.append(simplify(s))
solution = FiniteSet(tuple(solution))
return solution |
def substitution(system, symbols, result=[{}], known_symbols=[], exclude=[], all_symbols=None):
"\n Solves the `system` using substitution method. It is used in\n `nonlinsolve`. This will be called from `nonlinsolve` when any\n equation(s) is non polynomial equation.\n\n Parameters\n ==========\n\n system : list of equations\n The target system of equations\n symbols : list of symbols to be solved.\n The variable(s) for which the system is solved\n known_symbols : list of solved symbols\n Values are known for these variable(s)\n result : An empty list or list of dict\n If No symbol values is known then empty list otherwise\n symbol as keys and corresponding value in dict.\n exclude : Set of expression.\n Mostly denominator expression(s) of the equations of the system.\n Final solution should not satisfy these expressions.\n all_symbols : known_symbols + symbols(unsolved).\n\n Returns\n =======\n\n A FiniteSet of ordered tuple of values of `all_symbols` for which the\n `system` has solution. Order of values in the tuple is same as symbols\n present in the parameter `all_symbols`. If parameter `all_symbols` is None\n then same as symbols present in the parameter `symbols`.\n\n Please note that general FiniteSet is unordered, the solution returned\n here is not simply a FiniteSet of solutions, rather it is a FiniteSet of\n ordered tuple, i.e. the first & only argument to FiniteSet is a tuple of\n solutions, which is ordered, & hence the returned solution is ordered.\n\n Also note that solution could also have been returned as an ordered tuple,\n FiniteSet is just a wrapper `{}` around the tuple. It has no other\n significance except for the fact it is just used to maintain a consistent\n output format throughout the solveset.\n\n Raises\n ======\n\n ValueError\n The input is not valid.\n The symbols are not given.\n AttributeError\n The input symbols are not `Symbol` type.\n\n Examples\n ========\n\n >>> from sympy.core.symbol import symbols\n >>> x, y = symbols('x, y', real=True)\n >>> from sympy.solvers.solveset import substitution\n >>> substitution([x + y], [x], [{y: 1}], [y], set([]), [x, y])\n {(-1, 1)}\n\n * when you want soln should not satisfy eq `x + 1 = 0`\n\n >>> substitution([x + y], [x], [{y: 1}], [y], set([x + 1]), [y, x])\n EmptySet()\n >>> substitution([x + y], [x], [{y: 1}], [y], set([x - 1]), [y, x])\n {(1, -1)}\n >>> substitution([x + y - 1, y - x**2 + 5], [x, y])\n {(-3, 4), (2, -1)}\n\n * Returns both real and complex solution\n\n >>> x, y, z = symbols('x, y, z')\n >>> from sympy import exp, sin\n >>> substitution([exp(x) - sin(y), y**2 - 4], [x, y])\n {(log(sin(2)), 2), (ImageSet(Lambda(_n, I*(2*_n*pi + pi) +\n log(sin(2))), Integers()), -2), (ImageSet(Lambda(_n, 2*_n*I*pi +\n Mod(log(sin(2)), 2*I*pi)), Integers()), 2)}\n\n >>> eqs = [z**2 + exp(2*x) - sin(y), -3 + exp(-y)]\n >>> substitution(eqs, [y, z])\n {(-log(3), -sqrt(-exp(2*x) - sin(log(3)))),\n (-log(3), sqrt(-exp(2*x) - sin(log(3)))),\n (ImageSet(Lambda(_n, 2*_n*I*pi + Mod(-log(3), 2*I*pi)), Integers()),\n ImageSet(Lambda(_n, -sqrt(-exp(2*x) + sin(2*_n*I*pi +\n Mod(-log(3), 2*I*pi)))), Integers())),\n (ImageSet(Lambda(_n, 2*_n*I*pi + Mod(-log(3), 2*I*pi)), Integers()),\n ImageSet(Lambda(_n, sqrt(-exp(2*x) + sin(2*_n*I*pi +\n Mod(-log(3), 2*I*pi)))), Integers()))}\n\n "
from sympy import Complement
from sympy.core.compatibility import is_sequence
if (not system):
return S.EmptySet
if (not symbols):
msg = 'Symbols must be given, for which solution of the system is to be found.'
raise ValueError(filldedent(msg))
if (not is_sequence(symbols)):
msg = 'symbols should be given as a sequence, e.g. a list.Not type %s: %s'
raise TypeError(filldedent((msg % (type(symbols), symbols))))
try:
sym = symbols[0].is_Symbol
except AttributeError:
sym = False
if (not sym):
msg = 'Iterable of symbols must be given as second argument, not type %s: %s'
raise ValueError(filldedent((msg % (type(symbols[0]), symbols[0]))))
if (all_symbols is None):
all_symbols = symbols
old_result = result
complements = {}
intersections = {}
total_conditionset = (- 1)
total_solveset_call = (- 1)
def _unsolved_syms(eq, sort=False):
'Returns the unsolved symbol present\n in the equation `eq`.\n '
free = eq.free_symbols
unsolved = ((free - set(known_symbols)) & set(all_symbols))
if sort:
unsolved = list(unsolved)
unsolved.sort(key=default_sort_key)
return unsolved
eqs_in_better_order = list(ordered(system, (lambda _: len(_unsolved_syms(_)))))
def add_intersection_complement(result, sym_set, **flags):
final_result = []
for res in result:
res_copy = res
for (key_res, value_res) in res.items():
intersection_true = flags.get('Intersection', True)
complements_true = flags.get('Complement', True)
for (key_sym, value_sym) in sym_set.items():
if (key_sym == key_res):
if intersection_true:
new_value = Intersection(FiniteSet(value_res), value_sym)
if (new_value is not S.EmptySet):
res_copy[key_res] = new_value
if complements_true:
new_value = Complement(FiniteSet(value_res), value_sym)
if (new_value is not S.EmptySet):
res_copy[key_res] = new_value
final_result.append(res_copy)
return final_result
def _extract_main_soln(sol, soln_imageset):
"separate the Complements, Intersections, ImageSet lambda expr\n and it's base_set.\n "
if isinstance(sol, Complement):
complements[sym] = sol.args[1]
sol = sol.args[0]
if isinstance(sol, Intersection):
if (sol.args[0] != Interval((- oo), oo)):
intersections[sym] = sol.args[0]
sol = sol.args[1]
if isinstance(sol, ImageSet):
soln_imagest = sol
expr2 = sol.lamda.expr
sol = FiniteSet(expr2)
soln_imageset[expr2] = soln_imagest
if isinstance(sol, Union):
sol_args = sol.args
sol = S.EmptySet
for sol_arg2 in sol_args:
if isinstance(sol_arg2, FiniteSet):
sol += sol_arg2
else:
sol += FiniteSet(sol_arg2)
if (not isinstance(sol, FiniteSet)):
sol = FiniteSet(sol)
return (sol, soln_imageset)
def _check_exclude(rnew, imgset_yes):
rnew_ = rnew
if imgset_yes:
rnew_copy = rnew.copy()
dummy_n = imgset_yes[0]
for (key_res, value_res) in rnew_copy.items():
rnew_copy[key_res] = value_res.subs(dummy_n, 0)
rnew_ = rnew_copy
try:
satisfy_exclude = any((checksol(d, rnew_) for d in exclude))
except TypeError:
satisfy_exclude = None
return satisfy_exclude
def _restore_imgset(rnew, original_imageset, newresult):
restore_sym = (set(rnew.keys()) & set(original_imageset.keys()))
for key_sym in restore_sym:
img = original_imageset[key_sym]
rnew[key_sym] = img
if (rnew not in newresult):
newresult.append(rnew)
def _append_eq(eq, result, res, delete_soln, n=None):
u = Dummy('u')
if n:
eq = eq.subs(n, 0)
satisfy = checksol(u, u, eq, minimal=True)
if (satisfy is False):
delete_soln = True
res = {}
else:
result.append(res)
return (result, res, delete_soln)
def _append_new_soln(rnew, sym, sol, imgset_yes, soln_imageset, original_imageset, newresult, eq=None):
'If `rnew` (A dict <symbol: soln>) contains valid soln\n append it to `newresult` list.\n `imgset_yes` is (base, dummy_var) if there was imageset in previously\n calculated result(otherwise empty tuple). `original_imageset` is dict\n of imageset expr and imageset from this result.\n `soln_imageset` dict of imageset expr and imageset of new soln.\n '
satisfy_exclude = _check_exclude(rnew, imgset_yes)
delete_soln = False
if (not satisfy_exclude):
local_n = None
if imgset_yes:
local_n = imgset_yes[0]
base = imgset_yes[1]
if (sym and sol):
dummy_list = list(sol.atoms(Dummy))
local_n_list = [local_n for i in range(0, len(dummy_list))]
dummy_zip = zip(dummy_list, local_n_list)
lam = Lambda(local_n, sol.subs(dummy_zip))
rnew[sym] = ImageSet(lam, base)
if (eq is not None):
(newresult, rnew, delete_soln) = _append_eq(eq, newresult, rnew, delete_soln, local_n)
elif (eq is not None):
(newresult, rnew, delete_soln) = _append_eq(eq, newresult, rnew, delete_soln)
elif soln_imageset:
rnew[sym] = soln_imageset[sol]
_restore_imgset(rnew, original_imageset, newresult)
else:
newresult.append(rnew)
elif satisfy_exclude:
delete_soln = True
rnew = {}
_restore_imgset(rnew, original_imageset, newresult)
return (newresult, delete_soln)
def _new_order_result(result, eq):
first_priority = []
second_priority = []
for res in result:
if (not any((isinstance(val, ImageSet) for val in res.values()))):
if (eq.subs(res) == 0):
first_priority.append(res)
else:
second_priority.append(res)
if (first_priority or second_priority):
return (first_priority + second_priority)
return result
def _solve_using_known_values(result, solver):
'Solves the system using already known solution\n (result contains the dict <symbol: value>).\n solver is `solveset_complex` or `solveset_real`.\n '
soln_imageset = {}
total_solvest_call = 0
total_conditionst = 0
for (index, eq) in enumerate(eqs_in_better_order):
newresult = []
original_imageset = {}
imgset_yes = False
result = _new_order_result(result, eq)
for res in result:
got_symbol = set()
if soln_imageset:
for (key_res, value_res) in res.items():
if isinstance(value_res, ImageSet):
res[key_res] = value_res.lamda.expr
original_imageset[key_res] = value_res
dummy_n = value_res.lamda.expr.atoms(Dummy).pop()
base = value_res.base_set
imgset_yes = (dummy_n, base)
eq2 = eq.subs(res)
unsolved_syms = _unsolved_syms(eq2, sort=True)
if (not unsolved_syms):
if res:
(newresult, delete_res) = _append_new_soln(res, None, None, imgset_yes, soln_imageset, original_imageset, newresult, eq2)
if delete_res:
result.remove(res)
continue
depen = eq2.as_independent(unsolved_syms)[0]
if (depen.has(Abs) and (solver == solveset_complex)):
continue
soln_imageset = {}
for sym in unsolved_syms:
not_solvable = False
try:
soln = solver(eq2, sym)
total_solvest_call += 1
soln_new = S.EmptySet
if isinstance(soln, Complement):
complements[sym] = soln.args[1]
soln = soln.args[0]
if isinstance(soln, Intersection):
if (soln.args[0] != Interval((- oo), oo)):
intersections[sym] = soln.args[0]
soln_new += soln.args[1]
soln = (soln_new if soln_new else soln)
if ((index > 0) and (solver == solveset_real)):
if (not isinstance(soln, (ImageSet, ConditionSet))):
soln += solveset_complex(eq2, sym)
except NotImplementedError:
continue
if isinstance(soln, ConditionSet):
soln = S.EmptySet
not_solvable = True
total_conditionst += 1
if (soln is not S.EmptySet):
(soln, soln_imageset) = _extract_main_soln(soln, soln_imageset)
for sol in soln:
(sol, soln_imageset) = _extract_main_soln(sol, soln_imageset)
sol = set(sol).pop()
free = sol.free_symbols
if (got_symbol and any([(ss in free) for ss in got_symbol])):
continue
rnew = res.copy()
for (k, v) in res.items():
if isinstance(v, Expr):
rnew[k] = v.subs(sym, sol)
if soln_imageset:
imgst = soln_imageset[sol]
rnew[sym] = imgst.lamda(*[0 for i in range(0, len(imgst.lamda.variables))])
else:
rnew[sym] = sol
(newresult, delete_res) = _append_new_soln(rnew, sym, sol, imgset_yes, soln_imageset, original_imageset, newresult)
if delete_res:
result.remove(res)
if (not not_solvable):
got_symbol.add(sym)
if newresult:
result = newresult
return (result, total_solvest_call, total_conditionst)
(new_result_real, solve_call1, cnd_call1) = _solve_using_known_values(old_result, solveset_real)
(new_result_complex, solve_call2, cnd_call2) = _solve_using_known_values(old_result, solveset_complex)
total_conditionset += (cnd_call1 + cnd_call2)
total_solveset_call += (solve_call1 + solve_call2)
if ((total_conditionset == total_solveset_call) and (total_solveset_call != (- 1))):
return _return_conditionset(eqs_in_better_order, all_symbols)
result = (new_result_real + new_result_complex)
result_all_variables = []
result_infinite = []
for res in result:
if (not res):
continue
if (len(res) < len(all_symbols)):
solved_symbols = res.keys()
unsolved = list(filter((lambda x: (x not in solved_symbols)), all_symbols))
for unsolved_sym in unsolved:
res[unsolved_sym] = unsolved_sym
result_infinite.append(res)
if (res not in result_all_variables):
result_all_variables.append(res)
if result_infinite:
result_all_variables = result_infinite
if (intersections and complements):
result_all_variables = add_intersection_complement(result_all_variables, intersections, Intersection=True, Complement=True)
elif intersections:
result_all_variables = add_intersection_complement(result_all_variables, intersections, Intersection=True)
elif complements:
result_all_variables = add_intersection_complement(result_all_variables, complements, Complement=True)
result = S.EmptySet
for r in result_all_variables:
temp = [r[symb] for symb in all_symbols]
result += FiniteSet(tuple(temp))
return result | -3,908,398,040,080,195,600 | Solves the `system` using substitution method. It is used in
`nonlinsolve`. This will be called from `nonlinsolve` when any
equation(s) is non polynomial equation.
Parameters
==========
system : list of equations
The target system of equations
symbols : list of symbols to be solved.
The variable(s) for which the system is solved
known_symbols : list of solved symbols
Values are known for these variable(s)
result : An empty list or list of dict
If No symbol values is known then empty list otherwise
symbol as keys and corresponding value in dict.
exclude : Set of expression.
Mostly denominator expression(s) of the equations of the system.
Final solution should not satisfy these expressions.
all_symbols : known_symbols + symbols(unsolved).
Returns
=======
A FiniteSet of ordered tuple of values of `all_symbols` for which the
`system` has solution. Order of values in the tuple is same as symbols
present in the parameter `all_symbols`. If parameter `all_symbols` is None
then same as symbols present in the parameter `symbols`.
Please note that general FiniteSet is unordered, the solution returned
here is not simply a FiniteSet of solutions, rather it is a FiniteSet of
ordered tuple, i.e. the first & only argument to FiniteSet is a tuple of
solutions, which is ordered, & hence the returned solution is ordered.
Also note that solution could also have been returned as an ordered tuple,
FiniteSet is just a wrapper `{}` around the tuple. It has no other
significance except for the fact it is just used to maintain a consistent
output format throughout the solveset.
Raises
======
ValueError
The input is not valid.
The symbols are not given.
AttributeError
The input symbols are not `Symbol` type.
Examples
========
>>> from sympy.core.symbol import symbols
>>> x, y = symbols('x, y', real=True)
>>> from sympy.solvers.solveset import substitution
>>> substitution([x + y], [x], [{y: 1}], [y], set([]), [x, y])
{(-1, 1)}
* when you want soln should not satisfy eq `x + 1 = 0`
>>> substitution([x + y], [x], [{y: 1}], [y], set([x + 1]), [y, x])
EmptySet()
>>> substitution([x + y], [x], [{y: 1}], [y], set([x - 1]), [y, x])
{(1, -1)}
>>> substitution([x + y - 1, y - x**2 + 5], [x, y])
{(-3, 4), (2, -1)}
* Returns both real and complex solution
>>> x, y, z = symbols('x, y, z')
>>> from sympy import exp, sin
>>> substitution([exp(x) - sin(y), y**2 - 4], [x, y])
{(log(sin(2)), 2), (ImageSet(Lambda(_n, I*(2*_n*pi + pi) +
log(sin(2))), Integers()), -2), (ImageSet(Lambda(_n, 2*_n*I*pi +
Mod(log(sin(2)), 2*I*pi)), Integers()), 2)}
>>> eqs = [z**2 + exp(2*x) - sin(y), -3 + exp(-y)]
>>> substitution(eqs, [y, z])
{(-log(3), -sqrt(-exp(2*x) - sin(log(3)))),
(-log(3), sqrt(-exp(2*x) - sin(log(3)))),
(ImageSet(Lambda(_n, 2*_n*I*pi + Mod(-log(3), 2*I*pi)), Integers()),
ImageSet(Lambda(_n, -sqrt(-exp(2*x) + sin(2*_n*I*pi +
Mod(-log(3), 2*I*pi)))), Integers())),
(ImageSet(Lambda(_n, 2*_n*I*pi + Mod(-log(3), 2*I*pi)), Integers()),
ImageSet(Lambda(_n, sqrt(-exp(2*x) + sin(2*_n*I*pi +
Mod(-log(3), 2*I*pi)))), Integers()))} | sympy/solvers/solveset.py | substitution | aktech/sympy | python | def substitution(system, symbols, result=[{}], known_symbols=[], exclude=[], all_symbols=None):
"\n Solves the `system` using substitution method. It is used in\n `nonlinsolve`. This will be called from `nonlinsolve` when any\n equation(s) is non polynomial equation.\n\n Parameters\n ==========\n\n system : list of equations\n The target system of equations\n symbols : list of symbols to be solved.\n The variable(s) for which the system is solved\n known_symbols : list of solved symbols\n Values are known for these variable(s)\n result : An empty list or list of dict\n If No symbol values is known then empty list otherwise\n symbol as keys and corresponding value in dict.\n exclude : Set of expression.\n Mostly denominator expression(s) of the equations of the system.\n Final solution should not satisfy these expressions.\n all_symbols : known_symbols + symbols(unsolved).\n\n Returns\n =======\n\n A FiniteSet of ordered tuple of values of `all_symbols` for which the\n `system` has solution. Order of values in the tuple is same as symbols\n present in the parameter `all_symbols`. If parameter `all_symbols` is None\n then same as symbols present in the parameter `symbols`.\n\n Please note that general FiniteSet is unordered, the solution returned\n here is not simply a FiniteSet of solutions, rather it is a FiniteSet of\n ordered tuple, i.e. the first & only argument to FiniteSet is a tuple of\n solutions, which is ordered, & hence the returned solution is ordered.\n\n Also note that solution could also have been returned as an ordered tuple,\n FiniteSet is just a wrapper `{}` around the tuple. It has no other\n significance except for the fact it is just used to maintain a consistent\n output format throughout the solveset.\n\n Raises\n ======\n\n ValueError\n The input is not valid.\n The symbols are not given.\n AttributeError\n The input symbols are not `Symbol` type.\n\n Examples\n ========\n\n >>> from sympy.core.symbol import symbols\n >>> x, y = symbols('x, y', real=True)\n >>> from sympy.solvers.solveset import substitution\n >>> substitution([x + y], [x], [{y: 1}], [y], set([]), [x, y])\n {(-1, 1)}\n\n * when you want soln should not satisfy eq `x + 1 = 0`\n\n >>> substitution([x + y], [x], [{y: 1}], [y], set([x + 1]), [y, x])\n EmptySet()\n >>> substitution([x + y], [x], [{y: 1}], [y], set([x - 1]), [y, x])\n {(1, -1)}\n >>> substitution([x + y - 1, y - x**2 + 5], [x, y])\n {(-3, 4), (2, -1)}\n\n * Returns both real and complex solution\n\n >>> x, y, z = symbols('x, y, z')\n >>> from sympy import exp, sin\n >>> substitution([exp(x) - sin(y), y**2 - 4], [x, y])\n {(log(sin(2)), 2), (ImageSet(Lambda(_n, I*(2*_n*pi + pi) +\n log(sin(2))), Integers()), -2), (ImageSet(Lambda(_n, 2*_n*I*pi +\n Mod(log(sin(2)), 2*I*pi)), Integers()), 2)}\n\n >>> eqs = [z**2 + exp(2*x) - sin(y), -3 + exp(-y)]\n >>> substitution(eqs, [y, z])\n {(-log(3), -sqrt(-exp(2*x) - sin(log(3)))),\n (-log(3), sqrt(-exp(2*x) - sin(log(3)))),\n (ImageSet(Lambda(_n, 2*_n*I*pi + Mod(-log(3), 2*I*pi)), Integers()),\n ImageSet(Lambda(_n, -sqrt(-exp(2*x) + sin(2*_n*I*pi +\n Mod(-log(3), 2*I*pi)))), Integers())),\n (ImageSet(Lambda(_n, 2*_n*I*pi + Mod(-log(3), 2*I*pi)), Integers()),\n ImageSet(Lambda(_n, sqrt(-exp(2*x) + sin(2*_n*I*pi +\n Mod(-log(3), 2*I*pi)))), Integers()))}\n\n "
from sympy import Complement
from sympy.core.compatibility import is_sequence
if (not system):
return S.EmptySet
if (not symbols):
msg = 'Symbols must be given, for which solution of the system is to be found.'
raise ValueError(filldedent(msg))
if (not is_sequence(symbols)):
msg = 'symbols should be given as a sequence, e.g. a list.Not type %s: %s'
raise TypeError(filldedent((msg % (type(symbols), symbols))))
try:
sym = symbols[0].is_Symbol
except AttributeError:
sym = False
if (not sym):
msg = 'Iterable of symbols must be given as second argument, not type %s: %s'
raise ValueError(filldedent((msg % (type(symbols[0]), symbols[0]))))
if (all_symbols is None):
all_symbols = symbols
old_result = result
complements = {}
intersections = {}
total_conditionset = (- 1)
total_solveset_call = (- 1)
def _unsolved_syms(eq, sort=False):
'Returns the unsolved symbol present\n in the equation `eq`.\n '
free = eq.free_symbols
unsolved = ((free - set(known_symbols)) & set(all_symbols))
if sort:
unsolved = list(unsolved)
unsolved.sort(key=default_sort_key)
return unsolved
eqs_in_better_order = list(ordered(system, (lambda _: len(_unsolved_syms(_)))))
def add_intersection_complement(result, sym_set, **flags):
final_result = []
for res in result:
res_copy = res
for (key_res, value_res) in res.items():
intersection_true = flags.get('Intersection', True)
complements_true = flags.get('Complement', True)
for (key_sym, value_sym) in sym_set.items():
if (key_sym == key_res):
if intersection_true:
new_value = Intersection(FiniteSet(value_res), value_sym)
if (new_value is not S.EmptySet):
res_copy[key_res] = new_value
if complements_true:
new_value = Complement(FiniteSet(value_res), value_sym)
if (new_value is not S.EmptySet):
res_copy[key_res] = new_value
final_result.append(res_copy)
return final_result
def _extract_main_soln(sol, soln_imageset):
"separate the Complements, Intersections, ImageSet lambda expr\n and it's base_set.\n "
if isinstance(sol, Complement):
complements[sym] = sol.args[1]
sol = sol.args[0]
if isinstance(sol, Intersection):
if (sol.args[0] != Interval((- oo), oo)):
intersections[sym] = sol.args[0]
sol = sol.args[1]
if isinstance(sol, ImageSet):
soln_imagest = sol
expr2 = sol.lamda.expr
sol = FiniteSet(expr2)
soln_imageset[expr2] = soln_imagest
if isinstance(sol, Union):
sol_args = sol.args
sol = S.EmptySet
for sol_arg2 in sol_args:
if isinstance(sol_arg2, FiniteSet):
sol += sol_arg2
else:
sol += FiniteSet(sol_arg2)
if (not isinstance(sol, FiniteSet)):
sol = FiniteSet(sol)
return (sol, soln_imageset)
def _check_exclude(rnew, imgset_yes):
rnew_ = rnew
if imgset_yes:
rnew_copy = rnew.copy()
dummy_n = imgset_yes[0]
for (key_res, value_res) in rnew_copy.items():
rnew_copy[key_res] = value_res.subs(dummy_n, 0)
rnew_ = rnew_copy
try:
satisfy_exclude = any((checksol(d, rnew_) for d in exclude))
except TypeError:
satisfy_exclude = None
return satisfy_exclude
def _restore_imgset(rnew, original_imageset, newresult):
restore_sym = (set(rnew.keys()) & set(original_imageset.keys()))
for key_sym in restore_sym:
img = original_imageset[key_sym]
rnew[key_sym] = img
if (rnew not in newresult):
newresult.append(rnew)
def _append_eq(eq, result, res, delete_soln, n=None):
u = Dummy('u')
if n:
eq = eq.subs(n, 0)
satisfy = checksol(u, u, eq, minimal=True)
if (satisfy is False):
delete_soln = True
res = {}
else:
result.append(res)
return (result, res, delete_soln)
def _append_new_soln(rnew, sym, sol, imgset_yes, soln_imageset, original_imageset, newresult, eq=None):
'If `rnew` (A dict <symbol: soln>) contains valid soln\n append it to `newresult` list.\n `imgset_yes` is (base, dummy_var) if there was imageset in previously\n calculated result(otherwise empty tuple). `original_imageset` is dict\n of imageset expr and imageset from this result.\n `soln_imageset` dict of imageset expr and imageset of new soln.\n '
satisfy_exclude = _check_exclude(rnew, imgset_yes)
delete_soln = False
if (not satisfy_exclude):
local_n = None
if imgset_yes:
local_n = imgset_yes[0]
base = imgset_yes[1]
if (sym and sol):
dummy_list = list(sol.atoms(Dummy))
local_n_list = [local_n for i in range(0, len(dummy_list))]
dummy_zip = zip(dummy_list, local_n_list)
lam = Lambda(local_n, sol.subs(dummy_zip))
rnew[sym] = ImageSet(lam, base)
if (eq is not None):
(newresult, rnew, delete_soln) = _append_eq(eq, newresult, rnew, delete_soln, local_n)
elif (eq is not None):
(newresult, rnew, delete_soln) = _append_eq(eq, newresult, rnew, delete_soln)
elif soln_imageset:
rnew[sym] = soln_imageset[sol]
_restore_imgset(rnew, original_imageset, newresult)
else:
newresult.append(rnew)
elif satisfy_exclude:
delete_soln = True
rnew = {}
_restore_imgset(rnew, original_imageset, newresult)
return (newresult, delete_soln)
def _new_order_result(result, eq):
first_priority = []
second_priority = []
for res in result:
if (not any((isinstance(val, ImageSet) for val in res.values()))):
if (eq.subs(res) == 0):
first_priority.append(res)
else:
second_priority.append(res)
if (first_priority or second_priority):
return (first_priority + second_priority)
return result
def _solve_using_known_values(result, solver):
'Solves the system using already known solution\n (result contains the dict <symbol: value>).\n solver is `solveset_complex` or `solveset_real`.\n '
soln_imageset = {}
total_solvest_call = 0
total_conditionst = 0
for (index, eq) in enumerate(eqs_in_better_order):
newresult = []
original_imageset = {}
imgset_yes = False
result = _new_order_result(result, eq)
for res in result:
got_symbol = set()
if soln_imageset:
for (key_res, value_res) in res.items():
if isinstance(value_res, ImageSet):
res[key_res] = value_res.lamda.expr
original_imageset[key_res] = value_res
dummy_n = value_res.lamda.expr.atoms(Dummy).pop()
base = value_res.base_set
imgset_yes = (dummy_n, base)
eq2 = eq.subs(res)
unsolved_syms = _unsolved_syms(eq2, sort=True)
if (not unsolved_syms):
if res:
(newresult, delete_res) = _append_new_soln(res, None, None, imgset_yes, soln_imageset, original_imageset, newresult, eq2)
if delete_res:
result.remove(res)
continue
depen = eq2.as_independent(unsolved_syms)[0]
if (depen.has(Abs) and (solver == solveset_complex)):
continue
soln_imageset = {}
for sym in unsolved_syms:
not_solvable = False
try:
soln = solver(eq2, sym)
total_solvest_call += 1
soln_new = S.EmptySet
if isinstance(soln, Complement):
complements[sym] = soln.args[1]
soln = soln.args[0]
if isinstance(soln, Intersection):
if (soln.args[0] != Interval((- oo), oo)):
intersections[sym] = soln.args[0]
soln_new += soln.args[1]
soln = (soln_new if soln_new else soln)
if ((index > 0) and (solver == solveset_real)):
if (not isinstance(soln, (ImageSet, ConditionSet))):
soln += solveset_complex(eq2, sym)
except NotImplementedError:
continue
if isinstance(soln, ConditionSet):
soln = S.EmptySet
not_solvable = True
total_conditionst += 1
if (soln is not S.EmptySet):
(soln, soln_imageset) = _extract_main_soln(soln, soln_imageset)
for sol in soln:
(sol, soln_imageset) = _extract_main_soln(sol, soln_imageset)
sol = set(sol).pop()
free = sol.free_symbols
if (got_symbol and any([(ss in free) for ss in got_symbol])):
continue
rnew = res.copy()
for (k, v) in res.items():
if isinstance(v, Expr):
rnew[k] = v.subs(sym, sol)
if soln_imageset:
imgst = soln_imageset[sol]
rnew[sym] = imgst.lamda(*[0 for i in range(0, len(imgst.lamda.variables))])
else:
rnew[sym] = sol
(newresult, delete_res) = _append_new_soln(rnew, sym, sol, imgset_yes, soln_imageset, original_imageset, newresult)
if delete_res:
result.remove(res)
if (not not_solvable):
got_symbol.add(sym)
if newresult:
result = newresult
return (result, total_solvest_call, total_conditionst)
(new_result_real, solve_call1, cnd_call1) = _solve_using_known_values(old_result, solveset_real)
(new_result_complex, solve_call2, cnd_call2) = _solve_using_known_values(old_result, solveset_complex)
total_conditionset += (cnd_call1 + cnd_call2)
total_solveset_call += (solve_call1 + solve_call2)
if ((total_conditionset == total_solveset_call) and (total_solveset_call != (- 1))):
return _return_conditionset(eqs_in_better_order, all_symbols)
result = (new_result_real + new_result_complex)
result_all_variables = []
result_infinite = []
for res in result:
if (not res):
continue
if (len(res) < len(all_symbols)):
solved_symbols = res.keys()
unsolved = list(filter((lambda x: (x not in solved_symbols)), all_symbols))
for unsolved_sym in unsolved:
res[unsolved_sym] = unsolved_sym
result_infinite.append(res)
if (res not in result_all_variables):
result_all_variables.append(res)
if result_infinite:
result_all_variables = result_infinite
if (intersections and complements):
result_all_variables = add_intersection_complement(result_all_variables, intersections, Intersection=True, Complement=True)
elif intersections:
result_all_variables = add_intersection_complement(result_all_variables, intersections, Intersection=True)
elif complements:
result_all_variables = add_intersection_complement(result_all_variables, complements, Complement=True)
result = S.EmptySet
for r in result_all_variables:
temp = [r[symb] for symb in all_symbols]
result += FiniteSet(tuple(temp))
return result |
def nonlinsolve(system, *symbols):
"\n Solve system of N non linear equations with M variables, which means both\n under and overdetermined systems are supported. Positive dimensional\n system is also supported (A system with infinitely many solutions is said\n to be positive-dimensional). In Positive dimensional system solution will\n be dependent on at least one symbol. Returns both real solution\n and complex solution(If system have). The possible number of solutions\n is zero, one or infinite.\n\n Parameters\n ==========\n\n system : list of equations\n The target system of equations\n symbols : list of Symbols\n symbols should be given as a sequence eg. list\n\n Returns\n =======\n\n A FiniteSet of ordered tuple of values of `symbols` for which the `system`\n has solution. Order of values in the tuple is same as symbols present in\n the parameter `symbols`.\n\n Please note that general FiniteSet is unordered, the solution returned\n here is not simply a FiniteSet of solutions, rather it is a FiniteSet of\n ordered tuple, i.e. the first & only argument to FiniteSet is a tuple of\n solutions, which is ordered, & hence the returned solution is ordered.\n\n Also note that solution could also have been returned as an ordered tuple,\n FiniteSet is just a wrapper `{}` around the tuple. It has no other\n significance except for the fact it is just used to maintain a consistent\n output format throughout the solveset.\n\n For the given set of Equations, the respective input types\n are given below:\n\n .. math:: x*y - 1 = 0\n .. math:: 4*x**2 + y**2 - 5 = 0\n\n `system = [x*y - 1, 4*x**2 + y**2 - 5]`\n `symbols = [x, y]`\n\n Raises\n ======\n\n ValueError\n The input is not valid.\n The symbols are not given.\n AttributeError\n The input symbols are not `Symbol` type.\n\n Examples\n ========\n\n >>> from sympy.core.symbol import symbols\n >>> from sympy.solvers.solveset import nonlinsolve\n >>> x, y, z = symbols('x, y, z', real=True)\n >>> nonlinsolve([x*y - 1, 4*x**2 + y**2 - 5], [x, y])\n {(-1, -1), (-1/2, -2), (1/2, 2), (1, 1)}\n\n 1. Positive dimensional system and complements:\n\n >>> from sympy import pprint\n >>> from sympy.polys.polytools import is_zero_dimensional\n >>> a, b, c, d = symbols('a, b, c, d', real=True)\n >>> eq1 = a + b + c + d\n >>> eq2 = a*b + b*c + c*d + d*a\n >>> eq3 = a*b*c + b*c*d + c*d*a + d*a*b\n >>> eq4 = a*b*c*d - 1\n >>> system = [eq1, eq2, eq3, eq4]\n >>> is_zero_dimensional(system)\n False\n >>> pprint(nonlinsolve(system, [a, b, c, d]), use_unicode=False)\n -1 1 1 -1\n {(---, -d, -, {d} \\ {0}), (-, -d, ---, {d} \\ {0})}\n d d d d\n >>> nonlinsolve([(x+y)**2 - 4, x + y - 2], [x, y])\n {(-y + 2, y)}\n\n 2. If some of the equations are non polynomial equation then `nonlinsolve`\n will call `substitution` function and returns real and complex solutions,\n if present.\n\n >>> from sympy import exp, sin\n >>> nonlinsolve([exp(x) - sin(y), y**2 - 4], [x, y])\n {(log(sin(2)), 2), (ImageSet(Lambda(_n, I*(2*_n*pi + pi) +\n log(sin(2))), Integers()), -2), (ImageSet(Lambda(_n, 2*_n*I*pi +\n Mod(log(sin(2)), 2*I*pi)), Integers()), 2)}\n\n 3. If system is Non linear polynomial zero dimensional then it returns\n both solution (real and complex solutions, if present using\n `solve_poly_system`):\n\n >>> from sympy import sqrt\n >>> nonlinsolve([x**2 - 2*y**2 -2, x*y - 2], [x, y])\n {(-2, -1), (2, 1), (-sqrt(2)*I, sqrt(2)*I), (sqrt(2)*I, -sqrt(2)*I)}\n\n 4. `nonlinsolve` can solve some linear(zero or positive dimensional)\n system (because it is using `groebner` function to get the\n groebner basis and then `substitution` function basis as the new `system`).\n But it is not recommended to solve linear system using `nonlinsolve`,\n because `linsolve` is better for all kind of linear system.\n\n >>> nonlinsolve([x + 2*y -z - 3, x - y - 4*z + 9 , y + z - 4], [x, y, z])\n {(3*z - 5, -z + 4, z)}\n\n 5. System having polynomial equations and only real solution is present\n (will be solved using `solve_poly_system`):\n\n >>> e1 = sqrt(x**2 + y**2) - 10\n >>> e2 = sqrt(y**2 + (-x + 10)**2) - 3\n >>> nonlinsolve((e1, e2), (x, y))\n {(191/20, -3*sqrt(391)/20), (191/20, 3*sqrt(391)/20)}\n >>> nonlinsolve([x**2 + 2/y - 2, x + y - 3], [x, y])\n {(1, 2), (1 + sqrt(5), -sqrt(5) + 2), (-sqrt(5) + 1, 2 + sqrt(5))}\n >>> nonlinsolve([x**2 + 2/y - 2, x + y - 3], [y, x])\n {(2, 1), (2 + sqrt(5), -sqrt(5) + 1), (-sqrt(5) + 2, 1 + sqrt(5))}\n\n 6. It is better to use symbols instead of Trigonometric Function or\n Function (e.g. replace `sin(x)` with symbol, replace `f(x)` with symbol\n and so on. Get soln from `nonlinsolve` and then using `solveset` get\n the value of `x`)\n\n How nonlinsolve is better than old solver `_solve_system` :\n ===========================================================\n\n 1. A positive dimensional system solver : nonlinsolve can return\n solution for positive dimensional system. It finds the\n Groebner Basis of the positive dimensional system(calling it as\n basis) then we can start solving equation(having least number of\n variable first in the basis) using solveset and substituting that\n solved solutions into other equation(of basis) to get solution in\n terms of minimum variables. Here the important thing is how we\n are substituting the known values and in which equations.\n\n 2. Real and Complex both solutions : nonlinsolve returns both real\n and complex solution. If all the equations in the system are polynomial\n then using `solve_poly_system` both real and complex solution is returned.\n If all the equations in the system are not polynomial equation then goes to\n `substitution` method with this polynomial and non polynomial equation(s),\n to solve for unsolved variables. Here to solve for particular variable\n solveset_real and solveset_complex is used. For both real and complex\n solution function `_solve_using_know_values` is used inside `substitution`\n function.(`substitution` function will be called when there is any non\n polynomial equation(s) is present). When solution is valid then add its\n general solution in the final result.\n\n 3. Complement and Intersection will be added if any : nonlinsolve maintains\n dict for complements and Intersections. If solveset find complements or/and\n Intersection with any Interval or set during the execution of\n `substitution` function ,then complement or/and Intersection for that\n variable is added before returning final solution.\n\n "
from sympy.polys.polytools import is_zero_dimensional
if (not system):
return S.EmptySet
if (not symbols):
msg = 'Symbols must be given, for which solution of the system is to be found.'
raise ValueError(filldedent(msg))
if hasattr(symbols[0], '__iter__'):
symbols = symbols[0]
try:
sym = symbols[0].is_Symbol
except AttributeError:
sym = False
except IndexError:
msg = 'Symbols must be given, for which solution of the system is to be found.'
raise IndexError(filldedent(msg))
if (not sym):
msg = 'Symbols or iterable of symbols must be given as second argument, not type %s: %s'
raise ValueError(filldedent((msg % (type(symbols[0]), symbols[0]))))
if ((len(system) == 1) and (len(symbols) == 1)):
return _solveset_work(system, symbols)
(polys, polys_expr, nonpolys, denominators) = _separate_poly_nonpoly(system, symbols)
if (len(symbols) == len(polys)):
if is_zero_dimensional(polys, symbols):
try:
return _handle_zero_dimensional(polys, symbols, system)
except NotImplementedError:
result = substitution(polys_expr, symbols, exclude=denominators)
return result
return _handle_positive_dimensional(polys, symbols, denominators)
else:
result = substitution((polys_expr + nonpolys), symbols, exclude=denominators)
return result | 6,897,244,678,591,841,000 | Solve system of N non linear equations with M variables, which means both
under and overdetermined systems are supported. Positive dimensional
system is also supported (A system with infinitely many solutions is said
to be positive-dimensional). In Positive dimensional system solution will
be dependent on at least one symbol. Returns both real solution
and complex solution(If system have). The possible number of solutions
is zero, one or infinite.
Parameters
==========
system : list of equations
The target system of equations
symbols : list of Symbols
symbols should be given as a sequence eg. list
Returns
=======
A FiniteSet of ordered tuple of values of `symbols` for which the `system`
has solution. Order of values in the tuple is same as symbols present in
the parameter `symbols`.
Please note that general FiniteSet is unordered, the solution returned
here is not simply a FiniteSet of solutions, rather it is a FiniteSet of
ordered tuple, i.e. the first & only argument to FiniteSet is a tuple of
solutions, which is ordered, & hence the returned solution is ordered.
Also note that solution could also have been returned as an ordered tuple,
FiniteSet is just a wrapper `{}` around the tuple. It has no other
significance except for the fact it is just used to maintain a consistent
output format throughout the solveset.
For the given set of Equations, the respective input types
are given below:
.. math:: x*y - 1 = 0
.. math:: 4*x**2 + y**2 - 5 = 0
`system = [x*y - 1, 4*x**2 + y**2 - 5]`
`symbols = [x, y]`
Raises
======
ValueError
The input is not valid.
The symbols are not given.
AttributeError
The input symbols are not `Symbol` type.
Examples
========
>>> from sympy.core.symbol import symbols
>>> from sympy.solvers.solveset import nonlinsolve
>>> x, y, z = symbols('x, y, z', real=True)
>>> nonlinsolve([x*y - 1, 4*x**2 + y**2 - 5], [x, y])
{(-1, -1), (-1/2, -2), (1/2, 2), (1, 1)}
1. Positive dimensional system and complements:
>>> from sympy import pprint
>>> from sympy.polys.polytools import is_zero_dimensional
>>> a, b, c, d = symbols('a, b, c, d', real=True)
>>> eq1 = a + b + c + d
>>> eq2 = a*b + b*c + c*d + d*a
>>> eq3 = a*b*c + b*c*d + c*d*a + d*a*b
>>> eq4 = a*b*c*d - 1
>>> system = [eq1, eq2, eq3, eq4]
>>> is_zero_dimensional(system)
False
>>> pprint(nonlinsolve(system, [a, b, c, d]), use_unicode=False)
-1 1 1 -1
{(---, -d, -, {d} \ {0}), (-, -d, ---, {d} \ {0})}
d d d d
>>> nonlinsolve([(x+y)**2 - 4, x + y - 2], [x, y])
{(-y + 2, y)}
2. If some of the equations are non polynomial equation then `nonlinsolve`
will call `substitution` function and returns real and complex solutions,
if present.
>>> from sympy import exp, sin
>>> nonlinsolve([exp(x) - sin(y), y**2 - 4], [x, y])
{(log(sin(2)), 2), (ImageSet(Lambda(_n, I*(2*_n*pi + pi) +
log(sin(2))), Integers()), -2), (ImageSet(Lambda(_n, 2*_n*I*pi +
Mod(log(sin(2)), 2*I*pi)), Integers()), 2)}
3. If system is Non linear polynomial zero dimensional then it returns
both solution (real and complex solutions, if present using
`solve_poly_system`):
>>> from sympy import sqrt
>>> nonlinsolve([x**2 - 2*y**2 -2, x*y - 2], [x, y])
{(-2, -1), (2, 1), (-sqrt(2)*I, sqrt(2)*I), (sqrt(2)*I, -sqrt(2)*I)}
4. `nonlinsolve` can solve some linear(zero or positive dimensional)
system (because it is using `groebner` function to get the
groebner basis and then `substitution` function basis as the new `system`).
But it is not recommended to solve linear system using `nonlinsolve`,
because `linsolve` is better for all kind of linear system.
>>> nonlinsolve([x + 2*y -z - 3, x - y - 4*z + 9 , y + z - 4], [x, y, z])
{(3*z - 5, -z + 4, z)}
5. System having polynomial equations and only real solution is present
(will be solved using `solve_poly_system`):
>>> e1 = sqrt(x**2 + y**2) - 10
>>> e2 = sqrt(y**2 + (-x + 10)**2) - 3
>>> nonlinsolve((e1, e2), (x, y))
{(191/20, -3*sqrt(391)/20), (191/20, 3*sqrt(391)/20)}
>>> nonlinsolve([x**2 + 2/y - 2, x + y - 3], [x, y])
{(1, 2), (1 + sqrt(5), -sqrt(5) + 2), (-sqrt(5) + 1, 2 + sqrt(5))}
>>> nonlinsolve([x**2 + 2/y - 2, x + y - 3], [y, x])
{(2, 1), (2 + sqrt(5), -sqrt(5) + 1), (-sqrt(5) + 2, 1 + sqrt(5))}
6. It is better to use symbols instead of Trigonometric Function or
Function (e.g. replace `sin(x)` with symbol, replace `f(x)` with symbol
and so on. Get soln from `nonlinsolve` and then using `solveset` get
the value of `x`)
How nonlinsolve is better than old solver `_solve_system` :
===========================================================
1. A positive dimensional system solver : nonlinsolve can return
solution for positive dimensional system. It finds the
Groebner Basis of the positive dimensional system(calling it as
basis) then we can start solving equation(having least number of
variable first in the basis) using solveset and substituting that
solved solutions into other equation(of basis) to get solution in
terms of minimum variables. Here the important thing is how we
are substituting the known values and in which equations.
2. Real and Complex both solutions : nonlinsolve returns both real
and complex solution. If all the equations in the system are polynomial
then using `solve_poly_system` both real and complex solution is returned.
If all the equations in the system are not polynomial equation then goes to
`substitution` method with this polynomial and non polynomial equation(s),
to solve for unsolved variables. Here to solve for particular variable
solveset_real and solveset_complex is used. For both real and complex
solution function `_solve_using_know_values` is used inside `substitution`
function.(`substitution` function will be called when there is any non
polynomial equation(s) is present). When solution is valid then add its
general solution in the final result.
3. Complement and Intersection will be added if any : nonlinsolve maintains
dict for complements and Intersections. If solveset find complements or/and
Intersection with any Interval or set during the execution of
`substitution` function ,then complement or/and Intersection for that
variable is added before returning final solution. | sympy/solvers/solveset.py | nonlinsolve | aktech/sympy | python | def nonlinsolve(system, *symbols):
"\n Solve system of N non linear equations with M variables, which means both\n under and overdetermined systems are supported. Positive dimensional\n system is also supported (A system with infinitely many solutions is said\n to be positive-dimensional). In Positive dimensional system solution will\n be dependent on at least one symbol. Returns both real solution\n and complex solution(If system have). The possible number of solutions\n is zero, one or infinite.\n\n Parameters\n ==========\n\n system : list of equations\n The target system of equations\n symbols : list of Symbols\n symbols should be given as a sequence eg. list\n\n Returns\n =======\n\n A FiniteSet of ordered tuple of values of `symbols` for which the `system`\n has solution. Order of values in the tuple is same as symbols present in\n the parameter `symbols`.\n\n Please note that general FiniteSet is unordered, the solution returned\n here is not simply a FiniteSet of solutions, rather it is a FiniteSet of\n ordered tuple, i.e. the first & only argument to FiniteSet is a tuple of\n solutions, which is ordered, & hence the returned solution is ordered.\n\n Also note that solution could also have been returned as an ordered tuple,\n FiniteSet is just a wrapper `{}` around the tuple. It has no other\n significance except for the fact it is just used to maintain a consistent\n output format throughout the solveset.\n\n For the given set of Equations, the respective input types\n are given below:\n\n .. math:: x*y - 1 = 0\n .. math:: 4*x**2 + y**2 - 5 = 0\n\n `system = [x*y - 1, 4*x**2 + y**2 - 5]`\n `symbols = [x, y]`\n\n Raises\n ======\n\n ValueError\n The input is not valid.\n The symbols are not given.\n AttributeError\n The input symbols are not `Symbol` type.\n\n Examples\n ========\n\n >>> from sympy.core.symbol import symbols\n >>> from sympy.solvers.solveset import nonlinsolve\n >>> x, y, z = symbols('x, y, z', real=True)\n >>> nonlinsolve([x*y - 1, 4*x**2 + y**2 - 5], [x, y])\n {(-1, -1), (-1/2, -2), (1/2, 2), (1, 1)}\n\n 1. Positive dimensional system and complements:\n\n >>> from sympy import pprint\n >>> from sympy.polys.polytools import is_zero_dimensional\n >>> a, b, c, d = symbols('a, b, c, d', real=True)\n >>> eq1 = a + b + c + d\n >>> eq2 = a*b + b*c + c*d + d*a\n >>> eq3 = a*b*c + b*c*d + c*d*a + d*a*b\n >>> eq4 = a*b*c*d - 1\n >>> system = [eq1, eq2, eq3, eq4]\n >>> is_zero_dimensional(system)\n False\n >>> pprint(nonlinsolve(system, [a, b, c, d]), use_unicode=False)\n -1 1 1 -1\n {(---, -d, -, {d} \\ {0}), (-, -d, ---, {d} \\ {0})}\n d d d d\n >>> nonlinsolve([(x+y)**2 - 4, x + y - 2], [x, y])\n {(-y + 2, y)}\n\n 2. If some of the equations are non polynomial equation then `nonlinsolve`\n will call `substitution` function and returns real and complex solutions,\n if present.\n\n >>> from sympy import exp, sin\n >>> nonlinsolve([exp(x) - sin(y), y**2 - 4], [x, y])\n {(log(sin(2)), 2), (ImageSet(Lambda(_n, I*(2*_n*pi + pi) +\n log(sin(2))), Integers()), -2), (ImageSet(Lambda(_n, 2*_n*I*pi +\n Mod(log(sin(2)), 2*I*pi)), Integers()), 2)}\n\n 3. If system is Non linear polynomial zero dimensional then it returns\n both solution (real and complex solutions, if present using\n `solve_poly_system`):\n\n >>> from sympy import sqrt\n >>> nonlinsolve([x**2 - 2*y**2 -2, x*y - 2], [x, y])\n {(-2, -1), (2, 1), (-sqrt(2)*I, sqrt(2)*I), (sqrt(2)*I, -sqrt(2)*I)}\n\n 4. `nonlinsolve` can solve some linear(zero or positive dimensional)\n system (because it is using `groebner` function to get the\n groebner basis and then `substitution` function basis as the new `system`).\n But it is not recommended to solve linear system using `nonlinsolve`,\n because `linsolve` is better for all kind of linear system.\n\n >>> nonlinsolve([x + 2*y -z - 3, x - y - 4*z + 9 , y + z - 4], [x, y, z])\n {(3*z - 5, -z + 4, z)}\n\n 5. System having polynomial equations and only real solution is present\n (will be solved using `solve_poly_system`):\n\n >>> e1 = sqrt(x**2 + y**2) - 10\n >>> e2 = sqrt(y**2 + (-x + 10)**2) - 3\n >>> nonlinsolve((e1, e2), (x, y))\n {(191/20, -3*sqrt(391)/20), (191/20, 3*sqrt(391)/20)}\n >>> nonlinsolve([x**2 + 2/y - 2, x + y - 3], [x, y])\n {(1, 2), (1 + sqrt(5), -sqrt(5) + 2), (-sqrt(5) + 1, 2 + sqrt(5))}\n >>> nonlinsolve([x**2 + 2/y - 2, x + y - 3], [y, x])\n {(2, 1), (2 + sqrt(5), -sqrt(5) + 1), (-sqrt(5) + 2, 1 + sqrt(5))}\n\n 6. It is better to use symbols instead of Trigonometric Function or\n Function (e.g. replace `sin(x)` with symbol, replace `f(x)` with symbol\n and so on. Get soln from `nonlinsolve` and then using `solveset` get\n the value of `x`)\n\n How nonlinsolve is better than old solver `_solve_system` :\n ===========================================================\n\n 1. A positive dimensional system solver : nonlinsolve can return\n solution for positive dimensional system. It finds the\n Groebner Basis of the positive dimensional system(calling it as\n basis) then we can start solving equation(having least number of\n variable first in the basis) using solveset and substituting that\n solved solutions into other equation(of basis) to get solution in\n terms of minimum variables. Here the important thing is how we\n are substituting the known values and in which equations.\n\n 2. Real and Complex both solutions : nonlinsolve returns both real\n and complex solution. If all the equations in the system are polynomial\n then using `solve_poly_system` both real and complex solution is returned.\n If all the equations in the system are not polynomial equation then goes to\n `substitution` method with this polynomial and non polynomial equation(s),\n to solve for unsolved variables. Here to solve for particular variable\n solveset_real and solveset_complex is used. For both real and complex\n solution function `_solve_using_know_values` is used inside `substitution`\n function.(`substitution` function will be called when there is any non\n polynomial equation(s) is present). When solution is valid then add its\n general solution in the final result.\n\n 3. Complement and Intersection will be added if any : nonlinsolve maintains\n dict for complements and Intersections. If solveset find complements or/and\n Intersection with any Interval or set during the execution of\n `substitution` function ,then complement or/and Intersection for that\n variable is added before returning final solution.\n\n "
from sympy.polys.polytools import is_zero_dimensional
if (not system):
return S.EmptySet
if (not symbols):
msg = 'Symbols must be given, for which solution of the system is to be found.'
raise ValueError(filldedent(msg))
if hasattr(symbols[0], '__iter__'):
symbols = symbols[0]
try:
sym = symbols[0].is_Symbol
except AttributeError:
sym = False
except IndexError:
msg = 'Symbols must be given, for which solution of the system is to be found.'
raise IndexError(filldedent(msg))
if (not sym):
msg = 'Symbols or iterable of symbols must be given as second argument, not type %s: %s'
raise ValueError(filldedent((msg % (type(symbols[0]), symbols[0]))))
if ((len(system) == 1) and (len(symbols) == 1)):
return _solveset_work(system, symbols)
(polys, polys_expr, nonpolys, denominators) = _separate_poly_nonpoly(system, symbols)
if (len(symbols) == len(polys)):
if is_zero_dimensional(polys, symbols):
try:
return _handle_zero_dimensional(polys, symbols, system)
except NotImplementedError:
result = substitution(polys_expr, symbols, exclude=denominators)
return result
return _handle_positive_dimensional(polys, symbols, denominators)
else:
result = substitution((polys_expr + nonpolys), symbols, exclude=denominators)
return result |
def _unsolved_syms(eq, sort=False):
'Returns the unsolved symbol present\n in the equation `eq`.\n '
free = eq.free_symbols
unsolved = ((free - set(known_symbols)) & set(all_symbols))
if sort:
unsolved = list(unsolved)
unsolved.sort(key=default_sort_key)
return unsolved | 3,910,959,993,474,881,000 | Returns the unsolved symbol present
in the equation `eq`. | sympy/solvers/solveset.py | _unsolved_syms | aktech/sympy | python | def _unsolved_syms(eq, sort=False):
'Returns the unsolved symbol present\n in the equation `eq`.\n '
free = eq.free_symbols
unsolved = ((free - set(known_symbols)) & set(all_symbols))
if sort:
unsolved = list(unsolved)
unsolved.sort(key=default_sort_key)
return unsolved |
def _extract_main_soln(sol, soln_imageset):
"separate the Complements, Intersections, ImageSet lambda expr\n and it's base_set.\n "
if isinstance(sol, Complement):
complements[sym] = sol.args[1]
sol = sol.args[0]
if isinstance(sol, Intersection):
if (sol.args[0] != Interval((- oo), oo)):
intersections[sym] = sol.args[0]
sol = sol.args[1]
if isinstance(sol, ImageSet):
soln_imagest = sol
expr2 = sol.lamda.expr
sol = FiniteSet(expr2)
soln_imageset[expr2] = soln_imagest
if isinstance(sol, Union):
sol_args = sol.args
sol = S.EmptySet
for sol_arg2 in sol_args:
if isinstance(sol_arg2, FiniteSet):
sol += sol_arg2
else:
sol += FiniteSet(sol_arg2)
if (not isinstance(sol, FiniteSet)):
sol = FiniteSet(sol)
return (sol, soln_imageset) | 5,009,555,416,651,553,000 | separate the Complements, Intersections, ImageSet lambda expr
and it's base_set. | sympy/solvers/solveset.py | _extract_main_soln | aktech/sympy | python | def _extract_main_soln(sol, soln_imageset):
"separate the Complements, Intersections, ImageSet lambda expr\n and it's base_set.\n "
if isinstance(sol, Complement):
complements[sym] = sol.args[1]
sol = sol.args[0]
if isinstance(sol, Intersection):
if (sol.args[0] != Interval((- oo), oo)):
intersections[sym] = sol.args[0]
sol = sol.args[1]
if isinstance(sol, ImageSet):
soln_imagest = sol
expr2 = sol.lamda.expr
sol = FiniteSet(expr2)
soln_imageset[expr2] = soln_imagest
if isinstance(sol, Union):
sol_args = sol.args
sol = S.EmptySet
for sol_arg2 in sol_args:
if isinstance(sol_arg2, FiniteSet):
sol += sol_arg2
else:
sol += FiniteSet(sol_arg2)
if (not isinstance(sol, FiniteSet)):
sol = FiniteSet(sol)
return (sol, soln_imageset) |
def _append_new_soln(rnew, sym, sol, imgset_yes, soln_imageset, original_imageset, newresult, eq=None):
'If `rnew` (A dict <symbol: soln>) contains valid soln\n append it to `newresult` list.\n `imgset_yes` is (base, dummy_var) if there was imageset in previously\n calculated result(otherwise empty tuple). `original_imageset` is dict\n of imageset expr and imageset from this result.\n `soln_imageset` dict of imageset expr and imageset of new soln.\n '
satisfy_exclude = _check_exclude(rnew, imgset_yes)
delete_soln = False
if (not satisfy_exclude):
local_n = None
if imgset_yes:
local_n = imgset_yes[0]
base = imgset_yes[1]
if (sym and sol):
dummy_list = list(sol.atoms(Dummy))
local_n_list = [local_n for i in range(0, len(dummy_list))]
dummy_zip = zip(dummy_list, local_n_list)
lam = Lambda(local_n, sol.subs(dummy_zip))
rnew[sym] = ImageSet(lam, base)
if (eq is not None):
(newresult, rnew, delete_soln) = _append_eq(eq, newresult, rnew, delete_soln, local_n)
elif (eq is not None):
(newresult, rnew, delete_soln) = _append_eq(eq, newresult, rnew, delete_soln)
elif soln_imageset:
rnew[sym] = soln_imageset[sol]
_restore_imgset(rnew, original_imageset, newresult)
else:
newresult.append(rnew)
elif satisfy_exclude:
delete_soln = True
rnew = {}
_restore_imgset(rnew, original_imageset, newresult)
return (newresult, delete_soln) | 1,804,431,466,947,199,000 | If `rnew` (A dict <symbol: soln>) contains valid soln
append it to `newresult` list.
`imgset_yes` is (base, dummy_var) if there was imageset in previously
calculated result(otherwise empty tuple). `original_imageset` is dict
of imageset expr and imageset from this result.
`soln_imageset` dict of imageset expr and imageset of new soln. | sympy/solvers/solveset.py | _append_new_soln | aktech/sympy | python | def _append_new_soln(rnew, sym, sol, imgset_yes, soln_imageset, original_imageset, newresult, eq=None):
'If `rnew` (A dict <symbol: soln>) contains valid soln\n append it to `newresult` list.\n `imgset_yes` is (base, dummy_var) if there was imageset in previously\n calculated result(otherwise empty tuple). `original_imageset` is dict\n of imageset expr and imageset from this result.\n `soln_imageset` dict of imageset expr and imageset of new soln.\n '
satisfy_exclude = _check_exclude(rnew, imgset_yes)
delete_soln = False
if (not satisfy_exclude):
local_n = None
if imgset_yes:
local_n = imgset_yes[0]
base = imgset_yes[1]
if (sym and sol):
dummy_list = list(sol.atoms(Dummy))
local_n_list = [local_n for i in range(0, len(dummy_list))]
dummy_zip = zip(dummy_list, local_n_list)
lam = Lambda(local_n, sol.subs(dummy_zip))
rnew[sym] = ImageSet(lam, base)
if (eq is not None):
(newresult, rnew, delete_soln) = _append_eq(eq, newresult, rnew, delete_soln, local_n)
elif (eq is not None):
(newresult, rnew, delete_soln) = _append_eq(eq, newresult, rnew, delete_soln)
elif soln_imageset:
rnew[sym] = soln_imageset[sol]
_restore_imgset(rnew, original_imageset, newresult)
else:
newresult.append(rnew)
elif satisfy_exclude:
delete_soln = True
rnew = {}
_restore_imgset(rnew, original_imageset, newresult)
return (newresult, delete_soln) |
def _solve_using_known_values(result, solver):
'Solves the system using already known solution\n (result contains the dict <symbol: value>).\n solver is `solveset_complex` or `solveset_real`.\n '
soln_imageset = {}
total_solvest_call = 0
total_conditionst = 0
for (index, eq) in enumerate(eqs_in_better_order):
newresult = []
original_imageset = {}
imgset_yes = False
result = _new_order_result(result, eq)
for res in result:
got_symbol = set()
if soln_imageset:
for (key_res, value_res) in res.items():
if isinstance(value_res, ImageSet):
res[key_res] = value_res.lamda.expr
original_imageset[key_res] = value_res
dummy_n = value_res.lamda.expr.atoms(Dummy).pop()
base = value_res.base_set
imgset_yes = (dummy_n, base)
eq2 = eq.subs(res)
unsolved_syms = _unsolved_syms(eq2, sort=True)
if (not unsolved_syms):
if res:
(newresult, delete_res) = _append_new_soln(res, None, None, imgset_yes, soln_imageset, original_imageset, newresult, eq2)
if delete_res:
result.remove(res)
continue
depen = eq2.as_independent(unsolved_syms)[0]
if (depen.has(Abs) and (solver == solveset_complex)):
continue
soln_imageset = {}
for sym in unsolved_syms:
not_solvable = False
try:
soln = solver(eq2, sym)
total_solvest_call += 1
soln_new = S.EmptySet
if isinstance(soln, Complement):
complements[sym] = soln.args[1]
soln = soln.args[0]
if isinstance(soln, Intersection):
if (soln.args[0] != Interval((- oo), oo)):
intersections[sym] = soln.args[0]
soln_new += soln.args[1]
soln = (soln_new if soln_new else soln)
if ((index > 0) and (solver == solveset_real)):
if (not isinstance(soln, (ImageSet, ConditionSet))):
soln += solveset_complex(eq2, sym)
except NotImplementedError:
continue
if isinstance(soln, ConditionSet):
soln = S.EmptySet
not_solvable = True
total_conditionst += 1
if (soln is not S.EmptySet):
(soln, soln_imageset) = _extract_main_soln(soln, soln_imageset)
for sol in soln:
(sol, soln_imageset) = _extract_main_soln(sol, soln_imageset)
sol = set(sol).pop()
free = sol.free_symbols
if (got_symbol and any([(ss in free) for ss in got_symbol])):
continue
rnew = res.copy()
for (k, v) in res.items():
if isinstance(v, Expr):
rnew[k] = v.subs(sym, sol)
if soln_imageset:
imgst = soln_imageset[sol]
rnew[sym] = imgst.lamda(*[0 for i in range(0, len(imgst.lamda.variables))])
else:
rnew[sym] = sol
(newresult, delete_res) = _append_new_soln(rnew, sym, sol, imgset_yes, soln_imageset, original_imageset, newresult)
if delete_res:
result.remove(res)
if (not not_solvable):
got_symbol.add(sym)
if newresult:
result = newresult
return (result, total_solvest_call, total_conditionst) | 3,553,278,576,903,280,600 | Solves the system using already known solution
(result contains the dict <symbol: value>).
solver is `solveset_complex` or `solveset_real`. | sympy/solvers/solveset.py | _solve_using_known_values | aktech/sympy | python | def _solve_using_known_values(result, solver):
'Solves the system using already known solution\n (result contains the dict <symbol: value>).\n solver is `solveset_complex` or `solveset_real`.\n '
soln_imageset = {}
total_solvest_call = 0
total_conditionst = 0
for (index, eq) in enumerate(eqs_in_better_order):
newresult = []
original_imageset = {}
imgset_yes = False
result = _new_order_result(result, eq)
for res in result:
got_symbol = set()
if soln_imageset:
for (key_res, value_res) in res.items():
if isinstance(value_res, ImageSet):
res[key_res] = value_res.lamda.expr
original_imageset[key_res] = value_res
dummy_n = value_res.lamda.expr.atoms(Dummy).pop()
base = value_res.base_set
imgset_yes = (dummy_n, base)
eq2 = eq.subs(res)
unsolved_syms = _unsolved_syms(eq2, sort=True)
if (not unsolved_syms):
if res:
(newresult, delete_res) = _append_new_soln(res, None, None, imgset_yes, soln_imageset, original_imageset, newresult, eq2)
if delete_res:
result.remove(res)
continue
depen = eq2.as_independent(unsolved_syms)[0]
if (depen.has(Abs) and (solver == solveset_complex)):
continue
soln_imageset = {}
for sym in unsolved_syms:
not_solvable = False
try:
soln = solver(eq2, sym)
total_solvest_call += 1
soln_new = S.EmptySet
if isinstance(soln, Complement):
complements[sym] = soln.args[1]
soln = soln.args[0]
if isinstance(soln, Intersection):
if (soln.args[0] != Interval((- oo), oo)):
intersections[sym] = soln.args[0]
soln_new += soln.args[1]
soln = (soln_new if soln_new else soln)
if ((index > 0) and (solver == solveset_real)):
if (not isinstance(soln, (ImageSet, ConditionSet))):
soln += solveset_complex(eq2, sym)
except NotImplementedError:
continue
if isinstance(soln, ConditionSet):
soln = S.EmptySet
not_solvable = True
total_conditionst += 1
if (soln is not S.EmptySet):
(soln, soln_imageset) = _extract_main_soln(soln, soln_imageset)
for sol in soln:
(sol, soln_imageset) = _extract_main_soln(sol, soln_imageset)
sol = set(sol).pop()
free = sol.free_symbols
if (got_symbol and any([(ss in free) for ss in got_symbol])):
continue
rnew = res.copy()
for (k, v) in res.items():
if isinstance(v, Expr):
rnew[k] = v.subs(sym, sol)
if soln_imageset:
imgst = soln_imageset[sol]
rnew[sym] = imgst.lamda(*[0 for i in range(0, len(imgst.lamda.variables))])
else:
rnew[sym] = sol
(newresult, delete_res) = _append_new_soln(rnew, sym, sol, imgset_yes, soln_imageset, original_imageset, newresult)
if delete_res:
result.remove(res)
if (not not_solvable):
got_symbol.add(sym)
if newresult:
result = newresult
return (result, total_solvest_call, total_conditionst) |
def get_file_handle(file_path):
'Return a opened file'
if file_path.endswith('.gz'):
file_handle = getreader('utf-8')(gzip.open(file_path, 'r'), errors='replace')
else:
file_handle = open(file_path, 'r', encoding='utf-8')
return file_handle | -1,693,644,682,931,493,000 | Return a opened file | scout/utils/handle.py | get_file_handle | Clinical-Genomics/scout | python | def get_file_handle(file_path):
if file_path.endswith('.gz'):
file_handle = getreader('utf-8')(gzip.open(file_path, 'r'), errors='replace')
else:
file_handle = open(file_path, 'r', encoding='utf-8')
return file_handle |
def schedule(cron_schedule, pipeline_name, name=None, tags=None, tags_fn=None, solid_selection=None, mode='default', should_execute=None, environment_vars=None, execution_timezone=None):
"Create a schedule.\n\n The decorated function will be called as the ``run_config_fn`` of the underlying\n :py:class:`~dagster.ScheduleDefinition` and should take a\n :py:class:`~dagster.ScheduleExecutionContext` as its only argument, returning the environment\n dict for the scheduled execution.\n\n Args:\n cron_schedule (str): A valid cron string specifying when the schedule will run, e.g.,\n ``'45 23 * * 6'`` for a schedule that runs at 11:45 PM every Saturday.\n pipeline_name (str): The name of the pipeline to execute when the schedule runs.\n name (Optional[str]): The name of the schedule to create.\n tags (Optional[Dict[str, str]]): A dictionary of tags (string key-value pairs) to attach\n to the scheduled runs.\n tags_fn (Optional[Callable[[ScheduleExecutionContext], Optional[Dict[str, str]]]]): A function\n that generates tags to attach to the schedules runs. Takes a\n :py:class:`~dagster.ScheduleExecutionContext` and returns a dictionary of tags (string\n key-value pairs). You may set only one of ``tags`` and ``tags_fn``.\n solid_selection (Optional[List[str]]): A list of solid subselection (including single\n solid names) to execute when the schedule runs. e.g. ``['*some_solid+', 'other_solid']``\n mode (Optional[str]): The pipeline mode in which to execute this schedule.\n (Default: 'default')\n should_execute (Optional[Callable[[ScheduleExecutionContext], bool]]): A function that runs at\n schedule execution tie to determine whether a schedule should execute or skip. Takes a\n :py:class:`~dagster.ScheduleExecutionContext` and returns a boolean (``True`` if the\n schedule should execute). Defaults to a function that always returns ``True``.\n environment_vars (Optional[Dict[str, str]]): Any environment variables to set when executing\n the schedule.\n execution_timezone (Optional[str]): Timezone in which the schedule should run. Only works\n with DagsterDaemonScheduler, and must be set when using that scheduler.\n "
def inner(fn):
check.callable_param(fn, 'fn')
schedule_name = (name or fn.__name__)
return ScheduleDefinition(name=schedule_name, cron_schedule=cron_schedule, pipeline_name=pipeline_name, run_config_fn=fn, tags=tags, tags_fn=tags_fn, solid_selection=solid_selection, mode=mode, should_execute=should_execute, environment_vars=environment_vars, execution_timezone=execution_timezone)
return inner | -7,617,151,434,662,817,000 | Create a schedule.
The decorated function will be called as the ``run_config_fn`` of the underlying
:py:class:`~dagster.ScheduleDefinition` and should take a
:py:class:`~dagster.ScheduleExecutionContext` as its only argument, returning the environment
dict for the scheduled execution.
Args:
cron_schedule (str): A valid cron string specifying when the schedule will run, e.g.,
``'45 23 * * 6'`` for a schedule that runs at 11:45 PM every Saturday.
pipeline_name (str): The name of the pipeline to execute when the schedule runs.
name (Optional[str]): The name of the schedule to create.
tags (Optional[Dict[str, str]]): A dictionary of tags (string key-value pairs) to attach
to the scheduled runs.
tags_fn (Optional[Callable[[ScheduleExecutionContext], Optional[Dict[str, str]]]]): A function
that generates tags to attach to the schedules runs. Takes a
:py:class:`~dagster.ScheduleExecutionContext` and returns a dictionary of tags (string
key-value pairs). You may set only one of ``tags`` and ``tags_fn``.
solid_selection (Optional[List[str]]): A list of solid subselection (including single
solid names) to execute when the schedule runs. e.g. ``['*some_solid+', 'other_solid']``
mode (Optional[str]): The pipeline mode in which to execute this schedule.
(Default: 'default')
should_execute (Optional[Callable[[ScheduleExecutionContext], bool]]): A function that runs at
schedule execution tie to determine whether a schedule should execute or skip. Takes a
:py:class:`~dagster.ScheduleExecutionContext` and returns a boolean (``True`` if the
schedule should execute). Defaults to a function that always returns ``True``.
environment_vars (Optional[Dict[str, str]]): Any environment variables to set when executing
the schedule.
execution_timezone (Optional[str]): Timezone in which the schedule should run. Only works
with DagsterDaemonScheduler, and must be set when using that scheduler. | python_modules/dagster/dagster/core/definitions/decorators/schedule.py | schedule | alex-treebeard/dagster | python | def schedule(cron_schedule, pipeline_name, name=None, tags=None, tags_fn=None, solid_selection=None, mode='default', should_execute=None, environment_vars=None, execution_timezone=None):
"Create a schedule.\n\n The decorated function will be called as the ``run_config_fn`` of the underlying\n :py:class:`~dagster.ScheduleDefinition` and should take a\n :py:class:`~dagster.ScheduleExecutionContext` as its only argument, returning the environment\n dict for the scheduled execution.\n\n Args:\n cron_schedule (str): A valid cron string specifying when the schedule will run, e.g.,\n ``'45 23 * * 6'`` for a schedule that runs at 11:45 PM every Saturday.\n pipeline_name (str): The name of the pipeline to execute when the schedule runs.\n name (Optional[str]): The name of the schedule to create.\n tags (Optional[Dict[str, str]]): A dictionary of tags (string key-value pairs) to attach\n to the scheduled runs.\n tags_fn (Optional[Callable[[ScheduleExecutionContext], Optional[Dict[str, str]]]]): A function\n that generates tags to attach to the schedules runs. Takes a\n :py:class:`~dagster.ScheduleExecutionContext` and returns a dictionary of tags (string\n key-value pairs). You may set only one of ``tags`` and ``tags_fn``.\n solid_selection (Optional[List[str]]): A list of solid subselection (including single\n solid names) to execute when the schedule runs. e.g. ``['*some_solid+', 'other_solid']``\n mode (Optional[str]): The pipeline mode in which to execute this schedule.\n (Default: 'default')\n should_execute (Optional[Callable[[ScheduleExecutionContext], bool]]): A function that runs at\n schedule execution tie to determine whether a schedule should execute or skip. Takes a\n :py:class:`~dagster.ScheduleExecutionContext` and returns a boolean (``True`` if the\n schedule should execute). Defaults to a function that always returns ``True``.\n environment_vars (Optional[Dict[str, str]]): Any environment variables to set when executing\n the schedule.\n execution_timezone (Optional[str]): Timezone in which the schedule should run. Only works\n with DagsterDaemonScheduler, and must be set when using that scheduler.\n "
def inner(fn):
check.callable_param(fn, 'fn')
schedule_name = (name or fn.__name__)
return ScheduleDefinition(name=schedule_name, cron_schedule=cron_schedule, pipeline_name=pipeline_name, run_config_fn=fn, tags=tags, tags_fn=tags_fn, solid_selection=solid_selection, mode=mode, should_execute=should_execute, environment_vars=environment_vars, execution_timezone=execution_timezone)
return inner |
def monthly_schedule(pipeline_name, start_date, name=None, execution_day_of_month=1, execution_time=datetime.time(0, 0), tags_fn_for_date=None, solid_selection=None, mode='default', should_execute=None, environment_vars=None, end_date=None, execution_timezone=None):
"Create a schedule that runs monthly.\n\n The decorated function will be called as the ``run_config_fn`` of the underlying\n :py:class:`~dagster.ScheduleDefinition` and should take a\n :py:class:`~dagster.ScheduleExecutionContext` as its only argument, returning the environment\n dict for the scheduled execution.\n\n Args:\n pipeline_name (str): The name of the pipeline to execute when the schedule runs.\n start_date (datetime.datetime): The date from which to run the schedule.\n name (Optional[str]): The name of the schedule to create.\n execution_day_of_month (int): The day of the month on which to run the schedule (must be\n between 0 and 31).\n execution_time (datetime.time): The time at which to execute the schedule.\n tags_fn_for_date (Optional[Callable[[datetime.datetime], Optional[Dict[str, str]]]]): A\n function that generates tags to attach to the schedules runs. Takes the date of the\n schedule run and returns a dictionary of tags (string key-value pairs).\n solid_selection (Optional[List[str]]): A list of solid subselection (including single\n solid names) to execute when the schedule runs. e.g. ``['*some_solid+', 'other_solid']``\n mode (Optional[str]): The pipeline mode in which to execute this schedule.\n (Default: 'default')\n should_execute (Optional[Callable[ScheduleExecutionContext, bool]]): A function that runs at\n schedule execution tie to determine whether a schedule should execute or skip. Takes a\n :py:class:`~dagster.ScheduleExecutionContext` and returns a boolean (``True`` if the\n schedule should execute). Defaults to a function that always returns ``True``.\n environment_vars (Optional[Dict[str, str]]): Any environment variables to set when executing\n the schedule.\n end_date (Optional[datetime.datetime]): The last time to run the schedule to, defaults to\n current time.\n execution_timezone (Optional[str]): Timezone in which the schedule should run. Only works\n with DagsterDaemonScheduler, and must be set when using that scheduler.\n "
check.opt_str_param(name, 'name')
check.inst_param(start_date, 'start_date', datetime.datetime)
check.opt_inst_param(end_date, 'end_date', datetime.datetime)
check.opt_callable_param(tags_fn_for_date, 'tags_fn_for_date')
check.opt_nullable_list_param(solid_selection, 'solid_selection', of_type=str)
mode = check.opt_str_param(mode, 'mode', DEFAULT_MODE_NAME)
check.opt_callable_param(should_execute, 'should_execute')
check.opt_dict_param(environment_vars, 'environment_vars', key_type=str, value_type=str)
check.str_param(pipeline_name, 'pipeline_name')
check.int_param(execution_day_of_month, 'execution_day')
check.inst_param(execution_time, 'execution_time', datetime.time)
check.opt_str_param(execution_timezone, 'execution_timezone')
if ((start_date.day != 1) or (start_date.hour != 0) or (start_date.minute != 0) or (start_date.second != 0)):
warnings.warn('`start_date` must be at the beginning of the first day of the month for a monthly schedule. Use `execution_day_of_month` and `execution_time` to execute the schedule at a specific time within the month. For example, to run the schedule at 3AM on the 23rd of each month starting in October, your schedule definition would look like:\n@monthly_schedule(\n start_date=datetime.datetime(2020, 10, 1),\n execution_day_of_month=23,\n execution_time=datetime.time(3, 0)\n):\ndef my_schedule_definition(_):\n ...\n')
if ((execution_day_of_month <= 0) or (execution_day_of_month > 31)):
raise DagsterInvalidDefinitionError('`execution_day_of_month={}` is not valid for monthly schedule. Execution day must be between 1 and 31'.format(execution_day_of_month))
cron_schedule = '{minute} {hour} {day} * *'.format(minute=execution_time.minute, hour=execution_time.hour, day=execution_day_of_month)
fmt = DEFAULT_MONTHLY_FORMAT
execution_time_to_partition_fn = (lambda d: pendulum.instance(d).replace(hour=0, minute=0).subtract(months=1, days=(execution_day_of_month - 1)))
partition_fn = schedule_partition_range(start_date, end=end_date, cron_schedule=cron_schedule, fmt=fmt, timezone=execution_timezone, execution_time_to_partition_fn=execution_time_to_partition_fn)
def inner(fn):
check.callable_param(fn, 'fn')
schedule_name = (name or fn.__name__)
tags_fn_for_partition_value = (lambda partition: {})
if tags_fn_for_date:
tags_fn_for_partition_value = (lambda partition: tags_fn_for_date(partition.value))
partition_set = PartitionSetDefinition(name='{}_partitions'.format(schedule_name), pipeline_name=pipeline_name, partition_fn=partition_fn, run_config_fn_for_partition=(lambda partition: fn(partition.value)), solid_selection=solid_selection, tags_fn_for_partition=tags_fn_for_partition_value, mode=mode)
return partition_set.create_schedule_definition(schedule_name, cron_schedule, should_execute=should_execute, environment_vars=environment_vars, partition_selector=create_offset_partition_selector(execution_time_to_partition_fn=execution_time_to_partition_fn), execution_timezone=execution_timezone)
return inner | -2,608,099,812,723,566,600 | Create a schedule that runs monthly.
The decorated function will be called as the ``run_config_fn`` of the underlying
:py:class:`~dagster.ScheduleDefinition` and should take a
:py:class:`~dagster.ScheduleExecutionContext` as its only argument, returning the environment
dict for the scheduled execution.
Args:
pipeline_name (str): The name of the pipeline to execute when the schedule runs.
start_date (datetime.datetime): The date from which to run the schedule.
name (Optional[str]): The name of the schedule to create.
execution_day_of_month (int): The day of the month on which to run the schedule (must be
between 0 and 31).
execution_time (datetime.time): The time at which to execute the schedule.
tags_fn_for_date (Optional[Callable[[datetime.datetime], Optional[Dict[str, str]]]]): A
function that generates tags to attach to the schedules runs. Takes the date of the
schedule run and returns a dictionary of tags (string key-value pairs).
solid_selection (Optional[List[str]]): A list of solid subselection (including single
solid names) to execute when the schedule runs. e.g. ``['*some_solid+', 'other_solid']``
mode (Optional[str]): The pipeline mode in which to execute this schedule.
(Default: 'default')
should_execute (Optional[Callable[ScheduleExecutionContext, bool]]): A function that runs at
schedule execution tie to determine whether a schedule should execute or skip. Takes a
:py:class:`~dagster.ScheduleExecutionContext` and returns a boolean (``True`` if the
schedule should execute). Defaults to a function that always returns ``True``.
environment_vars (Optional[Dict[str, str]]): Any environment variables to set when executing
the schedule.
end_date (Optional[datetime.datetime]): The last time to run the schedule to, defaults to
current time.
execution_timezone (Optional[str]): Timezone in which the schedule should run. Only works
with DagsterDaemonScheduler, and must be set when using that scheduler. | python_modules/dagster/dagster/core/definitions/decorators/schedule.py | monthly_schedule | alex-treebeard/dagster | python | def monthly_schedule(pipeline_name, start_date, name=None, execution_day_of_month=1, execution_time=datetime.time(0, 0), tags_fn_for_date=None, solid_selection=None, mode='default', should_execute=None, environment_vars=None, end_date=None, execution_timezone=None):
"Create a schedule that runs monthly.\n\n The decorated function will be called as the ``run_config_fn`` of the underlying\n :py:class:`~dagster.ScheduleDefinition` and should take a\n :py:class:`~dagster.ScheduleExecutionContext` as its only argument, returning the environment\n dict for the scheduled execution.\n\n Args:\n pipeline_name (str): The name of the pipeline to execute when the schedule runs.\n start_date (datetime.datetime): The date from which to run the schedule.\n name (Optional[str]): The name of the schedule to create.\n execution_day_of_month (int): The day of the month on which to run the schedule (must be\n between 0 and 31).\n execution_time (datetime.time): The time at which to execute the schedule.\n tags_fn_for_date (Optional[Callable[[datetime.datetime], Optional[Dict[str, str]]]]): A\n function that generates tags to attach to the schedules runs. Takes the date of the\n schedule run and returns a dictionary of tags (string key-value pairs).\n solid_selection (Optional[List[str]]): A list of solid subselection (including single\n solid names) to execute when the schedule runs. e.g. ``['*some_solid+', 'other_solid']``\n mode (Optional[str]): The pipeline mode in which to execute this schedule.\n (Default: 'default')\n should_execute (Optional[Callable[ScheduleExecutionContext, bool]]): A function that runs at\n schedule execution tie to determine whether a schedule should execute or skip. Takes a\n :py:class:`~dagster.ScheduleExecutionContext` and returns a boolean (``True`` if the\n schedule should execute). Defaults to a function that always returns ``True``.\n environment_vars (Optional[Dict[str, str]]): Any environment variables to set when executing\n the schedule.\n end_date (Optional[datetime.datetime]): The last time to run the schedule to, defaults to\n current time.\n execution_timezone (Optional[str]): Timezone in which the schedule should run. Only works\n with DagsterDaemonScheduler, and must be set when using that scheduler.\n "
check.opt_str_param(name, 'name')
check.inst_param(start_date, 'start_date', datetime.datetime)
check.opt_inst_param(end_date, 'end_date', datetime.datetime)
check.opt_callable_param(tags_fn_for_date, 'tags_fn_for_date')
check.opt_nullable_list_param(solid_selection, 'solid_selection', of_type=str)
mode = check.opt_str_param(mode, 'mode', DEFAULT_MODE_NAME)
check.opt_callable_param(should_execute, 'should_execute')
check.opt_dict_param(environment_vars, 'environment_vars', key_type=str, value_type=str)
check.str_param(pipeline_name, 'pipeline_name')
check.int_param(execution_day_of_month, 'execution_day')
check.inst_param(execution_time, 'execution_time', datetime.time)
check.opt_str_param(execution_timezone, 'execution_timezone')
if ((start_date.day != 1) or (start_date.hour != 0) or (start_date.minute != 0) or (start_date.second != 0)):
warnings.warn('`start_date` must be at the beginning of the first day of the month for a monthly schedule. Use `execution_day_of_month` and `execution_time` to execute the schedule at a specific time within the month. For example, to run the schedule at 3AM on the 23rd of each month starting in October, your schedule definition would look like:\n@monthly_schedule(\n start_date=datetime.datetime(2020, 10, 1),\n execution_day_of_month=23,\n execution_time=datetime.time(3, 0)\n):\ndef my_schedule_definition(_):\n ...\n')
if ((execution_day_of_month <= 0) or (execution_day_of_month > 31)):
raise DagsterInvalidDefinitionError('`execution_day_of_month={}` is not valid for monthly schedule. Execution day must be between 1 and 31'.format(execution_day_of_month))
cron_schedule = '{minute} {hour} {day} * *'.format(minute=execution_time.minute, hour=execution_time.hour, day=execution_day_of_month)
fmt = DEFAULT_MONTHLY_FORMAT
execution_time_to_partition_fn = (lambda d: pendulum.instance(d).replace(hour=0, minute=0).subtract(months=1, days=(execution_day_of_month - 1)))
partition_fn = schedule_partition_range(start_date, end=end_date, cron_schedule=cron_schedule, fmt=fmt, timezone=execution_timezone, execution_time_to_partition_fn=execution_time_to_partition_fn)
def inner(fn):
check.callable_param(fn, 'fn')
schedule_name = (name or fn.__name__)
tags_fn_for_partition_value = (lambda partition: {})
if tags_fn_for_date:
tags_fn_for_partition_value = (lambda partition: tags_fn_for_date(partition.value))
partition_set = PartitionSetDefinition(name='{}_partitions'.format(schedule_name), pipeline_name=pipeline_name, partition_fn=partition_fn, run_config_fn_for_partition=(lambda partition: fn(partition.value)), solid_selection=solid_selection, tags_fn_for_partition=tags_fn_for_partition_value, mode=mode)
return partition_set.create_schedule_definition(schedule_name, cron_schedule, should_execute=should_execute, environment_vars=environment_vars, partition_selector=create_offset_partition_selector(execution_time_to_partition_fn=execution_time_to_partition_fn), execution_timezone=execution_timezone)
return inner |
def weekly_schedule(pipeline_name, start_date, name=None, execution_day_of_week=0, execution_time=datetime.time(0, 0), tags_fn_for_date=None, solid_selection=None, mode='default', should_execute=None, environment_vars=None, end_date=None, execution_timezone=None):
"Create a schedule that runs weekly.\n\n The decorated function will be called as the ``run_config_fn`` of the underlying\n :py:class:`~dagster.ScheduleDefinition` and should take a\n :py:class:`~dagster.ScheduleExecutionContext` as its only argument, returning the environment\n dict for the scheduled execution.\n\n Args:\n pipeline_name (str): The name of the pipeline to execute when the schedule runs.\n start_date (datetime.datetime): The date from which to run the schedule.\n name (Optional[str]): The name of the schedule to create.\n execution_day_of_week (int): The day of the week on which to run the schedule. Must be\n between 0 (Sunday) and 6 (Saturday).\n execution_time (datetime.time): The time at which to execute the schedule.\n tags_fn_for_date (Optional[Callable[[datetime.datetime], Optional[Dict[str, str]]]]): A\n function that generates tags to attach to the schedules runs. Takes the date of the\n schedule run and returns a dictionary of tags (string key-value pairs).\n solid_selection (Optional[List[str]]): A list of solid subselection (including single\n solid names) to execute when the schedule runs. e.g. ``['*some_solid+', 'other_solid']``\n mode (Optional[str]): The pipeline mode in which to execute this schedule.\n (Default: 'default')\n should_execute (Optional[Callable[ScheduleExecutionContext, bool]]): A function that runs at\n schedule execution tie to determine whether a schedule should execute or skip. Takes a\n :py:class:`~dagster.ScheduleExecutionContext` and returns a boolean (``True`` if the\n schedule should execute). Defaults to a function that always returns ``True``.\n environment_vars (Optional[Dict[str, str]]): Any environment variables to set when executing\n the schedule.\n end_date (Optional[datetime.datetime]): The last time to run the schedule to, defaults to\n current time.\n execution_timezone (Optional[str]): Timezone in which the schedule should run. Only works\n with DagsterDaemonScheduler, and must be set when using that scheduler.\n "
check.opt_str_param(name, 'name')
check.inst_param(start_date, 'start_date', datetime.datetime)
check.opt_inst_param(end_date, 'end_date', datetime.datetime)
check.opt_callable_param(tags_fn_for_date, 'tags_fn_for_date')
check.opt_nullable_list_param(solid_selection, 'solid_selection', of_type=str)
mode = check.opt_str_param(mode, 'mode', DEFAULT_MODE_NAME)
check.opt_callable_param(should_execute, 'should_execute')
check.opt_dict_param(environment_vars, 'environment_vars', key_type=str, value_type=str)
check.str_param(pipeline_name, 'pipeline_name')
check.int_param(execution_day_of_week, 'execution_day_of_week')
check.inst_param(execution_time, 'execution_time', datetime.time)
check.opt_str_param(execution_timezone, 'execution_timezone')
if ((start_date.hour != 0) or (start_date.minute != 0) or (start_date.second != 0)):
warnings.warn('`start_date` must be at the beginning of a day for a weekly schedule. Use `execution_time` to execute the schedule at a specific time of day. For example, to run the schedule at 3AM each Tuesday starting on 10/20/2020, your schedule definition would look like:\n@weekly_schedule(\n start_date=datetime.datetime(2020, 10, 20),\n execution_day_of_week=1,\n execution_time=datetime.time(3, 0)\n):\ndef my_schedule_definition(_):\n ...\n')
if ((execution_day_of_week < 0) or (execution_day_of_week >= 7)):
raise DagsterInvalidDefinitionError('`execution_day_of_week={}` is not valid for weekly schedule. Execution day must be between 0 [Sunday] and 6 [Saturday]'.format(execution_day_of_week))
cron_schedule = '{minute} {hour} * * {day}'.format(minute=execution_time.minute, hour=execution_time.hour, day=execution_day_of_week)
fmt = DEFAULT_DATE_FORMAT
day_difference = ((execution_day_of_week - (start_date.weekday() + 1)) % 7)
execution_time_to_partition_fn = (lambda d: pendulum.instance(d).replace(hour=0, minute=0).subtract(weeks=1, days=day_difference))
partition_fn = schedule_partition_range(start_date, end=end_date, cron_schedule=cron_schedule, fmt=fmt, timezone=execution_timezone, execution_time_to_partition_fn=execution_time_to_partition_fn)
def inner(fn):
check.callable_param(fn, 'fn')
schedule_name = (name or fn.__name__)
tags_fn_for_partition_value = (lambda partition: {})
if tags_fn_for_date:
tags_fn_for_partition_value = (lambda partition: tags_fn_for_date(partition.value))
partition_set = PartitionSetDefinition(name='{}_partitions'.format(schedule_name), pipeline_name=pipeline_name, partition_fn=partition_fn, run_config_fn_for_partition=(lambda partition: fn(partition.value)), solid_selection=solid_selection, tags_fn_for_partition=tags_fn_for_partition_value, mode=mode)
return partition_set.create_schedule_definition(schedule_name, cron_schedule, should_execute=should_execute, environment_vars=environment_vars, partition_selector=create_offset_partition_selector(execution_time_to_partition_fn=execution_time_to_partition_fn), execution_timezone=execution_timezone)
return inner | 7,615,266,254,079,671,000 | Create a schedule that runs weekly.
The decorated function will be called as the ``run_config_fn`` of the underlying
:py:class:`~dagster.ScheduleDefinition` and should take a
:py:class:`~dagster.ScheduleExecutionContext` as its only argument, returning the environment
dict for the scheduled execution.
Args:
pipeline_name (str): The name of the pipeline to execute when the schedule runs.
start_date (datetime.datetime): The date from which to run the schedule.
name (Optional[str]): The name of the schedule to create.
execution_day_of_week (int): The day of the week on which to run the schedule. Must be
between 0 (Sunday) and 6 (Saturday).
execution_time (datetime.time): The time at which to execute the schedule.
tags_fn_for_date (Optional[Callable[[datetime.datetime], Optional[Dict[str, str]]]]): A
function that generates tags to attach to the schedules runs. Takes the date of the
schedule run and returns a dictionary of tags (string key-value pairs).
solid_selection (Optional[List[str]]): A list of solid subselection (including single
solid names) to execute when the schedule runs. e.g. ``['*some_solid+', 'other_solid']``
mode (Optional[str]): The pipeline mode in which to execute this schedule.
(Default: 'default')
should_execute (Optional[Callable[ScheduleExecutionContext, bool]]): A function that runs at
schedule execution tie to determine whether a schedule should execute or skip. Takes a
:py:class:`~dagster.ScheduleExecutionContext` and returns a boolean (``True`` if the
schedule should execute). Defaults to a function that always returns ``True``.
environment_vars (Optional[Dict[str, str]]): Any environment variables to set when executing
the schedule.
end_date (Optional[datetime.datetime]): The last time to run the schedule to, defaults to
current time.
execution_timezone (Optional[str]): Timezone in which the schedule should run. Only works
with DagsterDaemonScheduler, and must be set when using that scheduler. | python_modules/dagster/dagster/core/definitions/decorators/schedule.py | weekly_schedule | alex-treebeard/dagster | python | def weekly_schedule(pipeline_name, start_date, name=None, execution_day_of_week=0, execution_time=datetime.time(0, 0), tags_fn_for_date=None, solid_selection=None, mode='default', should_execute=None, environment_vars=None, end_date=None, execution_timezone=None):
"Create a schedule that runs weekly.\n\n The decorated function will be called as the ``run_config_fn`` of the underlying\n :py:class:`~dagster.ScheduleDefinition` and should take a\n :py:class:`~dagster.ScheduleExecutionContext` as its only argument, returning the environment\n dict for the scheduled execution.\n\n Args:\n pipeline_name (str): The name of the pipeline to execute when the schedule runs.\n start_date (datetime.datetime): The date from which to run the schedule.\n name (Optional[str]): The name of the schedule to create.\n execution_day_of_week (int): The day of the week on which to run the schedule. Must be\n between 0 (Sunday) and 6 (Saturday).\n execution_time (datetime.time): The time at which to execute the schedule.\n tags_fn_for_date (Optional[Callable[[datetime.datetime], Optional[Dict[str, str]]]]): A\n function that generates tags to attach to the schedules runs. Takes the date of the\n schedule run and returns a dictionary of tags (string key-value pairs).\n solid_selection (Optional[List[str]]): A list of solid subselection (including single\n solid names) to execute when the schedule runs. e.g. ``['*some_solid+', 'other_solid']``\n mode (Optional[str]): The pipeline mode in which to execute this schedule.\n (Default: 'default')\n should_execute (Optional[Callable[ScheduleExecutionContext, bool]]): A function that runs at\n schedule execution tie to determine whether a schedule should execute or skip. Takes a\n :py:class:`~dagster.ScheduleExecutionContext` and returns a boolean (``True`` if the\n schedule should execute). Defaults to a function that always returns ``True``.\n environment_vars (Optional[Dict[str, str]]): Any environment variables to set when executing\n the schedule.\n end_date (Optional[datetime.datetime]): The last time to run the schedule to, defaults to\n current time.\n execution_timezone (Optional[str]): Timezone in which the schedule should run. Only works\n with DagsterDaemonScheduler, and must be set when using that scheduler.\n "
check.opt_str_param(name, 'name')
check.inst_param(start_date, 'start_date', datetime.datetime)
check.opt_inst_param(end_date, 'end_date', datetime.datetime)
check.opt_callable_param(tags_fn_for_date, 'tags_fn_for_date')
check.opt_nullable_list_param(solid_selection, 'solid_selection', of_type=str)
mode = check.opt_str_param(mode, 'mode', DEFAULT_MODE_NAME)
check.opt_callable_param(should_execute, 'should_execute')
check.opt_dict_param(environment_vars, 'environment_vars', key_type=str, value_type=str)
check.str_param(pipeline_name, 'pipeline_name')
check.int_param(execution_day_of_week, 'execution_day_of_week')
check.inst_param(execution_time, 'execution_time', datetime.time)
check.opt_str_param(execution_timezone, 'execution_timezone')
if ((start_date.hour != 0) or (start_date.minute != 0) or (start_date.second != 0)):
warnings.warn('`start_date` must be at the beginning of a day for a weekly schedule. Use `execution_time` to execute the schedule at a specific time of day. For example, to run the schedule at 3AM each Tuesday starting on 10/20/2020, your schedule definition would look like:\n@weekly_schedule(\n start_date=datetime.datetime(2020, 10, 20),\n execution_day_of_week=1,\n execution_time=datetime.time(3, 0)\n):\ndef my_schedule_definition(_):\n ...\n')
if ((execution_day_of_week < 0) or (execution_day_of_week >= 7)):
raise DagsterInvalidDefinitionError('`execution_day_of_week={}` is not valid for weekly schedule. Execution day must be between 0 [Sunday] and 6 [Saturday]'.format(execution_day_of_week))
cron_schedule = '{minute} {hour} * * {day}'.format(minute=execution_time.minute, hour=execution_time.hour, day=execution_day_of_week)
fmt = DEFAULT_DATE_FORMAT
day_difference = ((execution_day_of_week - (start_date.weekday() + 1)) % 7)
execution_time_to_partition_fn = (lambda d: pendulum.instance(d).replace(hour=0, minute=0).subtract(weeks=1, days=day_difference))
partition_fn = schedule_partition_range(start_date, end=end_date, cron_schedule=cron_schedule, fmt=fmt, timezone=execution_timezone, execution_time_to_partition_fn=execution_time_to_partition_fn)
def inner(fn):
check.callable_param(fn, 'fn')
schedule_name = (name or fn.__name__)
tags_fn_for_partition_value = (lambda partition: {})
if tags_fn_for_date:
tags_fn_for_partition_value = (lambda partition: tags_fn_for_date(partition.value))
partition_set = PartitionSetDefinition(name='{}_partitions'.format(schedule_name), pipeline_name=pipeline_name, partition_fn=partition_fn, run_config_fn_for_partition=(lambda partition: fn(partition.value)), solid_selection=solid_selection, tags_fn_for_partition=tags_fn_for_partition_value, mode=mode)
return partition_set.create_schedule_definition(schedule_name, cron_schedule, should_execute=should_execute, environment_vars=environment_vars, partition_selector=create_offset_partition_selector(execution_time_to_partition_fn=execution_time_to_partition_fn), execution_timezone=execution_timezone)
return inner |
def daily_schedule(pipeline_name, start_date, name=None, execution_time=datetime.time(0, 0), tags_fn_for_date=None, solid_selection=None, mode='default', should_execute=None, environment_vars=None, end_date=None, execution_timezone=None):
"Create a schedule that runs daily.\n\n The decorated function will be called as the ``run_config_fn`` of the underlying\n :py:class:`~dagster.ScheduleDefinition` and should take a\n :py:class:`~dagster.ScheduleExecutionContext` as its only argument, returning the environment\n dict for the scheduled execution.\n\n Args:\n pipeline_name (str): The name of the pipeline to execute when the schedule runs.\n start_date (datetime.datetime): The date from which to run the schedule.\n name (Optional[str]): The name of the schedule to create.\n execution_time (datetime.time): The time at which to execute the schedule.\n tags_fn_for_date (Optional[Callable[[datetime.datetime], Optional[Dict[str, str]]]]): A\n function that generates tags to attach to the schedules runs. Takes the date of the\n schedule run and returns a dictionary of tags (string key-value pairs).\n solid_selection (Optional[List[str]]): A list of solid subselection (including single\n solid names) to execute when the schedule runs. e.g. ``['*some_solid+', 'other_solid']``\n mode (Optional[str]): The pipeline mode in which to execute this schedule.\n (Default: 'default')\n should_execute (Optional[Callable[ScheduleExecutionContext, bool]]): A function that runs at\n schedule execution tie to determine whether a schedule should execute or skip. Takes a\n :py:class:`~dagster.ScheduleExecutionContext` and returns a boolean (``True`` if the\n schedule should execute). Defaults to a function that always returns ``True``.\n environment_vars (Optional[Dict[str, str]]): Any environment variables to set when executing\n the schedule.\n end_date (Optional[datetime.datetime]): The last time to run the schedule to, defaults to\n current time.\n execution_timezone (Optional[str]): Timezone in which the schedule should run. Only works\n with DagsterDaemonScheduler, and must be set when using that scheduler.\n "
check.str_param(pipeline_name, 'pipeline_name')
check.inst_param(start_date, 'start_date', datetime.datetime)
check.opt_str_param(name, 'name')
check.inst_param(execution_time, 'execution_time', datetime.time)
check.opt_inst_param(end_date, 'end_date', datetime.datetime)
check.opt_callable_param(tags_fn_for_date, 'tags_fn_for_date')
check.opt_nullable_list_param(solid_selection, 'solid_selection', of_type=str)
mode = check.opt_str_param(mode, 'mode', DEFAULT_MODE_NAME)
check.opt_callable_param(should_execute, 'should_execute')
check.opt_dict_param(environment_vars, 'environment_vars', key_type=str, value_type=str)
check.opt_str_param(execution_timezone, 'execution_timezone')
if ((start_date.hour != 0) or (start_date.minute != 0) or (start_date.second != 0)):
warnings.warn('`start_date` must be at the beginning of a day for a daily schedule. Use `execution_time` to execute the schedule at a specific time of day. For example, to run the schedule at 3AM each day starting on 10/20/2020, your schedule definition would look like:\n@daily_schedule(\n start_date=datetime.datetime(2020, 10, 20),\n execution_time=datetime.time(3, 0)\n):\ndef my_schedule_definition(_):\n ...\n')
cron_schedule = '{minute} {hour} * * *'.format(minute=execution_time.minute, hour=execution_time.hour)
fmt = DEFAULT_DATE_FORMAT
execution_time_to_partition_fn = (lambda d: pendulum.instance(d).replace(hour=0, minute=0).subtract(days=1))
partition_fn = schedule_partition_range(start_date, end=end_date, cron_schedule=cron_schedule, fmt=fmt, timezone=execution_timezone, execution_time_to_partition_fn=execution_time_to_partition_fn)
def inner(fn):
check.callable_param(fn, 'fn')
schedule_name = (name or fn.__name__)
tags_fn_for_partition_value = (lambda partition: {})
if tags_fn_for_date:
tags_fn_for_partition_value = (lambda partition: tags_fn_for_date(partition.value))
partition_set = PartitionSetDefinition(name='{}_partitions'.format(schedule_name), pipeline_name=pipeline_name, partition_fn=partition_fn, run_config_fn_for_partition=(lambda partition: fn(partition.value)), solid_selection=solid_selection, tags_fn_for_partition=tags_fn_for_partition_value, mode=mode)
return partition_set.create_schedule_definition(schedule_name, cron_schedule, should_execute=should_execute, environment_vars=environment_vars, partition_selector=create_offset_partition_selector(execution_time_to_partition_fn=execution_time_to_partition_fn), execution_timezone=execution_timezone)
return inner | 5,154,281,865,935,283,000 | Create a schedule that runs daily.
The decorated function will be called as the ``run_config_fn`` of the underlying
:py:class:`~dagster.ScheduleDefinition` and should take a
:py:class:`~dagster.ScheduleExecutionContext` as its only argument, returning the environment
dict for the scheduled execution.
Args:
pipeline_name (str): The name of the pipeline to execute when the schedule runs.
start_date (datetime.datetime): The date from which to run the schedule.
name (Optional[str]): The name of the schedule to create.
execution_time (datetime.time): The time at which to execute the schedule.
tags_fn_for_date (Optional[Callable[[datetime.datetime], Optional[Dict[str, str]]]]): A
function that generates tags to attach to the schedules runs. Takes the date of the
schedule run and returns a dictionary of tags (string key-value pairs).
solid_selection (Optional[List[str]]): A list of solid subselection (including single
solid names) to execute when the schedule runs. e.g. ``['*some_solid+', 'other_solid']``
mode (Optional[str]): The pipeline mode in which to execute this schedule.
(Default: 'default')
should_execute (Optional[Callable[ScheduleExecutionContext, bool]]): A function that runs at
schedule execution tie to determine whether a schedule should execute or skip. Takes a
:py:class:`~dagster.ScheduleExecutionContext` and returns a boolean (``True`` if the
schedule should execute). Defaults to a function that always returns ``True``.
environment_vars (Optional[Dict[str, str]]): Any environment variables to set when executing
the schedule.
end_date (Optional[datetime.datetime]): The last time to run the schedule to, defaults to
current time.
execution_timezone (Optional[str]): Timezone in which the schedule should run. Only works
with DagsterDaemonScheduler, and must be set when using that scheduler. | python_modules/dagster/dagster/core/definitions/decorators/schedule.py | daily_schedule | alex-treebeard/dagster | python | def daily_schedule(pipeline_name, start_date, name=None, execution_time=datetime.time(0, 0), tags_fn_for_date=None, solid_selection=None, mode='default', should_execute=None, environment_vars=None, end_date=None, execution_timezone=None):
"Create a schedule that runs daily.\n\n The decorated function will be called as the ``run_config_fn`` of the underlying\n :py:class:`~dagster.ScheduleDefinition` and should take a\n :py:class:`~dagster.ScheduleExecutionContext` as its only argument, returning the environment\n dict for the scheduled execution.\n\n Args:\n pipeline_name (str): The name of the pipeline to execute when the schedule runs.\n start_date (datetime.datetime): The date from which to run the schedule.\n name (Optional[str]): The name of the schedule to create.\n execution_time (datetime.time): The time at which to execute the schedule.\n tags_fn_for_date (Optional[Callable[[datetime.datetime], Optional[Dict[str, str]]]]): A\n function that generates tags to attach to the schedules runs. Takes the date of the\n schedule run and returns a dictionary of tags (string key-value pairs).\n solid_selection (Optional[List[str]]): A list of solid subselection (including single\n solid names) to execute when the schedule runs. e.g. ``['*some_solid+', 'other_solid']``\n mode (Optional[str]): The pipeline mode in which to execute this schedule.\n (Default: 'default')\n should_execute (Optional[Callable[ScheduleExecutionContext, bool]]): A function that runs at\n schedule execution tie to determine whether a schedule should execute or skip. Takes a\n :py:class:`~dagster.ScheduleExecutionContext` and returns a boolean (``True`` if the\n schedule should execute). Defaults to a function that always returns ``True``.\n environment_vars (Optional[Dict[str, str]]): Any environment variables to set when executing\n the schedule.\n end_date (Optional[datetime.datetime]): The last time to run the schedule to, defaults to\n current time.\n execution_timezone (Optional[str]): Timezone in which the schedule should run. Only works\n with DagsterDaemonScheduler, and must be set when using that scheduler.\n "
check.str_param(pipeline_name, 'pipeline_name')
check.inst_param(start_date, 'start_date', datetime.datetime)
check.opt_str_param(name, 'name')
check.inst_param(execution_time, 'execution_time', datetime.time)
check.opt_inst_param(end_date, 'end_date', datetime.datetime)
check.opt_callable_param(tags_fn_for_date, 'tags_fn_for_date')
check.opt_nullable_list_param(solid_selection, 'solid_selection', of_type=str)
mode = check.opt_str_param(mode, 'mode', DEFAULT_MODE_NAME)
check.opt_callable_param(should_execute, 'should_execute')
check.opt_dict_param(environment_vars, 'environment_vars', key_type=str, value_type=str)
check.opt_str_param(execution_timezone, 'execution_timezone')
if ((start_date.hour != 0) or (start_date.minute != 0) or (start_date.second != 0)):
warnings.warn('`start_date` must be at the beginning of a day for a daily schedule. Use `execution_time` to execute the schedule at a specific time of day. For example, to run the schedule at 3AM each day starting on 10/20/2020, your schedule definition would look like:\n@daily_schedule(\n start_date=datetime.datetime(2020, 10, 20),\n execution_time=datetime.time(3, 0)\n):\ndef my_schedule_definition(_):\n ...\n')
cron_schedule = '{minute} {hour} * * *'.format(minute=execution_time.minute, hour=execution_time.hour)
fmt = DEFAULT_DATE_FORMAT
execution_time_to_partition_fn = (lambda d: pendulum.instance(d).replace(hour=0, minute=0).subtract(days=1))
partition_fn = schedule_partition_range(start_date, end=end_date, cron_schedule=cron_schedule, fmt=fmt, timezone=execution_timezone, execution_time_to_partition_fn=execution_time_to_partition_fn)
def inner(fn):
check.callable_param(fn, 'fn')
schedule_name = (name or fn.__name__)
tags_fn_for_partition_value = (lambda partition: {})
if tags_fn_for_date:
tags_fn_for_partition_value = (lambda partition: tags_fn_for_date(partition.value))
partition_set = PartitionSetDefinition(name='{}_partitions'.format(schedule_name), pipeline_name=pipeline_name, partition_fn=partition_fn, run_config_fn_for_partition=(lambda partition: fn(partition.value)), solid_selection=solid_selection, tags_fn_for_partition=tags_fn_for_partition_value, mode=mode)
return partition_set.create_schedule_definition(schedule_name, cron_schedule, should_execute=should_execute, environment_vars=environment_vars, partition_selector=create_offset_partition_selector(execution_time_to_partition_fn=execution_time_to_partition_fn), execution_timezone=execution_timezone)
return inner |
def hourly_schedule(pipeline_name, start_date, name=None, execution_time=datetime.time(0, 0), tags_fn_for_date=None, solid_selection=None, mode='default', should_execute=None, environment_vars=None, end_date=None, execution_timezone=None):
"Create a schedule that runs hourly.\n\n The decorated function will be called as the ``run_config_fn`` of the underlying\n :py:class:`~dagster.ScheduleDefinition` and should take a\n :py:class:`~dagster.ScheduleExecutionContext` as its only argument, returning the environment\n dict for the scheduled execution.\n\n Args:\n pipeline_name (str): The name of the pipeline to execute when the schedule runs.\n start_date (datetime.datetime): The date from which to run the schedule.\n name (Optional[str]): The name of the schedule to create. By default, this will be the name\n of the decorated function.\n execution_time (datetime.time): The time at which to execute the schedule. Only the minutes\n component will be respected -- the hour should be 0, and will be ignored if it is not 0.\n tags_fn_for_date (Optional[Callable[[datetime.datetime], Optional[Dict[str, str]]]]): A\n function that generates tags to attach to the schedules runs. Takes the date of the\n schedule run and returns a dictionary of tags (string key-value pairs).\n solid_selection (Optional[List[str]]): A list of solid subselection (including single\n solid names) to execute when the schedule runs. e.g. ``['*some_solid+', 'other_solid']``\n mode (Optional[str]): The pipeline mode in which to execute this schedule.\n (Default: 'default')\n should_execute (Optional[Callable[ScheduleExecutionContext, bool]]): A function that runs at\n schedule execution tie to determine whether a schedule should execute or skip. Takes a\n :py:class:`~dagster.ScheduleExecutionContext` and returns a boolean (``True`` if the\n schedule should execute). Defaults to a function that always returns ``True``.\n environment_vars (Optional[Dict[str, str]]): Any environment variables to set when executing\n the schedule.\n end_date (Optional[datetime.datetime]): The last time to run the schedule to, defaults to\n current time.\n execution_timezone (Optional[str]): Timezone in which the schedule should run. Only works\n with DagsterDaemonScheduler, and must be set when using that scheduler.\n "
check.opt_str_param(name, 'name')
check.inst_param(start_date, 'start_date', datetime.datetime)
check.opt_inst_param(end_date, 'end_date', datetime.datetime)
check.opt_callable_param(tags_fn_for_date, 'tags_fn_for_date')
check.opt_nullable_list_param(solid_selection, 'solid_selection', of_type=str)
mode = check.opt_str_param(mode, 'mode', DEFAULT_MODE_NAME)
check.opt_callable_param(should_execute, 'should_execute')
check.opt_dict_param(environment_vars, 'environment_vars', key_type=str, value_type=str)
check.str_param(pipeline_name, 'pipeline_name')
check.inst_param(execution_time, 'execution_time', datetime.time)
check.opt_str_param(execution_timezone, 'execution_timezone')
if ((start_date.minute != 0) or (start_date.second != 0)):
warnings.warn('`start_date` must be at the beginning of the hour for an hourly schedule. Use `execution_time` to execute the schedule at a specific time within the hour. For example, to run the schedule each hour at 15 minutes past the hour starting at 3AM on 10/20/2020, your schedule definition would look like:\n@hourly_schedule(\n start_date=datetime.datetime(2020, 10, 20, 3),\n execution_time=datetime.time(0, 15)\n):\ndef my_schedule_definition(_):\n ...\n')
if (execution_time.hour != 0):
warnings.warn('Hourly schedule {schedule_name} created with:\n\tschedule_time=datetime.time(hour={hour}, minute={minute}, ...).Since this is an hourly schedule, the hour parameter will be ignored and the schedule will run on the {minute} mark for the previous hour interval. Replace datetime.time(hour={hour}, minute={minute}, ...) with datetime.time(minute={minute}, ...) to fix this warning.')
cron_schedule = '{minute} * * * *'.format(minute=execution_time.minute)
fmt = (DEFAULT_HOURLY_FORMAT_WITH_TIMEZONE if execution_timezone else DEFAULT_HOURLY_FORMAT_WITHOUT_TIMEZONE)
execution_time_to_partition_fn = (lambda d: pendulum.instance(d).subtract(hours=1, minutes=((execution_time.minute - start_date.minute) % 60)))
partition_fn = schedule_partition_range(start_date, end=end_date, cron_schedule=cron_schedule, fmt=fmt, timezone=execution_timezone, execution_time_to_partition_fn=execution_time_to_partition_fn)
def inner(fn):
check.callable_param(fn, 'fn')
schedule_name = (name or fn.__name__)
tags_fn_for_partition_value = (lambda partition: {})
if tags_fn_for_date:
tags_fn_for_partition_value = (lambda partition: tags_fn_for_date(partition.value))
partition_set = PartitionSetDefinition(name='{}_partitions'.format(schedule_name), pipeline_name=pipeline_name, partition_fn=partition_fn, run_config_fn_for_partition=(lambda partition: fn(partition.value)), solid_selection=solid_selection, tags_fn_for_partition=tags_fn_for_partition_value, mode=mode)
return partition_set.create_schedule_definition(schedule_name, cron_schedule, should_execute=should_execute, environment_vars=environment_vars, partition_selector=create_offset_partition_selector(execution_time_to_partition_fn=execution_time_to_partition_fn), execution_timezone=execution_timezone)
return inner | -2,717,627,667,788,724,700 | Create a schedule that runs hourly.
The decorated function will be called as the ``run_config_fn`` of the underlying
:py:class:`~dagster.ScheduleDefinition` and should take a
:py:class:`~dagster.ScheduleExecutionContext` as its only argument, returning the environment
dict for the scheduled execution.
Args:
pipeline_name (str): The name of the pipeline to execute when the schedule runs.
start_date (datetime.datetime): The date from which to run the schedule.
name (Optional[str]): The name of the schedule to create. By default, this will be the name
of the decorated function.
execution_time (datetime.time): The time at which to execute the schedule. Only the minutes
component will be respected -- the hour should be 0, and will be ignored if it is not 0.
tags_fn_for_date (Optional[Callable[[datetime.datetime], Optional[Dict[str, str]]]]): A
function that generates tags to attach to the schedules runs. Takes the date of the
schedule run and returns a dictionary of tags (string key-value pairs).
solid_selection (Optional[List[str]]): A list of solid subselection (including single
solid names) to execute when the schedule runs. e.g. ``['*some_solid+', 'other_solid']``
mode (Optional[str]): The pipeline mode in which to execute this schedule.
(Default: 'default')
should_execute (Optional[Callable[ScheduleExecutionContext, bool]]): A function that runs at
schedule execution tie to determine whether a schedule should execute or skip. Takes a
:py:class:`~dagster.ScheduleExecutionContext` and returns a boolean (``True`` if the
schedule should execute). Defaults to a function that always returns ``True``.
environment_vars (Optional[Dict[str, str]]): Any environment variables to set when executing
the schedule.
end_date (Optional[datetime.datetime]): The last time to run the schedule to, defaults to
current time.
execution_timezone (Optional[str]): Timezone in which the schedule should run. Only works
with DagsterDaemonScheduler, and must be set when using that scheduler. | python_modules/dagster/dagster/core/definitions/decorators/schedule.py | hourly_schedule | alex-treebeard/dagster | python | def hourly_schedule(pipeline_name, start_date, name=None, execution_time=datetime.time(0, 0), tags_fn_for_date=None, solid_selection=None, mode='default', should_execute=None, environment_vars=None, end_date=None, execution_timezone=None):
"Create a schedule that runs hourly.\n\n The decorated function will be called as the ``run_config_fn`` of the underlying\n :py:class:`~dagster.ScheduleDefinition` and should take a\n :py:class:`~dagster.ScheduleExecutionContext` as its only argument, returning the environment\n dict for the scheduled execution.\n\n Args:\n pipeline_name (str): The name of the pipeline to execute when the schedule runs.\n start_date (datetime.datetime): The date from which to run the schedule.\n name (Optional[str]): The name of the schedule to create. By default, this will be the name\n of the decorated function.\n execution_time (datetime.time): The time at which to execute the schedule. Only the minutes\n component will be respected -- the hour should be 0, and will be ignored if it is not 0.\n tags_fn_for_date (Optional[Callable[[datetime.datetime], Optional[Dict[str, str]]]]): A\n function that generates tags to attach to the schedules runs. Takes the date of the\n schedule run and returns a dictionary of tags (string key-value pairs).\n solid_selection (Optional[List[str]]): A list of solid subselection (including single\n solid names) to execute when the schedule runs. e.g. ``['*some_solid+', 'other_solid']``\n mode (Optional[str]): The pipeline mode in which to execute this schedule.\n (Default: 'default')\n should_execute (Optional[Callable[ScheduleExecutionContext, bool]]): A function that runs at\n schedule execution tie to determine whether a schedule should execute or skip. Takes a\n :py:class:`~dagster.ScheduleExecutionContext` and returns a boolean (``True`` if the\n schedule should execute). Defaults to a function that always returns ``True``.\n environment_vars (Optional[Dict[str, str]]): Any environment variables to set when executing\n the schedule.\n end_date (Optional[datetime.datetime]): The last time to run the schedule to, defaults to\n current time.\n execution_timezone (Optional[str]): Timezone in which the schedule should run. Only works\n with DagsterDaemonScheduler, and must be set when using that scheduler.\n "
check.opt_str_param(name, 'name')
check.inst_param(start_date, 'start_date', datetime.datetime)
check.opt_inst_param(end_date, 'end_date', datetime.datetime)
check.opt_callable_param(tags_fn_for_date, 'tags_fn_for_date')
check.opt_nullable_list_param(solid_selection, 'solid_selection', of_type=str)
mode = check.opt_str_param(mode, 'mode', DEFAULT_MODE_NAME)
check.opt_callable_param(should_execute, 'should_execute')
check.opt_dict_param(environment_vars, 'environment_vars', key_type=str, value_type=str)
check.str_param(pipeline_name, 'pipeline_name')
check.inst_param(execution_time, 'execution_time', datetime.time)
check.opt_str_param(execution_timezone, 'execution_timezone')
if ((start_date.minute != 0) or (start_date.second != 0)):
warnings.warn('`start_date` must be at the beginning of the hour for an hourly schedule. Use `execution_time` to execute the schedule at a specific time within the hour. For example, to run the schedule each hour at 15 minutes past the hour starting at 3AM on 10/20/2020, your schedule definition would look like:\n@hourly_schedule(\n start_date=datetime.datetime(2020, 10, 20, 3),\n execution_time=datetime.time(0, 15)\n):\ndef my_schedule_definition(_):\n ...\n')
if (execution_time.hour != 0):
warnings.warn('Hourly schedule {schedule_name} created with:\n\tschedule_time=datetime.time(hour={hour}, minute={minute}, ...).Since this is an hourly schedule, the hour parameter will be ignored and the schedule will run on the {minute} mark for the previous hour interval. Replace datetime.time(hour={hour}, minute={minute}, ...) with datetime.time(minute={minute}, ...) to fix this warning.')
cron_schedule = '{minute} * * * *'.format(minute=execution_time.minute)
fmt = (DEFAULT_HOURLY_FORMAT_WITH_TIMEZONE if execution_timezone else DEFAULT_HOURLY_FORMAT_WITHOUT_TIMEZONE)
execution_time_to_partition_fn = (lambda d: pendulum.instance(d).subtract(hours=1, minutes=((execution_time.minute - start_date.minute) % 60)))
partition_fn = schedule_partition_range(start_date, end=end_date, cron_schedule=cron_schedule, fmt=fmt, timezone=execution_timezone, execution_time_to_partition_fn=execution_time_to_partition_fn)
def inner(fn):
check.callable_param(fn, 'fn')
schedule_name = (name or fn.__name__)
tags_fn_for_partition_value = (lambda partition: {})
if tags_fn_for_date:
tags_fn_for_partition_value = (lambda partition: tags_fn_for_date(partition.value))
partition_set = PartitionSetDefinition(name='{}_partitions'.format(schedule_name), pipeline_name=pipeline_name, partition_fn=partition_fn, run_config_fn_for_partition=(lambda partition: fn(partition.value)), solid_selection=solid_selection, tags_fn_for_partition=tags_fn_for_partition_value, mode=mode)
return partition_set.create_schedule_definition(schedule_name, cron_schedule, should_execute=should_execute, environment_vars=environment_vars, partition_selector=create_offset_partition_selector(execution_time_to_partition_fn=execution_time_to_partition_fn), execution_timezone=execution_timezone)
return inner |
def init_all_dbs():
'\n call it when creating database\n :return:\n '
conn = sqlite3.connect(DB_PATH)
cursor = conn.cursor()
exec_sql = 'create table Question (id INTEGER primary key, content text, user VARCHAR(20), date VARCHAR(30))'
cursor.execute(exec_sql)
exec_sql = 'create table People (id INTEGER primary key, question_id INTEGER, content text, user VARCHAR(20), date VARCHAR(30))'
cursor.execute(exec_sql)
conn.commit()
conn.close() | -5,197,294,188,878,423,000 | call it when creating database
:return: | store/store.py | init_all_dbs | mengfanShi/SpiderMan | python | def init_all_dbs():
'\n call it when creating database\n :return:\n '
conn = sqlite3.connect(DB_PATH)
cursor = conn.cursor()
exec_sql = 'create table Question (id INTEGER primary key, content text, user VARCHAR(20), date VARCHAR(30))'
cursor.execute(exec_sql)
exec_sql = 'create table People (id INTEGER primary key, question_id INTEGER, content text, user VARCHAR(20), date VARCHAR(30))'
cursor.execute(exec_sql)
conn.commit()
conn.close() |
@property
def BgpCustomAfiSafiv6(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpcustomafisafiv6_31ae8bd98f331c2119281ac977022fca.BgpCustomAfiSafiv6): An instance of the BgpCustomAfiSafiv6 class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpcustomafisafiv6_31ae8bd98f331c2119281ac977022fca import BgpCustomAfiSafiv6
return BgpCustomAfiSafiv6(self)._select() | -7,325,503,119,801,193,000 | Returns
-------
- obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpcustomafisafiv6_31ae8bd98f331c2119281ac977022fca.BgpCustomAfiSafiv6): An instance of the BgpCustomAfiSafiv6 class
Raises
------
- ServerError: The server has encountered an uncategorized error condition | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | BgpCustomAfiSafiv6 | rfrye-github/ixnetwork_restpy | python | @property
def BgpCustomAfiSafiv6(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpcustomafisafiv6_31ae8bd98f331c2119281ac977022fca.BgpCustomAfiSafiv6): An instance of the BgpCustomAfiSafiv6 class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpcustomafisafiv6_31ae8bd98f331c2119281ac977022fca import BgpCustomAfiSafiv6
return BgpCustomAfiSafiv6(self)._select() |
@property
def BgpEpePeerList(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpepepeerlist_8e1fc47aa0221fde5418b0e01514b909.BgpEpePeerList): An instance of the BgpEpePeerList class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpepepeerlist_8e1fc47aa0221fde5418b0e01514b909 import BgpEpePeerList
return BgpEpePeerList(self)._select() | -3,840,936,234,641,362,400 | Returns
-------
- obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpepepeerlist_8e1fc47aa0221fde5418b0e01514b909.BgpEpePeerList): An instance of the BgpEpePeerList class
Raises
------
- ServerError: The server has encountered an uncategorized error condition | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | BgpEpePeerList | rfrye-github/ixnetwork_restpy | python | @property
def BgpEpePeerList(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpepepeerlist_8e1fc47aa0221fde5418b0e01514b909.BgpEpePeerList): An instance of the BgpEpePeerList class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpepepeerlist_8e1fc47aa0221fde5418b0e01514b909 import BgpEpePeerList
return BgpEpePeerList(self)._select() |
@property
def BgpEthernetSegmentV6(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpethernetsegmentv6_766c04a63efb3fe4eca969aac968fe4e.BgpEthernetSegmentV6): An instance of the BgpEthernetSegmentV6 class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpethernetsegmentv6_766c04a63efb3fe4eca969aac968fe4e import BgpEthernetSegmentV6
return BgpEthernetSegmentV6(self)._select() | 6,040,624,524,474,441,000 | Returns
-------
- obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpethernetsegmentv6_766c04a63efb3fe4eca969aac968fe4e.BgpEthernetSegmentV6): An instance of the BgpEthernetSegmentV6 class
Raises
------
- ServerError: The server has encountered an uncategorized error condition | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | BgpEthernetSegmentV6 | rfrye-github/ixnetwork_restpy | python | @property
def BgpEthernetSegmentV6(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpethernetsegmentv6_766c04a63efb3fe4eca969aac968fe4e.BgpEthernetSegmentV6): An instance of the BgpEthernetSegmentV6 class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpethernetsegmentv6_766c04a63efb3fe4eca969aac968fe4e import BgpEthernetSegmentV6
return BgpEthernetSegmentV6(self)._select() |
@property
def BgpFlowSpecRangesList(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpflowspecrangeslist_9ad7609645f425215665a5736cc73e84.BgpFlowSpecRangesList): An instance of the BgpFlowSpecRangesList class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpflowspecrangeslist_9ad7609645f425215665a5736cc73e84 import BgpFlowSpecRangesList
return BgpFlowSpecRangesList(self)._select() | 3,712,483,164,783,856,000 | Returns
-------
- obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpflowspecrangeslist_9ad7609645f425215665a5736cc73e84.BgpFlowSpecRangesList): An instance of the BgpFlowSpecRangesList class
Raises
------
- ServerError: The server has encountered an uncategorized error condition | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | BgpFlowSpecRangesList | rfrye-github/ixnetwork_restpy | python | @property
def BgpFlowSpecRangesList(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpflowspecrangeslist_9ad7609645f425215665a5736cc73e84.BgpFlowSpecRangesList): An instance of the BgpFlowSpecRangesList class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpflowspecrangeslist_9ad7609645f425215665a5736cc73e84 import BgpFlowSpecRangesList
return BgpFlowSpecRangesList(self)._select() |
@property
def BgpFlowSpecRangesListV4(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpflowspecrangeslistv4_ab0c3185b027eff54394da27736dcb9a.BgpFlowSpecRangesListV4): An instance of the BgpFlowSpecRangesListV4 class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpflowspecrangeslistv4_ab0c3185b027eff54394da27736dcb9a import BgpFlowSpecRangesListV4
return BgpFlowSpecRangesListV4(self)._select() | 3,334,446,235,289,044,000 | Returns
-------
- obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpflowspecrangeslistv4_ab0c3185b027eff54394da27736dcb9a.BgpFlowSpecRangesListV4): An instance of the BgpFlowSpecRangesListV4 class
Raises
------
- ServerError: The server has encountered an uncategorized error condition | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | BgpFlowSpecRangesListV4 | rfrye-github/ixnetwork_restpy | python | @property
def BgpFlowSpecRangesListV4(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpflowspecrangeslistv4_ab0c3185b027eff54394da27736dcb9a.BgpFlowSpecRangesListV4): An instance of the BgpFlowSpecRangesListV4 class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpflowspecrangeslistv4_ab0c3185b027eff54394da27736dcb9a import BgpFlowSpecRangesListV4
return BgpFlowSpecRangesListV4(self)._select() |
@property
def BgpFlowSpecRangesListV6(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpflowspecrangeslistv6_305d65dd8b0f124660b13211ca670c20.BgpFlowSpecRangesListV6): An instance of the BgpFlowSpecRangesListV6 class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpflowspecrangeslistv6_305d65dd8b0f124660b13211ca670c20 import BgpFlowSpecRangesListV6
return BgpFlowSpecRangesListV6(self)._select() | -5,145,287,172,163,459,000 | Returns
-------
- obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpflowspecrangeslistv6_305d65dd8b0f124660b13211ca670c20.BgpFlowSpecRangesListV6): An instance of the BgpFlowSpecRangesListV6 class
Raises
------
- ServerError: The server has encountered an uncategorized error condition | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | BgpFlowSpecRangesListV6 | rfrye-github/ixnetwork_restpy | python | @property
def BgpFlowSpecRangesListV6(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpflowspecrangeslistv6_305d65dd8b0f124660b13211ca670c20.BgpFlowSpecRangesListV6): An instance of the BgpFlowSpecRangesListV6 class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpflowspecrangeslistv6_305d65dd8b0f124660b13211ca670c20 import BgpFlowSpecRangesListV6
return BgpFlowSpecRangesListV6(self)._select() |
@property
def BgpIPv6EvpnEvi(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6evpnevi_7148192f2f68b72a7e220fe51f91ee65.BgpIPv6EvpnEvi): An instance of the BgpIPv6EvpnEvi class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6evpnevi_7148192f2f68b72a7e220fe51f91ee65 import BgpIPv6EvpnEvi
return BgpIPv6EvpnEvi(self) | 6,720,772,140,658,798,000 | Returns
-------
- obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6evpnevi_7148192f2f68b72a7e220fe51f91ee65.BgpIPv6EvpnEvi): An instance of the BgpIPv6EvpnEvi class
Raises
------
- ServerError: The server has encountered an uncategorized error condition | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | BgpIPv6EvpnEvi | rfrye-github/ixnetwork_restpy | python | @property
def BgpIPv6EvpnEvi(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6evpnevi_7148192f2f68b72a7e220fe51f91ee65.BgpIPv6EvpnEvi): An instance of the BgpIPv6EvpnEvi class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6evpnevi_7148192f2f68b72a7e220fe51f91ee65 import BgpIPv6EvpnEvi
return BgpIPv6EvpnEvi(self) |
@property
def BgpIPv6EvpnPbb(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6evpnpbb_7e3d31c960a96c76772f39596f4e0b6c.BgpIPv6EvpnPbb): An instance of the BgpIPv6EvpnPbb class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6evpnpbb_7e3d31c960a96c76772f39596f4e0b6c import BgpIPv6EvpnPbb
return BgpIPv6EvpnPbb(self) | -1,671,315,899,680,887,000 | Returns
-------
- obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6evpnpbb_7e3d31c960a96c76772f39596f4e0b6c.BgpIPv6EvpnPbb): An instance of the BgpIPv6EvpnPbb class
Raises
------
- ServerError: The server has encountered an uncategorized error condition | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | BgpIPv6EvpnPbb | rfrye-github/ixnetwork_restpy | python | @property
def BgpIPv6EvpnPbb(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6evpnpbb_7e3d31c960a96c76772f39596f4e0b6c.BgpIPv6EvpnPbb): An instance of the BgpIPv6EvpnPbb class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6evpnpbb_7e3d31c960a96c76772f39596f4e0b6c import BgpIPv6EvpnPbb
return BgpIPv6EvpnPbb(self) |
@property
def BgpIPv6EvpnVXLAN(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6evpnvxlan_58919d93e3f1d08f428277c92a21e890.BgpIPv6EvpnVXLAN): An instance of the BgpIPv6EvpnVXLAN class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6evpnvxlan_58919d93e3f1d08f428277c92a21e890 import BgpIPv6EvpnVXLAN
return BgpIPv6EvpnVXLAN(self) | 1,290,244,958,635,942,100 | Returns
-------
- obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6evpnvxlan_58919d93e3f1d08f428277c92a21e890.BgpIPv6EvpnVXLAN): An instance of the BgpIPv6EvpnVXLAN class
Raises
------
- ServerError: The server has encountered an uncategorized error condition | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | BgpIPv6EvpnVXLAN | rfrye-github/ixnetwork_restpy | python | @property
def BgpIPv6EvpnVXLAN(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6evpnvxlan_58919d93e3f1d08f428277c92a21e890.BgpIPv6EvpnVXLAN): An instance of the BgpIPv6EvpnVXLAN class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6evpnvxlan_58919d93e3f1d08f428277c92a21e890 import BgpIPv6EvpnVXLAN
return BgpIPv6EvpnVXLAN(self) |
@property
def BgpIPv6EvpnVXLANVpws(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6evpnvxlanvpws_3f36e2b3e739d7ab9aec3577a508ada7.BgpIPv6EvpnVXLANVpws): An instance of the BgpIPv6EvpnVXLANVpws class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6evpnvxlanvpws_3f36e2b3e739d7ab9aec3577a508ada7 import BgpIPv6EvpnVXLANVpws
return BgpIPv6EvpnVXLANVpws(self) | 8,252,743,323,883,794,000 | Returns
-------
- obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6evpnvxlanvpws_3f36e2b3e739d7ab9aec3577a508ada7.BgpIPv6EvpnVXLANVpws): An instance of the BgpIPv6EvpnVXLANVpws class
Raises
------
- ServerError: The server has encountered an uncategorized error condition | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | BgpIPv6EvpnVXLANVpws | rfrye-github/ixnetwork_restpy | python | @property
def BgpIPv6EvpnVXLANVpws(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6evpnvxlanvpws_3f36e2b3e739d7ab9aec3577a508ada7.BgpIPv6EvpnVXLANVpws): An instance of the BgpIPv6EvpnVXLANVpws class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6evpnvxlanvpws_3f36e2b3e739d7ab9aec3577a508ada7 import BgpIPv6EvpnVXLANVpws
return BgpIPv6EvpnVXLANVpws(self) |
@property
def BgpIPv6EvpnVpws(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6evpnvpws_7e7a3dec141df7b1c974f723df7f4814.BgpIPv6EvpnVpws): An instance of the BgpIPv6EvpnVpws class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6evpnvpws_7e7a3dec141df7b1c974f723df7f4814 import BgpIPv6EvpnVpws
return BgpIPv6EvpnVpws(self) | 491,731,151,166,504,600 | Returns
-------
- obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6evpnvpws_7e7a3dec141df7b1c974f723df7f4814.BgpIPv6EvpnVpws): An instance of the BgpIPv6EvpnVpws class
Raises
------
- ServerError: The server has encountered an uncategorized error condition | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | BgpIPv6EvpnVpws | rfrye-github/ixnetwork_restpy | python | @property
def BgpIPv6EvpnVpws(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6evpnvpws_7e7a3dec141df7b1c974f723df7f4814.BgpIPv6EvpnVpws): An instance of the BgpIPv6EvpnVpws class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6evpnvpws_7e7a3dec141df7b1c974f723df7f4814 import BgpIPv6EvpnVpws
return BgpIPv6EvpnVpws(self) |
@property
def BgpIpv6AdL2Vpn(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6adl2vpn_dfa30e45f6798c9ecc0ef8b85351cb5d.BgpIpv6AdL2Vpn): An instance of the BgpIpv6AdL2Vpn class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6adl2vpn_dfa30e45f6798c9ecc0ef8b85351cb5d import BgpIpv6AdL2Vpn
return BgpIpv6AdL2Vpn(self) | 2,498,762,400,428,744,700 | Returns
-------
- obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6adl2vpn_dfa30e45f6798c9ecc0ef8b85351cb5d.BgpIpv6AdL2Vpn): An instance of the BgpIpv6AdL2Vpn class
Raises
------
- ServerError: The server has encountered an uncategorized error condition | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | BgpIpv6AdL2Vpn | rfrye-github/ixnetwork_restpy | python | @property
def BgpIpv6AdL2Vpn(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6adl2vpn_dfa30e45f6798c9ecc0ef8b85351cb5d.BgpIpv6AdL2Vpn): An instance of the BgpIpv6AdL2Vpn class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6adl2vpn_dfa30e45f6798c9ecc0ef8b85351cb5d import BgpIpv6AdL2Vpn
return BgpIpv6AdL2Vpn(self) |
@property
def BgpIpv6L2Site(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6l2site_91dde52dc0cc2c12360c0d436c8db2fe.BgpIpv6L2Site): An instance of the BgpIpv6L2Site class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6l2site_91dde52dc0cc2c12360c0d436c8db2fe import BgpIpv6L2Site
return BgpIpv6L2Site(self) | -1,916,634,906,356,977,000 | Returns
-------
- obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6l2site_91dde52dc0cc2c12360c0d436c8db2fe.BgpIpv6L2Site): An instance of the BgpIpv6L2Site class
Raises
------
- ServerError: The server has encountered an uncategorized error condition | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | BgpIpv6L2Site | rfrye-github/ixnetwork_restpy | python | @property
def BgpIpv6L2Site(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6l2site_91dde52dc0cc2c12360c0d436c8db2fe.BgpIpv6L2Site): An instance of the BgpIpv6L2Site class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6l2site_91dde52dc0cc2c12360c0d436c8db2fe import BgpIpv6L2Site
return BgpIpv6L2Site(self) |
@property
def BgpIpv6MVrf(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6mvrf_226a44af23e6291841522d3353c88b21.BgpIpv6MVrf): An instance of the BgpIpv6MVrf class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6mvrf_226a44af23e6291841522d3353c88b21 import BgpIpv6MVrf
return BgpIpv6MVrf(self) | 6,978,177,364,024,046,000 | Returns
-------
- obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6mvrf_226a44af23e6291841522d3353c88b21.BgpIpv6MVrf): An instance of the BgpIpv6MVrf class
Raises
------
- ServerError: The server has encountered an uncategorized error condition | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | BgpIpv6MVrf | rfrye-github/ixnetwork_restpy | python | @property
def BgpIpv6MVrf(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6mvrf_226a44af23e6291841522d3353c88b21.BgpIpv6MVrf): An instance of the BgpIpv6MVrf class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpipv6mvrf_226a44af23e6291841522d3353c88b21 import BgpIpv6MVrf
return BgpIpv6MVrf(self) |
@property
def BgpLsAsPathSegmentList(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgplsaspathsegmentlist_fed4f671dbff6ccda8e8824fbe375856.BgpLsAsPathSegmentList): An instance of the BgpLsAsPathSegmentList class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgplsaspathsegmentlist_fed4f671dbff6ccda8e8824fbe375856 import BgpLsAsPathSegmentList
return BgpLsAsPathSegmentList(self) | 2,239,986,300,212,686,000 | Returns
-------
- obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgplsaspathsegmentlist_fed4f671dbff6ccda8e8824fbe375856.BgpLsAsPathSegmentList): An instance of the BgpLsAsPathSegmentList class
Raises
------
- ServerError: The server has encountered an uncategorized error condition | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | BgpLsAsPathSegmentList | rfrye-github/ixnetwork_restpy | python | @property
def BgpLsAsPathSegmentList(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgplsaspathsegmentlist_fed4f671dbff6ccda8e8824fbe375856.BgpLsAsPathSegmentList): An instance of the BgpLsAsPathSegmentList class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgplsaspathsegmentlist_fed4f671dbff6ccda8e8824fbe375856 import BgpLsAsPathSegmentList
return BgpLsAsPathSegmentList(self) |
@property
def BgpLsClusterIdList(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgplsclusteridlist_7b4bcec76ea98c69afbc1dcb2556f669.BgpLsClusterIdList): An instance of the BgpLsClusterIdList class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgplsclusteridlist_7b4bcec76ea98c69afbc1dcb2556f669 import BgpLsClusterIdList
return BgpLsClusterIdList(self) | -2,438,261,614,393,010,000 | Returns
-------
- obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgplsclusteridlist_7b4bcec76ea98c69afbc1dcb2556f669.BgpLsClusterIdList): An instance of the BgpLsClusterIdList class
Raises
------
- ServerError: The server has encountered an uncategorized error condition | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | BgpLsClusterIdList | rfrye-github/ixnetwork_restpy | python | @property
def BgpLsClusterIdList(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgplsclusteridlist_7b4bcec76ea98c69afbc1dcb2556f669.BgpLsClusterIdList): An instance of the BgpLsClusterIdList class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgplsclusteridlist_7b4bcec76ea98c69afbc1dcb2556f669 import BgpLsClusterIdList
return BgpLsClusterIdList(self) |
@property
def BgpLsCommunitiesList(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgplscommunitieslist_fdb216f1d4195f82ad738e19cb2b5d32.BgpLsCommunitiesList): An instance of the BgpLsCommunitiesList class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgplscommunitieslist_fdb216f1d4195f82ad738e19cb2b5d32 import BgpLsCommunitiesList
return BgpLsCommunitiesList(self) | -7,831,585,676,460,029,000 | Returns
-------
- obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgplscommunitieslist_fdb216f1d4195f82ad738e19cb2b5d32.BgpLsCommunitiesList): An instance of the BgpLsCommunitiesList class
Raises
------
- ServerError: The server has encountered an uncategorized error condition | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | BgpLsCommunitiesList | rfrye-github/ixnetwork_restpy | python | @property
def BgpLsCommunitiesList(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgplscommunitieslist_fdb216f1d4195f82ad738e19cb2b5d32.BgpLsCommunitiesList): An instance of the BgpLsCommunitiesList class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgplscommunitieslist_fdb216f1d4195f82ad738e19cb2b5d32 import BgpLsCommunitiesList
return BgpLsCommunitiesList(self) |
@property
def BgpLsExtendedCommunitiesList(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgplsextendedcommunitieslist_835ffabe7ce10fa0b2a04b0ca4ed54d9.BgpLsExtendedCommunitiesList): An instance of the BgpLsExtendedCommunitiesList class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgplsextendedcommunitieslist_835ffabe7ce10fa0b2a04b0ca4ed54d9 import BgpLsExtendedCommunitiesList
return BgpLsExtendedCommunitiesList(self) | 4,599,853,937,210,486,300 | Returns
-------
- obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgplsextendedcommunitieslist_835ffabe7ce10fa0b2a04b0ca4ed54d9.BgpLsExtendedCommunitiesList): An instance of the BgpLsExtendedCommunitiesList class
Raises
------
- ServerError: The server has encountered an uncategorized error condition | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | BgpLsExtendedCommunitiesList | rfrye-github/ixnetwork_restpy | python | @property
def BgpLsExtendedCommunitiesList(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgplsextendedcommunitieslist_835ffabe7ce10fa0b2a04b0ca4ed54d9.BgpLsExtendedCommunitiesList): An instance of the BgpLsExtendedCommunitiesList class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgplsextendedcommunitieslist_835ffabe7ce10fa0b2a04b0ca4ed54d9 import BgpLsExtendedCommunitiesList
return BgpLsExtendedCommunitiesList(self) |
@property
def BgpSRGBRangeSubObjectsList(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpsrgbrangesubobjectslist_6e28159e439bbeffe19ca2de4c7f7879.BgpSRGBRangeSubObjectsList): An instance of the BgpSRGBRangeSubObjectsList class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpsrgbrangesubobjectslist_6e28159e439bbeffe19ca2de4c7f7879 import BgpSRGBRangeSubObjectsList
return BgpSRGBRangeSubObjectsList(self) | 3,278,076,265,471,277,000 | Returns
-------
- obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpsrgbrangesubobjectslist_6e28159e439bbeffe19ca2de4c7f7879.BgpSRGBRangeSubObjectsList): An instance of the BgpSRGBRangeSubObjectsList class
Raises
------
- ServerError: The server has encountered an uncategorized error condition | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | BgpSRGBRangeSubObjectsList | rfrye-github/ixnetwork_restpy | python | @property
def BgpSRGBRangeSubObjectsList(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpsrgbrangesubobjectslist_6e28159e439bbeffe19ca2de4c7f7879.BgpSRGBRangeSubObjectsList): An instance of the BgpSRGBRangeSubObjectsList class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpsrgbrangesubobjectslist_6e28159e439bbeffe19ca2de4c7f7879 import BgpSRGBRangeSubObjectsList
return BgpSRGBRangeSubObjectsList(self) |
@property
def BgpSRTEPoliciesListV6(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpsrtepolicieslistv6_4c4a356e5a00d2ddfa49e9cef396bffd.BgpSRTEPoliciesListV6): An instance of the BgpSRTEPoliciesListV6 class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpsrtepolicieslistv6_4c4a356e5a00d2ddfa49e9cef396bffd import BgpSRTEPoliciesListV6
return BgpSRTEPoliciesListV6(self)._select() | -2,489,453,630,538,092,500 | Returns
-------
- obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpsrtepolicieslistv6_4c4a356e5a00d2ddfa49e9cef396bffd.BgpSRTEPoliciesListV6): An instance of the BgpSRTEPoliciesListV6 class
Raises
------
- ServerError: The server has encountered an uncategorized error condition | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | BgpSRTEPoliciesListV6 | rfrye-github/ixnetwork_restpy | python | @property
def BgpSRTEPoliciesListV6(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpsrtepolicieslistv6_4c4a356e5a00d2ddfa49e9cef396bffd.BgpSRTEPoliciesListV6): An instance of the BgpSRTEPoliciesListV6 class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpsrtepolicieslistv6_4c4a356e5a00d2ddfa49e9cef396bffd import BgpSRTEPoliciesListV6
return BgpSRTEPoliciesListV6(self)._select() |
@property
def BgpV6Vrf(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpv6vrf_1d6029d380b737c5ce1f12d2ed82f3ed.BgpV6Vrf): An instance of the BgpV6Vrf class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpv6vrf_1d6029d380b737c5ce1f12d2ed82f3ed import BgpV6Vrf
return BgpV6Vrf(self) | -3,337,457,177,840,421,400 | Returns
-------
- obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpv6vrf_1d6029d380b737c5ce1f12d2ed82f3ed.BgpV6Vrf): An instance of the BgpV6Vrf class
Raises
------
- ServerError: The server has encountered an uncategorized error condition | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | BgpV6Vrf | rfrye-github/ixnetwork_restpy | python | @property
def BgpV6Vrf(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpv6vrf_1d6029d380b737c5ce1f12d2ed82f3ed.BgpV6Vrf): An instance of the BgpV6Vrf class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.bgpv6vrf_1d6029d380b737c5ce1f12d2ed82f3ed import BgpV6Vrf
return BgpV6Vrf(self) |
@property
def Connector(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.connector_d0d942810e4010add7642d3914a1f29b.Connector): An instance of the Connector class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.connector_d0d942810e4010add7642d3914a1f29b import Connector
return Connector(self) | 6,783,369,117,556,820,000 | Returns
-------
- obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.connector_d0d942810e4010add7642d3914a1f29b.Connector): An instance of the Connector class
Raises
------
- ServerError: The server has encountered an uncategorized error condition | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | Connector | rfrye-github/ixnetwork_restpy | python | @property
def Connector(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.connector_d0d942810e4010add7642d3914a1f29b.Connector): An instance of the Connector class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.connector_d0d942810e4010add7642d3914a1f29b import Connector
return Connector(self) |
@property
def FlexAlgoColorMappingTemplate(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.flexalgocolormappingtemplate_8e0816b88fc7b32d81aaa2e2335895f1.FlexAlgoColorMappingTemplate): An instance of the FlexAlgoColorMappingTemplate class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.flexalgocolormappingtemplate_8e0816b88fc7b32d81aaa2e2335895f1 import FlexAlgoColorMappingTemplate
return FlexAlgoColorMappingTemplate(self)._select() | 8,741,643,204,530,978,000 | Returns
-------
- obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.flexalgocolormappingtemplate_8e0816b88fc7b32d81aaa2e2335895f1.FlexAlgoColorMappingTemplate): An instance of the FlexAlgoColorMappingTemplate class
Raises
------
- ServerError: The server has encountered an uncategorized error condition | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | FlexAlgoColorMappingTemplate | rfrye-github/ixnetwork_restpy | python | @property
def FlexAlgoColorMappingTemplate(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.flexalgocolormappingtemplate_8e0816b88fc7b32d81aaa2e2335895f1.FlexAlgoColorMappingTemplate): An instance of the FlexAlgoColorMappingTemplate class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.flexalgocolormappingtemplate_8e0816b88fc7b32d81aaa2e2335895f1 import FlexAlgoColorMappingTemplate
return FlexAlgoColorMappingTemplate(self)._select() |
@property
def LearnedInfo(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.learnedinfo.learnedinfo_ff4d5e5643a63bccb40b6cf64fc58100.LearnedInfo): An instance of the LearnedInfo class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.learnedinfo.learnedinfo_ff4d5e5643a63bccb40b6cf64fc58100 import LearnedInfo
return LearnedInfo(self) | 7,549,900,077,694,341,000 | Returns
-------
- obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.learnedinfo.learnedinfo_ff4d5e5643a63bccb40b6cf64fc58100.LearnedInfo): An instance of the LearnedInfo class
Raises
------
- ServerError: The server has encountered an uncategorized error condition | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | LearnedInfo | rfrye-github/ixnetwork_restpy | python | @property
def LearnedInfo(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.learnedinfo.learnedinfo_ff4d5e5643a63bccb40b6cf64fc58100.LearnedInfo): An instance of the LearnedInfo class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.learnedinfo.learnedinfo_ff4d5e5643a63bccb40b6cf64fc58100 import LearnedInfo
return LearnedInfo(self) |
@property
def TlvProfile(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.tlvprofile.tlvprofile_69db000d3ef3b060f5edc387b878736c.TlvProfile): An instance of the TlvProfile class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.tlvprofile.tlvprofile_69db000d3ef3b060f5edc387b878736c import TlvProfile
return TlvProfile(self) | 5,812,676,477,857,461,000 | Returns
-------
- obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.tlvprofile.tlvprofile_69db000d3ef3b060f5edc387b878736c.TlvProfile): An instance of the TlvProfile class
Raises
------
- ServerError: The server has encountered an uncategorized error condition | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | TlvProfile | rfrye-github/ixnetwork_restpy | python | @property
def TlvProfile(self):
'\n Returns\n -------\n - obj(uhd_restpy.testplatform.sessions.ixnetwork.topology.tlvprofile.tlvprofile_69db000d3ef3b060f5edc387b878736c.TlvProfile): An instance of the TlvProfile class\n\n Raises\n ------\n - ServerError: The server has encountered an uncategorized error condition\n '
from uhd_restpy.testplatform.sessions.ixnetwork.topology.tlvprofile.tlvprofile_69db000d3ef3b060f5edc387b878736c import TlvProfile
return TlvProfile(self) |
@property
def ActAsRestarted(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Act as restarted\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['ActAsRestarted'])) | -7,196,879,219,354,280,000 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): Act as restarted | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | ActAsRestarted | rfrye-github/ixnetwork_restpy | python | @property
def ActAsRestarted(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Act as restarted\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['ActAsRestarted'])) |
@property
def Active(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Activate/Deactivate Configuration\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['Active'])) | -8,614,067,439,674,340,000 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): Activate/Deactivate Configuration | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | Active | rfrye-github/ixnetwork_restpy | python | @property
def Active(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Activate/Deactivate Configuration\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['Active'])) |
@property
def AdvSrv6SidInIgp(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Advertise SRv6 SID in IGP\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['AdvSrv6SidInIgp'])) | 7,843,939,858,331,869,000 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): Advertise SRv6 SID in IGP | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | AdvSrv6SidInIgp | rfrye-github/ixnetwork_restpy | python | @property
def AdvSrv6SidInIgp(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Advertise SRv6 SID in IGP\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['AdvSrv6SidInIgp'])) |
@property
def AdvertiseEndOfRib(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Advertise End-Of-RIB\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['AdvertiseEndOfRib'])) | -568,183,110,144,396,500 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): Advertise End-Of-RIB | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | AdvertiseEndOfRib | rfrye-github/ixnetwork_restpy | python | @property
def AdvertiseEndOfRib(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Advertise End-Of-RIB\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['AdvertiseEndOfRib'])) |
@property
def AdvertiseEvpnRoutesForOtherVtep(self):
'\n Returns\n -------\n - bool: Advertise EVPN routes for other VTEPS\n '
return self._get_attribute(self._SDM_ATT_MAP['AdvertiseEvpnRoutesForOtherVtep']) | -327,058,035,595,677,000 | Returns
-------
- bool: Advertise EVPN routes for other VTEPS | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | AdvertiseEvpnRoutesForOtherVtep | rfrye-github/ixnetwork_restpy | python | @property
def AdvertiseEvpnRoutesForOtherVtep(self):
'\n Returns\n -------\n - bool: Advertise EVPN routes for other VTEPS\n '
return self._get_attribute(self._SDM_ATT_MAP['AdvertiseEvpnRoutesForOtherVtep']) |
@property
def AdvertiseSRv6SID(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Advertise SRv6 SID\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['AdvertiseSRv6SID'])) | 1,427,049,423,402,907,600 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): Advertise SRv6 SID | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | AdvertiseSRv6SID | rfrye-github/ixnetwork_restpy | python | @property
def AdvertiseSRv6SID(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Advertise SRv6 SID\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['AdvertiseSRv6SID'])) |
@property
def AdvertiseTunnelEncapsulationExtendedCommunity(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Advertise Tunnel Encapsulation Extended Community\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['AdvertiseTunnelEncapsulationExtendedCommunity'])) | 2,813,584,264,658,598,400 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): Advertise Tunnel Encapsulation Extended Community | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | AdvertiseTunnelEncapsulationExtendedCommunity | rfrye-github/ixnetwork_restpy | python | @property
def AdvertiseTunnelEncapsulationExtendedCommunity(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Advertise Tunnel Encapsulation Extended Community\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['AdvertiseTunnelEncapsulationExtendedCommunity'])) |
@property
def AlwaysIncludeTunnelEncExtCommunity(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Always Include Tunnel Encapsulation Extended Community\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['AlwaysIncludeTunnelEncExtCommunity'])) | -1,722,546,325,876,228,400 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): Always Include Tunnel Encapsulation Extended Community | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | AlwaysIncludeTunnelEncExtCommunity | rfrye-github/ixnetwork_restpy | python | @property
def AlwaysIncludeTunnelEncExtCommunity(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Always Include Tunnel Encapsulation Extended Community\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['AlwaysIncludeTunnelEncExtCommunity'])) |
@property
def AsSetMode(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): AS# Set Mode\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['AsSetMode'])) | 3,627,613,641,122,489,000 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): AS# Set Mode | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | AsSetMode | rfrye-github/ixnetwork_restpy | python | @property
def AsSetMode(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): AS# Set Mode\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['AsSetMode'])) |
@property
def Authentication(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Authentication Type\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['Authentication'])) | -8,498,841,170,008,673,000 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): Authentication Type | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | Authentication | rfrye-github/ixnetwork_restpy | python | @property
def Authentication(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Authentication Type\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['Authentication'])) |
@property
def AutoGenSegmentLeftValue(self):
'\n Returns\n -------\n - bool: If enabled then Segment Left field value will be auto generated\n '
return self._get_attribute(self._SDM_ATT_MAP['AutoGenSegmentLeftValue']) | -2,350,733,040,861,744,000 | Returns
-------
- bool: If enabled then Segment Left field value will be auto generated | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | AutoGenSegmentLeftValue | rfrye-github/ixnetwork_restpy | python | @property
def AutoGenSegmentLeftValue(self):
'\n Returns\n -------\n - bool: If enabled then Segment Left field value will be auto generated\n '
return self._get_attribute(self._SDM_ATT_MAP['AutoGenSegmentLeftValue']) |
@property
def BgpFsmState(self):
'\n Returns\n -------\n - list(str[active | connect | error | established | idle | none | openConfirm | openSent]): Logs additional information about the BGP Peer State\n '
return self._get_attribute(self._SDM_ATT_MAP['BgpFsmState']) | -7,621,347,124,457,967,000 | Returns
-------
- list(str[active | connect | error | established | idle | none | openConfirm | openSent]): Logs additional information about the BGP Peer State | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | BgpFsmState | rfrye-github/ixnetwork_restpy | python | @property
def BgpFsmState(self):
'\n Returns\n -------\n - list(str[active | connect | error | established | idle | none | openConfirm | openSent]): Logs additional information about the BGP Peer State\n '
return self._get_attribute(self._SDM_ATT_MAP['BgpFsmState']) |
@property
def BgpId(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): BGP ID\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['BgpId'])) | 9,043,268,046,621,933,000 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): BGP ID | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | BgpId | rfrye-github/ixnetwork_restpy | python | @property
def BgpId(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): BGP ID\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['BgpId'])) |
@property
def BgpLsAsSetMode(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): AS# Set Mode\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['BgpLsAsSetMode'])) | 319,127,661,016,352,300 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): AS# Set Mode | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | BgpLsAsSetMode | rfrye-github/ixnetwork_restpy | python | @property
def BgpLsAsSetMode(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): AS# Set Mode\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['BgpLsAsSetMode'])) |
@property
def BgpLsEnableAsPathSegments(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Enable AS Path Segments\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['BgpLsEnableAsPathSegments'])) | 2,265,162,943,682,732,500 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): Enable AS Path Segments | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | BgpLsEnableAsPathSegments | rfrye-github/ixnetwork_restpy | python | @property
def BgpLsEnableAsPathSegments(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Enable AS Path Segments\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['BgpLsEnableAsPathSegments'])) |
@property
def BgpLsEnableCluster(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Enable Cluster\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['BgpLsEnableCluster'])) | 6,132,178,046,963,054,000 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): Enable Cluster | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | BgpLsEnableCluster | rfrye-github/ixnetwork_restpy | python | @property
def BgpLsEnableCluster(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Enable Cluster\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['BgpLsEnableCluster'])) |
@property
def BgpLsEnableExtendedCommunity(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Enable Extended Community\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['BgpLsEnableExtendedCommunity'])) | 8,942,937,420,216,711,000 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): Enable Extended Community | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | BgpLsEnableExtendedCommunity | rfrye-github/ixnetwork_restpy | python | @property
def BgpLsEnableExtendedCommunity(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Enable Extended Community\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['BgpLsEnableExtendedCommunity'])) |
@property
def BgpLsNoOfASPathSegments(self):
'\n Returns\n -------\n - number: Number Of AS Path Segments Per Route Range\n '
return self._get_attribute(self._SDM_ATT_MAP['BgpLsNoOfASPathSegments']) | -8,530,864,123,651,886,000 | Returns
-------
- number: Number Of AS Path Segments Per Route Range | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | BgpLsNoOfASPathSegments | rfrye-github/ixnetwork_restpy | python | @property
def BgpLsNoOfASPathSegments(self):
'\n Returns\n -------\n - number: Number Of AS Path Segments Per Route Range\n '
return self._get_attribute(self._SDM_ATT_MAP['BgpLsNoOfASPathSegments']) |
@property
def BgpLsNoOfClusters(self):
'\n Returns\n -------\n - number: Number of Clusters\n '
return self._get_attribute(self._SDM_ATT_MAP['BgpLsNoOfClusters']) | -3,051,049,339,947,409,000 | Returns
-------
- number: Number of Clusters | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | BgpLsNoOfClusters | rfrye-github/ixnetwork_restpy | python | @property
def BgpLsNoOfClusters(self):
'\n Returns\n -------\n - number: Number of Clusters\n '
return self._get_attribute(self._SDM_ATT_MAP['BgpLsNoOfClusters']) |
@property
def BgpLsNoOfCommunities(self):
'\n Returns\n -------\n - number: Number of Communities\n '
return self._get_attribute(self._SDM_ATT_MAP['BgpLsNoOfCommunities']) | -5,189,109,858,748,717,000 | Returns
-------
- number: Number of Communities | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | BgpLsNoOfCommunities | rfrye-github/ixnetwork_restpy | python | @property
def BgpLsNoOfCommunities(self):
'\n Returns\n -------\n - number: Number of Communities\n '
return self._get_attribute(self._SDM_ATT_MAP['BgpLsNoOfCommunities']) |
@property
def BgpLsOverridePeerAsSetMode(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Override Peer AS# Set Mode\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['BgpLsOverridePeerAsSetMode'])) | -5,136,637,764,748,780,000 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): Override Peer AS# Set Mode | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | BgpLsOverridePeerAsSetMode | rfrye-github/ixnetwork_restpy | python | @property
def BgpLsOverridePeerAsSetMode(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Override Peer AS# Set Mode\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['BgpLsOverridePeerAsSetMode'])) |
@property
def BgpUnnumbered(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): If enabled, BGP local IP will be Link-local IP.\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['BgpUnnumbered'])) | 3,803,989,257,556,558,000 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): If enabled, BGP local IP will be Link-local IP. | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | BgpUnnumbered | rfrye-github/ixnetwork_restpy | python | @property
def BgpUnnumbered(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): If enabled, BGP local IP will be Link-local IP.\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['BgpUnnumbered'])) |
@property
def CapabilityIpV4Mdt(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): IPv4 BGP MDT: AFI = 1, SAFI = 66\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityIpV4Mdt'])) | 4,725,452,127,750,323,000 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): IPv4 BGP MDT: AFI = 1, SAFI = 66 | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | CapabilityIpV4Mdt | rfrye-github/ixnetwork_restpy | python | @property
def CapabilityIpV4Mdt(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): IPv4 BGP MDT: AFI = 1, SAFI = 66\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityIpV4Mdt'])) |
@property
def CapabilityIpV4Mpls(self):
'DEPRECATED \n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): IPv4 MPLS\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityIpV4Mpls'])) | 2,653,988,765,480,852,000 | DEPRECATED
Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): IPv4 MPLS | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | CapabilityIpV4Mpls | rfrye-github/ixnetwork_restpy | python | @property
def CapabilityIpV4Mpls(self):
'DEPRECATED \n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): IPv4 MPLS\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityIpV4Mpls'])) |
@property
def CapabilityIpV4MplsVpn(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): IPv4 MPLS VPN Capability: AFI=1,SAFI=128\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityIpV4MplsVpn'])) | 7,705,672,281,504,060,000 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): IPv4 MPLS VPN Capability: AFI=1,SAFI=128 | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | CapabilityIpV4MplsVpn | rfrye-github/ixnetwork_restpy | python | @property
def CapabilityIpV4MplsVpn(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): IPv4 MPLS VPN Capability: AFI=1,SAFI=128\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityIpV4MplsVpn'])) |
@property
def CapabilityIpV4Multicast(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): IPv4 Multicast Capability: AFI=1,SAFI=2\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityIpV4Multicast'])) | -5,959,574,163,894,074,000 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): IPv4 Multicast Capability: AFI=1,SAFI=2 | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | CapabilityIpV4Multicast | rfrye-github/ixnetwork_restpy | python | @property
def CapabilityIpV4Multicast(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): IPv4 Multicast Capability: AFI=1,SAFI=2\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityIpV4Multicast'])) |
@property
def CapabilityIpV4MulticastVpn(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): IP MCAST-VPN: AFI = 1, SAFI = 5\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityIpV4MulticastVpn'])) | -1,670,850,077,124,506,000 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): IP MCAST-VPN: AFI = 1, SAFI = 5 | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | CapabilityIpV4MulticastVpn | rfrye-github/ixnetwork_restpy | python | @property
def CapabilityIpV4MulticastVpn(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): IP MCAST-VPN: AFI = 1, SAFI = 5\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityIpV4MulticastVpn'])) |
@property
def CapabilityIpV4Unicast(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): IPv4 Unicast Capability: AFI=1,SAFI=1\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityIpV4Unicast'])) | -2,234,620,909,009,305,300 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): IPv4 Unicast Capability: AFI=1,SAFI=1 | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | CapabilityIpV4Unicast | rfrye-github/ixnetwork_restpy | python | @property
def CapabilityIpV4Unicast(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): IPv4 Unicast Capability: AFI=1,SAFI=1\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityIpV4Unicast'])) |
@property
def CapabilityIpV6Mpls(self):
'DEPRECATED \n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): IPv6 MPLS\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityIpV6Mpls'])) | 4,050,921,797,112,284,700 | DEPRECATED
Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): IPv6 MPLS | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | CapabilityIpV6Mpls | rfrye-github/ixnetwork_restpy | python | @property
def CapabilityIpV6Mpls(self):
'DEPRECATED \n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): IPv6 MPLS\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityIpV6Mpls'])) |
@property
def CapabilityIpV6MplsVpn(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): IPv6 MPLS VPN Capability: AFI=2,SAFI=128\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityIpV6MplsVpn'])) | -7,248,043,999,864,903,000 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): IPv6 MPLS VPN Capability: AFI=2,SAFI=128 | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | CapabilityIpV6MplsVpn | rfrye-github/ixnetwork_restpy | python | @property
def CapabilityIpV6MplsVpn(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): IPv6 MPLS VPN Capability: AFI=2,SAFI=128\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityIpV6MplsVpn'])) |
@property
def CapabilityIpV6Multicast(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): IPv6 Multicast Capability: AFI=2,SAFI=2\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityIpV6Multicast'])) | 7,636,897,105,456,212,000 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): IPv6 Multicast Capability: AFI=2,SAFI=2 | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | CapabilityIpV6Multicast | rfrye-github/ixnetwork_restpy | python | @property
def CapabilityIpV6Multicast(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): IPv6 Multicast Capability: AFI=2,SAFI=2\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityIpV6Multicast'])) |
@property
def CapabilityIpV6MulticastVpn(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): IP6 MCAST-VPN: AFI = 2, SAFI = 5\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityIpV6MulticastVpn'])) | 4,273,521,640,843,206,000 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): IP6 MCAST-VPN: AFI = 2, SAFI = 5 | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | CapabilityIpV6MulticastVpn | rfrye-github/ixnetwork_restpy | python | @property
def CapabilityIpV6MulticastVpn(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): IP6 MCAST-VPN: AFI = 2, SAFI = 5\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityIpV6MulticastVpn'])) |
@property
def CapabilityIpV6Unicast(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): IPv6 Unicast Capability: AFI=2,SAFI=1\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityIpV6Unicast'])) | 6,578,704,941,314,357,000 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): IPv6 Unicast Capability: AFI=2,SAFI=1 | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | CapabilityIpV6Unicast | rfrye-github/ixnetwork_restpy | python | @property
def CapabilityIpV6Unicast(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): IPv6 Unicast Capability: AFI=2,SAFI=1\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityIpV6Unicast'])) |
@property
def CapabilityIpv4MplsAddPath(self):
'\n Returns\n -------\n - bool: IPv4 MPLS Add Path Capability\n '
return self._get_attribute(self._SDM_ATT_MAP['CapabilityIpv4MplsAddPath']) | 5,448,256,857,143,750,000 | Returns
-------
- bool: IPv4 MPLS Add Path Capability | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | CapabilityIpv4MplsAddPath | rfrye-github/ixnetwork_restpy | python | @property
def CapabilityIpv4MplsAddPath(self):
'\n Returns\n -------\n - bool: IPv4 MPLS Add Path Capability\n '
return self._get_attribute(self._SDM_ATT_MAP['CapabilityIpv4MplsAddPath']) |
@property
def CapabilityIpv4UnicastAddPath(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Check box for IPv4 Unicast Add Path\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityIpv4UnicastAddPath'])) | 4,481,523,749,071,057,000 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): Check box for IPv4 Unicast Add Path | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | CapabilityIpv4UnicastAddPath | rfrye-github/ixnetwork_restpy | python | @property
def CapabilityIpv4UnicastAddPath(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Check box for IPv4 Unicast Add Path\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityIpv4UnicastAddPath'])) |
@property
def CapabilityIpv6MplsAddPath(self):
'\n Returns\n -------\n - bool: IPv6 MPLS Add Path Capability\n '
return self._get_attribute(self._SDM_ATT_MAP['CapabilityIpv6MplsAddPath']) | -468,016,014,134,343,900 | Returns
-------
- bool: IPv6 MPLS Add Path Capability | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | CapabilityIpv6MplsAddPath | rfrye-github/ixnetwork_restpy | python | @property
def CapabilityIpv6MplsAddPath(self):
'\n Returns\n -------\n - bool: IPv6 MPLS Add Path Capability\n '
return self._get_attribute(self._SDM_ATT_MAP['CapabilityIpv6MplsAddPath']) |
@property
def CapabilityIpv6UnicastAddPath(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Check box for IPv6 Unicast Add Path\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityIpv6UnicastAddPath'])) | 6,929,437,793,636,300,000 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): Check box for IPv6 Unicast Add Path | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | CapabilityIpv6UnicastAddPath | rfrye-github/ixnetwork_restpy | python | @property
def CapabilityIpv6UnicastAddPath(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Check box for IPv6 Unicast Add Path\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityIpv6UnicastAddPath'])) |
@property
def CapabilityLinkStateNonVpn(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Link State Non-VPN Capability: AFI=16388,SAFI=71\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityLinkStateNonVpn'])) | -236,741,811,375,229,800 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): Link State Non-VPN Capability: AFI=16388,SAFI=71 | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | CapabilityLinkStateNonVpn | rfrye-github/ixnetwork_restpy | python | @property
def CapabilityLinkStateNonVpn(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Link State Non-VPN Capability: AFI=16388,SAFI=71\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityLinkStateNonVpn'])) |
@property
def CapabilityLinkStateVpn(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Select this check box to enable Link State VPN capability on the router.AFI=16388 and SAFI=72 values will be supported.\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityLinkStateVpn'])) | 9,103,111,205,149,441,000 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): Select this check box to enable Link State VPN capability on the router.AFI=16388 and SAFI=72 values will be supported. | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | CapabilityLinkStateVpn | rfrye-github/ixnetwork_restpy | python | @property
def CapabilityLinkStateVpn(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Select this check box to enable Link State VPN capability on the router.AFI=16388 and SAFI=72 values will be supported.\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityLinkStateVpn'])) |
@property
def CapabilityNHEncodingCapabilities(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Extended Next Hop Encoding Capability which needs to be used when advertising IPv4 or VPN-IPv4 routes over IPv6 Core\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityNHEncodingCapabilities'])) | 8,351,961,515,150,855,000 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): Extended Next Hop Encoding Capability which needs to be used when advertising IPv4 or VPN-IPv4 routes over IPv6 Core | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | CapabilityNHEncodingCapabilities | rfrye-github/ixnetwork_restpy | python | @property
def CapabilityNHEncodingCapabilities(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Extended Next Hop Encoding Capability which needs to be used when advertising IPv4 or VPN-IPv4 routes over IPv6 Core\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityNHEncodingCapabilities'])) |
@property
def CapabilityRouteConstraint(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Route Constraint Capability: AFI=1,SAFI=132\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityRouteConstraint'])) | 7,900,999,350,622,410,000 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): Route Constraint Capability: AFI=1,SAFI=132 | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | CapabilityRouteConstraint | rfrye-github/ixnetwork_restpy | python | @property
def CapabilityRouteConstraint(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Route Constraint Capability: AFI=1,SAFI=132\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityRouteConstraint'])) |
@property
def CapabilityRouteRefresh(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Route Refresh\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityRouteRefresh'])) | 5,150,408,324,567,939,000 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): Route Refresh | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | CapabilityRouteRefresh | rfrye-github/ixnetwork_restpy | python | @property
def CapabilityRouteRefresh(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): Route Refresh\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityRouteRefresh'])) |
@property
def CapabilitySRTEPoliciesV4(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): IPv4 SR TE Policy Capability: AFI=1,SAFI=73\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilitySRTEPoliciesV4'])) | 4,357,890,466,959,535,000 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): IPv4 SR TE Policy Capability: AFI=1,SAFI=73 | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | CapabilitySRTEPoliciesV4 | rfrye-github/ixnetwork_restpy | python | @property
def CapabilitySRTEPoliciesV4(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): IPv4 SR TE Policy Capability: AFI=1,SAFI=73\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilitySRTEPoliciesV4'])) |
@property
def CapabilitySRTEPoliciesV6(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): IPv6 SR TE Policy Capability: AFI=2,SAFI=73\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilitySRTEPoliciesV6'])) | -281,317,356,902,695,460 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): IPv6 SR TE Policy Capability: AFI=2,SAFI=73 | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | CapabilitySRTEPoliciesV6 | rfrye-github/ixnetwork_restpy | python | @property
def CapabilitySRTEPoliciesV6(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): IPv6 SR TE Policy Capability: AFI=2,SAFI=73\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilitySRTEPoliciesV6'])) |
@property
def CapabilityVpls(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): VPLS Capability: AFI = 25, SAFI = 65\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityVpls'])) | 2,527,981,225,844,211,000 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): VPLS Capability: AFI = 25, SAFI = 65 | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | CapabilityVpls | rfrye-github/ixnetwork_restpy | python | @property
def CapabilityVpls(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): VPLS Capability: AFI = 25, SAFI = 65\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['CapabilityVpls'])) |
@property
def Capabilityipv4UnicastFlowSpec(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): IPv4 Unicast Flow Spec Capability: AFI=1,SAFI=133\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['Capabilityipv4UnicastFlowSpec'])) | 432,845,826,204,110,460 | Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): IPv4 Unicast Flow Spec Capability: AFI=1,SAFI=133 | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | Capabilityipv4UnicastFlowSpec | rfrye-github/ixnetwork_restpy | python | @property
def Capabilityipv4UnicastFlowSpec(self):
'\n Returns\n -------\n - obj(uhd_restpy.multivalue.Multivalue): IPv4 Unicast Flow Spec Capability: AFI=1,SAFI=133\n '
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['Capabilityipv4UnicastFlowSpec'])) |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.