本文整理汇总了Python中stringpict.stringPict.next函数的典型用法代码示例。如果您正苦于以下问题:Python next函数的具体用法?Python next怎么用?Python next使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了next函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _print_Add
def _print_Add(self, sum):
args = list(sum.args)
args.sort(Basic._compare_pretty)
pforms = []
for x in args:
# Check for negative "things" so that this information can be enforce upon
# the pretty form so that it can be made of use (such as in a sum).
if x.is_Mul and x.as_coeff_terms()[0] < 0:
pform1 = self._print(-x)
if len(pforms) == 0:
if pform1.height() > 1:
pform2 = '- '
else:
pform2 = '-'
else:
pform2 = ' - '
pform = stringPict.next(pform2, pform1)
pforms.append(prettyForm(binding=prettyForm.NEG, *pform))
elif x.is_Number and x < 0:
pform1 = self._print(-x)
if len(pforms) == 0:
if pform1.height() > 1:
pform2 = '- '
else:
pform2 = '-'
pform = stringPict.next(pform2, pform1)
else:
pform = stringPict.next(' - ', pform1)
pforms.append(prettyForm(binding=prettyForm.NEG, *pform))
else:
pforms.append(self._print(x))
return prettyForm.__add__(*pforms)
开发者ID:jcockayne,项目名称:sympy-rkern,代码行数:32,代码来源:pretty.py
示例2: __print_set
def __print_set(self, s):
items = list(s)
items.sort( Basic.compare_pretty )
S = self._print_seq(items, '(', ')')
S = prettyForm(*stringPict.next(type(s).__name__, S))
return S
开发者ID:jcockayne,项目名称:sympy-rkern,代码行数:7,代码来源:pretty.py
示例3: __print_set
def __print_set(self, set_):
items = list(set_)
items.sort( key=cmp_to_key(Basic.compare_pretty) )
s = self._print_seq(items, '(', ')')
s = prettyForm(*stringPict.next(type(set_).__name__, s))
return s
开发者ID:TeddyBoomer,项目名称:wxgeometrie,代码行数:7,代码来源:pretty.py
示例4: _print_Derivative
def _print_Derivative(self, deriv):
# XXX use U('PARTIAL DIFFERENTIAL') here ?
syms = list(reversed(deriv.variables))
x = None
for sym, num in group(syms, multiple=False):
s = self._print(sym)
ds = prettyForm(*s.left('d'))
if num > 1:
ds = ds**prettyForm(str(num))
if x is None:
x = ds
else:
x = prettyForm(*x.right(' '))
x = prettyForm(*x.right(ds))
f = prettyForm(binding=prettyForm.FUNC, *self._print(deriv.expr).parens())
pform = prettyForm('d')
if len(syms) > 1:
pform = pform**prettyForm(str(len(syms)))
pform = prettyForm(*pform.below(stringPict.LINE, x))
pform.baseline = pform.baseline + 1
pform = prettyForm(*stringPict.next(pform, f))
return pform
开发者ID:TeddyBoomer,项目名称:wxgeometrie,代码行数:30,代码来源:pretty.py
示例5: __print_set
def __print_set(self, set_):
items = list(set_)
items.sort(Basic.compare_pretty)
s = self._print_seq(items, "(", ")")
s = prettyForm(*stringPict.next(type(set_).__name__, s))
return s
开发者ID:zworkb,项目名称:sympy,代码行数:7,代码来源:pretty.py
示例6: _print_Derivative
def _print_Derivative(self, deriv):
# XXX use U('PARTIAL DIFFERENTIAL') here ?
syms = list(deriv.symbols)
syms.reverse()
x = None
for sym in syms:
s = self._print(sym)
ds = prettyForm(*s.left('d'))
if x is None:
x = ds
else:
x = prettyForm(*x.right(' '))
x = prettyForm(*x.right(ds))
f = prettyForm(binding=prettyForm.FUNC, *self._print(deriv.expr).parens())
pform = prettyForm('d')
if len(syms) > 1:
pform = pform ** prettyForm(str(len(deriv.symbols)))
pform = prettyForm(*pform.below(stringPict.LINE, x))
pform.baseline = pform.baseline + 1
pform = prettyForm(*stringPict.next(pform, f))
return pform
开发者ID:Sumith1896,项目名称:sympy-polys,代码行数:25,代码来源:pretty.py
示例7: _print_Relational
def _print_Relational(self, e):
op = prettyForm(' ' + xsym(e.rel_op) + ' ')
l = self._print(e.lhs)
r = self._print(e.rhs)
pform = prettyForm(*stringPict.next(l, op, r))
return pform
开发者ID:TeddyBoomer,项目名称:wxgeometrie,代码行数:7,代码来源:pretty.py
示例8: _print_seq
def _print_seq(self, seq, left=None, right=None, delimiter=', '):
s = None
for item in seq:
pform = self._print(item)
if s is None:
# first element
s = pform
else:
s = prettyForm(*stringPict.next(s, delimiter))
s = prettyForm(*stringPict.next(s, pform))
if s is None:
s = stringPict('')
s = prettyForm(*s.parens(left, right, ifascii_nougly=True))
return s
开发者ID:Sumith1896,项目名称:sympy-polys,代码行数:18,代码来源:pretty.py
示例9: _print_seq
def _print_seq(self, seq, left=None, right=None):
S = None
for item in seq:
pform = self._print(item)
if S is None:
# first element
S = pform
else:
S = prettyForm(*stringPict.next(S, ', '))
S = prettyForm(*stringPict.next(S, pform))
if S is None:
S = stringPict('')
S = prettyForm(*S.parens(left, right, ifascii_nougly=True))
return S
开发者ID:jcockayne,项目名称:sympy-rkern,代码行数:18,代码来源:pretty.py
示例10: _print_seq
def _print_seq(self, seq, left=None, right=None, delimiter=", ", parenthesize=lambda x: False):
s = None
for item in seq:
pform = self._print(item)
if parenthesize(item):
pform = prettyForm(*pform.parens())
if s is None:
# first element
s = pform
else:
s = prettyForm(*stringPict.next(s, delimiter))
s = prettyForm(*stringPict.next(s, pform))
if s is None:
s = stringPict("")
s = prettyForm(*s.parens(left, right, ifascii_nougly=True))
return s
开发者ID:rhythm-gupta,项目名称:sympy,代码行数:20,代码来源:pretty.py
示例11: _print_dict
def _print_dict(self, d):
items = []
keys = sorted(d.keys(), key=cmp_to_key(Basic.compare_pretty) )
for k in keys:
K = self._print(k)
V = self._print(d[k])
s = prettyForm(*stringPict.next(K, ': ', V))
items.append(s)
return self._print_seq(items, '{', '}')
开发者ID:Narsil,项目名称:sympy,代码行数:12,代码来源:pretty.py
示例12: _print_dict
def _print_dict(self, d):
keys = sorted(d.keys(), key=default_sort_key)
items = []
for k in keys:
K = self._print(k)
V = self._print(d[k])
s = prettyForm(*stringPict.next(K, ': ', V))
items.append(s)
return self._print_seq(items, '{', '}')
开发者ID:meo-meo,项目名称:sympy,代码行数:12,代码来源:pretty.py
示例13: pretty_negative
def pretty_negative(pform, index):
"""Prepend a minus sign to a pretty form. """
if index == 0:
if pform.height() > 1:
pform_neg = '- '
else:
pform_neg = '-'
else:
pform_neg = ' - '
pform = stringPict.next(pform_neg, pform)
return prettyForm(binding=prettyForm.NEG, *pform)
开发者ID:TeddyBoomer,项目名称:wxgeometrie,代码行数:12,代码来源:pretty.py
示例14: _print_Union
def _print_Union(self, u):
other_sets, singletons = [], []
for set in u.args:
if isinstance(set, Interval) and set.measure == 0:
singletons.append(set.start)
else:
other_sets.append(set)
union_delimiter = ' %s ' % pretty_atom('Union')
s2 = self._print_seq(other_sets, None, None, union_delimiter)
if len(singletons) > 0:
s1 = self._print_seq(singletons, '{', '}')
s = prettyForm(*stringPict.next(s1, union_delimiter))
s = prettyForm(*stringPict.next(s, s2))
else:
s = s2
return s
开发者ID:Sumith1896,项目名称:sympy-polys,代码行数:21,代码来源:pretty.py
示例15: _print_Add
def _print_Add(self, expr):
if self.order is None:
terms = sorted(expr.args, Basic._compare_pretty)
else:
terms = [ elt[-1] for elt in self.analyze(expr) ]
pforms = []
for term in terms:
if term.is_Mul and term.as_coeff_terms()[0] < 0:
pform1 = self._print(-term)
if len(pforms) == 0:
if pform1.height() > 1:
pform2 = '- '
else:
pform2 = '-'
else:
pform2 = ' - '
pform = stringPict.next(pform2, pform1)
pforms.append(prettyForm(binding=prettyForm.NEG, *pform))
elif term.is_Number and term < 0:
pform1 = self._print(-term)
if len(pforms) == 0:
if pform1.height() > 1:
pform2 = '- '
else:
pform2 = '-'
pform = stringPict.next(pform2, pform1)
else:
pform = stringPict.next(' - ', pform1)
pforms.append(prettyForm(binding=prettyForm.NEG, *pform))
else:
pforms.append(self._print(term))
return prettyForm.__add__(*pforms)
开发者ID:Sumith1896,项目名称:sympy-polys,代码行数:40,代码来源:pretty.py
示例16: _print_Chi
def _print_Chi(self, e):
# This needs a special case since otherwise it comes out as greek
# letter chi...
prettyFunc = prettyForm("Chi")
prettyArgs = prettyForm(*self._print_seq(e.args).parens())
pform = prettyForm(binding=prettyForm.FUNC, *stringPict.next(prettyFunc, prettyArgs))
# store pform parts so it can be reassembled e.g. when powered
pform.prettyFunc = prettyFunc
pform.prettyArgs = prettyArgs
return pform
开发者ID:Botouls,项目名称:sympy,代码行数:13,代码来源:pretty.py
示例17: _print_dict
def _print_dict(self, d):
items = []
keys = d.keys()
keys.sort( Basic.compare_pretty )
for k in keys:
K = self._print(k)
V = self._print(d[k])
S = prettyForm(*stringPict.next(K, ': ', V))
items.append(S)
return self._print_seq(items, '{', '}')
开发者ID:jcockayne,项目名称:sympy-rkern,代码行数:14,代码来源:pretty.py
示例18: _print_dict
def _print_dict(self, d):
items = []
keys = d.keys()
keys.sort(Basic.compare_pretty)
for k in keys:
K = self._print(k)
V = self._print(d[k])
s = prettyForm(*stringPict.next(K, ": ", V))
items.append(s)
return self._print_seq(items, "{", "}")
开发者ID:zworkb,项目名称:sympy,代码行数:14,代码来源:pretty.py
示例19: _print_Function
def _print_Function(self, e):
# XXX works only for applied functions
func = e.func
args = e.args
func_name = func.__name__
prettyFunc = self._print(C.Symbol(func_name))
prettyArgs = prettyForm(*self._print_seq(args).parens())
pform = prettyForm(binding=prettyForm.FUNC, *stringPict.next(prettyFunc, prettyArgs))
# store pform parts so it can be reassembled e.g. when powered
pform.prettyFunc = prettyFunc
pform.prettyArgs = prettyArgs
return pform
开发者ID:101man,项目名称:sympy,代码行数:17,代码来源:pretty.py
示例20: _print_Lambda
def _print_Lambda(self, e):
symbols, expr = e.args
if len(symbols) == 1:
symbols = self._print(symbols[0])
else:
symbols = self._print(tuple(symbols))
args = (symbols, self._print(expr))
prettyFunc = self._print(C.Symbol("Lambda"))
prettyArgs = prettyForm(*self._print_seq(args).parens())
pform = prettyForm(binding=prettyForm.FUNC, *stringPict.next(prettyFunc, prettyArgs))
# store pform parts so it can be reassembled e.g. when powered
pform.prettyFunc = prettyFunc
pform.prettyArgs = prettyArgs
return pform
开发者ID:TeddyBoomer,项目名称:wxgeometrie,代码行数:20,代码来源:pretty.py
注:本文中的stringpict.stringPict.next函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论