本文整理汇总了Python中sympy.printing.codeprinter.CodePrinter.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python CodePrinter.__init__方法的具体用法?Python CodePrinter.__init__怎么用?Python CodePrinter.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sympy.printing.codeprinter.CodePrinter
的用法示例。
在下文中一共展示了CodePrinter.__init__方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from sympy.printing.codeprinter import CodePrinter [as 别名]
# 或者: from sympy.printing.codeprinter.CodePrinter import __init__ [as 别名]
def __init__(self, settings={}):
CodePrinter.__init__(self, settings)
self.known_functions = dict(known_functions)
userfuncs = settings.get('user_functions', {})
self.known_functions.update(userfuncs)
self._dereference = set(settings.get('dereference', []))
self.reserved_words = set(reserved_words)
示例2: __init__
# 需要导入模块: from sympy.printing.codeprinter import CodePrinter [as 别名]
# 或者: from sympy.printing.codeprinter.CodePrinter import __init__ [as 别名]
def __init__(self, settings={}):
"""Register function mappings supplied by user"""
CodePrinter.__init__(self, settings)
self.known_functions = dict(known_functions)
userfuncs = settings.get('user_functions', {})
for k, v in userfuncs.items():
if not isinstance(v, list):
userfuncs[k] = [(lambda *x: True, v)]
self.known_functions.update(userfuncs)
示例3: __init__
# 需要导入模块: from sympy.printing.codeprinter import CodePrinter [as 别名]
# 或者: from sympy.printing.codeprinter.CodePrinter import __init__ [as 别名]
def __init__(self, settings=None):
CodePrinter.__init__(self, settings)
self._init_leading_padding()
assign_to = self._settings['assign_to']
if isinstance(assign_to, basestring):
self._settings['assign_to'] = C.Symbol(assign_to)
elif not isinstance(assign_to, (C.Basic, type(None))):
raise TypeError("FCodePrinter cannot assign to object of type %s" %
type(assign_to))
示例4: __init__
# 需要导入模块: from sympy.printing.codeprinter import CodePrinter [as 别名]
# 或者: from sympy.printing.codeprinter.CodePrinter import __init__ [as 别名]
def __init__(self, settings={}):
CodePrinter.__init__(self, settings)
self.known_functions = dict(known_functions)
userfuncs = settings.get('user_functions', {})
self.known_functions.update(userfuncs)
# leading columns depend on fixed or free format
if self._settings['source_format'] == 'fixed':
self._lead_code = " "
self._lead_cont = " @ "
self._lead_comment = "C "
elif self._settings['source_format'] == 'free':
self._lead_code = ""
self._lead_cont = " "
self._lead_comment = "! "
else:
raise ValueError("Unknown source format: %s" % self._settings[
'source_format'])
standards = set([66, 77, 90, 95, 2003, 2008])
if self._settings['standard'] not in standards:
raise ValueError("Unknown Fortran standard: %s" % self._settings[
'standard'])
示例5: __init__
# 需要导入模块: from sympy.printing.codeprinter import CodePrinter [as 别名]
# 或者: from sympy.printing.codeprinter.CodePrinter import __init__ [as 别名]
def __init__(self, **kwargs):
"""Register function mappings supplied by user"""
CodePrinter.__init__(self, kwargs)
self.known_functions = dict(known_functions)
示例6: __init__
# 需要导入模块: from sympy.printing.codeprinter import CodePrinter [as 别名]
# 或者: from sympy.printing.codeprinter.CodePrinter import __init__ [as 别名]
def __init__(self, settings={}):
CodePrinter.__init__(self, settings)
self.known_functions = dict(known_functions)
userfuncs = settings.get('user_functions', {})
self.known_functions.update(userfuncs)