def _print_Permutation(self, expr): from sympy.combinatorics.permutations import Permutation, Cycle if Permutation.print_cyclic: if not expr.size: return "()" # before taking Cycle notation, see if the last element is # a singleton and move it to the head of the string s = Cycle(expr)(expr.size - 1).__repr__()[len("Cycle") :] last = s.rfind("(") if not last == 0 and "," not in s[last:]: s = s[last:] + s[:last] s = s.replace(",", "") return s else: s = expr.support() if not s: if expr.size < 5: return "Permutation(%s)" % str(expr.array_form) return "Permutation([], size=%s)" % expr.size trim = str(expr.array_form[: s[-1] + 1]) + ", size=%s" % expr.size use = full = str(expr.array_form) if len(trim) < len(full): use = trim return "Permutation(%s)" % use
def _print_Permutation(self, expr): from sympy.combinatorics.permutations import Permutation, Cycle if Permutation.print_cyclic: if not expr.size: return 'Permutation()' # before taking Cycle notation, see if the last element is # a singleton and move it to the head of the string s = Cycle(expr)(expr.size - 1).__repr__()[len('Cycle'):] last = s.rfind('(') if not last == 0 and ',' not in s[last:]: s = s[last:] + s[:last] return 'Permutation%s' % s else: s = expr.support() if not s: if expr.size < 5: return 'Permutation(%s)' % str(expr.array_form) return 'Permutation([], size=%s)' % expr.size trim = str(expr.array_form[:s[-1] + 1]) + ', size=%s' % expr.size use = full = str(expr.array_form) if len(trim) < len(full): use = trim return 'Permutation(%s)' % use
def _print_Permutation(self, expr): from sympy.combinatorics.permutations import Permutation, Cycle if Permutation.print_cyclic: if not expr.size: return '()' # before taking Cycle notation, see if the last element is # a singleton and move it to the head of the string s = Cycle(expr)(expr.size - 1).__repr__()[len('Cycle'):] last = s.rfind('(') if not last == 0 and ',' not in s[last:]: s = s[last:] + s[:last] s = s.replace(',', '') return s else: s = expr.support() if not s: if expr.size < 5: return 'Permutation(%s)' % str(expr.array_form) return 'Permutation([], size=%s)' % expr.size trim = str(expr.array_form[:s[-1] + 1]) + ', size=%s' % expr.size use = full = str(expr.array_form) if len(trim) < len(full): use = trim return 'Permutation(%s)' % use
def _print_Permutation(self, expr): from sympy.combinatorics.permutations import Permutation, Cycle from sympy.utilities.exceptions import SymPyDeprecationWarning perm_cyclic = Permutation.print_cyclic if perm_cyclic is not None: SymPyDeprecationWarning( feature="Permutation.print_cyclic = {}".format(perm_cyclic), useinstead="init_printing(perm_cyclic={})".format(perm_cyclic), issue=15201, deprecated_since_version="1.6", ).warn() else: perm_cyclic = self._settings.get("perm_cyclic", True) if perm_cyclic: if not expr.size: return "Permutation()" # before taking Cycle notation, see if the last element is # a singleton and move it to the head of the string s = Cycle(expr)(expr.size - 1).__repr__()[len("Cycle") :] last = s.rfind("(") if not last == 0 and "," not in s[last:]: s = s[last:] + s[:last] return "Permutation%s" % s else: s = expr.support() if not s: if expr.size < 5: return "Permutation(%s)" % str(expr.array_form) return "Permutation([], size=%s)" % expr.size trim = str(expr.array_form[: s[-1] + 1]) + ", size=%s" % expr.size use = full = str(expr.array_form) if len(trim) < len(full): use = trim return "Permutation(%s)" % use